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-03-20 00:32:21 +0000
commit7a26d16efb4ee303c8d66ee82caf9d0686f4a074 (patch)
tree131e8962617e1f41402ba2468ad331dd888c101a /session.c
parentef912859a4300360164292abe47b5516c8ee4a13 (diff)
Add support for registering ConsoleKit sessions on login
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450 Last-Updated: 2014-03-20 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 6848df42f..9d43fc3c7 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>
@@ -1160,6 +1161,9 @@ do_setup_env(Session *s, const char *shell)
1160#if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) 1161#if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN)
1161 char *path = NULL; 1162 char *path = NULL;
1162#endif 1163#endif
1164#ifdef USE_CONSOLEKIT
1165 const char *ckcookie = NULL;
1166#endif /* USE_CONSOLEKIT */
1163 1167
1164 /* Initialize the environment. */ 1168 /* Initialize the environment. */
1165 envsize = 100; 1169 envsize = 100;
@@ -1304,6 +1308,11 @@ do_setup_env(Session *s, const char *shell)
1304 child_set_env(&env, &envsize, "KRB5CCNAME", 1308 child_set_env(&env, &envsize, "KRB5CCNAME",
1305 s->authctxt->krb5_ccname); 1309 s->authctxt->krb5_ccname);
1306#endif 1310#endif
1311#ifdef USE_CONSOLEKIT
1312 ckcookie = PRIVSEP(consolekit_register(s, s->display));
1313 if (ckcookie)
1314 child_set_env(&env, &envsize, "XDG_SESSION_COOKIE", ckcookie);
1315#endif /* USE_CONSOLEKIT */
1307#ifdef USE_PAM 1316#ifdef USE_PAM
1308 /* 1317 /*
1309 * Pull in any environment variables that may have 1318 * Pull in any environment variables that may have
@@ -2353,6 +2362,10 @@ session_pty_cleanup2(Session *s)
2353 2362
2354 debug("session_pty_cleanup: session %d release %s", s->self, s->tty); 2363 debug("session_pty_cleanup: session %d release %s", s->self, s->tty);
2355 2364
2365#ifdef USE_CONSOLEKIT
2366 consolekit_unregister(s);
2367#endif /* USE_CONSOLEKIT */
2368
2356 /* Record that the user has logged out. */ 2369 /* Record that the user has logged out. */
2357 if (s->pid != 0) 2370 if (s->pid != 0)
2358 record_logout(s->pid, s->tty, s->pw->pw_name); 2371 record_logout(s->pid, s->tty, s->pw->pw_name);