diff options
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 74 |
1 files changed, 71 insertions, 3 deletions
diff --git a/readconf.c b/readconf.c index cf27a9f41..1fbf59793 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.143 2005/07/30 02:03:47 djm Exp $"); | 15 | RCSID("$OpenBSD: readconf.c,v 1.145 2005/12/08 18:34:11 reyk Exp $"); |
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "xmalloc.h" | 18 | #include "xmalloc.h" |
@@ -70,6 +70,10 @@ RCSID("$OpenBSD: readconf.c,v 1.143 2005/07/30 02:03:47 djm Exp $"); | |||
70 | Cipher none | 70 | Cipher none |
71 | PasswordAuthentication no | 71 | PasswordAuthentication no |
72 | 72 | ||
73 | Host vpn.fake.com | ||
74 | Tunnel yes | ||
75 | TunnelDevice 3 | ||
76 | |||
73 | # Defaults for various options | 77 | # Defaults for various options |
74 | Host * | 78 | Host * |
75 | ForwardAgent no | 79 | ForwardAgent no |
@@ -107,6 +111,7 @@ typedef enum { | |||
107 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, | 111 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
108 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, | 112 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, |
109 | oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, | 113 | oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, |
114 | oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, | ||
110 | oDeprecated, oUnsupported | 115 | oDeprecated, oUnsupported |
111 | } OpCodes; | 116 | } OpCodes; |
112 | 117 | ||
@@ -198,6 +203,10 @@ static struct { | |||
198 | { "controlpath", oControlPath }, | 203 | { "controlpath", oControlPath }, |
199 | { "controlmaster", oControlMaster }, | 204 | { "controlmaster", oControlMaster }, |
200 | { "hashknownhosts", oHashKnownHosts }, | 205 | { "hashknownhosts", oHashKnownHosts }, |
206 | { "tunnel", oTunnel }, | ||
207 | { "tunneldevice", oTunnelDevice }, | ||
208 | { "localcommand", oLocalCommand }, | ||
209 | { "permitlocalcommand", oPermitLocalCommand }, | ||
201 | { NULL, oBadOption } | 210 | { NULL, oBadOption } |
202 | }; | 211 | }; |
203 | 212 | ||
@@ -264,6 +273,7 @@ clear_forwardings(Options *options) | |||
264 | xfree(options->remote_forwards[i].connect_host); | 273 | xfree(options->remote_forwards[i].connect_host); |
265 | } | 274 | } |
266 | options->num_remote_forwards = 0; | 275 | options->num_remote_forwards = 0; |
276 | options->tun_open = SSH_TUNMODE_NO; | ||
267 | } | 277 | } |
268 | 278 | ||
269 | /* | 279 | /* |
@@ -296,7 +306,7 @@ process_config_line(Options *options, const char *host, | |||
296 | int *activep) | 306 | int *activep) |
297 | { | 307 | { |
298 | char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256]; | 308 | char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256]; |
299 | int opcode, *intptr, value; | 309 | int opcode, *intptr, value, value2; |
300 | size_t len; | 310 | size_t len; |
301 | Forward fwd; | 311 | Forward fwd; |
302 | 312 | ||
@@ -553,9 +563,10 @@ parse_string: | |||
553 | goto parse_string; | 563 | goto parse_string; |
554 | 564 | ||
555 | case oProxyCommand: | 565 | case oProxyCommand: |
566 | charptr = &options->proxy_command; | ||
567 | parse_command: | ||
556 | if (s == NULL) | 568 | if (s == NULL) |
557 | fatal("%.200s line %d: Missing argument.", filename, linenum); | 569 | fatal("%.200s line %d: Missing argument.", filename, linenum); |
558 | charptr = &options->proxy_command; | ||
559 | len = strspn(s, WHITESPACE "="); | 570 | len = strspn(s, WHITESPACE "="); |
560 | if (*activep && *charptr == NULL) | 571 | if (*activep && *charptr == NULL) |
561 | *charptr = xstrdup(s + len); | 572 | *charptr = xstrdup(s + len); |
@@ -822,6 +833,49 @@ parse_int: | |||
822 | intptr = &options->hash_known_hosts; | 833 | intptr = &options->hash_known_hosts; |
823 | goto parse_flag; | 834 | goto parse_flag; |
824 | 835 | ||
836 | case oTunnel: | ||
837 | intptr = &options->tun_open; | ||
838 | arg = strdelim(&s); | ||
839 | if (!arg || *arg == '\0') | ||
840 | fatal("%s line %d: Missing yes/point-to-point/" | ||
841 | "ethernet/no argument.", filename, linenum); | ||
842 | value = 0; /* silence compiler */ | ||
843 | if (strcasecmp(arg, "ethernet") == 0) | ||
844 | value = SSH_TUNMODE_ETHERNET; | ||
845 | else if (strcasecmp(arg, "point-to-point") == 0) | ||
846 | value = SSH_TUNMODE_POINTOPOINT; | ||
847 | else if (strcasecmp(arg, "yes") == 0) | ||
848 | value = SSH_TUNMODE_DEFAULT; | ||
849 | else if (strcasecmp(arg, "no") == 0) | ||
850 | value = SSH_TUNMODE_NO; | ||
851 | else | ||
852 | fatal("%s line %d: Bad yes/point-to-point/ethernet/" | ||
853 | "no argument: %s", filename, linenum, arg); | ||
854 | if (*activep) | ||
855 | *intptr = value; | ||
856 | break; | ||
857 | |||
858 | case oTunnelDevice: | ||
859 | arg = strdelim(&s); | ||
860 | if (!arg || *arg == '\0') | ||
861 | fatal("%.200s line %d: Missing argument.", filename, linenum); | ||
862 | value = a2tun(arg, &value2); | ||
863 | if (value == SSH_TUNID_ERR) | ||
864 | fatal("%.200s line %d: Bad tun device.", filename, linenum); | ||
865 | if (*activep) { | ||
866 | options->tun_local = value; | ||
867 | options->tun_remote = value2; | ||
868 | } | ||
869 | break; | ||
870 | |||
871 | case oLocalCommand: | ||
872 | charptr = &options->local_command; | ||
873 | goto parse_command; | ||
874 | |||
875 | case oPermitLocalCommand: | ||
876 | intptr = &options->permit_local_command; | ||
877 | goto parse_flag; | ||
878 | |||
825 | case oDeprecated: | 879 | case oDeprecated: |
826 | debug("%s line %d: Deprecated option \"%s\"", | 880 | debug("%s line %d: Deprecated option \"%s\"", |
827 | filename, linenum, keyword); | 881 | filename, linenum, keyword); |
@@ -966,6 +1020,11 @@ initialize_options(Options * options) | |||
966 | options->control_path = NULL; | 1020 | options->control_path = NULL; |
967 | options->control_master = -1; | 1021 | options->control_master = -1; |
968 | options->hash_known_hosts = -1; | 1022 | options->hash_known_hosts = -1; |
1023 | options->tun_open = -1; | ||
1024 | options->tun_local = -1; | ||
1025 | options->tun_remote = -1; | ||
1026 | options->local_command = NULL; | ||
1027 | options->permit_local_command = -1; | ||
969 | } | 1028 | } |
970 | 1029 | ||
971 | /* | 1030 | /* |
@@ -1090,6 +1149,15 @@ fill_default_options(Options * options) | |||
1090 | options->control_master = 0; | 1149 | options->control_master = 0; |
1091 | if (options->hash_known_hosts == -1) | 1150 | if (options->hash_known_hosts == -1) |
1092 | options->hash_known_hosts = 0; | 1151 | options->hash_known_hosts = 0; |
1152 | if (options->tun_open == -1) | ||
1153 | options->tun_open = SSH_TUNMODE_NO; | ||
1154 | if (options->tun_local == -1) | ||
1155 | options->tun_local = SSH_TUNID_ANY; | ||
1156 | if (options->tun_remote == -1) | ||
1157 | options->tun_remote = SSH_TUNID_ANY; | ||
1158 | if (options->permit_local_command == -1) | ||
1159 | options->permit_local_command = 0; | ||
1160 | /* options->local_command should not be set by default */ | ||
1093 | /* options->proxy_command should not be set by default */ | 1161 | /* options->proxy_command should not be set by default */ |
1094 | /* options->user will be set in the main program if appropriate */ | 1162 | /* options->user will be set in the main program if appropriate */ |
1095 | /* options->hostname will be set in the main program if appropriate */ | 1163 | /* options->hostname will be set in the main program if appropriate */ |