pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/consolekit Fix socket credential handling and...
details: https://anonhg.NetBSD.org/pkgsrc/rev/222631a0b26f
branches: trunk
changeset: 550482:222631a0b26f
user: jmcneill <jmcneill%pkgsrc.org@localhost>
date: Sat Nov 22 19:33:05 2008 +0000
description:
Fix socket credential handling and sysctl kern.proc2 usage. Bump PKGREVISION
diffstat:
sysutils/consolekit/Makefile | 8 +++-
sysutils/consolekit/distinfo | 4 +-
sysutils/consolekit/files/ck-sysdeps-netbsd.c | 25 +++++++-----
sysutils/consolekit/patches/patch-ae | 53 ++++++++++++++++++++++++--
4 files changed, 72 insertions(+), 18 deletions(-)
diffs (182 lines):
diff -r 40ec51463178 -r 222631a0b26f sysutils/consolekit/Makefile
--- a/sysutils/consolekit/Makefile Sat Nov 22 18:59:54 2008 +0000
+++ b/sysutils/consolekit/Makefile Sat Nov 22 19:33:05 2008 +0000
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.1.1.1 2008/11/22 03:32:22 jmcneill Exp $
+# $NetBSD: Makefile,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
#
CONSOLEKIT_VER= 0.3.0
DISTNAME= ConsoleKit-${CONSOLEKIT_VER}
PKGNAME= consolekit-${CONSOLEKIT_VER}
+PKGREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://people.freedesktop.org/~mccann/dist/
EXTRACT_SUFX= .tar.bz2
@@ -33,6 +34,10 @@
CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASE:Q}
CONFIGURE_ARGS+= --localstatedir=${VARBASE}
+# TODO
+#CONFIGURE_ARGS+= --enable-pam-module
+#.include "../../mk/pam.buildlink3.mk"
+
post-extract:
cp ${FILESDIR}/ck-sysdeps-netbsd.c ${WRKSRC}/src/
@@ -42,5 +47,4 @@
.include "../../security/policykit/buildlink3.mk"
.include "../../sysutils/dbus/buildlink3.mk"
.include "../../sysutils/dbus-glib/buildlink3.mk"
-.include "../../mk/pam.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff -r 40ec51463178 -r 222631a0b26f sysutils/consolekit/distinfo
--- a/sysutils/consolekit/distinfo Sat Nov 22 18:59:54 2008 +0000
+++ b/sysutils/consolekit/distinfo Sat Nov 22 19:33:05 2008 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.1.1.1 2008/11/22 03:32:22 jmcneill Exp $
+$NetBSD: distinfo,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
SHA1 (ConsoleKit-0.3.0.tar.bz2) = e3b6156622cc14ebca7382a55b8ed15f2f2bad98
RMD160 (ConsoleKit-0.3.0.tar.bz2) = 7a1ebd2f4bfb65690e70138c9923c3fd2fcaf671
@@ -7,4 +7,4 @@
SHA1 (patch-ab) = 2e9fe9de1f27c635a4eefa77af8322cb8a02ab35
SHA1 (patch-ac) = 0595a9cd1c4013eb4761e044b4b4b01b613f7d2b
SHA1 (patch-ad) = a1c1a1d0452945550065da3eac2390318c1eb7be
-SHA1 (patch-ae) = 893cd9214218e283747dc886ef5623e5847b8149
+SHA1 (patch-ae) = 231ff806d2ce5e8dfb4d3b25fff4820c313c8caa
diff -r 40ec51463178 -r 222631a0b26f sysutils/consolekit/files/ck-sysdeps-netbsd.c
--- a/sysutils/consolekit/files/ck-sysdeps-netbsd.c Sat Nov 22 18:59:54 2008 +0000
+++ b/sysutils/consolekit/files/ck-sysdeps-netbsd.c Sat Nov 22 19:33:05 2008 +0000
@@ -1,3 +1,5 @@
+/* $NetBSD: ck-sysdeps-netbsd.c,v 1.2 2008/11/22 19:33:05 jmcneill Exp $ */
+
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2006 William Jon McCann <mccann%jhu.edu@localhost>
@@ -121,16 +123,21 @@
get_kinfo_proc (pid_t pid,
struct kinfo_proc2 *p)
{
- int mib[4];
- size_t len;
+ int name[6];
+ u_int namelen;
+ size_t sz;
- len = 4;
- sysctlnametomib ("kern.proc.pid", mib, &len);
+ sz = sizeof(*p);
+ namelen = 0;
+ name[namelen++] = CTL_KERN;
+ name[namelen++] = KERN_PROC2;
+ name[namelen++] = KERN_PROC_PID;
+ name[namelen++] = pid;
+ name[namelen++] = sz;
+ name[namelen++] = 1;
- len = sizeof(struct kinfo_proc2);
- mib[3] = pid;
-
- if (sysctl (mib, 4, p, &len, NULL, 0) == -1) {
+ if (sysctl (name, namelen, p, &sz, NULL, 0) == -1) {
+ perror("sysctl kern.proc2.pid");
return FALSE;
}
@@ -203,7 +210,6 @@
GError **error)
{
gboolean res;
- GError *local_error;
CkProcessStat *proc;
g_return_val_if_fail (pid > 1, FALSE);
@@ -218,7 +224,6 @@
if (res) {
*stat = proc;
} else {
- g_propagate_error (error, local_error);
*stat = NULL;
}
diff -r 40ec51463178 -r 222631a0b26f sysutils/consolekit/patches/patch-ae
--- a/sysutils/consolekit/patches/patch-ae Sat Nov 22 18:59:54 2008 +0000
+++ b/sysutils/consolekit/patches/patch-ae Sat Nov 22 19:33:05 2008 +0000
@@ -1,19 +1,64 @@
-$NetBSD: patch-ae,v 1.1.1.1 2008/11/22 03:32:22 jmcneill Exp $
+$NetBSD: patch-ae,v 1.2 2008/11/22 19:33:05 jmcneill Exp $
--- src/ck-sysdeps-unix.c.orig 2008-01-23 09:30:44.000000000 -0500
+++ src/ck-sysdeps-unix.c
-@@ -35,6 +35,10 @@
+@@ -35,6 +35,11 @@
#include <linux/kd.h>
#endif
+#ifdef __NetBSD__
+#include <dev/wscons/wsdisplay_usl_io.h>
++#include <sys/un.h>
+#endif
+
#ifdef HAVE_SYS_VT_H
#include <sys/vt.h>
#endif
-@@ -126,7 +130,7 @@ ck_get_socket_peer_credentials (int
+@@ -53,6 +58,25 @@
+ #define ERROR -1
+ #endif
+
++#ifdef LOCAL_PEEREID
++static gboolean
++ck_nb_getpeeruucred(int socket_fd, pid_t *pid, uid_t *uid)
++{
++ struct unpcbid cred;
++ socklen_t len = sizeof(cred);
++
++ if (getsockopt(socket_fd, 0, LOCAL_PEEREID, &cred, &len) < 0)
++ return FALSE;
++
++ if (pid)
++ *pid = cred.unp_pid;
++ if (uid)
++ *uid = cred.unp_euid;
++
++ return TRUE;
++}
++#endif
++
+ /* Adapted from dbus-sysdeps-unix.c:_dbus_read_credentials_socket() */
+ gboolean
+ ck_get_socket_peer_credentials (int socket_fd,
+@@ -99,7 +123,16 @@ ck_get_socket_peer_credentials (int
+ if (ucred != NULL) {
+ ucred_free (ucred);
+ }
+-#else /* !SO_PEERCRED && !HAVE_GETPEERUCRED */
++#elif defined(LOCAL_PEEREID)
++ pid_t sockpid = -1, sockuid = -1;
++ if (ck_nb_getpeeruucred(socket_fd, &sockpid, &sockuid) == TRUE) {
++ pid_read = sockpid;
++ uid_read = sockuid;
++ ret = TRUE;
++ } else {
++ g_warning ("Failed to ck_nb_getpeeruucred() credentials\n");
++ }
++#else /* !SO_PEERCRED && !HAVE_GETPEERUCRED && !LOCAL_PEEREID*/
+ g_warning ("Socket credentials not supported on this OS\n");
+ #endif
+
+@@ -126,7 +159,7 @@ ck_get_socket_peer_credentials (int
gboolean
ck_fd_is_a_console (int fd)
{
@@ -22,7 +67,7 @@
struct vt_stat vts;
#elif defined(__FreeBSD__)
int vers;
-@@ -134,7 +138,7 @@ ck_fd_is_a_console (int fd)
+@@ -134,7 +167,7 @@ ck_fd_is_a_console (int fd)
int kb_ok;
errno = 0;
Home |
Main Index |
Thread Index |
Old Index