diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | readconf.c | 13 | ||||
-rw-r--r-- | readconf.h | 8 | ||||
-rw-r--r-- | ssh.c | 10 |
4 files changed, 23 insertions, 12 deletions
@@ -8,6 +8,10 @@ | |||
8 | - dtucker@cvs.openbsd.org 2013/02/19 02:12:47 | 8 | - dtucker@cvs.openbsd.org 2013/02/19 02:12:47 |
9 | [krl.c] | 9 | [krl.c] |
10 | Remove bogus include. ok djm | 10 | Remove bogus include. ok djm |
11 | - dtucker@cvs.openbsd.org 2013/02/22 04:45:09 | ||
12 | [ssh.c readconf.c readconf.h] | ||
13 | Don't complain if IdentityFiles specified in system-wide configs are | ||
14 | missing. ok djm, deraadt. | ||
11 | 15 | ||
12 | 20130401 | 16 | 20130401 |
13 | - (dtucker) [openbsd-compat/bsd-cygwin_util.{c,h}] Don't include windows.h | 17 | - (dtucker) [openbsd-compat/bsd-cygwin_util.{c,h}] Don't include windows.h |
diff --git a/readconf.c b/readconf.c index 6f978f828..36265e431 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.195 2013/02/17 23:16:57 dtucker Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.196 2013/02/22 04:45:08 dtucker 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 |
@@ -373,7 +373,7 @@ parse_token(const char *cp, const char *filename, int linenum) | |||
373 | int | 373 | int |
374 | process_config_line(Options *options, const char *host, | 374 | process_config_line(Options *options, const char *host, |
375 | char *line, const char *filename, int linenum, | 375 | char *line, const char *filename, int linenum, |
376 | int *activep) | 376 | int *activep, int userconfig) |
377 | { | 377 | { |
378 | char *s, **charptr, *endofnumber, *keyword, *arg, *arg2; | 378 | char *s, **charptr, *endofnumber, *keyword, *arg, *arg2; |
379 | char **cpptr, fwdarg[256]; | 379 | char **cpptr, fwdarg[256]; |
@@ -606,7 +606,7 @@ parse_yesnoask: | |||
606 | if (*intptr >= SSH_MAX_IDENTITY_FILES) | 606 | if (*intptr >= SSH_MAX_IDENTITY_FILES) |
607 | fatal("%.200s line %d: Too many identity files specified (max %d).", | 607 | fatal("%.200s line %d: Too many identity files specified (max %d).", |
608 | filename, linenum, SSH_MAX_IDENTITY_FILES); | 608 | filename, linenum, SSH_MAX_IDENTITY_FILES); |
609 | add_identity_file(options, NULL, arg, 1); | 609 | add_identity_file(options, NULL, arg, userconfig); |
610 | } | 610 | } |
611 | break; | 611 | break; |
612 | 612 | ||
@@ -1093,7 +1093,7 @@ parse_int: | |||
1093 | 1093 | ||
1094 | int | 1094 | int |
1095 | read_config_file(const char *filename, const char *host, Options *options, | 1095 | read_config_file(const char *filename, const char *host, Options *options, |
1096 | int checkperm) | 1096 | int flags) |
1097 | { | 1097 | { |
1098 | FILE *f; | 1098 | FILE *f; |
1099 | char line[1024]; | 1099 | char line[1024]; |
@@ -1103,7 +1103,7 @@ read_config_file(const char *filename, const char *host, Options *options, | |||
1103 | if ((f = fopen(filename, "r")) == NULL) | 1103 | if ((f = fopen(filename, "r")) == NULL) |
1104 | return 0; | 1104 | return 0; |
1105 | 1105 | ||
1106 | if (checkperm) { | 1106 | if (flags & SSHCONF_CHECKPERM) { |
1107 | struct stat sb; | 1107 | struct stat sb; |
1108 | 1108 | ||
1109 | if (fstat(fileno(f), &sb) == -1) | 1109 | if (fstat(fileno(f), &sb) == -1) |
@@ -1124,7 +1124,8 @@ read_config_file(const char *filename, const char *host, Options *options, | |||
1124 | while (fgets(line, sizeof(line), f)) { | 1124 | while (fgets(line, sizeof(line), f)) { |
1125 | /* Update line number counter. */ | 1125 | /* Update line number counter. */ |
1126 | linenum++; | 1126 | linenum++; |
1127 | if (process_config_line(options, host, line, filename, linenum, &active) != 0) | 1127 | if (process_config_line(options, host, line, filename, linenum, |
1128 | &active, flags & SSHCONF_USERCONF) != 0) | ||
1128 | bad_options++; | 1129 | bad_options++; |
1129 | } | 1130 | } |
1130 | fclose(f); | 1131 | fclose(f); |
diff --git a/readconf.h b/readconf.h index 35f596626..841648906 100644 --- a/readconf.h +++ b/readconf.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.h,v 1.92 2013/02/17 23:16:57 dtucker Exp $ */ | 1 | /* $OpenBSD: readconf.h,v 1.93 2013/02/22 04:45:09 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -149,13 +149,17 @@ typedef struct { | |||
149 | #define REQUEST_TTY_YES 2 | 149 | #define REQUEST_TTY_YES 2 |
150 | #define REQUEST_TTY_FORCE 3 | 150 | #define REQUEST_TTY_FORCE 3 |
151 | 151 | ||
152 | #define SSHCONF_CHECKPERM 1 /* check permissions on config file */ | ||
153 | #define SSHCONF_USERCONF 2 /* user provided config file not system */ | ||
154 | |||
152 | void initialize_options(Options *); | 155 | void initialize_options(Options *); |
153 | void fill_default_options(Options *); | 156 | void fill_default_options(Options *); |
154 | int read_config_file(const char *, const char *, Options *, int); | 157 | int read_config_file(const char *, const char *, Options *, int); |
155 | int parse_forward(Forward *, const char *, int, int); | 158 | int parse_forward(Forward *, const char *, int, int); |
156 | 159 | ||
157 | int | 160 | int |
158 | process_config_line(Options *, const char *, char *, const char *, int, int *); | 161 | process_config_line(Options *, const char *, char *, const char *, int, int *, |
162 | int); | ||
159 | 163 | ||
160 | void add_local_forward(Options *, const Forward *); | 164 | void add_local_forward(Options *, const Forward *); |
161 | void add_remote_forward(Options *, const Forward *); | 165 | void add_remote_forward(Options *, const Forward *); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.371 2013/02/17 23:16:57 dtucker Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.372 2013/02/22 04:45:09 dtucker 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 |
@@ -579,7 +579,8 @@ main(int ac, char **av) | |||
579 | dummy = 1; | 579 | dummy = 1; |
580 | line = xstrdup(optarg); | 580 | line = xstrdup(optarg); |
581 | if (process_config_line(&options, host ? host : "", | 581 | if (process_config_line(&options, host ? host : "", |
582 | line, "command-line", 0, &dummy) != 0) | 582 | line, "command-line", 0, &dummy, SSHCONF_USERCONF) |
583 | != 0) | ||
583 | exit(255); | 584 | exit(255); |
584 | xfree(line); | 585 | xfree(line); |
585 | break; | 586 | break; |
@@ -673,14 +674,15 @@ main(int ac, char **av) | |||
673 | * file if the user specifies a config file on the command line. | 674 | * file if the user specifies a config file on the command line. |
674 | */ | 675 | */ |
675 | if (config != NULL) { | 676 | if (config != NULL) { |
676 | if (!read_config_file(config, host, &options, 0)) | 677 | if (!read_config_file(config, host, &options, SSHCONF_USERCONF)) |
677 | fatal("Can't open user config file %.100s: " | 678 | fatal("Can't open user config file %.100s: " |
678 | "%.100s", config, strerror(errno)); | 679 | "%.100s", config, strerror(errno)); |
679 | } else { | 680 | } else { |
680 | r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, | 681 | r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, |
681 | _PATH_SSH_USER_CONFFILE); | 682 | _PATH_SSH_USER_CONFFILE); |
682 | if (r > 0 && (size_t)r < sizeof(buf)) | 683 | if (r > 0 && (size_t)r < sizeof(buf)) |
683 | (void)read_config_file(buf, host, &options, 1); | 684 | (void)read_config_file(buf, host, &options, |
685 | SSHCONF_CHECKPERM|SSHCONF_USERCONF); | ||
684 | 686 | ||
685 | /* Read systemwide configuration file after user config. */ | 687 | /* Read systemwide configuration file after user config. */ |
686 | (void)read_config_file(_PATH_HOST_CONFIG_FILE, host, | 688 | (void)read_config_file(_PATH_HOST_CONFIG_FILE, host, |