summaryrefslogtreecommitdiff
path: root/accel-pppd/auth/auth_pap.c
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2011-04-20 15:06:28 +0400
committerKozlov Dmitry <dima@server>2011-04-20 15:06:28 +0400
commitbbbe1fd4f5c91210a4246225aff7728fa58384f3 (patch)
tree82d89e181025b1d593a32202904c03f0312a4e4d /accel-pppd/auth/auth_pap.c
parentd4f6b13bcfb5c6245d39f5a71db199bac5a0a26f (diff)
downloadaccel-ppp-bbbe1fd4f5c91210a4246225aff7728fa58384f3.tar.gz
accel-ppp-bbbe1fd4f5c91210a4246225aff7728fa58384f3.zip
ppp: introduced new option 'single-session' to control single session per user
Diffstat (limited to 'accel-pppd/auth/auth_pap.c')
-rw-r--r--accel-pppd/auth/auth_pap.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/accel-pppd/auth/auth_pap.c b/accel-pppd/auth/auth_pap.c
index 70e80819..c03a9a10 100644
--- a/accel-pppd/auth/auth_pap.c
+++ b/accel-pppd/auth/auth_pap.c
@@ -198,9 +198,14 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr)
peer_id = _strndup((const char*)peer_id, peer_id_len);
if (conf_any_login) {
+ if (ppp_auth_successed(p->ppp, peer_id)) {
+ pap_send_nak(p, hdr->id);
+ ppp_terminate(p->ppp, TERM_AUTH_ERROR, 0);
+ _free(peer_id);
+ return -1;
+ }
pap_send_ack(p, hdr->id);
p->started = 1;
- ppp_auth_successed(p->ppp, peer_id);
return 0;
}
@@ -223,15 +228,19 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr)
ppp_terminate(p->ppp, TERM_AUTH_ERROR, 0);
else
ppp_auth_failed(p->ppp, peer_id);
- ret=-1;
+ ret = -1;
_free(peer_id);
} else {
- pap_send_ack(p, hdr->id);
- if (!p->started) {
+ if (ppp_auth_successed(p->ppp, peer_id)) {
+ pap_send_nak(p, hdr->id);
+ ppp_terminate(p->ppp, TERM_AUTH_ERROR, 0);
+ _free(peer_id);
+ ret = -1;
+ } else {
+ pap_send_ack(p, hdr->id);
p->started = 1;
- ppp_auth_successed(p->ppp, peer_id);
+ ret = 0;
}
- ret = 0;
}
_free(passwd);