version 1.195, 2013/02/17 23:16:57 |
version 1.196, 2013/02/22 04:45:08 |
|
|
int |
int |
process_config_line(Options *options, const char *host, |
process_config_line(Options *options, const char *host, |
char *line, const char *filename, int linenum, |
char *line, const char *filename, int linenum, |
int *activep) |
int *activep, int userconfig) |
{ |
{ |
char *s, **charptr, *endofnumber, *keyword, *arg, *arg2; |
char *s, **charptr, *endofnumber, *keyword, *arg, *arg2; |
char **cpptr, fwdarg[256]; |
char **cpptr, fwdarg[256]; |
|
|
if (*intptr >= SSH_MAX_IDENTITY_FILES) |
if (*intptr >= SSH_MAX_IDENTITY_FILES) |
fatal("%.200s line %d: Too many identity files specified (max %d).", |
fatal("%.200s line %d: Too many identity files specified (max %d).", |
filename, linenum, SSH_MAX_IDENTITY_FILES); |
filename, linenum, SSH_MAX_IDENTITY_FILES); |
add_identity_file(options, NULL, arg, 1); |
add_identity_file(options, NULL, arg, userconfig); |
} |
} |
break; |
break; |
|
|
|
|
|
|
int |
int |
read_config_file(const char *filename, const char *host, Options *options, |
read_config_file(const char *filename, const char *host, Options *options, |
int checkperm) |
int flags) |
{ |
{ |
FILE *f; |
FILE *f; |
char line[1024]; |
char line[1024]; |
|
|
if ((f = fopen(filename, "r")) == NULL) |
if ((f = fopen(filename, "r")) == NULL) |
return 0; |
return 0; |
|
|
if (checkperm) { |
if (flags & SSHCONF_CHECKPERM) { |
struct stat sb; |
struct stat sb; |
|
|
if (fstat(fileno(f), &sb) == -1) |
if (fstat(fileno(f), &sb) == -1) |
|
|
while (fgets(line, sizeof(line), f)) { |
while (fgets(line, sizeof(line), f)) { |
/* Update line number counter. */ |
/* Update line number counter. */ |
linenum++; |
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++; |
bad_options++; |
} |
} |
fclose(f); |
fclose(f); |