diff options
author | Colin Watson <cjwatson@debian.org> | 2010-05-22 22:43:47 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2010-05-22 22:43:47 +0100 |
commit | d61e316833eb7d05b0b5c937bfce8ee0f19dc7cb (patch) | |
tree | 5a2e2057bd64ca0825d5edf13e55128a2fb7cadb /auth.c | |
parent | ec9f6c25d67f48277fe2ed56fa7773c7f6cf3580 (diff) |
Allow ~/.ssh/authorized_keys and other secure files to be
group-writable, provided that the group in question contains only the
file's owner; this extends a patch previously applied to ~/.ssh/config
(closes: #581919).
Diffstat (limited to 'auth.c')
-rw-r--r-- | auth.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -385,8 +385,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, | |||
385 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); | 385 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); |
386 | if (options.strict_modes && | 386 | if (options.strict_modes && |
387 | (stat(user_hostfile, &st) == 0) && | 387 | (stat(user_hostfile, &st) == 0) && |
388 | ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || | 388 | !secure_permissions(&st, pw->pw_uid)) { |
389 | (st.st_mode & 022) != 0)) { | ||
390 | logit("Authentication refused for %.100s: " | 389 | logit("Authentication refused for %.100s: " |
391 | "bad owner or modes for %.200s", | 390 | "bad owner or modes for %.200s", |
392 | pw->pw_name, user_hostfile); | 391 | pw->pw_name, user_hostfile); |
@@ -438,8 +437,7 @@ secure_filename(FILE *f, const char *file, struct passwd *pw, | |||
438 | 437 | ||
439 | /* check the open file to avoid races */ | 438 | /* check the open file to avoid races */ |
440 | if (fstat(fileno(f), &st) < 0 || | 439 | if (fstat(fileno(f), &st) < 0 || |
441 | (st.st_uid != 0 && st.st_uid != uid) || | 440 | !secure_permissions(&st, uid)) { |
442 | (st.st_mode & 022) != 0) { | ||
443 | snprintf(err, errlen, "bad ownership or modes for file %s", | 441 | snprintf(err, errlen, "bad ownership or modes for file %s", |
444 | buf); | 442 | buf); |
445 | return -1; | 443 | return -1; |
@@ -455,8 +453,7 @@ secure_filename(FILE *f, const char *file, struct passwd *pw, | |||
455 | 453 | ||
456 | debug3("secure_filename: checking '%s'", buf); | 454 | debug3("secure_filename: checking '%s'", buf); |
457 | if (stat(buf, &st) < 0 || | 455 | if (stat(buf, &st) < 0 || |
458 | (st.st_uid != 0 && st.st_uid != uid) || | 456 | !secure_permissions(&st, uid)) { |
459 | (st.st_mode & 022) != 0) { | ||
460 | snprintf(err, errlen, | 457 | snprintf(err, errlen, |
461 | "bad ownership or modes for directory %s", buf); | 458 | "bad ownership or modes for directory %s", buf); |
462 | return -1; | 459 | return -1; |