summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>1999-02-01 13:50:28 +0000
committerbrian <brian@cvs.openbsd.org>1999-02-01 13:50:28 +0000
commit98de5d07eb392f4fca6db586179da9c6e5fed5c8 (patch)
treee80ff8bd80bd38c717fe4358948c56292a532d13
parentbd0b50c5fc6fb21e3149c54e61969896ee06632a (diff)
If we receive no answer from the server when sending PAP
requests, give up (don't sit there indefinitely).
-rw-r--r--usr.sbin/ppp/ppp/auth.c11
-rw-r--r--usr.sbin/ppp/ppp/auth.h8
-rw-r--r--usr.sbin/ppp/ppp/datalink.c8
-rw-r--r--usr.sbin/ppp/ppp/pap.c11
-rw-r--r--usr.sbin/ppp/ppp/pap.h3
5 files changed, 28 insertions, 13 deletions
diff --git a/usr.sbin/ppp/ppp/auth.c b/usr.sbin/ppp/ppp/auth.c
index fff9b873a97..550d7246a81 100644
--- a/usr.sbin/ppp/ppp/auth.c
+++ b/usr.sbin/ppp/ppp/auth.c
@@ -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.2 1998/12/17 00:28:39 brian Exp $
+ * $Id: auth.c,v 1.3 1999/02/01 13:50:27 brian Exp $
*
* TODO:
* o Implement check against with registered IP addresses.
@@ -244,7 +244,8 @@ 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);
}
void
@@ -256,9 +257,11 @@ auth_Init(struct authinfo *authinfo)
void
auth_StartChallenge(struct authinfo *authp, struct physical *physical,
- void (*fn)(struct authinfo *, int, struct physical *))
+ void (*chal)(struct authinfo *, int, struct physical *),
+ void (*fail)(struct physical *))
{
- authp->ChallengeFunc = fn;
+ authp->ChallengeFunc = chal;
+ authp->FailedFunc = fail;
authp->physical = physical;
timer_Stop(&authp->authtimer);
authp->authtimer.func = AuthTimeout;
diff --git a/usr.sbin/ppp/ppp/auth.h b/usr.sbin/ppp/ppp/auth.h
index eb0d26a37e0..8f710e55e26 100644
--- a/usr.sbin/ppp/ppp/auth.h
+++ b/usr.sbin/ppp/ppp/auth.h
@@ -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.1 1998/08/31 00:22:16 brian Exp $
+ * $Id: auth.h,v 1.2 1999/02/01 13:50:27 brian Exp $
*
* TODO:
*/
@@ -25,6 +25,7 @@ struct bundle;
struct authinfo {
void (*ChallengeFunc)(struct authinfo *, int, struct physical *);
+ void (*FailedFunc)(struct physical *);
struct pppTimer authtimer;
int retry;
int id;
@@ -39,8 +40,9 @@ extern const char *Auth2Nam(u_short);
extern void auth_Init(struct authinfo *);
extern void auth_StopTimer(struct authinfo *);
extern void auth_StartChallenge(struct authinfo *, struct physical *,
- void (*fn)(struct authinfo *, int,
- struct physical *));
+ void (*)(struct authinfo *, int,
+ struct physical *),
+ void (*)(struct physical *));
extern int auth_Validate(struct bundle *, const char *, const char *,
struct physical *);
extern char *auth_GetSecret(struct bundle *, const char *, int,
diff --git a/usr.sbin/ppp/ppp/datalink.c b/usr.sbin/ppp/ppp/datalink.c
index b351a0103fb..ffb6da1fe8f 100644
--- a/usr.sbin/ppp/ppp/datalink.c
+++ b/usr.sbin/ppp/ppp/datalink.c
@@ -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.7 1999/01/20 18:07:11 brian Exp $
+ * $Id: datalink.c,v 1.8 1999/02/01 13:50:27 brian Exp $
*/
#include <sys/types.h>
@@ -476,9 +476,11 @@ 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);
+ auth_StartChallenge(&dl->pap, dl->physical, pap_SendChallenge,
+ pap_Failed);
if (dl->physical->link.lcp.want_auth == PROTO_CHAP)
- auth_StartChallenge(&dl->chap.auth, dl->physical, chap_SendChallenge);
+ auth_StartChallenge(&dl->chap.auth, dl->physical, chap_SendChallenge,
+ NULL);
} else
datalink_AuthOk(dl);
}
diff --git a/usr.sbin/ppp/ppp/pap.c b/usr.sbin/ppp/ppp/pap.c
index 8ebc8a8f8c6..a1bfe2cd423 100644
--- a/usr.sbin/ppp/ppp/pap.c
+++ b/usr.sbin/ppp/ppp/pap.c
@@ -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.1 1998/08/31 00:22:25 brian Exp $
+ * $Id: pap.c,v 1.2 1999/02/01 13:50:27 brian Exp $
*
* TODO:
*/
@@ -135,6 +135,14 @@ PapValidate(struct bundle *bundle, u_char *name, u_char *key,
}
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)
{
int len = mbuf_Length(bp);
@@ -164,7 +172,6 @@ pap_Input(struct bundle *bundle, struct mbuf *bp, struct physical *physical)
* told that I got the answer right.
*/
datalink_AuthOk(physical->dl);
-
} else {
SendPapCode(php->id, PAP_NAK, "Login incorrect", physical);
datalink_AuthNotOk(physical->dl);
diff --git a/usr.sbin/ppp/ppp/pap.h b/usr.sbin/ppp/ppp/pap.h
index a07e2ba9d41..8fc405ca774 100644
--- a/usr.sbin/ppp/ppp/pap.h
+++ b/usr.sbin/ppp/ppp/pap.h
@@ -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.1 1998/08/31 00:22:25 brian Exp $
+ * $Id: pap.h,v 1.2 1999/02/01 13:50:27 brian Exp $
*
* TODO:
*/
@@ -29,5 +29,6 @@ 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 *);