2 configure.ac | 14 ++++++++
4 resource.c | 13 +++++++
5 session.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 5 files changed, 135 insertions(+), 1 deletion(-)
9 Index: xdm-1.1.10/configure.ac
10 ===================================================================
11 --- xdm-1.1.10.orig/configure.ac
12 +++ xdm-1.1.10/configure.ac
13 @@ -434,6 +434,20 @@ fi
15 AM_CONDITIONAL(DYNAMIC_GREETER, test x$DYNAMIC_GREETER = xyes)
18 +AC_ARG_WITH(consolekit, AC_HELP_STRING([--with-consolekit], [Use ConsoleKit]),
19 + [USE_CONSOLEKIT=$withval], [USE_CONSOLEKIT=yes])
20 +if test x"$USE_CONSOLEKIT" != xno; then
21 + PKG_CHECK_MODULES(CK_CONNECTOR, ck-connector,
22 + [USE_CONSOLEKIT=yes], [USE_CONSOLEKIT=no])
23 + if test x"$USE_CONSOLEKIT" = xyes; then
24 + AC_DEFINE([USE_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit])
25 + XDM_CFLAGS="$XDM_CFLAGS $CK_CONNECTOR_CFLAGS"
26 + XDM_LIBS="$XDM_LIBS $CK_CONNECTOR_LIBS"
29 +dnl AM_CONDITIONAL(USE_CONSOLEKIT, test$USE_CONSOLEKIT = xyes)
34 Index: xdm-1.1.10/session.c
35 ===================================================================
36 --- xdm-1.1.10.orig/session.c
37 +++ xdm-1.1.10/session.c
38 @@ -67,6 +67,11 @@ extern int key_setnet(struct key_netstar
42 +#ifdef USE_CONSOLEKIT
43 +#include <ck-connector.h>
44 +#include <dbus/dbus.h>
50 @@ -514,6 +519,97 @@ UnsecureDisplay (struct display *d, Disp
54 +#ifdef USE_CONSOLEKIT
56 +static CkConnector *connector;
58 +static int openCKSession(struct verify_info *verify, struct display *d)
62 + char *remote_host_name = "";
63 + dbus_bool_t is_local;
64 + char *display_name = "";
65 + char *display_device = "";
68 + if (!use_consolekit)
71 + is_local = d->displayType.location == Local;
72 + if (d->peerlen > 0 && d->peer)
73 + remote_host_name = d->peer;
75 + display_name = d->name;
76 + /* how can we get the corresponding tty at best...? */
77 + if (d->windowPath) {
78 + display_device = strchr(d->windowPath, ':');
79 + if (display_device && display_device[1])
82 + display_device = d->windowPath;
83 + snprintf(devtmp, sizeof(devtmp), "/dev/tty%s", display_device);
84 + display_device = devtmp;
87 + connector = ck_connector_new();
89 + LogOutOfMem("ck_connector");
93 + dbus_error_init(&error);
94 + ret = ck_connector_open_session_with_parameters(
96 + "unix-user", &verify->uid,
97 + "x11-display", &display_name,
98 + "x11-display-device", &display_device,
99 + "remote-host-name", &remote_host_name,
100 + "is-local", &is_local,
103 + if (dbus_error_is_set(&error)) {
104 + LogError("Dbus error: %s\n", error.message);
105 + dbus_error_free(&error);
107 + LogError("ConsoleKit error\n");
109 + LogError("console-kit-daemon not running?\n");
110 + ck_connector_unref(connector);
115 + verify->userEnviron = setEnv(verify->userEnviron,
116 + "XDG_SESSION_COOKIE", ck_connector_get_cookie(connector));
120 +static void closeCKSession(void)
127 + dbus_error_init(&error);
128 + if (!ck_connector_close_session(connector, &error)) {
129 + if (dbus_error_is_set(&error)) {
130 + LogError("Dbus error: %s\n", error.message);
131 + dbus_error_free(&error);
133 + LogError("ConsoleKit close error\n");
135 + LogError("console-kit-daemon not running?\n");
137 + ck_connector_unref(connector);
141 +#define openCKSession(v,d) 1
142 +#define closeCKSession()
146 SessionExit (struct display *d, int status, int removeAuth)
148 @@ -528,6 +624,8 @@ SessionExit (struct display *d, int stat
154 /* make sure the server gets reset after the session is over */
155 if (d->serverPid >= 2 && d->resetSignal)
156 kill (d->serverPid, d->resetSignal);
157 @@ -610,6 +708,10 @@ StartClient (
159 if (pamh) pam_open_session(pamh, 0);
162 + if (!openCKSession(verify, d))
165 switch (pid = fork ()) {
168 Index: xdm-1.1.10/dm.h
169 ===================================================================
170 --- xdm-1.1.10.orig/dm.h
172 @@ -323,6 +323,9 @@ extern char *randomFile;
173 extern char *prngdSocket;
174 extern int prngdPort;
176 +#ifdef USE_CONSOLEKIT
177 +extern int use_consolekit;
180 extern char *greeterLib;
181 extern char *willing;
182 Index: xdm-1.1.10/resource.c
183 ===================================================================
184 --- xdm-1.1.10.orig/resource.c
185 +++ xdm-1.1.10/resource.c
186 @@ -65,6 +65,9 @@ char *randomDevice;
190 +#ifdef USE_CONSOLEKIT
196 @@ -196,6 +199,10 @@ struct dmResources {
198 { "willing", "Willing", DM_STRING, &willing,
200 +#ifdef USE_CONSOLEKIT
201 +{ "consoleKit", "ConsoleKit", DM_BOOL, (char **) &use_consolekit,
206 #define NUM_DM_RESOURCES (sizeof DmResources / sizeof DmResources[0])
207 @@ -378,7 +385,11 @@ XrmOptionDescRec optionTable [] = {
208 {"-debug", "*debugLevel", XrmoptionSepArg, (caddr_t) NULL },
209 {"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL },
210 {"-daemon", ".daemonMode", XrmoptionNoArg, "true" },
211 -{"-nodaemon", ".daemonMode", XrmoptionNoArg, "false" }
212 +{"-nodaemon", ".daemonMode", XrmoptionNoArg, "false" },
213 +#ifdef USE_CONSOLEKIT
214 +{"-consolekit", ".consoleKit", XrmoptionNoArg, "true" },
215 +{"-noconsolekit", ".consoleKit", XrmoptionNoArg, "false" }
219 static int originalArgc;
220 Index: xdm-1.1.10/xdm.man.cpp
221 ===================================================================
222 --- xdm-1.1.10.orig/xdm.man.cpp
223 +++ xdm-1.1.10/xdm.man.cpp
224 @@ -48,6 +48,8 @@ xdm \- X Display Manager with support fo
233 @@ -215,6 +217,10 @@ indicates the program to run as the sess
234 .IP "\fB\-xrm\fP \fIresource_specification\fP"
235 Allows an arbitrary resource to be specified, as in most
236 X Toolkit applications.
237 +.IP "\fB\-noconsolekit\fP"
238 +Specifies ``false'' as the value for the \fBDisplayManager.consoleKit\fP
240 +This suppresses the session management using ConsoleKit.
242 At many stages the actions of