summaryrefslogtreecommitdiff
path: root/accel-pptpd/auth/auth_chap_md5.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2010-09-20 01:09:07 +0400
committerDmitry Kozlov <xeb@mail.ru>2010-09-20 01:09:34 +0400
commitb96fbc3f966b012720d2b74b1dfd2a0ab95086cf (patch)
tree606750874faf65029f756dc0b401ee40cc4da89f /accel-pptpd/auth/auth_chap_md5.c
parentd860a4beaf5f99d5045d03b931b4829426a2f7b0 (diff)
downloadaccel-ppp-xebd-b96fbc3f966b012720d2b74b1dfd2a0ab95086cf.tar.gz
accel-ppp-xebd-b96fbc3f966b012720d2b74b1dfd2a0ab95086cf.zip
fixed many bugs and memory leaks
Diffstat (limited to 'accel-pptpd/auth/auth_chap_md5.c')
-rw-r--r--accel-pptpd/auth/auth_chap_md5.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/accel-pptpd/auth/auth_chap_md5.c b/accel-pptpd/auth/auth_chap_md5.c
index 058dc67..7681fb5 100644
--- a/accel-pptpd/auth/auth_chap_md5.c
+++ b/accel-pptpd/auth/auth_chap_md5.c
@@ -15,6 +15,8 @@
#include "ppp_lcp.h"
#include "pwdb.h"
+#include "memdebug.h"
+
#define CHAP_CHALLENGE 1
#define CHAP_RESPONSE 2
#define CHAP_SUCCESS 3
@@ -89,7 +91,7 @@ static void print_str(const char *buf,int size)
static struct auth_data_t* auth_data_init(struct ppp_t *ppp)
{
- struct chap_auth_data_t *d=malloc(sizeof(*d));
+ struct chap_auth_data_t *d=_malloc(sizeof(*d));
memset(d,0,sizeof(*d));
d->auth.proto=PPP_CHAP;
@@ -102,7 +104,7 @@ static void auth_data_free(struct ppp_t *ppp,struct auth_data_t *auth)
{
struct chap_auth_data_t *d=container_of(auth,typeof(*d),auth);
- free(d);
+ _free(d);
}
static int chap_start(struct ppp_t *ppp, struct auth_data_t *auth)
@@ -223,7 +225,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
ppp_terminate(ad->ppp, 0);
}
- name = strndup(msg->name,ntohs(msg->hdr.len)-sizeof(*msg)+2);
+ name = _strndup(msg->name,ntohs(msg->hdr.len)-sizeof(*msg)+2);
r = pwdb_check(ad->ppp, name, PPP_CHAP, CHAP_MD5, ad->id, ad->val, VALUE_SIZE, msg->val);
@@ -231,7 +233,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
passwd = pwdb_get_passwd(ad->ppp,name);
if (!passwd)
{
- free(name);
+ _free(name);
log_ppp_debug("chap-md5: user not found\n");
chap_send_failure(ad);
return;
@@ -253,11 +255,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
chap_send_success(ad);
auth_successed(ad->ppp, name);
}
- free(passwd);
+ _free(passwd);
} else if (r == PWDB_DENIED) {
chap_send_failure(ad);
auth_failed(ad->ppp);
- free(name);
+ _free(name);
} else {
chap_send_success(ad);
auth_successed(ad->ppp, name);