summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/readconf.c b/readconf.c
index d8898a029..51b23a3b8 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.198 2013/05/16 02:00:34 dtucker Exp $ */ 1/* $OpenBSD: readconf.c,v 1.199 2013/05/16 04:27:50 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -134,8 +134,8 @@ typedef enum {
134 oHashKnownHosts, 134 oHashKnownHosts,
135 oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, 135 oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
136 oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication, 136 oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication,
137 oKexAlgorithms, oIPQoS, oRequestTTY, 137 oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown,
138 oDeprecated, oUnsupported 138 oIgnoredUnknownOption, oDeprecated, oUnsupported
139} OpCodes; 139} OpCodes;
140 140
141/* Textual representations of the tokens. */ 141/* Textual representations of the tokens. */
@@ -246,6 +246,7 @@ static struct {
246 { "kexalgorithms", oKexAlgorithms }, 246 { "kexalgorithms", oKexAlgorithms },
247 { "ipqos", oIPQoS }, 247 { "ipqos", oIPQoS },
248 { "requesttty", oRequestTTY }, 248 { "requesttty", oRequestTTY },
249 { "ignoreunknown", oIgnoreUnknown },
249 250
250 { NULL, oBadOption } 251 { NULL, oBadOption }
251}; 252};
@@ -351,14 +352,17 @@ add_identity_file(Options *options, const char *dir, const char *filename,
351 */ 352 */
352 353
353static OpCodes 354static OpCodes
354parse_token(const char *cp, const char *filename, int linenum) 355parse_token(const char *cp, const char *filename, int linenum,
356 const char *ignored_unknown)
355{ 357{
356 u_int i; 358 int i;
357 359
358 for (i = 0; keywords[i].name; i++) 360 for (i = 0; keywords[i].name; i++)
359 if (strcasecmp(cp, keywords[i].name) == 0) 361 if (strcmp(cp, keywords[i].name) == 0)
360 return keywords[i].opcode; 362 return keywords[i].opcode;
361 363 if (ignored_unknown != NULL && match_pattern_list(cp, ignored_unknown,
364 strlen(ignored_unknown), 1) == 1)
365 return oIgnoredUnknownOption;
362 error("%s: line %d: Bad configuration option: %s", 366 error("%s: line %d: Bad configuration option: %s",
363 filename, linenum, cp); 367 filename, linenum, cp);
364 return oBadOption; 368 return oBadOption;
@@ -377,7 +381,7 @@ process_config_line(Options *options, const char *host,
377{ 381{
378 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2; 382 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2;
379 char **cpptr, fwdarg[256]; 383 char **cpptr, fwdarg[256];
380 u_int *uintptr, max_entries = 0; 384 u_int i, *uintptr, max_entries = 0;
381 int negated, opcode, *intptr, value, value2, scale; 385 int negated, opcode, *intptr, value, value2, scale;
382 LogLevel *log_level_ptr; 386 LogLevel *log_level_ptr;
383 long long orig, val64; 387 long long orig, val64;
@@ -400,14 +404,22 @@ process_config_line(Options *options, const char *host,
400 keyword = strdelim(&s); 404 keyword = strdelim(&s);
401 if (keyword == NULL || !*keyword || *keyword == '\n' || *keyword == '#') 405 if (keyword == NULL || !*keyword || *keyword == '\n' || *keyword == '#')
402 return 0; 406 return 0;
407 /* Match lowercase keyword */
408 for (i = 0; i < strlen(keyword); i++)
409 keyword[i] = tolower(keyword[i]);
403 410
404 opcode = parse_token(keyword, filename, linenum); 411 opcode = parse_token(keyword, filename, linenum,
412 options->ignored_unknown);
405 413
406 switch (opcode) { 414 switch (opcode) {
407 case oBadOption: 415 case oBadOption:
408 /* don't panic, but count bad options */ 416 /* don't panic, but count bad options */
409 return -1; 417 return -1;
410 /* NOTREACHED */ 418 /* NOTREACHED */
419 case oIgnoredUnknownOption:
420 debug("%s line %d: Ignored unknown option \"%s\"",
421 filename, linenum, keyword);
422 return 0;
411 case oConnectTimeout: 423 case oConnectTimeout:
412 intptr = &options->connection_timeout; 424 intptr = &options->connection_timeout;
413parse_time: 425parse_time:
@@ -1077,6 +1089,10 @@ parse_int:
1077 *intptr = value; 1089 *intptr = value;
1078 break; 1090 break;
1079 1091
1092 case oIgnoreUnknown:
1093 charptr = &options->ignored_unknown;
1094 goto parse_string;
1095
1080 case oDeprecated: 1096 case oDeprecated:
1081 debug("%s line %d: Deprecated option \"%s\"", 1097 debug("%s line %d: Deprecated option \"%s\"",
1082 filename, linenum, keyword); 1098 filename, linenum, keyword);
@@ -1238,6 +1254,7 @@ initialize_options(Options * options)
1238 options->ip_qos_interactive = -1; 1254 options->ip_qos_interactive = -1;
1239 options->ip_qos_bulk = -1; 1255 options->ip_qos_bulk = -1;
1240 options->request_tty = -1; 1256 options->request_tty = -1;
1257 options->ignored_unknown = NULL;
1241} 1258}
1242 1259
1243/* 1260/*