View | Details | Raw Unified | Return to bug 2341 | Differences between
and this patch

Collapse All | Expand All

(-)a/clientloop.c (+34 lines)
Lines 313-318 client_x11_get_proto(const char *display, const char *xauth_path, Link Here
313
	struct stat st;
313
	struct stat st;
314
	u_int now;
314
	u_int now;
315
315
316
#if __APPLE__
317
	int is_path_to_socket = 0;
318
#endif /* __APPLE__ */
319
316
	xauthdir = xauthfile = NULL;
320
	xauthdir = xauthfile = NULL;
317
	*_proto = proto;
321
	*_proto = proto;
318
	*_data = data;
322
	*_data = data;
Lines 328-333 client_x11_get_proto(const char *display, const char *xauth_path, Link Here
328
			debug("x11_get_proto: DISPLAY not set");
332
			debug("x11_get_proto: DISPLAY not set");
329
			return;
333
			return;
330
		}
334
		}
335
#if __APPLE__
336
		{
337
			/*
338
			 * If using launchd socket, remove the screen number from the end
339
			 * of $DISPLAY. is_path_to_socket is used later in this function
340
			 * to determine if an error should be displayed.
341
			 */
342
			char path[PATH_MAX];
343
			struct stat sbuf;
344
345
			strlcpy(path, display, sizeof(path));
346
			if (0 == stat(path, &sbuf)) {
347
				is_path_to_socket = 1;
348
			} else {
349
				char *dot = strrchr(path, '.');
350
				if (dot) {
351
					*dot = '\0';
352
					/* screen = atoi(dot + 1); */
353
					if (0 == stat(path, &sbuf)) {
354
						is_path_to_socket = 1;
355
						debug("x11_get_proto: $DISPLAY is launchd, removing screennum");
356
						setenv("DISPLAY", path, 1);
357
					}
358
				}
359
			}
360
		}
361
#endif /* __APPLE__ */
331
		/*
362
		/*
332
		 * Handle FamilyLocal case where $DISPLAY does
363
		 * Handle FamilyLocal case where $DISPLAY does
333
		 * not match an authorization entry.  For this we
364
		 * not match an authorization entry.  For this we
Lines 407-412 client_x11_get_proto(const char *display, const char *xauth_path, Link Here
407
	if (!got_data) {
437
	if (!got_data) {
408
		u_int32_t rnd = 0;
438
		u_int32_t rnd = 0;
409
439
440
#if __APPLE__
441
		if (!is_path_to_socket)
442
#endif /* __APPLE__ */
410
		logit("Warning: No xauth data; "
443
		logit("Warning: No xauth data; "
411
		    "using fake authentication data for X11 forwarding.");
444
		    "using fake authentication data for X11 forwarding.");
412
		strlcpy(proto, SSH_X11_PROTO, sizeof proto);
445
		strlcpy(proto, SSH_X11_PROTO, sizeof proto);
(-)a/channels.c (-7 / +27 lines)
Lines 3576-3590 x11_connect_display(void) Link Here
3576
	 * connection to the real X server.
3576
	 * connection to the real X server.
3577
	 */
3577
	 */
3578
3578
3579
	/* Check if the display is from launchd. */
3580
#ifdef __APPLE__
3579
#ifdef __APPLE__
3581
	if (strncmp(display, "/tmp/launch", 11) == 0) {
3580
	/* Check if the display is a path to a socket (as set by launchd). */
3582
		sock = connect_local_xsocket_path(display);
3581
	{
3583
		if (sock < 0)
3582
		char path[PATH_MAX];
3584
			return -1;
3583
		struct stat sbuf;
3584
		int is_path_to_socket = 0;
3585
3586
		strlcpy(path, display, sizeof(path));
3587
		if (0 == stat(path, &sbuf)) {
3588
			is_path_to_socket = 1;
3589
		} else {
3590
			char *dot = strrchr(path, '.');
3591
			if (dot) {
3592
				*dot = '\0';
3593
				/* screen = atoi(dot + 1); */
3594
				if (0 == stat(path, &sbuf)) {
3595
					is_path_to_socket=1;
3596
				}
3597
			}
3598
		}
3585
3599
3586
		/* OK, we now have a connection to the display. */
3600
		if (is_path_to_socket) {
3587
		return sock;
3601
			sock = connect_local_xsocket_path(path);
3602
			if (sock < 0)
3603
				return -1;
3604
3605
			/* OK, we now have a connection to the display. */
3606
			return sock;
3607
		}
3588
	}
3608
	}
3589
#endif
3609
#endif
3590
	/*
3610
	/*

Return to bug 2341