]> andersk Git - openssh.git/blobdiff - monitor_wrap.c
- (djm) [Makefile.in]
[openssh.git] / monitor_wrap.c
index cd340360a0eb114b36635eae9cff2af39e8d883d..3728e5f55bdf60e8f58a2ef43628a9842b34c7e0 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenBSD: monitor_wrap.c,v 1.48 2006/07/22 20:48:23 stevesk Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos@citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus@openbsd.org>
 
 #include "includes.h"
 
+#include <sys/types.h>
+
 #include <openssl/bn.h>
 #include <openssl/dh.h>
 
+#include <errno.h>
+#include <pwd.h>
+#include <string.h>
+
 #include "ssh.h"
 #include "dh.h"
 #include "kex.h"
@@ -51,7 +58,7 @@
 #include "xmalloc.h"
 #include "atomicio.h"
 #include "monitor_fdpass.h"
-#include "getput.h"
+#include "misc.h"
 #include "servconf.h"
 
 #include "auth.h"
@@ -90,7 +97,7 @@ mm_request_send(int sock, enum monitor_reqtype type, Buffer *m)
 
        debug3("%s entering: type %d", __func__, type);
 
-       PUT_32BIT(buf, mlen + 1);
+       put_u32(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));
@@ -111,7 +118,7 @@ mm_request_receive(int sock, Buffer *m)
                        cleanup_exit(255);
                fatal("%s: read: %s", __func__, strerror(errno));
        }
-       msg_len = GET_32BIT(buf);
+       msg_len = get_u32(buf);
        if (msg_len > 256 * 1024)
                fatal("%s: read: bad msg_len %d", __func__, msg_len);
        buffer_clear(m);
@@ -775,8 +782,11 @@ mm_sshpam_query(void *ctx, char **name, char **info,
        *name = buffer_get_string(&m, NULL);
        *info = buffer_get_string(&m, NULL);
        *num = buffer_get_int(&m);
-       *prompts = xmalloc((*num + 1) * sizeof(char *));
-       *echo_on = xmalloc((*num + 1) * sizeof(u_int));
+       if (*num > PAM_MAX_NUM_MSG)
+               fatal("%s: recieved %u PAM messages, expected <= %u",
+                   __func__, *num, PAM_MAX_NUM_MSG);
+       *prompts = xcalloc((*num + 1), sizeof(char *));
+       *echo_on = xcalloc((*num + 1), sizeof(u_int));
        for (i = 0; i < *num; ++i) {
                (*prompts)[i] = buffer_get_string(&m, NULL);
                (*echo_on)[i] = buffer_get_int(&m);
This page took 0.042388 seconds and 4 git commands to generate.