|
Line
Link Here
|
| 0 |
-- session.c |
0 |
++ session.c |
|
Lines 2250-2257
Link Here
|
| 2250 |
session_close(Session *s) |
2250 |
session_close(Session *s) |
| 2251 |
{ |
2251 |
{ |
| 2252 |
u_int i; |
2252 |
u_int i; |
|
|
2253 |
int do_xauth; |
| 2253 |
|
2254 |
|
| 2254 |
debug("session_close: session %d pid %ld", s->self, (long)s->pid); |
2255 |
debug("session_close: session %d pid %ld", s->self, (long)s->pid); |
|
|
2256 |
|
| 2257 |
do_xauth = s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL; |
| 2258 |
if (do_xauth && options.xauth_location != NULL) { |
| 2259 |
pid_t pid; |
| 2260 |
FILE *f; |
| 2261 |
char cmd[1024]; |
| 2262 |
struct passwd * pw = s->pw; |
| 2263 |
|
| 2264 |
if (!(pid = fork())) { |
| 2265 |
permanently_set_uid(pw); |
| 2266 |
|
| 2267 |
/* Remove authority data from .Xauthority if appropriate. */ |
| 2268 |
debug("Running %.500s remove %.100s\n", |
| 2269 |
options.xauth_location, s->auth_display); |
| 2270 |
|
| 2271 |
snprintf(cmd, sizeof cmd, "unset XAUTHORITY && HOME=\"%.200s\" %s -q -", |
| 2272 |
s->pw->pw_dir, options.xauth_location); |
| 2273 |
f = popen(cmd, "w"); |
| 2274 |
if (f) { |
| 2275 |
fprintf(f, "remove %s\n", s->auth_display); |
| 2276 |
pclose(f); |
| 2277 |
} else |
| 2278 |
error("Could not run %s\n", cmd); |
| 2279 |
exit(0); |
| 2280 |
} else if (pid > 0) { |
| 2281 |
int status; |
| 2282 |
|
| 2283 |
waitpid(pid, &status, 0); |
| 2284 |
} |
| 2285 |
} |
| 2286 |
|
| 2287 |
|
| 2255 |
if (s->ttyfd != -1) |
2288 |
if (s->ttyfd != -1) |
| 2256 |
session_pty_cleanup(s); |
2289 |
session_pty_cleanup(s); |
| 2257 |
if (s->term) |
2290 |
if (s->term) |