diff options
Diffstat (limited to 'auth.c')
-rw-r--r-- | auth.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -425,8 +425,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, | |||
425 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); | 425 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); |
426 | if (options.strict_modes && | 426 | if (options.strict_modes && |
427 | (stat(user_hostfile, &st) == 0) && | 427 | (stat(user_hostfile, &st) == 0) && |
428 | ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || | 428 | !secure_permissions(&st, pw->pw_uid)) { |
429 | (st.st_mode & 022) != 0)) { | ||
430 | logit("Authentication refused for %.100s: " | 429 | logit("Authentication refused for %.100s: " |
431 | "bad owner or modes for %.200s", | 430 | "bad owner or modes for %.200s", |
432 | pw->pw_name, user_hostfile); | 431 | pw->pw_name, user_hostfile); |
@@ -488,8 +487,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, | |||
488 | snprintf(err, errlen, "%s is not a regular file", buf); | 487 | snprintf(err, errlen, "%s is not a regular file", buf); |
489 | return -1; | 488 | return -1; |
490 | } | 489 | } |
491 | if ((!platform_sys_dir_uid(stp->st_uid) && stp->st_uid != uid) || | 490 | if (!secure_permissions(stp, uid)) { |
492 | (stp->st_mode & 022) != 0) { | ||
493 | snprintf(err, errlen, "bad ownership or modes for file %s", | 491 | snprintf(err, errlen, "bad ownership or modes for file %s", |
494 | buf); | 492 | buf); |
495 | return -1; | 493 | return -1; |
@@ -504,8 +502,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, | |||
504 | strlcpy(buf, cp, sizeof(buf)); | 502 | strlcpy(buf, cp, sizeof(buf)); |
505 | 503 | ||
506 | if (stat(buf, &st) < 0 || | 504 | if (stat(buf, &st) < 0 || |
507 | (!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) || | 505 | !secure_permissions(&st, uid)) { |
508 | (st.st_mode & 022) != 0) { | ||
509 | snprintf(err, errlen, | 506 | snprintf(err, errlen, |
510 | "bad ownership or modes for directory %s", buf); | 507 | "bad ownership or modes for directory %s", buf); |
511 | return -1; | 508 | return -1; |