Reimplement the previous fix (no response to PAP requests)

at the authentication layer rather than at the PAP layer
so that it also applies to CHAP (no response to CHAP
challenges).
This commit is contained in:
Brian Somers 1999-02-02 09:35:17 +00:00
parent 79a2501238
commit aceaed9283
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43525
5 changed files with 20 additions and 26 deletions

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: auth.c,v 1.35 1999/01/28 01:56:30 brian Exp $
* $Id: auth.c,v 1.36 1999/02/01 13:42:24 brian Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@ -31,10 +31,12 @@
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include "mbuf.h"
#include "defs.h"
#include "log.h"
#include "timer.h"
#include "fsm.h"
#include "iplist.h"
@ -56,6 +58,11 @@
#ifndef NORADIUS
#include "radius.h"
#endif
#include "cbcp.h"
#include "chap.h"
#include "async.h"
#include "physical.h"
#include "datalink.h"
#include "bundle.h"
const char *
@ -273,8 +280,10 @@ AuthTimeout(void *vauthp)
if (--authp->retry > 0) {
timer_Start(&authp->authtimer);
(*authp->ChallengeFunc)(authp, ++authp->id, authp->physical);
} else if (authp->FailedFunc)
(*authp->FailedFunc)(authp->physical);
} else {
log_Printf(LogPHASE, "Auth: No response from server\n");
datalink_AuthNotOk(authp->physical->dl);
}
}
void
@ -286,11 +295,9 @@ auth_Init(struct authinfo *authinfo)
void
auth_StartChallenge(struct authinfo *authp, struct physical *physical,
void (*chal)(struct authinfo *, int, struct physical *),
void (*fail)(struct physical *))
void (*chal)(struct authinfo *, int, struct physical *))
{
authp->ChallengeFunc = chal;
authp->FailedFunc = fail;
authp->physical = physical;
timer_Stop(&authp->authtimer);
authp->authtimer.func = AuthTimeout;

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: auth.h,v 1.12 1998/08/07 18:42:47 brian Exp $
* $Id: auth.h,v 1.13 1999/02/01 13:42:24 brian Exp $
*
* TODO:
*/
@ -25,7 +25,6 @@ struct bundle;
struct authinfo {
void (*ChallengeFunc)(struct authinfo *, int, struct physical *);
void (*FailedFunc)(struct physical *);
struct pppTimer authtimer;
int retry;
int id;
@ -41,8 +40,7 @@ extern void auth_Init(struct authinfo *);
extern void auth_StopTimer(struct authinfo *);
extern void auth_StartChallenge(struct authinfo *, struct physical *,
void (*)(struct authinfo *, int,
struct physical *),
void (*)(struct physical *));
struct physical *));
extern int auth_Validate(struct bundle *, const char *, const char *,
struct physical *);
extern char *auth_GetSecret(struct bundle *, const char *, int,

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: datalink.c,v 1.26 1999/01/28 01:56:31 brian Exp $
* $Id: datalink.c,v 1.27 1999/02/01 13:42:24 brian Exp $
*/
#include <sys/param.h>
@ -479,11 +479,9 @@ datalink_LayerUp(void *v, struct fsm *fp)
Auth2Nam(dl->physical->link.lcp.his_auth),
Auth2Nam(dl->physical->link.lcp.want_auth));
if (dl->physical->link.lcp.his_auth == PROTO_PAP)
auth_StartChallenge(&dl->pap, dl->physical, pap_SendChallenge,
pap_Failed);
auth_StartChallenge(&dl->pap, dl->physical, pap_SendChallenge);
if (dl->physical->link.lcp.want_auth == PROTO_CHAP)
auth_StartChallenge(&dl->chap.auth, dl->physical, chap_SendChallenge,
NULL);
auth_StartChallenge(&dl->chap.auth, dl->physical, chap_SendChallenge);
} else
datalink_AuthOk(dl);
}

View File

@ -18,7 +18,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: pap.c,v 1.28 1999/01/28 01:56:33 brian Exp $
* $Id: pap.c,v 1.29 1999/02/01 13:42:25 brian Exp $
*
* TODO:
*/
@ -137,14 +137,6 @@ PapValidate(struct bundle *bundle, u_char *name, u_char *key,
return auth_Validate(bundle, name, key, physical);
}
void
pap_Failed(struct physical *p)
{
auth_StopTimer(&p->dl->pap);
log_Printf(LogPHASE, "Pap: No response from server\n");
datalink_AuthNotOk(p->dl);
}
void
pap_Input(struct bundle *bundle, struct mbuf *bp, struct physical *physical)
{

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: pap.h,v 1.6 1998/05/21 21:47:21 brian Exp $
* $Id: pap.h,v 1.7 1999/02/01 13:42:25 brian Exp $
*
* TODO:
*/
@ -29,6 +29,5 @@ struct physical;
struct authinfo;
struct bundle;
extern void pap_Failed(struct physical *);
extern void pap_Input(struct bundle *, struct mbuf *, struct physical *);
extern void pap_SendChallenge(struct authinfo *, int, struct physical *);