diff options
author | Kozlov Dmitry <dima@server> | 2011-04-20 15:06:28 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2011-04-20 15:06:28 +0400 |
commit | bbbe1fd4f5c91210a4246225aff7728fa58384f3 (patch) | |
tree | 82d89e181025b1d593a32202904c03f0312a4e4d /accel-pppd/auth/auth_chap_md5.c | |
parent | d4f6b13bcfb5c6245d39f5a71db199bac5a0a26f (diff) | |
download | accel-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_chap_md5.c')
-rw-r--r-- | accel-pppd/auth/auth_chap_md5.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/accel-pppd/auth/auth_chap_md5.c b/accel-pppd/auth/auth_chap_md5.c index 2ea60ba7..a9a5572a 100644 --- a/accel-pppd/auth/auth_chap_md5.c +++ b/accel-pppd/auth/auth_chap_md5.c @@ -289,9 +289,14 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h name = _strndup(msg->name,ntohs(msg->hdr.len) - sizeof(*msg) + 2); if (conf_any_login) { + if (ppp_auth_successed(ad->ppp, name)) { + chap_send_failure(ad); + ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + _free(name); + return; + } chap_send_success(ad); ad->started = 1; - ppp_auth_successed(ad->ppp, name); return; } @@ -325,12 +330,17 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h ppp_auth_failed(ad->ppp, name); _free(name); } else { - chap_send_success(ad); if (!ad->started) { - ad->started = 1; - if (conf_interval) - triton_timer_add(ad->ppp->ctrl->ctx, &ad->interval, 0); - ppp_auth_successed(ad->ppp, name); + if (ppp_auth_successed(ad->ppp, name)) { + chap_send_failure(ad); + ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + _free(name); + } else { + chap_send_success(ad); + ad->started = 1; + if (conf_interval) + triton_timer_add(ad->ppp->ctrl->ctx, &ad->interval, 0); + } } else _free(name); } @@ -343,14 +353,21 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h ppp_auth_failed(ad->ppp, name); _free(name); } else { - chap_send_success(ad); if (!ad->started) { - ad->started = 1; - if (conf_interval) - triton_timer_add(ad->ppp->ctrl->ctx, &ad->interval, 0); - ppp_auth_successed(ad->ppp, name); - } else + if (ppp_auth_successed(ad->ppp, name)) { + chap_send_failure(ad); + ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + _free(name); + } else { + chap_send_success(ad); + ad->started = 1; + if (conf_interval) + triton_timer_add(ad->ppp->ctrl->ctx, &ad->interval, 0); + } + } else { + chap_send_success(ad); _free(name); + } } } |