diff options
Diffstat (limited to 'auth.c')
-rw-r--r-- | auth.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -444,8 +444,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, | |||
444 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); | 444 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); |
445 | if (options.strict_modes && | 445 | if (options.strict_modes && |
446 | (stat(user_hostfile, &st) == 0) && | 446 | (stat(user_hostfile, &st) == 0) && |
447 | ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || | 447 | !secure_permissions(&st, pw->pw_uid)) { |
448 | (st.st_mode & 022) != 0)) { | ||
449 | logit("Authentication refused for %.100s: " | 448 | logit("Authentication refused for %.100s: " |
450 | "bad owner or modes for %.200s", | 449 | "bad owner or modes for %.200s", |
451 | pw->pw_name, user_hostfile); | 450 | pw->pw_name, user_hostfile); |
@@ -507,8 +506,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, | |||
507 | snprintf(err, errlen, "%s is not a regular file", buf); | 506 | snprintf(err, errlen, "%s is not a regular file", buf); |
508 | return -1; | 507 | return -1; |
509 | } | 508 | } |
510 | if ((!platform_sys_dir_uid(stp->st_uid) && stp->st_uid != uid) || | 509 | if (!secure_permissions(stp, uid)) { |
511 | (stp->st_mode & 022) != 0) { | ||
512 | snprintf(err, errlen, "bad ownership or modes for file %s", | 510 | snprintf(err, errlen, "bad ownership or modes for file %s", |
513 | buf); | 511 | buf); |
514 | return -1; | 512 | return -1; |
@@ -523,8 +521,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, | |||
523 | strlcpy(buf, cp, sizeof(buf)); | 521 | strlcpy(buf, cp, sizeof(buf)); |
524 | 522 | ||
525 | if (stat(buf, &st) < 0 || | 523 | if (stat(buf, &st) < 0 || |
526 | (!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) || | 524 | !secure_permissions(&st, uid)) { |
527 | (st.st_mode & 022) != 0) { | ||
528 | snprintf(err, errlen, | 525 | snprintf(err, errlen, |
529 | "bad ownership or modes for directory %s", buf); | 526 | "bad ownership or modes for directory %s", buf); |
530 | return -1; | 527 | return -1; |