From: Todd C. Miller Date: Thu, 5 Aug 1999 10:51:02 +0000 (+0000) Subject: o new defines for syslog facility and priority X-Git-Tag: SUDO_1_6_0~160 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27d6f353e278969ea8bbcf1e97411124f7dab47e;p=sudo o new defines for syslog facility and priority o use new print_version() functino for -V mode --- diff --git a/logging.c b/logging.c index f08e7dacf..bc21813c6 100644 --- 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); diff --git a/logging.h b/logging.h index e656f99b6..99c0eb144 100644 --- a/logging.h +++ b/logging.h @@ -65,25 +65,11 @@ #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 -# 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 69f6494ae..0e100d061 100644 --- 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 645fa8e1d..24a5da948 100644 --- 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. */