summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-09-20 00:57:55 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-09-20 00:57:55 +0000
commit2b7a0e953e3e85c2d95cfb6b4bed095135c3a2b7 (patch)
treea059e0bd658419103c94c154ee12b19ed3da48b2 /readconf.c
parent309f3d1d9c6a8f480de33a21f61809c14da97bdd (diff)
- stevesk@cvs.openbsd.org 2001/09/19 19:24:19
[readconf.c readconf.h scp.c sftp.c ssh.1] add ClearAllForwardings ssh option and set it in scp and sftp; ok markus@
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c
index 6a426ae05..83069d3ad 100644
--- a/readconf.c
+++ b/readconf.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: readconf.c,v 1.89 2001/09/03 20:58:33 stevesk Exp $"); 15RCSID("$OpenBSD: readconf.c,v 1.90 2001/09/19 19:24:18 stevesk Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -114,7 +114,8 @@ typedef enum {
114 oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication, 114 oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication,
115 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias, 115 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias,
116 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication, 116 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication,
117 oHostKeyAlgorithms, oBindAddress, oSmartcardDevice 117 oHostKeyAlgorithms, oBindAddress, oSmartcardDevice,
118 oClearAllForwardings
118} OpCodes; 119} OpCodes;
119 120
120/* Textual representations of the tokens. */ 121/* Textual representations of the tokens. */
@@ -184,6 +185,7 @@ static struct {
184 { "hostkeyalgorithms", oHostKeyAlgorithms }, 185 { "hostkeyalgorithms", oHostKeyAlgorithms },
185 { "bindaddress", oBindAddress }, 186 { "bindaddress", oBindAddress },
186 { "smartcarddevice", oSmartcardDevice }, 187 { "smartcarddevice", oSmartcardDevice },
188 { "clearallforwardings", oClearAllForwardings },
187 { NULL, 0 } 189 { NULL, 0 }
188}; 190};
189 191
@@ -229,6 +231,19 @@ add_remote_forward(Options *options, u_short port, const char *host,
229 fwd->host_port = host_port; 231 fwd->host_port = host_port;
230} 232}
231 233
234static void
235clear_forwardings(Options *options)
236{
237 int i;
238
239 for (i = 0; i < options->num_local_forwards; i++)
240 xfree(options->local_forwards[i].host);
241 options->num_local_forwards = 0;
242 for (i = 0; i < options->num_remote_forwards; i++)
243 xfree(options->remote_forwards[i].host);
244 options->num_remote_forwards = 0;
245}
246
232/* 247/*
233 * Returns the number of the token pointed to by cp or oBadOption. 248 * Returns the number of the token pointed to by cp or oBadOption.
234 */ 249 */
@@ -621,6 +636,10 @@ parse_int:
621 add_local_forward(options, fwd_port, "socks4", 0); 636 add_local_forward(options, fwd_port, "socks4", 0);
622 break; 637 break;
623 638
639 case oClearAllForwardings:
640 intptr = &options->clear_forwardings;
641 goto parse_flag;
642
624 case oHost: 643 case oHost:
625 *activep = 0; 644 *activep = 0;
626 while ((arg = strdelim(&s)) != NULL && *arg != '\0') 645 while ((arg = strdelim(&s)) != NULL && *arg != '\0')
@@ -769,6 +788,7 @@ initialize_options(Options * options)
769 options->user_hostfile2 = NULL; 788 options->user_hostfile2 = NULL;
770 options->num_local_forwards = 0; 789 options->num_local_forwards = 0;
771 options->num_remote_forwards = 0; 790 options->num_remote_forwards = 0;
791 options->clear_forwardings = -1;
772 options->log_level = (LogLevel) - 1; 792 options->log_level = (LogLevel) - 1;
773 options->preferred_authentications = NULL; 793 options->preferred_authentications = NULL;
774 options->bind_address = NULL; 794 options->bind_address = NULL;
@@ -889,6 +909,8 @@ fill_default_options(Options * options)
889 options->user_hostfile2 = _PATH_SSH_USER_HOSTFILE2; 909 options->user_hostfile2 = _PATH_SSH_USER_HOSTFILE2;
890 if (options->log_level == (LogLevel) - 1) 910 if (options->log_level == (LogLevel) - 1)
891 options->log_level = SYSLOG_LEVEL_INFO; 911 options->log_level = SYSLOG_LEVEL_INFO;
912 if (options->clear_forwardings == 1)
913 clear_forwardings(options);
892 /* options->proxy_command should not be set by default */ 914 /* options->proxy_command should not be set by default */
893 /* options->user will be set in the main program if appropriate */ 915 /* options->user will be set in the main program if appropriate */
894 /* options->hostname will be set in the main program if appropriate */ 916 /* options->hostname will be set in the main program if appropriate */