X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/184eed6a9e5b95e89c2fc77fd9b703a2c50781ee..f69e651d5586a0c9f4a057a69be9981b49bee672:/auth-bsdauth.c?ds=inline diff --git a/auth-bsdauth.c b/auth-bsdauth.c index b70d48f2..0b3262b4 100644 --- a/auth-bsdauth.c +++ b/auth-bsdauth.c @@ -1,3 +1,4 @@ +/* $OpenBSD: auth-bsdauth.c,v 1.11 2007/09/21 08:15:29 djm Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * @@ -21,13 +22,24 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include "includes.h" -RCSID("$OpenBSD: auth-bsdauth.c,v 1.2 2001/12/19 07:18:56 deraadt Exp $"); + +#include + +#include #ifdef BSD_AUTH #include "xmalloc.h" +#include "key.h" +#include "hostfile.h" #include "auth.h" #include "log.h" +#include "buffer.h" +#ifdef GSSAPI +#include "ssh-gss.h" +#endif +#include "monitor_wrap.h" static void * bsdauth_init_ctx(Authctxt *authctxt) @@ -35,7 +47,7 @@ bsdauth_init_ctx(Authctxt *authctxt) return authctxt; } -static int +int bsdauth_query(void *ctx, char **name, char **infotxt, u_int *numprompts, char ***prompts, u_int **echo_on) { @@ -56,7 +68,7 @@ bsdauth_query(void *ctx, char **name, char **infotxt, debug3("bsdauth_query: style %s", authctxt->style ? authctxt->style : ""); authctxt->as = auth_userchallenge(authctxt->user, - authctxt->style, "auth-ssh", &challenge); + authctxt->style, "auth-ssh", &challenge); if (authctxt->as == NULL) challenge = NULL; debug2("bsdauth_query: <%s>", challenge ? challenge : "empty"); @@ -65,23 +77,25 @@ bsdauth_query(void *ctx, char **name, char **infotxt, if (challenge == NULL) return -1; - *name = xstrdup(""); - *infotxt = xstrdup(""); + *name = xstrdup(""); + *infotxt = xstrdup(""); *numprompts = 1; - *prompts = xmalloc(*numprompts * sizeof(char*)); - *echo_on = xmalloc(*numprompts * sizeof(u_int)); - (*echo_on)[0] = 0; + *prompts = xcalloc(*numprompts, sizeof(char *)); + *echo_on = xcalloc(*numprompts, sizeof(u_int)); (*prompts)[0] = xstrdup(challenge); return 0; } -static int +int bsdauth_respond(void *ctx, u_int numresponses, char **responses) { Authctxt *authctxt = ctx; int authok; + if (!authctxt->valid) + return -1; + if (authctxt->as == 0) error("bsdauth_respond: no bsd auth session"); @@ -113,4 +127,12 @@ KbdintDevice bsdauth_device = { bsdauth_respond, bsdauth_free_ctx }; + +KbdintDevice mm_bsdauth_device = { + "bsdauth", + bsdauth_init_ctx, + mm_bsdauth_query, + mm_bsdauth_respond, + bsdauth_free_ctx +}; #endif