diff options
author | Colin Watson <cjwatson@ubuntu.com> | 2014-02-09 16:09:57 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2015-09-17 13:52:40 +0100 |
commit | 2219c0ae6be6750432932833b69264a53e0496e4 (patch) | |
tree | 5a55e6573928cf627579b6705bf5c7c8da72ab73 /session.c | |
parent | cc53919ec39bb8a84127b7ba1f23acf3809dc2a0 (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.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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); |