From 168349c63e554e3bedcf7202b598968177f8c6c8e1a2f4f9d3c524e5edc75a73 Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Wed, 29 Aug 2018 23:07:45 +0000 Subject: [PATCH] Accepting request 632195 from home:frispete:Tumbleweed Here's the corrected version.. OBS-URL: https://build.opensuse.org/request/show/632195 OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=161 --- Fix-scanning-with-python-pillow-4.2.0.patch | 37 -- change-udev-rules.diff | 6 +- disable_hp-upgrade.patch | 8 +- hplip-3.17.9.tar.gz | 3 - hplip-3.17.9.tar.gz.asc | 7 - hplip-3.18.6.tar.gz | 3 + hplip-3.18.6.tar.gz.asc | 7 + hplip-mdns-retry-query.patch | 86 --- hplip-mdns.patch | 553 ------------------ ...isc-missing-includes-and-definitions.patch | 33 +- hplip-rpmlintrc | 3 + hplip-udev-rules-in-usr.patch | 10 +- hplip.changes | 162 +++++ hplip.spec | 15 +- 14 files changed, 208 insertions(+), 725 deletions(-) delete mode 100644 Fix-scanning-with-python-pillow-4.2.0.patch delete mode 100644 hplip-3.17.9.tar.gz delete mode 100644 hplip-3.17.9.tar.gz.asc create mode 100644 hplip-3.18.6.tar.gz create mode 100644 hplip-3.18.6.tar.gz.asc delete mode 100644 hplip-mdns-retry-query.patch delete mode 100644 hplip-mdns.patch create mode 100644 hplip-rpmlintrc diff --git a/Fix-scanning-with-python-pillow-4.2.0.patch b/Fix-scanning-with-python-pillow-4.2.0.patch deleted file mode 100644 index c24c8ba..0000000 --- a/Fix-scanning-with-python-pillow-4.2.0.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 72be09ee8482cdd19e0895f8f536854c2dafe535 Mon Sep 17 00:00:00 2001 -From: Martin Wilck -Date: Tue, 12 Jun 2018 15:17:11 +0200 -Subject: [PATCH] Fix scanning with python-pillow 4.2.0 - -python-pillow released new version (4.2.0), which forbids -saving RGBA data to JPEG. This behavior breaks scanning -by hp-scan. Output is: - - $ hp-scan -m color -s file - Saving to file /home/zdohnal/hpscan001.jpg - error: Error saving file: cannot write mode RGBA as JPEG (I/O) - -These RGBA data needs to be convert to RGB data before saving as JPEG -(other formats - PNG, PNM, TIFF etc. - works fine, because they doesn't -ignore A channel). - -https://bugs.launchpad.net/hplip/+bug/1741214 ---- - scan.py | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/scan.py b/scan.py -index c33d84b..1ae4079 100755 ---- a/scan.py -+++ b/scan.py -@@ -1078,6 +1078,7 @@ try: - log.info("Saving to file %s" % output) - - try: -+ im = im.convert("RGB") - im.save(output) - except IOError as e: - log.error("Error saving file: %s (I/O)" % e) --- -2.17.0 - diff --git a/change-udev-rules.diff b/change-udev-rules.diff index 70f7712..84497a6 100644 --- a/change-udev-rules.diff +++ b/change-udev-rules.diff @@ -1,7 +1,7 @@ -Index: hplip-3.16.8/data/rules/56-hpmud.rules +Index: b/data/rules/56-hpmud.rules =================================================================== ---- hplip-3.16.8.orig/data/rules/56-hpmud.rules -+++ hplip-3.16.8/data/rules/56-hpmud.rules +--- a/data/rules/56-hpmud.rules ++++ b/data/rules/56-hpmud.rules @@ -1,8 +1,33 @@ # HPLIP udev rules file. Notify console user if plugin support is required for this device. +# diff --git a/disable_hp-upgrade.patch b/disable_hp-upgrade.patch index aa4ace1..ec577c4 100644 --- a/disable_hp-upgrade.patch +++ b/disable_hp-upgrade.patch @@ -1,6 +1,8 @@ ---- upgrade.py.orig 2013-10-31 12:46:54.000000000 +0100 -+++ upgrade.py 2013-12-04 14:58:03.000000000 +0100 -@@ -134,6 +134,11 @@ except getopt.GetoptError, e: +Index: b/upgrade.py +=================================================================== +--- a/upgrade.py ++++ b/upgrade.py +@@ -207,6 +207,11 @@ if os.geteuid() == 0: if os.getenv("HPLIP_DEBUG"): log.set_level('debug') diff --git a/hplip-3.17.9.tar.gz b/hplip-3.17.9.tar.gz deleted file mode 100644 index 0ac8e1b..0000000 --- a/hplip-3.17.9.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b2aad842f51dae7da2dd08d09ce2c27bc5f73c82a560b9494dd33589b0948678 -size 23862533 diff --git a/hplip-3.17.9.tar.gz.asc b/hplip-3.17.9.tar.gz.asc deleted file mode 100644 index 2df942a..0000000 --- a/hplip-3.17.9.tar.gz.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.11 (GNU/Linux) - -iEYEABECAAYFAlnAx/0ACgkQc9dwzaWQR7lBJgCg7JNpORzSzYJmzzhq7KMQe9Ba -D9QAoNaWSkp6rVLAGe0aeaohENBUozwr -=SMdx ------END PGP SIGNATURE----- diff --git a/hplip-3.18.6.tar.gz b/hplip-3.18.6.tar.gz new file mode 100644 index 0000000..a63b832 --- /dev/null +++ b/hplip-3.18.6.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ecf3e68b09480f602de81798ac00774cf8ffe754692e784bbbe0f9b2e337b7d +size 22590564 diff --git a/hplip-3.18.6.tar.gz.asc b/hplip-3.18.6.tar.gz.asc new file mode 100644 index 0000000..5d3e6d4 --- /dev/null +++ b/hplip-3.18.6.tar.gz.asc @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.11 (GNU/Linux) + +iEYEABECAAYFAlsYzCYACgkQc9dwzaWQR7k3kQCgpUG6Okb3nGf7qodmI9zTBf3A +a8AAoLD0LiwifYlnEBlHS5Eaw/ylB9A8 +=H/1x +-----END PGP SIGNATURE----- diff --git a/hplip-mdns-retry-query.patch b/hplip-mdns-retry-query.patch deleted file mode 100644 index bde0179..0000000 --- a/hplip-mdns-retry-query.patch +++ /dev/null @@ -1,86 +0,0 @@ -diff --git a/protocol/discovery/mdns.c b/protocol/discovery/mdns.c -index 92e153a..75ef0ea 100644 ---- a/protocol/discovery/mdns.c -+++ b/protocol/discovery/mdns.c -@@ -436,7 +436,7 @@ static int mdns_read_single_response(int udp_socket, char *recvbuffer, int recvb - FD_SET(udp_socket, &master); - maxfd = udp_socket; - tmo.tv_sec = 0; -- tmo.tv_usec = 300000; -+ tmo.tv_usec = 10000; - - readfd = master; - ret = select(maxfd + 1, &readfd, NULL, NULL, &tmo); -@@ -549,6 +549,34 @@ static void mdns_rr_cleanup(DNS_RECORD *rr) - } - } - -+static DNS_RECORD* send_and_receive(struct mdns_socket *mdns_sock, -+ const char *name, -+ int query_type, int read_mode) -+{ -+ /* wait up to ~1s */ -+ const useconds_t DELTA_T = 251000; -+ const int RETRIES = 8; -+ int retry = RETRIES; -+ DNS_RECORD *rr_list; -+ -+ while (retry) { -+ if (mdns_send_query(mdns_sock, name, query_type) == MDNS_STATUS_OK) { -+ rr_list = mdns_read_responses(mdns_sock->socket, read_mode, name); -+ if (rr_list != NULL) { -+ DBG("send_and_receive: got response after %d retries\n", -+ RETRIES - retry); -+ return rr_list; -+ } -+ } -+ /* MDNS servers delay responses. If the server just responded -+ * to some query (maybe an earlier one we sent), we may need to wait. */ -+ --retry; -+ usleep(DELTA_T); -+ } -+ BUG("send_and_receive: no response after %d retries\n", RETRIES); -+ return NULL; -+} -+ - int mdns_probe_nw_scanners(char* uris_buf, int buf_size, int *count) - { - int n = 0, bytes_read = 0; -@@ -562,11 +590,7 @@ int mdns_probe_nw_scanners(char* uris_buf, int buf_size, int *count) - if (mdns_open_socket(&mdns_sock) != MDNS_STATUS_OK) - goto bugout; - -- /* Send dns query */ -- mdns_send_query(&mdns_sock, scanner_name, QTYPE_PTR); -- -- /* Read Responses */ -- rr_list = mdns_read_responses(mdns_sock.socket, MODE_READ_ALL, scanner_name); -+ rr_list = send_and_receive(&mdns_sock, scanner_name, QTYPE_PTR, MODE_READ_ALL); - - /* Update URIs buffer */ - bytes_read = mdns_update_uris(rr_list, uris_buf, buf_size, count); -@@ -598,10 +622,8 @@ int mdns_lookup(char* hostname, unsigned char* ip) - - /* Send dns query */ - sprintf(fqdn, "%s.local", hostname); -- mdns_send_query(&mdns_sock, fqdn, QTYPE_A); - -- /* Read Responses */ -- rr_list = mdns_read_responses(mdns_sock.socket, MODE_READ_SINGLE, fqdn); -+ rr_list = send_and_receive(&mdns_sock, fqdn, QTYPE_A, MODE_READ_SINGLE); - - /* Update IP Address buffer */ - if(rr_list) -diff --git a/protocol/discovery/mdns.h b/protocol/discovery/mdns.h -index 34066fb..56d8847 100644 ---- a/protocol/discovery/mdns.h -+++ b/protocol/discovery/mdns.h -@@ -102,5 +102,8 @@ static int mdns_parse_respponse(unsigned char *Response, DNS_RECORD *rr); - static void mdns_rr_cleanup(DNS_RECORD *rr); - static DNS_RECORD *mdns_read_responses(int udp_socket, int mode, const char *question); - static unsigned char* mdns_readMDL(unsigned char *p, unsigned char *normalized_mdl, int len); -+static DNS_RECORD* send_and_receive(struct mdns_socket *mdns_sock, const char *name, -+ int query_type, int read_mode); -+static int get_ipv4_address(const char *iface, struct in_addr *addr); - #endif // _DISCOVERY_MDNS_H - diff --git a/hplip-mdns.patch b/hplip-mdns.patch deleted file mode 100644 index 49370de..0000000 --- a/hplip-mdns.patch +++ /dev/null @@ -1,553 +0,0 @@ -diff --git a/base/mdns.py b/base/mdns.py -index 03bdb92..11d08b8 100644 ---- a/base/mdns.py -+++ b/base/mdns.py -@@ -35,6 +35,17 @@ from .g import * - from . import utils - from .sixext import BytesIO, to_bytes_utf8, to_bytes_latin, to_string_latin - -+if hasattr(socket, "if_nameindex"): -+ if_nameindex = socket.if_nameindex -+else: -+ def _if_nameindex(): -+ """"Poor man's if_nameindex for Python 2.""" -+ import os -+ sysdir = "/sys/class/net" -+ return sorted([ (int(open("%s/%s/ifindex" % (sysdir, iface), "r").read(), 0), iface) -+ for iface in os.listdir(sysdir) ]) -+ if_nameindex = _if_nameindex -+ - MAX_ANSWERS_PER_PACKET = 24 - - QTYPE_A = 1 -@@ -45,6 +56,8 @@ QTYPE_PTR = 12 - - QCLASS_IN = 1 - -+MCAST_ADDR='224.0.0.251' -+ - # Caller needs to ensure, data should be in string format. - def read_utf8(offset, data, l): - return offset+l, data[offset:offset+l] -@@ -188,11 +201,6 @@ def createSocketsWithsetOption(ttl=4): - s=None - try: - s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) -- x = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -- x.connect(('1.2.3.4', 56)) -- intf = x.getsockname()[0] -- x.close() -- - s.setblocking(0) - ttl = struct.pack('B', ttl) - except socket.error: -@@ -209,14 +217,42 @@ def createSocketsWithsetOption(ttl=4): - - try: - s.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_TTL, ttl) -- s.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(intf) + socket.inet_aton('0.0.0.0')) - s.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_LOOP ,1) - except Exception as e: - log.error("Unable to setup multicast socket for mDNS: %s" % e) - if s: - s.close() - return None -- return s -+ -+ ifaces = [] -+ for idx, name in if_nameindex(): -+ mreqn = struct.pack("=4sii", socket.inet_aton(MCAST_ADDR), -+ socket.ntohl(socket.INADDR_ANY), idx) -+ try: -+ s.setsockopt(socket.SOL_IP, socket.IP_ADD_MEMBERSHIP, mreqn) -+ except Exception as e: -+ log.debug("Failed to join multicast group on interface %s: %s" % -+ (name, e)) -+ else: -+ log.debug("Joined multicast group on interface %s" % name) -+ ifaces.append((idx, name)) -+ -+ if len(ifaces) == 0: -+ log.error("failed to join multicast group on any interface") -+ s.close() -+ return None -+ -+ return (s, ifaces) -+ -+def closeSocket(s): -+ for idx, name in if_nameindex(): -+ mreqn = struct.pack("=4sii", socket.inet_aton(MCAST_ADDR), -+ socket.ntohl(socket.INADDR_ANY), idx) -+ try: -+ s.setsockopt(socket.SOL_IP, socket.IP_DROP_MEMBERSHIP, mreqn) -+ except Exception: -+ pass -+ s.close() - - def updateReceivedData(data, answers): - update_spinner() -@@ -299,13 +335,22 @@ def updateReceivedData(data, answers): - break - return y, answers - -+def send_packets(s, answers, name, mcast_addr, mcast_port): -+ for p in create_outgoing_packets(answers): -+ log.debug("Outgoing on %s: (%d)" % (name, len(p))) -+ log.log_data(p, width=16) -+ try: -+ s.sendto(p, 0, (mcast_addr, mcast_port)) -+ except socket.error as e: -+ log.debug("Unable to send broadcast DNS packet on %s: %s" % (name, e)) -+ raise - - def detectNetworkDevices(ttl=4, timeout=10): -- mcast_addr, mcast_port ='224.0.0.251', 5353 -+ mcast_addr, mcast_port =MCAST_ADDR, 5353 - found_devices = {} - answers = [] - -- s = createSocketsWithsetOption(ttl) -+ s, ifaces = createSocketsWithsetOption(ttl) - if not s: - return {} - -@@ -321,14 +366,24 @@ def detectNetworkDevices(ttl=4, timeout=10): - break - - if now >= next: -- try: -- for p in create_outgoing_packets(answers): -- log.debug("Outgoing: (%d)" % len(p)) -- log.log_data(p, width=16) -- s.sendto(p, 0, (mcast_addr, mcast_port)) -+ good = [] -+ for idx, name in ifaces: -+ mreqn = struct.pack("=4sii", socket.inet_aton(mcast_addr), -+ socket.ntohl(socket.INADDR_ANY), idx) -+ try: -+ s.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, mreqn) -+ except socket.error as e: -+ log.debug("failed to set IP_MULTICAST_IF on %s" % name) -+ continue -+ try: -+ send_packets(s, answers, name, mcast_addr, mcast_port) -+ except socket.error: -+ continue -+ else: -+ good.append((idx, name)) - -- except socket.error as e: -- log.error("Unable to send broadcast DNS packet: %s" % e) -+ if len(good) == 0: -+ log.error("Failed to send MDNS packet on any interface") - - next += delay - delay *= 2 -@@ -347,7 +402,5 @@ def detectNetworkDevices(ttl=4, timeout=10): - found_devices[y['ip']] = y - - log.debug("Found %d devices" % len(found_devices)) -- s.close() -+ closeSocket(s) - return found_devices -- -- -diff --git a/protocol/discovery/mdns.c b/protocol/discovery/mdns.c -index 3324d2a..92e153a 100644 ---- a/protocol/discovery/mdns.c -+++ b/protocol/discovery/mdns.c -@@ -1,3 +1,4 @@ -+ - /***************************************************************************** - mdns.c - mDNS related calls - -@@ -29,14 +30,17 @@ - #endif - - #include -+#include - #include - #include - #include - #include - #include - #include -+#include - #include "mdns.h" - #include -+#include - - /* Convert "www.google.com" to "3www6google3com". */ - static int mdns_convert_name_to_dns(const char *name, int name_size, char *dns_name) -@@ -71,14 +75,50 @@ static int mdns_convert_name_to_dns(const char *name, int name_size, char *dns_n - return x; /* return length DOES include null termination */ - } - -+#define MREQN_INIT(_mr, index) do { \ -+ (&(_mr))->imr_multiaddr.s_addr = inet_addr("224.0.0.251"); \ -+ (&(_mr))->imr_address.s_addr = htonl(INADDR_ANY); \ -+ (&(_mr))->imr_ifindex = (index); \ -+ } while(0) -+ -+struct mdns_socket { -+ int socket; -+ struct if_nameindex *idx; -+ struct if_nameindex **good; -+}; -+#define MDNS_SOCKET_INIT { .socket = -1, .idx = NULL, .good = NULL, } -+ -+static int get_ipv4_address(const char *iface, struct in_addr *addr) -+{ -+ int s, r; -+ struct ifreq ifr; -+ -+ memset(&ifr, 0, sizeof(ifr)); -+ strncpy(ifr.ifr_name, iface, IFNAMSIZ-1); -+ -+ s = socket(AF_INET, SOCK_DGRAM, 0); -+ r = ioctl(s, SIOCGIFADDR, &ifr); -+ close(s); -+ -+ if (r == -1) { -+ DBG("error in SIOCGIFADDR for %s: %m\n", iface); -+ return MDNS_STATUS_ERROR; -+ } -+ -+ if (addr != NULL) -+ memcpy(addr, &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr, -+ sizeof(*addr)); -+ return MDNS_STATUS_OK; -+} - --static int mdns_open_socket(int *psocket) -+static int mdns_open_socket(struct mdns_socket *mdns_sock) - { - int stat = MDNS_STATUS_ERROR; -- int udp_socket = -1, yes = 1; -+ int udp_socket = -1, yes = 1, ifaces; - char loop = 0, ttl = 255; - struct sockaddr_in recv_addr , addr; -- struct ip_mreq mreq; -+ struct ip_mreqn mreqn; -+ struct if_nameindex *idx; - - DBG("mdns_open_socket entry.\n"); - -@@ -120,24 +160,86 @@ static int mdns_open_socket(int *psocket) - goto bugout; - } - -- /* Join the .local multicast group */ -- mreq.imr_multiaddr.s_addr = inet_addr("224.0.0.251"); -- mreq.imr_interface.s_addr = htonl(INADDR_ANY); -- if (setsockopt(udp_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(struct ip_mreq)) == -1) { -- BUG("unable to add to multicast group: %m\n"); -- close(udp_socket); -+ mdns_sock->idx = if_nameindex(); -+ if (mdns_sock->idx == NULL) { -+ BUG("if_nameindex failed: %m\n"); -+ goto bugout; -+ } -+ -+ for (idx = mdns_sock->idx, ifaces = 0; -+ idx && (idx->if_index != 0 || idx->if_name != NULL); idx++) { -+ ifaces ++; -+ } -+ -+ mdns_sock->good = calloc(ifaces, sizeof(struct if_nameindex*)); -+ if (mdns_sock->good == NULL) -+ goto bugout; -+ -+ for (idx = mdns_sock->idx, ifaces = 0; -+ idx && (idx->if_index != 0 || idx->if_name != NULL); idx++) { -+ -+ /* Skip lo and interfaces without IPv4 address */ -+ if (!strcmp(idx->if_name, "lo")) -+ continue; -+ if (get_ipv4_address(idx->if_name, NULL) == MDNS_STATUS_ERROR) -+ continue; -+ -+ /* Join the multicast group on each local interface */ -+ MREQN_INIT(mreqn, idx->if_index); -+ if (setsockopt(udp_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreqn, -+ sizeof(struct ip_mreqn)) == -1) { -+ BUG("unable to add to multicast group for %s: %m\n", idx->if_name); -+ } else { -+ mdns_sock->good[ifaces++] = idx; -+ DBG("added multicast group on interface %s\n", idx->if_name); -+ } -+ } -+ -+ if (ifaces == 0) { -+ BUG("no interfaces for multicast found\n"); - goto bugout; - } - -- *psocket = udp_socket; -- DBG("pSocket = [%d]: %m\n", *psocket); -+ mdns_sock->socket = udp_socket; -+ DBG("Socket = [%d]: %m\n", mdns_sock->socket); - stat = MDNS_STATUS_OK; - - bugout: -+ if (stat != MDNS_STATUS_OK) -+ mdns_close_socket(mdns_sock); - return stat; - } - --static void mdns_create_query_packet(char* fqdn, int query_type, char* querybuf, int *length) -+static void mdns_close_socket(struct mdns_socket *mdns_sock) -+{ -+ int i; -+ struct if_nameindex *idx; -+ struct ip_mreqn mreqn; -+ if (mdns_sock->socket != -1) { -+ for (i = 0; mdns_sock->good[i]; i++) { -+ idx = mdns_sock->good[i]; -+ MREQN_INIT(mreqn, idx->if_index); -+ if (setsockopt(mdns_sock->socket, IPPROTO_IP, IP_DROP_MEMBERSHIP, -+ &mreqn, sizeof(struct ip_mreqn)) == -1) { -+ BUG("unable to drop multicast group for %s: %m\n", idx->if_name); -+ }; -+ } -+ close(mdns_sock->socket); -+ mdns_sock->socket = -1; -+ } -+ -+ if (mdns_sock->idx != NULL) { -+ if_freenameindex(mdns_sock->idx); -+ mdns_sock->idx = NULL; -+ } -+ -+ if (mdns_sock->good != NULL) { -+ free(mdns_sock->good); -+ mdns_sock->good = NULL; -+ } -+} -+ -+static void mdns_create_query_packet(const char* fqdn, int query_type, char* querybuf, int *length) - { - int n = 0; - char header[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -@@ -157,14 +259,14 @@ static void mdns_create_query_packet(char* fqdn, int query_type, char* querybuf, - *length = n; - } - --static int mdns_send_query(int udp_socket, char *fqdn, int query_type) -+static int mdns_send_query(struct mdns_socket *mdns_sock, const char *fqdn, int query_type) - { - char querybuf[256] = {0,}; -- int length = 0; -+ int length = 0, i, success; - int stat = MDNS_STATUS_OK; - struct sockaddr_in send_addr; - -- DBG("mdns_send_query entry. send socket=%d len=%d\n", udp_socket, length); -+ DBG("mdns_send_query entry. send socket=%d len=%d\n", mdns_sock->socket, length); - - mdns_create_query_packet(fqdn, query_type, querybuf, &length); - -@@ -172,8 +274,26 @@ static int mdns_send_query(int udp_socket, char *fqdn, int query_type) - send_addr.sin_family = AF_INET; - send_addr.sin_addr.s_addr = inet_addr("224.0.0.251"); - send_addr.sin_port = htons(5353); -- if (sendto(udp_socket, querybuf, length, 0, (struct sockaddr *) &send_addr, sizeof(send_addr)) < 0) -- stat = MDNS_STATUS_ERROR; -+ -+ for (i = 0, success = 0; mdns_sock->good[i]; i++) { -+ struct if_nameindex *idx; -+ struct ip_mreqn mreqn; -+ idx = mdns_sock->good[i]; -+ MREQN_INIT(mreqn, idx->if_index); -+ if (setsockopt(mdns_sock->socket, IPPROTO_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn)) -+ == -1) { -+ DBG("failed to set IP_MULTICAST_IF to %s\n", idx->if_name); -+ continue; -+ } -+ if (sendto(mdns_sock->socket, querybuf, length, 0, -+ (struct sockaddr *) &send_addr, sizeof(send_addr))< 0) { -+ DBG("failed to send on %s\n", idx->if_name); -+ } else -+ success++; -+ } -+ -+ if (success == 0) -+ stat = MDNS_STATUS_ERROR; - - DBG("mdns_send_query returning with status(%d)...\n", stat); - return stat; -@@ -252,7 +372,7 @@ static void mdns_read_header(char *Response, DNS_PKT_HEADER *h) - - } - --static void mdns_parse_respponse(unsigned char *Response, DNS_RECORD *rr) -+static int mdns_parse_respponse(unsigned char *Response, DNS_RECORD *rr) - { - unsigned char *p = Response; - unsigned short type = 0, data_len = 0; -@@ -263,6 +383,11 @@ static void mdns_parse_respponse(unsigned char *Response, DNS_RECORD *rr) - mdns_read_header(Response, &h); - p += MDNS_HEADER_SIZE; - -+ if (h.answers + h.additionals <= 0) { -+ DBG("mdns_parse_respponse: no answers"); -+ return MDNS_STATUS_ERROR; -+ } -+ - for (i = 0; i < h.questions; i++) - { - p += mdns_readName(Response, p, rr->name); -@@ -295,6 +420,7 @@ static void mdns_parse_respponse(unsigned char *Response, DNS_RECORD *rr) - } - - DBG("mdns_parse_respponse returning MDL = %s, IP = %s\n",rr->mdl, rr->ip); -+ return MDNS_STATUS_OK; - } - - static int mdns_read_single_response(int udp_socket, char *recvbuffer, int recvbufsize) -@@ -328,7 +454,7 @@ static int mdns_read_single_response(int udp_socket, char *recvbuffer, int recvb - return ret; - } - --static DNS_RECORD *mdns_read_responses(int udp_socket, int mode) -+static DNS_RECORD *mdns_read_responses(int udp_socket, int mode, const char *question) - { - int retries = 3, ret = 0; - char recvbuffer[MAX_MDNS_RESPONSE_LEN] = { 0, }; -@@ -351,17 +477,22 @@ static DNS_RECORD *mdns_read_responses(int udp_socket, int mode) - temp = (DNS_RECORD *)malloc(sizeof(DNS_RECORD)); - if(temp) - { -- temp->next = NULL; -- if(head == NULL) -- rr = head = temp; -- else -- { -- rr->next = temp; -- rr = rr->next; -- } -- -- memset(rr, 0, sizeof(DNS_RECORD)); -- mdns_parse_respponse(recvbuffer, rr); -+ memset(temp, 0, sizeof(DNS_RECORD)); -+ if (mdns_parse_respponse(recvbuffer, temp) == MDNS_STATUS_OK && -+ (mode == MODE_READ_ALL || question == NULL || -+ !strncmp(question, temp->name, sizeof(temp->name)-1))) { -+ if(head == NULL) -+ rr = head = temp; -+ else -+ { -+ rr->next = temp; -+ rr = rr->next; -+ } -+ } else { -+ DBG("Parse error or wrong MDNS name"); -+ free(temp); -+ continue; -+ } - - if(mode == MODE_READ_SINGLE) - break; -@@ -421,28 +552,28 @@ static void mdns_rr_cleanup(DNS_RECORD *rr) - int mdns_probe_nw_scanners(char* uris_buf, int buf_size, int *count) - { - int n = 0, bytes_read = 0; -- int udp_socket = 0; -+ struct mdns_socket mdns_sock = MDNS_SOCKET_INIT; - int stat = MDNS_STATUS_ERROR; - DNS_RECORD *rr_list = NULL; -+ const char scanner_name[] = "_scanner._tcp.local"; - - DBG("mdns_probe_nw_scanners entry.\n"); - /* Open UDP socket */ -- if (mdns_open_socket(&udp_socket) != MDNS_STATUS_OK) -+ if (mdns_open_socket(&mdns_sock) != MDNS_STATUS_OK) - goto bugout; - - /* Send dns query */ -- mdns_send_query(udp_socket, "_scanner._tcp.local", QTYPE_PTR); -+ mdns_send_query(&mdns_sock, scanner_name, QTYPE_PTR); - - /* Read Responses */ -- rr_list = mdns_read_responses(udp_socket, MODE_READ_ALL); -+ rr_list = mdns_read_responses(mdns_sock.socket, MODE_READ_ALL, scanner_name); - - /* Update URIs buffer */ - bytes_read = mdns_update_uris(rr_list, uris_buf, buf_size, count); - DBG("mdns_probe_nw_scanners returned with bytes_read = [%d].\n",bytes_read); - - bugout: -- if (udp_socket >= 0) -- close(udp_socket); -+ mdns_close_socket(&mdns_sock); - - mdns_rr_cleanup(rr_list); - -@@ -455,22 +586,22 @@ bugout: - */ - int mdns_lookup(char* hostname, unsigned char* ip) - { -- int udp_socket = 0; -+ struct mdns_socket mdns_sock = MDNS_SOCKET_INIT; - int stat = MDNS_STATUS_ERROR; - char fqdn[MAX_NAME_LENGTH] = {0}; - DNS_RECORD *rr_list = NULL; - - DBG("mdns_probe_nw_scanners entry.\n"); - /* Open UDP socket */ -- if (mdns_open_socket(&udp_socket) != MDNS_STATUS_OK) -+ if (mdns_open_socket(&mdns_sock) != MDNS_STATUS_OK) - goto bugout; - - /* Send dns query */ - sprintf(fqdn, "%s.local", hostname); -- mdns_send_query(udp_socket, fqdn, QTYPE_A); -+ mdns_send_query(&mdns_sock, fqdn, QTYPE_A); - - /* Read Responses */ -- rr_list = mdns_read_responses(udp_socket, MODE_READ_SINGLE); -+ rr_list = mdns_read_responses(mdns_sock.socket, MODE_READ_SINGLE, fqdn); - - /* Update IP Address buffer */ - if(rr_list) -@@ -481,8 +612,7 @@ int mdns_lookup(char* hostname, unsigned char* ip) - } - - bugout: -- if (udp_socket >= 0) -- close(udp_socket); -+ mdns_close_socket(&mdns_sock); - - mdns_rr_cleanup(rr_list); - return stat; -diff --git a/protocol/discovery/mdns.h b/protocol/discovery/mdns.h -index 8fccc82..34066fb 100644 ---- a/protocol/discovery/mdns.h -+++ b/protocol/discovery/mdns.h -@@ -86,19 +86,21 @@ typedef struct _DNS_PKT_HEADER - int mdns_probe_nw_scanners(char* buf, int buf_size, int *count); - int mdns_lookup(char* hostname, unsigned char* ip); - -+struct mdns_socket; - - /*Helper Function Prototypes*/ - static int mdns_convert_name_to_dns(const char *name, int name_size, char *dns_name); - static int mdns_read_single_response(int udp_socket, char *recvbuffer, int recvbufsize); --static int mdns_open_socket(int *psocket); --static int mdns_send_query(int udp_socket, char *fqdn, int query_type); -+static int mdns_open_socket(struct mdns_socket *mdns_sock); -+static void mdns_close_socket(struct mdns_socket *mdns_sock); -+static int mdns_send_query(struct mdns_socket *mdns_sock, const char *fqdn, int query_type); - static int mdns_readName(unsigned char* start, unsigned char *p, char *buf); - static int mdns_update_uris(DNS_RECORD *rr, char* uris_buf, int buf_size, int *count); --static void mdns_create_query_packet(char* fqdn, int query_type, char* dnsquery, int *length); -+static void mdns_create_query_packet(const char* fqdn, int query_type, char* dnsquery, int *length); - static void mdns_read_header(char *Response, DNS_PKT_HEADER *h); --static void mdns_parse_respponse(unsigned char *Response, DNS_RECORD *rr); -+static int mdns_parse_respponse(unsigned char *Response, DNS_RECORD *rr); - static void mdns_rr_cleanup(DNS_RECORD *rr); --static DNS_RECORD *mdns_read_responses(int udp_socket, int mode); -+static DNS_RECORD *mdns_read_responses(int udp_socket, int mode, const char *question); - static unsigned char* mdns_readMDL(unsigned char *p, unsigned char *normalized_mdl, int len); - #endif // _DISCOVERY_MDNS_H - diff --git a/hplip-misc-missing-includes-and-definitions.patch b/hplip-misc-missing-includes-and-definitions.patch index 416c49a..445feec 100644 --- a/hplip-misc-missing-includes-and-definitions.patch +++ b/hplip-misc-missing-includes-and-definitions.patch @@ -10,31 +10,31 @@ Subject: [PATCH] hplip: misc missing #includes and definitions scan/sane/http.c | 1 + 4 files changed, 4 insertions(+) -diff --git a/protocol/discovery/mdns.c b/protocol/discovery/mdns.c -index 75ef0eab7214..c58d218390f5 100644 +Index: b/protocol/discovery/mdns.c +=================================================================== --- a/protocol/discovery/mdns.c +++ b/protocol/discovery/mdns.c -@@ -40,6 +40,7 @@ - #include +@@ -37,6 +37,7 @@ + #include #include "mdns.h" #include +#include - #include /* Convert "www.google.com" to "3www6google3com". */ -diff --git a/protocol/discovery/mdns.h b/protocol/discovery/mdns.h -index 56d8847da28a..d64e668fe194 100644 + static int mdns_convert_name_to_dns(const char *name, int name_size, char *dns_name) +Index: b/protocol/discovery/mdns.h +=================================================================== --- a/protocol/discovery/mdns.h +++ b/protocol/discovery/mdns.h -@@ -105,5 +105,6 @@ static unsigned char* mdns_readMDL(unsigned char *p, unsigned char *normalized_m - static DNS_RECORD* send_and_receive(struct mdns_socket *mdns_sock, const char *name, - int query_type, int read_mode); - static int get_ipv4_address(const char *iface, struct in_addr *addr); +@@ -100,5 +100,6 @@ static void mdns_parse_respponse(unsign + static void mdns_rr_cleanup(DNS_RECORD *rr); + static DNS_RECORD *mdns_read_responses(int udp_socket, int mode); + static unsigned char* mdns_readMDL(unsigned char *p, unsigned char *normalized_mdl, int len); +int mdns_probe_nw_scanners(char* uris_buf, int buf_size, int *count); #endif // _DISCOVERY_MDNS_H -diff --git a/scan/sane/hpaio.c b/scan/sane/hpaio.c -index ae34cfb63fd9..28899d10bae3 100644 +Index: b/scan/sane/hpaio.c +=================================================================== --- a/scan/sane/hpaio.c +++ b/scan/sane/hpaio.c @@ -46,6 +46,7 @@ @@ -45,8 +45,8 @@ index ae34cfb63fd9..28899d10bae3 100644 #define DEBUG_DECLARE_ONLY #include "sanei_debug.h" -diff --git a/scan/sane/http.c b/scan/sane/http.c -index 800df91bb3f3..ae5edf4c8fe8 100644 +Index: b/scan/sane/http.c +=================================================================== --- a/scan/sane/http.c +++ b/scan/sane/http.c @@ -33,6 +33,7 @@ @@ -57,6 +57,3 @@ index 800df91bb3f3..ae5edf4c8fe8 100644 #include #include #include --- -2.16.1 - diff --git a/hplip-rpmlintrc b/hplip-rpmlintrc new file mode 100644 index 0000000..e58ef06 --- /dev/null +++ b/hplip-rpmlintrc @@ -0,0 +1,3 @@ +from Config import * + +addFilter("arch-dependent-file-in-usr-share") diff --git a/hplip-udev-rules-in-usr.patch b/hplip-udev-rules-in-usr.patch index 298ae1b..aeb584d 100644 --- a/hplip-udev-rules-in-usr.patch +++ b/hplip-udev-rules-in-usr.patch @@ -1,11 +1,11 @@ -Index: hplip-3.15.2/Makefile.am +Index: b/Makefile.am =================================================================== ---- hplip-3.15.2.orig/Makefile.am -+++ hplip-3.15.2/Makefile.am -@@ -109,7 +109,7 @@ rulessystemdir=/usr/lib/systemd/system - dist_rulessystem_DATA =data/rules/hplip-printer@.service +--- a/Makefile.am ++++ b/Makefile.am +@@ -134,7 +134,7 @@ dist_rulessystem_DATA =data/rules/hplip- # hpmud.rules + if !HPLIP_CLASS_DRIVER -rulesdir = /etc/udev/rules.d +rulesdir = /usr/lib/udev/rules.d if UDEV_SYSFS_RULES diff --git a/hplip.changes b/hplip.changes index 1a7fbb6..796ba9c 100644 --- a/hplip.changes +++ b/hplip.changes @@ -1,3 +1,165 @@ +------------------------------------------------------------------- +Tue Aug 28 11:37:58 UTC 2018 - Hans-Peter Jansen + +- removed Fix-scanning-with-python-pillow-4.2.0.patch as resolved + upstream. Closes boo#1096755 +- removed hplip-mdns.patch and hplip-mdns-retry-query.patch, since + upstream further improved the code in this area + +------------------------------------------------------------------- +Thu Aug 2 13:38:51 UTC 2018 - hpj@urpla.net + +- update to 3.18.7 avoided due to newly added ImageProcessor.so blob + +- update to 3.18.6: + Added Support for the following new Printers: + - HP DesignJet Z6810 42in PostScript + - HP DesignJet Z6810 60in PostScript + - HP DesignJet Z6610 60in PostScript + +- update to 3.18.5: + Added Support for the following new Printers: + - HP DesignJet T1700 PostScript + - HP DesignJet T1700dr PostScript + - HP Color LaserJet Pro M253a + - HP Color LaserJet Pro M254dn + - HP Color LaserJet Pro M254n + - HP Color LaserJet Pro M254dne + - HP Color LaserJet Pro M254nw + - HP Color LaserJet Pro M254dw + - HP Color LaserJet Pro M254cnw + - HP Color LaserJet Pro M253nw + - HP Color LaserJet Pro M253cnw + - HP Color LaserJet Pro M254cdw + - HP Color LaserJet Pro MFP M180nw + - HP Color LaserJet Pro MFP M181fw + - HP Color LaserJet Pro MFP M179fw + - HP Color LaserJet Pro MFP M179cfw + - HP Color LaserJet Pro MFP M181fnw + - HP Color LaserJet Pro MFP M181cfw + - HP Color LaserJet Pro MFP M180n + - HP Color LaserJet Pro MFP M178cn + - HP Color LaserJet Pro MFP M178n + - HP Color LaserJet Pro MFP M180cn + - HP Color LaserJet Pro MFP M281fdw + - HP Color LaserJet Pro MFP M279fdw + - HP Color LaserJet Pro MFP M281cdw + - HP Color LaserJet Pro MFP M281fdn + - HP Color LaserJet Pro MFP M281dne + - HP Color LaserJet Pro MFP M278dn + - HP Color LaserJet Pro MFP M280nw + - HP Color LaserJet Pro MFP M278nw + - HP Color LaserJet Pro MFP M278cw + - HP Color LaserJet Pro MFP M280cnw + - HP Color LaserJet Pro MFP M280c2 + - HP Color LaserJet Pro M154a + - HP Color LaserJet M153a + - HP Color LaserJet M153b + - HP Color LaserJet M154b + - HP Color LaserJet M154nw + - HP Color LaserJet M153nw + - HP Color LaserJet M153cnw + - HP Color LaserJet M153c1 + - HP Color LaserJet M154cnw + - HP Color LaserJet M154c1 + - HP PageWide Managed Color P75250dn + - HP PageWide Managed Color MFP P77940dns + - HP PageWide Managed Color MFP P77940dn + - HP PageWide Managed Color MFP P77940dn+ + - HP PageWide Managed Color MFP P77950dns + - HP PageWide Managed Color MFP P77950dn + - HP PageWide Managed Color MFP P77950dn+ + - HP PageWide Managed Color MFP P77960dns + - HP PageWide Managed Color MFP P77960dn + - HP PageWide Managed Color MFP P77960dn+ + - HP PageWide Managed Color MFP P77440dn + - HP PageWide Managed Color Flow MFP E77950z + - HP PageWide Managed Color Flow MFP E77950zs + - HP PageWide Managed Color Flow MFP E77950z+ + - HP PageWide Managed Color Flow MFP E77960z + - HP PageWide Managed Color Flow MFP E77960zs + - HP PageWide Managed Color Flow MFP E77960zts + - HP PageWide Managed Color Flow MFP E77960z+ + +- update to 3.18.4: + Added Support for the following new Printers: + - HP LaserJet Pro MFP M28a + - HP LaserJet Pro MFP M29a + - HP LaserJet Pro MFP M30a + - HP LaserJet Pro MFP M31a + - HP LaserJet Pro MFP M30c + - HP LaserJet Pro MFP M31c + - HP LaserJet Pro MFP M28w + - HP LaserJet Pro MFP M29w + - HP LaserJet Pro MFP M30w + - HP LaserJet Pro MFP M31w + - HP LaserJet Pro MFP M30cw + - HP LaserJet Pro MFP M31cw + - HP LaserJet Pro M14a + - HP LaserJet Pro M15a + - HP LaserJet Pro M16a + - HP LaserJet Pro M17a + - HP LaserJet Pro M14c + - HP LaserJet Pro M17c + - HP LaserJet Pro M14w + - HP LaserJet Pro M15w + - HP LaserJet Pro M16w + - HP LaserJet Pro M17w + - HP LaserJet Pro M14cw + - HP LaserJet Pro M17cw + Added Support for the following new Distros: + - Ubuntu 18.04 Beta Version (64 bit) + - Debian 9.2 (32 bit and 64 bit) + - Debian 9.3 (32 bit and 64 bit) + - Debian 9.4 (32 bit and 64 bit) + +- update to 3.18.3: + Added Support for the following new Printers: + - HP DesignJet Z2600 PostScript + - HP DesignJet Z5600 PostScript + - HP PageWide XL 8000ps Printer + - HP PageWide XL 8000 Blueprinter + - HP PageWide XL 5000 Printer + - HP PageWide XL 5000 MFP + - HP PageWide XL 5000 Blueprinter + - HP PageWide XL 4500 Printer + - HP PageWide XL 4500 MFP + - HP PageWide XL 4000 Printer + - HP PageWide XL 4000 MFP + - HP PageWide XL 5100ps + - HP PageWide XL 5100ps MFP + - HP PageWide XL 5100ps MFP Blueprinter + - HP PageWide XL 6000ps + - HP PageWide XL 6000ps MFP + Added Support for the following new Distros: + - Manjaro Linux 17.1.4 (64 bit) + - Fedora 27 (64 bit) + - Linux Mint 18.3 (32 bit and 64 bit) + Launchpad fixes: + - 1736221 : hplip-3.17.11 source tarball contains compiled + binaries + - 1741214 : scan.py - scans cannot be saved as JPEG since + python-pillow-4.2.0 + +- update to 3.17.11: + Added Support for the following new Distros: + - Ubuntu 17.10 (64bit) + Other requirement: + - Class Driver support + +- update to 3.17.10: + Added Support for the following new Scanners: + - HP Scanjet Enterprise Flow N9120 fn2 Document Scanner + - HP Digital Sender Flow 8500 fn2 Document Capture Workstation + Added Support for the following new Distros: + - Debian 9.1 + +- refresh patches +- adjust mdns.c changes + (which looses newly added _uscan._tcp.local queries, but requires + interface changes) +- fix build due to unexpanded ppd/hpcups/*.ppd.gz usage in Makefile + ------------------------------------------------------------------- Sun Jun 24 05:22:01 UTC 2018 - bwiedemann@suse.com diff --git a/hplip.spec b/hplip.spec index a2ac973..1a3816e 100644 --- a/hplip.spec +++ b/hplip.spec @@ -54,7 +54,7 @@ BuildRequires: systemd-rpm-macros %endif Name: hplip -Version: 3.17.9 +Version: 3.18.6 Release: 0 Summary: HP's Printing, Scanning, and Faxing Software License: BSD-3-Clause AND GPL-2.0-or-later AND MIT @@ -75,6 +75,8 @@ Source2: hplip.keyring # Source100... is for special SUSE sources: # Source102 is a small man page for /usr/bin/hpijs: Source102: hpijs.1.gz +# +Source1000: %{name}-rpmlintrc # Patch100... is for special Suse patches: # Patch101 change-udev-rules.diff changes the udev rules file 56-hpmud.rules Patch101: change-udev-rules.diff @@ -90,11 +92,6 @@ Patch108: add_missing_includes_and_define_GNU_SOURCE.patch # PATCH-FIX-SUSE: GNOME no longer provides a system tray, so don't warn the user that we can't find it Patch109: no-systray-failure-message.patch Patch110: hpijs-avoid-segfault-in-DJGenericVIP-DJGenericVIP.patch -Patch111: Fix-scanning-with-python-pillow-4.2.0.patch -# Patch200 fixes device communication and detection via MDNS in some network setups: -Patch200: hplip-mdns.patch -# Patch201 makes MDNS lookups more robust by retrying queries: -Patch201: hplip-mdns-retry-query.patch # Python3 port: cleanup patches Patch300: pcardext-python3-fixes.patch Patch301: hplip-misc-missing-includes-and-definitions.patch @@ -393,16 +390,13 @@ This sub-package is only required by developers. # Patch106 disable_hp-upgrade.patch disables hp-upgrade/upgrade.py for security reasons, # see https://bugzilla.novell.com/show_bug.cgi?id=853405 # To upgrade HPLIP an openSUSE software package manager like YaST or zypper should be used. -%patch106 -b .disable_hp-upgrade.orig +%patch106 -p1 -b .disable_hp-upgrade.orig %patch107 -p1 -b .udev_rules_dir.orig # Patch108 add_missing_includes_and_define_GNU_SOURCE.patch adds missing '#include <...>' # and missing '#define _GNU_SOURCE' see https://bugs.launchpad.net/hplip/+bug/1456590 %patch108 -p1 -b .add_missing_includes_and_define_GNU_SOURCE.orig %patch109 -p1 -b .systemtray.py.orig %patch110 -p1 -b .boo1094141 -%patch111 -p1 -b .boo1096755 -%patch200 -p1 -b .mdns -%patch201 -p1 -b .mdns-retry %patch300 -p1 -b .pcardext-python3 %patch301 -p1 -b .misc-headers %patch302 -p1 -b .hp_ipp_missing_prototypes @@ -480,6 +474,7 @@ export CXXFLAGS="%{optflags} -fno-strict-aliasing" CFLAGS='%{optflags}' \ PYTHON=%{pyexe} make +sed -i 's|ppd/hpcups/\*.ppd.gz ||g' Makefile %install make DESTDIR=%{buildroot} install