Skip to content

Commit

Permalink
ldap: more useful info on reconnect
Browse files Browse the repository at this point in the history
- reconnect message made a notice level, being not an error situation
- print the chosen ldap server address at info level when reconnecting

(cherry picked from commit c5ae402)
(cherry picked from commit b2aa72a)
  • Loading branch information
miconda committed Dec 18, 2015
1 parent be3623e commit 2665896
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/ldap/ldap_connect.c
Expand Up @@ -41,7 +41,7 @@
#include "../../mem/mem.h"
#include "../../ut.h"

int ldap_connect(char* _ld_name)
int ldap_connect_ex(char* _ld_name, int llevel)
{
int rc;
int ldap_bind_result_code;
Expand Down Expand Up @@ -226,13 +226,18 @@ int ldap_connect(char* _ld_name)
/* ldap_msgfree(result); */


LM_DBG( "[%s]: LDAP bind successful (ldap_host [%s])\n",
LOG(llevel, "[%s]: LDAP bind successful (ldap_host [%s])\n",
_ld_name,
lds->host_name);

return 0;
}

int ldap_connect(char* _ld_name)
{
return ldap_connect(_ld_name, L_DBG);
}

int ldap_disconnect(char* _ld_name)
{
struct ld_session* lds;
Expand Down Expand Up @@ -267,14 +272,14 @@ int ldap_reconnect(char* _ld_name)
return -1;
}

if ((rc = ldap_connect(_ld_name)) != 0)
if ((rc = ldap_connect_ex(_ld_name, L_INFO)) != 0)
{
LM_ERR("[%s]: reconnect failed\n",
_ld_name);
}
else
{
LM_ERR("[%s]: LDAP reconnect successful\n",
LM_NOTICE("[%s]: LDAP reconnect successful\n",
_ld_name);
}
return rc;
Expand Down

0 comments on commit 2665896

Please sign in to comment.