summaryrefslogtreecommitdiff
path: root/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth.c')
-rw-r--r--auth.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/auth.c b/auth.c
index 8ffd77662..fc0c05bae 100644
--- a/auth.c
+++ b/auth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth.c,v 1.138 2019/01/19 21:41:18 djm Exp $ */ 1/* $OpenBSD: auth.c,v 1.141 2019/10/02 00:42:30 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -32,6 +32,7 @@
32 32
33#include <netinet/in.h> 33#include <netinet/in.h>
34 34
35#include <stdlib.h>
35#include <errno.h> 36#include <errno.h>
36#include <fcntl.h> 37#include <fcntl.h>
37#ifdef HAVE_PATHS_H 38#ifdef HAVE_PATHS_H
@@ -72,7 +73,6 @@
72#endif 73#endif
73#include "authfile.h" 74#include "authfile.h"
74#include "monitor_wrap.h" 75#include "monitor_wrap.h"
75#include "authfile.h"
76#include "ssherr.h" 76#include "ssherr.h"
77#include "compat.h" 77#include "compat.h"
78#include "channels.h" 78#include "channels.h"
@@ -167,7 +167,7 @@ allowed_user(struct ssh *ssh, struct passwd * pw)
167 char *shell = xstrdup((pw->pw_shell[0] == '\0') ? 167 char *shell = xstrdup((pw->pw_shell[0] == '\0') ?
168 _PATH_BSHELL : pw->pw_shell); /* empty = /bin/sh */ 168 _PATH_BSHELL : pw->pw_shell); /* empty = /bin/sh */
169 169
170 if (stat(shell, &st) != 0) { 170 if (stat(shell, &st) == -1) {
171 logit("User %.100s not allowed because shell %.100s " 171 logit("User %.100s not allowed because shell %.100s "
172 "does not exist", pw->pw_name, shell); 172 "does not exist", pw->pw_name, shell);
173 free(shell); 173 free(shell);
@@ -517,7 +517,7 @@ auth_openfile(const char *file, struct passwd *pw, int strict_modes,
517 return NULL; 517 return NULL;
518 } 518 }
519 519
520 if (fstat(fd, &st) < 0) { 520 if (fstat(fd, &st) == -1) {
521 close(fd); 521 close(fd);
522 return NULL; 522 return NULL;
523 } 523 }
@@ -791,7 +791,7 @@ subprocess(const char *tag, struct passwd *pw, const char *command,
791 return 0; 791 return 0;
792 } 792 }
793 temporarily_use_uid(pw); 793 temporarily_use_uid(pw);
794 if (stat(av[0], &st) < 0) { 794 if (stat(av[0], &st) == -1) {
795 error("Could not stat %s \"%s\": %s", tag, 795 error("Could not stat %s \"%s\": %s", tag,
796 av[0], strerror(errno)); 796 av[0], strerror(errno));
797 restore_uid(); 797 restore_uid();
@@ -803,7 +803,7 @@ subprocess(const char *tag, struct passwd *pw, const char *command,
803 return 0; 803 return 0;
804 } 804 }
805 /* Prepare to keep the child's stdout if requested */ 805 /* Prepare to keep the child's stdout if requested */
806 if (pipe(p) != 0) { 806 if (pipe(p) == -1) {
807 error("%s: pipe: %s", tag, strerror(errno)); 807 error("%s: pipe: %s", tag, strerror(errno));
808 restore_uid(); 808 restore_uid();
809 return 0; 809 return 0;
@@ -853,12 +853,12 @@ subprocess(const char *tag, struct passwd *pw, const char *command,
853 closefrom(STDERR_FILENO + 1); 853 closefrom(STDERR_FILENO + 1);
854 854
855 /* Don't use permanently_set_uid() here to avoid fatal() */ 855 /* Don't use permanently_set_uid() here to avoid fatal() */
856 if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) != 0) { 856 if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) == -1) {
857 error("%s: setresgid %u: %s", tag, (u_int)pw->pw_gid, 857 error("%s: setresgid %u: %s", tag, (u_int)pw->pw_gid,
858 strerror(errno)); 858 strerror(errno));
859 _exit(1); 859 _exit(1);
860 } 860 }
861 if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) != 0) { 861 if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) == -1) {
862 error("%s: setresuid %u: %s", tag, (u_int)pw->pw_uid, 862 error("%s: setresuid %u: %s", tag, (u_int)pw->pw_uid,
863 strerror(errno)); 863 strerror(errno));
864 _exit(1); 864 _exit(1);