diff options
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/readconf.c b/readconf.c index cf27a9f41..b6aad9d8d 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.144 2005/12/06 22:38:27 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 = 0; | ||
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,31 @@ 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 | goto parse_flag; | ||
839 | |||
840 | case oTunnelDevice: | ||
841 | arg = strdelim(&s); | ||
842 | if (!arg || *arg == '\0') | ||
843 | fatal("%.200s line %d: Missing argument.", filename, linenum); | ||
844 | value = a2tun(arg, &value2); | ||
845 | if (value < -1) | ||
846 | fatal("%.200s line %d: Bad tun device.", filename, linenum); | ||
847 | if (*activep) { | ||
848 | options->tun_local = value; | ||
849 | options->tun_remote = value2; | ||
850 | } | ||
851 | break; | ||
852 | |||
853 | case oLocalCommand: | ||
854 | charptr = &options->local_command; | ||
855 | goto parse_command; | ||
856 | |||
857 | case oPermitLocalCommand: | ||
858 | intptr = &options->permit_local_command; | ||
859 | goto parse_flag; | ||
860 | |||
825 | case oDeprecated: | 861 | case oDeprecated: |
826 | debug("%s line %d: Deprecated option \"%s\"", | 862 | debug("%s line %d: Deprecated option \"%s\"", |
827 | filename, linenum, keyword); | 863 | filename, linenum, keyword); |
@@ -966,6 +1002,11 @@ initialize_options(Options * options) | |||
966 | options->control_path = NULL; | 1002 | options->control_path = NULL; |
967 | options->control_master = -1; | 1003 | options->control_master = -1; |
968 | options->hash_known_hosts = -1; | 1004 | options->hash_known_hosts = -1; |
1005 | options->tun_open = -1; | ||
1006 | options->tun_local = -1; | ||
1007 | options->tun_remote = -1; | ||
1008 | options->local_command = NULL; | ||
1009 | options->permit_local_command = -1; | ||
969 | } | 1010 | } |
970 | 1011 | ||
971 | /* | 1012 | /* |
@@ -1090,6 +1131,11 @@ fill_default_options(Options * options) | |||
1090 | options->control_master = 0; | 1131 | options->control_master = 0; |
1091 | if (options->hash_known_hosts == -1) | 1132 | if (options->hash_known_hosts == -1) |
1092 | options->hash_known_hosts = 0; | 1133 | options->hash_known_hosts = 0; |
1134 | if (options->tun_open == -1) | ||
1135 | options->tun_open = 0; | ||
1136 | if (options->permit_local_command == -1) | ||
1137 | options->permit_local_command = 0; | ||
1138 | /* options->local_command should not be set by default */ | ||
1093 | /* options->proxy_command should not be set by default */ | 1139 | /* options->proxy_command should not be set by default */ |
1094 | /* options->user will be set in the main program if appropriate */ | 1140 | /* options->user will be set in the main program if appropriate */ |
1095 | /* options->hostname will be set in the main program if appropriate */ | 1141 | /* options->hostname will be set in the main program if appropriate */ |