X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fchap.c;h=2a43c050cdadcf4f06c966521e2618199012c8aa;hb=44cd25b6c5a886f3cb615f2f0d8d78c6a52a2030;hp=27a60f21d058f76b5695d2e61f468737668ff4c5;hpb=7a4dc0ff500aaa176a41965d8d4ad15a97a70904;p=ppp.git diff --git a/pppd/chap.c b/pppd/chap.c index 27a60f2..2a43c05 100644 --- a/pppd/chap.c +++ b/pppd/chap.c @@ -33,9 +33,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#ifndef lint -static char rcsid[] = "$Id: chap.c,v 1.19 1999/03/16 03:15:13 paulus Exp $"; -#endif +#define RCSID "$Id: chap.c,v 1.24 1999/11/15 01:51:50 paulus Exp $" /* * TODO: @@ -53,6 +51,8 @@ static char rcsid[] = "$Id: chap.c,v 1.19 1999/03/16 03:15:13 paulus Exp $"; #include "chap_ms.h" #endif +static const char rcsid[] = RCSID; + /* * Command-line options. */ @@ -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 { @@ -740,7 +741,7 @@ ChapGenChallenge(cstate) { int chal_len; u_char *ptr = cstate->challenge; - unsigned int i; + int i; /* pick a random challenge length between MIN_CHALLENGE_LENGTH and MAX_CHALLENGE_LENGTH */ @@ -752,7 +753,7 @@ ChapGenChallenge(cstate) cstate->chal_transmits = 0; /* generate a random string */ - for (i = 0; i < chal_len; i++ ) + for (i = 0; i < chal_len; i++) *ptr++ = (char) (drand48() * 0xff); }