Accepting request 1136612 from home:mwilck:branches:Printing

- Update to hplip 3.23.12
  * del fix-printer-attributes-parsing.patch (merged upstream)
  * del hppsfilter-booklet-printing-change-insecure-fixed-tm.patch
    (merged upstream)
- Added support for new printers:  
  * HP OfficeJet Pro 9130b series
  * HP OfficeJet Pro 9120b series
  * HP OfficeJet Pro 9110b series
  * HP Color LaserJet Enterprise Flow MFP X58045z
  * HP Color LaserJet Enterprise Flow MFP X58045zs
  * HP Color LaserJet Enterprise MFP X58045dn 
  * HP Color LaserJet Enterprise MFP X58045
  * HP LaserJet Pro P1106 plus
  * HP LaserJet Pro P1108 plus

OBS-URL: https://build.opensuse.org/request/show/1136612
OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=246
This commit is contained in:
Martin Wilck 2024-01-03 16:39:01 +00:00 committed by Git OBS Bridge
parent 2c19af6ac1
commit fc6be677a6
10 changed files with 69 additions and 315 deletions

4
_service Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0"?><!-- -*- xml -*- -->
<services>
<service name="download_files" mode="manual"/>
</services>

View File

@ -1,73 +0,0 @@
From 0bd5dd829e6f5509fda6cb09430ff14faa432941 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 15 Sep 2023 18:32:08 +0200
Subject: [PATCH 19/19] hplip: fix printer attributes parsing
---
protocol/hp_ipp.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/protocol/hp_ipp.c b/protocol/hp_ipp.c
index 9b05f5e..3ba83fa 100644
--- a/protocol/hp_ipp.c
+++ b/protocol/hp_ipp.c
@@ -43,6 +43,13 @@ Boston, MA 02110-1301, USA.
#define _STRINGIZE(x) #x
#define STRINGIZE(x) _STRINGIZE(x)
+#define hplip_strlcpy(dst, src, size) \
+ do { \
+ if (!memccpy(dst, src, '\0', size)) \
+ dst[size - 1] = '\0'; \
+ } while (0)
+
+
http_t *acquireCupsInstance()
{
if (http == NULL)
@@ -113,7 +120,7 @@ int addCupsPrinter(char *name, char *device_uri, char *location, char *ppd_file,
}
if ( info == NULL )
- snprintf( info,sizeof(info), name );
+ hplip_strlcpy( info, name, sizeof(info));
sprintf(printer_uri, "ipp://localhost/printers/%s", name);
@@ -518,27 +525,27 @@ int __parsePrinterAttributes(ipp_t *response, printer_t **printer_list)
if ( strcmp(attr_name, "printer-name") == 0 &&
val_tag == IPP_TAG_NAME ) {
- snprintf(t_printer->name, sizeof(t_printer->name),ippGetString(attr, 0, NULL) );
+ hplip_strlcpy(t_printer->name, ippGetString(attr, 0, NULL), sizeof(t_printer->name) );
}
else if ( strcmp(attr_name, "device-uri") == 0 &&
val_tag == IPP_TAG_URI ) {
- snprintf(t_printer->device_uri,sizeof(t_printer->device_uri), ippGetString(attr, 0, NULL) );
+ hplip_strlcpy(t_printer->device_uri, ippGetString(attr, 0, NULL), sizeof(t_printer->device_uri) );
}
else if ( strcmp(attr_name, "printer-uri-supported") == 0 &&
val_tag == IPP_TAG_URI ) {
- snprintf(t_printer->printer_uri,sizeof(t_printer->printer_uri), ippGetString(attr, 0, NULL) );
+ hplip_strlcpy(t_printer->printer_uri, ippGetString(attr, 0, NULL), sizeof(t_printer->printer_uri) );
}
else if ( strcmp(attr_name, "printer-info") == 0 &&
val_tag == IPP_TAG_TEXT ) {
- snprintf(t_printer->info,sizeof(t_printer->info), ippGetString(attr, 0, NULL) );
+ hplip_strlcpy(t_printer->info, ippGetString(attr, 0, NULL), sizeof(t_printer->info) );
}
else if ( strcmp(attr_name, "printer-location") == 0 &&
val_tag == IPP_TAG_TEXT ) {
- snprintf(t_printer->location,sizeof(t_printer->location),ippGetString(attr, 0, NULL) );
+ hplip_strlcpy(t_printer->location, ippGetString(attr, 0, NULL), sizeof(t_printer->location) );
}
else if ( strcmp(attr_name, "printer-make-and-model") == 0 &&
val_tag == IPP_TAG_TEXT ) {
- snprintf(t_printer->make_model,sizeof(t_printer->make_model),ippGetString(attr, 0, NULL) );
+ hplip_strlcpy(t_printer->make_model, ippGetString(attr, 0, NULL), sizeof(t_printer->make_model));
}
else if ( strcmp(attr_name, "printer-state") == 0 &&
val_tag == IPP_TAG_ENUM ) {
--
2.42.0

3
hplip-3.23.12.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a76c2ac8deb31ddb5f0da31398d25ac57440928a0692dcb060a48daa718e69ed
size 30162044

6
hplip-3.23.12.tar.gz.asc Normal file
View File

@ -0,0 +1,6 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRKui9m29WpWJSRDgZz13DNpZBHuQUCZWSyogAKCRBz13DNpZBH
uVF7AJwLUoaLa1hTcyzo4hVznR9NQhL/VgCfdNKIqdWCxyZ9ugr8IBptjQ2u1es=
=kO2i
-----END PGP SIGNATURE-----

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f7cc05f628c0cfd750e54ae41431c1dfdd29e97682f18b5c5ba5cb2c5b4b1b46
size 30121648

View File

@ -1,6 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iF0EABECAB0WIQRKui9m29WpWJSRDgZz13DNpZBHuQUCZQE3rQAKCRBz13DNpZBH
uXcAAKCaq7vba92lagYYA6sXL0rUNvkXHgCfeOSP5AY/WM7gG/N2SSTkbCjGwWw=
=SGJw
-----END PGP SIGNATURE-----

View File

@ -1,8 +1,19 @@
Index: hplip-3.22.4/cups_drv.inc
===================================================================
--- hplip-3.22.4.orig/cups_drv.inc
+++ hplip-3.22.4/cups_drv.inc
@@ -411,6 +411,7 @@ cups_ppd_printers = \
From eab655e0f8ab7c7520e0c60970d74e51b25c2061 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 15 Sep 2023 18:31:38 +0200
Subject: [PATCH 18/18] hplip: missing drivers
---
cups_drv.inc | 2 +
data/models/models.dat | 477 ++++++++++++++++++++++++++++++++++++++++-
prnt/drv/hpcups.drv.in | 16 ++
3 files changed, 486 insertions(+), 9 deletions(-)
diff --git a/cups_drv.inc b/cups_drv.inc
index 8a33bfe..dc38978 100644
--- a/cups_drv.inc
+++ b/cups_drv.inc
@@ -414,6 +414,7 @@ cups_ppd_printers = \
ppd/hpcups/hp-laserjet_cm1418fnw-pcl3.ppd.gz \
ppd/hpcups/hp-laserjet_cp1025.ppd.gz \
ppd/hpcups/hp-laserjet_cp1025nw.ppd.gz \
@ -10,7 +21,7 @@ Index: hplip-3.22.4/cups_drv.inc
ppd/hpcups/hp-laserjet_m1005.ppd.gz \
ppd/hpcups/hp-laserjet_m101-m106.ppd.gz \
ppd/hpcups/hp-laserjet_m109-m112.ppd.gz \
@@ -527,6 +528,7 @@ cups_ppd_printers = \
@@ -531,6 +532,7 @@ cups_ppd_printers = \
ppd/hpcups/hp-laserjet_professional_p1607dn.ppd.gz \
ppd/hpcups/hp-laserjet_professional_p1608dn.ppd.gz \
ppd/hpcups/hp-laserjet_professional_p1609dn.ppd.gz \
@ -18,10 +29,10 @@ Index: hplip-3.22.4/cups_drv.inc
ppd/hpcups/hp-laserjet_professional_p_1102w.ppd.gz \
ppd/hpcups/hp-laserjet_tank_1020.ppd.gz \
ppd/hpcups/hp-laserjet_tank_150x.ppd.gz \
Index: hplip-3.22.4/data/models/models.dat
===================================================================
--- hplip-3.22.4.orig/data/models/models.dat
+++ hplip-3.22.4/data/models/models.dat
diff --git a/data/models/models.dat b/data/models/models.dat
index a567fdd..ed89569 100644
--- a/data/models/models.dat
+++ b/data/models/models.dat
@@ -2104,7 +2104,7 @@ usb-pid=411
usb-vid=3f0
wifi-config=0
@ -46,7 +57,7 @@ Index: hplip-3.22.4/data/models/models.dat
ppd-name=hp-laserjet_100_color_mfp_m175-ps.ppd
monitor-type=0
panel-check-type=0
@@ -2165,6 +2157,378 @@ usb-pid=62a
@@ -2218,6 +2210,378 @@ usb-pid=62a
usb-vid=3f0
wifi-config=3
@ -425,7 +436,7 @@ Index: hplip-3.22.4/data/models/models.dat
[officejet_100_mobile_l411]
align-type=-1
clean-type=1
@@ -17867,6 +18231,58 @@ usb-pid=2c17
@@ -17920,6 +18284,58 @@ usb-pid=2c17
usb-vid=3f0
wifi-config=0
@ -484,7 +495,7 @@ Index: hplip-3.22.4/data/models/models.dat
[hp_laserjet_cp1025nw]
align-type=0
clean-type=0
@@ -18468,6 +18884,49 @@ usb-pid=3011
@@ -18521,6 +18937,49 @@ usb-pid=3011
usb-vid=3f0
wifi-config=0
@ -534,14 +545,15 @@ Index: hplip-3.22.4/data/models/models.dat
[hp_laserjet_professional_p1102]
align-type=0
clean-type=0
Index: hplip-3.22.4/prnt/drv/hpcups.drv.in
===================================================================
--- hplip-3.22.4.orig/prnt/drv/hpcups.drv.in
+++ hplip-3.22.4/prnt/drv/hpcups.drv.in
@@ -22689,6 +22689,14 @@ Group "RLT/HP Real Life Technologies"
diff --git a/prnt/drv/hpcups.drv.in b/prnt/drv/hpcups.drv.in
index 2829168..3c1377a 100644
--- a/prnt/drv/hpcups.drv.in
+++ b/prnt/drv/hpcups.drv.in
@@ -23107,6 +23107,14 @@ Group "RLT/HP Real Life Technologies"
Attribute "Product" "" "(HP LaserJet Professional p1102 Printer)"
Attribute "Product" "" "(HP LaserJet Professional p1102s Printer)"
}
{
+ {
+ ModelName "HP LaserJet Professional p1102w"
+ Attribute "NickName" "" "HP LaserJet Professional p1102w, hpcups $Version, requires proprietary plugin"
+ Attribute "ShortNickName" "" "HP LaserJet Professional p1102w hpijs"
@ -549,11 +561,10 @@ Index: hplip-3.22.4/prnt/drv/hpcups.drv.in
+ PCFileName "hp-laserjet_professional_p1102w.ppd"
+ Attribute "Product" "" "(HP LaserJet Professional p1102w Printer)"
+ }
+ {
{
ModelName "HP LaserJet Professional p1106"
Attribute "NickName" "" "HP LaserJet Professional p1106, hpcups $Version"
Attribute "ShortNickName" "" "HP LJ Pro p1106 hpijs"
@@ -23122,6 +23130,14 @@ Group "RLT/HP Real Life Technologies"
@@ -23541,6 +23549,14 @@ Group "RLT/HP Real Life Technologies"
PCFileName "hp-laserjet_cp1025nw.ppd"
Attribute "Product" "" "(HP LaserJet Pro cp1025nw Color Printer Series)"
}
@ -568,3 +579,6 @@ Index: hplip-3.22.4/prnt/drv/hpcups.drv.in
}
} // End LJZjsColor (for proprietary plugin)
--
2.43.0

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Wed Jan 3 16:11:11 UTC 2024 - Martin Wilck <mwilck@suse.com>
- Update to hplip 3.23.12
* del fix-printer-attributes-parsing.patch (merged upstream)
* del hppsfilter-booklet-printing-change-insecure-fixed-tm.patch
(merged upstream)
- Added support for new printers:
* HP OfficeJet Pro 9130b series
* HP OfficeJet Pro 9120b series
* HP OfficeJet Pro 9110b series
* HP Color LaserJet Enterprise Flow MFP X58045z
* HP Color LaserJet Enterprise Flow MFP X58045zs
* HP Color LaserJet Enterprise MFP X58045dn
* HP Color LaserJet Enterprise MFP X58045
* HP LaserJet Pro P1106 plus
* HP LaserJet Pro P1108 plus
-------------------------------------------------------------------
Wed Nov 15 20:21:30 UTC 2023 - Martin Wilck <mwilck@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package hplip
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -24,7 +24,7 @@
%define pyexe %{_bindir}/python3
%global use_qt5 1
Name: hplip
Version: 3.23.8
Version: 3.23.12
Release: 0
Summary: HP's Printing, Scanning, and Faxing Software
License: BSD-3-Clause AND GPL-2.0-or-later AND MIT
@ -86,10 +86,6 @@ Patch403: Revert-changes-from-3.18.5-that-break-hp-setup-for-f.patch
# PATCH-FIX-UPSTREAM: https://bugs.launchpad.net/hplip/+bug/1879445
Patch404: hplip-3.20.6-python-includes.patch
Patch500: hplip-missing-drivers.patch
# PATCH-FIX-UPSTREAM boo#1209866 lp#2013185
Patch501: fix-printer-attributes-parsing.patch
# PATCH-FIX-SUSE bsc#1214399
Patch502: hppsfilter-booklet-printing-change-insecure-fixed-tm.patch
BuildRequires: %{pymod devel}
BuildRequires: %{pymod qt5-devel}
BuildRequires: %{pymod xml}
@ -335,8 +331,6 @@ This sub-package is only required by developers.
%patch403 -p1
%patch404 -p1
%patch500 -p1
%patch501 -p1
%patch502 -p1
# replace "env" shebang and "/usr/bin/python" with real executable
find . -name '*.py' -o -name pstotiff | \
xargs -n 1 sed -i '1s,^#!\(%{_bindir}/env python\|%{_bindir}/python\),#!%{pyexe},'

View File

@ -1,203 +0,0 @@
From d12ed6cd01bef7765cdeee16f8f6e66f22e71fbd Mon Sep 17 00:00:00 2001
From: Matthias Gerstner <matthias.gerstner@suse.de>
Date: Fri, 8 Sep 2023 10:17:04 +0200
Subject: [PATCH] hppsfilter: booklet printing: change insecure fixed /tmp file
paths
Using the fixed /tmp file paths in booklet printing /tmp/booklet.ps,
/tmp/temp.ps and /tmp/NUP.ps is a local security issue and also prevents
potential parallel operation of hplip.
Use proper `mkstemp()` for these files. Functions like `PS_Booklet()`
and `cupsFileOpen()` don't use the open file descriptor but open the
path by name again. This is safe, since the files have already been
safely created and have safe modes. I wanted to avoid changing a whole
series of function signatures for this.
The purpose of the `chmod()` in `open_tempbookletfile()` is unclear, the
data should only be processed by our own process. Making the file world
readable is an information leak, though. Thus drop this line.
---
prnt/hpps/hppsfilter.c | 124 ++++++++++++++++++++++++++++++++---------
1 file changed, 98 insertions(+), 26 deletions(-)
diff --git a/prnt/hpps/hppsfilter.c b/prnt/hpps/hppsfilter.c
index d6721b1..711b8d8 100644
--- a/prnt/hpps/hppsfilter.c
+++ b/prnt/hpps/hppsfilter.c
@@ -43,7 +43,9 @@ static FILE *g_fp_outdbgps = NULL;
static FILE *ptempbooklet_file = NULL;
static char temp_filename[FILE_NAME_SIZE] = {0};
static char booklet_filename[FILE_NAME_SIZE] = {0};
+static int booklet_fd = -1;
static char Nup_filename[FILE_NAME_SIZE] = {0};
+static int Nup_fd = -1;
extern void PS_Booklet(char *tempfile, char *bookletfile, char *nupfile,int order, int nup, char* pagesize, int bookletMaker);
static const char *GetOptionValue(const char *iOptionValue);
@@ -99,16 +101,78 @@ static int hpwrite (void *pBuffer, size_t size)
return ndata_written;
}
-static void open_tempbookletfile(char *mode)
+static int open_tempbookletfile(char *mode)
{
- ptempbooklet_file= fopen(temp_filename, mode);
+ snprintf(temp_filename, FILE_NAME_SIZE, "/tmp/hppsfilter-temp.XXXXXX");
+ int fd = mkstemp(temp_filename);
+ if (fd < 0) {
+ temp_filename[0] = '\0';
+ fprintf(stderr, "ERROR: Unable to open temp file %s\n", temp_filename);
+ return 1;
+ }
+
+ ptempbooklet_file = fdopen(fd, mode);
if(ptempbooklet_file == NULL)
{
- fprintf(stderr, "ERROR: Unable to open temp file %s\n", temp_filename);
- return 1;
+ close(fd);
+ fprintf(stderr, "ERROR: Unable to open temp file %s\n", temp_filename);
+ return 1;
}
- chmod(temp_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ return 0;
+}
+static void clean_tempfiles()
+{
+ if (booklet_fd != -1)
+ {
+ close(booklet_fd);
+ booklet_fd = -1;
+ }
+
+ if (Nup_fd != -1)
+ {
+ close(Nup_fd);
+ Nup_fd = -1;
+ }
+
+ if (ptempbooklet_file != NULL)
+ {
+ fclose(ptempbooklet_file);
+ ptempbooklet_file = NULL;
+ }
+
+ if( booklet_filename[0] != '\0' )
+ {
+ if ((unlink(booklet_filename)) == -1)
+ {
+ fprintf(stderr, "ERROR: Unable to remove temporary files in /tmp dir \"%s\" ",booklet_filename);
+ return 1;
+ }
+
+ booklet_filename[0] = '\0';
+ }
+
+ if( temp_filename[0] != '\0' )
+ {
+ if ((unlink(temp_filename)) == -1)
+ {
+ fprintf(stderr, "ERROR: Unable to remove temporary files in /tmp dir \"%s\" ",temp_filename);
+ return 1;
+ }
+
+ temp_filename[0] = '\0';
+ }
+
+ if( Nup_filename[0] != '\0' )
+ {
+ if ((unlink(Nup_filename)) == -1)
+ {
+ fprintf(stderr, "ERROR: Unable to remove temporary files in /tmp dir \"%s\" ",Nup_filename);
+ return 1;
+ }
+
+ Nup_filename[0] = '\0';
+ }
}
static int Dump_tempbookletfile (void *pBuffer, size_t size)
@@ -921,6 +985,8 @@ int main (int argc, char **argv)
char buffer[MAX_BUFFER] = {0};
int LfpSecurePin = 0;
+ atexit(clean_tempfiles);
+
get_LogLevel();
setbuf (stderr, NULL);
@@ -1024,13 +1090,32 @@ int main (int argc, char **argv)
if(booklet_enabled)
{
/* 1. dump the contents of the input file into temp file */
- sprintf(booklet_filename, "/tmp/%s.ps","booklet");
- sprintf(temp_filename, "/tmp/%s.ps","temp");
- sprintf(Nup_filename, "/tmp/%s.ps","NUP");
- open_tempbookletfile("w");
- while( (numBytes = cupsFileGetLine(fp_input, line, sizeof(line))) > 0)
+ snprintf(booklet_filename, FILE_NAME_SIZE, "/tmp/hppsfilter-booklet.XXXXXX");
+ booklet_fd = mkstemp(booklet_filename);
+ if( booklet_fd < 0 )
+ {
+ booklet_filename[0] = '\0';
+ fprintf(stderr, "ERROR: Unable to create booklet temporary file \"%s\"", booklet_filename);
+ return 1;
+ }
+
+ snprintf(Nup_filename, FILE_NAME_SIZE, "/tmp/hppsfilter-nup.XXXXXX");
+ Nup_fd = mkstemp(Nup_filename);
+ if( Nup_fd < 0 )
+ {
+ Nup_filename[0] = '\0';
+ clean_tempfiles();
+ fprintf(stderr, "ERROR: Unable to create nup temporary file \"%s\"", Nup_filename);
+ return 1;
+ }
+
+ if( open_tempbookletfile("w") != 0 )
+ {
+ clean_tempfiles();
+ return 1;
+ }
+ while( (numBytes = cupsFileGetLine(fp_input, line, sizeof(line))) > 0)
Dump_tempbookletfile (line, numBytes);
- fclose(ptempbooklet_file);
/* 2. Perform the booklet operation on the PS file */
PS_Booklet(temp_filename,booklet_filename,Nup_filename,order,nup,subString,bookletMaker);
@@ -1040,6 +1125,7 @@ int main (int argc, char **argv)
if ((fp_bookletinput = cupsFileOpen(Nup_filename, "r")) == NULL)
{
fprintf(stderr, "ERROR: Unable to open Nup_filename print file \"%s\"", Nup_filename);
+ clean_tempfiles();
return 1;
}
while ( (numBytes = cupsFileGetLine(fp_bookletinput, line, sizeof(line))) > 0)
@@ -1047,21 +1133,7 @@ int main (int argc, char **argv)
cupsFileClose (fp_bookletinput);
/* 4. Unlink function to remove the temp temporary files created */
- if( (unlink(booklet_filename)) == -1)
- {
- fprintf(stderr, "ERROR: Unable to remove temporary files in /tmp dir \"%s\" ",booklet_filename);
- return 1;
- }
- if( (unlink(temp_filename)) == -1)
- {
- fprintf(stderr, "ERROR: Unable to remove temporary files in /tmp dir \"%s\" ",temp_filename);
- return 1;
- }
- if( (unlink(Nup_filename)) == -1)
- {
- fprintf(stderr, "ERROR: Unable to remove temporary files in /tmp dir \"%s\" ",Nup_filename);
- return 1;
- }
+ clean_tempfiles();
booklet_enabled = 0;
bookletMaker=0;
}
--
2.42.1