summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2017-05-30 14:18:15 +0000
committermarkus <markus@openbsd.org>2017-05-30 14:18:15 +0000
commitbd5af9a54a976077c2ffcd66cfc1bf7469b0321c (patch)
tree946c4dcaa2a5c6cf3a1733b9cc9574ae99ca8a06
parentremove unused wrapper functions from key.[ch]; ok djm@ (diff)
downloadwireguard-openbsd-bd5af9a54a976077c2ffcd66cfc1bf7469b0321c.tar.xz
wireguard-openbsd-bd5af9a54a976077c2ffcd66cfc1bf7469b0321c.zip
sshd: pass struct ssh to auth functions; ok djm@
-rw-r--r--usr.bin/ssh/auth2-chall.c5
-rw-r--r--usr.bin/ssh/auth2-gss.c14
-rw-r--r--usr.bin/ssh/auth2.c14
-rw-r--r--usr.bin/ssh/packet.h5
4 files changed, 25 insertions, 13 deletions
diff --git a/usr.bin/ssh/auth2-chall.c b/usr.bin/ssh/auth2-chall.c
index 94beb26e8fb..ef3369f646a 100644
--- a/usr.bin/ssh/auth2-chall.c
+++ b/usr.bin/ssh/auth2-chall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-chall.c,v 1.45 2017/05/30 08:49:58 markus Exp $ */
+/* $OpenBSD: auth2-chall.c,v 1.46 2017/05/30 14:18:15 markus Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2001 Per Allansson. All rights reserved.
@@ -241,7 +241,8 @@ send_userauth_info_request(Authctxt *authctxt)
static int
input_userauth_info_response(int type, u_int32_t seq, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
KbdintAuthctxt *kbdintctxt;
int authenticated = 0, res;
u_int i, nresp;
diff --git a/usr.bin/ssh/auth2-gss.c b/usr.bin/ssh/auth2-gss.c
index d003551ce83..3a958398dcc 100644
--- a/usr.bin/ssh/auth2-gss.c
+++ b/usr.bin/ssh/auth2-gss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 markus Exp $ */
+/* $OpenBSD: auth2-gss.c,v 1.23 2017/05/30 14:18:15 markus Exp $ */
/*
* Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -124,7 +124,8 @@ userauth_gssapi(Authctxt *authctxt)
static int
input_gssapi_token(int type, u_int32_t plen, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
Gssctxt *gssctxt;
gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
gss_buffer_desc recv_tok;
@@ -179,7 +180,8 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt)
static int
input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
Gssctxt *gssctxt;
gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
gss_buffer_desc recv_tok;
@@ -220,7 +222,8 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
static int
input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
int authenticated;
if (authctxt == NULL || (authctxt->methoddata == NULL && !use_privsep))
@@ -247,7 +250,8 @@ input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt)
static int
input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
Gssctxt *gssctxt;
int authenticated = 0;
Buffer b;
diff --git a/usr.bin/ssh/auth2.c b/usr.bin/ssh/auth2.c
index e163c8ea67e..f019f7def4c 100644
--- a/usr.bin/ssh/auth2.c
+++ b/usr.bin/ssh/auth2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2.c,v 1.137 2017/02/03 23:05:57 djm Exp $ */
+/* $OpenBSD: auth2.c,v 1.138 2017/05/30 14:18:15 markus Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
@@ -155,16 +155,20 @@ done:
void
do_authentication2(Authctxt *authctxt)
{
+ struct ssh *ssh = active_state; /* XXX */
+ ssh->authctxt = authctxt; /* XXX move to caller */
dispatch_init(&dispatch_protocol_error);
dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request);
- dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt);
+ dispatch_run(DISPATCH_BLOCK, &authctxt->success, ssh);
+ ssh->authctxt = NULL;
}
/*ARGSUSED*/
static int
input_service_request(int type, u_int32_t seq, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
u_int len;
int acceptit = 0;
char *service = packet_get_cstring(&len);
@@ -199,8 +203,8 @@ input_service_request(int type, u_int32_t seq, void *ctxt)
static int
input_userauth_request(int type, u_int32_t seq, void *ctxt)
{
- struct ssh *ssh = active_state; /* XXX */
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
Authmethod *m = NULL;
char *user, *service, *method, *style = NULL;
int authenticated = 0;
diff --git a/usr.bin/ssh/packet.h b/usr.bin/ssh/packet.h
index d46424c63d0..978b3a3fb5b 100644
--- a/usr.bin/ssh/packet.h
+++ b/usr.bin/ssh/packet.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.h,v 1.79 2017/05/03 21:08:09 naddy Exp $ */
+/* $OpenBSD: packet.h,v 1.80 2017/05/30 14:18:15 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -63,6 +63,9 @@ struct ssh {
TAILQ_HEAD(, key_entry) private_keys;
TAILQ_HEAD(, key_entry) public_keys;
+ /* Client/Server authentication context */
+ void *authctxt;
+
/* APP data */
void *app_data;
};