now use setreuid()
This commit is contained in:
12
check.c
12
check.c
@@ -82,10 +82,10 @@ void check_user()
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
rtn = check_timestamp();
|
rtn = check_timestamp();
|
||||||
if (setruid(uid)) { /* don't want to be root longer than
|
/* don't want to be root longer than necessary */
|
||||||
* necessary */
|
if (setreuid(uid, (uid_t)-1)) {
|
||||||
#ifndef _AIX
|
#ifndef _AIX
|
||||||
perror("setruid(uid)");
|
perror("setreuid()");
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -97,10 +97,10 @@ void check_user()
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
update_timestamp();
|
update_timestamp();
|
||||||
if (setruid(uid)) { /* don't want to be root longer than
|
/* don't want to be root longer than necessary */
|
||||||
* necessary */
|
if (setreuid(uid, (uid_t)-1)) {
|
||||||
#ifndef _AIX
|
#ifndef _AIX
|
||||||
perror("setruid(uid)");
|
perror("setreuid()");
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
4
sudo.c
4
sudo.c
@@ -131,9 +131,9 @@ main(argc, argv, envp)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
rtn = validate();
|
rtn = validate();
|
||||||
if (setruid(uid)) {
|
if (setreuid(uid, (uid_t)-1)) {
|
||||||
#ifndef _AIX
|
#ifndef _AIX
|
||||||
perror("setruid(uid)");
|
perror("setreuid()");
|
||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
9
sudo.h
9
sudo.h
@@ -289,18 +289,11 @@ extern char **Envp;
|
|||||||
#endif
|
#endif
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
|
||||||
/*
|
|
||||||
* Emulate setruid() under linux
|
|
||||||
*/
|
|
||||||
#ifdef linux
|
|
||||||
#define setruid(__RUID) (setreuid((uid_t) (__RUID), (uid_t) -1))
|
|
||||||
#endif /* linux */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is to placate hpux
|
* This is to placate hpux
|
||||||
*/
|
*/
|
||||||
#ifdef hpux
|
#ifdef hpux
|
||||||
#define setruid(__RUID) (setresuid((uid_t) (__RUID), (uid_t) -1, (uid_t) -1))
|
#define setreuid(__RUID, __EUID) (setresuid(__RUID, __EUID, (uid_t) -1))
|
||||||
#define getdtablesize() (sysconf(_SC_OPEN_MAX))
|
#define getdtablesize() (sysconf(_SC_OPEN_MAX))
|
||||||
#ifndef USE_CWD
|
#ifndef USE_CWD
|
||||||
#define USE_CWD
|
#define USE_CWD
|
||||||
|
Reference in New Issue
Block a user