diff options
author | Kozlov Dmitry <dima@server> | 2010-11-24 18:48:56 +0300 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-11-24 18:48:56 +0300 |
commit | 3abd20bf026b1500121969f02af51cfd29ecb47b (patch) | |
tree | 187cf610ac0a132ed9a26b1ec184c1ec79954e44 /accel-pptpd/radius | |
parent | ffa0e97458090a48b9a0ea7bc8749de636b26465 (diff) | |
download | accel-ppp-3abd20bf026b1500121969f02af51cfd29ecb47b.tar.gz accel-ppp-3abd20bf026b1500121969f02af51cfd29ecb47b.zip |
radius: fixed incorrect handling empty user password when pap authentication is used
Diffstat (limited to 'accel-pptpd/radius')
-rw-r--r-- | accel-pptpd/radius/auth.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/accel-pptpd/radius/auth.c b/accel-pptpd/radius/auth.c index 55d1858..94a8269 100644 --- a/accel-pptpd/radius/auth.c +++ b/accel-pptpd/radius/auth.c @@ -108,8 +108,13 @@ static uint8_t* encrypt_password(const char *passwd, const char *secret, const u int i, j, chunk_cnt; uint8_t b[16], c[16]; MD5_CTX ctx; - - chunk_cnt = (strlen(passwd) - 1) / 16 + 1; + + if (strlen(passwd)) + chunk_cnt = (strlen(passwd) - 1) / 16 + 1; + else { + *epasswd_len = 0; + return (uint8_t *)1; + } epasswd = _malloc(chunk_cnt * 16); if (!epasswd) { @@ -186,11 +191,13 @@ int rad_auth_pap(struct radius_pd_t *rpd, const char *username, va_list args) goto out; if (rad_packet_add_octets(req->pack, "User-Password", epasswd, epasswd_len)) { - _free(epasswd); + if (epasswd_len) + _free(epasswd); goto out; } - _free(epasswd); + if (epasswd_len) + _free(epasswd); if (conf_sid_in_auth) if (rad_packet_add_str(req->pack, "Acct-Session-Id", rpd->ppp->sessionid, PPP_SESSIONID_LEN)) |