cvs: php4 /ext/ldap ldap.c
| From: | Jani Taskinen | Date: | Sun, 23 Jul 2000 21:32:03 +0000 |
| Subject: | cvs: php4 /ext/ldap ldap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-875@lists.php.net to get a copy of this message | ||
sniper Sun Jul 23 14:32:03 2000 EDT
Modified files:
/php4/ext/ldap ldap.c
Log:
It's better not touch those ldap->ld_* when they aren't given as parameters.
(Now using -1 the parameters not wanted can be omitted)
# Plus some source-polishing.
Index: php4/ext/ldap/ldap.c
diff -u php4/ext/ldap/ldap.c:1.48 php4/ext/ldap/ldap.c:1.49
--- php4/ext/ldap/ldap.c:1.48 Fri Jul 21 17:34:22 2000
+++ php4/ext/ldap/ldap.c Sun Jul 23 14:32:02 2000
@@ -21,7 +21,7 @@
*/
-/* $Id: ldap.c,v 1.48 2000/07/22 00:34:22 sniper Exp $ */
+/* $Id: ldap.c,v 1.49 2000/07/23 21:32:02 sniper Exp $ */
#define IS_EXT_MODULE
#include "php.h"
@@ -86,9 +86,9 @@
PHP_FE(ldap_mod_replace, NULL)
PHP_FE(ldap_mod_del, NULL)
/* end gjt mod */
- PHP_FE(ldap_errno, NULL)
+ PHP_FE(ldap_errno, NULL)
PHP_FE(ldap_err2str, NULL)
- PHP_FE(ldap_error, NULL)
+ PHP_FE(ldap_error, NULL)
{NULL, NULL, NULL}
};
@@ -99,7 +99,6 @@
};
-
#ifdef COMPILE_DL_LDAP
ZEND_GET_MODULE(ldap)
#endif
@@ -139,7 +138,7 @@
REGISTER_INI_ENTRIES();
- /* Consts to be used with deref-parameter in php_ldap_do_search() */
+ /* Constants to be used with deref-parameter in php_ldap_do_search() */
REGISTER_MAIN_LONG_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT |
CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING,
CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT |
CONST_CS);
@@ -185,7 +184,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "LDAP Support", "enabled" );
- php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.48 2000/07/22 00:34:22
sniper Exp $" );
+ php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.49 2000/07/23 21:32:02
sniper Exp $" );
php_info_print_table_row(2, "Total Links", maxl );
#if HAVE_NSLDAP
@@ -216,6 +215,7 @@
}
+
/* {{{ proto int ldap_connect([string host [, int port]])
Connect to an LDAP server */
PHP_FUNCTION(ldap_connect)
@@ -362,10 +362,11 @@
return ber;
}
+
#if 0
PHP_FUNCTION(ber_free)
{
- pval **berp;
+ pval **berp;
if ( zend_get_parameters_ex(1,&berp) == FAILURE ) {
WRONG_PARAM_COUNT;
@@ -376,6 +377,7 @@
}
#endif
+
/* {{{ proto int ldap_bind(int link [, string dn, string password])
Bind to LDAP directory */
PHP_FUNCTION(ldap_bind)
@@ -432,6 +434,7 @@
}
/* }}} */
+
/* {{{ proto int ldap_unbind(int link)
Unbind from LDAP directory */
PHP_FUNCTION(ldap_unbind)
@@ -460,10 +463,10 @@
char *ldap_base_dn, *ldap_filter;
LDAP *ldap;
char **ldap_attrs = NULL;
- int ldap_attrsonly = 0; /* 0 = types & values , 1 = only attributes types */
- int ldap_sizelimit = 0; /* LDAP_NO_LIMIT 0 */
- int ldap_timelimit = 0; /* 0 = no timelimit? */
- int ldap_deref = 0; /* LDAP_DEREF_NEVER 0, LDAP_DEREF_SEARCHING 1, LDAP_DEREF_FINDING 2,
LDAP_DEREF_ALWAYS 3 */
+ int ldap_attrsonly = 0;
+ int ldap_sizelimit = -1;
+ int ldap_timelimit = -1;
+ int ldap_deref = -1;
LDAPMessage *ldap_result;
int num_attribs = 0;
int i, errno;
@@ -537,17 +540,17 @@
if (ldap == NULL) RETURN_FALSE;
/* sizelimit */
- if(ldap_sizelimit > 0) {
+ if(ldap_sizelimit > -1) {
ldap->ld_sizelimit = ldap_sizelimit;
}
/* timelimit */
- if(ldap_timelimit > 0) {
+ if(ldap_timelimit > -1) {
ldap->ld_timelimit = ldap_timelimit;
}
/* deref */
- if(ldap_deref > 0) {
+ if(ldap_deref > -1) {
ldap->ld_deref = ldap_deref;
}
@@ -625,6 +628,7 @@
}
/* }}} */
+
/* {{{ proto int ldap_count_entries(int link, int result)
Count the number of entries in a search result */
PHP_FUNCTION(ldap_count_entries)
@@ -647,6 +651,7 @@
}
/* }}} */
+
/* {{{ proto int ldap_first_entry(int link, int result)
Return first result id */
PHP_FUNCTION(ldap_first_entry)
@@ -675,6 +680,7 @@
}
/* }}} */
+
/* {{{ proto int ldap_next_entry(int link, int entry)
Get next result entry */
PHP_FUNCTION(ldap_next_entry)
@@ -702,6 +708,7 @@
}
/* }}} */
+
/* {{{ proto array ldap_get_entries(int link, int result)
Get all result entries */
PHP_FUNCTION(ldap_get_entries)
@@ -789,6 +796,7 @@
}
/* }}} */
+
/* {{{ proto string ldap_first_attribute(int link, int result, int ber)
Return first attribute */
PHP_FUNCTION(ldap_first_attribute)
@@ -825,6 +833,7 @@
}
/* }}} */
+
/* {{{ proto string ldap_next_attribute(int link, int result, int ber)
Get the next attribute in result */
PHP_FUNCTION(ldap_next_attribute)
@@ -858,6 +867,7 @@
}
/* }}} */
+
/* {{{ proto array ldap_get_attributes(int link, int result)
Get attributes from a search result entry */
PHP_FUNCTION(ldap_get_attributes)
@@ -916,6 +926,7 @@
}
/* }}} */
+
/* {{{ proto array ldap_get_values(int link, int result, string attribute)
Get all values from a result entry */
PHP_FUNCTION(ldap_get_values)
@@ -967,6 +978,7 @@
}
/* }}} */
+
/* {{{ proto array ldap_get_values_len(int link, int result, string attribute)
Get the lengths for all values from a result entry */
PHP_FUNCTION(ldap_get_values_len)
@@ -1050,6 +1062,7 @@
}
/* }}} */
+
/* {{{ proto array ldap_explode_dn(string dn, int with_attrib)
Splits DN into its component parts */
PHP_FUNCTION(ldap_explode_dn)
@@ -1084,6 +1097,7 @@
}
/* }}} */
+
/* {{{ proto string ldap_dn2ufn(string dn)
Convert DN to User Friendly Naming format */
PHP_FUNCTION(ldap_dn2ufn)
@@ -1110,10 +1124,9 @@
}
/* }}} */
+
/* added to fix use of ldap_modify_add for doing an ldap_add, gerrit thomson. */
#define PHP_LD_FULL_ADD 0xff
-
-
static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
{
pval **link, **dn, **entry, **value, **ivalue;
@@ -1220,6 +1233,7 @@
return;
}
+
/* {{{ proto int ldap_add(int link, string dn, array entry)
Add entries to LDAP directory */
PHP_FUNCTION(ldap_add)
@@ -1242,8 +1256,6 @@
/* three functions for attribute base modifications, gerrit Thomson */
-
-
/* {{{ proto int ldap_mod_replace(int link, string dn, array entry)
Replace attribute values with new ones */
PHP_FUNCTION(ldap_mod_replace)
@@ -1251,6 +1263,7 @@
php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE);}
/* }}} */
+
/* {{{ proto int ldap_mod_add(int link, string dn, array entry)
Add attribute values to current */
PHP_FUNCTION(ldap_mod_add)
@@ -1259,12 +1272,14 @@
}
/* }}} */
+
/* {{{ proto int ldap_mod_del(int link, string dn, array entry)
Delete attribute values */
PHP_FUNCTION(ldap_mod_del)
{
php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_DELETE);
}
+/* }}} */
/* end of attribute based functions , gerrit thomson */
@@ -1295,6 +1310,7 @@
RETURN_TRUE;
}
/* }}} */
+
/* {{{ proto int ldap_errno(int link)
Get the current ldap error number */