X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/1853d1ef0d12e0942aca46cf9e6af2c69804d0a7..575a5eced126099bed926a05ff174b7a8c9f1612:/auth-bsdauth.c diff --git a/auth-bsdauth.c b/auth-bsdauth.c index fa06732c..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,23 @@ * (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.3 2002/03/18 17:50:31 provos 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 * @@ -57,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"); @@ -66,12 +77,11 @@ 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; @@ -83,6 +93,9 @@ 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");