summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/nsd.c
diff options
context:
space:
mode:
authorJakob Schlyter <jakob@cvs.openbsd.org>2011-05-21 18:29:57 +0000
committerJakob Schlyter <jakob@cvs.openbsd.org>2011-05-21 18:29:57 +0000
commitb909b54c8500748cbeafc196862afe51932e033f (patch)
tree209cc589f7f933f8919f11e05dd9129c10062370 /usr.sbin/nsd/nsd.c
parent1b54f2dc84bb9cee0bece121aa6a98a3f651d28f (diff)
resolve conflicts and regen configure using autoconf-2.65
Diffstat (limited to 'usr.sbin/nsd/nsd.c')
-rw-r--r--usr.sbin/nsd/nsd.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/nsd/nsd.c b/usr.sbin/nsd/nsd.c
index de356f05187..372c2b47f3f 100644
--- a/usr.sbin/nsd/nsd.c
+++ b/usr.sbin/nsd/nsd.c
@@ -1,7 +1,7 @@
/*
* nsd.c -- nsd(8)
*
- * Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
+ * Copyright (c) 2001-2011, NLnet Labs. All rights reserved.
*
* See LICENSE for the license.
*
@@ -106,7 +106,7 @@ version(void)
fprintf(stderr, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
fprintf(stderr, "Written by NLnet Labs.\n\n");
fprintf(stderr,
- "Copyright (C) 2001-2006 NLnet Labs. This is free software.\n"
+ "Copyright (C) 2001-2011 NLnet Labs. This is free software.\n"
"There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"
"FOR A PARTICULAR PURPOSE.\n");
exit(0);
@@ -954,7 +954,9 @@ main(int argc, char *argv[])
#ifdef HAVE_GETPWNAM
if (*nsd.username) {
#ifdef HAVE_SETUSERCONTEXT
- /* setusercontext sets resource limits from login config */
+ /* setusercontext does initgroups, setuid, setgid, and
+ * also resource limits from login config, but we
+ * still call setresuid, setresgid to be sure to set all uid */
if (setusercontext(NULL, pwd, nsd.uid,
LOGIN_SETALL & ~LOGIN_SETUSER & ~LOGIN_SETGROUP) != 0)
log_msg(LOG_WARNING, "unable to setusercontext %s: %s",
@@ -963,8 +965,8 @@ main(int argc, char *argv[])
}
#endif /* HAVE_GETPWNAM */
-#ifdef HAVE_CHROOT
/* Chroot */
+#ifdef HAVE_CHROOT
if (nsd.chrootdir && strlen(nsd.chrootdir)) {
int l = strlen(nsd.chrootdir);
int ret = 0;
@@ -1014,11 +1016,11 @@ main(int argc, char *argv[])
/* Drop the permissions */
#ifdef HAVE_GETPWNAM
if (*nsd.username) {
- #ifdef HAVE_INITGROUPS
+#ifdef HAVE_INITGROUPS
if(initgroups(nsd.username, nsd.gid) != 0)
log_msg(LOG_WARNING, "unable to initgroups %s: %s",
nsd.username, strerror(errno));
- #endif /* HAVE_INITGROUPS */
+#endif /* HAVE_INITGROUPS */
endpwent();
#ifdef HAVE_SETRESGID
@@ -1043,7 +1045,7 @@ main(int argc, char *argv[])
DEBUG(DEBUG_IPC,1, (LOG_INFO, "dropped user privileges, run as %s",
nsd.username));
- }
+ }
#endif /* HAVE_GETPWNAM */
if (server_prepare(&nsd) != 0) {