|
Lines 966-984
static void
Link Here
|
| 966 |
do_rc_files(struct ssh *ssh, Session *s, const char *shell) |
966 |
do_rc_files(struct ssh *ssh, Session *s, const char *shell) |
| 967 |
{ |
967 |
{ |
| 968 |
FILE *f = NULL; |
968 |
FILE *f = NULL; |
| 969 |
char cmd[1024]; |
969 |
char cmd[1024], *user_rc = NULL; |
| 970 |
int do_xauth; |
970 |
int do_xauth; |
| 971 |
struct stat st; |
971 |
struct stat st; |
| 972 |
|
972 |
|
| 973 |
do_xauth = |
973 |
do_xauth = |
| 974 |
s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL; |
974 |
s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL; |
|
|
975 |
user_rc = tilde_expand_filename("~/" _PATH_SSH_USER_RC, getuid()); |
| 975 |
|
976 |
|
| 976 |
/* ignore _PATH_SSH_USER_RC for subsystems and admin forced commands */ |
977 |
/* ignore _PATH_SSH_USER_RC for subsystems and admin forced commands */ |
| 977 |
if (!s->is_subsystem && options.adm_forced_command == NULL && |
978 |
if (!s->is_subsystem && options.adm_forced_command == NULL && |
| 978 |
auth_opts->permit_user_rc && options.permit_user_rc && |
979 |
auth_opts->permit_user_rc && options.permit_user_rc && |
| 979 |
stat(_PATH_SSH_USER_RC, &st) >= 0) { |
980 |
stat(user_rc, &st) >= 0) { |
| 980 |
snprintf(cmd, sizeof cmd, "%s -c '%s %s'", |
981 |
snprintf(cmd, sizeof cmd, "%s -c '%s %s'", |
| 981 |
shell, _PATH_BSHELL, _PATH_SSH_USER_RC); |
982 |
shell, _PATH_BSHELL, user_rc); |
| 982 |
if (debug_flag) |
983 |
if (debug_flag) |
| 983 |
fprintf(stderr, "Running %s\n", cmd); |
984 |
fprintf(stderr, "Running %s\n", cmd); |
| 984 |
f = popen(cmd, "w"); |
985 |
f = popen(cmd, "w"); |
|
Lines 989-995
do_rc_files(struct ssh *ssh, Session *s,
Link Here
|
| 989 |
pclose(f); |
990 |
pclose(f); |
| 990 |
} else |
991 |
} else |
| 991 |
fprintf(stderr, "Could not run %s\n", |
992 |
fprintf(stderr, "Could not run %s\n", |
| 992 |
_PATH_SSH_USER_RC); |
993 |
user_rc); |
| 993 |
} else if (stat(_PATH_SSH_SYSTEM_RC, &st) >= 0) { |
994 |
} else if (stat(_PATH_SSH_SYSTEM_RC, &st) >= 0) { |
| 994 |
if (debug_flag) |
995 |
if (debug_flag) |
| 995 |
fprintf(stderr, "Running %s %s\n", _PATH_BSHELL, |
996 |
fprintf(stderr, "Running %s %s\n", _PATH_BSHELL, |
|
Lines 1029-1034
do_rc_files(struct ssh *ssh, Session *s,
Link Here
|
| 1029 |
cmd); |
1030 |
cmd); |
| 1030 |
} |
1031 |
} |
| 1031 |
} |
1032 |
} |
|
|
1033 |
free(user_rc); |
| 1032 |
} |
1034 |
} |
| 1033 |
|
1035 |
|
| 1034 |
static void |
1036 |
static void |