Skip to content

Commit b090fe9

Browse files
authored
Merge pull request #2 from ajaykini/aix_audit_support_final
conditional compilation checks specifc to AIX in setresuid
2 parents 4d6cc29 + 6a970fd commit b090fe9

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
121121
SSHDOBJS=sshd.o \
122122
platform-listen.o \
123123
servconf.o sshpty.o srclimit.o groupaccess.o auth2-methods.o \
124-
dns.o fatal.o compat.o utf8.o authfd.o canohost.o packet.o\
124+
dns.o fatal.o compat.o utf8.o authfd.o canohost.o \
125125
$(P11OBJS) $(SKOBJS)
126126

127127
SSHD_SESSION_OBJS=sshd-session.o auth-rhosts.o auth-passwd.o \
128-
audit.o audit-bsm.o audit-linux.o platform.o packet.o\
128+
audit.o audit-bsm.o audit-linux.o platform.o \
129129
sshpty.o sshlogin.o servconf.o serverloop.o \
130130
auth.o auth2.o auth2-methods.o auth-options.o session.o \
131131
auth2-chall.o groupaccess.o \

openbsd-compat/bsd-setres_id.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
#include <stdarg.h>
2222
#include <unistd.h>
2323
#include <string.h>
24+
#ifdef _AIX
2425
#include <sys/id.h>
2526
#include <userpriv.h>
2627
#include <sys/priv.h>
28+
#endif
2729

2830
#include "log.h"
2931

@@ -90,17 +92,22 @@ setresuid(uid_t ruid, uid_t euid, uid_t suid)
9092
ret = -1;
9193
}
9294
# endif
93-
94-
debug("Executing setuid : ");
95-
if (setuidx(ID_EFFECTIVE|ID_REAL|ID_SAVED,ruid) < 0) {
95+
#ifdef _AIX
96+
if (setuidx(ID_EFFECTIVE|ID_REAL|ID_SAVED,ruid) < 0) {
97+
#else
98+
if (setuid(ruid) < 0) {
99+
#endif
96100
saved_errno = errno;
97101
error("setuid %lu: %.100s", (u_long)ruid, strerror(errno));
98102
errno = saved_errno;
99103
ret = -1;
100104
}
105+
#ifdef _AIX
101106
priv_clrall(&set_pv);
102107
privbit_set(&set_pv,PV_AU_);
103108
setppriv(getpid(), (privg_tp)&set_pv, (privg_tp)&set_pv, (privg_tp)&set_pv, NULL);
109+
#endif
110+
104111
#endif
105112
return ret;
106113
}

0 commit comments

Comments
 (0)