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>2015-08-19 17:09:56 +0100
commit1197fd975ab8fd11b1ac83557ef750129b16c0d8 (patch)
treeab0af14bf4b460ffcb98e1aa6bb5d3f7032acf7d /session.c
parent5496170cd67abb653e385277bd83b69f1b10905d (diff)
Add support for registering ConsoleKit sessions on login
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450 Last-Updated: 2015-08-19 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 afac4a58f..c6bd7286b 100644
--- a/session.c
+++ b/session.c
@@ -94,6 +94,7 @@
94#include "kex.h" 94#include "kex.h"
95#include "monitor_wrap.h" 95#include "monitor_wrap.h"
96#include "sftp.h" 96#include "sftp.h"
97#include "consolekit.h"
97 98
98#if defined(KRB5) && defined(USE_AFS) 99#if defined(KRB5) && defined(USE_AFS)
99#include <kafs.h> 100#include <kafs.h>
@@ -1144,6 +1145,9 @@ do_setup_env(Session *s, const char *shell)
1144#if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) 1145#if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN)
1145 char *path = NULL; 1146 char *path = NULL;
1146#endif 1147#endif
1148#ifdef USE_CONSOLEKIT
1149 const char *ckcookie = NULL;
1150#endif /* USE_CONSOLEKIT */
1147 1151
1148 /* Initialize the environment. */ 1152 /* Initialize the environment. */
1149 envsize = 100; 1153 envsize = 100;
@@ -1288,6 +1292,11 @@ do_setup_env(Session *s, const char *shell)
1288 child_set_env(&env, &envsize, "KRB5CCNAME", 1292 child_set_env(&env, &envsize, "KRB5CCNAME",
1289 s->authctxt->krb5_ccname); 1293 s->authctxt->krb5_ccname);
1290#endif 1294#endif
1295#ifdef USE_CONSOLEKIT
1296 ckcookie = PRIVSEP(consolekit_register(s, s->display));
1297 if (ckcookie)
1298 child_set_env(&env, &envsize, "XDG_SESSION_COOKIE", ckcookie);
1299#endif /* USE_CONSOLEKIT */
1291#ifdef USE_PAM 1300#ifdef USE_PAM
1292 /* 1301 /*
1293 * Pull in any environment variables that may have 1302 * Pull in any environment variables that may have
@@ -2351,6 +2360,10 @@ session_pty_cleanup2(Session *s)
2351 2360
2352 debug("session_pty_cleanup: session %d release %s", s->self, s->tty); 2361 debug("session_pty_cleanup: session %d release %s", s->self, s->tty);
2353 2362
2363#ifdef USE_CONSOLEKIT
2364 consolekit_unregister(s);
2365#endif /* USE_CONSOLEKIT */
2366
2354 /* Record that the user has logged out. */ 2367 /* Record that the user has logged out. */
2355 if (s->pid != 0) 2368 if (s->pid != 0)
2356 record_logout(s->pid, s->tty, s->pw->pw_name); 2369 record_logout(s->pid, s->tty, s->pw->pw_name);