summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-11-21 13:23:52 +1100
committerDamien Miller <djm@mindrot.org>1999-11-21 13:23:52 +1100
commit6162d1215bbff30cf0c4c19368dc85ae570d44ca (patch)
treef82956b4429cad04a2296a1ede65e147bafb92f4 /readconf.c
parentf58db38f8d396ee5ea42975d9409a644e01cede8 (diff)
- OpenBSD CVS Changes
- [channels.c] make this compile, bad markus - [log.c readconf.c servconf.c ssh.h] bugfix: loglevels are per host in clientconfig, factor out common log-level parsing code. - [servconf.c] remove unused index (-Wall) - [ssh-agent.c] only one 'extern char *__progname' - [sshd.8] document SIGHUP, -Q to synopsis - [sshconnect.c serverloop.c sshd.c packet.c packet.h] [channels.c clientloop.c] SSH_CMSG_MAX_PACKET_SIZE, some clients use this, some need this, niels@ [hope this time my ISP stays alive during commit]
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c48
1 files changed, 11 insertions, 37 deletions
diff --git a/readconf.c b/readconf.c
index b341322c8..d8694b82d 100644
--- a/readconf.c
+++ b/readconf.c
@@ -14,7 +14,7 @@ Functions for reading the configuration files.
14*/ 14*/
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$Id: readconf.c,v 1.3 1999/11/15 04:25:10 damien Exp $"); 17RCSID("$Id: readconf.c,v 1.4 1999/11/21 02:23:53 damien Exp $");
18 18
19#include "ssh.h" 19#include "ssh.h"
20#include "cipher.h" 20#include "cipher.h"
@@ -155,23 +155,6 @@ static struct
155 { NULL, 0 } 155 { NULL, 0 }
156}; 156};
157 157
158/* textual representation of log-levels */
159
160static struct
161{
162 const char *name;
163 LogLevel level;
164} log_levels[] =
165{
166 { "QUIET", SYSLOG_LEVEL_QUIET },
167 { "FATAL", SYSLOG_LEVEL_FATAL },
168 { "ERROR", SYSLOG_LEVEL_ERROR },
169 { "INFO", SYSLOG_LEVEL_INFO },
170 { "CHAT", SYSLOG_LEVEL_CHAT },
171 { "DEBUG", SYSLOG_LEVEL_DEBUG },
172 { NULL, 0 }
173};
174
175/* Characters considered whitespace in strtok calls. */ 158/* Characters considered whitespace in strtok calls. */
176#define WHITESPACE " \t\r\n" 159#define WHITESPACE " \t\r\n"
177 160
@@ -237,7 +220,7 @@ process_config_line(Options *options, const char *host,
237 int *activep) 220 int *activep)
238{ 221{
239 char buf[256], *cp, *string, **charptr; 222 char buf[256], *cp, *string, **charptr;
240 int opcode, *intptr, value, fwd_port, fwd_host_port, i; 223 int opcode, *intptr, value, fwd_port, fwd_host_port;
241 224
242 /* Skip leading whitespace. */ 225 /* Skip leading whitespace. */
243 cp = line + strspn(line, WHITESPACE); 226 cp = line + strspn(line, WHITESPACE);
@@ -462,30 +445,21 @@ process_config_line(Options *options, const char *host,
462 cp = strtok(NULL, WHITESPACE); 445 cp = strtok(NULL, WHITESPACE);
463 value = cipher_number(cp); 446 value = cipher_number(cp);
464 if (value == -1) 447 if (value == -1)
465 fatal("%.200s line %d: Bad cipher.", filename, linenum); 448 fatal("%.200s line %d: Bad cipher '%s'.",
449 filename, linenum, cp ? cp : "<NONE>");
466 if (*activep && *intptr == -1) 450 if (*activep && *intptr == -1)
467 *intptr = value; 451 *intptr = value;
468 break; 452 break;
469 453
470 case oLogLevel: 454 case oLogLevel:
455 intptr = (int *)&options->log_level;
471 cp = strtok(NULL, WHITESPACE); 456 cp = strtok(NULL, WHITESPACE);
472 if (!cp) 457 value = log_level_number(cp);
473 { 458 if (value == (LogLevel)-1)
474 fprintf(stderr, "%s line %d: missing level name.\n", 459 fatal("%.200s line %d: unsupported log level '%s'\n",
475 filename, linenum); 460 filename, linenum, cp ? cp : "<NONE>");
476 exit(1); 461 if (*activep && (LogLevel)*intptr == -1)
477 } 462 *intptr = (LogLevel)value;
478 for (i = 0; log_levels[i].name; i++)
479 if (strcasecmp(log_levels[i].name, cp) == 0)
480 break;
481 if (!log_levels[i].name)
482 {
483 fprintf(stderr, "%s line %d: unsupported log level %s\n",
484 filename, linenum, cp);
485 exit(1);
486 }
487 if (options->log_level == (LogLevel)(-1))
488 options->log_level = log_levels[i].level;
489 break; 463 break;
490 464
491 case oRemoteForward: 465 case oRemoteForward: