=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/monitor_wrap.c,v retrieving revision 1.40.4.1 retrieving revision 1.41 diff -u -r1.40.4.1 -r1.41 --- src/usr.bin/ssh/monitor_wrap.c 2006/09/30 04:06:50 1.40.4.1 +++ src/usr.bin/ssh/monitor_wrap.c 2006/03/19 18:51:18 1.41 @@ -1,4 +1,3 @@ -/* $OpenBSD: monitor_wrap.c,v 1.40.4.1 2006/09/30 04:06:50 brad Exp $ */ /* * Copyright 2002 Niels Provos * Copyright 2002 Markus Friedl @@ -25,45 +24,37 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include "includes.h" #include #include -#include -#include -#include -#include -#include -#include - -#include "xmalloc.h" #include "ssh.h" #include "dh.h" -#include "buffer.h" -#include "key.h" -#include "cipher.h" #include "kex.h" -#include "hostfile.h" #include "auth.h" #include "auth-options.h" +#include "buffer.h" +#include "bufaux.h" #include "packet.h" #include "mac.h" #include "log.h" -#include +#include "zlib.h" #include "monitor.h" -#ifdef GSSAPI -#include "ssh-gss.h" -#endif #include "monitor_wrap.h" +#include "xmalloc.h" #include "atomicio.h" #include "monitor_fdpass.h" -#include "misc.h" +#include "getput.h" +#include "auth.h" #include "channels.h" #include "session.h" +#ifdef GSSAPI +#include "ssh-gss.h" +#endif + /* Imports */ extern int compat20; extern Newkeys *newkeys[]; @@ -91,7 +82,7 @@ debug3("%s entering: type %d", __func__, type); - put_u32(buf, mlen + 1); + PUT_32BIT(buf, mlen + 1); buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf)) fatal("%s: write: %s", __func__, strerror(errno)); @@ -112,7 +103,7 @@ cleanup_exit(255); fatal("%s: read: %s", __func__, strerror(errno)); } - msg_len = get_u32(buf); + msg_len = GET_32BIT(buf); if (msg_len > 256 * 1024) fatal("%s: read: bad msg_len %d", __func__, msg_len); buffer_clear(m); @@ -635,7 +626,7 @@ } int -mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, size_t namebuflen) +mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) { Buffer m; char *p, *msg; @@ -729,8 +720,8 @@ *name = xstrdup(""); *infotxt = xstrdup(""); *numprompts = 1; - *prompts = xcalloc(*numprompts, sizeof(char *)); - *echo_on = xcalloc(*numprompts, sizeof(u_int)); + *prompts = xmalloc(*numprompts * sizeof(char *)); + *echo_on = xmalloc(*numprompts * sizeof(u_int)); (*echo_on)[0] = 0; } @@ -797,8 +788,9 @@ u_int *numprompts, char ***prompts, u_int **echo_on) { Buffer m; + int len; u_int success; - char *challenge; + char *p, *challenge; debug3("%s: entering", __func__); @@ -822,7 +814,11 @@ mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); - xasprintf(*prompts, "%s%s", challenge, SKEY_PROMPT); + len = strlen(challenge) + strlen(SKEY_PROMPT) + 1; + p = xmalloc(len); + strlcpy(p, challenge, len); + strlcat(p, SKEY_PROMPT, len); + (*prompts)[0] = p; xfree(challenge); return (0);