summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authorbluhm@openbsd.org <bluhm@openbsd.org>2017-05-30 18:58:37 +0000
committerDamien Miller <djm@mindrot.org>2017-05-31 10:51:09 +1000
commit1112b534a6a7a07190e497e6bf86b0d5c5fb02dc (patch)
treead8c53c5857fe2290828b378b8c4cb8aff27fefe /readconf.c
parenteb272ea4099fd6157846f15c129ac5727933aa69 (diff)
upstream commit
Add RemoteCommand option to specify a command in the ssh config file instead of giving it on the client's command line. This command will be executed on the remote host. The feature allows to automate tasks using ssh config. OK markus@ Upstream-ID: 5d982fc17adea373a9c68cae1021ce0a0904a5ee
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c
index 4be5327a9..b11c628f9 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.276 2017/05/20 02:35:47 djm Exp $ */ 1/* $OpenBSD: readconf.c,v 1.277 2017/05/30 18:58:37 bluhm 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
@@ -163,7 +163,8 @@ typedef enum {
163 oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, 163 oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
164 oSendEnv, oControlPath, oControlMaster, oControlPersist, 164 oSendEnv, oControlPath, oControlMaster, oControlPersist,
165 oHashKnownHosts, 165 oHashKnownHosts,
166 oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, 166 oTunnel, oTunnelDevice,
167 oLocalCommand, oPermitLocalCommand, oRemoteCommand,
167 oVisualHostKey, 168 oVisualHostKey,
168 oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass, 169 oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass,
169 oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots, 170 oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots,
@@ -284,6 +285,7 @@ static struct {
284 { "tunneldevice", oTunnelDevice }, 285 { "tunneldevice", oTunnelDevice },
285 { "localcommand", oLocalCommand }, 286 { "localcommand", oLocalCommand },
286 { "permitlocalcommand", oPermitLocalCommand }, 287 { "permitlocalcommand", oPermitLocalCommand },
288 { "remotecommand", oRemoteCommand },
287 { "visualhostkey", oVisualHostKey }, 289 { "visualhostkey", oVisualHostKey },
288 { "kexalgorithms", oKexAlgorithms }, 290 { "kexalgorithms", oKexAlgorithms },
289 { "ipqos", oIPQoS }, 291 { "ipqos", oIPQoS },
@@ -1440,6 +1442,10 @@ parse_keytypes:
1440 intptr = &options->permit_local_command; 1442 intptr = &options->permit_local_command;
1441 goto parse_flag; 1443 goto parse_flag;
1442 1444
1445 case oRemoteCommand:
1446 charptr = &options->remote_command;
1447 goto parse_command;
1448
1443 case oVisualHostKey: 1449 case oVisualHostKey:
1444 intptr = &options->visual_host_key; 1450 intptr = &options->visual_host_key;
1445 goto parse_flag; 1451 goto parse_flag;
@@ -1828,6 +1834,7 @@ initialize_options(Options * options)
1828 options->tun_remote = -1; 1834 options->tun_remote = -1;
1829 options->local_command = NULL; 1835 options->local_command = NULL;
1830 options->permit_local_command = -1; 1836 options->permit_local_command = -1;
1837 options->remote_command = NULL;
1831 options->add_keys_to_agent = -1; 1838 options->add_keys_to_agent = -1;
1832 options->identity_agent = NULL; 1839 options->identity_agent = NULL;
1833 options->visual_host_key = -1; 1840 options->visual_host_key = -1;
@@ -2032,6 +2039,7 @@ fill_default_options(Options * options)
2032 } \ 2039 } \
2033 } while(0) 2040 } while(0)
2034 CLEAR_ON_NONE(options->local_command); 2041 CLEAR_ON_NONE(options->local_command);
2042 CLEAR_ON_NONE(options->remote_command);
2035 CLEAR_ON_NONE(options->proxy_command); 2043 CLEAR_ON_NONE(options->proxy_command);
2036 CLEAR_ON_NONE(options->control_path); 2044 CLEAR_ON_NONE(options->control_path);
2037 CLEAR_ON_NONE(options->revoked_host_keys); 2045 CLEAR_ON_NONE(options->revoked_host_keys);
@@ -2509,6 +2517,7 @@ dump_client_config(Options *o, const char *host)
2509 dump_cfg_string(oKbdInteractiveDevices, o->kbd_interactive_devices); 2517 dump_cfg_string(oKbdInteractiveDevices, o->kbd_interactive_devices);
2510 dump_cfg_string(oKexAlgorithms, o->kex_algorithms ? o->kex_algorithms : KEX_CLIENT_KEX); 2518 dump_cfg_string(oKexAlgorithms, o->kex_algorithms ? o->kex_algorithms : KEX_CLIENT_KEX);
2511 dump_cfg_string(oLocalCommand, o->local_command); 2519 dump_cfg_string(oLocalCommand, o->local_command);
2520 dump_cfg_string(oRemoteCommand, o->remote_command);
2512 dump_cfg_string(oLogLevel, log_level_name(o->log_level)); 2521 dump_cfg_string(oLogLevel, log_level_name(o->log_level));
2513 dump_cfg_string(oMacs, o->macs ? o->macs : KEX_CLIENT_MAC); 2522 dump_cfg_string(oMacs, o->macs ? o->macs : KEX_CLIENT_MAC);
2514#ifdef ENABLE_PKCS11 2523#ifdef ENABLE_PKCS11