=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/Attic/auth-skey.c,v retrieving revision 1.20 retrieving revision 1.20.14.1 diff -u -r1.20 -r1.20.14.1 --- src/usr.bin/ssh/Attic/auth-skey.c 2002/06/30 21:59:45 1.20 +++ src/usr.bin/ssh/Attic/auth-skey.c 2006/10/06 03:19:32 1.20.14.1 @@ -1,3 +1,4 @@ +/* $OpenBSD: auth-skey.c,v 1.20.14.1 2006/10/06 03:19:32 brad Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * @@ -21,14 +22,19 @@ * (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-skey.c,v 1.20 2002/06/30 21:59:45 deraadt Exp $"); #ifdef SKEY +#include + +#include +#include + #include #include "xmalloc.h" +#include "key.h" +#include "hostfile.h" #include "auth.h" #include "monitor_wrap.h" @@ -43,8 +49,7 @@ u_int* numprompts, char ***prompts, u_int **echo_on) { Authctxt *authctxt = ctx; - char challenge[1024], *p; - int len; + char challenge[1024]; struct skey skey; if (skeychallenge(&skey, authctxt->user, challenge) == -1) @@ -53,15 +58,10 @@ *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)); - len = strlen(challenge) + strlen(SKEY_PROMPT) + 1; - p = xmalloc(len); - strlcpy(p, challenge, len); - strlcat(p, SKEY_PROMPT, len); - (*prompts)[0] = p; + xasprintf(*prompts, "%s%s", challenge, SKEY_PROMPT); return 0; }