*/
#ifndef lint
-static char rcsid[] = "$Id: chap.c,v 1.4 1994/09/21 06:47:37 paulus Exp $";
+static char rcsid[] = "$Id: chap.c,v 1.8 1995/07/04 12:32:26 paulus Exp $";
#endif
/*
*/
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <syslog.h>
#include "chap.h"
#include "md5.h"
-chap_state chap[N_PPP]; /* CHAP state; one for each unit */
+chap_state chap[NUM_PPP]; /* CHAP state; one for each unit */
static void ChapChallengeTimeout __P((caddr_t));
static void ChapResponseTimeout __P((caddr_t));
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 */
}
ChapGenChallenge(cstate);
ChapSendChallenge(cstate);
cstate->serverstate = CHAPSS_RECHALLENGE;
-
- if (cstate->chal_interval != 0)
- TIMEOUT(ChapRechallenge, (caddr_t) cstate, cstate->chal_interval);
}
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;
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