diff options
author | Colin Watson <cjwatson@ubuntu.com> | 2014-02-09 16:09:57 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-02-09 23:43:40 +0000 |
commit | 05609b1cb381eafb999214bf4a95138e63abdbf2 (patch) | |
tree | f6adc60829e0310ab4fcafca21d7f1b9d62c88c0 /session.c | |
parent | 84589dc348c43ec22b50ede0c2946cf6afd0980d (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.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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> |
@@ -1132,6 +1133,9 @@ do_setup_env(Session *s, const char *shell) | |||
1132 | #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) | 1133 | #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) |
1133 | char *path = NULL; | 1134 | char *path = NULL; |
1134 | #endif | 1135 | #endif |
1136 | #ifdef USE_CONSOLEKIT | ||
1137 | const char *ckcookie = NULL; | ||
1138 | #endif /* USE_CONSOLEKIT */ | ||
1135 | 1139 | ||
1136 | /* Initialize the environment. */ | 1140 | /* Initialize the environment. */ |
1137 | envsize = 100; | 1141 | envsize = 100; |
@@ -1276,6 +1280,11 @@ do_setup_env(Session *s, const char *shell) | |||
1276 | child_set_env(&env, &envsize, "KRB5CCNAME", | 1280 | child_set_env(&env, &envsize, "KRB5CCNAME", |
1277 | s->authctxt->krb5_ccname); | 1281 | s->authctxt->krb5_ccname); |
1278 | #endif | 1282 | #endif |
1283 | #ifdef USE_CONSOLEKIT | ||
1284 | ckcookie = PRIVSEP(consolekit_register(s, s->display)); | ||
1285 | if (ckcookie) | ||
1286 | child_set_env(&env, &envsize, "XDG_SESSION_COOKIE", ckcookie); | ||
1287 | #endif /* USE_CONSOLEKIT */ | ||
1279 | #ifdef USE_PAM | 1288 | #ifdef USE_PAM |
1280 | /* | 1289 | /* |
1281 | * Pull in any environment variables that may have | 1290 | * Pull in any environment variables that may have |
@@ -2320,6 +2329,10 @@ session_pty_cleanup2(Session *s) | |||
2320 | 2329 | ||
2321 | debug("session_pty_cleanup: session %d release %s", s->self, s->tty); | 2330 | debug("session_pty_cleanup: session %d release %s", s->self, s->tty); |
2322 | 2331 | ||
2332 | #ifdef USE_CONSOLEKIT | ||
2333 | consolekit_unregister(s); | ||
2334 | #endif /* USE_CONSOLEKIT */ | ||
2335 | |||
2323 | /* Record that the user has logged out. */ | 2336 | /* Record that the user has logged out. */ |
2324 | if (s->pid != 0) | 2337 | if (s->pid != 0) |
2325 | record_logout(s->pid, s->tty, s->pw->pw_name); | 2338 | record_logout(s->pid, s->tty, s->pw->pw_name); |