diff options
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/readconf.c b/readconf.c index 7173a8c23..345df9c25 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.137 2005/03/04 08:48:06 djm Exp $"); | 15 | RCSID("$OpenBSD: readconf.c,v 1.143 2005/07/30 02:03:47 djm Exp $"); |
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "xmalloc.h" | 18 | #include "xmalloc.h" |
@@ -105,6 +105,7 @@ typedef enum { | |||
105 | oClearAllForwardings, oNoHostAuthenticationForLocalhost, | 105 | oClearAllForwardings, oNoHostAuthenticationForLocalhost, |
106 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, | 106 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, |
107 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, | 107 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
108 | oGssTrustDns, | ||
108 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, | 109 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, |
109 | oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, | 110 | oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, |
110 | oDeprecated, oUnsupported | 111 | oDeprecated, oUnsupported |
@@ -140,9 +141,11 @@ static struct { | |||
140 | #if defined(GSSAPI) | 141 | #if defined(GSSAPI) |
141 | { "gssapiauthentication", oGssAuthentication }, | 142 | { "gssapiauthentication", oGssAuthentication }, |
142 | { "gssapidelegatecredentials", oGssDelegateCreds }, | 143 | { "gssapidelegatecredentials", oGssDelegateCreds }, |
144 | { "gssapitrustdns", oGssTrustDns }, | ||
143 | #else | 145 | #else |
144 | { "gssapiauthentication", oUnsupported }, | 146 | { "gssapiauthentication", oUnsupported }, |
145 | { "gssapidelegatecredentials", oUnsupported }, | 147 | { "gssapidelegatecredentials", oUnsupported }, |
148 | { "gssapitrustdns", oUnsupported }, | ||
146 | #endif | 149 | #endif |
147 | { "fallbacktorsh", oDeprecated }, | 150 | { "fallbacktorsh", oDeprecated }, |
148 | { "usersh", oDeprecated }, | 151 | { "usersh", oDeprecated }, |
@@ -253,12 +256,14 @@ clear_forwardings(Options *options) | |||
253 | int i; | 256 | int i; |
254 | 257 | ||
255 | for (i = 0; i < options->num_local_forwards; i++) { | 258 | for (i = 0; i < options->num_local_forwards; i++) { |
256 | xfree(options->local_forwards[i].listen_host); | 259 | if (options->local_forwards[i].listen_host != NULL) |
260 | xfree(options->local_forwards[i].listen_host); | ||
257 | xfree(options->local_forwards[i].connect_host); | 261 | xfree(options->local_forwards[i].connect_host); |
258 | } | 262 | } |
259 | options->num_local_forwards = 0; | 263 | options->num_local_forwards = 0; |
260 | for (i = 0; i < options->num_remote_forwards; i++) { | 264 | for (i = 0; i < options->num_remote_forwards; i++) { |
261 | xfree(options->remote_forwards[i].listen_host); | 265 | if (options->remote_forwards[i].listen_host != NULL) |
266 | xfree(options->remote_forwards[i].listen_host); | ||
262 | xfree(options->remote_forwards[i].connect_host); | 267 | xfree(options->remote_forwards[i].connect_host); |
263 | } | 268 | } |
264 | options->num_remote_forwards = 0; | 269 | options->num_remote_forwards = 0; |
@@ -299,7 +304,7 @@ process_config_line(Options *options, const char *host, | |||
299 | Forward fwd; | 304 | Forward fwd; |
300 | 305 | ||
301 | /* Strip trailing whitespace */ | 306 | /* Strip trailing whitespace */ |
302 | for(len = strlen(line) - 1; len > 0; len--) { | 307 | for (len = strlen(line) - 1; len > 0; len--) { |
303 | if (strchr(WHITESPACE, line[len]) == NULL) | 308 | if (strchr(WHITESPACE, line[len]) == NULL) |
304 | break; | 309 | break; |
305 | line[len] = '\0'; | 310 | line[len] = '\0'; |
@@ -408,6 +413,10 @@ parse_flag: | |||
408 | intptr = &options->gss_deleg_creds; | 413 | intptr = &options->gss_deleg_creds; |
409 | goto parse_flag; | 414 | goto parse_flag; |
410 | 415 | ||
416 | case oGssTrustDns: | ||
417 | intptr = &options->gss_trust_dns; | ||
418 | goto parse_flag; | ||
419 | |||
411 | case oBatchMode: | 420 | case oBatchMode: |
412 | intptr = &options->batch_mode; | 421 | intptr = &options->batch_mode; |
413 | goto parse_flag; | 422 | goto parse_flag; |
@@ -693,7 +702,7 @@ parse_int: | |||
693 | fwd.listen_host = cleanhostname(fwd.listen_host); | 702 | fwd.listen_host = cleanhostname(fwd.listen_host); |
694 | } else { | 703 | } else { |
695 | fwd.listen_port = a2port(fwd.listen_host); | 704 | fwd.listen_port = a2port(fwd.listen_host); |
696 | fwd.listen_host = ""; | 705 | fwd.listen_host = NULL; |
697 | } | 706 | } |
698 | if (fwd.listen_port == 0) | 707 | if (fwd.listen_port == 0) |
699 | fatal("%.200s line %d: Badly formatted port number.", | 708 | fatal("%.200s line %d: Badly formatted port number.", |
@@ -741,6 +750,9 @@ parse_int: | |||
741 | 750 | ||
742 | case oAddressFamily: | 751 | case oAddressFamily: |
743 | arg = strdelim(&s); | 752 | arg = strdelim(&s); |
753 | if (!arg || *arg == '\0') | ||
754 | fatal("%s line %d: missing address family.", | ||
755 | filename, linenum); | ||
744 | intptr = &options->address_family; | 756 | intptr = &options->address_family; |
745 | if (strcasecmp(arg, "inet") == 0) | 757 | if (strcasecmp(arg, "inet") == 0) |
746 | value = AF_INET; | 758 | value = AF_INET; |
@@ -791,7 +803,27 @@ parse_int: | |||
791 | 803 | ||
792 | case oControlMaster: | 804 | case oControlMaster: |
793 | intptr = &options->control_master; | 805 | intptr = &options->control_master; |
794 | goto parse_yesnoask; | 806 | arg = strdelim(&s); |
807 | if (!arg || *arg == '\0') | ||
808 | fatal("%.200s line %d: Missing ControlMaster argument.", | ||
809 | filename, linenum); | ||
810 | value = 0; /* To avoid compiler warning... */ | ||
811 | if (strcmp(arg, "yes") == 0 || strcmp(arg, "true") == 0) | ||
812 | value = SSHCTL_MASTER_YES; | ||
813 | else if (strcmp(arg, "no") == 0 || strcmp(arg, "false") == 0) | ||
814 | value = SSHCTL_MASTER_NO; | ||
815 | else if (strcmp(arg, "auto") == 0) | ||
816 | value = SSHCTL_MASTER_AUTO; | ||
817 | else if (strcmp(arg, "ask") == 0) | ||
818 | value = SSHCTL_MASTER_ASK; | ||
819 | else if (strcmp(arg, "autoask") == 0) | ||
820 | value = SSHCTL_MASTER_AUTO_ASK; | ||
821 | else | ||
822 | fatal("%.200s line %d: Bad ControlMaster argument.", | ||
823 | filename, linenum); | ||
824 | if (*activep && *intptr == -1) | ||
825 | *intptr = value; | ||
826 | break; | ||
795 | 827 | ||
796 | case oHashKnownHosts: | 828 | case oHashKnownHosts: |
797 | intptr = &options->hash_known_hosts; | 829 | intptr = &options->hash_known_hosts; |
@@ -814,7 +846,7 @@ parse_int: | |||
814 | /* Check that there is no garbage at end of line. */ | 846 | /* Check that there is no garbage at end of line. */ |
815 | if ((arg = strdelim(&s)) != NULL && *arg != '\0') { | 847 | if ((arg = strdelim(&s)) != NULL && *arg != '\0') { |
816 | fatal("%.200s line %d: garbage at end of line; \"%.200s\".", | 848 | fatal("%.200s line %d: garbage at end of line; \"%.200s\".", |
817 | filename, linenum, arg); | 849 | filename, linenum, arg); |
818 | } | 850 | } |
819 | return 0; | 851 | return 0; |
820 | } | 852 | } |
@@ -892,6 +924,7 @@ initialize_options(Options * options) | |||
892 | options->challenge_response_authentication = -1; | 924 | options->challenge_response_authentication = -1; |
893 | options->gss_authentication = -1; | 925 | options->gss_authentication = -1; |
894 | options->gss_deleg_creds = -1; | 926 | options->gss_deleg_creds = -1; |
927 | options->gss_trust_dns = -1; | ||
895 | options->password_authentication = -1; | 928 | options->password_authentication = -1; |
896 | options->kbd_interactive_authentication = -1; | 929 | options->kbd_interactive_authentication = -1; |
897 | options->kbd_interactive_devices = NULL; | 930 | options->kbd_interactive_devices = NULL; |
@@ -975,6 +1008,8 @@ fill_default_options(Options * options) | |||
975 | options->gss_authentication = 0; | 1008 | options->gss_authentication = 0; |
976 | if (options->gss_deleg_creds == -1) | 1009 | if (options->gss_deleg_creds == -1) |
977 | options->gss_deleg_creds = 0; | 1010 | options->gss_deleg_creds = 0; |
1011 | if (options->gss_trust_dns == -1) | ||
1012 | options->gss_trust_dns = 0; | ||
978 | if (options->password_authentication == -1) | 1013 | if (options->password_authentication == -1) |
979 | options->password_authentication = 1; | 1014 | options->password_authentication = 1; |
980 | if (options->kbd_interactive_authentication == -1) | 1015 | if (options->kbd_interactive_authentication == -1) |