summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-05 12:26:34 +1100
committerDamien Miller <djm@mindrot.org>2002-02-05 12:26:34 +1100
commitfcd9320440c7eb2758659ec2ac19b99054e43044 (patch)
treebb61ee56c4a5311027d9ac7e593a5f957267ab2f
parent9b74bfc5be938d1bf5012c997c463b621c4fbffd (diff)
- markus@cvs.openbsd.org 2002/02/04 12:15:25
[log.c log.h readconf.c servconf.c] add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1, fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@
-rw-r--r--ChangeLog6
-rw-r--r--log.c10
-rw-r--r--log.h8
-rw-r--r--readconf.c10
-rw-r--r--servconf.c14
5 files changed, 27 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f39d6ed6..d36ec3268 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -85,6 +85,10 @@
85 [auth2.c] 85 [auth2.c]
86 cross checking of announced vs actual pktype in pubkey/hostbaed auth; 86 cross checking of announced vs actual pktype in pubkey/hostbaed auth;
87 ok stevesk@ 87 ok stevesk@
88 - markus@cvs.openbsd.org 2002/02/04 12:15:25
89 [log.c log.h readconf.c servconf.c]
90 add SYSLOG_FACILITY_NOT_SET = -1, SYSLOG_LEVEL_NOT_SET = -1,
91 fixes arm/netbsd; based on patch from bjh21@netbsd.org; ok djm@
88 92
8920020130 9320020130
90 - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@ 94 - (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
@@ -7487,4 +7491,4 @@
7487 - Wrote replacements for strlcpy and mkdtemp 7491 - Wrote replacements for strlcpy and mkdtemp
7488 - Released 1.0pre1 7492 - Released 1.0pre1
7489 7493
7490$Id: ChangeLog,v 1.1822 2002/02/05 01:26:03 djm Exp $ 7494$Id: ChangeLog,v 1.1823 2002/02/05 01:26:34 djm Exp $
diff --git a/log.c b/log.c
index d1d13dd53..5b25b5929 100644
--- a/log.c
+++ b/log.c
@@ -34,7 +34,7 @@
34 */ 34 */
35 35
36#include "includes.h" 36#include "includes.h"
37RCSID("$OpenBSD: log.c,v 1.20 2002/01/17 04:27:37 stevesk Exp $"); 37RCSID("$OpenBSD: log.c,v 1.21 2002/02/04 12:15:25 markus Exp $");
38 38
39#include "log.h" 39#include "log.h"
40#include "xmalloc.h" 40#include "xmalloc.h"
@@ -68,7 +68,7 @@ static struct {
68 { "LOCAL5", SYSLOG_FACILITY_LOCAL5 }, 68 { "LOCAL5", SYSLOG_FACILITY_LOCAL5 },
69 { "LOCAL6", SYSLOG_FACILITY_LOCAL6 }, 69 { "LOCAL6", SYSLOG_FACILITY_LOCAL6 },
70 { "LOCAL7", SYSLOG_FACILITY_LOCAL7 }, 70 { "LOCAL7", SYSLOG_FACILITY_LOCAL7 },
71 { NULL, (SyslogFacility)0 } 71 { NULL, SYSLOG_FACILITY_NOT_SET }
72}; 72};
73 73
74static struct { 74static struct {
@@ -85,7 +85,7 @@ static struct {
85 { "DEBUG1", SYSLOG_LEVEL_DEBUG1 }, 85 { "DEBUG1", SYSLOG_LEVEL_DEBUG1 },
86 { "DEBUG2", SYSLOG_LEVEL_DEBUG2 }, 86 { "DEBUG2", SYSLOG_LEVEL_DEBUG2 },
87 { "DEBUG3", SYSLOG_LEVEL_DEBUG3 }, 87 { "DEBUG3", SYSLOG_LEVEL_DEBUG3 },
88 { NULL, (LogLevel)0 } 88 { NULL, SYSLOG_LEVEL_NOT_SET }
89}; 89};
90 90
91static void do_log(LogLevel level, const char *fmt, va_list args); 91static void do_log(LogLevel level, const char *fmt, va_list args);
@@ -98,7 +98,7 @@ log_facility_number(char *name)
98 for (i = 0; log_facilities[i].name; i++) 98 for (i = 0; log_facilities[i].name; i++)
99 if (strcasecmp(log_facilities[i].name, name) == 0) 99 if (strcasecmp(log_facilities[i].name, name) == 0)
100 return log_facilities[i].val; 100 return log_facilities[i].val;
101 return (SyslogFacility) - 1; 101 return SYSLOG_FACILITY_NOT_SET;
102} 102}
103 103
104LogLevel 104LogLevel
@@ -109,7 +109,7 @@ log_level_number(char *name)
109 for (i = 0; log_levels[i].name; i++) 109 for (i = 0; log_levels[i].name; i++)
110 if (strcasecmp(log_levels[i].name, name) == 0) 110 if (strcasecmp(log_levels[i].name, name) == 0)
111 return log_levels[i].val; 111 return log_levels[i].val;
112 return (LogLevel) - 1; 112 return SYSLOG_LEVEL_NOT_SET;
113} 113}
114/* Fatal messages. This function never returns. */ 114/* Fatal messages. This function never returns. */
115 115
diff --git a/log.h b/log.h
index 23451f74f..8ab5c0939 100644
--- a/log.h
+++ b/log.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: log.h,v 1.4 2001/06/26 17:27:24 markus Exp $ */ 1/* $OpenBSD: log.h,v 1.5 2002/02/04 12:15:25 markus Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -32,7 +32,8 @@ typedef enum {
32 SYSLOG_FACILITY_LOCAL4, 32 SYSLOG_FACILITY_LOCAL4,
33 SYSLOG_FACILITY_LOCAL5, 33 SYSLOG_FACILITY_LOCAL5,
34 SYSLOG_FACILITY_LOCAL6, 34 SYSLOG_FACILITY_LOCAL6,
35 SYSLOG_FACILITY_LOCAL7 35 SYSLOG_FACILITY_LOCAL7,
36 SYSLOG_FACILITY_NOT_SET = -1,
36} SyslogFacility; 37} SyslogFacility;
37 38
38typedef enum { 39typedef enum {
@@ -43,7 +44,8 @@ typedef enum {
43 SYSLOG_LEVEL_VERBOSE, 44 SYSLOG_LEVEL_VERBOSE,
44 SYSLOG_LEVEL_DEBUG1, 45 SYSLOG_LEVEL_DEBUG1,
45 SYSLOG_LEVEL_DEBUG2, 46 SYSLOG_LEVEL_DEBUG2,
46 SYSLOG_LEVEL_DEBUG3 47 SYSLOG_LEVEL_DEBUG3,
48 SYSLOG_LEVEL_NOT_SET = -1,
47} LogLevel; 49} LogLevel;
48 50
49void log_init(char *, LogLevel, SyslogFacility, int); 51void log_init(char *, LogLevel, SyslogFacility, int);
diff --git a/readconf.c b/readconf.c
index 650a11994..7920ac86d 100644
--- a/readconf.c
+++ b/readconf.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: readconf.c,v 1.94 2002/01/04 17:59:17 stevesk Exp $"); 15RCSID("$OpenBSD: readconf.c,v 1.95 2002/02/04 12:15:25 markus Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -591,10 +591,10 @@ parse_int:
591 intptr = (int *) &options->log_level; 591 intptr = (int *) &options->log_level;
592 arg = strdelim(&s); 592 arg = strdelim(&s);
593 value = log_level_number(arg); 593 value = log_level_number(arg);
594 if (value == (LogLevel) - 1) 594 if (value == SYSLOG_LEVEL_NOT_SET)
595 fatal("%.200s line %d: unsupported log level '%s'", 595 fatal("%.200s line %d: unsupported log level '%s'",
596 filename, linenum, arg ? arg : "<NONE>"); 596 filename, linenum, arg ? arg : "<NONE>");
597 if (*activep && (LogLevel) * intptr == -1) 597 if (*activep && (LogLevel) *intptr == SYSLOG_LEVEL_NOT_SET)
598 *intptr = (LogLevel) value; 598 *intptr = (LogLevel) value;
599 break; 599 break;
600 600
@@ -794,7 +794,7 @@ initialize_options(Options * options)
794 options->num_local_forwards = 0; 794 options->num_local_forwards = 0;
795 options->num_remote_forwards = 0; 795 options->num_remote_forwards = 0;
796 options->clear_forwardings = -1; 796 options->clear_forwardings = -1;
797 options->log_level = (LogLevel) - 1; 797 options->log_level = SYSLOG_LEVEL_NOT_SET;
798 options->preferred_authentications = NULL; 798 options->preferred_authentications = NULL;
799 options->bind_address = NULL; 799 options->bind_address = NULL;
800 options->smartcard_device = NULL; 800 options->smartcard_device = NULL;
@@ -911,7 +911,7 @@ fill_default_options(Options * options)
911 options->system_hostfile2 = _PATH_SSH_SYSTEM_HOSTFILE2; 911 options->system_hostfile2 = _PATH_SSH_SYSTEM_HOSTFILE2;
912 if (options->user_hostfile2 == NULL) 912 if (options->user_hostfile2 == NULL)
913 options->user_hostfile2 = _PATH_SSH_USER_HOSTFILE2; 913 options->user_hostfile2 = _PATH_SSH_USER_HOSTFILE2;
914 if (options->log_level == (LogLevel) - 1) 914 if (options->log_level == SYSLOG_LEVEL_NOT_SET)
915 options->log_level = SYSLOG_LEVEL_INFO; 915 options->log_level = SYSLOG_LEVEL_INFO;
916 if (options->clear_forwardings == 1) 916 if (options->clear_forwardings == 1)
917 clear_forwardings(options); 917 clear_forwardings(options);
diff --git a/servconf.c b/servconf.c
index 8273df54c..9bbd994ca 100644
--- a/servconf.c
+++ b/servconf.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: servconf.c,v 1.100 2002/01/29 14:32:03 markus Exp $"); 13RCSID("$OpenBSD: servconf.c,v 1.101 2002/02/04 12:15:25 markus Exp $");
14 14
15#if defined(KRB4) || defined(KRB5) 15#if defined(KRB4) || defined(KRB5)
16#include <krb.h> 16#include <krb.h>
@@ -67,8 +67,8 @@ initialize_server_options(ServerOptions *options)
67 options->xauth_location = NULL; 67 options->xauth_location = NULL;
68 options->strict_modes = -1; 68 options->strict_modes = -1;
69 options->keepalives = -1; 69 options->keepalives = -1;
70 options->log_facility = (SyslogFacility) - 1; 70 options->log_facility = SYSLOG_FACILITY_NOT_SET;
71 options->log_level = (LogLevel) - 1; 71 options->log_level = SYSLOG_LEVEL_NOT_SET;
72 options->rhosts_authentication = -1; 72 options->rhosts_authentication = -1;
73 options->rhosts_rsa_authentication = -1; 73 options->rhosts_rsa_authentication = -1;
74 options->hostbased_authentication = -1; 74 options->hostbased_authentication = -1;
@@ -168,9 +168,9 @@ fill_default_server_options(ServerOptions *options)
168 options->strict_modes = 1; 168 options->strict_modes = 1;
169 if (options->keepalives == -1) 169 if (options->keepalives == -1)
170 options->keepalives = 1; 170 options->keepalives = 1;
171 if (options->log_facility == (SyslogFacility) (-1)) 171 if (options->log_facility == SYSLOG_FACILITY_NOT_SET)
172 options->log_facility = SYSLOG_FACILITY_AUTH; 172 options->log_facility = SYSLOG_FACILITY_AUTH;
173 if (options->log_level == (LogLevel) (-1)) 173 if (options->log_level == SYSLOG_LEVEL_NOT_SET)
174 options->log_level = SYSLOG_LEVEL_INFO; 174 options->log_level = SYSLOG_LEVEL_INFO;
175 if (options->rhosts_authentication == -1) 175 if (options->rhosts_authentication == -1)
176 options->rhosts_authentication = 0; 176 options->rhosts_authentication = 0;
@@ -696,7 +696,7 @@ parse_flag:
696 intptr = (int *) &options->log_facility; 696 intptr = (int *) &options->log_facility;
697 arg = strdelim(&cp); 697 arg = strdelim(&cp);
698 value = log_facility_number(arg); 698 value = log_facility_number(arg);
699 if (value == (SyslogFacility) - 1) 699 if (value == SYSLOG_FACILITY_NOT_SET)
700 fatal("%.200s line %d: unsupported log facility '%s'", 700 fatal("%.200s line %d: unsupported log facility '%s'",
701 filename, linenum, arg ? arg : "<NONE>"); 701 filename, linenum, arg ? arg : "<NONE>");
702 if (*intptr == -1) 702 if (*intptr == -1)
@@ -707,7 +707,7 @@ parse_flag:
707 intptr = (int *) &options->log_level; 707 intptr = (int *) &options->log_level;
708 arg = strdelim(&cp); 708 arg = strdelim(&cp);
709 value = log_level_number(arg); 709 value = log_level_number(arg);
710 if (value == (LogLevel) - 1) 710 if (value == SYSLOG_LEVEL_NOT_SET)
711 fatal("%.200s line %d: unsupported log level '%s'", 711 fatal("%.200s line %d: unsupported log level '%s'",
712 filename, linenum, arg ? arg : "<NONE>"); 712 filename, linenum, arg ? arg : "<NONE>");
713 if (*intptr == -1) 713 if (*intptr == -1)