]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/chap.c
tweaks to Makefiles - use cc, suppress warnings
[ppp.git] / pppd / chap.c
index a0400b9348c44aaf7823865ab120532a11f88e9f..d192fe618d39d856ae026b33c8439326f851c567 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: chap.c,v 1.6 1994/10/24 04:31:11 paulus Exp $";
+static char rcsid[] = "$Id: chap.c,v 1.9 1995/12/18 03:46:19 paulus Exp $";
 #endif
 
 /*
@@ -36,6 +36,12 @@ static char rcsid[] = "$Id: chap.c,v 1.6 1994/10/24 04:31:11 paulus Exp $";
 #include "chap.h"
 #include "md5.h"
 
+struct protent chap_protent = {
+    PPP_CHAP, ChapInit, ChapInput, ChapProtocolReject,
+    ChapLowerUp, ChapLowerDown, NULL, NULL,
+    ChapPrintPkt, NULL, 1, "CHAP"
+};
+
 chap_state chap[NUM_PPP];              /* CHAP state; one for each unit */
 
 static void ChapChallengeTimeout __P((caddr_t));
@@ -67,7 +73,7 @@ ChapInit(unit)
     cstate->serverstate = CHAPSS_INITIAL;
     cstate->timeouttime = CHAP_DEFTIMEOUT;
     cstate->max_transmits = CHAP_DEFTRANSMITS;
-    srand48((long) time(NULL));        /* joggle random number generator */
+    /* random number generator is initialized in magic_init */
 }
 
 
@@ -189,9 +195,6 @@ ChapRechallenge(arg)
     ChapGenChallenge(cstate);
     ChapSendChallenge(cstate);
     cstate->serverstate = CHAPSS_RECHALLENGE;
-
-    if (cstate->chal_interval != 0)
-       TIMEOUT(ChapRechallenge, (caddr_t) cstate, cstate->chal_interval);
 }
 
 
@@ -506,7 +509,7 @@ ChapReceiveResponse(cstate, inp, id, len)
            MD5Final(&mdContext); 
 
            /* compare local and remote MDs and send the appropriate status */
-           if (bcmp (mdContext.digest, remmd, MD5_SIGNATURE_SIZE) == 0)
+           if (memcmp (mdContext.digest, remmd, MD5_SIGNATURE_SIZE) == 0)
                code = CHAP_SUCCESS;    /* they are the same! */
            break;
 
@@ -806,18 +809,3 @@ ChapPrintPkt(p, plen, printer, arg)
 
     return len + CHAP_HEADERLEN;
 }
-
-#ifdef NO_DRAND48
-
-double drand48()
-{
-  return (double)random() / (double)0x7fffffffL; /* 2**31-1 */
-}
-
-void srand48(seedval)
-long seedval;
-{
-  srand((int)seedval);
-}
-
-#endif