summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@ubuntu.com>2014-02-09 16:09:57 +0000
committerColin Watson <cjwatson@debian.org>2014-02-10 02:40:16 +0000
commitefe70e315cfcc70e765ebd070e83528a6be6c125 (patch)
treef6c2e72f2385973b3be77d85a155178f33e521dc /session.c
parent71003a35537df521296408d9f6bd0a200ed2a854 (diff)
Add support for registering ConsoleKit sessions on login
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450 Last-Updated: 2013-09-14 Patch-Name: consolekit.patch
Diffstat (limited to 'session.c')
-rw-r--r--session.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/session.c b/session.c
index 5ddd82aa6..14df2262c 100644
--- a/session.c
+++ b/session.c
@@ -92,6 +92,7 @@
92#include "kex.h" 92#include "kex.h"
93#include "monitor_wrap.h" 93#include "monitor_wrap.h"
94#include "sftp.h" 94#include "sftp.h"
95#include "consolekit.h"
95 96
96#if defined(KRB5) && defined(USE_AFS) 97#if defined(KRB5) && defined(USE_AFS)
97#include <kafs.h> 98#include <kafs.h>
@@ -1155,6 +1156,9 @@ do_setup_env(Session *s, const char *shell)
1155#if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) 1156#if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN)
1156 char *path = NULL; 1157 char *path = NULL;
1157#endif 1158#endif
1159#ifdef USE_CONSOLEKIT
1160 const char *ckcookie = NULL;
1161#endif /* USE_CONSOLEKIT */
1158 1162
1159 /* Initialize the environment. */ 1163 /* Initialize the environment. */
1160 envsize = 100; 1164 envsize = 100;
@@ -1299,6 +1303,11 @@ do_setup_env(Session *s, const char *shell)
1299 child_set_env(&env, &envsize, "KRB5CCNAME", 1303 child_set_env(&env, &envsize, "KRB5CCNAME",
1300 s->authctxt->krb5_ccname); 1304 s->authctxt->krb5_ccname);
1301#endif 1305#endif
1306#ifdef USE_CONSOLEKIT
1307 ckcookie = PRIVSEP(consolekit_register(s, s->display));
1308 if (ckcookie)
1309 child_set_env(&env, &envsize, "XDG_SESSION_COOKIE", ckcookie);
1310#endif /* USE_CONSOLEKIT */
1302#ifdef USE_PAM 1311#ifdef USE_PAM
1303 /* 1312 /*
1304 * Pull in any environment variables that may have 1313 * Pull in any environment variables that may have
@@ -2348,6 +2357,10 @@ session_pty_cleanup2(Session *s)
2348 2357
2349 debug("session_pty_cleanup: session %d release %s", s->self, s->tty); 2358 debug("session_pty_cleanup: session %d release %s", s->self, s->tty);
2350 2359
2360#ifdef USE_CONSOLEKIT
2361 consolekit_unregister(s);
2362#endif /* USE_CONSOLEKIT */
2363
2351 /* Record that the user has logged out. */ 2364 /* Record that the user has logged out. */
2352 if (s->pid != 0) 2365 if (s->pid != 0)
2353 record_logout(s->pid, s->tty, s->pw->pw_name); 2366 record_logout(s->pid, s->tty, s->pw->pw_name);