Parcourir la source

More minor changes for HP-UX

John C. Frickson il y a 9 ans
Parent
commit
067f531ed1
4 fichiers modifiés avec 23 ajouts et 3 suppressions
  1. 12 1
      configure
  2. 7 0
      configure.ac
  3. 2 0
      include/config.h.in
  4. 2 2
      src/nrpe.c

+ 12 - 1
configure

@@ -6745,6 +6745,17 @@ else
 fi
 
 
+ac_fn_c_check_func "$LINENO" "seteuid" "ac_cv_func_seteuid"
+if test "x$ac_cv_func_seteuid" = xyes; then :
+  $as_echo "#define SETEUID(id) seteuid(id)" >>confdefs.h
+
+else
+  $as_echo "#define SETEUID(id) setresuid((uid_t) -1, id, (uid_t) -1)" >>confdefs.h
+
+
+fi
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 vsnprintf" >&5
 $as_echo_n "checking for C99 vsnprintf... " >&6; }
 if ${ac_cv_HAVE_C99_VSNPRINTF+:} false; then :
@@ -7242,7 +7253,7 @@ fi
 				echo "*** Generating DH Parameters for SSL/TLS ***"
 				# awk to strip off meta data at bottom of dhparam output
 #				$sslbin dhparam -C 2048 | awk '/^-----/ {exit} {print}' > include/dh.h
-				$sslbin dhparam -C 1024 | awk '/^-----/ {exit} {print}' > include/dh.h
+#				$sslbin dhparam -C 1024 | awk '/^-----/ {exit} {print}' > include/dh.h
 			fi
 		fi
 	fi

+ 7 - 0
configure.ac

@@ -1,5 +1,7 @@
 dnl Process this -*-m4-*- file with autoconf to produce a configure script.
 
+set +u
+
 dnl Disable caching
 define([AC_CACHE_LOAD],)
 define([AC_CACHE_SAVE],)
@@ -204,6 +206,11 @@ AC_CHECK_FUNC(snprintf,,SNPRINTF_O=./snprintf.o)
 AC_CHECK_FUNC(asprintf,,SNPRINTF_O=./snprintf.o)
 AC_CHECK_FUNC(vasprintf,,SNPRINTF_O=./snprintf.o)
 
+AC_CHECK_FUNC(seteuid,
+	AC_DEFINE(SETEUID(id),[seteuid(id)]),
+	AC_DEFINE(SETEUID(id),[setresuid((uid_t) -1, id, (uid_t) -1)])
+)
+
 AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
 AC_TRY_RUN([
 #include <sys/types.h>

+ 2 - 0
include/config.h.in

@@ -100,6 +100,8 @@ typedef int int32_t;
 #define RETSIGTYPE ""
 #undef HAVE_STRUCT_SOCKADDR_STORAGE
 
+#undef SETEUID
+
 #undef HAVE_GETOPT_H
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>

+ 2 - 2
src/nrpe.c

@@ -2192,7 +2192,7 @@ int drop_privileges(char *user, char *group)
 			}
 #endif
 
-			if (seteuid(uid) == -1)
+			if (SETEUID(uid) == -1)
 				syslog(LOG_ERR, "Warning: Could not set effective UID=%d", (int)uid);
 		}
 	}
@@ -2258,7 +2258,7 @@ int remove_pid_file(void)
 	if (wrote_pid_file == FALSE)
 		return OK;				/* pid file was not written */
 
-	seteuid(0);					/* get root back so we can delete the pid file */
+	SETEUID(0);					/* get root back so we can delete the pid file */
 	if (unlink(pid_file) == -1) {
 		syslog(LOG_ERR, "Cannot remove pidfile '%s' - check your privileges.", pid_file);
 		return ERROR;