diff options
author | Colin Watson <cjwatson@debian.org> | 2004-03-01 02:25:32 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2004-03-01 02:25:32 +0000 |
commit | ea8116a11e3de70036dbc665ccb0d486cf89cac9 (patch) | |
tree | d73ccdff78d8608e156465af42e6a1b3527fb2d6 /readconf.c | |
parent | e39b311381a5609cc05acf298c42fba196dc524b (diff) | |
parent | f5bda272678ec6dccaa5f29379cf60cb855018e8 (diff) |
Merge 3.8p1 to the trunk. This builds and runs, but I haven't tested it
extensively yet.
ProtocolKeepAlives is now just a compatibility alias for
ServerAliveInterval.
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 93 |
1 files changed, 57 insertions, 36 deletions
diff --git a/readconf.c b/readconf.c index 0a1788ba0..3af3038bb 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: readconf.c,v 1.121 2003/09/01 18:15:50 markus Exp $"); | 15 | RCSID("$OpenBSD: readconf.c,v 1.127 2003/12/16 15:49:51 markus Exp $"); |
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "xmalloc.h" | 18 | #include "xmalloc.h" |
@@ -78,9 +78,7 @@ RCSID("$OpenBSD: readconf.c,v 1.121 2003/09/01 18:15:50 markus Exp $"); | |||
78 | RSAAuthentication yes | 78 | RSAAuthentication yes |
79 | RhostsRSAAuthentication yes | 79 | RhostsRSAAuthentication yes |
80 | StrictHostKeyChecking yes | 80 | StrictHostKeyChecking yes |
81 | KeepAlives no | 81 | TcpKeepAlive no |
82 | ProtocolKeepAlives 0 | ||
83 | SetupTimeOut 0 | ||
84 | IdentityFile ~/.ssh/identity | 82 | IdentityFile ~/.ssh/identity |
85 | Port 22 | 83 | Port 22 |
86 | EscapeChar ~ | 84 | EscapeChar ~ |
@@ -91,14 +89,14 @@ RCSID("$OpenBSD: readconf.c,v 1.121 2003/09/01 18:15:50 markus Exp $"); | |||
91 | 89 | ||
92 | typedef enum { | 90 | typedef enum { |
93 | oBadOption, | 91 | oBadOption, |
94 | oForwardAgent, oForwardX11, oGatewayPorts, | 92 | oForwardAgent, oForwardX11, oForwardX11Trusted, oGatewayPorts, |
95 | oPasswordAuthentication, oRSAAuthentication, | 93 | oPasswordAuthentication, oRSAAuthentication, |
96 | oChallengeResponseAuthentication, oXAuthLocation, | 94 | oChallengeResponseAuthentication, oXAuthLocation, |
97 | oIdentityFile, oHostName, oPort, oCipher, oRemoteForward, oLocalForward, | 95 | oIdentityFile, oHostName, oPort, oCipher, oRemoteForward, oLocalForward, |
98 | oUser, oHost, oEscapeChar, oRhostsRSAAuthentication, oProxyCommand, | 96 | oUser, oHost, oEscapeChar, oRhostsRSAAuthentication, oProxyCommand, |
99 | oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, | 97 | oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, |
100 | oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression, | 98 | oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression, |
101 | oCompressionLevel, oKeepAlives, oNumberOfPasswordPrompts, | 99 | oCompressionLevel, oTCPKeepAlive, oNumberOfPasswordPrompts, |
102 | oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs, | 100 | oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs, |
103 | oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication, | 101 | oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication, |
104 | oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias, | 102 | oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias, |
@@ -107,6 +105,7 @@ typedef enum { | |||
107 | oClearAllForwardings, oNoHostAuthenticationForLocalhost, | 105 | oClearAllForwardings, oNoHostAuthenticationForLocalhost, |
108 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, | 106 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, |
109 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, | 107 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
108 | oServerAliveInterval, oServerAliveCountMax, | ||
110 | oProtocolKeepAlives, oSetupTimeOut, | 109 | oProtocolKeepAlives, oSetupTimeOut, |
111 | oDeprecated, oUnsupported | 110 | oDeprecated, oUnsupported |
112 | } OpCodes; | 111 | } OpCodes; |
@@ -119,6 +118,7 @@ static struct { | |||
119 | } keywords[] = { | 118 | } keywords[] = { |
120 | { "forwardagent", oForwardAgent }, | 119 | { "forwardagent", oForwardAgent }, |
121 | { "forwardx11", oForwardX11 }, | 120 | { "forwardx11", oForwardX11 }, |
121 | { "forwardx11trusted", oForwardX11Trusted }, | ||
122 | { "xauthlocation", oXAuthLocation }, | 122 | { "xauthlocation", oXAuthLocation }, |
123 | { "gatewayports", oGatewayPorts }, | 123 | { "gatewayports", oGatewayPorts }, |
124 | { "useprivilegedport", oUsePrivilegedPort }, | 124 | { "useprivilegedport", oUsePrivilegedPort }, |
@@ -171,7 +171,8 @@ static struct { | |||
171 | { "stricthostkeychecking", oStrictHostKeyChecking }, | 171 | { "stricthostkeychecking", oStrictHostKeyChecking }, |
172 | { "compression", oCompression }, | 172 | { "compression", oCompression }, |
173 | { "compressionlevel", oCompressionLevel }, | 173 | { "compressionlevel", oCompressionLevel }, |
174 | { "keepalive", oKeepAlives }, | 174 | { "tcpkeepalive", oTCPKeepAlive }, |
175 | { "keepalive", oTCPKeepAlive }, /* obsolete */ | ||
175 | { "numberofpasswordprompts", oNumberOfPasswordPrompts }, | 176 | { "numberofpasswordprompts", oNumberOfPasswordPrompts }, |
176 | { "loglevel", oLogLevel }, | 177 | { "loglevel", oLogLevel }, |
177 | { "dynamicforward", oDynamicForward }, | 178 | { "dynamicforward", oDynamicForward }, |
@@ -185,15 +186,13 @@ static struct { | |||
185 | #endif | 186 | #endif |
186 | { "clearallforwardings", oClearAllForwardings }, | 187 | { "clearallforwardings", oClearAllForwardings }, |
187 | { "enablesshkeysign", oEnableSSHKeysign }, | 188 | { "enablesshkeysign", oEnableSSHKeysign }, |
188 | #ifdef DNS | ||
189 | { "verifyhostkeydns", oVerifyHostKeyDNS }, | 189 | { "verifyhostkeydns", oVerifyHostKeyDNS }, |
190 | #else | ||
191 | { "verifyhostkeydns", oUnsupported }, | ||
192 | #endif | ||
193 | { "nohostauthenticationforlocalhost", oNoHostAuthenticationForLocalhost }, | 190 | { "nohostauthenticationforlocalhost", oNoHostAuthenticationForLocalhost }, |
194 | { "rekeylimit", oRekeyLimit }, | 191 | { "rekeylimit", oRekeyLimit }, |
195 | { "connecttimeout", oConnectTimeout }, | 192 | { "connecttimeout", oConnectTimeout }, |
196 | { "addressfamily", oAddressFamily }, | 193 | { "addressfamily", oAddressFamily }, |
194 | { "serveraliveinterval", oServerAliveInterval }, | ||
195 | { "serveralivecountmax", oServerAliveCountMax }, | ||
197 | { "protocolkeepalives", oProtocolKeepAlives }, | 196 | { "protocolkeepalives", oProtocolKeepAlives }, |
198 | { "setuptimeout", oSetupTimeOut }, | 197 | { "setuptimeout", oSetupTimeOut }, |
199 | { NULL, oBadOption } | 198 | { NULL, oBadOption } |
@@ -314,7 +313,7 @@ process_config_line(Options *options, const char *host, | |||
314 | /* NOTREACHED */ | 313 | /* NOTREACHED */ |
315 | case oConnectTimeout: | 314 | case oConnectTimeout: |
316 | intptr = &options->connection_timeout; | 315 | intptr = &options->connection_timeout; |
317 | /* parse_time: */ | 316 | parse_time: |
318 | arg = strdelim(&s); | 317 | arg = strdelim(&s); |
319 | if (!arg || *arg == '\0') | 318 | if (!arg || *arg == '\0') |
320 | fatal("%s line %d: missing time value.", | 319 | fatal("%s line %d: missing time value.", |
@@ -347,6 +346,10 @@ parse_flag: | |||
347 | intptr = &options->forward_x11; | 346 | intptr = &options->forward_x11; |
348 | goto parse_flag; | 347 | goto parse_flag; |
349 | 348 | ||
349 | case oForwardX11Trusted: | ||
350 | intptr = &options->forward_x11_trusted; | ||
351 | goto parse_flag; | ||
352 | |||
350 | case oGatewayPorts: | 353 | case oGatewayPorts: |
351 | intptr = &options->gateway_ports; | 354 | intptr = &options->gateway_ports; |
352 | goto parse_flag; | 355 | goto parse_flag; |
@@ -405,10 +408,11 @@ parse_flag: | |||
405 | 408 | ||
406 | case oVerifyHostKeyDNS: | 409 | case oVerifyHostKeyDNS: |
407 | intptr = &options->verify_host_key_dns; | 410 | intptr = &options->verify_host_key_dns; |
408 | goto parse_flag; | 411 | goto parse_yesnoask; |
409 | 412 | ||
410 | case oStrictHostKeyChecking: | 413 | case oStrictHostKeyChecking: |
411 | intptr = &options->strict_host_key_checking; | 414 | intptr = &options->strict_host_key_checking; |
415 | parse_yesnoask: | ||
412 | arg = strdelim(&s); | 416 | arg = strdelim(&s); |
413 | if (!arg || *arg == '\0') | 417 | if (!arg || *arg == '\0') |
414 | fatal("%.200s line %d: Missing yes/no/ask argument.", | 418 | fatal("%.200s line %d: Missing yes/no/ask argument.", |
@@ -430,22 +434,14 @@ parse_flag: | |||
430 | intptr = &options->compression; | 434 | intptr = &options->compression; |
431 | goto parse_flag; | 435 | goto parse_flag; |
432 | 436 | ||
433 | case oKeepAlives: | 437 | case oTCPKeepAlive: |
434 | intptr = &options->keepalives; | 438 | intptr = &options->tcp_keep_alive; |
435 | goto parse_flag; | 439 | goto parse_flag; |
436 | 440 | ||
437 | case oNoHostAuthenticationForLocalhost: | 441 | case oNoHostAuthenticationForLocalhost: |
438 | intptr = &options->no_host_authentication_for_localhost; | 442 | intptr = &options->no_host_authentication_for_localhost; |
439 | goto parse_flag; | 443 | goto parse_flag; |
440 | 444 | ||
441 | case oProtocolKeepAlives: | ||
442 | intptr = &options->protocolkeepalives; | ||
443 | goto parse_int; | ||
444 | |||
445 | case oSetupTimeOut: | ||
446 | intptr = &options->setuptimeout; | ||
447 | goto parse_int; | ||
448 | |||
449 | case oNumberOfPasswordPrompts: | 445 | case oNumberOfPasswordPrompts: |
450 | intptr = &options->number_of_password_prompts; | 446 | intptr = &options->number_of_password_prompts; |
451 | goto parse_int; | 447 | goto parse_int; |
@@ -743,6 +739,19 @@ parse_int: | |||
743 | intptr = &options->enable_ssh_keysign; | 739 | intptr = &options->enable_ssh_keysign; |
744 | goto parse_flag; | 740 | goto parse_flag; |
745 | 741 | ||
742 | case oServerAliveInterval: | ||
743 | case oProtocolKeepAlives: /* Debian-specific compatibility alias */ | ||
744 | intptr = &options->server_alive_interval; | ||
745 | goto parse_time; | ||
746 | |||
747 | case oServerAliveCountMax: | ||
748 | intptr = &options->server_alive_count_max; | ||
749 | goto parse_int; | ||
750 | |||
751 | case oSetupTimeOut: | ||
752 | intptr = &options->setuptimeout; | ||
753 | goto parse_int; | ||
754 | |||
746 | case oDeprecated: | 755 | case oDeprecated: |
747 | debug("%s line %d: Deprecated option \"%s\"", | 756 | debug("%s line %d: Deprecated option \"%s\"", |
748 | filename, linenum, keyword); | 757 | filename, linenum, keyword); |
@@ -819,6 +828,7 @@ initialize_options(Options * options) | |||
819 | memset(options, 'X', sizeof(*options)); | 828 | memset(options, 'X', sizeof(*options)); |
820 | options->forward_agent = -1; | 829 | options->forward_agent = -1; |
821 | options->forward_x11 = -1; | 830 | options->forward_x11 = -1; |
831 | options->forward_x11_trusted = -1; | ||
822 | options->xauth_location = NULL; | 832 | options->xauth_location = NULL; |
823 | options->gateway_ports = -1; | 833 | options->gateway_ports = -1; |
824 | options->use_privileged_port = -1; | 834 | options->use_privileged_port = -1; |
@@ -836,8 +846,7 @@ initialize_options(Options * options) | |||
836 | options->check_host_ip = -1; | 846 | options->check_host_ip = -1; |
837 | options->strict_host_key_checking = -1; | 847 | options->strict_host_key_checking = -1; |
838 | options->compression = -1; | 848 | options->compression = -1; |
839 | options->keepalives = -1; | 849 | options->tcp_keep_alive = -1; |
840 | options->protocolkeepalives = -1; | ||
841 | options->setuptimeout = -1; | 850 | options->setuptimeout = -1; |
842 | options->compression_level = -1; | 851 | options->compression_level = -1; |
843 | options->port = -1; | 852 | options->port = -1; |
@@ -871,6 +880,8 @@ initialize_options(Options * options) | |||
871 | options->no_host_authentication_for_localhost = - 1; | 880 | options->no_host_authentication_for_localhost = - 1; |
872 | options->rekey_limit = - 1; | 881 | options->rekey_limit = - 1; |
873 | options->verify_host_key_dns = -1; | 882 | options->verify_host_key_dns = -1; |
883 | options->server_alive_interval = -1; | ||
884 | options->server_alive_count_max = -1; | ||
874 | } | 885 | } |
875 | 886 | ||
876 | /* | 887 | /* |
@@ -887,6 +898,8 @@ fill_default_options(Options * options) | |||
887 | options->forward_agent = 0; | 898 | options->forward_agent = 0; |
888 | if (options->forward_x11 == -1) | 899 | if (options->forward_x11 == -1) |
889 | options->forward_x11 = 0; | 900 | options->forward_x11 = 0; |
901 | if (options->forward_x11_trusted == -1) | ||
902 | options->forward_x11_trusted = 0; | ||
890 | if (options->xauth_location == NULL) | 903 | if (options->xauth_location == NULL) |
891 | options->xauth_location = _PATH_XAUTH; | 904 | options->xauth_location = _PATH_XAUTH; |
892 | if (options->gateway_ports == -1) | 905 | if (options->gateway_ports == -1) |
@@ -900,7 +913,7 @@ fill_default_options(Options * options) | |||
900 | if (options->challenge_response_authentication == -1) | 913 | if (options->challenge_response_authentication == -1) |
901 | options->challenge_response_authentication = 1; | 914 | options->challenge_response_authentication = 1; |
902 | if (options->gss_authentication == -1) | 915 | if (options->gss_authentication == -1) |
903 | options->gss_authentication = 1; | 916 | options->gss_authentication = 0; |
904 | if (options->gss_deleg_creds == -1) | 917 | if (options->gss_deleg_creds == -1) |
905 | options->gss_deleg_creds = 0; | 918 | options->gss_deleg_creds = 0; |
906 | if (options->password_authentication == -1) | 919 | if (options->password_authentication == -1) |
@@ -919,16 +932,8 @@ fill_default_options(Options * options) | |||
919 | options->strict_host_key_checking = 2; /* 2 is default */ | 932 | options->strict_host_key_checking = 2; /* 2 is default */ |
920 | if (options->compression == -1) | 933 | if (options->compression == -1) |
921 | options->compression = 0; | 934 | options->compression = 0; |
922 | if (options->keepalives == -1) | 935 | if (options->tcp_keep_alive == -1) |
923 | options->keepalives = 1; | 936 | options->tcp_keep_alive = 1; |
924 | if (options->protocolkeepalives == -1){ | ||
925 | if (options->batch_mode == 1) /*in batch mode, default is 5mins */ | ||
926 | options->protocolkeepalives = 300; | ||
927 | else options->protocolkeepalives = 0;} | ||
928 | if (options->setuptimeout == -1){ | ||
929 | if (options->batch_mode == 1) /*in batch mode, default is 5mins */ | ||
930 | options->setuptimeout = 300; | ||
931 | else options->setuptimeout = 0;} | ||
932 | if (options->compression_level == -1) | 937 | if (options->compression_level == -1) |
933 | options->compression_level = 6; | 938 | options->compression_level = 6; |
934 | if (options->port == -1) | 939 | if (options->port == -1) |
@@ -991,6 +996,22 @@ fill_default_options(Options * options) | |||
991 | options->rekey_limit = 0; | 996 | options->rekey_limit = 0; |
992 | if (options->verify_host_key_dns == -1) | 997 | if (options->verify_host_key_dns == -1) |
993 | options->verify_host_key_dns = 0; | 998 | options->verify_host_key_dns = 0; |
999 | if (options->server_alive_interval == -1) { | ||
1000 | /* in batch mode, default is 5mins */ | ||
1001 | if (options->batch_mode == 1) | ||
1002 | options->server_alive_interval = 300; | ||
1003 | else | ||
1004 | options->server_alive_interval = 0; | ||
1005 | } | ||
1006 | if (options->server_alive_count_max == -1) | ||
1007 | options->server_alive_count_max = 3; | ||
1008 | if (options->setuptimeout == -1) { | ||
1009 | /* in batch mode, default is 5mins */ | ||
1010 | if (options->batch_mode == 1) | ||
1011 | options->setuptimeout = 300; | ||
1012 | else | ||
1013 | options->setuptimeout = 0; | ||
1014 | } | ||
994 | /* options->proxy_command should not be set by default */ | 1015 | /* options->proxy_command should not be set by default */ |
995 | /* options->user will be set in the main program if appropriate */ | 1016 | /* options->user will be set in the main program if appropriate */ |
996 | /* options->hostname will be set in the main program if appropriate */ | 1017 | /* options->hostname will be set in the main program if appropriate */ |