- dtucker@cvs.openbsd.org 2013/02/22 04:45:09
[ssh.c readconf.c readconf.h] Don't complain if IdentityFiles specified in system-wide configs are missing. ok djm, deraadt
This commit is contained in:
parent
f3c3814243
commit
aefa368243
|
@ -8,6 +8,10 @@
|
|||
- dtucker@cvs.openbsd.org 2013/02/19 02:12:47
|
||||
[krl.c]
|
||||
Remove bogus include. ok djm
|
||||
- dtucker@cvs.openbsd.org 2013/02/22 04:45:09
|
||||
[ssh.c readconf.c readconf.h]
|
||||
Don't complain if IdentityFiles specified in system-wide configs are
|
||||
missing. ok djm, deraadt.
|
||||
|
||||
20130401
|
||||
- (dtucker) [openbsd-compat/bsd-cygwin_util.{c,h}] Don't include windows.h
|
||||
|
|
13
readconf.c
13
readconf.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: readconf.c,v 1.195 2013/02/17 23:16:57 dtucker Exp $ */
|
||||
/* $OpenBSD: readconf.c,v 1.196 2013/02/22 04:45:08 dtucker Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* 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)
|
|||
int
|
||||
process_config_line(Options *options, const char *host,
|
||||
char *line, const char *filename, int linenum,
|
||||
int *activep)
|
||||
int *activep, int userconfig)
|
||||
{
|
||||
char *s, **charptr, *endofnumber, *keyword, *arg, *arg2;
|
||||
char **cpptr, fwdarg[256];
|
||||
|
@ -606,7 +606,7 @@ parse_yesnoask:
|
|||
if (*intptr >= SSH_MAX_IDENTITY_FILES)
|
||||
fatal("%.200s line %d: Too many identity files specified (max %d).",
|
||||
filename, linenum, SSH_MAX_IDENTITY_FILES);
|
||||
add_identity_file(options, NULL, arg, 1);
|
||||
add_identity_file(options, NULL, arg, userconfig);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ parse_int:
|
|||
|
||||
int
|
||||
read_config_file(const char *filename, const char *host, Options *options,
|
||||
int checkperm)
|
||||
int flags)
|
||||
{
|
||||
FILE *f;
|
||||
char line[1024];
|
||||
|
@ -1103,7 +1103,7 @@ read_config_file(const char *filename, const char *host, Options *options,
|
|||
if ((f = fopen(filename, "r")) == NULL)
|
||||
return 0;
|
||||
|
||||
if (checkperm) {
|
||||
if (flags & SSHCONF_CHECKPERM) {
|
||||
struct stat sb;
|
||||
|
||||
if (fstat(fileno(f), &sb) == -1)
|
||||
|
@ -1124,7 +1124,8 @@ read_config_file(const char *filename, const char *host, Options *options,
|
|||
while (fgets(line, sizeof(line), f)) {
|
||||
/* Update line number counter. */
|
||||
linenum++;
|
||||
if (process_config_line(options, host, line, filename, linenum, &active) != 0)
|
||||
if (process_config_line(options, host, line, filename, linenum,
|
||||
&active, flags & SSHCONF_USERCONF) != 0)
|
||||
bad_options++;
|
||||
}
|
||||
fclose(f);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: readconf.h,v 1.92 2013/02/17 23:16:57 dtucker Exp $ */
|
||||
/* $OpenBSD: readconf.h,v 1.93 2013/02/22 04:45:09 dtucker Exp $ */
|
||||
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
|
@ -149,13 +149,17 @@ typedef struct {
|
|||
#define REQUEST_TTY_YES 2
|
||||
#define REQUEST_TTY_FORCE 3
|
||||
|
||||
#define SSHCONF_CHECKPERM 1 /* check permissions on config file */
|
||||
#define SSHCONF_USERCONF 2 /* user provided config file not system */
|
||||
|
||||
void initialize_options(Options *);
|
||||
void fill_default_options(Options *);
|
||||
int read_config_file(const char *, const char *, Options *, int);
|
||||
int parse_forward(Forward *, const char *, int, int);
|
||||
|
||||
int
|
||||
process_config_line(Options *, const char *, char *, const char *, int, int *);
|
||||
process_config_line(Options *, const char *, char *, const char *, int, int *,
|
||||
int);
|
||||
|
||||
void add_local_forward(Options *, const Forward *);
|
||||
void add_remote_forward(Options *, const Forward *);
|
||||
|
|
10
ssh.c
10
ssh.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ssh.c,v 1.371 2013/02/17 23:16:57 dtucker Exp $ */
|
||||
/* $OpenBSD: ssh.c,v 1.372 2013/02/22 04:45:09 dtucker Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -579,7 +579,8 @@ main(int ac, char **av)
|
|||
dummy = 1;
|
||||
line = xstrdup(optarg);
|
||||
if (process_config_line(&options, host ? host : "",
|
||||
line, "command-line", 0, &dummy) != 0)
|
||||
line, "command-line", 0, &dummy, SSHCONF_USERCONF)
|
||||
!= 0)
|
||||
exit(255);
|
||||
xfree(line);
|
||||
break;
|
||||
|
@ -673,14 +674,15 @@ main(int ac, char **av)
|
|||
* file if the user specifies a config file on the command line.
|
||||
*/
|
||||
if (config != NULL) {
|
||||
if (!read_config_file(config, host, &options, 0))
|
||||
if (!read_config_file(config, host, &options, SSHCONF_USERCONF))
|
||||
fatal("Can't open user config file %.100s: "
|
||||
"%.100s", config, strerror(errno));
|
||||
} else {
|
||||
r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir,
|
||||
_PATH_SSH_USER_CONFFILE);
|
||||
if (r > 0 && (size_t)r < sizeof(buf))
|
||||
(void)read_config_file(buf, host, &options, 1);
|
||||
(void)read_config_file(buf, host, &options,
|
||||
SSHCONF_CHECKPERM|SSHCONF_USERCONF);
|
||||
|
||||
/* Read systemwide configuration file after user config. */
|
||||
(void)read_config_file(_PATH_HOST_CONFIG_FILE, host,
|
||||
|
|
Loading…
Reference in New Issue