/* $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.
*
#include "ldap-int.h"
int
-ldap_parse_refresh( LDAP *ld, LDAPMessage *res, int *newttl )
+ldap_parse_refresh( LDAP *ld, LDAPMessage *res, ber_int_t *newttl )
{
int rc;
struct berval *retdata = NULL;
ldap_refresh(
LDAP *ld,
struct berval *dn,
- int ttl,
+ ber_int_t ttl,
LDAPControl **sctrls,
LDAPControl **cctrls,
int *msgidp )
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;
ldap_refresh_s(
LDAP *ld,
struct berval *dn,
- int ttl,
- int *newttl,
+ ber_int_t ttl,
+ ber_int_t *newttl,
LDAPControl **sctrls,
LDAPControl **cctrls )
{
LDAPMessage *res;
rc = ldap_refresh( ld, dn, ttl, sctrls, cctrls, &msgid );
- if ( rc != LDAP_SUCCESS ) {
- return rc;
- }
-
- if ( ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *)NULL, &res ) == -1 ) {
- return ld->ld_errno;
- }
+ if ( rc != LDAP_SUCCESS ) return rc;
+
+ rc = ldap_result( ld, msgid, LDAP_MSG_ALL, (struct timeval *)NULL, &res );
+ if( rc == -1 || !res ) return ld->ld_errno;
rc = ldap_parse_refresh( ld, res, newttl );
if( rc != LDAP_SUCCESS ) {
return rc;
}
- return( ldap_result2error( ld, res, 1 ) );
+ return ldap_result2error( ld, res, 1 );
}