The following issue has been SUBMITTED. ====================================================================== http://dbmail.org/mantis/view.php?id=663 ====================================================================== Reported By: vugluskr Assigned To: ====================================================================== Project: DBMail Issue ID: 663 Category: Authentication layer Reproducibility: always Severity: major Priority: normal Status: new target: ====================================================================== Date Submitted: 16-Dec-07 18:38 CET Last Modified: 16-Dec-07 18:38 CET ====================================================================== Summary: Authldap module reloads when it try to recconect Description: Continue of 0000612 issue. :)
I have check 2.2.7 release and problem still there. When module try to reconnect to LDAP server it call it's own function auth_dissconnect(modules/authldap.c:217), auth_connect(modules/authpldap.c:146)... you can see it in modules/authldap.c line 270. But... it call not his internal functions, he call global atuh_connect and auth_dissconect from authmodule.c I have write simple program to emulate behavior of dbmail's module. It in attach. Here is it's output. Plan 1 Step 0: app::test_funct(): -> APP! test_function. Step 1: load module Step 2: ptr_func() {expect plugin::test_funct} -> PLUGIN! test_function. Step 3: Indirect call -> PLUGIN! Call plugin::test_funct() -> APP! test_function. Step 4: app::test_function() -> APP! test_function. On "Step 3" we can see same behavior as in dbmail/authldap module. I also have and patch to fix it... but because I can't attach more than one file... here he is. :) ------------< cut here <------------ diff -Naur dbmail-2.2.7.orig/modules/authldap.c dbmail-2.2.7/modules/authldap.c --- dbmail-2.2.7.orig/modules/authldap.c 2007-10-27 11:09:47.000000000 +0300 +++ dbmail-2.2.7/modules/authldap.c 2007-11-29 23:52:25.000000000 +0200 @@ -56,7 +56,9 @@ static GList * __auth_get_every_match(const char *q, char **retfields); static int dm_ldap_user_shadow_rename(u64_t user_idnr, const char *new_name); -static int auth_reconnect(void); +static int authldap_connect(void); +static int authldap_disconnect(void); +static int authldap_reconnect(void); static int auth_search(const gchar *query); static void __auth_get_config(void) @@ -136,14 +138,19 @@ } +/* Module api wrappers */ +int auth_connect(void) + { return authldap_connect(); } +int auth_disconnect(void) + { return authldap_disconnect(); } /* - * auth_connect() + * authldap_connect() * * initializes the connection for authentication. * * returns 0 on success, -1 on failure */ -int auth_connect(void) +static int authldap_connect(void) { int version = 0; #ifdef HAVE_LDAP_INITIALIZE @@ -214,7 +221,7 @@ return auth_ldap_bind(); } -int auth_disconnect(void) +static int authldap_disconnect(void) { /* Destroy the connection */ if (_ldap_conn != NULL) { @@ -235,6 +242,12 @@ return 0; } +static int authldap_reconnect(void) +{ + authldap_disconnect(); + return authldap_connect(); +} + static int auth_search(const gchar *query) { int c=0; @@ -252,7 +265,7 @@ switch (_ldap_err) { case LDAP_SERVER_DOWN: TRACE(TRACE_WARNING, "LDAP gone away: %s. Try to reconnect(%d/5).", ldap_err2string(_ldap_err),c); - if (auth_reconnect()) + if (authldap_reconnect()) sleep(2); // reconnect failed. wait before trying again break; default: @@ -266,13 +279,6 @@ return -1; } - -static int auth_reconnect(void) -{ - auth_disconnect(); - return auth_connect(); -} - void dm_ldap_freeresult(GList *entlist) { GList *fldlist, *attlist; ------------< cut here <------------ ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 16-Dec-07 18:38 vugluskr New Issue 16-Dec-07 18:38 vugluskr File Added: test-plugin.tar.gz ====================================================================== _______________________________________________ Dbmail-dev mailing list Dbmail-dev@dbmail.org http://twister.fastxs.net/mailman/listinfo/dbmail-dev