Côme Chilliet <come(a)opensides.be> wrote:
I don't know what ldap_refresh is for and never used it.
it lets you change the expiry date of dynamic objects, cf slapo-dds man page.
Here is the previous implementation, I am not sure of what has to be changed. I
understood TSRMLS_CC had to go for instance, but is thezre anything esle?
/* {{{ proto ? ldap_refresh(resource link , string dn , int ttl, [int *newttl])
DDS refresh extended operation */
PHP_FUNCTION(ldap_refresh)
{
zval **link, **dn, **ttl, **newttl;
struct berval ldn;
ber_int_t lttl;
ber_int_t lnewttl;
ldap_linkdata *ld;
LDAP *ldap;
LDAPMessage *ldap_res;
int rc, msgid, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|Z",
&link,
&dn, &ttl, &newttl) != SUCCESS) {
WRONG_PARAM_COUNT;
}
if (Z_TYPE_PP(link) == IS_NULL) {
ldap = NULL;
} else {
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *,
link, -1, "ldap link", le_link);
ldap = ld->link;
}
ldn.bv_len = 0;
convert_to_string_ex(dn);
ldn.bv_val = Z_STRVAL_PP(dn);
ldn.bv_len = Z_STRLEN_PP(dn);
convert_to_long_ex(ttl);
lttl = (ber_int_t)Z_LVAL_PP(ttl);
/* asynchronous call */
rc = ldap_refresh_s(ld->link, &ldn, lttl, &lnewttl, NULL, NULL);
if (rc != LDAP_SUCCESS ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Refresh extended operation failed: %s (%d)",
ldap_err2string(rc), rc);
RETURN_FALSE;
}
if (myargcount == 4) {
zval_dtor(*newttl);
ZVAL_LONG(*newttl, (long)lnewttl);
}
RETURN_TRUE;
}
--
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu(a)netbsd.org