summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2002-02-04 12:15:26 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2002-02-04 12:15:26 +0000
commit9f1961736c716aedd500bf6d9fbb0726ccda4d00 (patch)
tree979f9d7d4c52fa9c25cbdebc8ce4a679e7e47efd /usr.bin
parenta7e06873d35476711d3836a821a70609e8a0df7e (diff)
add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/log.c10
-rw-r--r--usr.bin/ssh/log.h8
-rw-r--r--usr.bin/ssh/readconf.c10
-rw-r--r--usr.bin/ssh/servconf.c14
-rw-r--r--usr.bin/ssh/sshd.c8
5 files changed, 27 insertions, 23 deletions
diff --git a/usr.bin/ssh/log.c b/usr.bin/ssh/log.c
index 175330358a1..4b0f7a46eda 100644
--- a/usr.bin/ssh/log.c
+++ b/usr.bin/ssh/log.c
@@ -34,7 +34,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: log.c,v 1.20 2002/01/17 04:27:37 stevesk Exp $");
+RCSID("$OpenBSD: log.c,v 1.21 2002/02/04 12:15:25 markus Exp $");
#include "log.h"
#include "xmalloc.h"
@@ -65,7 +65,7 @@ static struct {
{ "LOCAL5", SYSLOG_FACILITY_LOCAL5 },
{ "LOCAL6", SYSLOG_FACILITY_LOCAL6 },
{ "LOCAL7", SYSLOG_FACILITY_LOCAL7 },
- { NULL, (SyslogFacility)0 }
+ { NULL, SYSLOG_FACILITY_NOT_SET }
};
static struct {
@@ -82,7 +82,7 @@ static struct {
{ "DEBUG1", SYSLOG_LEVEL_DEBUG1 },
{ "DEBUG2", SYSLOG_LEVEL_DEBUG2 },
{ "DEBUG3", SYSLOG_LEVEL_DEBUG3 },
- { NULL, (LogLevel)0 }
+ { NULL, SYSLOG_LEVEL_NOT_SET }
};
static void do_log(LogLevel level, const char *fmt, va_list args);
@@ -95,7 +95,7 @@ log_facility_number(char *name)
for (i = 0; log_facilities[i].name; i++)
if (strcasecmp(log_facilities[i].name, name) == 0)
return log_facilities[i].val;
- return (SyslogFacility) - 1;
+ return SYSLOG_FACILITY_NOT_SET;
}
LogLevel
@@ -106,7 +106,7 @@ log_level_number(char *name)
for (i = 0; log_levels[i].name; i++)
if (strcasecmp(log_levels[i].name, name) == 0)
return log_levels[i].val;
- return (LogLevel) - 1;
+ return SYSLOG_LEVEL_NOT_SET;
}
/* Fatal messages. This function never returns. */
diff --git a/usr.bin/ssh/log.h b/usr.bin/ssh/log.h
index 4493dc4046d..208a6dde1f0 100644
--- a/usr.bin/ssh/log.h
+++ b/usr.bin/ssh/log.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.h,v 1.4 2001/06/26 17:27:24 markus Exp $ */
+/* $OpenBSD: log.h,v 1.5 2002/02/04 12:15:25 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -27,7 +27,8 @@ typedef enum {
SYSLOG_FACILITY_LOCAL4,
SYSLOG_FACILITY_LOCAL5,
SYSLOG_FACILITY_LOCAL6,
- SYSLOG_FACILITY_LOCAL7
+ SYSLOG_FACILITY_LOCAL7,
+ SYSLOG_FACILITY_NOT_SET = -1,
} SyslogFacility;
typedef enum {
@@ -38,7 +39,8 @@ typedef enum {
SYSLOG_LEVEL_VERBOSE,
SYSLOG_LEVEL_DEBUG1,
SYSLOG_LEVEL_DEBUG2,
- SYSLOG_LEVEL_DEBUG3
+ SYSLOG_LEVEL_DEBUG3,
+ SYSLOG_LEVEL_NOT_SET = -1,
} LogLevel;
void log_init(char *, LogLevel, SyslogFacility, int);
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c
index 5d15fd71b1b..45e95d9f604 100644
--- a/usr.bin/ssh/readconf.c
+++ b/usr.bin/ssh/readconf.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.94 2002/01/04 17:59:17 stevesk Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.95 2002/02/04 12:15:25 markus Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -589,10 +589,10 @@ parse_int:
intptr = (int *) &options->log_level;
arg = strdelim(&s);
value = log_level_number(arg);
- if (value == (LogLevel) - 1)
+ if (value == SYSLOG_LEVEL_NOT_SET)
fatal("%.200s line %d: unsupported log level '%s'",
filename, linenum, arg ? arg : "<NONE>");
- if (*activep && (LogLevel) * intptr == -1)
+ if (*activep && (LogLevel) *intptr == SYSLOG_LEVEL_NOT_SET)
*intptr = (LogLevel) value;
break;
@@ -792,7 +792,7 @@ initialize_options(Options * options)
options->num_local_forwards = 0;
options->num_remote_forwards = 0;
options->clear_forwardings = -1;
- options->log_level = (LogLevel) - 1;
+ options->log_level = SYSLOG_LEVEL_NOT_SET;
options->preferred_authentications = NULL;
options->bind_address = NULL;
options->smartcard_device = NULL;
@@ -909,7 +909,7 @@ fill_default_options(Options * options)
options->system_hostfile2 = _PATH_SSH_SYSTEM_HOSTFILE2;
if (options->user_hostfile2 == NULL)
options->user_hostfile2 = _PATH_SSH_USER_HOSTFILE2;
- if (options->log_level == (LogLevel) - 1)
+ if (options->log_level == SYSLOG_LEVEL_NOT_SET)
options->log_level = SYSLOG_LEVEL_INFO;
if (options->clear_forwardings == 1)
clear_forwardings(options);
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c
index 6d3eb171d6f..cf2042e3100 100644
--- a/usr.bin/ssh/servconf.c
+++ b/usr.bin/ssh/servconf.c
@@ -10,7 +10,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: servconf.c,v 1.100 2002/01/29 14:32:03 markus Exp $");
+RCSID("$OpenBSD: servconf.c,v 1.101 2002/02/04 12:15:25 markus Exp $");
#if defined(KRB4) || defined(KRB5)
#include <krb.h>
@@ -62,8 +62,8 @@ initialize_server_options(ServerOptions *options)
options->xauth_location = NULL;
options->strict_modes = -1;
options->keepalives = -1;
- options->log_facility = (SyslogFacility) - 1;
- options->log_level = (LogLevel) - 1;
+ options->log_facility = SYSLOG_FACILITY_NOT_SET;
+ options->log_level = SYSLOG_LEVEL_NOT_SET;
options->rhosts_authentication = -1;
options->rhosts_rsa_authentication = -1;
options->hostbased_authentication = -1;
@@ -158,9 +158,9 @@ fill_default_server_options(ServerOptions *options)
options->strict_modes = 1;
if (options->keepalives == -1)
options->keepalives = 1;
- if (options->log_facility == (SyslogFacility) (-1))
+ if (options->log_facility == SYSLOG_FACILITY_NOT_SET)
options->log_facility = SYSLOG_FACILITY_AUTH;
- if (options->log_level == (LogLevel) (-1))
+ if (options->log_level == SYSLOG_LEVEL_NOT_SET)
options->log_level = SYSLOG_LEVEL_INFO;
if (options->rhosts_authentication == -1)
options->rhosts_authentication = 0;
@@ -674,7 +674,7 @@ parse_flag:
intptr = (int *) &options->log_facility;
arg = strdelim(&cp);
value = log_facility_number(arg);
- if (value == (SyslogFacility) - 1)
+ if (value == SYSLOG_FACILITY_NOT_SET)
fatal("%.200s line %d: unsupported log facility '%s'",
filename, linenum, arg ? arg : "<NONE>");
if (*intptr == -1)
@@ -685,7 +685,7 @@ parse_flag:
intptr = (int *) &options->log_level;
arg = strdelim(&cp);
value = log_level_number(arg);
- if (value == (LogLevel) - 1)
+ if (value == SYSLOG_LEVEL_NOT_SET)
fatal("%.200s line %d: unsupported log level '%s'",
filename, linenum, arg ? arg : "<NONE>");
if (*intptr == -1)
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 4afb27e8e1a..8920715fc65 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.223 2002/01/13 17:57:37 markus Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.224 2002/02/04 12:15:25 markus Exp $");
#include <openssl/dh.h>
#include <openssl/bn.h>
@@ -696,8 +696,10 @@ main(int ac, char **av)
* key (unless started from inetd)
*/
log_init(__progname,
- options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level,
- options.log_facility == -1 ? SYSLOG_FACILITY_AUTH : options.log_facility,
+ options.log_level == SYSLOG_LEVEL_NOT_SET ?
+ SYSLOG_LEVEL_INFO : options.log_level,
+ options.log_facility == SYSLOG_FACILITY_NOT_SET ?
+ SYSLOG_FACILITY_AUTH : options.log_facility,
!inetd_flag);
/* Read server configuration options from the configuration file. */