diff options
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/readconf.c b/readconf.c index 282afede6..cb3ae6dc7 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.318 2019/12/20 02:42:42 dtucker Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.319 2019/12/21 02:19:13 djm 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 |
@@ -919,6 +919,34 @@ parse_time: | |||
919 | 919 | ||
920 | case oForwardAgent: | 920 | case oForwardAgent: |
921 | intptr = &options->forward_agent; | 921 | intptr = &options->forward_agent; |
922 | |||
923 | arg = strdelim(&s); | ||
924 | if (!arg || *arg == '\0') | ||
925 | fatal("%s line %d: missing argument.", | ||
926 | filename, linenum); | ||
927 | |||
928 | value = -1; | ||
929 | multistate_ptr = multistate_flag; | ||
930 | for (i = 0; multistate_ptr[i].key != NULL; i++) { | ||
931 | if (strcasecmp(arg, multistate_ptr[i].key) == 0) { | ||
932 | value = multistate_ptr[i].value; | ||
933 | break; | ||
934 | } | ||
935 | } | ||
936 | if (value != -1) { | ||
937 | if (*activep && *intptr == -1) | ||
938 | *intptr = value; | ||
939 | break; | ||
940 | } | ||
941 | /* ForwardAgent wasn't 'yes' or 'no', assume a path */ | ||
942 | if (*activep && *intptr == -1) | ||
943 | *intptr = 1; | ||
944 | |||
945 | charptr = &options->forward_agent_sock_path; | ||
946 | goto parse_agent_path; | ||
947 | |||
948 | case oForwardX11: | ||
949 | intptr = &options->forward_x11; | ||
922 | parse_flag: | 950 | parse_flag: |
923 | multistate_ptr = multistate_flag; | 951 | multistate_ptr = multistate_flag; |
924 | parse_multistate: | 952 | parse_multistate: |
@@ -940,10 +968,6 @@ parse_time: | |||
940 | *intptr = value; | 968 | *intptr = value; |
941 | break; | 969 | break; |
942 | 970 | ||
943 | case oForwardX11: | ||
944 | intptr = &options->forward_x11; | ||
945 | goto parse_flag; | ||
946 | |||
947 | case oForwardX11Trusted: | 971 | case oForwardX11Trusted: |
948 | intptr = &options->forward_x11_trusted; | 972 | intptr = &options->forward_x11_trusted; |
949 | goto parse_flag; | 973 | goto parse_flag; |
@@ -1736,6 +1760,7 @@ parse_keytypes: | |||
1736 | if (!arg || *arg == '\0') | 1760 | if (!arg || *arg == '\0') |
1737 | fatal("%.200s line %d: Missing argument.", | 1761 | fatal("%.200s line %d: Missing argument.", |
1738 | filename, linenum); | 1762 | filename, linenum); |
1763 | parse_agent_path: | ||
1739 | /* Extra validation if the string represents an env var. */ | 1764 | /* Extra validation if the string represents an env var. */ |
1740 | if (arg[0] == '$' && !valid_env_name(arg + 1)) { | 1765 | if (arg[0] == '$' && !valid_env_name(arg + 1)) { |
1741 | fatal("%.200s line %d: Invalid environment name %s.", | 1766 | fatal("%.200s line %d: Invalid environment name %s.", |
@@ -1853,6 +1878,7 @@ initialize_options(Options * options) | |||
1853 | { | 1878 | { |
1854 | memset(options, 'X', sizeof(*options)); | 1879 | memset(options, 'X', sizeof(*options)); |
1855 | options->forward_agent = -1; | 1880 | options->forward_agent = -1; |
1881 | options->forward_agent_sock_path = NULL; | ||
1856 | options->forward_x11 = -1; | 1882 | options->forward_x11 = -1; |
1857 | options->forward_x11_trusted = -1; | 1883 | options->forward_x11_trusted = -1; |
1858 | options->forward_x11_timeout = -1; | 1884 | options->forward_x11_timeout = -1; |
@@ -2636,7 +2662,6 @@ dump_client_config(Options *o, const char *host) | |||
2636 | dump_cfg_fmtint(oClearAllForwardings, o->clear_forwardings); | 2662 | dump_cfg_fmtint(oClearAllForwardings, o->clear_forwardings); |
2637 | dump_cfg_fmtint(oExitOnForwardFailure, o->exit_on_forward_failure); | 2663 | dump_cfg_fmtint(oExitOnForwardFailure, o->exit_on_forward_failure); |
2638 | dump_cfg_fmtint(oFingerprintHash, o->fingerprint_hash); | 2664 | dump_cfg_fmtint(oFingerprintHash, o->fingerprint_hash); |
2639 | dump_cfg_fmtint(oForwardAgent, o->forward_agent); | ||
2640 | dump_cfg_fmtint(oForwardX11, o->forward_x11); | 2665 | dump_cfg_fmtint(oForwardX11, o->forward_x11); |
2641 | dump_cfg_fmtint(oForwardX11Trusted, o->forward_x11_trusted); | 2666 | dump_cfg_fmtint(oForwardX11Trusted, o->forward_x11_trusted); |
2642 | dump_cfg_fmtint(oGatewayPorts, o->fwd_opts.gateway_ports); | 2667 | dump_cfg_fmtint(oGatewayPorts, o->fwd_opts.gateway_ports); |
@@ -2712,6 +2737,12 @@ dump_client_config(Options *o, const char *host) | |||
2712 | 2737 | ||
2713 | /* Special cases */ | 2738 | /* Special cases */ |
2714 | 2739 | ||
2740 | /* oForwardAgent */ | ||
2741 | if (o->forward_agent_sock_path == NULL) | ||
2742 | dump_cfg_fmtint(oForwardAgent, o->forward_agent); | ||
2743 | else | ||
2744 | dump_cfg_string(oForwardAgent, o->forward_agent_sock_path); | ||
2745 | |||
2715 | /* oConnectTimeout */ | 2746 | /* oConnectTimeout */ |
2716 | if (o->connection_timeout == -1) | 2747 | if (o->connection_timeout == -1) |
2717 | printf("connecttimeout none\n"); | 2748 | printf("connecttimeout none\n"); |