mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Replaced seteuid/setegid by setreuid/setregid for HP-UX compatibility
SVN revision: 1888
This commit is contained in:
parent
f44c5d3889
commit
cc548e1c9a
2
Makefile
2
Makefile
@ -25,7 +25,7 @@ RCDIR = $(ROOT)/etc/rc.d/init.d
|
|||||||
|
|
||||||
# Default compilation flags unless stated otherwise.
|
# Default compilation flags unless stated otherwise.
|
||||||
# Add "-DHAVE_CRYPT" and "-lcrypt" to use crypt() function.
|
# Add "-DHAVE_CRYPT" and "-lcrypt" to use crypt() function.
|
||||||
CFLAGS += -O3 -funroll-loops -fomit-frame-pointer -W -Wall
|
CFLAGS += -g -O0 -funroll-loops -fomit-frame-pointer -W -Wall
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
IFLAGS = -kr -nut -i3 -l110
|
IFLAGS = -kr -nut -i3 -l110
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: elog
|
Name: elog
|
||||||
Summary: elog is a standalone electronic web logbook
|
Summary: elog is a standalone electronic web logbook
|
||||||
Version: 2.6.4
|
Version: 2.6.5
|
||||||
Release: 1
|
Release: 1
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Applications/Networking
|
Group: Applications/Networking
|
||||||
|
|||||||
11
src/elogd.c
11
src/elogd.c
@ -1163,7 +1163,7 @@ int subst_shell(char *cmd, char *result, int size)
|
|||||||
/* child process */
|
/* child process */
|
||||||
|
|
||||||
/* restore original UID/GID */
|
/* restore original UID/GID */
|
||||||
if (setegid(orig_gid) < 0 || seteuid(orig_uid) < 0)
|
if (setregid(-1, orig_gid) < 0 || setreuid(-1, orig_uid) < 0)
|
||||||
eprintf("Cannot restore original GID/UID.\n");
|
eprintf("Cannot restore original GID/UID.\n");
|
||||||
|
|
||||||
/* give up root privilege permanently */
|
/* give up root privilege permanently */
|
||||||
@ -1915,7 +1915,7 @@ int setegroup(char *str)
|
|||||||
gr = getgrnam(str);
|
gr = getgrnam(str);
|
||||||
|
|
||||||
if (gr != NULL)
|
if (gr != NULL)
|
||||||
if (setegid(gr->gr_gid) >= 0 && initgroups(gr->gr_name, gr->gr_gid) >= 0)
|
if (setregid(-1, gr->gr_gid) >= 0 && initgroups(gr->gr_name, gr->gr_gid) >= 0)
|
||||||
return 0;
|
return 0;
|
||||||
else {
|
else {
|
||||||
eprintf("Cannot set effective GID to group \"%s\"\n", gr->gr_name);
|
eprintf("Cannot set effective GID to group \"%s\"\n", gr->gr_name);
|
||||||
@ -1938,9 +1938,9 @@ int seteuser(char *str)
|
|||||||
pw = getpwnam(str);
|
pw = getpwnam(str);
|
||||||
|
|
||||||
if (pw != NULL)
|
if (pw != NULL)
|
||||||
if (seteuid(pw->pw_uid) >= 0)
|
if (setreuid(-1, pw->pw_uid) >= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
else {
|
} else {
|
||||||
eprintf("Cannot set effective UID to user \"%s\"\n", str);
|
eprintf("Cannot set effective UID to user \"%s\"\n", str);
|
||||||
eprintf("setuser: %s\n", strerror(errno));
|
eprintf("setuser: %s\n", strerror(errno));
|
||||||
} else
|
} else
|
||||||
@ -25747,6 +25747,7 @@ void server_loop(void)
|
|||||||
strcpy(remote_host[i_conn], (char *) inet_ntoa(rem_addr));
|
strcpy(remote_host[i_conn], (char *) inet_ntoa(rem_addr));
|
||||||
|
|
||||||
strcpy(rem_host, remote_host[i_conn]);
|
strcpy(rem_host, remote_host[i_conn]);
|
||||||
|
printf("X-forwarded-host: %s\n", rem_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_logging_level > 3) {
|
if (_logging_level > 3) {
|
||||||
@ -26544,7 +26545,7 @@ void cleanup(void)
|
|||||||
struct stat finfo;
|
struct stat finfo;
|
||||||
|
|
||||||
/* regain original uid */
|
/* regain original uid */
|
||||||
if (setegid(orig_gid) < 0 || seteuid(orig_uid) < 0)
|
if (setregid(-1, orig_gid) < 0 || setreuid(-1, orig_uid) < 0)
|
||||||
eprintf("Cannot restore original GID/UID.\n");
|
eprintf("Cannot restore original GID/UID.\n");
|
||||||
if (pidfile[0] && stat(pidfile, &finfo) >= 0) {
|
if (pidfile[0] && stat(pidfile, &finfo) >= 0) {
|
||||||
if (remove(pidfile) < 0) {
|
if (remove(pidfile) < 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user