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 9a36f1dac..0c45f0954 100644
--- a/auth.c
+++ b/auth.c
@@ -407,8 +407,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host,
407 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); 407 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid);
408 if (options.strict_modes && 408 if (options.strict_modes &&
409 (stat(user_hostfile, &st) == 0) && 409 (stat(user_hostfile, &st) == 0) &&
410 ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || 410 !secure_permissions(&st, pw->pw_uid)) {
411 (st.st_mode & 022) != 0)) {
412 logit("Authentication refused for %.100s: " 411 logit("Authentication refused for %.100s: "
413 "bad owner or modes for %.200s", 412 "bad owner or modes for %.200s",
414 pw->pw_name, user_hostfile); 413 pw->pw_name, user_hostfile);
@@ -470,8 +469,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
470 snprintf(err, errlen, "%s is not a regular file", buf); 469 snprintf(err, errlen, "%s is not a regular file", buf);
471 return -1; 470 return -1;
472 } 471 }
473 if ((!platform_sys_dir_uid(stp->st_uid) && stp->st_uid != uid) || 472 if (!secure_permissions(stp, uid)) {
474 (stp->st_mode & 022) != 0) {
475 snprintf(err, errlen, "bad ownership or modes for file %s", 473 snprintf(err, errlen, "bad ownership or modes for file %s",
476 buf); 474 buf);
477 return -1; 475 return -1;
@@ -486,8 +484,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
486 strlcpy(buf, cp, sizeof(buf)); 484 strlcpy(buf, cp, sizeof(buf));
487 485
488 if (stat(buf, &st) < 0 || 486 if (stat(buf, &st) < 0 ||
489 (!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) || 487 !secure_permissions(&st, uid)) {
490 (st.st_mode & 022) != 0) {
491 snprintf(err, errlen, 488 snprintf(err, errlen,
492 "bad ownership or modes for directory %s", buf); 489 "bad ownership or modes for directory %s", buf);
493 return -1; 490 return -1;