summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/readconf.c b/readconf.c
index 3f82345f6..3aedd6f5a 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.162 2007/03/20 03:56:12 tedu Exp $ */ 1/* $OpenBSD: readconf.c,v 1.167 2008/06/26 11:46:31 grunk 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
@@ -132,6 +132,7 @@ typedef enum {
132 oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, 132 oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
133 oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, 133 oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
134 oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, 134 oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
135 oVisualHostKey,
135 oDeprecated, oUnsupported 136 oDeprecated, oUnsupported
136} OpCodes; 137} OpCodes;
137 138
@@ -232,6 +233,7 @@ static struct {
232 { "tunneldevice", oTunnelDevice }, 233 { "tunneldevice", oTunnelDevice },
233 { "localcommand", oLocalCommand }, 234 { "localcommand", oLocalCommand },
234 { "permitlocalcommand", oPermitLocalCommand }, 235 { "permitlocalcommand", oPermitLocalCommand },
236 { "visualhostkey", oVisualHostKey },
235 { NULL, oBadOption } 237 { NULL, oBadOption }
236}; 238};
237 239
@@ -332,6 +334,7 @@ process_config_line(Options *options, const char *host,
332{ 334{
333 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256]; 335 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256];
334 int opcode, *intptr, value, value2, scale; 336 int opcode, *intptr, value, value2, scale;
337 LogLevel *log_level_ptr;
335 long long orig, val64; 338 long long orig, val64;
336 size_t len; 339 size_t len;
337 Forward fwd; 340 Forward fwd;
@@ -512,7 +515,6 @@ parse_yesnoask:
512 goto parse_int; 515 goto parse_int;
513 516
514 case oRekeyLimit: 517 case oRekeyLimit:
515 intptr = &options->rekey_limit;
516 arg = strdelim(&s); 518 arg = strdelim(&s);
517 if (!arg || *arg == '\0') 519 if (!arg || *arg == '\0')
518 fatal("%.200s line %d: Missing argument.", filename, linenum); 520 fatal("%.200s line %d: Missing argument.", filename, linenum);
@@ -540,14 +542,14 @@ parse_yesnoask:
540 } 542 }
541 val64 *= scale; 543 val64 *= scale;
542 /* detect integer wrap and too-large limits */ 544 /* detect integer wrap and too-large limits */
543 if ((val64 / scale) != orig || val64 > INT_MAX) 545 if ((val64 / scale) != orig || val64 > UINT_MAX)
544 fatal("%.200s line %d: RekeyLimit too large", 546 fatal("%.200s line %d: RekeyLimit too large",
545 filename, linenum); 547 filename, linenum);
546 if (val64 < 16) 548 if (val64 < 16)
547 fatal("%.200s line %d: RekeyLimit too small", 549 fatal("%.200s line %d: RekeyLimit too small",
548 filename, linenum); 550 filename, linenum);
549 if (*activep && *intptr == -1) 551 if (*activep && options->rekey_limit == -1)
550 *intptr = (int)val64; 552 options->rekey_limit = (u_int32_t)val64;
551 break; 553 break;
552 554
553 case oIdentityFile: 555 case oIdentityFile:
@@ -706,14 +708,14 @@ parse_int:
706 break; 708 break;
707 709
708 case oLogLevel: 710 case oLogLevel:
709 intptr = (int *) &options->log_level; 711 log_level_ptr = &options->log_level;
710 arg = strdelim(&s); 712 arg = strdelim(&s);
711 value = log_level_number(arg); 713 value = log_level_number(arg);
712 if (value == SYSLOG_LEVEL_NOT_SET) 714 if (value == SYSLOG_LEVEL_NOT_SET)
713 fatal("%.200s line %d: unsupported log level '%s'", 715 fatal("%.200s line %d: unsupported log level '%s'",
714 filename, linenum, arg ? arg : "<NONE>"); 716 filename, linenum, arg ? arg : "<NONE>");
715 if (*activep && (LogLevel) *intptr == SYSLOG_LEVEL_NOT_SET) 717 if (*activep && *log_level_ptr == SYSLOG_LEVEL_NOT_SET)
716 *intptr = (LogLevel) value; 718 *log_level_ptr = (LogLevel) value;
717 break; 719 break;
718 720
719 case oLocalForward: 721 case oLocalForward:
@@ -929,6 +931,10 @@ parse_int:
929 intptr = &options->permit_local_command; 931 intptr = &options->permit_local_command;
930 goto parse_flag; 932 goto parse_flag;
931 933
934 case oVisualHostKey:
935 intptr = &options->visual_host_key;
936 goto parse_flag;
937
932 case oDeprecated: 938 case oDeprecated:
933 debug("%s line %d: Deprecated option \"%s\"", 939 debug("%s line %d: Deprecated option \"%s\"",
934 filename, linenum, keyword); 940 filename, linenum, keyword);
@@ -1081,6 +1087,7 @@ initialize_options(Options * options)
1081 options->tun_remote = -1; 1087 options->tun_remote = -1;
1082 options->local_command = NULL; 1088 options->local_command = NULL;
1083 options->permit_local_command = -1; 1089 options->permit_local_command = -1;
1090 options->visual_host_key = -1;
1084} 1091}
1085 1092
1086/* 1093/*
@@ -1219,6 +1226,8 @@ fill_default_options(Options * options)
1219 options->tun_remote = SSH_TUNID_ANY; 1226 options->tun_remote = SSH_TUNID_ANY;
1220 if (options->permit_local_command == -1) 1227 if (options->permit_local_command == -1)
1221 options->permit_local_command = 0; 1228 options->permit_local_command = 0;
1229 if (options->visual_host_key == -1)
1230 options->visual_host_key = 0;
1222 /* options->local_command should not be set by default */ 1231 /* options->local_command should not be set by default */
1223 /* options->proxy_command should not be set by default */ 1232 /* options->proxy_command should not be set by default */
1224 /* options->user will be set in the main program if appropriate */ 1233 /* options->user will be set in the main program if appropriate */
@@ -1275,7 +1284,7 @@ parse_forward(Forward *fwd, const char *fwdspec)
1275 1284
1276 xfree(p); 1285 xfree(p);
1277 1286
1278 if (fwd->listen_port == 0 && fwd->connect_port == 0) 1287 if (fwd->listen_port == 0 || fwd->connect_port == 0)
1279 goto fail_free; 1288 goto fail_free;
1280 1289
1281 if (fwd->connect_host != NULL && 1290 if (fwd->connect_host != NULL &&