/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2005-2007 The OpenLDAP Foundation.
+ * Copyright 2005-2011 The OpenLDAP Foundation.
* Portions Copyright 2005-2006 SysNet s.n.c.
* All rights reserved.
*
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;
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 ) {