]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Log path and PID of client over domain sockets.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 5 Mar 2013 19:31:19 +0000 (19:31 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Tue, 5 Mar 2013 19:31:19 +0000 (19:31 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10883 7a7537e8-13f0-0310-91df-b6672ffda945

scheduler/client.c
test/run-stp-tests.sh

index 15b65db025e8887551d2aaae0b78ed188f16d14f..0b26203d4a4202cca8c7efe28741d228abf9882d 100644 (file)
@@ -49,6 +49,9 @@
 
 #include "cupsd.h"
 
+#ifdef __APPLE__
+#  include <libproc.h>
+#endif /* __APPLE__ */
 #ifdef HAVE_TCPD_H
 #  include <tcpd.h>
 #endif /* HAVE_TCPD_H */
@@ -377,8 +380,31 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
 
 #ifdef AF_LOCAL
   if (con->http.hostaddr->addr.sa_family == AF_LOCAL)
+  {
+#  ifdef __APPLE__
+    socklen_t  peersize;               /* Size of peer credentials */
+    pid_t      peerpid;                /* Peer process ID */
+    char       name[256];              /* Name of process */
+
+    peersize = sizeof(peerpid);
+    if (!getsockopt(con->http.fd, SOL_LOCAL, LOCAL_PEERPID, &peerpid,
+        &peersize))
+    {
+      if (!proc_name(peerpid, name, sizeof(name)))
+       cupsdLogMessage(CUPSD_LOG_DEBUG,
+                       "[Client %d] Accepted from %s (Domain ???[%d])",
+                       con->http.fd, con->http.hostname, (int)peerpid);
+      else
+       cupsdLogMessage(CUPSD_LOG_DEBUG,
+                       "[Client %d] Accepted from %s (Domain %s[%d])",
+                       con->http.fd, con->http.hostname, name, (int)peerpid);
+    }
+    else
+#  endif /* __APPLE__ */
+
     cupsdLogMessage(CUPSD_LOG_DEBUG, "[Client %d] Accepted from %s (Domain)",
                     con->http.fd, con->http.hostname);
+  }
   else
 #endif /* AF_LOCAL */
   cupsdLogMessage(CUPSD_LOG_DEBUG, "[Client %d] Accepted from %s:%d (IPv%d)",
index 29d3a2568eaf5a409b76697ac839949ee925e7cd..f296f2deae8b427d1b208fb35eee17f34213fad7 100755 (executable)
@@ -391,6 +391,7 @@ cat >/tmp/cups-$user/cupsd.conf <<EOF
 StrictConformance Yes
 Browsing Off
 Listen localhost:$port
+Listen /tmp/cups-$user/sock
 PassEnv LOCALEDIR
 PassEnv DYLD_INSERT_LIBRARIES
 MaxSubscriptions 3