version 1.12.4.4, 2002/10/11 14:53:06 |
version 1.13, 2001/12/19 07:18:56 |
|
|
|
|
#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; |
} |
} |
|
|
int |
#define PROMPT "\nS/Key Password: " |
|
|
|
static int |
skey_query(void *ctx, char **name, char **infotxt, |
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) |
{ |
{ |
|
|
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(SKEY_PROMPT) + 1; |
len = strlen(challenge) + strlen(PROMPT) + 1; |
p = xmalloc(len); |
p = xmalloc(len); |
strlcpy(p, challenge, len); |
p[0] = '\0'; |
strlcat(p, SKEY_PROMPT, len); |
strlcat(p, challenge, len); |
|
strlcat(p, PROMPT, len); |
(*prompts)[0] = p; |
(*prompts)[0] = p; |
|
|
return 0; |
return 0; |
} |
} |
|
|
int |
static 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; |
|
|
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 */ |