ldapauth memory leak fixed

Привет !
Исправил старую багу по утечки памяти в плагине .. теперь вообще не
течет ,
глупая ошибка.. Вот так 3,5  года не попрограммируеш , срузу ошибку
найдеш :)

--
Kirill Lopuchov
This commit is contained in:
Vladimir Dubrovin 2014-05-04 23:10:14 +04:00 committed by z3APA3A
parent 1a27fd88a9
commit eb8522bb8f
2 changed files with 11 additions and 13 deletions

View File

@ -121,6 +121,9 @@ static int ldapfunc(struct clientparam *param)
int rc = -1; int rc = -1;
char tmpbuf[1024]; char tmpbuf[1024];
/* test proxy user auth ------------------------*/
if(!param->username || !param->password) return 4;
if(strlen(param->password)==0) return 4;
/* init ldap ---------------------- */ /* init ldap ---------------------- */
ld = ldap_init( ldap_serv, 389 ); ld = ldap_init( ldap_serv, 389 );
@ -131,9 +134,6 @@ static int ldapfunc(struct clientparam *param)
return 7; return 7;
} }
/* test proxy user auth ------------------------*/
if(!param->username || !param->password) return 4;
if(strlen(param->password)==0) return 4;
/* this code for Active Directory LDAP catalog :( /* this code for Active Directory LDAP catalog :(
detail see documentation for plugin */ detail see documentation for plugin */
@ -161,6 +161,14 @@ static int ldapfunc(struct clientparam *param)
ldap_unbind_s(ld); ldap_unbind_s(ld);
ld = ldap_init( ldap_serv, 389 ); ld = ldap_init( ldap_serv, 389 );
if ( ld == NULL )
{
param->srv->logfunc(param,"Error ldap_init: No init lib ldap");
/*ldap_perror( ld, "Error ldap_init" ); */
return 7;
}
rc = ldap_bind_s( ld, ldap_user, ldap_pass, LDAP_AUTH_SIMPLE ); rc = ldap_bind_s( ld, ldap_user, ldap_pass, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) if ( rc != LDAP_SUCCESS )

View File

@ -27,11 +27,6 @@ http://lucas.bergmans.us/hacks/openldap/
под unix подобной ОС (Freebsd) использовался стандартный gcc. под unix подобной ОС (Freebsd) использовался стандартный gcc.
и библиотеки openldap-client. и библиотеки openldap-client.
!!!! Внимание при работе плагина возможна утечка памяти !!!!
У меня на Win 2000 Serv и окола 600 пользователях при канале 500 кбит/сек .
процесс 3proxy за сутки выростает до 40 мб . Лечится рестартом сервиса.
Если кто то знает хорошо Open Ldap api и может указать на ошибку в плагине
с радостью выслушаю :) .
2. Настройка плагина. 2. Настройка плагина.
@ -328,11 +323,6 @@ http://lucas.bergmans.us/hacks/openldap/
РПД unix РПДПВОПК пу (Freebsd) ЙУРПМШЪПЧБМУС УФБОДБТФОЩК gcc. РПД unix РПДПВОПК пу (Freebsd) ЙУРПМШЪПЧБМУС УФБОДБТФОЩК gcc.
Й ВЙВМЙПФЕЛЙ openldap-client. Й ВЙВМЙПФЕЛЙ openldap-client.
!!!! чОЙНБОЙЕ РТЙ ТБВПФЕ РМБЗЙОБ ЧПЪНПЦОБ ХФЕЮЛБ РБНСФЙ !!!!
х НЕОС ОБ Win 2000 Serv Й ПЛПМБ 600 РПМШЪПЧБФЕМСИ РТЙ ЛБОБМЕ 500 ЛВЙФ/УЕЛ .
РТПГЕУУ 3proxy ЪБ УХФЛЙ ЧЩТПУФБЕФ ДП 40 НВ . мЕЮЙФУС ТЕУФБТФПН УЕТЧЙУБ.
еУМЙ ЛФП ФП ЪОБЕФ ИПТПЫП Open Ldap api Й НПЦЕФ ХЛБЪБФШ ОБ ПЫЙВЛХ Ч РМБЗЙОЕ
У ТБДПУФША ЧЩУМХЫБА :) .
2. оБУФТПКЛБ РМБЗЙОБ. 2. оБУФТПКЛБ РМБЗЙОБ.