Bug 27727 - pam-univentioncyrus: Speicherleck, falscher Formatstring, deprecated LDAP Funktionen
pam-univentioncyrus: Speicherleck, falscher Formatstring, deprecated LDAP Fun...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: PAM
UCS 3.0
All Linux
: P5 normal (vote)
: UCS 3.0-2
Assigned To: Philipp Hahn
Sönke Schwardt-Krummrich
: interim-2
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-22 17:14 CEST by Philipp Hahn
Modified: 2012-07-20 15:24 CEST (History)
1 user (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
hahn: Patch_Available+


Attachments
memory leak, format string falsch, deprecated LDAP functions (7.58 KB, patch)
2012-06-22 17:15 CEST, Philipp Hahn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2012-06-22 17:14:49 CEST
Fix memory leak by calling univention_ldap_close()
-   lp = univention_ldap_new();
-   lp->host = strdup(ldap_host);
-   lp->base = strdup(ldap_base);
-   lp->binddn = strdup(binddn);
-   lp->bindpw = strdup(bindpw);

Fix formatstring for printing filter
-       _log_err(LOG_NOTICE, "Failed to query LDAP server: ", filter);

Replace deprecated ldap_*() functions with ldap_*_ext()
-   ldap_search_s(lp->ld, ldap_base, LDAP_SCOPE_SUBTREE, filter, attrs, 0, &res)
-   ldap_get_values(lp->ld, entry, toattr)
-   ldap_count_values(values)
-   ldap_value_free(values)
Comment 1 Philipp Hahn univentionstaff 2012-06-22 17:15:34 CEST
Created attachment 4474 [details]
memory leak, format string falsch, deprecated LDAP functions
Comment 2 Philipp Hahn univentionstaff 2012-06-22 19:49:36 CEST
# Zum testen
/etc/init.d/saslauthd stop
/usr/sbin/saslauthd -a pam -t 1 -c -r -m /var/run/saslauthd -n 1 -d &>/dev/null &
ps -o pid=,rss= `pgrep saslauthd` # 3132
/usr/sbin/testsaslauthd -u phahn1@pmhahn.dev -p univention -R 20000 >/dev/null
ps -o pid=,rss= `pgrep saslauthd` # 4800
/usr/sbin/testsaslauthd -u phahn2@pmhahn.dev -p univention -R 20000 >/dev/null
ps -o pid=,rss= `pgrep saslauthd` # 4828
/usr/sbin/testsaslauthd -u phahn3@pmhahn.dev -p univention -R 20000 >/dev/null
ps -o pid=,rss= `pgrep saslauthd` # 4852
pkill saslauthd
dpkg -i ../libpam-univentionmailcyrus_4.0.4-1_amd64.deb
/usr/sbin/saslauthd -a pam -t 1 -c -r -m /var/run/saslauthd -n 1 -d &>/dev/null &
ps -o pid=,rss= `pgrep saslauthd` # 3132
/usr/sbin/testsaslauthd -u phahn1@pmhahn.dev -p univention -R 20000 >/dev/null
ps -o pid=,rss= `pgrep saslauthd` # 4760
/usr/sbin/testsaslauthd -u phahn2@pmhahn.dev -p univention -R 20000 >/dev/null
ps -o pid=,rss= `pgrep saslauthd` # 4764
/usr/sbin/testsaslauthd -u phahn3@pmhahn.dev -p univention -R 20000 >/dev/null
ps -o pid=,rss= `pgrep saslauthd` # 4768
pkill saslauthd
/etc/init.d/saslauthd start

svn33719, pam-univentionmailcyrus_4.0.4-1.33.201206221946

ChangeLog: svn13609
\item A memory leak has been fixed in the Cyrus PAM module (\ucsBug{27727}).
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2012-07-02 18:29:27 CEST
Patch ist ok; Memoryleak konnte nachgestellt werden und ist mit Patch nicht mehr vorhanden; Authentifizierung funktioniert mit testsaslauthd und direkt über IMAP; weitere Memoryleaks ließen sich zunächst nicht provozieren; Changelogeintrag ist ok;
Comment 4 Stefan Gohmann univentionstaff 2012-07-20 15:24:57 CEST
UCS 3.0-2 has been released: 
  http://forum.univention.de/viewtopic.php?f=54&t=1905

If this error occurs again, please use "Clone This Bug".