summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/auth-options.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2017-09-12 06:32:09 +0000
committerDamien Miller <djm@cvs.openbsd.org>2017-09-12 06:32:09 +0000
commit86e210b5de9cbe2d7a2891527383c0c26cf2ca64 (patch)
tree2617b8f87a44dcbcb57e9e02e6ca70806135be6a /usr.bin/ssh/auth-options.c
parent75d559b3a60b7735d13f16652a3d18cfef49bf89 (diff)
refactor channels.c
Move static state to a "struct ssh_channels" that is allocated at runtime and tracked as a member of struct ssh. Explicitly pass "struct ssh" to all channels functions. Replace use of the legacy packet APIs in channels.c. Rework sshd_config PermitOpen handling: previously the configuration parser would call directly into the channels layer. After the refactor this is not possible, as the channels structures are allocated at connection time and aren't available when the configuration is parsed. The server config parser now tracks PermitOpen itself and explicitly configures the channels code later. ok markus@
Diffstat (limited to 'usr.bin/ssh/auth-options.c')
-rw-r--r--usr.bin/ssh/auth-options.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/ssh/auth-options.c b/usr.bin/ssh/auth-options.c
index 51d30b3ada4..718be7c6aef 100644
--- a/usr.bin/ssh/auth-options.c
+++ b/usr.bin/ssh/auth-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth-options.c,v 1.73 2017/05/31 10:54:00 markus Exp $ */
+/* $OpenBSD: auth-options.c,v 1.74 2017/09/12 06:32:07 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -58,9 +58,13 @@ char *authorized_principals = NULL;
extern ServerOptions options;
+/* XXX refactor to be stateless */
+
void
auth_clear_options(void)
{
+ struct ssh *ssh = active_state; /* XXX */
+
no_agent_forwarding_flag = 0;
no_port_forwarding_flag = 0;
no_pty_flag = 0;
@@ -78,7 +82,7 @@ auth_clear_options(void)
free(authorized_principals);
authorized_principals = NULL;
forced_tun_device = -1;
- channel_clear_permitted_opens();
+ channel_clear_permitted_opens(ssh);
}
/*
@@ -114,6 +118,7 @@ match_flag(const char *opt, int allow_negate, char **optsp, const char *msg)
/*
* return 1 if access is granted, 0 if not.
* side effect: sets key option flags
+ * XXX remove side effects; fill structure instead.
*/
int
auth_parse_options(struct passwd *pw, char *opts, const char *file,
@@ -377,7 +382,7 @@ auth_parse_options(struct passwd *pw, char *opts, const char *file,
goto bad_option;
}
if ((options.allow_tcp_forwarding & FORWARD_LOCAL) != 0)
- channel_add_permitted_opens(host, port);
+ channel_add_permitted_opens(ssh, host, port);
free(patterns);
goto next_option;
}