diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-06-19 19:06:06 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-06-19 19:06:06 +0400 |
commit | 02b3fb2b24aacd90d535c2136a055f529d722974 (patch) | |
tree | 6243dd815869add07be2bad5846e7817b732ac59 /accel-pppd/auth | |
parent | c553a7bbbc96d36ba4d0999bb172c7a926518eb1 (diff) | |
download | accel-ppp-02b3fb2b24aacd90d535c2136a055f529d722974.tar.gz accel-ppp-02b3fb2b24aacd90d535c2136a055f529d722974.zip |
general preparation for IPoE integration
Diffstat (limited to 'accel-pppd/auth')
-rw-r--r-- | accel-pppd/auth/auth_chap_md5.c | 24 | ||||
-rw-r--r-- | accel-pppd/auth/auth_mschap_v1.c | 20 | ||||
-rw-r--r-- | accel-pppd/auth/auth_mschap_v2.c | 20 | ||||
-rw-r--r-- | accel-pppd/auth/auth_pap.c | 12 |
4 files changed, 38 insertions, 38 deletions
diff --git a/accel-pppd/auth/auth_chap_md5.c b/accel-pppd/auth/auth_chap_md5.c index 4b8206b4..a43081d8 100644 --- a/accel-pppd/auth/auth_chap_md5.c +++ b/accel-pppd/auth/auth_chap_md5.c @@ -163,7 +163,7 @@ static void chap_timeout_timer(struct triton_timer_t *t) if (++d->failure == conf_max_failure) { if (d->started) - ppp_terminate(d->ppp, TERM_USER_ERROR, 0); + ap_session_terminate(&d->ppp->ses, TERM_USER_ERROR, 0); else ppp_auth_failed(d->ppp, NULL); } else { @@ -248,7 +248,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new) ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2); if (conf_timeout && !ad->timeout.tpd) - triton_timer_add(ad->ppp->ctrl->ctx, &ad->timeout, 0); + triton_timer_add(ad->ppp->ses.ctrl->ctx, &ad->timeout, 0); } static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *hdr) @@ -281,7 +281,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h log_ppp_error("chap-md5: incorrect value-size (%i)\n", msg->val_size); chap_send_failure(ad); if (ad->started) - ppp_terminate(ad->ppp, TERM_USER_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_USER_ERROR, 0); else ppp_auth_failed(ad->ppp, NULL); return; @@ -292,7 +292,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (conf_any_login) { if (ppp_auth_successed(ad->ppp, name)) { chap_send_failure(ad); - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_AUTH_ERROR, 0); _free(name); return; } @@ -301,10 +301,10 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h return; } - r = pwdb_check(ad->ppp, name, PPP_CHAP, CHAP_MD5, ad->id, ad->val, VALUE_SIZE, msg->val); + r = pwdb_check(&ad->ppp->ses, name, PPP_CHAP, CHAP_MD5, ad->id, ad->val, VALUE_SIZE, msg->val); if (r == PWDB_NO_IMPL) { - passwd = pwdb_get_passwd(ad->ppp,name); + passwd = pwdb_get_passwd(&ad->ppp->ses, name); if (!passwd) { _free(name); @@ -326,7 +326,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h log_ppp_warn("chap-md5: challenge response mismatch\n"); chap_send_failure(ad); if (ad->started) - ppp_terminate(ad->ppp, TERM_USER_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_USER_ERROR, 0); else ppp_auth_failed(ad->ppp, name); _free(name); @@ -334,13 +334,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (!ad->started) { if (ppp_auth_successed(ad->ppp, name)) { chap_send_failure(ad); - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, 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); + triton_timer_add(ad->ppp->ses.ctrl->ctx, &ad->interval, 0); } } else _free(name); @@ -349,7 +349,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h } else if (r == PWDB_DENIED) { chap_send_failure(ad); if (ad->started) - ppp_terminate(ad->ppp, TERM_USER_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_USER_ERROR, 0); else ppp_auth_failed(ad->ppp, name); _free(name); @@ -357,13 +357,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (!ad->started) { if (ppp_auth_successed(ad->ppp, name)) { chap_send_failure(ad); - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, 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); + triton_timer_add(ad->ppp->ses.ctrl->ctx, &ad->interval, 0); } } else { chap_send_success(ad); diff --git a/accel-pppd/auth/auth_mschap_v1.c b/accel-pppd/auth/auth_mschap_v1.c index f0b58f45..fd1a60a8 100644 --- a/accel-pppd/auth/auth_mschap_v1.c +++ b/accel-pppd/auth/auth_mschap_v1.c @@ -164,7 +164,7 @@ static void chap_timeout_timer(struct triton_timer_t *t) if (++d->failure == conf_max_failure) { if (d->started) - ppp_terminate(d->ppp, TERM_USER_ERROR, 0); + ap_session_terminate(&d->ppp->ses, TERM_USER_ERROR, 0); else ppp_auth_failed(d->ppp, NULL); } else { @@ -251,7 +251,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new) ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2); if (conf_timeout && !ad->timeout.tpd) - triton_timer_add(ad->ppp->ctrl->ctx, &ad->timeout, 0); + triton_timer_add(ad->ppp->ses.ctrl->ctx, &ad->timeout, 0); } static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *hdr) @@ -283,7 +283,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (msg->val_size != RESPONSE_VALUE_SIZE) { log_ppp_error("mschap-v1: incorrect value-size (%i)\n", msg->val_size); if (ad->started) - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_AUTH_ERROR, 0); else ppp_auth_failed(ad->ppp, NULL); return; @@ -293,7 +293,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (!name) { log_emerg("mschap-v1: out of memory\n"); if (ad->started) - ppp_terminate(ad->ppp, TERM_NAS_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_NAS_ERROR, 0); else ppp_auth_failed(ad->ppp, NULL); return; @@ -302,7 +302,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (conf_any_login) { if (ppp_auth_successed(ad->ppp, name)) { chap_send_failure(ad, mschap_error); - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_AUTH_ERROR, 0); _free(name); return; } @@ -311,7 +311,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h return; } - r = pwdb_check(ad->ppp, name, PPP_CHAP, MSCHAP_V1, ad->id, ad->val, VALUE_SIZE, msg->lm_hash, msg->nt_hash, msg->flags, &mschap_error); + r = pwdb_check(&ad->ppp->ses, name, PPP_CHAP, MSCHAP_V1, ad->id, ad->val, VALUE_SIZE, msg->lm_hash, msg->nt_hash, msg->flags, &mschap_error); if (r == PWDB_NO_IMPL) if (chap_check_response(ad, msg, name)) r = PWDB_DENIED; @@ -319,7 +319,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (r == PWDB_DENIED) { chap_send_failure(ad, mschap_error); if (ad->started) - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_AUTH_ERROR, 0); else ppp_auth_failed(ad->ppp, name); _free(name); @@ -327,13 +327,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (!ad->started) { if (ppp_auth_successed(ad->ppp, name)) { chap_send_failure(ad, mschap_error); - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, 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); + triton_timer_add(ad->ppp->ses.ctrl->ctx, &ad->interval, 0); } } else { chap_send_success(ad); @@ -380,7 +380,7 @@ static int chap_check_response(struct chap_auth_data_t *ad, struct chap_response char *u_passwd; int i; - passwd = pwdb_get_passwd(ad->ppp,name); + passwd = pwdb_get_passwd(&ad->ppp->ses, name); if (!passwd) { if (conf_ppp_verbose) log_ppp_warn("mschap-v1: user not found\n"); diff --git a/accel-pppd/auth/auth_mschap_v2.c b/accel-pppd/auth/auth_mschap_v2.c index aeb49077..ffb6fbf4 100644 --- a/accel-pppd/auth/auth_mschap_v2.c +++ b/accel-pppd/auth/auth_mschap_v2.c @@ -165,7 +165,7 @@ static void chap_timeout_timer(struct triton_timer_t *t) if (++d->failure == conf_max_failure) { if (d->started) - ppp_terminate(d->ppp, TERM_USER_ERROR, 0); + ap_session_terminate(&d->ppp->ses, TERM_USER_ERROR, 0); else ppp_auth_failed(d->ppp, NULL); } else { @@ -254,7 +254,7 @@ static int generate_response(struct chap_auth_data_t *ad, struct chap_response_t 0x6E}; - passwd = pwdb_get_passwd(ad->ppp,name); + passwd = pwdb_get_passwd(&ad->ppp->ses, name); if (!passwd) return -1; @@ -324,7 +324,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new) ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2); if (conf_timeout && !ad->timeout.tpd) - triton_timer_add(ad->ppp->ctrl->ctx, &ad->timeout, 0); + triton_timer_add(ad->ppp->ses.ctrl->ctx, &ad->timeout, 0); } static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *hdr) @@ -361,7 +361,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h log_ppp_error("mschap-v2: incorrect value-size (%i)\n", msg->val_size); chap_send_failure(ad, mschap_error, reply_msg); if (ad->started) - ppp_terminate(ad->ppp, TERM_USER_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_USER_ERROR, 0); else ppp_auth_failed(ad->ppp, NULL); return; @@ -371,13 +371,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (!name) { log_emerg("mschap-v2: out of memory\n"); if (ad->started) - ppp_terminate(ad->ppp, TERM_NAS_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_NAS_ERROR, 0); else ppp_auth_failed(ad->ppp, NULL); return; } - r = pwdb_check(ad->ppp, name, PPP_CHAP, MSCHAP_V2, ad->id, ad->val, msg->peer_challenge, msg->reserved, msg->nt_hash, msg->flags, authenticator, &mschap_error, &reply_msg); + r = pwdb_check(&ad->ppp->ses, name, PPP_CHAP, MSCHAP_V2, ad->id, ad->val, msg->peer_challenge, msg->reserved, msg->nt_hash, msg->flags, authenticator, &mschap_error, &reply_msg); if (r == PWDB_NO_IMPL) { r = chap_check_response(ad, msg, name); @@ -390,7 +390,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (r == PWDB_DENIED) { chap_send_failure(ad, mschap_error, reply_msg); if (ad->started) - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_AUTH_ERROR, 0); else ppp_auth_failed(ad->ppp, name); _free(name); @@ -398,13 +398,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h if (!ad->started) { if (ppp_auth_successed(ad->ppp, name)) { chap_send_failure(ad, mschap_error, reply_msg); - ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&ad->ppp->ses, TERM_AUTH_ERROR, 0); _free(name); } else { chap_send_success(ad, msg, authenticator); ad->started = 1; if (conf_interval) - triton_timer_add(ad->ppp->ctrl->ctx, &ad->interval, 0); + triton_timer_add(ad->ppp->ses.ctrl->ctx, &ad->interval, 0); } } else { chap_send_success(ad, msg, authenticator); @@ -453,7 +453,7 @@ static int chap_check_response(struct chap_auth_data_t *ad, struct chap_response char *u_passwd; int i; - passwd = pwdb_get_passwd(ad->ppp, name); + passwd = pwdb_get_passwd(&ad->ppp->ses, name); if (!passwd) { if (conf_ppp_verbose) log_ppp_warn("mschap-v2: user not found\n"); diff --git a/accel-pppd/auth/auth_pap.c b/accel-pppd/auth/auth_pap.c index 4ab9bbbf..206ecde6 100644 --- a/accel-pppd/auth/auth_pap.c +++ b/accel-pppd/auth/auth_pap.c @@ -95,7 +95,7 @@ static int pap_start(struct ppp_t *ppp, struct auth_data_t *auth) d->timeout.expire = pap_timeout; d->timeout.period = conf_timeout * 1000; - triton_timer_add(ppp->ctrl->ctx, &d->timeout, 0); + triton_timer_add(ppp->ses.ctrl->ctx, &d->timeout, 0); ppp_register_chan_handler(ppp, &d->h); @@ -201,7 +201,7 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr) 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); + ap_session_terminate(&p->ppp->ses, TERM_AUTH_ERROR, 0); _free(peer_id); return -1; } @@ -212,9 +212,9 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr) passwd = _strndup((const char*)ptr, passwd_len); - r = pwdb_check(p->ppp, peer_id, PPP_PAP, passwd); + r = pwdb_check(&p->ppp->ses, peer_id, PPP_PAP, passwd); if (r == PWDB_NO_IMPL) { - passwd2 = pwdb_get_passwd(p->ppp, peer_id); + passwd2 = pwdb_get_passwd(&p->ppp->ses, peer_id); if (!passwd2 || strcmp(passwd2, passwd)) r = PWDB_DENIED; else @@ -226,7 +226,7 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr) log_ppp_warn("PAP: authentication error\n"); pap_send_nak(p, hdr->id); if (p->started) - ppp_terminate(p->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&p->ppp->ses, TERM_AUTH_ERROR, 0); else ppp_auth_failed(p->ppp, peer_id); ret = -1; @@ -234,7 +234,7 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr) } else { if (ppp_auth_successed(p->ppp, peer_id)) { pap_send_nak(p, hdr->id); - ppp_terminate(p->ppp, TERM_AUTH_ERROR, 0); + ap_session_terminate(&p->ppp->ses, TERM_AUTH_ERROR, 0); _free(peer_id); ret = -1; } else { |