- (djm) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2003/11/03 09:03:37 [auth-chall.c] make this a little more idiot-proof; ok markus@ (includes portable-specific changes)
This commit is contained in:
parent
203c40b513
commit
3e8f41e6ac
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,11 @@
|
||||||
|
20031117
|
||||||
|
- (djm) OpenBSD CVS Sync
|
||||||
|
- djm@cvs.openbsd.org 2003/11/03 09:03:37
|
||||||
|
[auth-chall.c]
|
||||||
|
make this a little more idiot-proof; ok markus@
|
||||||
|
(includes portable-specific changes)
|
||||||
|
|
||||||
|
|
||||||
20031115
|
20031115
|
||||||
- (dtucker) [regress/agent-ptrace.sh] Test for GDB output from Solaris and
|
- (dtucker) [regress/agent-ptrace.sh] Test for GDB output from Solaris and
|
||||||
HP-UX, skip test on AIX.
|
HP-UX, skip test on AIX.
|
||||||
|
@ -1417,4 +1425,4 @@
|
||||||
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
|
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
|
||||||
Report from murple@murple.net, diagnosis from dtucker@zip.com.au
|
Report from murple@murple.net, diagnosis from dtucker@zip.com.au
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.3097 2003/11/15 01:13:16 dtucker Exp $
|
$Id: ChangeLog,v 1.3098 2003/11/17 10:09:50 djm Exp $
|
||||||
|
|
44
auth-chall.c
44
auth-chall.c
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: auth-chall.c,v 1.8 2001/05/18 14:13:28 markus Exp $");
|
RCSID("$OpenBSD: auth-chall.c,v 1.9 2003/11/03 09:03:37 djm Exp $");
|
||||||
|
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
@ -67,36 +67,38 @@ get_challenge(Authctxt *authctxt)
|
||||||
int
|
int
|
||||||
verify_response(Authctxt *authctxt, const char *response)
|
verify_response(Authctxt *authctxt, const char *response)
|
||||||
{
|
{
|
||||||
char *resp[1];
|
char *resp[1], *name, *info, **prompts;
|
||||||
int res;
|
u_int i, numprompts, *echo_on;
|
||||||
|
int authenticated = 0;
|
||||||
|
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
if (authctxt->kbdintctxt == NULL)
|
if (authctxt->kbdintctxt == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
resp[0] = (char *)response;
|
resp[0] = (char *)response;
|
||||||
res = device->respond(authctxt->kbdintctxt, 1, resp);
|
switch (device->respond(authctxt->kbdintctxt, 1, resp)) {
|
||||||
if (res == 1) {
|
case 0: /* Success */
|
||||||
/* postponed - send a null query just in case */
|
authenticated = 1;
|
||||||
char *name, *info, **prompts;
|
break;
|
||||||
u_int i, numprompts, *echo_on;
|
case 1: /* Postponed - retry with empty query for PAM */
|
||||||
|
if ((device->query(authctxt->kbdintctxt, &name, &info,
|
||||||
|
&numprompts, &prompts, &echo_on)) != 0)
|
||||||
|
break;
|
||||||
|
if (numprompts == 0 &&
|
||||||
|
device->respond(authctxt->kbdintctxt, 0, resp) == 0)
|
||||||
|
authenticated = 1;
|
||||||
|
|
||||||
res = device->query(authctxt->kbdintctxt, &name, &info,
|
for (i = 0; i < numprompts; i++)
|
||||||
&numprompts, &prompts, &echo_on);
|
xfree(prompts[i]);
|
||||||
if (res == 0) {
|
xfree(prompts);
|
||||||
for (i = 0; i < numprompts; i++)
|
xfree(name);
|
||||||
xfree(prompts[i]);
|
xfree(echo_on);
|
||||||
xfree(prompts);
|
xfree(info);
|
||||||
xfree(name);
|
break;
|
||||||
xfree(echo_on);
|
|
||||||
xfree(info);
|
|
||||||
}
|
|
||||||
/* if we received more prompts, we're screwed */
|
|
||||||
res = (res == 0 && numprompts == 0) ? 0 : -1;
|
|
||||||
}
|
}
|
||||||
device->free_ctx(authctxt->kbdintctxt);
|
device->free_ctx(authctxt->kbdintctxt);
|
||||||
authctxt->kbdintctxt = NULL;
|
authctxt->kbdintctxt = NULL;
|
||||||
return res ? 0 : 1;
|
return authenticated;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
abandon_challenge_response(Authctxt *authctxt)
|
abandon_challenge_response(Authctxt *authctxt)
|
||||||
|
|
Loading…
Reference in New Issue