summaryrefslogtreecommitdiff
path: root/accel-pptpd/auth
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-11-29 17:45:58 +0300
committerKozlov Dmitry <dima@server>2010-11-29 17:45:58 +0300
commitf96198bf149203e1ddca8f2c381cf4b9849cdda9 (patch)
treef4b4c10a7b489f693ecb6301d1584de22e4e90a5 /accel-pptpd/auth
parent3a293aabc6e43319761a1f3020559873aa714334 (diff)
downloadaccel-ppp-f96198bf149203e1ddca8f2c381cf4b9849cdda9.tar.gz
accel-ppp-f96198bf149203e1ddca8f2c381cf4b9849cdda9.zip
log: introduced additional log level (3) which shows only minimum of information messages
Diffstat (limited to 'accel-pptpd/auth')
-rw-r--r--accel-pptpd/auth/auth_chap_md5.c30
-rw-r--r--accel-pptpd/auth/auth_mschap_v1.c30
-rw-r--r--accel-pptpd/auth/auth_mschap_v2.c30
-rw-r--r--accel-pptpd/auth/auth_pap.c10
4 files changed, 50 insertions, 50 deletions
diff --git a/accel-pptpd/auth/auth_chap_md5.c b/accel-pptpd/auth/auth_chap_md5.c
index 634fba23..d19634a5 100644
--- a/accel-pptpd/auth/auth_chap_md5.c
+++ b/accel-pptpd/auth/auth_chap_md5.c
@@ -89,13 +89,13 @@ static void print_buf(const uint8_t *buf, int size)
{
int i;
for (i=0; i < size; i++)
- log_ppp_info("%x", buf[i]);
+ log_ppp_info2("%x", buf[i]);
}
static void print_str(const char *buf, int size)
{
int i;
for (i = 0; i < size; i++)
- log_ppp_info("%c", buf[i]);
+ log_ppp_info2("%c", buf[i]);
}
static struct auth_data_t* auth_data_init(struct ppp_t *ppp)
@@ -166,7 +166,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
if (d->started)
ppp_terminate(d->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(d->ppp);
+ ppp_auth_failed(d->ppp, NULL);
} else {
--d->id;
chap_send_challenge(d);
@@ -204,7 +204,7 @@ static void chap_send_failure(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [CHAP Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
+ log_ppp_info2("send [CHAP Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -220,7 +220,7 @@ static void chap_send_success(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [CHAP Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
+ log_ppp_info2("send [CHAP Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -239,9 +239,9 @@ static void chap_send_challenge(struct chap_auth_data_t *ad)
memcpy(msg.val, ad->val, VALUE_SIZE);
if (conf_ppp_verbose) {
- log_ppp_info("send [CHAP Challenge id=%x <", msg.hdr.id);
+ log_ppp_info2("send [CHAP Challenge id=%x <", msg.hdr.id);
print_buf(msg.val, VALUE_SIZE);
- log_ppp_info(">]\n");
+ log_ppp_info2(">]\n");
}
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
@@ -263,11 +263,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
triton_timer_del(&ad->timeout);
if (conf_ppp_verbose) {
- log_ppp_info("recv [CHAP Response id=%x <", msg->hdr.id);
+ log_ppp_info2("recv [CHAP Response id=%x <", msg->hdr.id);
print_buf(msg->val, msg->val_size);
- log_ppp_info(">, name=\"");
+ log_ppp_info2(">, name=\"");
print_str(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
- log_ppp_info("\"]\n");
+ log_ppp_info2("\"]\n");
}
if (msg->hdr.id != ad->id) {
@@ -319,9 +319,9 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
- }else
- {
+ ppp_auth_failed(ad->ppp, name);
+ _free(name);
+ } else {
chap_send_success(ad);
if (!ad->started) {
ad->started = 1;
@@ -334,11 +334,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
_free(passwd);
} else if (r == PWDB_DENIED) {
chap_send_failure(ad);
- _free(name);
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, name);
+ _free(name);
} else {
chap_send_success(ad);
if (!ad->started) {
diff --git a/accel-pptpd/auth/auth_mschap_v1.c b/accel-pptpd/auth/auth_mschap_v1.c
index 280a6727..5b38db54 100644
--- a/accel-pptpd/auth/auth_mschap_v1.c
+++ b/accel-pptpd/auth/auth_mschap_v1.c
@@ -106,13 +106,13 @@ static void print_buf(const uint8_t *buf,int size)
{
int i;
for (i = 0; i < size; i++)
- log_ppp_info("%x", buf[i]);
+ log_ppp_info2("%x", buf[i]);
}
static void print_str(const char *buf, int size)
{
int i;
for(i = 0; i < size; i++)
- log_ppp_info("%c", buf[i]);
+ log_ppp_info2("%c", buf[i]);
}
static struct auth_data_t* auth_data_init(struct ppp_t *ppp)
@@ -183,7 +183,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
if (d->started)
ppp_terminate(d->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(d->ppp);
+ ppp_auth_failed(d->ppp, NULL);
} else {
--d->id;
chap_send_challenge(d);
@@ -221,7 +221,7 @@ static void chap_send_failure(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [MSCHAP-v1 Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
+ log_ppp_info2("send [MSCHAP-v1 Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
ppp_chan_send(ad->ppp,&msg,ntohs(msg.hdr.len)+2);
}
@@ -237,7 +237,7 @@ static void chap_send_success(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [MSCHAP-v1 Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
+ log_ppp_info2("send [MSCHAP-v1 Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -256,9 +256,9 @@ static void chap_send_challenge(struct chap_auth_data_t *ad)
memcpy(msg.val, ad->val, VALUE_SIZE);
if (conf_ppp_verbose) {
- log_ppp_info("send [MSCHAP-v1 Challenge id=%x <", msg.hdr.id);
+ log_ppp_info2("send [MSCHAP-v1 Challenge id=%x <", msg.hdr.id);
print_buf(msg.val, VALUE_SIZE);
- log_ppp_info(">]\n");
+ log_ppp_info2(">]\n");
}
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
@@ -277,13 +277,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
triton_timer_del(&ad->timeout);
if (conf_ppp_verbose) {
- log_ppp_info("recv [MSCHAP-v1 Response id=%x <", msg->hdr.id);
+ log_ppp_info2("recv [MSCHAP-v1 Response id=%x <", msg->hdr.id);
print_buf(msg->lm_hash, 24);
- log_ppp_info(">, <");
+ log_ppp_info2(">, <");
print_buf(msg->nt_hash, 24);
- log_ppp_info(">, F=%i, name=\"", msg->flags);
+ log_ppp_info2(">, F=%i, name=\"", msg->flags);
print_str(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
- log_ppp_info("\"]\n");
+ log_ppp_info2("\"]\n");
}
if (msg->hdr.id != ad->id) {
@@ -293,7 +293,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
}
if (msg->val_size != RESPONSE_VALUE_SIZE) {
@@ -302,7 +302,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
}
name = _strndup(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
@@ -311,7 +311,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_NAS_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
return;
}
@@ -332,7 +332,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, name);
_free(name);
} else {
chap_send_success(ad);
diff --git a/accel-pptpd/auth/auth_mschap_v2.c b/accel-pptpd/auth/auth_mschap_v2.c
index 374c152a..014c6963 100644
--- a/accel-pptpd/auth/auth_mschap_v2.c
+++ b/accel-pptpd/auth/auth_mschap_v2.c
@@ -106,14 +106,14 @@ static void print_buf(const uint8_t *buf, int size)
{
int i;
for (i = 0; i < size; i++)
- log_ppp_info("%x", buf[i]);
+ log_ppp_info2("%x", buf[i]);
}
static void print_str(const char *buf, int size)
{
int i;
for (i = 0; i < size; i++)
- log_ppp_info("%c", buf[i]);
+ log_ppp_info2("%c", buf[i]);
}
static struct auth_data_t* auth_data_init(struct ppp_t *ppp)
@@ -184,7 +184,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
if (d->started)
ppp_terminate(d->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(d->ppp);
+ ppp_auth_failed(d->ppp, NULL);
} else {
--d->id;
chap_send_challenge(d);
@@ -222,7 +222,7 @@ static void chap_send_failure(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [MSCHAP-v2 Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
+ log_ppp_info2("send [MSCHAP-v2 Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -310,7 +310,7 @@ static void chap_send_success(struct chap_auth_data_t *ad, struct chap_response_
memcpy(msg.message + 2, authenticator, 40);
if (conf_ppp_verbose)
- log_ppp_info("send [MSCHAP-v2 Success id=%x \"%s\"]\n", msg.hdr.id, msg.message);
+ log_ppp_info2("send [MSCHAP-v2 Success id=%x \"%s\"]\n", msg.hdr.id, msg.message);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -329,9 +329,9 @@ static void chap_send_challenge(struct chap_auth_data_t *ad)
memcpy(msg.val, ad->val, VALUE_SIZE);
if (conf_ppp_verbose) {
- log_ppp_info("send [MSCHAP-v2 Challenge id=%x <", msg.hdr.id);
+ log_ppp_info2("send [MSCHAP-v2 Challenge id=%x <", msg.hdr.id);
print_buf(msg.val, VALUE_SIZE);
- log_ppp_info(">]\n");
+ log_ppp_info2(">]\n");
}
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
@@ -351,13 +351,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
triton_timer_del(&ad->timeout);
if (conf_ppp_verbose) {
- log_ppp_info("recv [MSCHAP-v2 Response id=%x <", msg->hdr.id);
+ log_ppp_info2("recv [MSCHAP-v2 Response id=%x <", msg->hdr.id);
print_buf(msg->peer_challenge,16);
- log_ppp_info(">, <");
+ log_ppp_info2(">, <");
print_buf(msg->nt_hash, 24);
- log_ppp_info(">, F=%i, name=\"", msg->flags);
+ log_ppp_info2(">, F=%i, name=\"", msg->flags);
print_str(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
- log_ppp_info("\"]\n");
+ log_ppp_info2("\"]\n");
}
if (msg->hdr.id != ad->id) {
@@ -367,7 +367,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
}
if (msg->val_size != RESPONSE_VALUE_SIZE) {
@@ -376,7 +376,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
}
name = _strndup(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
@@ -385,7 +385,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_NAS_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
return;
}
@@ -404,7 +404,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, name);
_free(name);
} else {
chap_send_success(ad, msg, authenticator);
diff --git a/accel-pptpd/auth/auth_pap.c b/accel-pptpd/auth/auth_pap.c
index 27b4dd8a..69090464 100644
--- a/accel-pptpd/auth/auth_pap.c
+++ b/accel-pptpd/auth/auth_pap.c
@@ -119,7 +119,7 @@ static void pap_timeout(struct triton_timer_t *t)
if (conf_ppp_verbose)
log_ppp_warn("pap: timeout\n");
- ppp_auth_failed(d->ppp);
+ ppp_auth_failed(d->ppp, NULL);
}
static int lcp_send_conf_req(struct ppp_t *ppp, struct auth_data_t *d, uint8_t *ptr)
@@ -144,7 +144,7 @@ static void pap_send_ack(struct pap_auth_data_t *p, int id)
memcpy(msg->msg, MSG_SUCCESSED, sizeof(MSG_SUCCESSED));
if (conf_ppp_verbose)
- log_ppp_info("send [PAP AuthAck id=%x \"%s\"]\n", id, MSG_SUCCESSED);
+ log_ppp_info2("send [PAP AuthAck id=%x \"%s\"]\n", id, MSG_SUCCESSED);
ppp_chan_send(p->ppp, msg, ntohs(msg->hdr.len) + 2);
}
@@ -161,7 +161,7 @@ static void pap_send_nak(struct pap_auth_data_t *p, int id)
memcpy(msg->msg, MSG_FAILED, sizeof(MSG_FAILED));
if (conf_ppp_verbose)
- log_ppp_info("send [PAP AuthNak id=%x \"%s\"]\n", id, MSG_FAILED);
+ log_ppp_info2("send [PAP AuthNak id=%x \"%s\"]\n", id, MSG_FAILED);
ppp_chan_send(p->ppp, msg, ntohs(msg->hdr.len) + 2);
}
@@ -180,7 +180,7 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr)
triton_timer_del(&p->timeout);
if (conf_ppp_verbose)
- log_ppp_info("recv [PAP AuthReq id=%x]\n", hdr->id);
+ log_ppp_info2("recv [PAP AuthReq id=%x]\n", hdr->id);
peer_id_len = *(uint8_t*)ptr; ptr++;
if (peer_id_len > ntohs(hdr->len) - sizeof(*hdr) + 2 - 1) {
@@ -222,7 +222,7 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr)
if (p->started)
ppp_terminate(p->ppp, TERM_AUTH_ERROR, 0);
else
- ppp_auth_failed(p->ppp);
+ ppp_auth_failed(p->ppp, peer_id);
ret=-1;
_free(peer_id);
} else {