]> granicus.if.org Git - sudo/commitdiff
o new defines for syslog facility and priority
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 Aug 1999 10:51:02 +0000 (10:51 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 Aug 1999 10:51:02 +0000 (10:51 +0000)
o use new print_version() functino for -V mode

logging.c
logging.h
sudo.c
sudo.h

index f08e7dacf482f3e10a608f1f1031a5baa2efadc3..bc21813c6552e9dd4455e8070e1304a1c3037b4e 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -265,7 +265,7 @@ log_auth(status, inform_user)
     char *message;
     char *logline;
 #if (LOGGING & SLOG_SYSLOG)
-    int pri = Syslog_priority_NO;
+    int pri = PRI_FAILURE;
 #endif /* LOGGING & SLOG_SYSLOG */
 
     /* Set error message, if any. */
@@ -300,7 +300,7 @@ log_auth(status, inform_user)
        case VALIDATE_OK:
        case VALIDATE_OK_NOPASS:
 #if (LOGGING & SLOG_SYSLOG)
-           pri = Syslog_priority_OK;
+           pri = PRI_SUCCESS;
 #endif /* LOGGING & SLOG_SYSLOG */
 #ifdef SEND_MAIL_WHEN_OK
            send_mail(logline);
@@ -420,7 +420,7 @@ log_error(va_alist)
      * Log to syslog and/or a file.
      */
 #if (LOGGING & SLOG_SYSLOG)
-    do_syslog(Syslog_priority_NO, logline);
+    do_syslog(PRI_FAILURE, logline);
 #endif
 #if (LOGGING & SLOG_FILE)
     do_logfile(logline);
index e656f99b6326d0b211fe86093753ea22eec99413..99c0eb1440e4dd64d68eda0c316eba24616cb543 100644 (file)
--- a/logging.h
+++ b/logging.h
 #define SLOG_FILE              0x02
 #define SLOG_BOTH              0x03
 
-/* XXX - priority should be configure flag */
-/*       these should all get renamed */
+/* XXX - PRI_SUCCESS and PRI_FAILURE should be configure options */
 #if (LOGGING & SLOG_SYSLOG)
 # include <syslog.h>
-# ifndef Syslog_ident
-#  define Syslog_ident         "sudo"
-# endif
-# ifndef Syslog_options
-#  define Syslog_options       0
-# endif
-# if !defined(Syslog_facility) && defined(LOG_NFACILITIES)
-#  define Syslog_facility      LOGFAC
-# endif
-# ifndef Syslog_priority_OK
-#  define Syslog_priority_OK   LOG_NOTICE
-# endif
-# ifndef Syslog_priority_NO
-#  define Syslog_priority_NO   LOG_ALERT
-# endif
+# define PRI_SUCCESS           LOG_NOTICE
+# define PRI_FAILURE           LOG_ALERT
 #endif /* LOGGING & SLOG_SYSLOG */
 
 void log_auth                  __P((int, int));
diff --git a/sudo.c b/sudo.c
index 69f6494aeab5f0e4d84dcf16ab9172f7186df900..0e100d0618413243b91c569a046136638bbe9e02 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -65,7 +65,6 @@
 
 #include "sudo.h"
 #include "interfaces.h"
-#include "version.h"
 
 #ifndef STDC_HEADERS
 extern char *getenv    __P((char *));
@@ -174,11 +173,11 @@ main(argc, argv)
 
     /* Initialize syslog(3) if we are using it. */
 #if (LOGGING & SLOG_SYSLOG)
-# ifdef Syslog_facility
-    openlog(Syslog_ident, Syslog_options, Syslog_facility);
+# ifdef LOG_NFACILITIES
+    openlog("sudo", 0, LOGFAC);
 # else
-    openlog(Syslog_ident, Syslog_options);
-# endif /* Syslog_facility */
+    openlog("sudo", 0);
+# endif /* LOG_NFACILITIES */
 #endif /* LOGGING & SLOG_SYSLOG */
 
     /*
@@ -220,12 +219,11 @@ main(argc, argv)
 
     switch (sudo_mode) {
        case MODE_VERSION:
+           print_version();
+           exit(0);
+           break;
        case MODE_HELP:
-           (void) printf("Sudo version %s\n", version);
-           if (sudo_mode == MODE_VERSION)
-               exit(0);
-           else
-               usage(0);
+           usage(0);
            break;
        case MODE_VALIDATE:
            user_cmnd = "validate";
diff --git a/sudo.h b/sudo.h
index 645fa8e1d0ec5acb2cfa64ccaf1f9b3cd43253ce..24a5da948173901d68e21f923525701b59384a98 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -163,6 +163,7 @@ VOID *erealloc              __P((VOID *, size_t));
 char *estrdup          __P((const char *));
 void easprintf         __P((char **, const char *, ...));
 void evasprintf                __P((char **, const char *, va_list));
+void print_version     __P((void));
 YY_DECL;
 
 /* Only provide extern declarations outside of sudo.c. */