Remove BROKEN_SYSLOG define which was for obsolete versions of HP-UX.

Remove last remnants of 4.2BSD syslog support.
This commit is contained in:
Todd C. Miller
2015-06-18 17:53:49 -06:00
parent 86fb8e15a8
commit 138aa2ccd1
5 changed files with 0 additions and 47 deletions

View File

@@ -3,10 +3,6 @@
#ifndef SUDO_CONFIG_H #ifndef SUDO_CONFIG_H
#define SUDO_CONFIG_H #define SUDO_CONFIG_H
/* Define to 1 if the `syslog' function returns a non-zero int to denote
failure. */
#undef BROKEN_SYSLOG
/* Define to 1 if you want the insults from the "classic" version sudo. */ /* Define to 1 if you want the insults from the "classic" version sudo. */
#undef CLASSIC_INSULTS #undef CLASSIC_INSULTS

8
configure vendored
View File

@@ -14959,14 +14959,7 @@ $as_echo "$sudo_cv_var_daportable" >&6; }
esac esac
case "$host_os" in case "$host_os" in
hpux[1-8].*)
$as_echo "#define BROKEN_SYSLOG 1" >>confdefs.h
;;
hpux9.*) hpux9.*)
$as_echo "#define BROKEN_SYSLOG 1" >>confdefs.h
shadow_funcs="getspwuid" shadow_funcs="getspwuid"
# DCE support (requires ANSI C compiler) # DCE support (requires ANSI C compiler)
@@ -26855,6 +26848,5 @@ fi

View File

@@ -1828,12 +1828,7 @@ case "$host" in
esac esac
case "$host_os" in case "$host_os" in
hpux[[1-8]].*)
AC_DEFINE(BROKEN_SYSLOG)
;;
hpux9.*) hpux9.*)
AC_DEFINE(BROKEN_SYSLOG)
shadow_funcs="getspwuid" shadow_funcs="getspwuid"
# DCE support (requires ANSI C compiler) # DCE support (requires ANSI C compiler)
@@ -4237,7 +4232,6 @@ fi
dnl dnl
dnl Autoheader templates dnl Autoheader templates
dnl dnl
AH_TEMPLATE(BROKEN_SYSLOG, [Define to 1 if the `syslog' function returns a non-zero int to denote failure.])
AH_TEMPLATE(CLASSIC_INSULTS, [Define to 1 if you want the insults from the "classic" version sudo.]) AH_TEMPLATE(CLASSIC_INSULTS, [Define to 1 if you want the insults from the "classic" version sudo.])
AH_TEMPLATE(CSOPS_INSULTS, [Define to 1 if you want insults culled from the twisted minds of CSOps.]) AH_TEMPLATE(CSOPS_INSULTS, [Define to 1 if you want insults culled from the twisted minds of CSOps.])
AH_TEMPLATE(DONT_LEAK_PATH_INFO, [Define to 1 if you want sudo to display "command not allowed" instead of "command not found" when a command cannot be found.]) AH_TEMPLATE(DONT_LEAK_PATH_INFO, [Define to 1 if you want sudo to display "command not allowed" instead of "command not found" when a command cannot be found.])

View File

@@ -55,7 +55,6 @@ struct strmap {
int num; int num;
}; };
#ifdef LOG_NFACILITIES
static struct strmap facilities[] = { static struct strmap facilities[] = {
#ifdef LOG_AUTHPRIV #ifdef LOG_AUTHPRIV
{ "authpriv", LOG_AUTHPRIV }, { "authpriv", LOG_AUTHPRIV },
@@ -73,7 +72,6 @@ static struct strmap facilities[] = {
{ "local7", LOG_LOCAL7 }, { "local7", LOG_LOCAL7 },
{ NULL, -1 } { NULL, -1 }
}; };
#endif /* LOG_NFACILITIES */
static struct strmap priorities[] = { static struct strmap priorities[] = {
{ "alert", LOG_ALERT }, { "alert", LOG_ALERT },
@@ -777,7 +775,6 @@ store_syslogfac(char *val, struct sudo_defs_types *def, int op)
def->sd_un.ival = false; def->sd_un.ival = false;
debug_return_bool(true); debug_return_bool(true);
} }
#ifdef LOG_NFACILITIES
if (!val) if (!val)
debug_return_bool(false); debug_return_bool(false);
for (fac = facilities; fac->name && strcmp(val, fac->name); fac++) for (fac = facilities; fac->name && strcmp(val, fac->name); fac++)
@@ -786,25 +783,18 @@ store_syslogfac(char *val, struct sudo_defs_types *def, int op)
debug_return_bool(false); /* not found */ debug_return_bool(false); /* not found */
def->sd_un.ival = fac->num; def->sd_un.ival = fac->num;
#else
def->sd_un.ival = -1;
#endif /* LOG_NFACILITIES */
debug_return_bool(true); debug_return_bool(true);
} }
static const char * static const char *
logfac2str(int n) logfac2str(int n)
{ {
#ifdef LOG_NFACILITIES
struct strmap *fac; struct strmap *fac;
debug_decl(logfac2str, SUDOERS_DEBUG_DEFAULTS) debug_decl(logfac2str, SUDOERS_DEBUG_DEFAULTS)
for (fac = facilities; fac->name && fac->num != n; fac++) for (fac = facilities; fac->name && fac->num != n; fac++)
; ;
debug_return_const_str(fac->name); debug_return_const_str(fac->name);
#else
return "default";
#endif /* LOG_NFACILITIES */
} }
static bool static bool

View File

@@ -77,37 +77,18 @@ static char *new_logline(const char *, int);
* own nefarious purposes and may call openlog(3) and closelog(3). * own nefarious purposes and may call openlog(3) and closelog(3).
* Note that because we don't want to assume that all systems have * Note that because we don't want to assume that all systems have
* vsyslog(3) (HP-UX doesn't) "%m" will not be expanded. * vsyslog(3) (HP-UX doesn't) "%m" will not be expanded.
* Sadly this is a maze of #ifdefs.
*/ */
static void static void
mysyslog(int pri, const char *fmt, ...) mysyslog(int pri, const char *fmt, ...)
{ {
#ifdef BROKEN_SYSLOG
int i;
#endif
char buf[MAXSYSLOGLEN+1]; char buf[MAXSYSLOGLEN+1];
va_list ap; va_list ap;
debug_decl(mysyslog, SUDOERS_DEBUG_LOGGING) debug_decl(mysyslog, SUDOERS_DEBUG_LOGGING)
va_start(ap, fmt); va_start(ap, fmt);
#ifdef LOG_NFACILITIES
openlog("sudo", 0, def_syslog); openlog("sudo", 0, def_syslog);
#else
openlog("sudo", 0);
#endif
vsnprintf(buf, sizeof(buf), fmt, ap); vsnprintf(buf, sizeof(buf), fmt, ap);
#ifdef BROKEN_SYSLOG
/*
* Some versions of syslog(3) don't guarantee success and return
* an int (notably HP-UX < 10.0). So, if at first we don't succeed,
* try, try again...
*/
for (i = 0; i < MAXSYSLOGTRIES; i++)
if (syslog(pri, "%s", buf) == 0)
break;
#else
syslog(pri, "%s", buf); syslog(pri, "%s", buf);
#endif /* BROKEN_SYSLOG */
va_end(ap); va_end(ap);
closelog(); closelog();
debug_return; debug_return;