sudo/sudo-1.7.1-auditfix.patch
2009-07-09 13:29:34 +00:00

49 lines
1.3 KiB
Diff

diff -up sudo-1.7.1/audit_help.c.auditfix sudo-1.7.1/audit_help.c
--- sudo-1.7.1/audit_help.c.auditfix 2009-07-09 15:05:14.000000000 +0200
+++ sudo-1.7.1/audit_help.c 2009-07-09 15:04:33.000000000 +0200
@@ -45,7 +45,7 @@
#include <selinux/selinux.h>
#endif
-int audit_fd;
+int audit_fd = -1;
void audit_help_open (void)
{
diff -up sudo-1.7.1/sudo.c.auditfix sudo-1.7.1/sudo.c
--- sudo-1.7.1/sudo.c.auditfix 2009-07-09 14:35:50.000000000 +0200
+++ sudo-1.7.1/sudo.c 2009-07-09 15:02:41.000000000 +0200
@@ -363,10 +363,6 @@ main(argc, argv, envp)
}
if (safe_cmnd == NULL)
safe_cmnd = estrdup(user_cmnd);
-
-#if defined(WITH_AUDIT)
- audit_help_open ();
-#endif
#ifdef HAVE_SETLOCALE
setlocale(LC_ALL, "");
@@ -529,7 +525,12 @@ main(argc, argv, envp)
(void) sigaction(SIGINT, &saved_sa_int, NULL);
(void) sigaction(SIGQUIT, &saved_sa_quit, NULL);
(void) sigaction(SIGTSTP, &saved_sa_tstp, NULL);
+
+ closefrom(def_closefrom + 1);
+#if defined(WITH_AUDIT)
+ audit_help_open ();
+#endif
if (access(safe_cmnd, X_OK) != 0) {
warn ("unable to execute %s", safe_cmnd);
#ifdef WITH_AUDIT
@@ -545,8 +546,6 @@ main(argc, argv, envp)
sudo_endpwent();
sudo_endgrent();
- closefrom(def_closefrom + 1);
-
#ifndef PROFILING
if (ISSET(sudo_mode, MODE_BACKGROUND) && fork() > 0) {
syslog(LOG_AUTH|LOG_ERR, "fork");