diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "includes.h" | 10 | #include "includes.h" |
11 | RCSID("$OpenBSD: session.c,v 1.12 2000/05/03 18:03:07 markus Exp $"); | 11 | RCSID("$OpenBSD: session.c,v 1.14 2000/05/25 03:10:18 deraadt Exp $"); |
12 | 12 | ||
13 | #include "xmalloc.h" | 13 | #include "xmalloc.h" |
14 | #include "ssh.h" | 14 | #include "ssh.h" |
@@ -645,7 +645,8 @@ do_exec_pty(Session *s, const char *command, struct passwd * pw) | |||
645 | } | 645 | } |
646 | #endif | 646 | #endif |
647 | /* Do common processing for the child, such as execing the command. */ | 647 | /* Do common processing for the child, such as execing the command. */ |
648 | do_child(command, pw, s->term, s->display, s->auth_proto, s->auth_data, s->tty); | 648 | do_child(command, pw, s->term, s->display, s->auth_proto, |
649 | s->auth_data, s->tty); | ||
649 | /* NOTREACHED */ | 650 | /* NOTREACHED */ |
650 | } | 651 | } |
651 | if (pid < 0) | 652 | if (pid < 0) |
@@ -749,7 +750,10 @@ read_environment_file(char ***env, unsigned int *envsize, | |||
749 | fprintf(stderr, "Bad line in %.100s: %.200s\n", filename, buf); | 750 | fprintf(stderr, "Bad line in %.100s: %.200s\n", filename, buf); |
750 | continue; | 751 | continue; |
751 | } | 752 | } |
752 | /* Replace the equals sign by nul, and advance value to the value string. */ | 753 | /* |
754 | * Replace the equals sign by nul, and advance value to | ||
755 | * the value string. | ||
756 | */ | ||
753 | *value = '\0'; | 757 | *value = '\0'; |
754 | value++; | 758 | value++; |
755 | child_set_env(env, envsize, cp, value); | 759 | child_set_env(env, envsize, cp, value); |
@@ -948,7 +952,8 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
948 | 952 | ||
949 | /* read $HOME/.ssh/environment. */ | 953 | /* read $HOME/.ssh/environment. */ |
950 | if (!options.use_login) { | 954 | if (!options.use_login) { |
951 | snprintf(buf, sizeof buf, "%.200s/.ssh/environment", pw->pw_dir); | 955 | snprintf(buf, sizeof buf, "%.200s/.ssh/environment", |
956 | pw->pw_dir); | ||
952 | read_environment_file(&env, &envsize, buf); | 957 | read_environment_file(&env, &envsize, buf); |
953 | } | 958 | } |
954 | if (debug_flag) { | 959 | if (debug_flag) { |
@@ -1037,21 +1042,27 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
1037 | if (auth_proto != NULL && auth_data != NULL) { | 1042 | if (auth_proto != NULL && auth_data != NULL) { |
1038 | char *screen = strchr(display, ':'); | 1043 | char *screen = strchr(display, ':'); |
1039 | if (debug_flag) { | 1044 | if (debug_flag) { |
1040 | fprintf(stderr, "Running %.100s add %.100s %.100s %.100s\n", | 1045 | fprintf(stderr, |
1046 | "Running %.100s add %.100s %.100s %.100s\n", | ||
1041 | XAUTH_PATH, display, auth_proto, auth_data); | 1047 | XAUTH_PATH, display, auth_proto, auth_data); |
1042 | if (screen != NULL) | 1048 | if (screen != NULL) |
1043 | fprintf(stderr, "Adding %.*s/unix%s %s %s\n", | 1049 | fprintf(stderr, |
1044 | screen-display, display, screen, auth_proto, auth_data); | 1050 | "Adding %.*s/unix%s %s %s\n", |
1051 | screen-display, display, | ||
1052 | screen, auth_proto, auth_data); | ||
1045 | } | 1053 | } |
1046 | f = popen(XAUTH_PATH " -q -", "w"); | 1054 | f = popen(XAUTH_PATH " -q -", "w"); |
1047 | if (f) { | 1055 | if (f) { |
1048 | fprintf(f, "add %s %s %s\n", display, auth_proto, auth_data); | 1056 | fprintf(f, "add %s %s %s\n", display, |
1057 | auth_proto, auth_data); | ||
1049 | if (screen != NULL) | 1058 | if (screen != NULL) |
1050 | fprintf(f, "add %.*s/unix%s %s %s\n", | 1059 | fprintf(f, "add %.*s/unix%s %s %s\n", |
1051 | screen-display, display, screen, auth_proto, auth_data); | 1060 | screen-display, display, |
1061 | screen, auth_proto, auth_data); | ||
1052 | pclose(f); | 1062 | pclose(f); |
1053 | } else | 1063 | } else |
1054 | fprintf(stderr, "Could not run %s -q -\n", XAUTH_PATH); | 1064 | fprintf(stderr, "Could not run %s -q -\n", |
1065 | XAUTH_PATH); | ||
1055 | } | 1066 | } |
1056 | } | 1067 | } |
1057 | #endif /* XAUTH_PATH */ | 1068 | #endif /* XAUTH_PATH */ |
@@ -1081,7 +1092,8 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
1081 | struct stat mailstat; | 1092 | struct stat mailstat; |
1082 | mailbox = getenv("MAIL"); | 1093 | mailbox = getenv("MAIL"); |
1083 | if (mailbox != NULL) { | 1094 | if (mailbox != NULL) { |
1084 | if (stat(mailbox, &mailstat) != 0 || mailstat.st_size == 0) | 1095 | if (stat(mailbox, &mailstat) != 0 || |
1096 | mailstat.st_size == 0) | ||
1085 | printf("No mail.\n"); | 1097 | printf("No mail.\n"); |
1086 | else if (mailstat.st_mtime < mailstat.st_atime) | 1098 | else if (mailstat.st_mtime < mailstat.st_atime) |
1087 | printf("You have mail.\n"); | 1099 | printf("You have mail.\n"); |