X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fchap.c;h=a0e821a1ce20f1d3e31138c1e53582600e857f64;hp=b580d2cb40e1cc6ce82f40331cdc01e1b23f4c34;hb=875d9641d05b4fcb7e186f784c801962bb2670e5;hpb=1e7bc3ea35208555bf233daacee9d85ded13f999 diff --git a/pppd/chap.c b/pppd/chap.c index b580d2c..a0e821a 100644 --- a/pppd/chap.c +++ b/pppd/chap.c @@ -34,7 +34,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: chap.c,v 1.20 1999/03/16 22:54:38 paulus Exp $"; +static const char rcsid[] = "$Id: chap.c,v 1.22 1999/08/12 04:25:20 paulus Exp $"; #endif /* @@ -436,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)); } @@ -552,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 {