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 --- xdm-1.1.12/xdm/session.c.orig 2019-03-02 23:06:13.000000000 +0100
35 +++ xdm-1.1.12/xdm/session.c 2019-03-05 18:55:19.964592706 +0100
36 @@ -73,6 +73,11 @@ extern int key_setnet(struct key_netstar
40 +#ifdef USE_CONSOLEKIT
41 +#include <ck-connector.h>
42 +#include <dbus/dbus.h>
46 #include <selinux/selinux.h>
47 #include <selinux/get_context_list.h>
48 @@ -523,6 +528,97 @@ UnsecureDisplay (struct display *d, Disp
52 +#ifdef USE_CONSOLEKIT
54 +static CkConnector *connector;
56 +static int openCKSession(struct verify_info *verify, struct display *d)
60 + char *remote_host_name = "";
61 + dbus_bool_t is_local;
62 + char *display_name = "";
63 + char *display_device = "";
66 + if (!use_consolekit)
69 + is_local = d->displayType.location == Local;
70 + if (d->peerlen > 0 && d->peer)
71 + remote_host_name = d->peer;
73 + display_name = d->name;
74 + /* how can we get the corresponding tty at best...? */
75 + if (d->windowPath) {
76 + display_device = strchr(d->windowPath, ':');
77 + if (display_device && display_device[1])
80 + display_device = d->windowPath;
81 + snprintf(devtmp, sizeof(devtmp), "/dev/tty%s", display_device);
82 + display_device = devtmp;
85 + connector = ck_connector_new();
87 + LogOutOfMem("ck_connector");
91 + dbus_error_init(&error);
92 + ret = ck_connector_open_session_with_parameters(
94 + "unix-user", &verify->uid,
95 + "x11-display", &display_name,
96 + "x11-display-device", &display_device,
97 + "remote-host-name", &remote_host_name,
98 + "is-local", &is_local,
101 + if (dbus_error_is_set(&error)) {
102 + LogError("Dbus error: %s\n", error.message);
103 + dbus_error_free(&error);
105 + LogError("ConsoleKit error\n");
107 + LogError("console-kit-daemon not running?\n");
108 + ck_connector_unref(connector);
113 + verify->userEnviron = setEnv(verify->userEnviron,
114 + "XDG_SESSION_COOKIE", ck_connector_get_cookie(connector));
118 +static void closeCKSession(void)
125 + dbus_error_init(&error);
126 + if (!ck_connector_close_session(connector, &error)) {
127 + if (dbus_error_is_set(&error)) {
128 + LogError("Dbus error: %s\n", error.message);
129 + dbus_error_free(&error);
131 + LogError("ConsoleKit close error\n");
133 + LogError("console-kit-daemon not running?\n");
135 + ck_connector_unref(connector);
139 +#define openCKSession(v,d) 1
140 +#define closeCKSession()
144 SessionExit (struct display *d, int status, int removeAuth)
146 @@ -537,6 +633,8 @@ SessionExit (struct display *d, int stat
152 /* make sure the server gets reset after the session is over */
153 if (d->serverPid >= 2 && d->resetSignal)
154 kill (d->serverPid, d->resetSignal);
155 @@ -614,6 +712,10 @@ StartClient (
157 if (pamh) pam_open_session(pamh, 0);
160 + if (!openCKSession(verify, d))
163 switch (pid = fork ()) {
166 --- xdm-1.1.11.orig/include/dm.h
167 +++ xdm-1.1.11/include/dm.h
168 @@ -323,6 +323,9 @@ extern char *randomFile;
169 extern char *prngdSocket;
170 extern int prngdPort;
172 +#ifdef USE_CONSOLEKIT
173 +extern int use_consolekit;
176 extern char *greeterLib;
177 extern char *willing;
178 --- xdm-1.1.11.orig/xdm/resource.c
179 +++ xdm-1.1.11/xdm/resource.c
180 @@ -65,6 +65,9 @@ char *randomDevice;
184 +#ifdef USE_CONSOLEKIT
190 @@ -196,6 +199,10 @@ struct dmResources {
192 { "willing", "Willing", DM_STRING, &willing,
194 +#ifdef USE_CONSOLEKIT
195 +{ "consoleKit", "ConsoleKit", DM_BOOL, (char **) &use_consolekit,
200 #define NUM_DM_RESOURCES (sizeof DmResources / sizeof DmResources[0])
201 @@ -378,7 +385,11 @@ XrmOptionDescRec optionTable [] = {
202 {"-debug", "*debugLevel", XrmoptionSepArg, (caddr_t) NULL },
203 {"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL },
204 {"-daemon", ".daemonMode", XrmoptionNoArg, "true" },
205 -{"-nodaemon", ".daemonMode", XrmoptionNoArg, "false" }
206 +{"-nodaemon", ".daemonMode", XrmoptionNoArg, "false" },
207 +#ifdef USE_CONSOLEKIT
208 +{"-consolekit", ".consoleKit", XrmoptionNoArg, "true" },
209 +{"-noconsolekit", ".consoleKit", XrmoptionNoArg, "false" }
213 static int originalArgc;
214 --- xdm-1.1.10.orig/man/xdm.man
215 +++ xdm-1.1.10/man/xdm.man
216 @@ -48,6 +48,8 @@ xdm \- X Display Manager with support fo
225 @@ -215,6 +217,10 @@ indicates the program to run as the sess
226 .IP "\fB\-xrm\fP \fIresource_specification\fP"
227 Allows an arbitrary resource to be specified, as in most
228 X Toolkit applications.
229 +.IP "\fB\-noconsolekit\fP"
230 +Specifies ``false'' as the value for the \fBDisplayManager.consoleKit\fP
232 +This suppresses the session management using ConsoleKit.
234 At many stages the actions of