summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2007-08-15 19:13:41 +1000
committerDarren Tucker <dtucker@zip.com.au>2007-08-15 19:13:41 +1000
commit513d13accd7925f6c94ffe2003c15ee5bbc5e9d1 (patch)
tree3f91c55f04f6b2b251740c0e2e8a849f8637c74a /clientloop.c
parent2d9636471bb75c10342dbabcc2f6a0b2e60cca01 (diff)
- markus@cvs.openbsd.org 2007/08/15 08:14:46
[clientloop.c] do NOT fall back to the trused x11 cookie if generation of an untrusted cookie fails; from security-alert at sun.com; ok dtucker
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/clientloop.c b/clientloop.c
index 538644c20..b57fda042 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.180 2007/08/07 07:32:53 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.181 2007/08/15 08:14:46 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -290,19 +290,29 @@ client_x11_get_proto(const char *display, const char *xauth_path,
290 generated = 1; 290 generated = 1;
291 } 291 }
292 } 292 }
293 snprintf(cmd, sizeof(cmd), 293
294 "%s %s%s list %s 2>" _PATH_DEVNULL, 294 /*
295 xauth_path, 295 * When in untrusted mode, we read the cookie only if it was
296 generated ? "-f " : "" , 296 * successfully generated as an untrusted one in the step
297 generated ? xauthfile : "", 297 * above.
298 display); 298 */
299 debug2("x11_get_proto: %s", cmd); 299 if (trusted || generated) {
300 f = popen(cmd, "r"); 300 snprintf(cmd, sizeof(cmd),
301 if (f && fgets(line, sizeof(line), f) && 301 "%s %s%s list %s 2>" _PATH_DEVNULL,
302 sscanf(line, "%*s %511s %511s", proto, data) == 2) 302 xauth_path,
303 got_data = 1; 303 generated ? "-f " : "" ,
304 if (f) 304 generated ? xauthfile : "",
305 pclose(f); 305 display);
306 debug2("x11_get_proto: %s", cmd);
307 f = popen(cmd, "r");
308 if (f && fgets(line, sizeof(line), f) &&
309 sscanf(line, "%*s %511s %511s", proto, data) == 2)
310 got_data = 1;
311 if (f)
312 pclose(f);
313 } else
314 error("Warning: untrusted X11 forwarding setup failed: "
315 "xauth key data not generated");
306 } 316 }
307 317
308 if (do_unlink) { 318 if (do_unlink) {