[openssh-commits] [openssh] 08/20: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Wed May 31 14:57:05 AEST 2017


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 5f4082d886c6173b9e90b9768c9a38a3bfd92c2b
Author: markus at openbsd.org <markus at openbsd.org>
Date:   Tue May 30 14:18:15 2017 +0000

    upstream commit
    
    sshd: pass struct ssh to auth functions; ok djm@
    
    Upstream-ID: b00a80c3460884ebcdd14ef550154c761aebe488
---
 auth2-chall.c |  5 +++--
 auth2-gss.c   | 14 +++++++++-----
 auth2.c       | 14 +++++++++-----
 packet.h      |  5 ++++-
 4 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/auth2-chall.c b/auth2-chall.c
index 4be42128..80f21228 100644
--- a/auth2-chall.c
+++ b/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.
@@ -287,7 +287,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/auth2-gss.c b/auth2-gss.c
index 1ca83577..5bfcb9b4 100644
--- a/auth2-gss.c
+++ b/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.
@@ -129,7 +129,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;
@@ -184,7 +185,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;
@@ -225,7 +227,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))
@@ -252,7 +255,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/auth2.c b/auth2.c
index 97dd2ef0..13ff95ea 100644
--- a/auth2.c
+++ b/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.
  *
@@ -168,16 +168,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);
@@ -212,8 +216,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/packet.h b/packet.h
index b82f45a7..2b8069cd 100644
--- a/packet.h
+++ b/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 at cs.hut.fi>
@@ -77,6 +77,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;
 };

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list