diff options
author | Colin Watson <cjwatson@debian.org> | 2012-10-31 10:35:38 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2012-10-31 10:35:38 +0000 |
commit | 301aad188299b268452af6b67261336c88f44ab1 (patch) | |
tree | 5ec34d429196f17ea6eb2205ca8f96da32b09dd1 /session.c | |
parent | 5cb249b209c170d817471b575b6d105094f137bc (diff) |
* Merge from Ubuntu:
- Add support for registering ConsoleKit sessions on login. (This is
currently enabled only when building for Ubuntu.)
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -91,6 +91,7 @@ | |||
91 | #include "kex.h" | 91 | #include "kex.h" |
92 | #include "monitor_wrap.h" | 92 | #include "monitor_wrap.h" |
93 | #include "sftp.h" | 93 | #include "sftp.h" |
94 | #include "consolekit.h" | ||
94 | 95 | ||
95 | #if defined(KRB5) && defined(USE_AFS) | 96 | #if defined(KRB5) && defined(USE_AFS) |
96 | #include <kafs.h> | 97 | #include <kafs.h> |
@@ -1129,6 +1130,9 @@ do_setup_env(Session *s, const char *shell) | |||
1129 | #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) | 1130 | #if !defined (HAVE_LOGIN_CAP) && !defined (HAVE_CYGWIN) |
1130 | char *path = NULL; | 1131 | char *path = NULL; |
1131 | #endif | 1132 | #endif |
1133 | #ifdef USE_CONSOLEKIT | ||
1134 | const char *ckcookie = NULL; | ||
1135 | #endif /* USE_CONSOLEKIT */ | ||
1132 | 1136 | ||
1133 | /* Initialize the environment. */ | 1137 | /* Initialize the environment. */ |
1134 | envsize = 100; | 1138 | envsize = 100; |
@@ -1273,6 +1277,11 @@ do_setup_env(Session *s, const char *shell) | |||
1273 | child_set_env(&env, &envsize, "KRB5CCNAME", | 1277 | child_set_env(&env, &envsize, "KRB5CCNAME", |
1274 | s->authctxt->krb5_ccname); | 1278 | s->authctxt->krb5_ccname); |
1275 | #endif | 1279 | #endif |
1280 | #ifdef USE_CONSOLEKIT | ||
1281 | ckcookie = PRIVSEP(consolekit_register(s, s->display)); | ||
1282 | if (ckcookie) | ||
1283 | child_set_env(&env, &envsize, "XDG_SESSION_COOKIE", ckcookie); | ||
1284 | #endif /* USE_CONSOLEKIT */ | ||
1276 | #ifdef USE_PAM | 1285 | #ifdef USE_PAM |
1277 | /* | 1286 | /* |
1278 | * Pull in any environment variables that may have | 1287 | * Pull in any environment variables that may have |
@@ -2300,6 +2309,10 @@ session_pty_cleanup2(Session *s) | |||
2300 | 2309 | ||
2301 | debug("session_pty_cleanup: session %d release %s", s->self, s->tty); | 2310 | debug("session_pty_cleanup: session %d release %s", s->self, s->tty); |
2302 | 2311 | ||
2312 | #ifdef USE_CONSOLEKIT | ||
2313 | consolekit_unregister(s); | ||
2314 | #endif /* USE_CONSOLEKIT */ | ||
2315 | |||
2303 | /* Record that the user has logged out. */ | 2316 | /* Record that the user has logged out. */ |
2304 | if (s->pid != 0) | 2317 | if (s->pid != 0) |
2305 | record_logout(s->pid, s->tty, s->pw->pw_name); | 2318 | record_logout(s->pid, s->tty, s->pw->pw_name); |