]> andersk Git - openssh.git/blobdiff - auth2-chall.c
- djm@cvs.openbsd.org 2010/01/27 19:21:39
[openssh.git] / auth2-chall.c
index 384a543ee4e4e8450e64645c5935b62e061d2cd5..e6dbffe22b91cf0eb42c8d90e86e401bc5854b32 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenBSD: auth2-chall.c,v 1.34 2008/12/09 04:32:22 djm Exp $ */
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
  * Copyright (c) 2001 Per Allansson.  All rights reserved.
  * (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: auth2-chall.c,v 1.22 2005/01/19 13:11:47 dtucker Exp $");
 
+#include <sys/types.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "xmalloc.h"
 #include "ssh2.h"
+#include "key.h"
+#include "hostfile.h"
 #include "auth.h"
 #include "buffer.h"
 #include "packet.h"
-#include "xmalloc.h"
 #include "dispatch.h"
 #include "log.h"
 #include "servconf.h"
@@ -167,7 +176,7 @@ kbdint_next_device(KbdintAuthctxt *kbdintctxt)
                kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL;
                xfree(t);
                debug2("kbdint_next_device: devices %s", kbdintctxt->devices ?
-                  kbdintctxt->devices : "<empty>");
+                   kbdintctxt->devices : "<empty>");
        } while (kbdintctxt->devices && !kbdintctxt->device);
 
        return kbdintctxt->device ? 1 : 0;
@@ -197,7 +206,7 @@ auth2_challenge_stop(Authctxt *authctxt)
 {
        /* unregister callback */
        dispatch_set(SSH2_MSG_USERAUTH_INFO_RESPONSE, NULL);
-       if (authctxt->kbdintctxt != NULL)  {
+       if (authctxt->kbdintctxt != NULL) {
                kbdint_free(authctxt->kbdintctxt);
                authctxt->kbdintctxt = NULL;
        }
@@ -239,8 +248,7 @@ send_userauth_info_request(Authctxt *authctxt)
 {
        KbdintAuthctxt *kbdintctxt;
        char *name, *instr, **prompts;
-       int i;
-       u_int *echo_on;
+       u_int i, *echo_on;
 
        kbdintctxt = authctxt->kbdintctxt;
        if (kbdintctxt->device->query(kbdintctxt->ctxt,
@@ -273,8 +281,8 @@ input_userauth_info_response(int type, u_int32_t seq, void *ctxt)
 {
        Authctxt *authctxt = ctxt;
        KbdintAuthctxt *kbdintctxt;
-       int i, authenticated = 0, res, len;
-       u_int nresp;
+       int authenticated = 0, res;
+       u_int i, nresp;
        char **response = NULL, *method;
 
        if (authctxt == NULL)
@@ -292,7 +300,7 @@ input_userauth_info_response(int type, u_int32_t seq, void *ctxt)
        if (nresp > 100)
                fatal("input_userauth_info_response: too many replies");
        if (nresp > 0) {
-               response = xmalloc(nresp * sizeof(char *));
+               response = xcalloc(nresp, sizeof(char *));
                for (i = 0; i < nresp; i++)
                        response[i] = packet_get_string(NULL);
        }
@@ -322,11 +330,7 @@ input_userauth_info_response(int type, u_int32_t seq, void *ctxt)
                break;
        }
 
-       len = strlen("keyboard-interactive") + 2 +
-               strlen(kbdintctxt->device->name);
-       method = xmalloc(len);
-       snprintf(method, len, "keyboard-interactive/%s",
-           kbdintctxt->device->name);
+       xasprintf(&method, "keyboard-interactive/%s", kbdintctxt->device->name);
 
        if (!authctxt->postponed) {
                if (authenticated) {
This page took 0.048676 seconds and 4 git commands to generate.