]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/chap.c
don't die on EIO on setting asyncmap
[ppp.git] / pppd / chap.c
index b418f6f493f002a192b0d8699a3530dcd5becc02..6b405f195d409d62734294544ed9707256c1080a 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: chap.c,v 1.14 1997/04/30 05:51:08 paulus Exp $";
+static char rcsid[] = "$Id: chap.c,v 1.18 1999/03/12 06:07:15 paulus Exp $";
 #endif
 
 /*
@@ -54,6 +54,23 @@ static char rcsid[] = "$Id: chap.c,v 1.14 1997/04/30 05:51:08 paulus Exp $";
 #include "chap_ms.h"
 #endif
 
+/*
+ * Command-line options.
+ */
+static option_t chap_option_list[] = {
+    { "chap-restart", o_int, &chap[0].timeouttime,
+      "Set timeout for CHAP" },
+    { "chap-max-challenge", o_int, &chap[0].max_transmits,
+      "Set max #xmits for challenge" },
+    { "chap-interval", o_int, &chap[0].chal_interval,
+      "Set interval for rechallenge" },
+#ifdef MSLANMAN
+    { "ms-lanman", o_bool, &ms_lanman,
+      "Use LanMan passwd when using MS-CHAP", 1 },
+#endif
+    { NULL }
+};
+
 /*
  * Protocol entry points.
  */
@@ -78,6 +95,7 @@ struct protent chap_protent = {
     NULL,
     1,
     "CHAP",
+    chap_option_list,
     NULL,
     NULL,
     NULL
@@ -424,8 +442,7 @@ ChapReceiveChallenge(cstate, inp, id, len)
 
     /* Microsoft doesn't send their name back in the PPP packet */
     if (remote_name[0] != 0 && (explicit_remote || rhostname[0] == 0)) {
-       strncpy(rhostname, remote_name, sizeof(rhostname));
-       rhostname[sizeof(rhostname) - 1] = 0;
+       strlcpy(rhostname, sizeof(rhostname), remote_name);
        CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: using '%s' as remote name",
                   rhostname));
     }
@@ -586,9 +603,12 @@ ChapReceiveResponse(cstate, inp, id, len)
        }
        if (cstate->chal_interval != 0)
            TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval);
+       syslog(LOG_NOTICE, "CHAP peer authentication succeeded for %s",
+              rhostname);
 
     } else {
-       syslog(LOG_ERR, "CHAP peer authentication failed");
+       syslog(LOG_ERR, "CHAP peer authentication failed for remote host %s",
+              rhostname);
        cstate->serverstate = CHAPSS_BADAUTH;
        auth_peer_fail(cstate->unit, PPP_CHAP);
     }