|
Lines 388-394
Link Here
|
| 388 |
user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); |
388 |
user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); |
| 389 |
if (options.strict_modes && |
389 |
if (options.strict_modes && |
| 390 |
(stat(user_hostfile, &st) == 0) && |
390 |
(stat(user_hostfile, &st) == 0) && |
| 391 |
((st.st_uid != 0 && st.st_uid != pw->pw_uid) || |
391 |
((st.st_uid != ROOTUID && st.st_uid != pw->pw_uid) || |
| 392 |
(st.st_mode & 022) != 0)) { |
392 |
(st.st_mode & 022) != 0)) { |
| 393 |
logit("Authentication refused for %.100s: " |
393 |
logit("Authentication refused for %.100s: " |
| 394 |
"bad owner or modes for %.200s", |
394 |
"bad owner or modes for %.200s", |
|
Lines 441-447
Link Here
|
| 441 |
|
441 |
|
| 442 |
/* check the open file to avoid races */ |
442 |
/* check the open file to avoid races */ |
| 443 |
if (fstat(fileno(f), &st) < 0 || |
443 |
if (fstat(fileno(f), &st) < 0 || |
| 444 |
(st.st_uid != 0 && st.st_uid != uid) || |
444 |
(st.st_uid != ROOTUID && st.st_uid != uid) || |
| 445 |
(st.st_mode & 022) != 0) { |
445 |
(st.st_mode & 022) != 0) { |
| 446 |
snprintf(err, errlen, "bad ownership or modes for file %s", |
446 |
snprintf(err, errlen, "bad ownership or modes for file %s", |
| 447 |
buf); |
447 |
buf); |
|
Lines 458-464
Link Here
|
| 458 |
|
458 |
|
| 459 |
debug3("secure_filename: checking '%s'", buf); |
459 |
debug3("secure_filename: checking '%s'", buf); |
| 460 |
if (stat(buf, &st) < 0 || |
460 |
if (stat(buf, &st) < 0 || |
| 461 |
(st.st_uid != 0 && st.st_uid != uid) || |
461 |
(st.st_uid != ROOTUID && st.st_uid != uid) || |
| 462 |
(st.st_mode & 022) != 0) { |
462 |
(st.st_mode & 022) != 0) { |
| 463 |
snprintf(err, errlen, |
463 |
snprintf(err, errlen, |
| 464 |
"bad ownership or modes for directory %s", buf); |
464 |
"bad ownership or modes for directory %s", buf); |