summaryrefslogtreecommitdiff
path: root/bin/named/unix/os.c
diff options
context:
space:
mode:
authorInternet Software Consortium, Inc <@isc.org>2011-08-20 15:47:09 -0600
committerInternet Software Consortium, Inc <@isc.org>2011-08-20 15:47:09 -0600
commit9dcbbb59f37cea46ceed2b8093280e5e23a3f498 (patch)
treefa82d28fac628ca1b6425517daaf99d5239c7bf7 /bin/named/unix/os.c
parenta593e6f3a919cf95145c05b3a6c89ef0e06a2c9b (diff)
downloadbind9-9dcbbb59f37cea46ceed2b8093280e5e23a3f498.tar.gz
9.8.1b1
Diffstat (limited to 'bin/named/unix/os.c')
-rw-r--r--bin/named/unix/os.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c
index 53e9e450..5fd65473 100644
--- a/bin/named/unix/os.c
+++ b/bin/named/unix/os.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: os.c,v 1.104 2010-11-17 23:47:08 tbox Exp $ */
+/* $Id: os.c,v 1.104.38.3 2011-03-02 00:04:01 marka Exp $ */
/*! \file */
@@ -790,6 +790,9 @@ ns_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user) {
free(f);
if (switch_user && runas_pw != NULL) {
+#ifndef HAVE_LINUXTHREADS
+ gid_t oldgid = getgid();
+#endif
/* Set UID/GID to the one we'll be running with eventually */
setperms(runas_pw->pw_uid, runas_pw->pw_gid);
@@ -797,7 +800,7 @@ ns_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user) {
#ifndef HAVE_LINUXTHREADS
/* Restore UID/GID to root */
- setperms(0, 0);
+ setperms(0, oldgid);
#endif /* HAVE_LINUXTHREADS */
if (fd == -1) {
@@ -950,7 +953,7 @@ ns_os_shutdownmsg(char *command, isc_buffer_t *text) {
isc_buffer_availablelength(text),
"pid: %ld", (long)pid);
/* Only send a message if it is complete. */
- if (n < isc_buffer_availablelength(text))
+ if (n > 0 && n < isc_buffer_availablelength(text))
isc_buffer_add(text, n);
}