Date: 08/27/98
- Next message: shane: "[PHP-DEV] CVS update: php31"
- Previous message: shane: "[PHP-DEV] CVS update: php31/ext/odbc"
- Next in thread: shane: "[PHP-DEV] CVS update: php31/ext/ldap"
- Maybe reply: shane: "[PHP-DEV] CVS update: php31/ext/ldap"
- Maybe reply: shane: "[PHP-DEV] CVS update: php31/ext/ldap"
- Maybe reply: shane: "[PHP-DEV] CVS update: php31/ext/ldap"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thursday August 27, 1998 @ 16:55
Author: shane
Update of /repository/php31/ext/ldap
In directory asf:/u2/tmp/cvs-serv1720/ext/ldap
Modified Files:
ldap.c php3_ldap.h
Log Message:
Various fixes
ldap now works with 3.1
moved dl close in request shutdown because it errored out if a loaded module
used a list.
moved module defines into msvc project files rather thwn config.w32.h
Index: php31/ext/ldap/ldap.c
diff -c php31/ext/ldap/ldap.c:2.2 php31/ext/ldap/ldap.c:2.3
*** php31/ext/ldap/ldap.c:2.2 Thu Jul 9 02:58:47 1998
--- php31/ext/ldap/ldap.c Thu Aug 27 16:55:40 1998
***************
*** 29,37 ****
*/
! /* $Id: ldap.c,v 2.2 1998/07/09 06:58:47 amitay Exp $ */
! #ifndef MSVC5
#include "config.h"
#endif
#include "php.h"
--- 29,43 ----
*/
! /* $Id: ldap.c,v 2.3 1998/08/27 20:55:40 shane Exp $ */
! #ifdef THREAD_SAFE
! #include "tls.h"
! DWORD ldapTLS;
! static int numthreads=0;
! void *ldap_mutex;
! #endif
! #if !(WIN32|WINNT)
#include "config.h"
#endif
#include "php.h"
***************
*** 40,48 ****
--- 46,59 ----
#if HAVE_LDAP
#if COMPILE_DL
+ #if PHP_31
+ #include "ext/phpdl.h"
+ #include "ext/standard/dl.h"
+ #else
#include "dl/phpdl.h"
#include "functions/dl.h"
#endif
+ #endif
#include "php3_list.h"
#include "php3_ldap.h"
***************
*** 59,83 ****
#define __STDC__ 1
#endif
! #include "php3_string.h"
- #include <lber.h>
- #include <ldap.h>
#if THREAD_SAFE & HAVE_NSLDAP
#include "php3_threads.h"
- struct ldap_thread_fns tfns;
/* Structure for LDAP error values */
! struct ldap_error {
! int le_errno; /* Corresponds to the LDAP error code */
! char *le_matched; /* Matching components of the DN,
! if an NO_SUCH_OBJECT error occurred */
! char *le_errmsg; /* Error message */
! };
! void *ldapkey;
#endif
- ldap_module php3_ldap_module;
/*
--- 70,93 ----
#define __STDC__ 1
#endif
! #if PHP_31
! #include "ext/standard/php3_string.h"
! #else
! #include "functions/php3_string.h"
! #endif
#if THREAD_SAFE & HAVE_NSLDAP
#include "php3_threads.h"
/* Structure for LDAP error values */
! #define LDAP_TLS_VARS ldap_module *PHP3_TLS_GET(ldapTLS,php3_ldap_module)
! #define LDAP_GLOBAL(a) php3_ldap_module->a
! #else
! #define LDAP_TLS_VARS
! #define LDAP_GLOBAL(a) php3_ldap_module.a
! ldap_module php3_ldap_module;
#endif
/*
***************
*** 98,104 ****
{"ldap_first_entry", php3_ldap_first_entry, NULL},
{"ldap_next_entry", php3_ldap_next_entry, NULL},
{"ldap_get_entries", php3_ldap_get_entries, NULL},
- {"ldap_free_entry", php3_ldap_free_entry, NULL},
{"ldap_first_attribute", php3_ldap_first_attribute, NULL},
{"ldap_next_attribute", php3_ldap_next_attribute, NULL},
{"ldap_get_attributes", php3_ldap_get_attributes, NULL},
--- 108,113 ----
***************
*** 114,120 ****
php3_module_entry ldap_module_entry = {
! "LDAP", ldap_functions, php3_minit_ldap, NULL, NULL, NULL, php3_info_ldap, STANDARD_MODULE_PROPERTIES
};
--- 123,129 ----
php3_module_entry ldap_module_entry = {
! "LDAP", ldap_functions, php3_minit_ldap, php3_mshutdown_ldap, NULL, NULL, php3_info_ldap, STANDARD_MODULE_PROPERTIES
};
***************
*** 124,165 ****
#endif
! #if THREAD_SAFE && HAVE_NSLDAP
/* Function for setting thread-specific LDAP error values */
static void php3_ldap_set_ld_error( int err, char *matched, char *errmsg, void *dummy )
{
! struct ldap_error *le;
! /* Get the data structure specific to the calling thread */
! le = GET_TLS_DATA( ldapkey );
/* Set the error code returned by the LDAP operation */
! le->le_errno = err;
/* Specify the components of the DN that matched (if
an "NO_SUCH_OBJECT" error occurred */
! if ( le->le_matched != NULL ) {
! ldap_memfree( le->le_matched );
}
! le->le_matched = matched;
/* Specify the error message corresponding to the error code */
! if ( le->le_errmsg != NULL ) {
! ldap_memfree( le->le_errmsg );
}
! le->le_errmsg = errmsg;
}
/* Function for getting the thread-specific LDAP error values */
static int php3_ldap_get_ld_error( char **matched, char **errmsg, void *dummy )
{
! struct ldap_error *le;
! /* Get the data values specific to the calling thread */
! le = GET_TLS_DATA( ldapkey );
/* Retrieve the error values */
if ( matched != NULL ) {
! *matched = le->le_matched;
}
if ( errmsg != NULL ) {
! *errmsg = le->le_errmsg;
}
! return( le->le_errno );
}
/* Function for setting the value of the errno variable */
--- 133,171 ----
#endif
! #if 0 /* see my note in php3_ldap.h. smc */
/* Function for setting thread-specific LDAP error values */
static void php3_ldap_set_ld_error( int err, char *matched, char *errmsg, void *dummy )
{
! LDAP_TLS_VARS;
!
/* Set the error code returned by the LDAP operation */
! LDAP_GLOBAL(le_errno) = err;
/* Specify the components of the DN that matched (if
an "NO_SUCH_OBJECT" error occurred */
! if ( LDAP_GLOBAL(le_matched) != NULL ) {
! ldap_memfree( LDAP_GLOBAL(le_matched) );
}
! LDAP_GLOBAL(le_matched) = matched;
/* Specify the error message corresponding to the error code */
! if ( LDAP_GLOBAL(le_errmsg) != NULL ) {
! ldap_memfree( LDAP_GLOBAL(le_errmsg) );
}
! LDAP_GLOBAL(le_errmsg) = errmsg;
}
/* Function for getting the thread-specific LDAP error values */
static int php3_ldap_get_ld_error( char **matched, char **errmsg, void *dummy )
{
! LDAP_TLS_VARS;
/* Retrieve the error values */
if ( matched != NULL ) {
! *matched = LDAP_GLOBAL(le_matched);
}
if ( errmsg != NULL ) {
! *errmsg = LDAP_GLOBAL(le_errmsg);
}
! return( LDAP_GLOBAL(le_errno) );
}
/* Function for setting the value of the errno variable */
***************
*** 173,185 ****
{
return( errno );
}
! #endif
static void _close_ldap_link(LDAP *ld)
{
ldap_unbind_s(ld);
/* php3_printf("Freeing ldap connection");*/
! php3_ldap_module.num_links--;
}
--- 179,192 ----
{
return( errno );
}
! #endif /* THREAD_SAFE && NSLDAP */
static void _close_ldap_link(LDAP *ld)
{
+ LDAP_TLS_VARS;
ldap_unbind_s(ld);
/* php3_printf("Freeing ldap connection");*/
! LDAP_GLOBAL(num_links)--;
}
***************
*** 188,259 ****
ldap_msgfree(result);
}
- #if 0
- static void _free_ber_entry(BerElement *ber)
- {
- /*if (ber!=NULL) ber_free(ber,0);*/
- }
- #endif
-
int php3_minit_ldap(INIT_FUNC_ARGS)
{
! #if THREAD_SAFE && HAVE_NSLDAP
/* Set up the ldap_thread_fns structure with pointers
to the functions that you want called */
! memset( &tfns, '\0', sizeof(struct ldap_thread_fns) );
/* Specify the functions that you want called */
/* Call the my_mutex_alloc() function whenever mutexes
need to be allocated */
! tfns.ltf_mutex_alloc = (void *(*)(void)) php3_mutex_alloc;
/* Call the my_mutex_free() function whenever mutexes
need to be destroyed */
! tfns.ltf_mutex_free = (void (*)(void *)) php3_mutex_free;
/* Call the pthread_mutex_lock() function whenever a
thread needs to lock a mutex. */
! tfns.ltf_mutex_lock = (int (*)(void *)) php3_mutex_lock;
/* Call the pthread_mutex_unlock() function whenever a
thread needs to unlock a mutex. */
! tfns.ltf_mutex_unlock = (int (*)(void *)) php3_mutex_unlock;
/* Call the get_errno() function to get the value of errno */
! tfns.ltf_get_errno = php3_ldap_get_errno;
/* Call the set_errno() function to set the value of errno */
! tfns.ltf_set_errno = php3_ldap_set_errno;
/* Call the get_ld_error() function to get error values from
calls to functions in the libldap library */
! tfns.ltf_get_lderrno = php3_ldap_get_ld_error;
/* Call the set_ld_error() function to set error values for
calls to functions in the libldap library */
! tfns.ltf_set_lderrno = php3_ldap_set_ld_error;
/* Don't pass any extra parameter to the functions for
getting and setting libldap function call errors */
! tfns.ltf_lderrno_arg = NULL;
/* Set the session option that specifies the functions to call for multi-threaded clients */
! if (ldap_set_option( ld, LDAP_OPT_THREAD_FN_PTRS, (void *) &tfns)!= 0) {
ldap_perror( ld, "ldap_set_option: thread pointers" );
}
#endif
! if (cfg_get_long("ldap.max_links", &php3_ldap_module.max_links) == FAILURE) {
! php3_ldap_module.max_links = -1;
}
! if (cfg_get_string("ldap.base_dn", &php3_ldap_module.base_dn) == FAILURE) {
! php3_ldap_module.base_dn = NULL;
}
! php3_ldap_module.le_result = register_list_destructors(_free_ldap_result, NULL);
! php3_ldap_module.le_result_entry = register_list_destructors(NULL, NULL);
! php3_ldap_module.le_ber_entry = register_list_destructors(NULL, NULL);
! php3_ldap_module.le_link = register_list_destructors(_close_ldap_link, NULL);
ldap_module_entry.type = type;
return SUCCESS;
}
void php3_info_ldap(void)
{
char maxl[16];
#if HAVE_NSLDAP
LDAPVersion ver;
double SDKVersion;
--- 195,289 ----
ldap_msgfree(result);
}
int php3_minit_ldap(INIT_FUNC_ARGS)
{
! #if defined(THREAD_SAFE)
! ldap_module *php3_ldap_module;
! PHP3_MUTEX_ALLOC(ldap_mutex);
! PHP3_MUTEX_LOCK(ldap_mutex);
! numthreads++;
! if (numthreads==1){
! if (!PHP3_TLS_PROC_STARTUP(ldapTLS)){
! PHP3_MUTEX_UNLOCK(ldap_mutex);
! PHP3_MUTEX_FREE(ldap_mutex);
! return 0;
! }
! }
! PHP3_MUTEX_UNLOCK(ldap_mutex);
! if(!PHP3_TLS_THREAD_INIT(ldapTLS,php3_ldap_module,ldap_module))
! return 0;
! #if 0 /*HAVE_NSLDAP*/
/* Set up the ldap_thread_fns structure with pointers
to the functions that you want called */
! memset( &LDAP_GLOBAL(tfns), '\0', sizeof(struct ldap_thread_fns) );
/* Specify the functions that you want called */
/* Call the my_mutex_alloc() function whenever mutexes
need to be allocated */
! LDAP_GLOBAL(tfns).ltf_mutex_alloc = (void *(*)(void)) php3_mutex_alloc;
/* Call the my_mutex_free() function whenever mutexes
need to be destroyed */
! LDAP_GLOBAL(tfns).ltf_mutex_free = (void (*)(void *)) php3_mutex_free;
/* Call the pthread_mutex_lock() function whenever a
thread needs to lock a mutex. */
! LDAP_GLOBAL(tfns).ltf_mutex_lock = (int (*)(void *)) php3_mutex_lock;
/* Call the pthread_mutex_unlock() function whenever a
thread needs to unlock a mutex. */
! LDAP_GLOBAL(tfns).ltf_mutex_unlock = (int (*)(void *)) php3_mutex_unlock;
/* Call the get_errno() function to get the value of errno */
! LDAP_GLOBAL(tfns).ltf_get_errno = php3_ldap_get_errno;
/* Call the set_errno() function to set the value of errno */
! LDAP_GLOBAL(tfns).ltf_set_errno = php3_ldap_set_errno;
/* Call the get_ld_error() function to get error values from
calls to functions in the libldap library */
! LDAP_GLOBAL(tfns).ltf_get_lderrno = php3_ldap_get_ld_error;
/* Call the set_ld_error() function to set error values for
calls to functions in the libldap library */
! LDAP_GLOBAL(tfns).ltf_set_lderrno = php3_ldap_set_ld_error;
/* Don't pass any extra parameter to the functions for
getting and setting libldap function call errors */
! LDAP_GLOBAL(tfns).ltf_lderrno_arg = NULL;
/* Set the session option that specifies the functions to call for multi-threaded clients */
! if (ldap_set_option( ld, LDAP_OPT_THREAD_FN_PTRS, (void *) &LDAP_GLOBAL(tfns))!= 0) {
ldap_perror( ld, "ldap_set_option: thread pointers" );
}
#endif
! #endif
! if (cfg_get_long("ldap.max_links", &LDAP_GLOBAL(max_links)) == FAILURE) {
! LDAP_GLOBAL(max_links) = -1;
}
! if (cfg_get_string("ldap.base_dn", &LDAP_GLOBAL(base_dn)) == FAILURE) {
! LDAP_GLOBAL(base_dn) = NULL;
}
! LDAP_GLOBAL(le_result) = register_list_destructors(_free_ldap_result, NULL);
! LDAP_GLOBAL(le_link) = register_list_destructors(_close_ldap_link, NULL);
+ /*FIXME is this safe in threaded environment? if so, please comment*/
ldap_module_entry.type = type;
return SUCCESS;
}
+ int php3_mshutdown_ldap(void){
+ LDAP_TLS_VARS;
+ #ifdef THREAD_SAFE
+ PHP3_TLS_THREAD_FREE(php3_ldap_module);
+ PHP3_MUTEX_LOCK(ldap_mutex);
+ numthreads--;
+ if (!numthreads) {
+ PHP3_TLS_PROC_SHUTDOWN(ldapTLS);
+ }
+ PHP3_MUTEX_UNLOCK(ldap_mutex);
+ PHP3_MUTEX_FREE(ldap_mutex);
+ #endif
+ return SUCCESS;
+ }
void php3_info_ldap(void)
{
char maxl[16];
+ LDAP_TLS_VARS;
#if HAVE_NSLDAP
LDAPVersion ver;
double SDKVersion;
***************
*** 261,282 ****
SDKVersion = ldap_version( &ver );
#endif
! if (php3_ldap_module.max_links == -1) {
strcpy(maxl, "Unlimited");
} else {
! snprintf(maxl, 15, "%ld", php3_ldap_module.max_links);
maxl[15] = 0;
}
php3_printf("<table>"
"<tr><td>Total links:</td><td>%d/%s</td></tr>\n"
! "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 2.2 1998/07/09 06:58:47 amitay Exp $</td></tr>\n"
#if HAVE_NSLDAP
"<tr><td>SDK Version:</td><td>%f</td></tr>"
"<tr><td>Highest LDAP Protocol Supported:</td><td>%f</td></tr>"
"<tr><td>SSL Level Supported:</td><td>%f</td></tr>"
#endif
! ,php3_ldap_module.num_links,maxl
#if HAVE_NSLDAP
,SDKVersion/100.0,ver.protocol_version/100.0,ver.SSL_version/100.0
#endif
--- 291,312 ----
SDKVersion = ldap_version( &ver );
#endif
! if (LDAP_GLOBAL(max_links) == -1) {
strcpy(maxl, "Unlimited");
} else {
! snprintf(maxl, 15, "%ld", LDAP_GLOBAL(max_links));
maxl[15] = 0;
}
php3_printf("<table>"
"<tr><td>Total links:</td><td>%d/%s</td></tr>\n"
! "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 2.3 1998/08/27 20:55:40 shane Exp $</td></tr>\n"
#if HAVE_NSLDAP
"<tr><td>SDK Version:</td><td>%f</td></tr>"
"<tr><td>Highest LDAP Protocol Supported:</td><td>%f</td></tr>"
"<tr><td>SSL Level Supported:</td><td>%f</td></tr>"
#endif
! ,LDAP_GLOBAL(num_links),maxl
#if HAVE_NSLDAP
,SDKVersion/100.0,ver.protocol_version/100.0,ver.SSL_version/100.0
#endif
***************
*** 300,305 ****
--- 330,336 ----
/* char *hashed_details;
int hashed_details_length;*/
LDAP *ldap;
+ LDAP_TLS_VARS;
switch(ARG_COUNT(ht)) {
case 0:
***************
*** 350,357 ****
break;
}
! if (php3_ldap_module.max_links!=-1 && php3_ldap_module.num_links>=php3_ldap_module.max_links) {
! php3_error(E_WARNING, "LDAP: Too many open links (%d)", php3_ldap_module.num_links);
RETURN_FALSE;
}
--- 381,388 ----
break;
}
! if (LDAP_GLOBAL(max_links)!=-1 && LDAP_GLOBAL(num_links)>=LDAP_GLOBAL(max_links)) {
! php3_error(E_WARNING, "LDAP: Too many open links (%d)", LDAP_GLOBAL(num_links));
RETURN_FALSE;
}
***************
*** 359,365 ****
if ( ldap == NULL ) {
RETURN_FALSE;
} else {
! RETURN_LONG(php3_list_insert((void*)ldap,php3_ldap_module.le_link));
}
}
--- 390,396 ----
if ( ldap == NULL ) {
RETURN_FALSE;
} else {
! RETURN_LONG(php3_list_insert((void*)ldap,LDAP_GLOBAL(le_link)));
}
}
***************
*** 367,379 ****
static LDAP * _get_ldap_link(pval *link, HashTable *list)
{
! LDAP *ldap;
! int type;
convert_to_long(link);
ldap = (LDAP *) php3_list_find(link->value.lval, &type);
! if (!ldap || !(type == php3_ldap_module.le_link)) {
php3_error(E_WARNING, "%d is not a LDAP link index", link->value.lval);
return NULL;
}
--- 398,411 ----
static LDAP * _get_ldap_link(pval *link, HashTable *list)
{
! LDAP *ldap;
! int type;
! LDAP_TLS_VARS;
convert_to_long(link);
ldap = (LDAP *) php3_list_find(link->value.lval, &type);
! if (!ldap || !(type == LDAP_GLOBAL(le_link))) {
php3_error(E_WARNING, "%d is not a LDAP link index", link->value.lval);
return NULL;
}
***************
*** 383,395 ****
static LDAPMessage * _get_ldap_result(pval *result, HashTable *list)
{
! LDAPMessage *ldap_result;
! int type;
convert_to_long(result);
ldap_result = (LDAPMessage *) php3_list_find(result->value.lval, &type);
! if (!ldap_result || type != php3_ldap_module.le_result) {
php3_error(E_WARNING, "%d is not a LDAP result index", result->value.lval);
return NULL;
}
--- 415,428 ----
static LDAPMessage * _get_ldap_result(pval *result, HashTable *list)
{
! LDAPMessage *ldap_result;
! int type;
! LDAP_TLS_VARS;
convert_to_long(result);
ldap_result = (LDAPMessage *) php3_list_find(result->value.lval, &type);
! if (!ldap_result || type != LDAP_GLOBAL(le_result)) {
php3_error(E_WARNING, "%d is not a LDAP result index", result->value.lval);
return NULL;
}
***************
*** 400,412 ****
static LDAPMessage * _get_ldap_result_entry(pval *result, HashTable *list)
{
! LDAPMessage *ldap_result_entry;
! int type;
convert_to_long(result);
ldap_result_entry = (LDAPMessage *) php3_list_find(result->value.lval, &type);
! if (!ldap_result_entry || type != php3_ldap_module.le_result_entry) {
php3_error(E_WARNING, "%d is not a LDAP result entry index", result->value.lval);
return NULL;
}
--- 433,446 ----
static LDAPMessage * _get_ldap_result_entry(pval *result, HashTable *list)
{
! LDAPMessage *ldap_result_entry;
! int type;
! LDAP_TLS_VARS;
convert_to_long(result);
ldap_result_entry = (LDAPMessage *) php3_list_find(result->value.lval, &type);
! if (!ldap_result_entry || type != LDAP_GLOBAL(le_result_entry)) {
php3_error(E_WARNING, "%d is not a LDAP result entry index", result->value.lval);
return NULL;
}
***************
*** 417,429 ****
static BerElement * _get_ber_entry(pval *berp, HashTable *list)
{
! BerElement *ber;
! int type;
convert_to_long(berp);
ber = (BerElement *) php3_list_find(berp->value.lval, &type);
! if ( type != php3_ldap_module.le_ber_entry) {
php3_error(E_WARNING, "%d is not a BerElement index", berp->value.lval);
return NULL;
}
--- 451,464 ----
static BerElement * _get_ber_entry(pval *berp, HashTable *list)
{
! BerElement *ber;
! int type;
! LDAP_TLS_VARS;
convert_to_long(berp);
ber = (BerElement *) php3_list_find(berp->value.lval, &type);
! if ( type != LDAP_GLOBAL(le_ber_entry)) {
php3_error(E_WARNING, "%d is not a BerElement index", berp->value.lval);
return NULL;
}
***************
*** 515,527 ****
static void php3_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;
switch(ARG_COUNT(ht)) {
case 3 :
--- 550,563 ----
static void php3_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;
! LDAP_TLS_VARS;
switch(ARG_COUNT(ht)) {
case 3 :
***************
*** 597,603 ****
#endif
RETVAL_FALSE;
} else {
! RETVAL_LONG(php3_list_insert(ldap_result, php3_ldap_module.le_result));
}
if (ldap_attrs != NULL) {
--- 633,639 ----
#endif
RETVAL_FALSE;
} else {
! RETVAL_LONG(php3_list_insert(ldap_result, LDAP_GLOBAL(le_result)));
}
if (ldap_attrs != NULL) {
***************
*** 669,678 ****
void php3_ldap_first_entry(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *result, *link;
! LDAP *ldap;
! LDAPMessage *ldap_result;
! LDAPMessage *ldap_result_entry;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &link, &result) == FAILURE) {
WRONG_PARAM_COUNT;
--- 705,715 ----
void php3_ldap_first_entry(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *result, *link;
! LDAP *ldap;
! LDAPMessage *ldap_result;
! LDAPMessage *ldap_result_entry;
! LDAP_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &link, &result) == FAILURE) {
WRONG_PARAM_COUNT;
***************
*** 688,703 ****
/* php3_error(E_WARNING, "LDAP: Unable to read the entries from result : %s", ldap_err2string(ldap->ld_errno));*/
RETURN_FALSE;
} else {
! RETURN_LONG(php3_list_insert(ldap_result_entry, php3_ldap_module.le_result_entry));
}
}
void php3_ldap_next_entry(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *result_entry, *link;
! LDAP *ldap;
! LDAPMessage *ldap_result_entry, *ldap_result_entry_next;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &link, &result_entry) == FAILURE) {
WRONG_PARAM_COUNT;
--- 725,741 ----
/* php3_error(E_WARNING, "LDAP: Unable to read the entries from result : %s", ldap_err2string(ldap->ld_errno));*/
RETURN_FALSE;
} else {
! RETURN_LONG(php3_list_insert(ldap_result_entry, LDAP_GLOBAL(le_result)_entry));
}
}
void php3_ldap_next_entry(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *result_entry, *link;
! LDAP *ldap;
! LDAPMessage *ldap_result_entry, *ldap_result_entry_next;
! LDAP_TLS_VARS;
if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &link, &result_entry) == FAILURE) {
WRONG_PARAM_COUNT;
***************
*** 714,720 ****
RETURN_FALSE;
} else {
/* php3_list_delete(result->value.lval); */
! RETURN_LONG(php3_list_insert(ldap_result_entry_next, php3_ldap_module.le_result_entry));
}
}
--- 752,758 ----
RETURN_FALSE;
} else {
/* php3_list_delete(result->value.lval); */
! RETURN_LONG(php3_list_insert(ldap_result_entry_next, LDAP_GLOBAL(le_result)_entry));
}
}
***************
*** 777,783 ****
for(i=0; i<num_values; i++) {
add_index_string(&tmp2, i, ldap_value[i], 1);
}
! free(ldap_value);
_php3_hash_update(tmp1.value.ht, _php3_strtolower(attribute), strlen(attribute)+1, (void *) &tmp2, sizeof(pval), NULL);
add_index_string(&tmp1, attr_count, attribute, 1);
--- 815,821 ----
for(i=0; i<num_values; i++) {
add_index_string(&tmp2, i, ldap_value[i], 1);
}
! ldap_value_free(ldap_value);
_php3_hash_update(tmp1.value.ht, _php3_strtolower(attribute), strlen(attribute)+1, (void *) &tmp2, sizeof(pval), NULL);
add_index_string(&tmp1, attr_count, attribute, 1);
***************
*** 800,830 ****
}
- void php3_ldap_free_entry(INTERNAL_FUNCTION_PARAMETERS)
- {
- pval *result_entry;
- LDAPMessage *ldap_result_entry;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &result_entry) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ldap_result_entry = _get_ldap_result_entry(result_entry, list);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
- _free_ldap_result(ldap_result_entry);
- php3_list_delete(result_entry->value.lval);
- RETURN_TRUE;
- }
-
-
void php3_ldap_first_attribute(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *result,*link,*berp;
! LDAP *ldap;
! LDAPMessage *ldap_result_entry;
! BerElement *ber;
! char *attribute;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &link, &result,&berp) == FAILURE || ParameterPassedByReference(ht,3)==0 ) {
WRONG_PARAM_COUNT;
--- 838,851 ----
}
void php3_ldap_first_attribute(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *result,*link,*berp;
! LDAP *ldap;
! LDAPMessage *ldap_result_entry;
! BerElement *ber;
! char *attribute;
! LDAP_TLS_VARS;
if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &link, &result,&berp) == FAILURE || ParameterPassedByReference(ht,3)==0 ) {
WRONG_PARAM_COUNT;
***************
*** 842,848 ****
} else {
/* brep is passed by ref so we do not have to account for memory */
berp->type=IS_LONG;
! berp->value.lval=php3_list_insert(ber, php3_ldap_module.le_ber_entry);
RETVAL_STRING(attribute,1);
#ifdef WINDOWS
--- 863,869 ----
} else {
/* brep is passed by ref so we do not have to account for memory */
berp->type=IS_LONG;
! berp->value.lval=php3_list_insert(ber, LDAP_GLOBAL(le_ber_entry));
RETVAL_STRING(attribute,1);
#ifdef WINDOWS
***************
*** 926,932 ****
for(i=0; i<num_values; i++) {
add_index_string(&tmp, i, ldap_value[i], 1);
}
! free(ldap_value);
_php3_hash_update(return_value->value.ht, attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval), NULL);
add_index_string(return_value, count, attribute, 1);
--- 947,953 ----
for(i=0; i<num_values; i++) {
add_index_string(&tmp, i, ldap_value[i], 1);
}
! ldap_value_free(ldap_value);
_php3_hash_update(return_value->value.ht, attribute, strlen(attribute)+1, (void *) &tmp, sizeof(pval), NULL);
add_index_string(return_value, count, attribute, 1);
Index: php31/ext/ldap/php3_ldap.h
diff -c php31/ext/ldap/php3_ldap.h:2.1 php31/ext/ldap/php3_ldap.h:2.2
*** php31/ext/ldap/php3_ldap.h:2.1 Thu Jul 9 02:58:47 1998
--- php31/ext/ldap/php3_ldap.h Thu Aug 27 16:55:41 1998
***************
*** 29,35 ****
*/
! /* $Id: php3_ldap.h,v 2.1 1998/07/09 06:58:47 amitay Exp $ */
#ifndef _PHP3_LDAP_H
#define _PHP3_LDAP_H
--- 29,35 ----
*/
! /* $Id: php3_ldap.h,v 2.2 1998/08/27 20:55:41 shane Exp $ */
#ifndef _PHP3_LDAP_H
#define _PHP3_LDAP_H
***************
*** 40,51 ****
--- 40,54 ----
#endif
#if HAVE_LDAP
+ #include <lber.h>
+ #include <ldap.h>
extern php3_module_entry ldap_module_entry;
#define ldap_module_ptr &ldap_module_entry
/* LDAP functions */
extern int php3_minit_ldap(INIT_FUNC_ARGS);
+ extern int php3_mshutdown_ldap(void);
extern void php3_info_ldap(void);
***************
*** 64,78 ****
extern void php3_ldap_first_entry(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_next_entry(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_get_entries(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_free_entry(INTERNAL_FUNCTION_PARAMETERS);
!
extern void php3_ldap_first_attribute(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_next_attribute(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_get_attributes(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_get_values(INTERNAL_FUNCTION_PARAMETERS);
! /*extern void php3_ber_free(INTERNAL_FUNCTION_PARAMETERS);*/
extern void php3_ldap_get_dn(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_explode_dn(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_dn2ufn(INTERNAL_FUNCTION_PARAMETERS);
--- 67,82 ----
extern void php3_ldap_first_entry(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_next_entry(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_get_entries(INTERNAL_FUNCTION_PARAMETERS);
+ #if 0
extern void php3_ldap_free_entry(INTERNAL_FUNCTION_PARAMETERS);
! #endif
extern void php3_ldap_first_attribute(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_next_attribute(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_get_attributes(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_get_values(INTERNAL_FUNCTION_PARAMETERS);
! extern void php3_ber_free(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_get_dn(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_explode_dn(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_ldap_dn2ufn(INTERNAL_FUNCTION_PARAMETERS);
***************
*** 87,95 ****
--- 91,116 ----
char *base_dn;
int le_result, le_result_entry, le_ber_entry;
int le_link;
+
+ /* I just found out that the thread safe features
+ of the netscape ldap library are only required if
+ multiple threads are accessing the same LDAP
+ structure. Since we are not doing that, we do
+ not need to use this feature. I am leaving the
+ code here anyway just in case. smc
+ */
+ #if 0
+ struct ldap_thread_fns tfns;
+ int le_errno; /* Corresponds to the LDAP error code */
+ char *le_matched; /* Matching components of the DN,
+ if an NO_SUCH_OBJECT error occurred */
+ char *le_errmsg; /* Error message */
+ #endif
} ldap_module;
+ #ifndef THREAD_SAFE
extern ldap_module php3_ldap_module;
+ #endif
#else
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: shane: "[PHP-DEV] CVS update: php31"
- Previous message: shane: "[PHP-DEV] CVS update: php31/ext/odbc"
- Next in thread: shane: "[PHP-DEV] CVS update: php31/ext/ldap"
- Maybe reply: shane: "[PHP-DEV] CVS update: php31/ext/ldap"
- Maybe reply: shane: "[PHP-DEV] CVS update: php31/ext/ldap"
- Maybe reply: shane: "[PHP-DEV] CVS update: php31/ext/ldap"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

