*** /usr/src/redhat/BUILD/openssh-3.1p1/auth-skey.c 2002/03/11 19:56:10 1.1 --- /usr/src/redhat/BUILD/openssh-3.1p1/auth-skey.c 2002/03/11 20:07:45 1.2 *************** *** 31,40 **** #include "xmalloc.h" #include "auth.h" static void * skey_init_ctx(Authctxt *authctxt) { ! return authctxt; } #define PROMPT "\nS/Key Password: " --- 31,48 ---- #include "xmalloc.h" #include "auth.h" + struct ctx { + Authctxt *authctxt; + struct skey skey; + }; + static void * skey_init_ctx(Authctxt *authctxt) { ! struct ctx* ctxp= malloc (sizeof (struct ctx)); ! ctxp->authctxt= authctxt; ! memset( &ctxp->skey, 0, sizeof (struct skey)); ! return ctxp; } #define PROMPT "\nS/Key Password: " *************** *** 43,54 **** skey_query(void *ctx, char **name, char **infotxt, u_int* numprompts, char ***prompts, u_int **echo_on) { ! Authctxt *authctxt = ctx; char challenge[1024], *p; int len; - struct skey skey; ! if (skeychallenge(&skey, authctxt->user, challenge) == -1) return -1; *name = xstrdup(""); --- 51,62 ---- skey_query(void *ctx, char **name, char **infotxt, u_int* numprompts, char ***prompts, u_int **echo_on) { ! struct ctx* ctxp= (struct ctx*)ctx; ! Authctxt *authctxt = ctxp->authctxt; char challenge[1024], *p; int len; ! if (skeychallenge(&ctxp->skey, authctxt->user, challenge) == -1) return -1; *name = xstrdup(""); *************** *** 70,81 **** static int skey_respond(void *ctx, u_int numresponses, char **responses) { ! Authctxt *authctxt = ctx; if (authctxt->valid && numresponses == 1 && ! skey_haskey(authctxt->pw->pw_name) == 0 && ! skey_passcheck(authctxt->pw->pw_name, responses[0]) != -1) return 0; return -1; } --- 78,89 ---- static int skey_respond(void *ctx, u_int numresponses, char **responses) { ! struct ctx* ctxp= (struct ctx*)ctx; ! Authctxt *authctxt = ctxp->authctxt; if (authctxt->valid && numresponses == 1 && ! skeyverify(&ctxp->skey, /*authctxt->pw->pw_name,*/ responses[0]) == 0) return 0; return -1; } *************** *** 83,89 **** static void skey_free_ctx(void *ctx) { ! /* we don't have a special context */ } KbdintDevice skey_device = { --- 91,97 ---- static void skey_free_ctx(void *ctx) { ! free( ctx ); } KbdintDevice skey_device = {