View | Details | Raw Unified | Return to bug 202269 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-15 / +17 lines)
Lines 2-37 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	consolekit
4
PORTNAME=	consolekit
5
PORTVERSION=	0.4.5
5
PORTVERSION=	1.2.0
6
PORTREVISION=	4
7
CATEGORIES=	sysutils gnome
6
CATEGORIES=	sysutils gnome
8
MASTER_SITES=	http://www.freedesktop.org/software/ConsoleKit/dist/
7
MASTER_SITES=	https://github.com/ConsoleKit2/ConsoleKit2/releases/download/${PORTVERSION}/
9
DISTFILES=	ConsoleKit-${PORTVERSION}${EXTRACT_SUFX}
8
DISTFILES=	ConsoleKit2-${PORTVERSION}${EXTRACT_SUFX}
10
9
11
MAINTAINER=	gnome@FreeBSD.org
10
MAINTAINER=	gnome@FreeBSD.org
12
COMMENT=	Framework for defining and tracking users
11
COMMENT=	Framework for defining and tracking users
13
12
13
LICENSE=	GPLv2
14
14
LIB_DEPENDS=	libdbus-glib-1.so:devel/dbus-glib \
15
LIB_DEPENDS=	libdbus-glib-1.so:devel/dbus-glib \
15
		libpolkit-gobject-1.so:sysutils/polkit
16
    		libpolkit-gobject-1.so:sysutils/polkit
16
17
17
WRKSRC=		${WRKDIR}/ConsoleKit-${PORTVERSION}
18
WRKSRC=		${WRKDIR}/ConsoleKit2-${PORTVERSION}
18
USES=		gettext gmake libtool pathfix pkgconfig tar:bzip2
19
USES=		gettext gmake libtool pathfix pkgconfig tar:bzip2 localbase
19
USE_XORG=	x11
20
USE_XORG=	x11
21
USE_GNOME=	glib20
20
GNU_CONFIGURE=	yes
22
GNU_CONFIGURE=	yes
21
USE_LDCONFIG=	yes
23
USE_LDCONFIG=	yes
22
CPPFLAGS+=	-I${LOCALBASE}/include
23
LDFLAGS+=	-L${LOCALBASE}/lib
24
CONFIGURE_ARGS=	--with-pid-file=/var/run/${PORTNAME}.pid \
24
CONFIGURE_ARGS=	--with-pid-file=/var/run/${PORTNAME}.pid \
25
		--enable-pam-module \
25
		--enable-pam-module \
26
		--with-pam-module-dir=${PREFIX}/lib \
26
		--with-pam-module-dir=${PREFIX}/lib \
27
		--localstatedir=/var
27
		--localstatedir=/var \
28
		--enable-polkit \
29
		--disable-udev-acl \
30
		--without-systemdsystemunitdir
28
INSTALL_TARGET=	install-strip
31
INSTALL_TARGET=	install-strip
29
32
30
post-install:
33
post-install:
31
	${INSTALL_SCRIPT} ${FILESDIR}/ck-get-x11-display-device \
34
	${MKDIR} ${STAGEDIR}/var/log/ConsoleKit
32
		${STAGEDIR}${PREFIX}/libexec/ck-get-x11-display-device
35
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xinit/xinitrc.d
33
	${INSTALL_SCRIPT} ${FILESDIR}/ck-get-x11-server-pid \
36
	${INSTALL_SCRIPT} ${WRKSRC}/data/90-consolekit \
34
		${STAGEDIR}${PREFIX}/libexec/ck-get-x11-server-pid
37
		${STAGEDIR}${PREFIX}/etc/X11/xinit/xinitrc.d
35
	@${MKDIR} ${STAGEDIR}/var/log/ConsoleKit
36
38
37
.include <bsd.port.mk>
39
.include <bsd.port.mk>
(-)distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (ConsoleKit-0.4.5.tar.bz2) = 43e0780c53078e125efcec3f847e484dc3533e49b408ce6a0ab1b223686b9c38
1
TIMESTAMP = 1500638647
2
SIZE (ConsoleKit-0.4.5.tar.bz2) = 425423
2
SHA256 (ConsoleKit2-1.2.0.tar.bz2) = d6ea13b306557a76519388de39bf7f1a1ea9010af147fad4fb3131ce634bd8b3
3
SIZE (ConsoleKit2-1.2.0.tar.bz2) = 1125402
(-)files/ck-get-x11-display-device (-46 lines)
Lines 1-46 Link Here
1
#!/bin/sh
2
3
FSTAT="/usr/bin/fstat"
4
GREP="/usr/bin/grep"
5
AWK="/usr/bin/awk"
6
SED="/usr/bin/sed"
7
CAT="/bin/cat"
8
9
dispnum=0
10
if [ x"$1" = x"--display" ]; then
11
    if [ $# != 2 ]; then
12
	echo "usage: $0 [--display DISPLAY]"
13
	exit 1
14
    fi
15
    DISPLAY=$2
16
fi
17
if [ ! -z "${DISPLAY}" ]; then
18
    dispnum=$(echo ${DISPLAY} | ${SED} -E -e 's|:([0-9]+).*|\1|')
19
fi
20
21
if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
22
    echo "ERROR: Failed to find X lock file for display ${dispnum}"
23
    exit 1
24
fi
25
pid=$(${CAT} "/tmp/.X${dispnum}-lock")
26
27
device=$(${FSTAT} -p ${pid} | ${GREP} ttyv | ${AWK} '{print $8}')
28
29
if [ -z "${device}" -a -f "/var/log/Xorg.$dispnum.log" ]; then
30
	device=$(awk '/using VT number/ { print "ttyv" ($7 - 1); }' \
31
	    "/var/log/Xorg.$dispnum.log")
32
fi
33
34
if [ -z "${device}" ]; then
35
    echo "ERROR: Failed to find TTY device for X server on display ${dispnum}"
36
    exit 1
37
fi
38
39
ret=""
40
for dev in ${device}; do
41
    if [ "${dev}" \> "${ret}" ]; then
42
	ret=${dev}
43
    fi
44
done
45
46
echo "/dev/${dev}"
(-)files/ck-get-x11-server-pid (-17 lines)
Lines 1-17 Link Here
1
#!/bin/sh
2
3
SED="/usr/bin/sed"
4
CAT="/bin/cat"
5
6
dispnum=0
7
if [ ! -z "${DISPLAY}" ]; then
8
    dispnum=$(echo ${DISPLAY} | ${SED} -E -e 's|:([0-9]+).*|\1|')
9
fi
10
11
if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
12
    echo "ERROR: Failed to find X lock file for display ${dispnum}"
13
    exit 1
14
fi
15
pid=$(${CAT} "/tmp/.X${dispnum}-lock")
16
17
echo ${pid}
(-)files/patch-src_ck-manager.c (-186 lines)
Lines 1-186 Link Here
1
$OpenBSD: patch-src_ck-manager_c,v 1.3 2011/04/28 13:08:33 ajacoutot Exp $
2
3
XXX revert 4f88228f31a63c026c424a92827f26ad7535275c
4
The Kit people assume the world runs Linux and PAM, see
5
https://bugs.freedesktop.org/show_bug.cgi?id=28377
6
7
--- src/ck-manager.c.orig	Tue Oct 26 16:34:03 2010
8
+++ src/ck-manager.c	Sat Dec  4 12:18:29 2010
9
@@ -1659,175 +1659,13 @@ open_session_for_leader (CkManager             *manage
10
         dbus_g_method_return (context, cookie);
11
 }
12
 
13
-enum {
14
-        PROP_STRING,
15
-        PROP_BOOLEAN,
16
-};
17
-
18
-#define CK_TYPE_PARAMETER_STRUCT (dbus_g_type_get_struct ("GValueArray", \
19
-                                                          G_TYPE_STRING,  \
20
-                                                          G_TYPE_VALUE, \
21
-                                                          G_TYPE_INVALID))
22
-
23
-static gboolean
24
-_get_parameter (GPtrArray  *parameters,
25
-                const char *name,
26
-                int         prop_type,
27
-                gpointer   *value)
28
-{
29
-        gboolean ret;
30
-        int      i;
31
-
32
-        if (parameters == NULL) {
33
-                return FALSE;
34
-        }
35
-
36
-        ret = FALSE;
37
-
38
-        for (i = 0; i < parameters->len && ret == FALSE; i++) {
39
-                gboolean    res;
40
-                GValue      val_struct = { 0, };
41
-                char       *prop_name;
42
-                GValue     *prop_val;
43
-
44
-                g_value_init (&val_struct, CK_TYPE_PARAMETER_STRUCT);
45
-                g_value_set_static_boxed (&val_struct, g_ptr_array_index (parameters, i));
46
-
47
-                res = dbus_g_type_struct_get (&val_struct,
48
-                                              0, &prop_name,
49
-                                              1, &prop_val,
50
-                                              G_MAXUINT);
51
-                if (! res) {
52
-                        g_debug ("Unable to extract parameter input");
53
-                        goto cont;
54
-                }
55
-
56
-                if (prop_name == NULL) {
57
-                        g_debug ("Skipping NULL parameter");
58
-                        goto cont;
59
-                }
60
-
61
-                if (strcmp (prop_name, name) != 0) {
62
-                        goto cont;
63
-                }
64
-
65
-                switch (prop_type) {
66
-                case PROP_STRING:
67
-                        if (value != NULL) {
68
-                                *value = g_value_dup_string (prop_val);
69
-                        }
70
-                        break;
71
-                case PROP_BOOLEAN:
72
-                        if (value != NULL) {
73
-                                *(gboolean *)value = g_value_get_boolean (prop_val);
74
-                        }
75
-                        break;
76
-                default:
77
-                        g_assert_not_reached ();
78
-                        break;
79
-                }
80
-
81
-                ret = TRUE;
82
-
83
-        cont:
84
-                g_free (prop_name);
85
-                if (prop_val != NULL) {
86
-                        g_value_unset (prop_val);
87
-                        g_free (prop_val);
88
-                }
89
-        }
90
-
91
-        return ret;
92
-}
93
-
94
-static gboolean
95
-_verify_login_session_id_is_local (CkManager  *manager,
96
-                                   const char *login_session_id)
97
-{
98
-        GHashTableIter iter;
99
-        const char    *id;
100
-        CkSession     *session;
101
-
102
-        g_return_val_if_fail (CK_IS_MANAGER (manager), FALSE);
103
-
104
-        /* If any local session exists for the given login session id
105
-           then that means a trusted party has vouched for the
106
-           original login */
107
-
108
-        g_debug ("Looking for local sessions for login-session-id=%s", login_session_id);
109
-
110
-        session = NULL;
111
-        g_hash_table_iter_init (&iter, manager->priv->sessions);
112
-        while (g_hash_table_iter_next (&iter, (gpointer *)&id, (gpointer *)&session)) {
113
-                if (session != NULL) {
114
-                        gboolean is_local;
115
-                        char    *sessid;
116
-
117
-                        sessid = NULL;
118
-                        g_object_get (session,
119
-                                      "login-session-id", &sessid,
120
-                                      "is-local", &is_local,
121
-                                      NULL);
122
-                        if (g_strcmp0 (sessid, login_session_id) == 0 && is_local) {
123
-                                g_debug ("CkManager: found is-local=true on %s", id);
124
-                                return TRUE;
125
-                        }
126
-                }
127
-        }
128
-
129
-        return FALSE;
130
-}
131
-
132
 static void
133
-add_param_boolean (GPtrArray  *parameters,
134
-                   const char *key,
135
-                   gboolean    value)
136
-{
137
-        GValue   val = { 0, };
138
-        GValue   param_val = { 0, };
139
-
140
-        g_value_init (&val, G_TYPE_BOOLEAN);
141
-        g_value_set_boolean (&val, value);
142
-        g_value_init (&param_val, CK_TYPE_PARAMETER_STRUCT);
143
-        g_value_take_boxed (&param_val,
144
-                            dbus_g_type_specialized_construct (CK_TYPE_PARAMETER_STRUCT));
145
-        dbus_g_type_struct_set (&param_val,
146
-                                0, key,
147
-                                1, &val,
148
-                                G_MAXUINT);
149
-        g_value_unset (&val);
150
-
151
-        g_ptr_array_add (parameters, g_value_get_boxed (&param_val));
152
-}
153
-
154
-static void
155
 verify_and_open_session_for_leader (CkManager             *manager,
156
                                     CkSessionLeader       *leader,
157
-                                    GPtrArray             *parameters,
158
+                                    const GPtrArray       *parameters,
159
                                     DBusGMethodInvocation *context)
160
 {
161
-        /* Only allow a local session if originating from an existing
162
-           local session.  Effectively this means that only trusted
163
-           parties can create local sessions. */
164
-
165
-        g_debug ("CkManager: verifying session for leader");
166
-
167
-        if (parameters != NULL && ! _get_parameter (parameters, "is-local", PROP_BOOLEAN, NULL)) {
168
-                gboolean is_local;
169
-                char    *login_session_id;
170
-
171
-                g_debug ("CkManager: is-local has not been set, will inherit from existing login-session-id if available");
172
-
173
-                is_local = FALSE;
174
-
175
-                if (_get_parameter (parameters, "login-session-id", PROP_STRING, (gpointer *) &login_session_id)) {
176
-                        is_local = _verify_login_session_id_is_local (manager, login_session_id);
177
-                        g_debug ("CkManager: found is-local=%s", is_local ? "true" : "false");
178
-                }
179
-
180
-                add_param_boolean (parameters, "is-local", is_local);
181
-        }
182
-
183
+        /* for now don't bother verifying since we protect OpenSessionWithParameters */
184
         open_session_for_leader (manager,
185
                                  leader,
186
                                  parameters,
(-)files/patch-src_ck-sysdeps-freebsd.c (-208 lines)
Lines 1-208 Link Here
1
--- src/ck-sysdeps-freebsd.c.orig	2010-09-03 15:54:31.000000000 +0200
2
+++ src/ck-sysdeps-freebsd.c	2015-03-23 09:28:20.476513000 +0100
3
@@ -27,6 +27,7 @@
4
 #include <unistd.h>
5
 #include <string.h>
6
 #include <errno.h>
7
+#include <glob.h>
8
 #include <paths.h>
9
 #include <ttyent.h>
10
 #include <kvm.h>
11
@@ -202,7 +203,6 @@ ck_process_stat_new_for_unix_pid (pid_t 
12
                                   GError        **error)
13
 {
14
         gboolean       res;
15
-        GError        *local_error;
16
         CkProcessStat *proc;
17
 
18
         g_return_val_if_fail (pid > 1, FALSE);
19
@@ -217,7 +217,6 @@ ck_process_stat_new_for_unix_pid (pid_t 
20
         if (res) {
21
                 *stat = proc;
22
         } else {
23
-                g_propagate_error (error, local_error);
24
                 *stat = NULL;
25
         }
26
 
27
@@ -233,24 +232,28 @@ ck_process_stat_free (CkProcessStat *sta
28
 GHashTable *
29
 ck_unix_pid_get_env_hash (pid_t pid)
30
 {
31
-        GHashTable       *hash;
32
+        GHashTable       *hash = NULL;
33
         char            **penv;
34
+        char              errbuf[_POSIX2_LINE_MAX];
35
         kvm_t            *kd;
36
         struct kinfo_proc p;
37
         int               i;
38
 
39
-        kd = kvm_openfiles (_PATH_DEVNULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL);
40
+        kd = kvm_openfiles (_PATH_DEVNULL, _PATH_DEVNULL, NULL, O_RDONLY, errbuf);
41
         if (kd == NULL) {
42
+                g_warning ("kvm_openfiles failed: %s", errbuf);
43
                 return NULL;
44
         }
45
 
46
         if (! get_kinfo_proc (pid, &p)) {
47
-                return NULL;
48
+                g_warning ("get_kinfo_proc failed: %s", g_strerror (errno));
49
+                goto fail;
50
         }
51
 
52
         penv = kvm_getenvv (kd, &p, 0);
53
         if (penv == NULL) {
54
-                return NULL;
55
+                g_warning ("kvm_getenvv failed: %s", kvm_geterr (kd));
56
+                goto fail;
57
         }
58
 
59
         hash = g_hash_table_new_full (g_str_hash,
60
@@ -261,6 +264,9 @@ ck_unix_pid_get_env_hash (pid_t pid)
61
         for (i = 0; penv[i] != NULL; i++) {
62
                 char **vals;
63
 
64
+	        if (!penv[i][0])
65
+	                continue;
66
+
67
                 vals = g_strsplit (penv[i], "=", 2);
68
                 if (vals != NULL) {
69
                         g_hash_table_insert (hash,
70
@@ -270,6 +276,7 @@ ck_unix_pid_get_env_hash (pid_t pid)
71
                 }
72
         }
73
 
74
+fail:
75
         kvm_close (kd);
76
 
77
         return hash;
78
@@ -280,7 +287,7 @@ ck_unix_pid_get_env (pid_t       pid,
79
                      const char *var)
80
 {
81
         GHashTable *hash;
82
-        char       *val;
83
+        char       *val = NULL;
84
 
85
         /*
86
          * Would probably be more efficient to just loop through the
87
@@ -288,6 +295,8 @@ ck_unix_pid_get_env (pid_t       pid,
88
          * table, but this works for now.
89
          */
90
         hash = ck_unix_pid_get_env_hash (pid);
91
+        if (hash == NULL)
92
+                return val;
93
         val  = g_strdup (g_hash_table_lookup (hash, var));
94
         g_hash_table_destroy (hash);
95
 
96
@@ -327,38 +336,38 @@ gboolean
97
 ck_get_max_num_consoles (guint *num)
98
 {
99
         int      max_consoles;
100
-        int      res;
101
-        gboolean ret;
102
-        struct ttyent *t;
103
+        int      i;
104
+        glob_t   g;
105
 
106
-        ret = FALSE;
107
         max_consoles = 0;
108
 
109
-        res = setttyent ();
110
-        if (res == 0) {
111
-                goto done;
112
-        }
113
+        g.gl_offs = 0;
114
+        glob ("/dev/ttyv*", GLOB_DOOFFS | GLOB_NOSORT, NULL, &g);
115
+        for (i = 0; i < g.gl_pathc && g.gl_pathv[i] != NULL; i++) {
116
+                struct stat sb;
117
+                char *cdev;
118
 
119
-        while ((t = getttyent ()) != NULL) {
120
-                if (t->ty_status & TTY_ON && strncmp (t->ty_name, "ttyv", 4) == 0)
121
+                cdev = g.gl_pathv[i];
122
+                if (stat (cdev, &sb) > -1 && S_ISCHR (sb.st_mode)) {
123
                         max_consoles++;
124
+                } else {
125
+                        break;
126
+                }
127
         }
128
 
129
-        /* Increment one more so that all consoles are properly counted
130
+        globfree (&g);
131
+
132
+        /*
133
+         * Increment one more so that all consoles are properly counted
134
          * this is arguable a bug in vt_add_watches().
135
          */
136
         max_consoles++;
137
 
138
-        ret = TRUE;
139
-
140
-        endttyent ();
141
-
142
-done:
143
         if (num != NULL) {
144
                 *num = max_consoles;
145
         }
146
 
147
-        return ret;
148
+        return TRUE;
149
 }
150
 
151
 gboolean
152
@@ -375,7 +384,12 @@ ck_get_console_device_for_num (guint num
153
         /* The device number is always one less than the VT number. */
154
         num--;
155
 
156
-        device = g_strdup_printf ("/dev/ttyv%u", num);
157
+        if (num < 10)
158
+                device = g_strdup_printf ("/dev/ttyv%i", num);
159
+        else if (num < 32)
160
+                device = g_strdup_printf ("/dev/ttyv%c", num - 10 + 'a');
161
+        else
162
+                device = NULL;
163
 
164
         return device;
165
 }
166
@@ -385,6 +399,7 @@ ck_get_console_num_from_device (const ch
167
                                 guint      *num)
168
 {
169
         guint    n;
170
+        char     c;
171
         gboolean ret;
172
 
173
         n = 0;
174
@@ -394,7 +409,11 @@ ck_get_console_num_from_device (const ch
175
                 return FALSE;
176
         }
177
 
178
-        if (sscanf (device, "/dev/ttyv%u", &n) == 1) {
179
+        if (sscanf (device, "/dev/ttyv%c", &c) == 1) {
180
+                if (c < 58)
181
+                        n = c - 48;
182
+                else
183
+                        n = c - 'a' + 10;
184
                 /* The VT number is always one more than the device number. */
185
                 n++;
186
                 ret = TRUE;
187
@@ -414,6 +433,7 @@ ck_get_active_console_num (int    consol
188
         gboolean ret;
189
         int      res;
190
         int      active;
191
+        char      ttyn;
192
 
193
         g_assert (console_fd != -1);
194
 
195
@@ -426,7 +446,12 @@ ck_get_active_console_num (int    consol
196
                 goto out;
197
         }
198
 
199
-        g_debug ("Active VT is: %d (ttyv%d)", active, active - 1);
200
+        if (active - 1 < 10)
201
+                ttyn = active - 1 + '0';
202
+        else
203
+                ttyn = active - 11 + 'a';
204
+
205
+        g_debug ("Active VT is: %d (ttyv%c)", active, ttyn);
206
         ret = TRUE;
207
 
208
  out:
(-)files/patch-src_ck-sysdeps-unix.c (-18 lines)
Lines 1-18 Link Here
1
--- src/ck-sysdeps-unix.c.orig	2008-02-06 22:59:55.000000000 -0500
2
+++ src/ck-sysdeps-unix.c	2008-02-06 22:52:34.000000000 -0500
3
@@ -172,6 +172,15 @@ ck_get_a_console_fd (void)
4
 
5
         fd = -1;
6
 
7
+#ifdef __FreeBSD__
8
+	/* On FreeBSD, try /dev/consolectl first as this will survive
9
+	 * /etc/ttys initialization. */
10
+	fd = open_a_console ("/dev/consolectl");
11
+	if (fd >= 0) {
12
+		goto done;
13
+	}
14
+#endif
15
+
16
 #ifdef __sun
17
         /* On Solaris, first try Sun VT device. */
18
         fd = open_a_console ("/dev/vt/active");
(-)files/patch-src_main.c (-33 lines)
Lines 1-33 Link Here
1
--- src/main.c.orig        2007-11-08 15:05:55.000000000 -0500
2
+++ src/main.c        2007-11-08 15:07:39.000000000 -0500
3
@@ -226,6 +226,21 @@ sigusr1_handler (int sig)
4
 }
5
 
6
 static void
7
+setup_termination_signals (void)
8
+{
9
+        struct sigaction sa;
10
+
11
+        sa.sa_handler = SIG_DFL;
12
+        sigemptyset (&sa.sa_mask);
13
+        sa.sa_flags = 0;
14
+
15
+        sigaction (SIGTERM, &sa, NULL);
16
+        sigaction (SIGQUIT, &sa, NULL);
17
+        sigaction (SIGINT, &sa, NULL);
18
+        sigaction (SIGHUP, &sa, NULL);
19
+}
20
+
21
+static void
22
 setup_debug_log_signals (void)
23
 {
24
         struct sigaction sa;
25
@@ -300,6 +315,8 @@ main (int    argc,
26
 
27
         setup_debug_log (debug);
28
 
29
+        setup_termination_signals ();
30
+
31
         connection = get_system_bus ();
32
         if (connection == NULL) {
33
                 goto out;
(-)files/patch-src_test-vt-monitor.c (-33 lines)
Lines 1-33 Link Here
1
--- src/test-vt-monitor.c.orig	2007-08-17 13:08:55.000000000 -0400
2
+++ src/test-vt-monitor.c	2007-11-08 15:11:37.000000000 -0500
3
@@ -31,6 +31,7 @@
4
 #include <pwd.h>
5
 #include <string.h>
6
 #include <errno.h>
7
+#include <signal.h>
8
 
9
 #include <locale.h>
10
 
11
@@ -55,12 +56,22 @@ main (int argc, char **argv)
12
         GError           *error;
13
         guint             num;
14
         gboolean          res;
15
+	struct sigaction  sa;
16
 
17
         if (! g_thread_supported ()) {
18
                 g_thread_init (NULL);
19
         }
20
         g_type_init ();
21
 
22
+	sa.sa_handler = SIG_DFL;
23
+	sigemptyset (&sa.sa_mask);
24
+	sa.sa_flags = 0;
25
+
26
+	sigaction (SIGINT,  &sa, NULL);
27
+	sigaction (SIGTERM, &sa, NULL);
28
+	sigaction (SIGQUIT, &sa, NULL);
29
+	sigaction (SIGHUP,  &sa, NULL);
30
+
31
         if (! ck_is_root_user ()) {
32
                 g_warning ("Must be run as root");
33
                 exit (1);
(-)files/patch-tools_Makefile.in (-77 lines)
Lines 1-77 Link Here
1
--- tools/Makefile.in.orig	2010-10-23 11:29:43.000000000 +0200
2
+++ tools/Makefile.in	2010-10-23 11:32:41.000000000 +0200
3
@@ -43,8 +43,7 @@ sbin_PROGRAMS = ck-log-system-start$(EXE
4
 	ck-log-system-restart$(EXEEXT) ck-log-system-stop$(EXEEXT) \
5
 	$(am__EXEEXT_1)
6
 libexec_PROGRAMS = ck-collect-session-info$(EXEEXT) \
7
-	ck-get-x11-server-pid$(EXEEXT) \
8
-	ck-get-x11-display-device$(EXEEXT) $(am__EXEEXT_1)
9
+	$(am__EXEEXT_1)
10
 subdir = tools
11
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
12
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
13
@@ -71,17 +70,6 @@ ck_collect_session_info_DEPENDENCIES = $
14
 AM_V_lt = $(am__v_lt_$(V))
15
 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
16
 am__v_lt_0 = --silent
17
-am_ck_get_x11_display_device_OBJECTS =  \
18
-	ck-get-x11-display-device.$(OBJEXT) $(am__objects_1)
19
-ck_get_x11_display_device_OBJECTS =  \
20
-	$(am_ck_get_x11_display_device_OBJECTS)
21
-ck_get_x11_display_device_DEPENDENCIES = $(am__DEPENDENCIES_1) \
22
-	$(top_builddir)/src/libck.la $(am__DEPENDENCIES_1)
23
-am_ck_get_x11_server_pid_OBJECTS = ck-get-x11-server-pid.$(OBJEXT) \
24
-	$(am__objects_1)
25
-ck_get_x11_server_pid_OBJECTS = $(am_ck_get_x11_server_pid_OBJECTS)
26
-ck_get_x11_server_pid_DEPENDENCIES = $(am__DEPENDENCIES_1) \
27
-	$(top_builddir)/src/libck.la $(am__DEPENDENCIES_1)
28
 am_ck_history_OBJECTS = ck-history.$(OBJEXT) $(am__objects_1)
29
 ck_history_OBJECTS = $(am_ck_history_OBJECTS)
30
 ck_history_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
31
@@ -441,24 +429,6 @@ ck_collect_session_info_LDADD = \
32
 	$(top_builddir)/src/libck.la	\
33
 	$(NULL)
34
 
35
-ck_get_x11_server_pid_SOURCES = \
36
-	ck-get-x11-server-pid.c		\
37
-	$(NULL)
38
-
39
-ck_get_x11_server_pid_LDADD = \
40
-	$(TOOLS_LIBS)			\
41
-	$(top_builddir)/src/libck.la	\
42
-	$(NULL)
43
-
44
-ck_get_x11_display_device_SOURCES = \
45
-	ck-get-x11-display-device.c	\
46
-	$(NULL)
47
-
48
-ck_get_x11_display_device_LDADD = \
49
-	$(TOOLS_LIBS)			\
50
-	$(top_builddir)/src/libck.la	\
51
-	$(NULL)
52
-
53
 EXTRA_DIST = \
54
 	$(NULL)
55
 
56
@@ -632,12 +602,6 @@ clean-sbinPROGRAMS:
57
 ck-collect-session-info$(EXEEXT): $(ck_collect_session_info_OBJECTS) $(ck_collect_session_info_DEPENDENCIES) 
58
 	@rm -f ck-collect-session-info$(EXEEXT)
59
 	$(AM_V_CCLD)$(LINK) $(ck_collect_session_info_OBJECTS) $(ck_collect_session_info_LDADD) $(LIBS)
60
-ck-get-x11-display-device$(EXEEXT): $(ck_get_x11_display_device_OBJECTS) $(ck_get_x11_display_device_DEPENDENCIES) 
61
-	@rm -f ck-get-x11-display-device$(EXEEXT)
62
-	$(AM_V_CCLD)$(LINK) $(ck_get_x11_display_device_OBJECTS) $(ck_get_x11_display_device_LDADD) $(LIBS)
63
-ck-get-x11-server-pid$(EXEEXT): $(ck_get_x11_server_pid_OBJECTS) $(ck_get_x11_server_pid_DEPENDENCIES) 
64
-	@rm -f ck-get-x11-server-pid$(EXEEXT)
65
-	$(AM_V_CCLD)$(LINK) $(ck_get_x11_server_pid_OBJECTS) $(ck_get_x11_server_pid_LDADD) $(LIBS)
66
 ck-history$(EXEEXT): $(ck_history_OBJECTS) $(ck_history_DEPENDENCIES) 
67
 	@rm -f ck-history$(EXEEXT)
68
 	$(AM_V_CCLD)$(LINK) $(ck_history_OBJECTS) $(ck_history_LDADD) $(LIBS)
69
@@ -664,8 +628,6 @@ distclean-compile:
70
 	-rm -f *.tab.c
71
 
72
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-collect-session-info.Po@am__quote@
73
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-get-x11-display-device.Po@am__quote@
74
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-get-x11-server-pid.Po@am__quote@
75
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-history.Po@am__quote@
76
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-launch-session.Po@am__quote@
77
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ck-log-system-restart.Po@am__quote@
(-)files/patch-tools_ck-collect-session-info.c (-92 lines)
Lines 1-92 Link Here
1
$OpenBSD: patch-tools_ck-collect-session-info_c,v 1.1 2011/04/28 13:08:33 ajacoutot Exp $
2
3
XXX revert 4f88228f31a63c026c424a92827f26ad7535275c
4
The Kit people assume the world runs Linux and PAM, see
5
https://bugs.freedesktop.org/show_bug.cgi?id=28377
6
--- tools/ck-collect-session-info.c.orig	2013-08-10 20:47:52.000000000 +0200
7
+++ tools/ck-collect-session-info.c	2013-08-10 20:47:33.000000000 +0200
8
@@ -226,6 +226,12 @@ fill_x11_info (SessionInfo *si)
9
         gboolean       res;
10
         CkProcessStat *xorg_stat;
11
         GError        *error;
12
+        char          *err;
13
+        char          *out;
14
+        int            status;
15
+        int            i;
16
+        char          *argv[4];
17
+        GPtrArray     *env;
18
 
19
         /* assume this is true then check it */
20
         si->x11_display = ck_unix_pid_get_env (si->pid, "DISPLAY");
21
@@ -272,9 +278,56 @@ fill_x11_info (SessionInfo *si)
22
         }
23
 
24
         si->x11_display_device = ck_process_stat_get_tty (xorg_stat);
25
+        if (g_strcmp0 (si->x11_display_device, si->display_device) != 0) {
26
+                goto gotit;
27
+        }
28
+
29
+        g_free (si->x11_display_device);
30
+
31
+        /* get the applicable environment */
32
+        env = get_filtered_environment (si->pid);
33
+
34
+        argv[0] = LIBEXECDIR "/ck-get-x11-display-device";
35
+        argv[1] = NULL;
36
+
37
+        error = NULL;
38
+        out = NULL;
39
+        err = NULL;
40
+        status = -1;
41
+        res = g_spawn_sync (NULL,
42
+                            argv,
43
+                            (char **)env->pdata,
44
+                            0,
45
+                            (GSpawnChildSetupFunc)setuid_child_setup_func,
46
+                            si,
47
+                            &out,
48
+                            &err,
49
+                            &status,
50
+                            &error);
51
+        for (i = 0; i < env->len; i++) {
52
+                g_free (g_ptr_array_index (env, i));
53
+        }
54
+        g_ptr_array_free (env, TRUE);
55
+
56
+        if (error != NULL) {
57
+                g_warning ("Unable to get display device for x11 server: %s", error->message);
58
+                g_error_free (error);
59
+        }
60
+
61
+        if (status == 0) {
62
+                if (res && out != NULL) {
63
+                        si->x11_display_device = g_strstrip (out);
64
+                        goto gotit;
65
+                }
66
+        }
67
+
68
+        si->x11_display_device = ck_process_stat_get_tty (xorg_stat);
69
+
70
+gotit:
71
         ck_process_stat_free (xorg_stat);
72
 
73
-        /* don't set is-local here - let the daemon do that */
74
+        si->is_local = TRUE;
75
+        si->is_local_is_set = TRUE;
76
 
77
         g_free (si->remote_host_name);
78
         si->remote_host_name = NULL;
79
@@ -303,6 +356,13 @@ fill_session_info (SessionInfo *si)
80
 
81
         fill_x11_info (si);
82
 
83
+        if (! si->is_local_is_set) {
84
+                /* FIXME: how should we set this? */
85
+                /* non x11 sessions must be local I guess */
86
+                si->is_local = TRUE;
87
+                si->is_local_is_set = TRUE;
88
+        }
89
+
90
         res = ck_unix_pid_get_login_session_id (si->pid, &si->login_session_id);
91
         if (! res) {
92
                 si->login_session_id = NULL;
(-)files/patch-tools_ck-history.c (-20 lines)
Lines 1-20 Link Here
1
--- tools/ck-history.c.orig	2010-09-03 15:54:31.000000000 +0200
2
+++ tools/ck-history.c	2013-08-10 20:56:36.000000000 +0200
3
@@ -511,7 +511,7 @@
4
         char                       *session_type;
5
         char                       *session_id;
6
         char                       *seat_id;
7
-        CkLogSeatSessionAddedEvent *e;
8
+        CkLogSeatSessionAddedEvent *e = NULL;
9
         CkLogEvent                 *remove_event;
10
         RecordStatus                status;
11
 
12
@@ -804,7 +804,7 @@
13
                 data = user_counts->data;
14
 
15
                 username = get_user_name_for_uid (data->uid);
16
-                g_print ("%-8.8s %u\n", username, data->count);
17
+                g_print ("%-8s %u\n", username, data->count);
18
                 g_free (data);
19
                 user_counts = g_list_delete_link (user_counts, user_counts);
20
                 g_free (username);
(-)files/patch-tools_ck-log-system-start.c (-60 lines)
Lines 1-60 Link Here
1
--- tools/ck-log-system-start.c.orig	2009-09-14 20:08:10.000000000 -0400
2
+++ tools/ck-log-system-start.c	2009-09-26 01:35:37.000000000 -0400
3
@@ -26,6 +26,9 @@
4
 #include <unistd.h>
5
 #include <errno.h>
6
 #include <fcntl.h>
7
+#ifdef __FreeBSD__
8
+#include <kenv.h>
9
+#endif
10
 #include <sys/types.h>
11
 #include <sys/stat.h>
12
 #include <sys/utsname.h>
13
@@ -41,7 +44,9 @@
14
 
15
 #define DEFAULT_LOG_FILENAME LOCALSTATEDIR "/log/ConsoleKit/history"
16
 
17
+#ifdef __linux__
18
 #define LINUX_KERNEL_CMDLINE "/proc/cmdline"
19
+#endif
20
 
21
 /* Adapted from auditd auditd-event.c */
22
 static gboolean
23
@@ -162,6 +167,7 @@ write_log_for_event (CkLogEvent *event)
24
 static char *
25
 get_boot_arguments (void)
26
 {
27
+#if defined(__linux__)
28
         char *contents;
29
         gboolean res;
30
 
31
@@ -178,6 +184,29 @@ get_boot_arguments (void)
32
         }
33
 
34
         return contents;
35
+#elif defined(__FreeBSD__)
36
+        char kern_name[1024], root[1024], mopts[1024];
37
+        char *options;
38
+
39
+        options = NULL;
40
+        if (kenv(KENV_GET, "kernelname", kern_name, sizeof (kern_name)) == -1) {
41
+                return options;
42
+        }
43
+
44
+        if (kenv(KENV_GET, "vfs.root.mountfrom.options", mopts, sizeof (mopts)) == -1) {
45
+                g_strlcpy (mopts, "ro", sizeof (mopts));
46
+        }
47
+
48
+        if (kenv(KENV_GET, "vfs.root.mountfrom", root, sizeof (root)) == -1) {
49
+                g_strlcpy (root, "/", sizeof (root));
50
+        }
51
+
52
+        options = g_strdup_printf ("%s %s root=%s", mopts, kern_name, root);
53
+
54
+        return options;
55
+#else
56
+        return NULL;
57
+#endif
58
 }
59
 
60
 int
(-)pkg-descr (-4 / +19 lines)
Lines 1-6 Link Here
1
ConsoleKit is a framework for defining and tracking users, login
1
ConsoleKit is a framework for defining and tracking users, login
2
sessions, and seats.  The primary motivations for this framework are to
2
sessions, and seats. It allows multiple users to be logged in at the
3
facilitate fast-user-switching and multi-seat capabilities, and to
3
same time and share hardware for their graphical session. ConsoleKit
4
enable more sophisticated policy decisions for desktop sessions.
4
will keep track of those resources and whichever session is active
5
will have use of the hardware at that time.
6
 
5
7
6
WWW: http://www.freedesktop.org/wiki/Software/ConsoleKit
8
What is a seat?
9
===============
10
A seat is a collection of sessions and a set of hardware (usually at
11
least a keyboard and mouse).  Only one session may be active on a
12
seat at a time.
13
14
What is a session?
15
==================
16
A session is a collection of all processes that originate from a single
17
common ancestor and retain knowledge of a secret.  As an implementation
18
detail, this secret may be stored in the process environment by the
19
login manager under the name XDG_SESSION_COOKIE.
20
21
WWW: https://github.com/ConsoleKit2/ConsoleKit2
(-)pkg-plist (-8 / +44 lines)
Lines 1-35 Link Here
1
bin/ck-history
1
bin/ck-history
2
bin/ck-launch-session
2
bin/ck-launch-session
3
bin/ck-list-sessions
3
bin/ck-list-sessions
4
sbin/ck-log-system-restart
5
sbin/ck-log-system-start
6
sbin/ck-log-system-stop
7
etc/ConsoleKit/seats.d/00-primary.seat
4
etc/ConsoleKit/seats.d/00-primary.seat
5
etc/X11/xinit/xinitrc.d/90-consolekit
8
etc/dbus-1/system.d/ConsoleKit.conf
6
etc/dbus-1/system.d/ConsoleKit.conf
7
etc/logrotate.d/consolekit
9
include/ConsoleKit/ck-connector/ck-connector.h
8
include/ConsoleKit/ck-connector/ck-connector.h
9
include/ConsoleKit/libconsolekit.h
10
lib/ConsoleKit/scripts/ck-get-x11-display-device
11
lib/ConsoleKit/scripts/ck-get-x11-server-pid
12
lib/ConsoleKit/scripts/ck-system-hibernate
13
lib/ConsoleKit/scripts/ck-system-hybridsleep
10
lib/ConsoleKit/scripts/ck-system-restart
14
lib/ConsoleKit/scripts/ck-system-restart
11
lib/ConsoleKit/scripts/ck-system-stop
15
lib/ConsoleKit/scripts/ck-system-stop
16
lib/ConsoleKit/scripts/ck-system-suspend
17
lib/girepository-1.0/libconsolekit-1.0.typelib
12
lib/libck-connector.so
18
lib/libck-connector.so
13
lib/libck-connector.so.0
19
lib/libck-connector.so.0
14
lib/libck-connector.so.0.0.0
20
lib/libck-connector.so.0.0.0
21
lib/libconsolekit.so
22
lib/libconsolekit.so.1
23
lib/libconsolekit.so.1.0.0
15
lib/pam_ck_connector.so
24
lib/pam_ck_connector.so
16
libdata/pkgconfig/ck-connector.pc
25
libdata/pkgconfig/ck-connector.pc
26
libdata/pkgconfig/libconsolekit.pc
17
libexec/ck-collect-session-info
27
libexec/ck-collect-session-info
18
libexec/ck-get-x11-display-device
28
libexec/ck-get-x11-display-device
19
libexec/ck-get-x11-server-pid
29
libexec/ck-get-x11-server-pid
30
libexec/ck-remove-directory
31
man/man1/ck-history.1.gz
32
man/man1/ck-launch-session.1.gz
33
man/man1/ck-list-sessions.1.gz
34
man/man1/console-kit-daemon.1m.gz
20
man/man8/pam_ck_connector.8.gz
35
man/man8/pam_ck_connector.8.gz
36
sbin/ck-log-system-restart
37
sbin/ck-log-system-start
38
sbin/ck-log-system-stop
21
sbin/console-kit-daemon
39
sbin/console-kit-daemon
22
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Manager.xml
40
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Manager.xml
23
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Seat.xml
41
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Seat.xml
24
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Session.xml
42
share/dbus-1/interfaces/org.freedesktop.ConsoleKit.Session.xml
25
share/dbus-1/system-services/org.freedesktop.ConsoleKit.service
43
share/dbus-1/system-services/org.freedesktop.ConsoleKit.service
44
share/gir-1.0/libconsolekit-1.0.gir
45
share/gtk-doc/html/libconsolekit-1.0/annotation-glossary.html
46
share/gtk-doc/html/libconsolekit-1.0/api-index-1.0.html
47
share/gtk-doc/html/libconsolekit-1.0/api-index-deprecated.html
48
share/gtk-doc/html/libconsolekit-1.0/api-index-full.html
49
share/gtk-doc/html/libconsolekit-1.0/ch01.html
50
share/gtk-doc/html/libconsolekit-1.0/home.png
51
share/gtk-doc/html/libconsolekit-1.0/index.html
52
share/gtk-doc/html/libconsolekit-1.0/left-insensitive.png
53
share/gtk-doc/html/libconsolekit-1.0/left.png
54
share/gtk-doc/html/libconsolekit-1.0/libconsolekit-1.0.devhelp2
55
share/gtk-doc/html/libconsolekit-1.0/libconsolekit-libconsolekit.html
56
share/gtk-doc/html/libconsolekit-1.0/right-insensitive.png
57
share/gtk-doc/html/libconsolekit-1.0/right.png
58
share/gtk-doc/html/libconsolekit-1.0/style.css
59
share/gtk-doc/html/libconsolekit-1.0/up-insensitive.png
60
share/gtk-doc/html/libconsolekit-1.0/up.png
61
share/locale/bg/LC_MESSAGES/ConsoleKit2.mo
62
share/locale/es/LC_MESSAGES/ConsoleKit2.mo
63
share/locale/es_419/LC_MESSAGES/ConsoleKit2.mo
64
share/locale/ru/LC_MESSAGES/ConsoleKit2.mo
26
share/polkit-1/actions/org.freedesktop.consolekit.policy
65
share/polkit-1/actions/org.freedesktop.consolekit.policy
27
@dir /var/run/ConsoleKit
28
@dir /var/log/ConsoleKit
29
@postexec /usr/bin/touch /var/log/ConsoleKit/history
30
@rmtry /var/log/ConsoleKit/history
31
@dir etc/ConsoleKit/run-seat.d
66
@dir etc/ConsoleKit/run-seat.d
32
@dir etc/ConsoleKit/run-session.d
67
@dir etc/ConsoleKit/run-session.d
33
@dir lib/ConsoleKit/run-seat.d
68
@dir lib/ConsoleKit/run-seat.d
34
@dir lib/ConsoleKit/run-session.d
69
@dir lib/ConsoleKit/run-session.d
35
70
@dir /var/log/ConsoleKit
71
@dir /var/run/ConsoleKit

Return to bug 202269