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