diff options
author | Damien Miller <djm@mindrot.org> | 2010-08-03 16:04:46 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2010-08-03 16:04:46 +1000 |
commit | e11e1ea5d475ee8be0038d64aa3e47c776295ac2 (patch) | |
tree | 88fa00ef41babbec7cb33e68f400e3a1ff787230 /readconf.c | |
parent | c4bb91c79c0a05d2bbf2ac68b7be8421fb4957bf (diff) |
- djm@cvs.openbsd.org 2010/07/19 09:15:12
[clientloop.c readconf.c readconf.h ssh.c ssh_config.5]
add a "ControlPersist" option that automatically starts a background
ssh(1) multiplex master when connecting. This connection can stay alive
indefinitely, or can be set to automatically close after a user-specified
duration of inactivity. bz#1330 - patch by dwmw2 AT infradead.org, but
further hacked on by wmertens AT cisco.com, apb AT cequrux.com,
martin-mindrot-bugzilla AT earth.li and myself; "looks ok" markus@
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c index da48ae7da..0296590e2 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.186 2010/06/25 23:15:36 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.187 2010/07/19 09:15:12 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 |
@@ -128,7 +128,8 @@ typedef enum { | |||
128 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, | 128 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, |
129 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, | 129 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
130 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, | 130 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, |
131 | oSendEnv, oControlPath, oControlMaster, oHashKnownHosts, | 131 | oSendEnv, oControlPath, oControlMaster, oControlPersist, |
132 | oHashKnownHosts, | ||
132 | oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, | 133 | oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, |
133 | oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication, | 134 | oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication, |
134 | oDeprecated, oUnsupported | 135 | oDeprecated, oUnsupported |
@@ -225,6 +226,7 @@ static struct { | |||
225 | { "sendenv", oSendEnv }, | 226 | { "sendenv", oSendEnv }, |
226 | { "controlpath", oControlPath }, | 227 | { "controlpath", oControlPath }, |
227 | { "controlmaster", oControlMaster }, | 228 | { "controlmaster", oControlMaster }, |
229 | { "controlpersist", oControlPersist }, | ||
228 | { "hashknownhosts", oHashKnownHosts }, | 230 | { "hashknownhosts", oHashKnownHosts }, |
229 | { "tunnel", oTunnel }, | 231 | { "tunnel", oTunnel }, |
230 | { "tunneldevice", oTunnelDevice }, | 232 | { "tunneldevice", oTunnelDevice }, |
@@ -882,6 +884,30 @@ parse_int: | |||
882 | *intptr = value; | 884 | *intptr = value; |
883 | break; | 885 | break; |
884 | 886 | ||
887 | case oControlPersist: | ||
888 | /* no/false/yes/true, or a time spec */ | ||
889 | intptr = &options->control_persist; | ||
890 | arg = strdelim(&s); | ||
891 | if (!arg || *arg == '\0') | ||
892 | fatal("%.200s line %d: Missing ControlPersist" | ||
893 | " argument.", filename, linenum); | ||
894 | value = 0; | ||
895 | value2 = 0; /* timeout */ | ||
896 | if (strcmp(arg, "no") == 0 || strcmp(arg, "false") == 0) | ||
897 | value = 0; | ||
898 | else if (strcmp(arg, "yes") == 0 || strcmp(arg, "true") == 0) | ||
899 | value = 1; | ||
900 | else if ((value2 = convtime(arg)) >= 0) | ||
901 | value = 1; | ||
902 | else | ||
903 | fatal("%.200s line %d: Bad ControlPersist argument.", | ||
904 | filename, linenum); | ||
905 | if (*activep && *intptr == -1) { | ||
906 | *intptr = value; | ||
907 | options->control_persist_timeout = value2; | ||
908 | } | ||
909 | break; | ||
910 | |||
885 | case oHashKnownHosts: | 911 | case oHashKnownHosts: |
886 | intptr = &options->hash_known_hosts; | 912 | intptr = &options->hash_known_hosts; |
887 | goto parse_flag; | 913 | goto parse_flag; |
@@ -1083,6 +1109,8 @@ initialize_options(Options * options) | |||
1083 | options->num_send_env = 0; | 1109 | options->num_send_env = 0; |
1084 | options->control_path = NULL; | 1110 | options->control_path = NULL; |
1085 | options->control_master = -1; | 1111 | options->control_master = -1; |
1112 | options->control_persist = -1; | ||
1113 | options->control_persist_timeout = 0; | ||
1086 | options->hash_known_hosts = -1; | 1114 | options->hash_known_hosts = -1; |
1087 | options->tun_open = -1; | 1115 | options->tun_open = -1; |
1088 | options->tun_local = -1; | 1116 | options->tun_local = -1; |
@@ -1218,6 +1246,10 @@ fill_default_options(Options * options) | |||
1218 | options->server_alive_count_max = 3; | 1246 | options->server_alive_count_max = 3; |
1219 | if (options->control_master == -1) | 1247 | if (options->control_master == -1) |
1220 | options->control_master = 0; | 1248 | options->control_master = 0; |
1249 | if (options->control_persist == -1) { | ||
1250 | options->control_persist = 0; | ||
1251 | options->control_persist_timeout = 0; | ||
1252 | } | ||
1221 | if (options->hash_known_hosts == -1) | 1253 | if (options->hash_known_hosts == -1) |
1222 | options->hash_known_hosts = 0; | 1254 | options->hash_known_hosts = 0; |
1223 | if (options->tun_open == -1) | 1255 | if (options->tun_open == -1) |