version 1.12, 2001/05/18 14:13:28 |
version 1.12.4.3, 2002/06/22 07:23:16 |
|
|
|
|
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "auth.h" |
#include "auth.h" |
|
#include "monitor_wrap.h" |
|
|
static void * |
static void * |
skey_init_ctx(Authctxt *authctxt) |
skey_init_ctx(Authctxt *authctxt) |
|
|
return authctxt; |
return authctxt; |
} |
} |
|
|
#define PROMPT "\nS/Key Password: " |
int |
|
skey_query(void *ctx, char **name, char **infotxt, |
static int |
|
skey_query(void *ctx, char **name, char **infotxt, |
|
u_int* numprompts, char ***prompts, u_int **echo_on) |
u_int* numprompts, char ***prompts, u_int **echo_on) |
{ |
{ |
Authctxt *authctxt = ctx; |
Authctxt *authctxt = ctx; |
|
|
if (skeychallenge(&skey, authctxt->user, challenge) == -1) |
if (skeychallenge(&skey, authctxt->user, challenge) == -1) |
return -1; |
return -1; |
|
|
*name = xstrdup(""); |
*name = xstrdup(""); |
*infotxt = xstrdup(""); |
*infotxt = xstrdup(""); |
*numprompts = 1; |
*numprompts = 1; |
*prompts = xmalloc(*numprompts * sizeof(char*)); |
*prompts = xmalloc(*numprompts * sizeof(char*)); |
*echo_on = xmalloc(*numprompts * sizeof(u_int)); |
*echo_on = xmalloc(*numprompts * sizeof(u_int)); |
(*echo_on)[0] = 0; |
(*echo_on)[0] = 0; |
|
|
len = strlen(challenge) + strlen(PROMPT) + 1; |
len = strlen(challenge) + strlen(SKEY_PROMPT) + 1; |
p = xmalloc(len); |
p = xmalloc(len); |
p[0] = '\0'; |
strlcpy(p, challenge, len); |
strlcat(p, challenge, len); |
strlcat(p, SKEY_PROMPT, len); |
strlcat(p, PROMPT, len); |
|
(*prompts)[0] = p; |
(*prompts)[0] = p; |
|
|
return 0; |
return 0; |
} |
} |
|
|
static int |
int |
skey_respond(void *ctx, u_int numresponses, char **responses) |
skey_respond(void *ctx, u_int numresponses, char **responses) |
{ |
{ |
Authctxt *authctxt = ctx; |
Authctxt *authctxt = ctx; |
|
|
if (authctxt->valid && |
if (authctxt->valid && |
numresponses == 1 && |
numresponses == 1 && |
skey_haskey(authctxt->pw->pw_name) == 0 && |
skey_haskey(authctxt->pw->pw_name) == 0 && |
skey_passcheck(authctxt->pw->pw_name, responses[0]) != -1) |
skey_passcheck(authctxt->pw->pw_name, responses[0]) != -1) |
return 0; |
return 0; |
|
|
skey_init_ctx, |
skey_init_ctx, |
skey_query, |
skey_query, |
skey_respond, |
skey_respond, |
|
skey_free_ctx |
|
}; |
|
|
|
KbdintDevice mm_skey_device = { |
|
"skey", |
|
skey_init_ctx, |
|
mm_skey_query, |
|
mm_skey_respond, |
skey_free_ctx |
skey_free_ctx |
}; |
}; |
#endif /* SKEY */ |
#endif /* SKEY */ |