summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-15 12:01:28 +1000
committerDamien Miller <djm@mindrot.org>2003-05-15 12:01:28 +1000
commitf842fcb296b9fbc0de905837c6074c732db550e5 (patch)
tree31b0d0e1d09e8c7b15112f4d79b78541aa0fc088
parent9d2be48b8fe5c3f54e932e578e3029ebe0a773fb (diff)
- markus@cvs.openbsd.org 2003/05/15 00:28:28
[sshconnect2.c] cleanup unregister of per-method packet handlers; ok djm@
-rw-r--r--ChangeLog5
-rw-r--r--sshconnect2.c25
2 files changed, 14 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 590a3f6c4..a6e2446e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@
13 - markus@cvs.openbsd.org 2003/05/14 22:24:42 13 - markus@cvs.openbsd.org 2003/05/14 22:24:42
14 [clientloop.c session.c ssh.1] 14 [clientloop.c session.c ssh.1]
15 allow to send a BREAK to the remote system; ok various 15 allow to send a BREAK to the remote system; ok various
16 - markus@cvs.openbsd.org 2003/05/15 00:28:28
17 [sshconnect2.c]
18 cleanup unregister of per-method packet handlers; ok djm@
16 - (djm) Configure glue for DNS support (code doesn't work in portable yet) 19 - (djm) Configure glue for DNS support (code doesn't work in portable yet)
17 20
1820030514 2120030514
@@ -1489,4 +1492,4 @@
1489 save auth method before monitor_reset_key_state(); bugzilla bug #284; 1492 save auth method before monitor_reset_key_state(); bugzilla bug #284;
1490 ok provos@ 1493 ok provos@
1491 1494
1492$Id: ChangeLog,v 1.2704 2003/05/15 00:53:49 djm Exp $ 1495$Id: ChangeLog,v 1.2705 2003/05/15 02:01:28 djm Exp $
diff --git a/sshconnect2.c b/sshconnect2.c
index 36d592b42..1b85730fe 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: sshconnect2.c,v 1.118 2003/05/14 02:15:47 markus Exp $"); 26RCSID("$OpenBSD: sshconnect2.c,v 1.119 2003/05/15 00:28:28 markus Exp $");
27 27
28#ifdef KRB5 28#ifdef KRB5
29#include <krb5.h> 29#include <krb5.h>
@@ -204,7 +204,6 @@ int userauth_kerberos(Authctxt *);
204void userauth(Authctxt *, char *); 204void userauth(Authctxt *, char *);
205 205
206static int sign_and_send_pubkey(Authctxt *, Identity *); 206static int sign_and_send_pubkey(Authctxt *, Identity *);
207static void clear_auth_state(Authctxt *);
208static void pubkey_prepare(Authctxt *); 207static void pubkey_prepare(Authctxt *);
209static void pubkey_cleanup(Authctxt *); 208static void pubkey_cleanup(Authctxt *);
210static Key *load_identity_file(char *); 209static Key *load_identity_file(char *);
@@ -299,8 +298,11 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
299 dispatch_run(DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */ 298 dispatch_run(DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */
300 299
301 pubkey_cleanup(&authctxt); 300 pubkey_cleanup(&authctxt);
301 dispatch_range(SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL);
302
302 debug("Authentication succeeded (%s).", authctxt.method->name); 303 debug("Authentication succeeded (%s).", authctxt.method->name);
303} 304}
305
304void 306void
305userauth(Authctxt *authctxt, char *authlist) 307userauth(Authctxt *authctxt, char *authlist)
306{ 308{
@@ -316,6 +318,12 @@ userauth(Authctxt *authctxt, char *authlist)
316 if (method == NULL) 318 if (method == NULL)
317 fatal("Permission denied (%s).", authlist); 319 fatal("Permission denied (%s).", authlist);
318 authctxt->method = method; 320 authctxt->method = method;
321
322 /* reset the per method handler */
323 dispatch_range(SSH2_MSG_USERAUTH_PER_METHOD_MIN,
324 SSH2_MSG_USERAUTH_PER_METHOD_MAX, NULL);
325
326 /* and try new method */
319 if (method->userauth(authctxt) != 0) { 327 if (method->userauth(authctxt) != 0) {
320 debug2("we sent a %s packet, wait for reply", method->name); 328 debug2("we sent a %s packet, wait for reply", method->name);
321 break; 329 break;
@@ -353,7 +361,6 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt)
353 fatal("input_userauth_success: no authentication context"); 361 fatal("input_userauth_success: no authentication context");
354 if (authctxt->authlist) 362 if (authctxt->authlist)
355 xfree(authctxt->authlist); 363 xfree(authctxt->authlist);
356 clear_auth_state(authctxt);
357 authctxt->success = 1; /* break out */ 364 authctxt->success = 1; /* break out */
358} 365}
359 366
@@ -375,7 +382,6 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt)
375 logit("Authenticated with partial success."); 382 logit("Authenticated with partial success.");
376 debug("Authentications that can continue: %s", authlist); 383 debug("Authentications that can continue: %s", authlist);
377 384
378 clear_auth_state(authctxt);
379 userauth(authctxt, authlist); 385 userauth(authctxt, authlist);
380} 386}
381void 387void
@@ -438,10 +444,6 @@ done:
438 xfree(pkalg); 444 xfree(pkalg);
439 xfree(pkblob); 445 xfree(pkblob);
440 446
441 /* unregister */
442 clear_auth_state(authctxt);
443 dispatch_set(SSH2_MSG_USERAUTH_PK_OK, NULL);
444
445 /* try another method if we did not send a packet */ 447 /* try another method if we did not send a packet */
446 if (sent == 0) 448 if (sent == 0)
447 userauth(authctxt, NULL); 449 userauth(authctxt, NULL);
@@ -558,13 +560,6 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt)
558 &input_userauth_passwd_changereq); 560 &input_userauth_passwd_changereq);
559} 561}
560 562
561static void
562clear_auth_state(Authctxt *authctxt)
563{
564 /* XXX clear authentication state */
565 dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, NULL);
566}
567
568static int 563static int
569identity_sign(Identity *id, u_char **sigp, u_int *lenp, 564identity_sign(Identity *id, u_char **sigp, u_int *lenp,
570 u_char *data, u_int datalen) 565 u_char *data, u_int datalen)