[cups/f16] Another systemd socket activation fix: initialise addrlen in getsockname() call.

Tim Waugh twaugh at fedoraproject.org
Tue Oct 4 12:23:05 UTC 2011


commit cd792f4a7268eead978e85571f4067bb1176b7a3
Author: Tim Waugh <twaugh at redhat.com>
Date:   Tue Oct 4 12:19:24 2011 +0100

    Another systemd socket activation fix: initialise addrlen in getsockname() call.

 cups-systemd-socket.patch |   50 ++++++++++++++++++++++----------------------
 cups.spec                 |    5 ++-
 2 files changed, 28 insertions(+), 27 deletions(-)
---
diff --git a/cups-systemd-socket.patch b/cups-systemd-socket.patch
index 934cca8..c504b4f 100644
--- a/cups-systemd-socket.patch
+++ b/cups-systemd-socket.patch
@@ -1,6 +1,6 @@
 diff -up cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket cups-1.5.0/config-scripts/cups-systemd.m4
---- cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket	2011-10-04 11:58:42.554997916 +0100
-+++ cups-1.5.0/config-scripts/cups-systemd.m4	2011-10-04 11:58:42.554997916 +0100
+--- cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket	2011-10-04 12:14:29.597746957 +0100
++++ cups-1.5.0/config-scripts/cups-systemd.m4	2011-10-04 12:14:29.598746938 +0100
 @@ -0,0 +1,25 @@
 +dnl
 +dnl "$Id$"
@@ -29,7 +29,7 @@ diff -up cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket cups-1.5.0/con
 +dnl
 diff -up cups-1.5.0/configure.in.systemd-socket cups-1.5.0/configure.in
 --- cups-1.5.0/configure.in.systemd-socket	2010-11-20 01:03:46.000000000 +0000
-+++ cups-1.5.0/configure.in	2011-10-04 11:58:42.555997897 +0100
++++ cups-1.5.0/configure.in	2011-10-04 12:14:29.598746938 +0100
 @@ -37,6 +37,7 @@ sinclude(config-scripts/cups-pam.m4)
  sinclude(config-scripts/cups-largefile.m4)
  sinclude(config-scripts/cups-dnssd.m4)
@@ -49,8 +49,8 @@ diff -up cups-1.5.0/configure.in.systemd-socket cups-1.5.0/configure.in
  	  doc/help/ref-cupsd-conf.html
  	  doc/help/standard.html
 diff -up cups-1.5.0/cups/usersys.c.systemd-socket cups-1.5.0/cups/usersys.c
---- cups-1.5.0/cups/usersys.c.systemd-socket	2011-10-04 11:59:16.310382444 +0100
-+++ cups-1.5.0/cups/usersys.c	2011-10-04 12:01:28.849965809 +0100
+--- cups-1.5.0/cups/usersys.c.systemd-socket	2011-10-04 12:14:29.365751167 +0100
++++ cups-1.5.0/cups/usersys.c	2011-10-04 12:14:29.599746919 +0100
 @@ -770,7 +770,7 @@ cups_read_client_conf(
      struct stat	sockinfo;		/* Domain socket information */
  
@@ -61,8 +61,8 @@ diff -up cups-1.5.0/cups/usersys.c.systemd-socket cups-1.5.0/cups/usersys.c
      else
  #endif /* CUPS_DEFAULT_DOMAINSOCKET */
 diff -up cups-1.5.0/data/cups.path.in.systemd-socket cups-1.5.0/data/cups.path.in
---- cups-1.5.0/data/cups.path.in.systemd-socket	2011-10-04 11:58:42.555997897 +0100
-+++ cups-1.5.0/data/cups.path.in	2011-10-04 11:58:42.555997897 +0100
+--- cups-1.5.0/data/cups.path.in.systemd-socket	2011-10-04 12:14:29.600746900 +0100
++++ cups-1.5.0/data/cups.path.in	2011-10-04 12:14:29.600746900 +0100
 @@ -0,0 +1,8 @@
 +[Unit]
 +Description=CUPS Printer Service Spool
@@ -73,8 +73,8 @@ diff -up cups-1.5.0/data/cups.path.in.systemd-socket cups-1.5.0/data/cups.path.i
 +[Install]
 +WantedBy=multi-user.target
 diff -up cups-1.5.0/data/cups.service.in.systemd-socket cups-1.5.0/data/cups.service.in
---- cups-1.5.0/data/cups.service.in.systemd-socket	2011-10-04 11:58:42.556997879 +0100
-+++ cups-1.5.0/data/cups.service.in	2011-10-04 11:58:42.556997879 +0100
+--- cups-1.5.0/data/cups.service.in.systemd-socket	2011-10-04 12:14:29.600746900 +0100
++++ cups-1.5.0/data/cups.service.in	2011-10-04 12:14:29.600746900 +0100
 @@ -0,0 +1,9 @@
 +[Unit]
 +Description=CUPS Printing Service
@@ -86,8 +86,8 @@ diff -up cups-1.5.0/data/cups.service.in.systemd-socket cups-1.5.0/data/cups.ser
 +Also=cups.socket cups.path
 +WantedBy=printer.target
 diff -up cups-1.5.0/data/cups.socket.in.systemd-socket cups-1.5.0/data/cups.socket.in
---- cups-1.5.0/data/cups.socket.in.systemd-socket	2011-10-04 11:58:42.556997879 +0100
-+++ cups-1.5.0/data/cups.socket.in	2011-10-04 11:58:42.556997879 +0100
+--- cups-1.5.0/data/cups.socket.in.systemd-socket	2011-10-04 12:14:29.601746883 +0100
++++ cups-1.5.0/data/cups.socket.in	2011-10-04 12:14:29.601746883 +0100
 @@ -0,0 +1,9 @@
 +[Unit]
 +Description=CUPS Printing Service Sockets
@@ -100,7 +100,7 @@ diff -up cups-1.5.0/data/cups.socket.in.systemd-socket cups-1.5.0/data/cups.sock
 +WantedBy=sockets.target
 diff -up cups-1.5.0/data/Makefile.systemd-socket cups-1.5.0/data/Makefile
 --- cups-1.5.0/data/Makefile.systemd-socket	2011-05-12 06:21:56.000000000 +0100
-+++ cups-1.5.0/data/Makefile	2011-10-04 11:58:42.557997861 +0100
++++ cups-1.5.0/data/Makefile	2011-10-04 12:14:29.601746883 +0100
 @@ -112,6 +112,12 @@ install-data:
  		$(INSTALL_DATA) $$file $(DATADIR)/ppdc; \
  	done
@@ -125,8 +125,8 @@ diff -up cups-1.5.0/data/Makefile.systemd-socket cups-1.5.0/data/Makefile
  
  #
 diff -up cups-1.5.0/Makedefs.in.systemd-socket cups-1.5.0/Makedefs.in
---- cups-1.5.0/Makedefs.in.systemd-socket	2011-10-04 11:58:42.334001946 +0100
-+++ cups-1.5.0/Makedefs.in	2011-10-04 11:58:42.558997843 +0100
+--- cups-1.5.0/Makedefs.in.systemd-socket	2011-10-04 12:14:29.441749789 +0100
++++ cups-1.5.0/Makedefs.in	2011-10-04 12:14:29.602746866 +0100
 @@ -143,6 +143,7 @@ CXXFLAGS	=	@CPPFLAGS@ @CXXFLAGS@
  CXXLIBS		=	@CXXLIBS@
  DBUS_NOTIFIER	=	@DBUS_NOTIFIER@
@@ -145,7 +145,7 @@ diff -up cups-1.5.0/Makedefs.in.systemd-socket cups-1.5.0/Makedefs.in
  #
 diff -up cups-1.5.0/scheduler/client.h.systemd-socket cups-1.5.0/scheduler/client.h
 --- cups-1.5.0/scheduler/client.h.systemd-socket	2011-03-25 21:25:38.000000000 +0000
-+++ cups-1.5.0/scheduler/client.h	2011-10-04 11:58:42.559997825 +0100
++++ cups-1.5.0/scheduler/client.h	2011-10-04 12:14:29.602746866 +0100
 @@ -75,6 +75,7 @@ typedef struct
    int			fd;		/* File descriptor for this server */
    http_addr_t		address;	/* Bind address of socket */
@@ -156,7 +156,7 @@ diff -up cups-1.5.0/scheduler/client.h.systemd-socket cups-1.5.0/scheduler/clien
  
 diff -up cups-1.5.0/scheduler/listen.c.systemd-socket cups-1.5.0/scheduler/listen.c
 --- cups-1.5.0/scheduler/listen.c.systemd-socket	2011-04-16 00:38:13.000000000 +0100
-+++ cups-1.5.0/scheduler/listen.c	2011-10-04 11:58:42.559997825 +0100
++++ cups-1.5.0/scheduler/listen.c	2011-10-04 12:14:29.603746849 +0100
 @@ -401,7 +401,7 @@ cupsdStopListening(void)
         lis;
         lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
@@ -167,8 +167,8 @@ diff -up cups-1.5.0/scheduler/listen.c.systemd-socket cups-1.5.0/scheduler/liste
  #ifdef WIN32
        closesocket(lis->fd);
 diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
---- cups-1.5.0/scheduler/main.c.systemd-socket	2011-10-04 11:58:42.507998773 +0100
-+++ cups-1.5.0/scheduler/main.c	2011-10-04 11:58:42.561997789 +0100
+--- cups-1.5.0/scheduler/main.c.systemd-socket	2011-10-04 12:14:29.563747574 +0100
++++ cups-1.5.0/scheduler/main.c	2011-10-04 12:18:14.964656652 +0100
 @@ -26,6 +26,8 @@
   *   launchd_checkin()     - Check-in with launchd and collect the listening
   *                           fds.
@@ -245,7 +245,7 @@ diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
 +  for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++)
 +  {
 +    http_addr_t addr;
-+    socklen_t addrlen;
++    socklen_t addrlen = sizeof (addr);
 +    int r;
 +    cupsd_listener_t *lis;
 +    char s[256];
@@ -320,8 +320,8 @@ diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
  /*
   * 'parent_handler()' - Catch USR1/CHLD signals...
 diff -up cups-1.5.0/scheduler/Makefile.systemd-socket cups-1.5.0/scheduler/Makefile
---- cups-1.5.0/scheduler/Makefile.systemd-socket	2011-10-04 11:58:42.518998573 +0100
-+++ cups-1.5.0/scheduler/Makefile	2011-10-04 11:58:42.562997771 +0100
+--- cups-1.5.0/scheduler/Makefile.systemd-socket	2011-10-04 12:14:29.574747375 +0100
++++ cups-1.5.0/scheduler/Makefile	2011-10-04 12:14:29.607746775 +0100
 @@ -41,6 +41,7 @@ CUPSDOBJS =	\
  		server.o \
  		statbuf.o \
@@ -346,8 +346,8 @@ diff -up cups-1.5.0/scheduler/Makefile.systemd-socket cups-1.5.0/scheduler/Makef
  #
  
 diff -up cups-1.5.0/scheduler/sd-daemon.c.systemd-socket cups-1.5.0/scheduler/sd-daemon.c
---- cups-1.5.0/scheduler/sd-daemon.c.systemd-socket	2011-10-04 11:58:42.563997752 +0100
-+++ cups-1.5.0/scheduler/sd-daemon.c	2011-10-04 11:58:42.563997752 +0100
+--- cups-1.5.0/scheduler/sd-daemon.c.systemd-socket	2011-10-04 12:14:29.609746739 +0100
++++ cups-1.5.0/scheduler/sd-daemon.c	2011-10-04 12:14:29.609746739 +0100
 @@ -0,0 +1,520 @@
 +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 +
@@ -870,8 +870,8 @@ diff -up cups-1.5.0/scheduler/sd-daemon.c.systemd-socket cups-1.5.0/scheduler/sd
 +#endif
 +}
 diff -up cups-1.5.0/scheduler/sd-daemon.h.systemd-socket cups-1.5.0/scheduler/sd-daemon.h
---- cups-1.5.0/scheduler/sd-daemon.h.systemd-socket	2011-10-04 11:58:42.564997733 +0100
-+++ cups-1.5.0/scheduler/sd-daemon.h	2011-10-04 11:58:42.564997733 +0100
+--- cups-1.5.0/scheduler/sd-daemon.h.systemd-socket	2011-10-04 12:14:29.609746739 +0100
++++ cups-1.5.0/scheduler/sd-daemon.h	2011-10-04 12:14:29.610746720 +0100
 @@ -0,0 +1,277 @@
 +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 +
diff --git a/cups.spec b/cups.spec
index 433d50c..9a250b9 100644
--- a/cups.spec
+++ b/cups.spec
@@ -643,8 +643,9 @@ rm -rf $RPM_BUILD_ROOT
 
 %changelog
 * Tue Oct  4 2011 Tim Waugh <twaugh at redhat.com> 1:1.5.0-12
-- Fix for systemd socket activation: relax permissions check for
-  domain socket in libcups.
+- More fixes for systemd socket activation:
+  - relax permissions check for domain socket in libcups.
+  - initialise addrlen before calling getsockname().
 
 * Mon Oct 03 2011 Richard Hughes <rhughes at redhat.com> 1:1.5.0-11
 - Updated colord patch with fixes to DeleteDevice.


More information about the scm-commits mailing list