version 1.112, 2001/12/19 07:18:56 |
version 1.113, 2001/12/19 15:43:11 |
|
|
int display_number; |
int display_number; |
char *display; |
char *display; |
int screen; |
int screen; |
char *auth_display; |
char *auth_display[2]; |
char *auth_proto; |
char *auth_proto; |
char *auth_data; |
char *auth_data; |
int single_connection; |
int single_connection; |
|
|
_PATH_SSH_SYSTEM_RC); |
_PATH_SSH_SYSTEM_RC); |
} else if (do_xauth && options.xauth_location != NULL) { |
} else if (do_xauth && options.xauth_location != NULL) { |
/* Add authority data to .Xauthority if appropriate. */ |
/* Add authority data to .Xauthority if appropriate. */ |
|
|
if (debug_flag) { |
if (debug_flag) { |
fprintf(stderr, |
fprintf(stderr, |
"Running %.100s add " |
"Running %.100s add " |
"%.100s %.100s %.100s\n", |
"%.100s %.100s %.100s\n", |
options.xauth_location, s->auth_display, |
options.xauth_location, s->auth_display[0], |
s->auth_proto, s->auth_data); |
s->auth_proto, s->auth_data); |
|
if (s->auth_display[1]) |
|
fprintf(stderr, |
|
"add %.100s %.100s %.100s\n", |
|
s->auth_display[1], |
|
s->auth_proto, s->auth_data); |
} |
} |
snprintf(cmd, sizeof cmd, "%s -q -", |
snprintf(cmd, sizeof cmd, "%s -q -", |
options.xauth_location); |
options.xauth_location); |
f = popen(cmd, "w"); |
f = popen(cmd, "w"); |
if (f) { |
if (f) { |
fprintf(f, "add %s %s %s\n", s->auth_display, |
fprintf(f, "add %s %s %s\n", |
s->auth_proto, s->auth_data); |
s->auth_display[0], s->auth_proto, |
|
s->auth_data); |
|
if (s->auth_display[1]) |
|
fprintf(f, "add %s %s %s\n", |
|
s->auth_display[1], s->auth_proto, |
|
s->auth_data); |
pclose(f); |
pclose(f); |
} else { |
} else { |
fprintf(stderr, "Could not run %s\n", |
fprintf(stderr, "Could not run %s\n", |
|
|
xfree(s->term); |
xfree(s->term); |
if (s->display) |
if (s->display) |
xfree(s->display); |
xfree(s->display); |
if (s->auth_display) |
if (s->auth_display[0]) |
xfree(s->auth_display); |
xfree(s->auth_display[0]); |
|
if (s->auth_display[1]) |
|
xfree(s->auth_display[1]); |
if (s->auth_data) |
if (s->auth_data) |
xfree(s->auth_data); |
xfree(s->auth_data); |
if (s->auth_proto) |
if (s->auth_proto) |
|
|
* authorization entry is added with xauth(1). This will be |
* authorization entry is added with xauth(1). This will be |
* different than the DISPLAY string for localhost displays. |
* different than the DISPLAY string for localhost displays. |
*/ |
*/ |
|
s->auth_display[1] = NULL; |
if (!options.gateway_ports) { |
if (!options.gateway_ports) { |
|
struct utsname uts; |
|
|
snprintf(display, sizeof display, "localhost:%d.%d", |
snprintf(display, sizeof display, "localhost:%d.%d", |
s->display_number, s->screen); |
s->display_number, s->screen); |
snprintf(auth_display, sizeof auth_display, "%.400s/unix:%d.%d", |
snprintf(auth_display, sizeof auth_display, "%.400s/unix:%d.%d", |
hostname, s->display_number, s->screen); |
hostname, s->display_number, s->screen); |
s->display = xstrdup(display); |
s->display = xstrdup(display); |
s->auth_display = xstrdup(auth_display); |
s->auth_display[0] = xstrdup(auth_display); |
|
/* |
|
* Xlib may use gethostbyname() or uname() hostname to |
|
* look up authorization data for FamilyLocal; see: |
|
* xc/lib/xtrans/Xtrans.c:TRANS(GetHostname) |
|
* We just add authorization entries with both |
|
* hostname and nodename if they are different. |
|
*/ |
|
if (uname(&uts) == -1) |
|
fatal("uname: %.100s", strerror(errno)); |
|
if (strcmp(hostname, uts.nodename) != 0) { |
|
snprintf(auth_display, sizeof auth_display, |
|
"%.400s/unix:%d.%d", uts.nodename, |
|
s->display_number, s->screen); |
|
s->auth_display[1] = xstrdup(auth_display); |
|
} |
} else { |
} else { |
snprintf(display, sizeof display, "%.400s:%d.%d", hostname, |
snprintf(display, sizeof display, "%.400s:%d.%d", hostname, |
s->display_number, s->screen); |
s->display_number, s->screen); |
s->display = xstrdup(display); |
s->display = xstrdup(display); |
s->auth_display = xstrdup(display); |
s->auth_display[0] = xstrdup(display); |
} |
} |
|
|
return 1; |
return 1; |