pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/dbus Add patch supporting socket credentials ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/3e7931670ce4
branches: trunk
changeset: 538459:3e7931670ce4
user: bjs <bjs%pkgsrc.org@localhost>
date: Fri Feb 08 23:15:16 2008 +0000
description:
Add patch supporting socket credentials for NetBSD, courtesy of
jmcneill@. Bump rev.
diffstat:
sysutils/dbus/Makefile | 4 +-
sysutils/dbus/distinfo | 4 +-
sysutils/dbus/patches/patch-ab | 107 ++++++++++++++++++++++++++++++++++++++++-
3 files changed, 109 insertions(+), 6 deletions(-)
diffs (146 lines):
diff -r 75da44c0a584 -r 3e7931670ce4 sysutils/dbus/Makefile
--- a/sysutils/dbus/Makefile Fri Feb 08 23:13:35 2008 +0000
+++ b/sysutils/dbus/Makefile Fri Feb 08 23:15:16 2008 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.25 2008/02/05 22:08:29 tnn Exp $
+# $NetBSD: Makefile,v 1.26 2008/02/08 23:15:16 bjs Exp $
#
DISTNAME= dbus-1.0.2
-PKGREVISION= 3
+PKGREVISION= 4
CATEGORIES= sysutils
MASTER_SITES= http://dbus.freedesktop.org/releases/dbus/
diff -r 75da44c0a584 -r 3e7931670ce4 sysutils/dbus/distinfo
--- a/sysutils/dbus/distinfo Fri Feb 08 23:13:35 2008 +0000
+++ b/sysutils/dbus/distinfo Fri Feb 08 23:15:16 2008 +0000
@@ -1,9 +1,9 @@
-$NetBSD: distinfo,v 1.17 2008/02/05 22:03:02 tnn Exp $
+$NetBSD: distinfo,v 1.18 2008/02/08 23:15:16 bjs Exp $
SHA1 (dbus-1.0.2.tar.gz) = 2870efd6ea0b5b0d14e52195f560238a74bb1e0e
RMD160 (dbus-1.0.2.tar.gz) = d5eddfb058c4c026d4a9f091ad90abcc6e54861a
Size (dbus-1.0.2.tar.gz) = 1400278 bytes
SHA1 (patch-aa) = 71c903a268e8ece66c39f48937c9544b7c82d1b3
-SHA1 (patch-ab) = ecda96c45e9782dc8611f843f940c8e7c4a4b510
+SHA1 (patch-ab) = 7b04aa9007c1616e954db72538b179130d98234a
SHA1 (patch-ac) = eae0564535d36cb0082dd2e66d74fea808800d4e
SHA1 (patch-ag) = 469993db97a74da50c61449454c02c8a7c69e7bd
diff -r 75da44c0a584 -r 3e7931670ce4 sysutils/dbus/patches/patch-ab
--- a/sysutils/dbus/patches/patch-ab Fri Feb 08 23:13:35 2008 +0000
+++ b/sysutils/dbus/patches/patch-ab Fri Feb 08 23:15:16 2008 +0000
@@ -1,8 +1,111 @@
-$NetBSD: patch-ab,v 1.7 2008/02/05 22:03:02 tnn Exp $
+$NetBSD: patch-ab,v 1.8 2008/02/08 23:15:16 bjs Exp $
--- dbus/dbus-sysdeps-unix.c.orig 2006-12-11 14:21:09.000000000 -0500
+++ dbus/dbus-sysdeps-unix.c
-@@ -2311,8 +2311,18 @@ int
+@@ -22,6 +22,10 @@
+ *
+ */
+
++#ifdef __NetBSD__
++#define _NETBSD_SOURCE
++#endif
++
+ #include "dbus-internals.h"
+ #include "dbus-sysdeps.h"
+ #include "dbus-sysdeps-unix.h"
+@@ -67,6 +71,10 @@
+ #include <ucred.h>
+ #endif
+
++#ifdef __NetBSD__
++#include <sys/un.h>
++#endif
++
+ #ifndef O_BINARY
+ #define O_BINARY 0
+ #endif
+@@ -75,6 +83,33 @@
+ #define socklen_t int
+ #endif
+
++#ifdef LOCAL_PEEREID
++static dbus_bool_t
++dbus_nb_getpeereid(int fd, pid_t *pid, uid_t *uid, gid_t *gid)
++{
++ struct unpcbid cred;
++ socklen_t len = sizeof(cred);
++
++ _dbus_verbose ("dbus_nb_getpeereid: enter, fd=%d\n", fd);
++
++ if (getsockopt(fd, 0, LOCAL_PEEREID, &cred, &len) < 0)
++ {
++ _dbus_verbose ("dbus_nb_getpeereid: getsockopt LOCAL_PEEREID failed: %s\n", strerror(errno));
++ return FALSE;
++ }
++ if (pid)
++ *pid = cred.unp_pid;
++ if (uid)
++ *uid = cred.unp_euid;
++ if (gid)
++ *gid = cred.unp_egid;
++
++ _dbus_verbose ("dbus_nb_getpeereid: returning TRUE, pid=%d uid=%d gid=%d\n",
++ cred.unp_pid, cred.unp_euid, cred.unp_egid);
++ return TRUE;
++}
++#endif
++
+ static dbus_bool_t
+ _dbus_open_socket (int *fd,
+ int domain,
+@@ -517,7 +552,7 @@ _dbus_set_local_creds (int fd, dbus_bool
+ {
+ dbus_bool_t retval = TRUE;
+
+-#if defined(HAVE_CMSGCRED)
++#if defined(HAVE_CMSGCRED) || defined(LOCAL_PEEREID)
+ /* NOOP just to make sure only one codepath is used
+ * and to prefer CMSGCRED
+ */
+@@ -955,7 +990,7 @@ _dbus_read_credentials_unix_socket (int
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+-#if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)
++#if (defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)) && !defined(LOCAL_PEEREID)
+ memset (&cmsg, 0, sizeof (cmsg));
+ msg.msg_control = &cmsg;
+ msg.msg_controllen = sizeof (cmsg);
+@@ -980,7 +1015,7 @@ _dbus_read_credentials_unix_socket (int
+ return FALSE;
+ }
+
+-#if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)
++#if (defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)) && !defined(LOCAL_PEEREID)
+ if (cmsg.hdr.cmsg_len < sizeof (cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS)
+ {
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+@@ -1012,6 +1047,19 @@ _dbus_read_credentials_unix_socket (int
+ credentials->pid = cmsg.cred.cmcred_pid;
+ credentials->uid = cmsg.cred.cmcred_euid;
+ credentials->gid = cmsg.cred.cmcred_groups[0];
++#elif defined(LOCAL_PEEREID)
++ pid_t sockpid, sockuid, sockgid;
++ if (dbus_nb_getpeereid(client_fd, &sockpid, &sockuid, &sockgid) == TRUE)
++ {
++ credentials->pid = sockpid;
++ credentials->uid = sockuid;
++ credentials->gid = sockgid;
++ }
++ else
++ {
++ _dbus_verbose ("Failed to dbus_nb_getpeereid() credentials\n");
++ }
++
+ #elif defined(LOCAL_CREDS)
+ credentials->pid = DBUS_PID_UNSET;
+ credentials->uid = cmsg.cred.sc_uid;
+@@ -2311,8 +2359,18 @@ int
_dbus_printf_string_upper_bound (const char *format,
va_list args)
{
Home |
Main Index |
Thread Index |
Old Index