View | Details | Raw Unified | Return to bug 2642 | Differences between
and this patch

Collapse All | Expand All

(-)a/sshconnect2.c (-3 / +29 lines)
Lines 309-314 void userauth(Authctxt *, char *); Link Here
309
309
310
static int sign_and_send_pubkey(Authctxt *, Identity *);
310
static int sign_and_send_pubkey(Authctxt *, Identity *);
311
static void pubkey_prepare(Authctxt *);
311
static void pubkey_prepare(Authctxt *);
312
static void pubkey_reset(Authctxt *);
312
static void pubkey_cleanup(Authctxt *);
313
static void pubkey_cleanup(Authctxt *);
313
static Key *load_identity_file(Identity *);
314
static Key *load_identity_file(Identity *);
314
315
Lines 551-559 input_userauth_failure(int type, u_int32_t seq, void *ctxt) Link Here
551
552
552
	if (partial != 0) {
553
	if (partial != 0) {
553
		verbose("Authenticated with partial success.");
554
		verbose("Authenticated with partial success.");
554
		/* reset state */
555
		pubkey_reset(authctxt);
555
		pubkey_cleanup(authctxt);
556
		pubkey_prepare(authctxt);
557
	}
556
	}
558
	debug("Authentications that can continue: %s", authlist);
557
	debug("Authentications that can continue: %s", authlist);
559
558
Lines 1390-1395 pubkey_prepare(Authctxt *authctxt) Link Here
1390
	}
1389
	}
1391
}
1390
}
1392
1391
1392
/* Reorder keys to try after partial authentication success */
1393
static void
1394
pubkey_reset(Authctxt *authctxt)
1395
{
1396
	Identity *id, *id2;
1397
	struct idlist tried, untried;
1398
1399
	TAILQ_INIT(&tried);
1400
	TAILQ_INIT(&untried);
1401
1402
	TAILQ_FOREACH_SAFE(id, &authctxt->keys, next, id2) {
1403
		struct idlist *which = id->tried ? &tried : &untried;
1404
		id->tried = 0;
1405
		TAILQ_REMOVE(&authctxt->keys, id, next);
1406
		TAILQ_INSERT_TAIL(which, id, next);
1407
	}
1408
	/* Prefer keys that have not already been tried */
1409
	TAILQ_FOREACH_SAFE(id, &untried, next, id2) {
1410
		TAILQ_REMOVE(&tried, id, next);
1411
		TAILQ_INSERT_TAIL(&authctxt->keys, id, next);
1412
	}
1413
	TAILQ_FOREACH_SAFE(id, &tried, next, id2) {
1414
		TAILQ_REMOVE(&tried, id, next);
1415
		TAILQ_INSERT_TAIL(&authctxt->keys, id, next);
1416
	}
1417
}
1418
1393
static void
1419
static void
1394
pubkey_cleanup(Authctxt *authctxt)
1420
pubkey_cleanup(Authctxt *authctxt)
1395
{
1421
{

Return to bug 2642