]> andersk Git - openssh.git/blobdiff - auth2-pam.c
- markus@cvs.openbsd.org 2002/06/26 14:51:33
[openssh.git] / auth2-pam.c
index 2ea6f2020602c613ab670ade22c502755dc220cf..b2bfa8130649958de564f64fcfebed434f1f5af0 100644 (file)
@@ -16,7 +16,7 @@ RCSID("$Id$");
 static int do_pam_conversation_kbd_int(int num_msg, 
     const struct pam_message **msg, struct pam_response **resp, 
     void *appdata_ptr);
-void input_userauth_info_response_pam(int type, int plen, void *ctxt);
+void input_userauth_info_response_pam(int type, u_int32_t seqnr, void *ctxt);
 
 struct {
        int finished, num_received, num_expected;
@@ -107,10 +107,12 @@ do_pam_conversation_kbd_int(int num_msg, const struct pam_message **msg,
        packet_send();
        packet_write_wait();
 
-       /* Grabbing control of execution and spinning until we get what
+       /*
+        * Grabbing control of execution and spinning until we get what
         * we want is probably rude, but it seems to work properly, and
         * the client *should* be in lock-step with us, so the loop should
-        * only be traversed once. */
+        * only be traversed once.
+        */
        while(context_pam2.finished == 0) {
                done = 1;
                dispatch_run(DISPATCH_BLOCK, &done, appdata_ptr);
@@ -126,7 +128,7 @@ do_pam_conversation_kbd_int(int num_msg, const struct pam_message **msg,
 }
 
 void
-input_userauth_info_response_pam(int type, int plen, void *ctxt)
+input_userauth_info_response_pam(int type, u_int32_t seqnr, void *ctxt)
 {
        Authctxt *authctxt = ctxt;
        unsigned int nresp = 0, rlen = 0, i = 0;
@@ -135,12 +137,18 @@ input_userauth_info_response_pam(int type, int plen, void *ctxt)
        if (authctxt == NULL)
                fatal("input_userauth_info_response_pam: no authentication context");
 
-       if (authctxt->attempt++ >= AUTH_FAIL_MAX)
-               packet_disconnect("too many failed userauth_requests");
-
        nresp = packet_get_int();       /* Number of responses. */
        debug("got %d responses", nresp);
 
+
+       if (nresp != context_pam2.num_expected)
+               fatal("%s: Received incorrect number of responses "
+                   "(expected %u, received %u)", __func__, nresp,
+                   context_pam2.num_expected);
+
+       if (nresp > 100)
+               fatal("%s: too many replies", __func__);
+
        for (i = 0; i < nresp; i++) {
                int j = context_pam2.prompts[i];
 
@@ -153,7 +161,7 @@ input_userauth_info_response_pam(int type, int plen, void *ctxt)
 
        context_pam2.finished = 1;
 
-       packet_done();
+       packet_check_eom();
 }
 
 #endif
This page took 0.037192 seconds and 4 git commands to generate.