openbsd-ports/net/uucp/patches/patch-unix_init_c
2003-12-14 01:39:18 +00:00

41 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Deal with _POSIX_SAVED_IDS when relinquishing privileges
use MAXHOSTNAMELEN
$OpenBSD: patch-unix_init_c,v 1.2 2003/12/14 01:39:18 naddy Exp $
--- unix/init.c.orig 2003-05-29 08:08:49.000000000 +0200
+++ unix/init.c 2003-11-11 21:28:58.000000000 +0100
@@ -209,7 +209,8 @@ usysdep_initialize (puuconf,iflags)
if (iuuconf == UUCONF_NOT_FOUND)
{
#if HAVE_GETHOSTNAME
- char ab[256];
+#include <sys/param.h>
+ char ab[MAXHOSTNAMELEN];
if (gethostname (ab, sizeof ab - 1) < 0)
ulog (LOG_FATAL, "gethostname: %s", strerror (errno));
@@ -271,8 +272,10 @@ usysdep_initialize (puuconf,iflags)
&& geteuid () == 0)
{
q = getpwnam (OWNER);
- if (q != NULL)
+ if (q != NULL) {
+ seteuid (q->pw_uid);
setuid (q->pw_uid);
+ }
}
if ((iflags & INIT_GETCWD) != 0)
@@ -370,8 +373,10 @@ usysdep_exit (fsuccess)
boolean fsysdep_other_config (z)
const char *z ATTRIBUTE_UNUSED;
{
- (void) setuid (getuid ());
+ (void) setegid (getgid ());
(void) setgid (getgid ());
+ (void) seteuid (getuid ());
+ (void) setuid (getuid ());
return TRUE;
}