PHP_FE(ldap_err2str, NULL)
PHP_FE(ldap_error, NULL)
PHP_FE(ldap_compare, NULL)
+ PHP_FE(ldap_sort, NULL)
#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
PHP_FE(ldap_get_option, third_argument_force_ref)
}
/* }}} */
+/* {{{ proto int ldap_sort(int link, int result, string sortfilter)
+ Sort LDAP result entries */
+PHP_FUNCTION(ldap_sort)
+{
+ zval *link, *result;
+ LDAP *ldap;
+ char *sortfilter;
+ int sflen;
+ zend_rsrc_list_entry *le;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrs", &link, &result, &sortfilter, &sflen) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ ZEND_FETCH_RESOURCE(ldap, LDAP *, &link, -1, "ldap link", le_link);
+
+ if (zend_hash_index_find(&EG(regular_list), Z_LVAL_P(result), (void **) &le) == FAILURE || le->type != le_result) {
+ php_error(E_WARNING, "Supplied resource is not a valid ldap result resource");
+ RETURN_FALSE;
+ }
+
+ if (ldap_sort_entries(ldap, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) {
+ php_error(E_WARNING, "LDAP sort failed: %s", ldap_err2string(errno));
+ RETURN_FALSE;
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+
#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP
/* {{{ proto boolean ldap_get_option(int link, int option, mixed retval)