aboutsummaryrefslogtreecommitdiffstats
path: root/main/cups/cups-check-sockaddr-size.patch
diff options
context:
space:
mode:
authorIsaac Dunham <ibid.ag@gmail.com>2014-06-29 22:53:44 -0700
committerNatanael Copa <ncopa@alpinelinux.org>2014-07-01 14:19:27 +0000
commitbd662709fe2c8742823e1cea6cddcafd54a942d4 (patch)
tree25b7843f70e24ddc4cbf18ca0f92ad12f308b015 /main/cups/cups-check-sockaddr-size.patch
parent02bf3e3b6a1cbf88dd4cd4d3e679be90911f9896 (diff)
downloadaports-bd662709fe2c8742823e1cea6cddcafd54a942d4.tar.bz2
aports-bd662709fe2c8742823e1cea6cddcafd54a942d4.tar.xz
main/cups: fix typo, lpd backend
'ldadmin' for 'lpadmin' kept cups from starting. 'lpd' failed with errno=EINVAL on musl, thanks to passing bind a struct sockaddr{,_in,_in6,_un} with a reported size of 256. This resulted in lpd print support being unusable.
Diffstat (limited to 'main/cups/cups-check-sockaddr-size.patch')
-rw-r--r--main/cups/cups-check-sockaddr-size.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/main/cups/cups-check-sockaddr-size.patch b/main/cups/cups-check-sockaddr-size.patch
new file mode 100644
index 0000000000..ce966dc970
--- /dev/null
+++ b/main/cups/cups-check-sockaddr-size.patch
@@ -0,0 +1,45 @@
+diff --git a/backend/lpd.c b/backend/lpd.c
+index 6e4ab36..bbffb82 100644
+--- a/backend/lpd.c
++++ b/backend/lpd.c
+@@ -1244,6 +1244,7 @@ rresvport_af(int *port, /* IO - Port number to bind to */
+ {
+ http_addr_t addr; /* Socket address */
+ int fd; /* Socket file descriptor */
++ socklen_t socksz=sizeof(struct sockaddr); /* size of struct sockaddr* */
+
+
+ /*
+@@ -1260,6 +1261,23 @@ rresvport_af(int *port, /* IO - Port number to bind to */
+ memset(&addr, 0, sizeof(addr));
+ addr.addr.sa_family = family;
+
++ switch(family) {
++ case AF_INET:
++ socksz = sizeof(struct sockaddr_in);
++ break;
++#ifdef AF_INET6
++ case AF_INET6:
++ socksz = sizeof(struct sockaddr_in6);
++ break;
++#endif
++#ifdef AF_LOCAL
++ case AF_LOCAL:
++ socksz = sizeof(struct sockaddr_un);
++#endif
++ default:
++ break;
++ }
++
+ /*
+ * Try to bind the socket to a reserved port...
+ */
+@@ -1276,7 +1294,7 @@ rresvport_af(int *port, /* IO - Port number to bind to */
+ * Try binding the port to the socket; return if all is OK...
+ */
+
+- if (!bind(fd, (struct sockaddr *)&addr, sizeof(addr)))
++ if (!bind(fd, (struct sockaddr *)&addr, socksz))
+ return (fd);
+
+ /*