summaryrefslogtreecommitdiff
path: root/ext/ldap
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2000-07-06 16:19:37 +0000
committerSVN Migration <svn@php.net>2000-07-06 16:19:37 +0000
commit3f80132ea88b86b490995107bdad7d1dead9d15c (patch)
tree4d1339e322a7f46d821797371733532010b75f2c /ext/ldap
parent45ca7ec17d7d9cc0f57f89a403a60064e3ddbd25 (diff)
downloadphp-git-3f80132ea88b86b490995107bdad7d1dead9d15c.tar.gz
This commit was manufactured by cvs2svn to create tagPRE_METHOD_CALL_SEPERATE_FIX_PATCH
'PRE_METHOD_CALL_SEPERATE_FIX_PATCH'.
Diffstat (limited to 'ext/ldap')
-rw-r--r--ext/ldap/LDAP_Win32_HOWTO.txt33
-rw-r--r--ext/ldap/Makefile.in5
-rw-r--r--ext/ldap/config.m481
-rw-r--r--ext/ldap/ldap.c1342
-rw-r--r--ext/ldap/ldap.dsp172
-rw-r--r--ext/ldap/php_ldap.h116
-rw-r--r--ext/ldap/setup.stub8
7 files changed, 0 insertions, 1757 deletions
diff --git a/ext/ldap/LDAP_Win32_HOWTO.txt b/ext/ldap/LDAP_Win32_HOWTO.txt
deleted file mode 100644
index ae085de86b..0000000000
--- a/ext/ldap/LDAP_Win32_HOWTO.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Rules for building LDAP
------------------------
-
-Note 1: During the entire build process, you can ignore warnings about
- inconsistent DLL linkage.
-
-
-- Open LDAP under php_build. Rename this directory to 'OpenLDAP'.
-- Rename OpenLDAP\include\portable.h.nt to OpenLDAP\include\portable.h
-- Rename OpenLDAP\include\ldapconfig.h.nt to OpenLDAP\include\ldapconfig.h
-- Launch Visual Studio with OpenLDAP\libraries\libldap\libldap.dsw
-- Enter Project->Settings.
- Select the C/C++ tab, and select 'Code Generation' in the Category box.
- For 'Win32 Debug', change the runtime library to 'Debug Multithreaded DLL'
- For 'Win32 Release', change the runtime library to 'Multithreaded DLL'
- Select the Preprocessor tab, select 'All Configurations'.
- Add '..\..\..\..\php4\regex' to the 'Additional include directories' list.
- Add 'HAVE_MKTEMP' to the 'Preprocessor definitions' list.
-- Compile (you can compile both Debug and Release versions).
-
-
-- Launch Visual Studio with OpenLDAP\libraries\liblber\liblber.dsw
-- Enter Project->Settings.
- Select the C/C++ tab, and select 'Code Generation' in the Category box.
- For 'Win32 Debug', change the runtime library to 'Debug Multithreaded DLL'
- For 'Win32 Release', change the runtime library to 'Multithreaded DLL'
- Select the Preprocessor tab, select 'All Configurations'.
- Add 'HAVE_MKTEMP' to the 'Preprocessor definitions' list.
-- Compile (you can compile both Debug and Release versions).
-
-
-Start Visual Studio, load php_modules.dsw, select the LDAP project, and build
-it.
diff --git a/ext/ldap/Makefile.in b/ext/ldap/Makefile.in
deleted file mode 100644
index dd196e1f26..0000000000
--- a/ext/ldap/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-LTLIBRARY_NAME = libldap.la
-LTLIBRARY_SOURCES = ldap.c
-
-include $(top_srcdir)/build/dynlib.mk
diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4
deleted file mode 100644
index c86aca2b8a..0000000000
--- a/ext/ldap/config.m4
+++ /dev/null
@@ -1,81 +0,0 @@
-dnl $Id$
-
-AC_MSG_CHECKING(for LDAP support)
-AC_ARG_WITH(ldap,
-[ --with-ldap[=DIR] Include LDAP support. DIR is the LDAP base
- install directory, defaults to /usr/local/ldap],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- if test -f /usr/include/ldap.h; then
- LDAP_INCDIR=/usr/include
- LDAP_LIBDIR=/usr/lib
- elif test -f /usr/local/include/ldap.h; then
- LDAP_INCDIR=/usr/local/include
- LDAP_LIBDIR=/usr/local/lib
- elif test -f /usr/local/ldap/include/ldap.h; then
- LDAP_INCDIR=/usr/local/ldap/include
- LDAP_LIBDIR=/usr/local/ldap/lib
- elif test -f /usr/include/umich-ldap/ldap.h; then
- LDAP_INCDIR=/usr/include/umich-ldap
- LDAP_LIBDIR=/usr/lib
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Unable to find ldap.h)
- fi
- else
- if test -f $withval/include/ldap.h; then
- LDAP_INCDIR=$withval/include
- LDAP_LIBDIR=$withval/lib
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Unable to find $withval/include/ldap.h)
- fi
- fi
-
-dnl The Linux version of the SDK need -lpthread
-dnl I have tested Solaris, and it doesn't, but others may. Add
-dnl these here if necessary. -RL
-
- if test `uname` = "Linux"; then
- LDAP_PTHREAD="pthread"
- else
- LDAP_PTHREAD=
- fi
-
- if test -f $LDAP_LIBDIR/liblber.a; then
- LDAP_LIBS="-lldap -llber"
- AC_ADD_LIBRARY(ldap)
- AC_ADD_LIBRARY(lber,1)
- elif test -f $LDAP_LIBDIR/libldapssl30.so; then
- AC_ADD_LIBRARY(ldapssl30)
- AC_ADD_LIBRARY($LDAP_PTHREAD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
- elif test -f $LDAP_LIBDIR/libldapssl30.sl; then
- AC_ADD_LIBRARY(ldapssl30)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
- elif test -f $LDAP_LIBDIR/libldap30.so; then
- AC_ADD_LIBRARY(ldap30)
- AC_ADD_LIBRARY($LDAP_PTHREAD)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
- elif test -f $LDAP_LIBDIR/libldap30.sl; then
- AC_ADD_LIBRARY(ldap30)
- AC_DEFINE(HAVE_NSLDAP,1,[ ])
- elif test -f $LDAP_LIBDIR/libumich_ldap.so; then
- AC_ADD_LIBRARY(umich_ldap)
- AC_ADD_LIBRARY(umich_lber,1)
- fi
-
- AC_ADD_INCLUDE($LDAP_INCDIR)
- AC_ADD_LIBPATH($LDAP_LIBDIR)
-
- AC_DEFINE(HAVE_LDAP,1,[ ])
-
- AC_MSG_RESULT(yes)
- PHP_EXTENSION(ldap)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
deleted file mode 100644
index 50adb79053..0000000000
--- a/ext/ldap/ldap.c
+++ /dev/null
@@ -1,1342 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Amitay Isaacs <amitay@w-o-i.com> |
- | Eric Warnke <ericw@albany.edu> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- | Gerrit Thomson <334647@swin.edu.au> |
- | PHP 4.0 updates: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-#define IS_EXT_MODULE
-
-#include "php.h"
-#include "php_ini.h"
-
-#include "ext/standard/dl.h"
-#include "php_ldap.h"
-
-#ifdef PHP_WIN32
-#include <string.h>
-#if HAVE_NSLDAP
-#include <winsock.h>
-#endif
-#define strdup _strdup
-#undef WINDOWS
-#undef strcasecmp
-#undef strncasecmp
-#define WINSOCK 1
-#define __STDC__ 1
-#endif
-
-#include "ext/standard/php_string.h"
-#include "ext/standard/info.h"
-
-ZEND_DECLARE_MODULE_GLOBALS(ldap)
-
-
-static int le_result, le_result_entry, le_ber_entry;
-static int le_link;
-
-/*
- This is just a small subset of the functionality provided by the LDAP library. All the
- operations are synchronous. Referrals are not handled automatically.
-*/
-
-function_entry ldap_functions[] = {
- PHP_FE(ldap_connect, NULL)
- PHP_FALIAS(ldap_close, ldap_unbind, NULL)
- PHP_FE(ldap_bind, NULL)
- PHP_FE(ldap_unbind, NULL)
- PHP_FE(ldap_read, NULL)
- PHP_FE(ldap_list, NULL)
- PHP_FE(ldap_search, NULL)
- PHP_FE(ldap_free_result, NULL)
- PHP_FE(ldap_count_entries, NULL)
- PHP_FE(ldap_first_entry, NULL)
- PHP_FE(ldap_next_entry, NULL)
- PHP_FE(ldap_get_entries, NULL)
- PHP_FE(ldap_first_attribute, NULL)
- PHP_FE(ldap_next_attribute, NULL)
- PHP_FE(ldap_get_attributes, NULL)
- PHP_FE(ldap_get_values, NULL)
- PHP_FE(ldap_get_values_len, NULL)
- PHP_FE(ldap_get_dn, NULL)
- PHP_FE(ldap_explode_dn, NULL)
- PHP_FE(ldap_dn2ufn, NULL)
- PHP_FE(ldap_add, NULL)
- PHP_FE(ldap_delete, NULL)
- PHP_FE(ldap_modify, NULL)
-/* additional functions for attribute based modifications, Gerrit Thomson */
- PHP_FE(ldap_mod_add, NULL)
- PHP_FE(ldap_mod_replace, NULL)
- PHP_FE(ldap_mod_del, NULL)
-/* end gjt mod */
- PHP_FE(ldap_errno, NULL)
- PHP_FE(ldap_err2str, NULL)
- PHP_FE(ldap_error, NULL)
- {NULL, NULL, NULL}
-};
-
-
-zend_module_entry ldap_module_entry = {
- "ldap", ldap_functions, PHP_MINIT(ldap), PHP_MSHUTDOWN(ldap), NULL, NULL,
- PHP_MINFO(ldap), STANDARD_MODULE_PROPERTIES
-};
-
-
-
-#ifdef COMPILE_DL_LDAP
-ZEND_GET_MODULE(ldap)
-#endif
-
-
-static void _close_ldap_link(LDAP *ld)
-{
- LDAPLS_FETCH();
-
- ldap_unbind_s(ld);
- /* php_printf("Freeing ldap connection");*/
- LDAPG(num_links)--;
-}
-
-
-static void _free_ldap_result(LDAPMessage *result)
-{
- ldap_msgfree(result);
-}
-
-
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY_EX("ldap.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_ldap_globals, ldap_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("ldap.base_dn", NULL, PHP_INI_ALL, OnUpdateString, base_dn, zend_ldap_globals, ldap_globals)
-PHP_INI_END()
-
-
-static void php_ldap_init_globals(zend_ldap_globals *ldap_globals)
-{
- ldap_globals->num_links = 0;
-}
-
-
-PHP_MINIT_FUNCTION(ldap)
-{
- ZEND_INIT_MODULE_GLOBALS(ldap, php_ldap_init_globals, NULL);
-
- REGISTER_INI_ENTRIES();
-
- le_result = register_list_destructors(_free_ldap_result, NULL);
- le_link = register_list_destructors(_close_ldap_link, NULL);
-
- ldap_module_entry.type = type;
-
- return SUCCESS;
-}
-
-
-PHP_MSHUTDOWN_FUNCTION(ldap)
-{
- return SUCCESS;
-}
-
-
-PHP_MINFO_FUNCTION(ldap)
-{
- char maxl[32];
-#if HAVE_NSLDAP
- char tmp[32];
- LDAPVersion ver;
- double SDKVersion;
-#endif
-
- LDAPLS_FETCH();
-
-#if HAVE_NSLDAP
-/* Print version information */
- SDKVersion = ldap_version( &ver );
-#endif
-
- if (LDAPG(max_links) == -1) {
- snprintf(maxl, 31, "%ld/unlimited", LDAPG(num_links) );
- } else {
- snprintf(maxl, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
- }
- maxl[31] = 0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "LDAP Support", "enabled" );
- php_info_print_table_row(2, "RCS Version", "$Id$" );
- php_info_print_table_row(2, "Total Links", maxl );
-
-#if HAVE_NSLDAP
-
- snprintf(tmp, 31, "%f", SDKVersion/100.0 );
- tmp[31]=0;
- php_info_print_table_row(2, "SDK Version", tmp );
-
- snprintf(tmp, 31, "%f", ver.protocol_version/100.0 );
- tmp[31]=0;
- php_info_print_table_row(2, "Highest LDAP Protocol Supported", tmp );
-
- snprintf(tmp, 31, "%f", ver.SSL_version/100.0 );
- tmp[31]=0;
- php_info_print_table_row(2, "SSL Level Supported", tmp );
-
- if ( ver.security_level != LDAP_SECURITY_NONE ) {
- snprintf(tmp, 31, "%d", ver.security_level );
- tmp[31]=0;
- } else {
- strcpy(tmp, "SSL not enabled" );
- }
- php_info_print_table_row(2, "Level of Encryption", tmp );
-
-#endif
-
- php_info_print_table_end();
-
-}
-
-/* {{{ proto int ldap_connect([string host [, int port]])
- Connect to an LDAP server */
-PHP_FUNCTION(ldap_connect)
-{
- char *host;
- int port;
- /* char *hashed_details;
- int hashed_details_length;*/
- LDAP *ldap;
- LDAPLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 0:
- host = NULL;
- port = 0;
- /* hashed_details = estrndup("ldap_", 5);
- hashed_details_length = 4+1; */
- break;
-
- case 1: {
- pval **yyhost;
-
- if (zend_get_parameters_ex(1, &yyhost) == FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(yyhost);
- host = (*yyhost)->value.str.val;
- port = 389; /* Default port */
-
- /* hashed_details_length = yyhost->value.str.len+4+1;
- hashed_details = emalloc(hashed_details_length+1);
- sprintf(hashed_details, "ldap_%s", yyhost->value.str.val);*/
- }
- break;
-
- case 2: {
- pval **yyhost, **yyport;
-
- if (zend_get_parameters_ex(2, &yyhost,&yyport) == FAILURE) {
- RETURN_FALSE;
- }
-
- convert_to_string_ex(yyhost);
- host = (*yyhost)->value.str.val;
- convert_to_long_ex(yyport);
- port = (*yyport)->value.lval;
-
- /* Do we need to take care of hosts running multiple LDAP servers ? */
- /* hashed_details_length = yyhost->value.str.len+4+1;
- hashed_details = emalloc(hashed_details_length+1);
- sprintf(hashed_details, "ldap_%s", yyhost->value.str.val);*/
- }
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- if (LDAPG(max_links)!=-1 && LDAPG(num_links)>=LDAPG(max_links)) {
- php_error(E_WARNING, "LDAP: Too many open links (%d)", LDAPG(num_links));
- RETURN_FALSE;
- }
-
- ldap = ldap_open(host,port);
- if ( ldap == NULL ) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(zend_list_insert((void*)ldap,le_link));
- }
-
-}
-/* }}} */
-
-
-static LDAP * _get_ldap_link(pval **link)
-{
- LDAP *ldap;
- int type;
- LDAPLS_FETCH();
-
- convert_to_long_ex(link);
- ldap = (LDAP *) zend_list_find((*link)->value.lval, &type);
-
- if (!ldap || !(type == le_link)) {
- php_error(E_WARNING, "%d is not a LDAP link index",(*link)->value.lval);
- return NULL;
- }
- return ldap;
-}
-
-
-static LDAPMessage * _get_ldap_result(pval **result)
-{
- LDAPMessage *ldap_result;
- int type;
- LDAPLS_FETCH();
-
- convert_to_long_ex(result);
- ldap_result = (LDAPMessage *)zend_list_find((*result)->value.lval, &type);
-
- if (!ldap_result || type != le_result) {
- php_error(E_WARNING, "%d is not a LDAP result index",(*result)->value.lval);
- return NULL;
- }
-
- return ldap_result;
-}
-
-
-static LDAPMessage * _get_ldap_result_entry(pval **result)
-{
- LDAPMessage *ldap_result_entry;
- int type;
- LDAPLS_FETCH();
-
- convert_to_long_ex(result);
- ldap_result_entry = (LDAPMessage *)zend_list_find((*result)->value.lval, &type);
-
- if (!ldap_result_entry || type != le_result_entry) {
- php_error(E_WARNING, "%d is not a LDAP result entry index", (*result)->value.lval);
- return NULL;
- }
-
- return ldap_result_entry;
-}
-
-
-static BerElement * _get_ber_entry(pval **berp)
-{
- BerElement *ber;
- int type;
- LDAPLS_FETCH();
-
- convert_to_long_ex(berp);
- ber = (BerElement *) zend_list_find((*berp)->value.lval, &type);
-
- if ( type != le_ber_entry) {
- php_error(E_WARNING, "%d is not a BerElement index",(*berp)->value.lval);
- return NULL;
- }
-
- return ber;
-}
-
-#if 0
-PHP_FUNCTION(ber_free)
-{
- pval **berp;
-
- if ( zend_get_parameters_ex(1,&berp) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
-
- zend_list_delete((*berp)->value.lval);
- RETURN_TRUE;
-}
-#endif
-
-/* {{{ proto int ldap_bind(int link [, string dn, string password])
- Bind to LDAP directory */
-PHP_FUNCTION(ldap_bind)
-{
- pval **link, **bind_rdn, **bind_pw;
- char *ldap_bind_rdn, *ldap_bind_pw;
- LDAP *ldap;
-
- switch(ZEND_NUM_ARGS()) {
- case 1: /* Anonymous Bind */
- if (zend_get_parameters_ex(1, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap_bind_rdn = NULL;
- ldap_bind_pw = NULL;
-
- break;
-
- case 3 :
- if (zend_get_parameters_ex(3, &link, &bind_rdn,&bind_pw) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(bind_rdn);
- convert_to_string_ex(bind_pw);
-
- ldap_bind_rdn = (*bind_rdn)->value.str.val;
- ldap_bind_pw = (*bind_pw)->value.str.val;
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- if (ldap_bind_s(ldap, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
-#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- /* New versions of OpenLDAP do it this way */
- php_error(E_WARNING,"LDAP: Unable to bind to server: %s",ldap_err2string(ldap_get_lderrno(ldap,NULL,NULL)));
-#else
- php_error(E_WARNING,"LDAP: Unable to bind to server: %s",ldap_err2string(ldap->ld_errno));
-#endif
-#endif
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-}
-/* }}} */
-
-/* {{{ proto int ldap_unbind(int link)
- Unbind from LDAP directory */
-PHP_FUNCTION(ldap_unbind)
-{
- pval **link;
- LDAP *ldap;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_ex(link);
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- zend_list_delete((*link)->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
-{
- pval **link, **base_dn, **filter, **attrs, **attr;
- char *ldap_base_dn, *ldap_filter;
- LDAP *ldap;
- char **ldap_attrs = NULL;
- int attrsonly;
- LDAPMessage *ldap_result;
- int num_attribs=0, i;
- LDAPLS_FETCH();
-
- switch(ZEND_NUM_ARGS()) {
- case 3 :
- if (zend_get_parameters_ex(3, &link, &base_dn,&filter) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(base_dn);
- convert_to_string_ex(filter);
-
- ldap_base_dn = (*base_dn)->value.str.val;
- ldap_filter = (*filter)->value.str.val;
-
- break;
-
- case 4 :
- if (zend_get_parameters_ex(4, &link, &base_dn,&filter, &attrs) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*attrs)->type != IS_ARRAY) {
- php_error(E_WARNING, "LDAP: Expected Array as last element");
- RETURN_FALSE;
- }
-
- convert_to_string_ex(base_dn);
- convert_to_string_ex(filter);
-
- ldap_base_dn = (*base_dn)->value.str.val;
- ldap_filter = (*filter)->value.str.val;
-
- num_attribs = zend_hash_num_elements((*attrs)->value.ht);
- if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) {
- php_error(E_WARNING, "LDAP: Could not allocate memory");
- RETURN_FALSE;
- return;
- }
-
- for(i=0; i<num_attribs; i++) {
- if(zend_hash_index_find((*attrs)->value.ht, i, (void **) &attr) == FAILURE)
-{
- php_error(E_WARNING, "LDAP: Array initialization wrong");
- RETURN_FALSE;
- return;
- }
- SEPARATE_ZVAL(attr);
- convert_to_string_ex(attr);
- ldap_attrs[i] = (*attr)->value.str.val;
- }
- ldap_attrs[num_attribs] = NULL;
-
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* fix to make null base_dn's work */
- if ( strlen(ldap_base_dn) < 1 ) {
- ldap_base_dn = NULL;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- /* Is it useful to only get the attributes ? */
- attrsonly = 0;
-
- /* We can possibly add the timeout value also */
-
- if (ldap_search_s(ldap, ldap_base_dn, scope, ldap_filter, ldap_attrs, attrsonly, &ldap_result) != LDAP_SUCCESS) {
-#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- php_error(E_WARNING,"LDAP: Unable to perform the search: %s",ldap_err2string(ldap_get_lderrno(ldap,NULL,NULL)));
-#else
- php_error(E_WARNING, "LDAP: Unable to perform the search: %s", ldap_err2string(ldap->ld_errno));
-#endif
-#endif
- RETVAL_FALSE;
- } else {
- RETVAL_LONG(zend_list_insert(ldap_result, le_result));
- }
-
- if (ldap_attrs != NULL) {
- /* for(i=0; i<num_attribs; i++) efree(ldap_attrs[i]); */
- efree(ldap_attrs);
- }
- return;
-}
-
-/* {{{ proto int ldap_read(int link, string base_dn, string filter [, array attributes])
- Read an entry */
-PHP_FUNCTION(ldap_read)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_BASE);
-}
-/* }}} */
-
-/* {{{ proto int ldap_list(int link, string base_dn, string filter [, array attributes])
- Single-level search */
-PHP_FUNCTION(ldap_list)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_ONELEVEL);
-}
-/* }}} */
-
-
-/* {{{ proto int ldap_search(int link, string base_dn, string filter [, array attributes])
- Search LDAP tree under base_dn */
-PHP_FUNCTION(ldap_search)
-{
- php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_SUBTREE);
-}
-/* }}} */
-
-/* {{{ proto int ldap_free_result(int result)
- Free result memory */
-PHP_FUNCTION(ldap_free_result)
-{
- pval **result;
- LDAPMessage *ldap_result;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap_result = _get_ldap_result(result);
- if (ldap_result == NULL) {
- RETVAL_FALSE;
- } else {
- zend_list_delete((*result)->value.lval); /* Delete list entry and call registered destructor function */
- RETVAL_TRUE;
- }
- return;
-}
-/* }}} */
-
-/* {{{ proto int ldap_count_entries(int link, int result)
- Count the number of entries in a search result */
-PHP_FUNCTION(ldap_count_entries)
-{
- pval **result, **link;
- LDAP *ldap;
- LDAPMessage *ldap_result;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- ldap_result = _get_ldap_result(result);
- if (ldap_result == NULL) RETURN_FALSE;
-
- RETURN_LONG(ldap_count_entries(ldap, ldap_result));
-}
-/* }}} */
-
-/* {{{ proto int ldap_first_entry(int link, int result)
- Return first result id */
-PHP_FUNCTION(ldap_first_entry)
-{
- pval **result, **link;
- LDAP *ldap;
- LDAPMessage *ldap_result;
- LDAPMessage *ldap_result_entry;
- LDAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- ldap_result = _get_ldap_result(result);
- if (ldap_result == NULL) RETURN_FALSE;
-
- if ((ldap_result_entry = ldap_first_entry(ldap, ldap_result)) == NULL) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(zend_list_insert(ldap_result_entry, le_result_entry));
- }
-}
-/* }}} */
-
-/* {{{ proto int ldap_next_entry(int link, int entry)
- Get next result entry */
-PHP_FUNCTION(ldap_next_entry)
-{
- pval **result_entry, **link;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry, *ldap_result_entry_next;
- LDAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link,&result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- ldap_result_entry = _get_ldap_result_entry(result_entry);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- if ((ldap_result_entry_next = ldap_next_entry(ldap, ldap_result_entry)) == NULL) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(zend_list_insert(ldap_result_entry_next, le_result_entry));
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_entries(int link, int result)
- Get all result entries */
-PHP_FUNCTION(ldap_get_entries)
-{
- pval **link, **result;
- LDAPMessage *ldap_result, *ldap_result_entry;
- pval *tmp1, *tmp2;
- LDAP *ldap;
- int num_entries, num_attrib, num_values, i;
- int attr_count, entry_count;
- BerElement *ber;
- char *attribute;
- size_t attr_len;
- char **ldap_value;
- char *dn;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- ldap_result = _get_ldap_result(result);
- if (ldap_result == NULL) RETURN_FALSE;
-
- num_entries = ldap_count_entries(ldap, ldap_result);
-
- array_init(return_value);
- add_assoc_long(return_value, "count", num_entries);
-
- if (num_entries == 0) return;
-
- ldap_result_entry = ldap_first_entry(ldap, ldap_result);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- entry_count = 0;
-
- while(ldap_result_entry != NULL) {
-
- num_attrib = 0;
- attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber);
- if (attribute == NULL) RETURN_FALSE;
- while (attribute != NULL) {
- num_attrib++;
- attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
- }
-
- MAKE_STD_ZVAL(tmp1);
- array_init(tmp1);
-
- attr_count = 0;
- attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber);
- while (attribute != NULL) {
- ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute);
- num_values = ldap_count_values(ldap_value);
-
- MAKE_STD_ZVAL(tmp2);
- array_init(tmp2);
- add_assoc_long(tmp2, "count", num_values);
- for(i=0; i<num_values; i++) {
- add_index_string(tmp2, i, ldap_value[i], 1);
- }
- ldap_value_free(ldap_value);
-
- attr_len = strlen(attribute);
- zend_hash_update(tmp1->value.ht, php_strtolower(attribute, attr_len), attr_len+1, (void *) &tmp2, sizeof(pval *), NULL);
- add_index_string(tmp1, attr_count, attribute, 1);
-
- attr_count++;
- attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
- }
-
- add_assoc_long(tmp1, "count", num_attrib);
- dn = ldap_get_dn(ldap, ldap_result_entry);
- add_assoc_string(tmp1, "dn", dn, 1);
-
- zend_hash_index_update(return_value->value.ht, entry_count, (void *) &tmp1, sizeof(pval *), NULL);
-
- entry_count++;
- ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry);
- }
-
- add_assoc_long(return_value, "count", num_entries);
-}
-/* }}} */
-
-/* {{{ proto string ldap_first_attribute(int link, int result, int ber)
- Return first attribute */
-PHP_FUNCTION(ldap_first_attribute)
-{
- pval **result,**link,**berp;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- BerElement *ber;
- char *attribute;
- LDAPLS_FETCH();
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link,&result,&berp) == FAILURE || ParameterPassedByReference(ht,3)==0 ) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- ldap_result_entry = _get_ldap_result_entry(result);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- if ((attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber)) == NULL) {
- RETURN_FALSE;
- } else {
- /* brep is passed by ref so we do not have to account for memory */
- (*berp)->type=IS_LONG;
- (*berp)->value.lval=zend_list_insert(ber,le_ber_entry);
-
- RETVAL_STRING(attribute,1);
-#ifdef WINDOWS
- ldap_memfree(attribute);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ proto string ldap_next_attribute(int link, int result, int ber)
- Get the next attribute in result */
-PHP_FUNCTION(ldap_next_attribute)
-{
- pval **result,**link,**berp;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- BerElement *ber;
- char *attribute;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link,&result,&berp) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- ldap_result_entry = _get_ldap_result_entry(result);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- ber = _get_ber_entry(berp);
-
- if ((attribute = ldap_next_attribute(ldap, ldap_result_entry, ber)) == NULL) {
- RETURN_FALSE;
- } else {
- RETVAL_STRING(attribute,1);
-#ifdef WINDOWS
- ldap_memfree(attribute);
-#endif
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_attributes(int link, int result)
- Get attributes from a search result entry */
-PHP_FUNCTION(ldap_get_attributes)
-{
- pval **link, **result_entry;
- pval *tmp;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- char *attribute;
- char **ldap_value;
- int i, count, num_values, num_attrib;
- BerElement *ber;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- ldap_result_entry = _get_ldap_result_entry(result_entry);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- num_attrib = 0;
- attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber);
- if (attribute == NULL) RETURN_FALSE;
- while (attribute != NULL) {
- num_attrib++;
- attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
- }
-
- array_init(return_value);
-
- count=0;
- attribute = ldap_first_attribute(ldap, ldap_result_entry, &ber);
- while (attribute != NULL) {
- ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute);
- num_values = ldap_count_values(ldap_value);
-
- MAKE_STD_ZVAL(tmp);
- array_init(tmp);
- add_assoc_long(tmp, "count", num_values);
- for(i=0; i<num_values; i++) {
- add_index_string(tmp, i, ldap_value[i], 1);
- }
- ldap_value_free(ldap_value);
-
- zend_hash_update(return_value->value.ht, attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval *), NULL);
- add_index_string(return_value, count, attribute, 1);
-
- count++;
- attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
- }
-
- add_assoc_long(return_value, "count", num_attrib);
-}
-/* }}} */
-
-/* {{{ proto array ldap_get_values(int link, int result, string attribute)
- Get all values from a result entry */
-PHP_FUNCTION(ldap_get_values)
-{
- pval **link, **result_entry, **attr;
- LDAP *ldap;
- LDAPMessage *ldap_result_entry;
- char *attribute;
- char **ldap_value;
- int i, num_values;
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link,&result_entry, &attr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- ldap_result_entry = _get_ldap_result_entry(result_entry);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- convert_to_string_ex(attr);
- attribute = (*attr)->value.str.val;
-
- if ((ldap_value = ldap_get_values(ldap, ldap_result_entry, attribute)) == NULL) {
-#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(ldap_get_lderrno(ldap,NULL,NULL)));
-#else
- php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(ldap->ld_errno));
-#endif
-#endif
- RETURN_FALSE;
- }
-
- num_values = ldap_count_values(ldap_value);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- for(i=0; i<num_values; i++) {
- add_next_index_string(return_value, ldap_value[i], 1);
- }
-
- add_assoc_long(return_value, "count", num_values);
-
- ldap_value_free(ldap_value);
-}
-/* }}} */
-
-/* {{{ 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)
-{
- pval **link, **result_entry, **attr;
- LDAP* ldap;
- LDAPMessage* ldap_result_entry;
- char* attribute;
- struct berval **ldap_value_len;
- int i, num_values;
-
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &link, &result_entry, &attr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((ldap = _get_ldap_link(link)) == NULL) {
- RETURN_FALSE;
- }
-
- ldap_result_entry = _get_ldap_result_entry(result_entry);
- convert_to_string_ex(attr);
- attribute = (*attr)->value.str.val;
-
- if ((ldap_value_len = ldap_get_values_len(ldap, ldap_result_entry, attribute)) == NULL) {
-#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(ldap_get_lderrno(ldap,NULL,NULL)));
-#else
- php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(ldap->ld_errno));
-#endif
-#else
- php_error(E_WARNING, "LDAP: Cannot get the value(s) of attribute %s", ldap_err2string(ldap_get_lderrno(ldap,NULL,NULL)));
-#endif
- RETURN_FALSE;
- }
-
- num_values = ldap_count_values_len(ldap_value_len);
- if (array_init(return_value) == FAILURE) {
- php_error(E_ERROR, "Cannot initialize return value");
- RETURN_FALSE;
- }
-
- for (i=0; i<num_values; i++) {
- add_next_index_string(return_value, ldap_value_len[i]->bv_val, 1);
- }
-
- add_assoc_long(return_value, "count", num_values);
-}
-/* }}} */
-
-
-/* {{{ proto string ldap_get_dn(int link, int result)
- Get the DN of a result entry */
-PHP_FUNCTION(ldap_get_dn)
-{
- pval **link,**entryp;
- LDAP *ld;
- LDAPMessage *entry;
- char *text;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &entryp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ld = _get_ldap_link(link);
- if (ld == NULL) RETURN_FALSE;
-
- entry = _get_ldap_result_entry(entryp);
- if (entry == NULL) RETURN_FALSE;
-
- text = ldap_get_dn(ld, entry);
- if ( text != NULL ) {
- RETVAL_STRING(text,1);
-#ifdef WINDOWS
- ldap_memfree(text);
-#endif
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto array ldap_explode_dn(string dn, int with_attrib)
- Splits DN into its component parts */
-PHP_FUNCTION(ldap_explode_dn)
-{
- pval **dn, **with_attrib;
- char **ldap_value;
- int i, count;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &dn,&with_attrib) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dn);
- convert_to_long_ex(with_attrib);
-
- ldap_value = ldap_explode_dn((*dn)->value.str.val,(*with_attrib)->value.lval);
-
- i=0;
- while(ldap_value[i] != NULL) i++;
- count = i;
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- add_assoc_long(return_value, "count", count);
- for(i=0; i<count; i++) {
- add_index_string(return_value, i, ldap_value[i], 1);
- }
-
- ldap_value_free(ldap_value);
-}
-/* }}} */
-
-/* {{{ proto string ldap_dn2ufn(string dn)
- Convert DN to User Friendly Naming format */
-PHP_FUNCTION(ldap_dn2ufn)
-{
- pval **dn;
- char *ufn;
-
- if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1,&dn)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(dn);
-
- ufn = ldap_dn2ufn((*dn)->value.str.val);
-
- if (ufn !=NULL) {
- RETVAL_STRING(ufn,1);
-#ifdef WINDOWS
- ldap_memfree(ufn);
-#endif
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* 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;
- LDAP *ldap;
- char *ldap_dn;
- LDAPMod **ldap_mods;
- int i, j, num_attribs, num_values;
- char *attribute;
- ulong index;
- int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
-
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &dn,&entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if ((*entry)->type != IS_ARRAY) {
- php_error(E_WARNING, "LDAP: Expected Array as the last element");
- RETURN_FALSE;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- convert_to_string_ex(dn);
- ldap_dn = (*dn)->value.str.val;
-
- num_attribs = zend_hash_num_elements((*entry)->value.ht);
-
- ldap_mods = emalloc((num_attribs+1) * sizeof(LDAPMod *));
-
- zend_hash_internal_pointer_reset((*entry)->value.ht);
- /* added by gerrit thomson to fix ldap_add using ldap_mod_add */
- if ( oper == PHP_LD_FULL_ADD )
- {
- oper = LDAP_MOD_ADD;
- is_full_add = 1;
- }
- /* end additional , gerrit thomson */
-
- for(i=0; i<num_attribs; i++) {
- ldap_mods[i] = emalloc(sizeof(LDAPMod));
-
- ldap_mods[i]->mod_op = oper;
-
- if (zend_hash_get_current_key((*entry)->value.ht,&attribute, &index) == HASH_KEY_IS_STRING) {
- ldap_mods[i]->mod_type = estrdup(attribute);
- efree(attribute);
- } else {
- php_error(E_WARNING, "LDAP: Unknown Attribute in the data");
- }
-
- zend_hash_get_current_data((*entry)->value.ht, (void **)&value);
-
- if ((*value)->type != IS_ARRAY) {
- num_values = 1;
- } else {
- num_values = zend_hash_num_elements((*value)->value.ht);
- }
-
- ldap_mods[i]->mod_values = emalloc((num_values+1) * sizeof(char *));
-
-/* allow for arrays with one element, no allowance for arrays with none but probably not required, gerrit thomson. */
-/* if (num_values == 1) {*/
- if ((num_values == 1) && ((*value)->type != IS_ARRAY)) {
- convert_to_string_ex(value);
- ldap_mods[i]->mod_values[0] = (*value)->value.str.val;
- ldap_mods[i]->mod_values[0][(*value)->value.str.len] = '\0';
- } else {
- for(j=0; j<num_values; j++) {
- zend_hash_index_find((*value)->value.ht,j, (void **) &ivalue);
- convert_to_string_ex(ivalue);
- ldap_mods[i]->mod_values[j] = (*ivalue)->value.str.val;
- ldap_mods[i]->mod_values[j][(*ivalue)->value.str.len] = '\0';
- }
- }
- ldap_mods[i]->mod_values[num_values] = NULL;
-
- zend_hash_move_forward((*entry)->value.ht);
- }
- ldap_mods[num_attribs] = NULL;
-
-/* check flag to see if do_mod was called to perform full add , gerrit thomson */
-/* if (oper == LDAP_MOD_ADD) { */
- if (is_full_add == 1) {
- if (ldap_add_s(ldap, ldap_dn, ldap_mods) != LDAP_SUCCESS) {
- ldap_perror(ldap, "LDAP");
- php_error(E_WARNING, "LDAP: add operation could not be completed.");
- RETVAL_FALSE;
- } else RETVAL_TRUE;
- } else {
- if (ldap_modify_s(ldap, ldap_dn, ldap_mods) != LDAP_SUCCESS) {
- php_error(E_WARNING, "LDAP: modify operation could not be completed.");
- RETVAL_FALSE;
- } else RETVAL_TRUE;
- }
-
- for(i=0; i<num_attribs; i++) {
- efree(ldap_mods[i]->mod_type);
- efree(ldap_mods[i]->mod_values);
- efree(ldap_mods[i]);
- }
- efree(ldap_mods);
-
- return;
-}
-
-/* {{{ proto int ldap_add(int link, string dn, array entry)
- Add entries to LDAP directory */
-PHP_FUNCTION(ldap_add)
-{
- /* use a newly define parameter into the do_modify so ldap_mod_add can be used the way it is supposed to be used , Gerrit THomson */
- /* php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD);*/
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LD_FULL_ADD);
-}
-/* }}} */
-
-
-/* {{{ proto int ldap_modify(int link, string dn, array entry)
- Modify an LDAP entry */
-PHP_FUNCTION(ldap_modify)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE);
-}
-/* }}} */
-
-
-/* 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)
-{
- 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)
-{
- php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD);
-}
-/* }}} */
-
-/* {{{ 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 */
-
-
-/* {{{ proto int ldap_delete(int link, string dn)
- Delete an entry from a directory */
-PHP_FUNCTION(ldap_delete)
-{
- pval **link, **dn;
- LDAP *ldap;
- char *ldap_dn;
-
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &link, &dn) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) RETURN_FALSE;
-
- convert_to_string_ex(dn);
- ldap_dn = (*dn)->value.str.val;
-
- if (ldap_delete_s(ldap, ldap_dn) != LDAP_SUCCESS) {
- ldap_perror(ldap, "LDAP");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ldap_errno(int link)
- Get the current ldap error number */
-PHP_FUNCTION(ldap_errno) {
- LDAP* ldap;
- pval** ldap_link;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &ldap_link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(ldap_link);
-
- ldap = _get_ldap_link(ldap_link);
- if (ldap == NULL) {
- RETURN_LONG(0);
- }
-
-#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- RETURN_LONG( ldap_get_lderrno(ldap, NULL, NULL) );
-#else
- RETURN_LONG( ldap->ld_errno );
-#endif
-#else
- RETURN_LONG( ldap_get_lderrno(ldap, NULL, NULL) );
-#endif
- RETURN_LONG(0);
-}
-/* }}} */
-
-
-/* {{{ proto string ldap_err2str(int errno)
- Convert error number to error string */
-PHP_FUNCTION(ldap_err2str) {
- zval** perrno;
-
- if ( ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &perrno) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(perrno);
- RETURN_STRING(ldap_err2string((*perrno)->value.lval), 1);
-}
-/* }}} */
-
-
-/* {{{ proto string ldap_error(int link)
- Get the current ldap error string */
-PHP_FUNCTION(ldap_error) {
- LDAP* ldap;
- pval** link;
- int ld_errno;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ht, &link) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap = _get_ldap_link(link);
- if (ldap == NULL) {
- RETURN_FALSE;
- }
-
-#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- ld_errno = ldap_get_lderrno(ldap, NULL, NULL);
-#else
- ld_errno = ldap->ld_errno;
-#endif
-#else
- ld_errno = ldap_get_lderrno(ldap, NULL, NULL);
-#endif
-
- RETURN_STRING(ldap_err2string(ld_errno), 1);
-}
-/* }}} */
diff --git a/ext/ldap/ldap.dsp b/ext/ldap/ldap.dsp
deleted file mode 100644
index 05500b62e1..0000000000
--- a/ext/ldap/ldap.dsp
+++ /dev/null
@@ -1,172 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ldap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=ldap - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ldap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ldap.mak" CFG="ldap - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ldap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ldap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "COMPILE_DL_LDAP_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D "COMPILE_DL_LDAP" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4nts.lib /nologo /dll /machine:I386 /out:"Release/php_ldap.dll" /libpath:"..\..\Release" /libpath:"..\..\..\php_build\openldap\libraries\Release"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "COMPILE_DL_LDAP_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D "COMPILE_DL_LDAP" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 oldap32.lib olber32.lib php4nts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "ldap___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "ldap___Win32_Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\openldap\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D ZEND_DEBUG=1 /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "COMPILE_DL_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib php4nts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\openldap\libraries\Debug" /libpath:"..\..\Debug"
-# ADD LINK32 oldap32.lib olber32.lib php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug_TS/php_ldap.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\openldap\libraries\Debug"
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "ldap___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "ldap___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\openldap\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /D ZEND_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /I "..\..\..\php_build\openldap\include" /D "NDEBUG" /D ZEND_DEBUG=0 /D "ZTS" /D "COMPILE_DL_LDAP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LDAP_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_LDAP=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4nts.lib /nologo /dll /machine:I386 /libpath:"..\..\..\openldap\libraries\Release" /libpath:"..\..\Release"
-# ADD LINK32 oldap32.lib olber32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib php4ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_ldap.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\openldap\libraries\Release"
-
-!ENDIF
-
-# Begin Target
-
-# Name "ldap - Win32 Release"
-# Name "ldap - Win32 Debug"
-# Name "ldap - Win32 Debug_TS"
-# Name "ldap - Win32 Release_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\ldap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_ldap.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\LDAP_Win32_HOWTO.txt
-# End Source File
-# End Target
-# End Project
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
deleted file mode 100644
index 760e63b623..0000000000
--- a/ext/ldap/php_ldap.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP HTML Embedded Scripting Language Version 3.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
- +----------------------------------------------------------------------+
- | This program is free software; you can redistribute it and/or modify |
- | it under the terms of one of the following licenses: |
- | |
- | A) the GNU General Public License as published by the Free Software |
- | Foundation; either version 2 of the License, or (at your option) |
- | any later version. |
- | |
- | B) the PHP License as published by the PHP Development Team and |
- | included in the distribution in the file: LICENSE |
- | |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- | |
- | You should have received a copy of both licenses referred to here. |
- | If you did not, or have any questions about PHP licensing, please |
- | contact core@php.net. |
- +----------------------------------------------------------------------+
- | Authors: Amitay Isaacs <amitay@w-o-i.com> |
- | Eric Warnke <ericw@albany.edu> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef PHP_LDAP_H
-#define PHP_LDAP_H
-
-#include <lber.h>
-#include <ldap.h>
-
-extern zend_module_entry ldap_module_entry;
-#define ldap_module_ptr &ldap_module_entry
-
-/* LDAP functions */
-PHP_MINIT_FUNCTION(ldap);
-PHP_MSHUTDOWN_FUNCTION(ldap);
-
-PHP_MINFO_FUNCTION(ldap);
-
-PHP_FUNCTION(ldap_connect);
-
-PHP_FUNCTION(ldap_bind);
-PHP_FUNCTION(ldap_unbind);
-
-PHP_FUNCTION(ldap_read);
-PHP_FUNCTION(ldap_list);
-PHP_FUNCTION(ldap_search);
-
-PHP_FUNCTION(ldap_free_result);
-PHP_FUNCTION(ldap_count_entries);
-
-PHP_FUNCTION(ldap_first_entry);
-PHP_FUNCTION(ldap_next_entry);
-PHP_FUNCTION(ldap_get_entries);
-#if 0
-PHP_FUNCTION(ldap_free_entry);
-#endif
-PHP_FUNCTION(ldap_first_attribute);
-PHP_FUNCTION(ldap_next_attribute);
-PHP_FUNCTION(ldap_get_attributes);
-
-PHP_FUNCTION(ldap_get_values);
-PHP_FUNCTION(ldap_get_values_len);
-
-PHP_FUNCTION(ber_free);
-PHP_FUNCTION(ldap_get_dn);
-PHP_FUNCTION(ldap_explode_dn);
-PHP_FUNCTION(ldap_dn2ufn);
-
-PHP_FUNCTION(ldap_add);
-PHP_FUNCTION(ldap_delete);
-PHP_FUNCTION(ldap_modify);
-
-PHP_FUNCTION(ldap_mod_add);
-PHP_FUNCTION(ldap_mod_replace);
-PHP_FUNCTION(ldap_mod_del);
-
-PHP_FUNCTION(ldap_errno);
-PHP_FUNCTION(ldap_err2str);
-PHP_FUNCTION(ldap_error);
-
-ZEND_BEGIN_MODULE_GLOBALS(ldap)
- long default_link;
- long num_links, max_links;
- char *base_dn;
-ZEND_END_MODULE_GLOBALS(ldap)
-
-#ifdef ZTS
-# define LDAPLS_D zend_ldap_globals *ldap_globals
-# define LDAPLS_DC , LDAPLS_D
-# define LDAPLS_C ldap_globals
-# define LDAPLS_CC , LDAPLS_C
-# define LDAPG(v) (ldap_globals->v)
-# define LDAPLS_FETCH() zend_ldap_globals *ldap_globals = ts_resource(ldap_globals_id)
-#else
-# define LDAPLS_D
-# define LDAPLS_DC
-# define LDAPLS_C
-# define LDAPLS_CC
-# define LDAPG(v) (ldap_globals.v)
-# define LDAPLS_FETCH()
-#endif
-
-
-#define phpext_ldap_ptr ldap_module_ptr
-
-#endif /* PHP_LDAP_H */
diff --git a/ext/ldap/setup.stub b/ext/ldap/setup.stub
deleted file mode 100644
index 72182a28ef..0000000000
--- a/ext/ldap/setup.stub
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Source$
-# $Id$
-
-define_option with-ldap 'LDAP support?' yesnodir \
- 'no /usr/local/ldap LDAP base install' \
-' Whether to build with LDAP (Lightweight Directory Access Protocol)\n
- support.\n
- More information about LDAP can be found in RFC1777 and RFC1778.'