summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-03-18 01:12:15 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-03-18 01:12:15 +0000
commit3c8963b9265c65ced3c834bbc8f03918116e041e (patch)
treee6d98f3e70cbeb7253b1dcade6cce1ab73686b3b
parent5b901a6d0dac476ac466dc1f4c02b56be12bed5a (diff)
have the authentication functions return the authentication context
and then do_authenticated; okay millert@
-rw-r--r--usr.bin/ssh/auth.h6
-rw-r--r--usr.bin/ssh/auth1.c7
-rw-r--r--usr.bin/ssh/auth2.c7
-rw-r--r--usr.bin/ssh/sshd.c12
4 files changed, 19 insertions, 13 deletions
diff --git a/usr.bin/ssh/auth.h b/usr.bin/ssh/auth.h
index 8fc5b93544d..727c70eea75 100644
--- a/usr.bin/ssh/auth.h
+++ b/usr.bin/ssh/auth.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth.h,v 1.32 2002/03/17 20:25:56 provos Exp $ */
+/* $OpenBSD: auth.h,v 1.33 2002/03/18 01:12:14 provos Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -118,8 +118,8 @@ int auth_krb5_password(Authctxt *authctxt, const char *password);
void krb5_cleanup_proc(void *authctxt);
#endif /* KRB5 */
-void do_authentication(void);
-void do_authentication2(void);
+Authctxt *do_authentication(void);
+Authctxt *do_authentication2(void);
Authctxt *authctxt_new(void);
void auth_log(Authctxt *, int, char *, char *);
diff --git a/usr.bin/ssh/auth1.c b/usr.bin/ssh/auth1.c
index 238e7387a99..8b9b35e15cb 100644
--- a/usr.bin/ssh/auth1.c
+++ b/usr.bin/ssh/auth1.c
@@ -10,7 +10,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth1.c,v 1.36 2002/03/17 20:25:56 provos Exp $");
+RCSID("$OpenBSD: auth1.c,v 1.37 2002/03/18 01:12:14 provos Exp $");
#include "xmalloc.h"
#include "rsa.h"
@@ -318,7 +318,7 @@ do_authloop(Authctxt *authctxt)
* Performs authentication of an incoming connection. Session key has already
* been exchanged and encryption is enabled.
*/
-void
+Authctxt *
do_authentication(void)
{
Authctxt *authctxt;
@@ -375,6 +375,5 @@ do_authentication(void)
packet_send();
packet_write_wait();
- /* Perform session preparation. */
- do_authenticated(authctxt);
+ return (authctxt);
}
diff --git a/usr.bin/ssh/auth2.c b/usr.bin/ssh/auth2.c
index 8a0c39c3454..8ca920ea2c8 100644
--- a/usr.bin/ssh/auth2.c
+++ b/usr.bin/ssh/auth2.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.86 2002/03/17 20:25:56 provos Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.87 2002/03/18 01:12:14 provos Exp $");
#include <openssl/evp.h>
@@ -109,7 +109,7 @@ Authmethod authmethods[] = {
* loop until authctxt->success == TRUE
*/
-void
+Authctxt *
do_authentication2(void)
{
Authctxt *authctxt = authctxt_new();
@@ -123,7 +123,8 @@ do_authentication2(void)
dispatch_init(&dispatch_protocol_error);
dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request);
dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt);
- do_authenticated(authctxt);
+
+ return (authctxt);
}
static void
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 4dfe130f09d..93a5f55faa2 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.229 2002/03/14 16:38:26 markus Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.230 2002/03/18 01:12:14 provos Exp $");
#include <openssl/dh.h>
#include <openssl/bn.h>
@@ -72,6 +72,7 @@ RCSID("$OpenBSD: sshd.c,v 1.229 2002/03/14 16:38:26 markus Exp $");
#include "misc.h"
#include "dispatch.h"
#include "channels.h"
+#include "session.h"
#ifdef LIBWRAP
#include <tcpd.h>
@@ -585,6 +586,7 @@ main(int ac, char **av)
int listen_sock, maxfd;
int startup_p[2];
int startups = 0;
+ Authctxt *authctxt;
Key *key;
int ret, key_used = 0;
@@ -1207,11 +1209,15 @@ main(int ac, char **av)
/* authenticate user and start session */
if (compat20) {
do_ssh2_kex();
- do_authentication2();
+ authctxt = do_authentication2();
} else {
do_ssh1_kex();
- do_authentication();
+ authctxt = do_authentication();
}
+
+ /* Perform session preparation. */
+ do_authenticated(authctxt);
+
/* The connection has been terminated. */
verbose("Closing connection to %.100s", remote_ip);
packet_close();