diff options
author | deraadt@openbsd.org <deraadt@openbsd.org> | 2019-06-28 13:35:04 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-07-05 11:10:39 +1000 |
commit | 4d28fa78abce2890e136281950633fae2066cc29 (patch) | |
tree | 33226ec64ced661bb7e40005e30744b68fa59a80 /auth-rhosts.c | |
parent | e8c974043c1648eab0ad67a7ba6a3e444fe79d2d (diff) |
upstream: When system calls indicate an error they return -1, not
some arbitrary value < 0. errno is only updated in this case. Change all
(most?) callers of syscalls to follow this better, and let's see if this
strictness helps us in the future.
OpenBSD-Commit-ID: 48081f00db7518e3b712a49dca06efc2a5428075
Diffstat (limited to 'auth-rhosts.c')
-rw-r--r-- | auth-rhosts.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/auth-rhosts.c b/auth-rhosts.c index 57296e1f6..63c1c8acb 100644 --- a/auth-rhosts.c +++ b/auth-rhosts.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth-rhosts.c,v 1.49 2018/07/09 21:35:50 markus Exp $ */ | 1 | /* $OpenBSD: auth-rhosts.c,v 1.50 2019/06/28 13:35:04 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -222,8 +222,8 @@ auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname, | |||
222 | * are no system-wide files. | 222 | * are no system-wide files. |
223 | */ | 223 | */ |
224 | if (!rhosts_files[rhosts_file_index] && | 224 | if (!rhosts_files[rhosts_file_index] && |
225 | stat(_PATH_RHOSTS_EQUIV, &st) < 0 && | 225 | stat(_PATH_RHOSTS_EQUIV, &st) == -1 && |
226 | stat(_PATH_SSH_HOSTS_EQUIV, &st) < 0) { | 226 | stat(_PATH_SSH_HOSTS_EQUIV, &st) == -1) { |
227 | debug3("%s: no hosts access files exist", __func__); | 227 | debug3("%s: no hosts access files exist", __func__); |
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
@@ -253,7 +253,7 @@ auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname, | |||
253 | * Check that the home directory is owned by root or the user, and is | 253 | * Check that the home directory is owned by root or the user, and is |
254 | * not group or world writable. | 254 | * not group or world writable. |
255 | */ | 255 | */ |
256 | if (stat(pw->pw_dir, &st) < 0) { | 256 | if (stat(pw->pw_dir, &st) == -1) { |
257 | logit("Rhosts authentication refused for %.100s: " | 257 | logit("Rhosts authentication refused for %.100s: " |
258 | "no home directory %.200s", pw->pw_name, pw->pw_dir); | 258 | "no home directory %.200s", pw->pw_name, pw->pw_dir); |
259 | auth_debug_add("Rhosts authentication refused for %.100s: " | 259 | auth_debug_add("Rhosts authentication refused for %.100s: " |
@@ -278,7 +278,7 @@ auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname, | |||
278 | /* Check users .rhosts or .shosts. */ | 278 | /* Check users .rhosts or .shosts. */ |
279 | snprintf(buf, sizeof buf, "%.500s/%.100s", | 279 | snprintf(buf, sizeof buf, "%.500s/%.100s", |
280 | pw->pw_dir, rhosts_files[rhosts_file_index]); | 280 | pw->pw_dir, rhosts_files[rhosts_file_index]); |
281 | if (stat(buf, &st) < 0) | 281 | if (stat(buf, &st) == -1) |
282 | continue; | 282 | continue; |
283 | 283 | ||
284 | /* | 284 | /* |