version 1.86, 2010/03/05 02:58:11 |
version 1.87, 2010/05/07 11:30:29 |
|
|
return expand_authorized_keys(options.authorized_keys_file2, pw); |
return expand_authorized_keys(options.authorized_keys_file2, pw); |
} |
} |
|
|
|
char * |
|
authorized_principals_file(struct passwd *pw) |
|
{ |
|
if (options.authorized_principals_file == NULL) |
|
return NULL; |
|
return expand_authorized_keys(options.authorized_principals_file, pw); |
|
} |
|
|
/* return ok if key exists in sysfile or userfile */ |
/* return ok if key exists in sysfile or userfile */ |
HostStatus |
HostStatus |
check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, |
check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, |
|
|
return 0; |
return 0; |
} |
} |
|
|
FILE * |
static FILE * |
auth_openkeyfile(const char *file, struct passwd *pw, int strict_modes) |
auth_openfile(const char *file, struct passwd *pw, int strict_modes, |
|
int log_missing, char *file_type) |
{ |
{ |
char line[1024]; |
char line[1024]; |
struct stat st; |
struct stat st; |
int fd; |
int fd; |
FILE *f; |
FILE *f; |
|
|
/* |
|
* Open the file containing the authorized keys |
|
* Fail quietly if file does not exist |
|
*/ |
|
if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) { |
if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) { |
if (errno != ENOENT) |
if (log_missing || errno != ENOENT) |
debug("Could not open keyfile '%s': %s", file, |
debug("Could not open %s '%s': %s", file_type, file, |
strerror(errno)); |
strerror(errno)); |
return NULL; |
return NULL; |
} |
} |
|
|
return NULL; |
return NULL; |
} |
} |
if (!S_ISREG(st.st_mode)) { |
if (!S_ISREG(st.st_mode)) { |
logit("User %s authorized keys %s is not a regular file", |
logit("User %s %s %s is not a regular file", |
pw->pw_name, file); |
pw->pw_name, file_type, file); |
close(fd); |
close(fd); |
return NULL; |
return NULL; |
} |
} |
|
|
} |
} |
|
|
return f; |
return f; |
|
} |
|
|
|
|
|
FILE * |
|
auth_openkeyfile(const char *file, struct passwd *pw, int strict_modes) |
|
{ |
|
return auth_openfile(file, pw, strict_modes, 1, "authorized keys"); |
|
} |
|
|
|
FILE * |
|
auth_openprincipals(const char *file, struct passwd *pw, int strict_modes) |
|
{ |
|
return auth_openfile(file, pw, strict_modes, 0, |
|
"authorized principals"); |
} |
} |
|
|
struct passwd * |
struct passwd * |