]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/dds.c
Merge remote branch 'origin/mdb.master'
[openldap] / libraries / libldap / dds.c
index 6897054590e52a249235e7aa7c6fdcfcc623e536..3c95eb4f3dac3f0f698afd6ebd4e5d93fc803848 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2006 The OpenLDAP Foundation.
+ * Copyright 2005-2011 The OpenLDAP Foundation.
  * Portions Copyright 2005-2006 SysNet s.n.c.
  * All rights reserved.
  *
@@ -113,13 +113,14 @@ ldap_refresh(
        rc = ber_flatten2( ber, &bv, 0 );
 
        if ( rc < 0 ) {
-               ld->ld_errno = LDAP_ENCODING_ERROR;
-               return ld->ld_errno;
+               rc = ld->ld_errno = LDAP_ENCODING_ERROR;
+               goto done;
        }
 
        rc = ldap_extended_operation( ld, LDAP_EXOP_REFRESH, &bv,
                sctrls, cctrls, msgidp );
 
+done:;
         ber_free( ber, 1 );
 
        return rc;
@@ -142,7 +143,7 @@ ldap_refresh_s(
        if ( rc != LDAP_SUCCESS ) return rc;
        
        rc = ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *)NULL, &res );
-       if( rc == -1 ) return ld->ld_errno;
+       if( rc == -1 || !res ) return ld->ld_errno;
 
        rc = ldap_parse_refresh( ld, res, newttl );
        if( rc != LDAP_SUCCESS ) {