Print ntlm_auth failure reason in Module-Failure-Message
authoraland <aland>
Wed, 18 Oct 2006 21:11:09 +0000 (21:11 +0000)
committeraland <aland>
Wed, 18 Oct 2006 21:11:09 +0000 (21:11 +0000)
This closes bug #398, in this branch

src/modules/rlm_mschap/rlm_mschap.c

index 527b62f..218fdb7 100644 (file)
@@ -796,7 +796,22 @@ static int do_mschap(rlm_mschap_t *inst,
                                             buffer, sizeof(buffer),
                                             NULL, NULL);
                if (result != 0) {
+                       char *p;
+                       
                        DEBUG2("  rlm_mschap: External script failed.");
+
+                       vp = pairmake("Module-Failure-Message", "", T_OP_EQ);
+                       if (!vp) {
+                               radlog(L_ERR, "No memory");
+                               return -1;
+                       }
+
+                       p = strchr(buffer, '\n');
+                       if (p) *p = '\0';
+                       snprintf(vp->strvalue, sizeof(vp->strvalue), 
+                                "rlm_mschap: %s", buffer);
+                       vp->length = strlen(vp->strvalue);
+                       pairadd(&request->packet->vps, vp);
                        return -1;
                }