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