summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2009-04-25 14:06:22 +0000
committerArthur de Jong <arthur@arthurdejong.org>2009-04-25 14:06:22 +0000
commit1bccdfe10c32a830f36116d0266af4c6ed4eb5c4 (patch)
tree04bb469be1fe2beddc0a97a376c57032021903df
parentbf126939bdefe07585ddb1225ef273c87087a74f (diff)
clear errno before ldap calls to get usable returned errno
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@848 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--nslcd/myldap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/nslcd/myldap.c b/nslcd/myldap.c
index 3790d0a..db87a84 100644
--- a/nslcd/myldap.c
+++ b/nslcd/myldap.c
@@ -375,6 +375,7 @@ static int do_bind(MYLDAP_SESSION *session,const char *uri)
/* check if StartTLS is requested */
if (nslcd_cfg->ldc_ssl_on==SSL_START_TLS)
{
+ errno=0;
rc=ldap_start_tls_s(session->ld,NULL,NULL);
if (rc!=LDAP_SUCCESS)
{
@@ -640,6 +641,7 @@ static int do_open(MYLDAP_SESSION *session)
session->ld=NULL;
session->lastactivity=0;
/* open the connection */
+ errno=0;
rc=ldap_initialize(&(session->ld),nslcd_cfg->ldc_uris[session->current_uri].uri);
if (rc!=LDAP_SUCCESS)
{
@@ -671,6 +673,7 @@ static int do_open(MYLDAP_SESSION *session)
return rc;
}
/* bind to the server */
+ errno=0;
rc=do_bind(session,nslcd_cfg->ldc_uris[session->current_uri].uri);
if (rc!=LDAP_SUCCESS)
{
@@ -1463,6 +1466,7 @@ static char **get_exploded_rdn(const char *dn)
/* explode rdn (first part of exploded_dn),
e.g. "cn=Test User+uid=testusr" into
{ "cn=Test User", "uid=testusr", NULL } */
+ errno=0;
exploded_rdn=ldap_explode_rdn(exploded_dn[0],0);
if ((exploded_rdn==NULL)||(exploded_rdn[0]==NULL))
{