]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/chap.c
kill warning
[ppp.git] / pppd / chap.c
index 27a60f21d058f76b5695d2e61f468737668ff4c5..a0e821a1ce20f1d3e31138c1e53582600e857f64 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: chap.c,v 1.19 1999/03/16 03:15:13 paulus Exp $";
+static const char rcsid[] = "$Id: chap.c,v 1.22 1999/08/12 04:25:20 paulus Exp $";
 #endif
 
 /*
@@ -94,6 +94,7 @@ struct protent chap_protent = {
     NULL,
     1,
     "CHAP",
+    NULL,
     chap_option_list,
     NULL,
     NULL,
@@ -435,8 +436,8 @@ ChapReceiveChallenge(cstate, inp, id, len)
     rhostname[len] = '\000';
 
     /* Microsoft doesn't send their name back in the PPP packet */
-    if (remote_name[0] != 0 && (explicit_remote || rhostname[0] == 0)) {
-       strlcpy(rhostname, sizeof(rhostname), remote_name);
+    if (explicit_remote || (remote_name[0] != 0 && rhostname[0] == 0)) {
+       strlcpy(rhostname, remote_name, sizeof(rhostname));
        CHAPDEBUG(("ChapReceiveChallenge: using '%q' as remote name",
                   rhostname));
     }
@@ -551,8 +552,8 @@ ChapReceiveResponse(cstate, inp, id, len)
      * do the hash ourselves, and compare the result.
      */
     code = CHAP_FAILURE;
-    if (!get_secret(cstate->unit, rhostname, cstate->chal_name,
-                   secret, &secret_len, 1)) {
+    if (!get_secret(cstate->unit, (explicit_remote? remote_name: rhostname),
+                   cstate->chal_name, secret, &secret_len, 1)) {
        warn("No CHAP secret found for authenticating %q", rhostname);
     } else {