summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/readconf.c b/readconf.c
index 07f5775d5..7ad5a8e18 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
@@ -135,6 +135,7 @@ typedef enum {
135 oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, 135 oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
136 oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, 136 oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
137 oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, 137 oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
138 oVisualHostKey,
138 oProtocolKeepAlives, oSetupTimeOut, 139 oProtocolKeepAlives, oSetupTimeOut,
139 oDeprecated, oUnsupported 140 oDeprecated, oUnsupported
140} OpCodes; 141} OpCodes;
@@ -237,6 +238,7 @@ static struct {
237 { "tunneldevice", oTunnelDevice }, 238 { "tunneldevice", oTunnelDevice },
238 { "localcommand", oLocalCommand }, 239 { "localcommand", oLocalCommand },
239 { "permitlocalcommand", oPermitLocalCommand }, 240 { "permitlocalcommand", oPermitLocalCommand },
241 { "visualhostkey", oVisualHostKey },
240 { "protocolkeepalives", oProtocolKeepAlives }, 242 { "protocolkeepalives", oProtocolKeepAlives },
241 { "setuptimeout", oSetupTimeOut }, 243 { "setuptimeout", oSetupTimeOut },
242 { NULL, oBadOption } 244 { NULL, oBadOption }
@@ -339,6 +341,7 @@ process_config_line(Options *options, const char *host,
339{ 341{
340 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256]; 342 char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256];
341 int opcode, *intptr, value, value2, scale; 343 int opcode, *intptr, value, value2, scale;
344 LogLevel *log_level_ptr;
342 long long orig, val64; 345 long long orig, val64;
343 size_t len; 346 size_t len;
344 Forward fwd; 347 Forward fwd;
@@ -523,7 +526,6 @@ parse_yesnoask:
523 goto parse_int; 526 goto parse_int;
524 527
525 case oRekeyLimit: 528 case oRekeyLimit:
526 intptr = &options->rekey_limit;
527 arg = strdelim(&s); 529 arg = strdelim(&s);
528 if (!arg || *arg == '\0') 530 if (!arg || *arg == '\0')
529 fatal("%.200s line %d: Missing argument.", filename, linenum); 531 fatal("%.200s line %d: Missing argument.", filename, linenum);
@@ -551,14 +553,14 @@ parse_yesnoask:
551 } 553 }
552 val64 *= scale; 554 val64 *= scale;
553 /* detect integer wrap and too-large limits */ 555 /* detect integer wrap and too-large limits */
554 if ((val64 / scale) != orig || val64 > INT_MAX) 556 if ((val64 / scale) != orig || val64 > UINT_MAX)
555 fatal("%.200s line %d: RekeyLimit too large", 557 fatal("%.200s line %d: RekeyLimit too large",
556 filename, linenum); 558 filename, linenum);
557 if (val64 < 16) 559 if (val64 < 16)
558 fatal("%.200s line %d: RekeyLimit too small", 560 fatal("%.200s line %d: RekeyLimit too small",
559 filename, linenum); 561 filename, linenum);
560 if (*activep && *intptr == -1) 562 if (*activep && options->rekey_limit == -1)
561 *intptr = (int)val64; 563 options->rekey_limit = (u_int32_t)val64;
562 break; 564 break;
563 565
564 case oIdentityFile: 566 case oIdentityFile:
@@ -717,14 +719,14 @@ parse_int:
717 break; 719 break;
718 720
719 case oLogLevel: 721 case oLogLevel:
720 intptr = (int *) &options->log_level; 722 log_level_ptr = &options->log_level;
721 arg = strdelim(&s); 723 arg = strdelim(&s);
722 value = log_level_number(arg); 724 value = log_level_number(arg);
723 if (value == SYSLOG_LEVEL_NOT_SET) 725 if (value == SYSLOG_LEVEL_NOT_SET)
724 fatal("%.200s line %d: unsupported log level '%s'", 726 fatal("%.200s line %d: unsupported log level '%s'",
725 filename, linenum, arg ? arg : "<NONE>"); 727 filename, linenum, arg ? arg : "<NONE>");
726 if (*activep && (LogLevel) *intptr == SYSLOG_LEVEL_NOT_SET) 728 if (*activep && *log_level_ptr == SYSLOG_LEVEL_NOT_SET)
727 *intptr = (LogLevel) value; 729 *log_level_ptr = (LogLevel) value;
728 break; 730 break;
729 731
730 case oLocalForward: 732 case oLocalForward:
@@ -844,6 +846,7 @@ parse_int:
844 846
845 case oServerAliveInterval: 847 case oServerAliveInterval:
846 case oProtocolKeepAlives: /* Debian-specific compatibility alias */ 848 case oProtocolKeepAlives: /* Debian-specific compatibility alias */
849 case oSetupTimeOut: /* Debian-specific compatibility alias */
847 intptr = &options->server_alive_interval; 850 intptr = &options->server_alive_interval;
848 goto parse_time; 851 goto parse_time;
849 852
@@ -941,9 +944,9 @@ parse_int:
941 intptr = &options->permit_local_command; 944 intptr = &options->permit_local_command;
942 goto parse_flag; 945 goto parse_flag;
943 946
944 case oSetupTimeOut: 947 case oVisualHostKey:
945 intptr = &options->setuptimeout; 948 intptr = &options->visual_host_key;
946 goto parse_int; 949 goto parse_flag;
947 950
948 case oDeprecated: 951 case oDeprecated:
949 debug("%s line %d: Deprecated option \"%s\"", 952 debug("%s line %d: Deprecated option \"%s\"",
@@ -1073,7 +1076,6 @@ initialize_options(Options * options)
1073 options->strict_host_key_checking = -1; 1076 options->strict_host_key_checking = -1;
1074 options->compression = -1; 1077 options->compression = -1;
1075 options->tcp_keep_alive = -1; 1078 options->tcp_keep_alive = -1;
1076 options->setuptimeout = -1;
1077 options->compression_level = -1; 1079 options->compression_level = -1;
1078 options->port = -1; 1080 options->port = -1;
1079 options->address_family = -1; 1081 options->address_family = -1;
@@ -1118,6 +1120,7 @@ initialize_options(Options * options)
1118 options->tun_remote = -1; 1120 options->tun_remote = -1;
1119 options->local_command = NULL; 1121 options->local_command = NULL;
1120 options->permit_local_command = -1; 1122 options->permit_local_command = -1;
1123 options->visual_host_key = -1;
1121} 1124}
1122 1125
1123/* 1126/*
@@ -1263,13 +1266,8 @@ fill_default_options(Options * options)
1263 options->tun_remote = SSH_TUNID_ANY; 1266 options->tun_remote = SSH_TUNID_ANY;
1264 if (options->permit_local_command == -1) 1267 if (options->permit_local_command == -1)
1265 options->permit_local_command = 0; 1268 options->permit_local_command = 0;
1266 if (options->setuptimeout == -1) { 1269 if (options->visual_host_key == -1)
1267 /* in batch mode, default is 5mins */ 1270 options->visual_host_key = 0;
1268 if (options->batch_mode == 1)
1269 options->setuptimeout = 300;
1270 else
1271 options->setuptimeout = 0;
1272 }
1273 /* options->local_command should not be set by default */ 1271 /* options->local_command should not be set by default */
1274 /* options->proxy_command should not be set by default */ 1272 /* options->proxy_command should not be set by default */
1275 /* options->user will be set in the main program if appropriate */ 1273 /* options->user will be set in the main program if appropriate */
@@ -1326,7 +1324,7 @@ parse_forward(Forward *fwd, const char *fwdspec)
1326 1324
1327 xfree(p); 1325 xfree(p);
1328 1326
1329 if (fwd->listen_port == 0 && fwd->connect_port == 0) 1327 if (fwd->listen_port == 0 || fwd->connect_port == 0)
1330 goto fail_free; 1328 goto fail_free;
1331 1329
1332 if (fwd->connect_host != NULL && 1330 if (fwd->connect_host != NULL &&