php4-beta | 200004
Date: 04/01/00
- Next message: Zeev Suraski: "[PHP4BETA] cvs: /php4/ext/imap imap.dsp /php4/ext/ldap ldap.dsp"
- Previous message: Sam Ruby: "[PHP4BETA] cvs: /php4/ext/java config.m4"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
zeev Sat Apr 1 08:23:39 2000 EDT
Added files:
/php4/ext/imap IMAP_Win32_HOWTO.txt
/php4/ext/ldap ldap.dsp
Removed files:
/php4/ext/imap imap.c imap.h
Modified files:
/php4 php_modules.dsw
/php4/ext/imap imap.dsp
/php4/ext/ldap ldap.c php_ldap.h
/php4/ext/mysql mysql.dsp php_mysql.c php_mysql.h
Log:
<email protected> Made the IMAP and LDAP modules compilable under Windows and thread-safe (Zeev)
Index: php4/php_modules.dsw
diff -u php4/php_modules.dsw:1.5 php4/php_modules.dsw:1.6
--- php4/php_modules.dsw:1.5 Fri Mar 31 11:46:34 2000
+++ php4/php_modules.dsw Sat Apr 1 08:23:38 2000
@@ -39,18 +39,6 @@
###############################################################################
-Project: "mysql"=.\ext\mysql\mysql.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
Project: "pgsql"=.\ext\pgsql\pgsql.dsp - Package Owner=<4>
Package=<5>
Index: php4/ext/imap/imap.dsp
diff -u php4/ext/imap/imap.dsp:1.3 php4/ext/imap/imap.dsp:1.4
--- php4/ext/imap/imap.dsp:1.3 Fri Mar 31 11:46:34 2000
+++ php4/ext/imap/imap.dsp Sat Apr 1 08:23:38 2000
@@ -44,7 +44,7 @@
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
@@ -54,7 +54,7 @@
# 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 c-client.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 php4ts.lib wsock32.lib winmm.lib /nologo /dll /machine:I386 /libpath:"..\..\Debug_TS"
+# ADD 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 php4nts.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /machine:I386 /libpath:"..\..\Release" /libpath:"..\..\..\php_build\IMAP\C-Client"
!ELSEIF "$(CFG)" == "imap - Win32 Debug"
@@ -69,7 +69,7 @@
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "_DEBUG"
@@ -79,7 +79,7 @@
# 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 c-client.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 php4ts.lib wsock32.lib winmm.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug"
+# ADD 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 php4nts_debug.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" /libpath:"..\..\..\php_build\IMAP\C-Client"
!ELSEIF "$(CFG)" == "imap - Win32 Debug_TS"
@@ -95,7 +95,7 @@
# 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 "IMAP_EXPORTS" /FR /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "ZTS" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /FR /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "ZTS" /D "_DEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "_DEBUG"
@@ -105,7 +105,7 @@
# 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php4ts.lib wsock32.lib winmm.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\\" /libpath:"..\..\Debug_TS"
+# ADD 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 php4ts_debug.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\\" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\php_build\IMAP\C-Client"
!ELSEIF "$(CFG)" == "imap - Win32 Release_TS"
@@ -118,9 +118,10 @@
# 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 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "IMAP_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "ZTS" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\php_build\IMAP\c-client" /I "..\..\TSRM" /D "ZTS" /D "NDEBUG" /D "IMAP_EXPORTS" /D "COMPILE_DL_IMAP" /D HAVE_IMAP=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=0 /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x40d /d "NDEBUG"
@@ -130,7 +131,7 @@
# 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 c-client.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 php4ts.lib wsock32.lib winmm.lib /nologo /dll /machine:I386 /libpath:"..\..\Debug_TS"
+# ADD 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 php4ts.lib wsock32.lib winmm.lib cclient.lib /nologo /dll /machine:I386 /libpath:"..\..\Release_TS" /libpath:"..\..\..\php_build\IMAP\C-Client"
!ENDIF
@@ -156,98 +157,6 @@
SOURCE=.\imap.h
# End Source File
-# End Group
-# Begin Group "IMAP"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\dummynt.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\fdstring.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\flstring.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\imap4r1.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\mail.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\mbxnt.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\misc.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\mtxnt.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\netmsg.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\newsrc.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\nntp.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\os_nt.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\pop3.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\pseudo.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\rfc822.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\smanager.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\smtp.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\tenexnt.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\unixnt.c"
-# End Source File
-# Begin Source File
-
-SOURCE="..\..\..\Imap\c-client\utf8.c"
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# End Group
# End Group
# End Target
# End Project
Index: php4/ext/ldap/ldap.c
diff -u php4/ext/ldap/ldap.c:1.28 php4/ext/ldap/ldap.c:1.29
--- php4/ext/ldap/ldap.c:1.28 Mon Mar 6 10:41:09 2000
+++ php4/ext/ldap/ldap.c Sat Apr 1 08:23:39 2000
@@ -16,18 +16,17 @@
| Eric Warnke <ericw <email protected>> |
| Rasmus Lerdorf <rasmus <email protected>> |
| Gerrit Thomson <334647 <email protected>> |
+ | PHP 4.0 updates: Zeev Suraski <zeev <email protected>> |
+----------------------------------------------------------------------+
*/
-/* $Id: ldap.c,v 1.28 2000/03/06 18:41:09 ssb Exp $ */
+/* $Id: ldap.c,v 1.29 2000/04/01 16:23:39 zeev Exp $ */
#define IS_EXT_MODULE
#include "php.h"
+#include "php_ini.h"
-#if HAVE_LDAP
-
-#include "dl/phpdl.h"
#include "ext/standard/dl.h"
#include "php_ldap.h"
@@ -47,18 +46,11 @@
#include "ext/standard/php_string.h"
-#if THREAD_SAFE & HAVE_NSLDAP
-#include "php3_threads.h"
-/* Structure for LDAP error values */
-#define LDAP_TLS_VARS ldap_module *PHP3_TLS_GET(ldapTLS,php_ldap_module)
-#define LDAP_GLOBAL(a) php_ldap_module->a
-#else
-#define LDAP_TLS_VARS
-#define LDAP_GLOBAL(a) php_ldap_module.a
-ldap_module php_ldap_module;
-#endif
+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
@@ -104,159 +96,60 @@
-#if COMPILE_DL
-DLEXPORT zend_module_entry *get_module(void ) { return &ldap_module_entry; }
+#ifdef COMPILE_DL_LDAP
+ZEND_DLEXPORT zend_module_entry *get_module(void ) { return &ldap_module_entry; }
#endif
-#if 0 /* see my note in php_ldap.h. smc */
-/* Function for setting thread-specific LDAP error values */
-static void php_ldap_set_ld_error( int err, char *matched, char *errmsg, void *dummy )
+static void _close_ldap_link(LDAP *ld)
{
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
- /* 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;
+ ldap_unbind_s(ld);
+ /* php_printf("Freeing ldap connection");*/
+ LDAPG(num_links)--;
}
-/* Function for getting the thread-specific LDAP error values */
-static int php_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 */
-static void php_ldap_set_errno( int err )
+static void _free_ldap_result(LDAPMessage *result)
{
- errno = err;
+ ldap_msgfree(result);
}
-/* Function for getting the value of the errno variable */
-static int php_ldap_get_errno( void )
-{
- return( errno );
-}
-#endif /* THREAD_SAFE && NSLDAP */
-static void _close_ldap_link(LDAP *ld)
-{
- LDAP_TLS_VARS;
- ldap_unbind_s(ld);
- /* php_printf("Freeing ldap connection");*/
- LDAP_GLOBAL(num_links)--;
-}
+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("mysql.base_dn", NULL, PHP_INI_ALL, OnUpdateString, base_dn, zend_ldap_globals, ldap_globals)
+PHP_INI_END()
-static void _free_ldap_result(LDAPMessage *result)
+static void php_ldap_init_globals(zend_ldap_globals *ldap_globals)
{
- ldap_msgfree(result);
+ ldap_globals->num_links = 0;
}
+
PHP_MINIT_FUNCTION(ldap)
{
-#if defined(THREAD_SAFE)
- ldap_module *php_ldap_module;
- PHP_MUTEX_ALLOC(ldap_mutex);
- PHP_MUTEX_LOCK(ldap_mutex);
- numthreads++;
- if (numthreads==1){
- if (!PHP3_TLS_PROC_STARTUP(ldapTLS)){
- PHP_MUTEX_UNLOCK(ldap_mutex);
- PHP_MUTEX_FREE(ldap_mutex);
- return 0;
- }
- }
- PHP_MUTEX_UNLOCK(ldap_mutex);
- if(!PHP3_TLS_THREAD_INIT(ldapTLS,php_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 = php_ldap_get_errno;
- /* Call the set_errno() function to set the value of errno */
- LDAP_GLOBAL(tfns).ltf_set_errno = php_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 = php_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 = php_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;
- }
+ ZEND_INIT_MODULE_GLOBALS(ldap, php_ldap_init_globals, NULL);
- if (cfg_get_string("ldap.base_dn", &LDAP_GLOBAL(base_dn)) == FAILURE) {
- LDAP_GLOBAL(base_dn) = NULL;
- }
+ REGISTER_INI_ENTRIES();
- LDAP_GLOBAL(le_result) = register_list_destructors(_free_ldap_result, NULL);
- LDAP_GLOBAL(le_link) = register_list_destructors(_close_ldap_link, NULL);
+ le_result = register_list_destructors(_free_ldap_result, NULL);
+ 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;
}
+
PHP_MSHUTDOWN_FUNCTION(ldap)
{
-#ifdef THREAD_SAFE
- LDAP_TLS_VARS;
- PHP3_TLS_THREAD_FREE(php_ldap_module);
- PHP_MUTEX_LOCK(ldap_mutex);
- numthreads--;
- if (!numthreads) {
- PHP3_TLS_PROC_SHUTDOWN(ldapTLS);
- }
- PHP_MUTEX_UNLOCK(ldap_mutex);
- PHP_MUTEX_FREE(ldap_mutex);
-#endif
return SUCCESS;
}
+
PHP_MINFO_FUNCTION(ldap)
{
char maxl[16];
@@ -266,24 +159,24 @@
/* Print version information */
SDKVersion = ldap_version( &ver );
#endif
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
- if (LDAP_GLOBAL(max_links) == -1) {
+ if (LDAPG(max_links) == -1) {
strcpy(maxl, "Unlimited");
} else {
- snprintf(maxl, 15, "%ld", LDAP_GLOBAL(max_links));
+ snprintf(maxl, 15, "%ld", LDAPG(max_links));
maxl[15] = 0;
}
php_printf("<table>"
"<tr><td>Total links:</td><td>%d/%s</td></tr>\n"
- "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.28 2000/03/06 18:41:09 ssb Exp $</td></tr>\n"
+ "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.29 2000/04/01 16:23:39 zeev 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
+ ,LDAPG(num_links), maxl
#if HAVE_NSLDAP
,SDKVersion/100.0,ver.protocol_version/100.0,ver.SSL_version/100.0
#endif
@@ -308,7 +201,7 @@
/* char *hashed_details;
int hashed_details_length;*/
LDAP *ldap;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
switch(ARG_COUNT(ht)) {
case 0:
@@ -359,16 +252,16 @@
break;
}
- if (LDAP_GLOBAL(max_links)!=-1 && LDAP_GLOBAL(num_links)>=LDAP_GLOBAL(max_links)) {
- php_error(E_WARNING, "LDAP: Too many open links (%d)", LDAP_GLOBAL(num_links));
- RETURN_FALSE;
+ 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;
+ RETURN_FALSE;
} else {
- RETURN_LONG(zend_list_insert((void*)ldap,LDAP_GLOBAL(le_link)));
+ RETURN_LONG(zend_list_insert((void*)ldap,le_link));
}
}
@@ -379,12 +272,12 @@
{
LDAP *ldap;
int type;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
convert_to_long_ex(link);
ldap = (LDAP *) zend_list_find((*link)->value.lval, &type);
- if (!ldap || !(type == LDAP_GLOBAL(le_link))) {
+ if (!ldap || !(type == le_link)) {
php_error(E_WARNING, "%d is not a LDAP link index",(*link)->value.lval);
return NULL;
}
@@ -396,12 +289,12 @@
{
LDAPMessage *ldap_result;
int type;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
convert_to_long_ex(result);
ldap_result = (LDAPMessage *)zend_list_find((*result)->value.lval, &type);
- if (!ldap_result || type != LDAP_GLOBAL(le_result)) {
+ if (!ldap_result || type != le_result) {
php_error(E_WARNING, "%d is not a LDAP result index",(*result)->value.lval);
return NULL;
}
@@ -414,12 +307,12 @@
{
LDAPMessage *ldap_result_entry;
int type;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
convert_to_long_ex(result);
ldap_result_entry = (LDAPMessage *)zend_list_find((*result)->value.lval, &type);
- if (!ldap_result_entry || type != LDAP_GLOBAL(le_result_entry)) {
+ 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;
}
@@ -432,12 +325,12 @@
{
BerElement *ber;
int type;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
convert_to_long_ex(berp);
ber = (BerElement *) zend_list_find((*berp)->value.lval, &type);
- if ( type != LDAP_GLOBAL(le_ber_entry)) {
+ if ( type != le_ber_entry) {
php_error(E_WARNING, "%d is not a BerElement index",(*berp)->value.lval);
return NULL;
}
@@ -546,7 +439,7 @@
int attrsonly;
LDAPMessage *ldap_result;
int num_attribs=0, i;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
switch(ARG_COUNT(ht)) {
case 3 :
@@ -628,7 +521,7 @@
#endif
RETVAL_FALSE;
} else {
- RETVAL_LONG(zend_list_insert(ldap_result, LDAP_GLOBAL(le_result)));
+ RETVAL_LONG(zend_list_insert(ldap_result, le_result));
}
if (ldap_attrs != NULL) {
@@ -715,7 +608,7 @@
LDAP *ldap;
LDAPMessage *ldap_result;
LDAPMessage *ldap_result_entry;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &link, &result) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -730,7 +623,7 @@
if ((ldap_result_entry = ldap_first_entry(ldap, ldap_result)) == NULL) {
RETURN_FALSE;
} else {
- RETURN_LONG(zend_list_insert(ldap_result_entry, LDAP_GLOBAL(le_result_entry)));
+ RETURN_LONG(zend_list_insert(ldap_result_entry, le_result_entry));
}
}
/* }}} */
@@ -742,7 +635,7 @@
pval **result_entry, **link;
LDAP *ldap;
LDAPMessage *ldap_result_entry, *ldap_result_entry_next;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
if (ARG_COUNT(ht) != 2 || zend_get_parameters_ex(2, &link,&result_entry) == FAILURE) {
WRONG_PARAM_COUNT;
@@ -757,7 +650,7 @@
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, LDAP_GLOBAL(le_result_entry)));
+ RETURN_LONG(zend_list_insert(ldap_result_entry_next, le_result_entry));
}
}
/* }}} */
@@ -858,7 +751,7 @@
LDAPMessage *ldap_result_entry;
BerElement *ber;
char *attribute;
- LDAP_TLS_VARS;
+ LDAPLS_FETCH();
if (ARG_COUNT(ht) != 3 || zend_get_parameters_ex(3, &link,&result,&berp) == FAILURE || ParameterPassedByReference(ht,3)==0 ) {
WRONG_PARAM_COUNT;
@@ -875,7 +768,7 @@
} 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,LDAP_GLOBAL(le_ber_entry));
+ (*berp)->value.lval=zend_list_insert(ber,le_ber_entry);
RETVAL_STRING(attribute,1);
#ifdef WINDOWS
@@ -1302,4 +1195,3 @@
}
/* }}} */
-#endif
Index: php4/ext/ldap/php_ldap.h
diff -u php4/ext/ldap/php_ldap.h:1.3 php4/ext/ldap/php_ldap.h:1.4
--- php4/ext/ldap/php_ldap.h:1.3 Sat Dec 18 03:49:31 1999
+++ php4/ext/ldap/php_ldap.h Sat Apr 1 08:23:39 2000
@@ -29,17 +29,11 @@
*/
-/* $Id: php_ldap.h,v 1.3 1999/12/18 11:49:31 zeev Exp $ */
+/* $Id: php_ldap.h,v 1.4 2000/04/01 16:23:39 zeev Exp $ */
#ifndef _PHP_LDAP_H
#define _PHP_LDAP_H
-#if COMPILE_DL
-#undef HAVE_LDAP
-#define HAVE_LDAP 1
-#endif
-
-#if HAVE_LDAP
#include <lber.h>
#include <ldap.h>
@@ -89,38 +83,28 @@
PHP_FUNCTION(ldap_mod_replace);
PHP_FUNCTION(ldap_mod_del);
-typedef struct {
+ZEND_BEGIN_MODULE_GLOBALS(ldap)
long default_link;
long num_links, max_links;
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;
+ZEND_END_MODULE_GLOBALS(ldap)
-#ifndef THREAD_SAFE
-extern ldap_module php_ldap_module;
-#endif
-
+#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 ldap_module_ptr NULL
-
+# 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
Index: php4/ext/mysql/mysql.dsp
diff -u php4/ext/mysql/mysql.dsp:1.11 php4/ext/mysql/mysql.dsp:1.12
--- php4/ext/mysql/mysql.dsp:1.11 Fri Mar 31 11:46:35 2000
+++ php4/ext/mysql/mysql.dsp Sat Apr 1 08:23:39 2000
@@ -21,7 +21,6 @@
!MESSAGE "mysql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "mysql - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "mysql - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Release_TS_inline" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
@@ -136,33 +135,6 @@
# 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS"
-!ELSEIF "$(CFG)" == "mysql - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "mysql___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "mysql___Win32_Release_TS_inline"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\MySQL\include" /I "..\..\TSRM" /D "NDEBUG" /D "ZTS" /D "MYSQL_EXPORTS" /D "COMPILE_DL_MYSQL" /D HAVE_MYSQL=1 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /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 libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS"
-# ADD 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 libmySQL.lib php4ts.lib /nologo /dll /machine:I386 /out:"Release_TS_inline/php_mysql.dll" /libpath:"..\..\..\MySQL\lib\opt" /libpath:"..\..\Release_TS_inline"
-
!ENDIF
# Begin Target
@@ -171,7 +143,6 @@
# Name "mysql - Win32 Debug"
# Name "mysql - Win32 Debug_TS"
# Name "mysql - Win32 Release_TS"
-# Name "mysql - Win32 Release_TS_inline"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
Index: php4/ext/mysql/php_mysql.c
diff -u php4/ext/mysql/php_mysql.c:1.37 php4/ext/mysql/php_mysql.c:1.38
--- php4/ext/mysql/php_mysql.c:1.37 Sat Mar 25 18:01:11 2000
+++ php4/ext/mysql/php_mysql.c Sat Apr 1 08:23:39 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mysql.c,v 1.37 2000/03/26 02:01:11 zeev Exp $ */
+/* $Id: php_mysql.c,v 1.38 2000/04/01 16:23:39 zeev Exp $ */
/* TODO:
@@ -52,7 +52,6 @@
#include "php_ini.h"
-#if HAVE_MYSQL
# if HAVE_MYSQL_MYSQL_H
# include <mysql/mysql.h>
# else
@@ -62,7 +61,6 @@
#ifdef HAVE_ERRMSG_H
#include <errmsg.h>
#endif
-#endif
#define SAFE_STRING(s) ((s)?(s):"")
@@ -150,26 +148,23 @@
PHP_MINFO(mysql), STANDARD_MODULE_PROPERTIES
};
-#ifdef ZTS
-int mysql_globals_id;
-#else
-PHP_MYSQL_API php_mysql_globals mysql_globals;
-#endif
+
+ZEND_DECLARE_MODULE_GLOBALS(mysql)
#ifdef COMPILE_DL_MYSQL
-# include "dl/phpdl.h"
-DLEXPORT zend_module_entry *get_module(void) { return &mysql_module_entry; }
+ZEND_DLEXPORT zend_module_entry *get_module(void) { return &mysql_module_entry; }
#endif
void timeout(int sig);
#define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"MySQL: A link to the server could not be established"); RETURN_FALSE; } }
-/* NOTE Don't ask me why, but soon as I made this the list
- * destructor, I stoped getting access violations in windows
- * with mysql 3.22.7a
+/*
+ * This wrapper is required since mysql_free_result() returns an integer, and
+ * thus, cannot be used directly
*/
-static void _free_mysql_result(MYSQL_RES *mysql_result){
+static void _free_mysql_result(MYSQL_RES *mysql_result)
+{
mysql_free_result(mysql_result);
}
@@ -240,31 +235,25 @@
PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("mysql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, php_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY_EX("mysql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, php_mysql_globals, mysql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY_EX("mysql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, php_mysql_globals, mysql_globals, display_link_numbers)
- STD_PHP_INI_ENTRY("mysql.default_host", NULL, PHP_INI_ALL, OnUpdateString, default_host, php_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY("mysql.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, php_mysql_globals, mysql_globals)
- STD_PHP_INI_ENTRY("mysql.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, php_mysql_globals, mysql_globals)
+ STD_PHP_INI_BOOLEAN("mysql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, zend_mysql_globals, mysql_globals)
+ STD_PHP_INI_ENTRY_EX("mysql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, zend_mysql_globals, mysql_globals, display_link_numbers)
+ STD_PHP_INI_ENTRY_EX("mysql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, zend_mysql_globals, mysql_globals, display_link_numbers)
+ STD_PHP_INI_ENTRY("mysql.default_host", NULL, PHP_INI_ALL, OnUpdateString, default_host, zend_mysql_globals, mysql_globals)
+ STD_PHP_INI_ENTRY("mysql.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysql_globals, mysql_globals)
+ STD_PHP_INI_ENTRY("mysql.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_mysql_globals, mysql_globals)
PHP_INI_ENTRY("mysql.default_port", NULL, PHP_INI_ALL, OnMySQLPort)
PHP_INI_END()
-#ifdef ZTS
-static void php_mysql_init_globals(php_mysql_globals *mysql_globals)
+static void php_mysql_init_globals(zend_mysql_globals *mysql_globals)
{
- MySG(num_persistent) = 0;
+ mysql_globals->num_persistent = 0;
}
-#endif
PHP_MINIT_FUNCTION(mysql)
{
-#ifdef ZTS
- mysql_globals_id = ts_allocate_id(sizeof(php_mysql_globals), (ts_allocate_ctor) php_mysql_init_globals, NULL);
-#else
- MySG(num_persistent)=0;
-#endif
+ ZEND_INIT_MODULE_GLOBALS(mysql, php_mysql_init_globals, NULL);
REGISTER_INI_ENTRIES();
le_result = register_list_destructors(_free_mysql_result,NULL);
Index: php4/ext/mysql/php_mysql.h
diff -u php4/ext/mysql/php_mysql.h:1.7 php4/ext/mysql/php_mysql.h:1.8
--- php4/ext/mysql/php_mysql.h:1.7 Sat Feb 19 15:41:16 2000
+++ php4/ext/mysql/php_mysql.h Sat Apr 1 08:23:39 2000
@@ -17,7 +17,7 @@
*/
-/* $Id: php_mysql.h,v 1.7 2000/02/19 23:41:16 zeev Exp $ */
+/* $Id: php_mysql.h,v 1.8 2000/04/01 16:23:39 zeev Exp $ */
#ifndef _PHP_MYSQL_H
#define _PHP_MYSQL_H
@@ -80,23 +80,22 @@
PHP_FUNCTION(mysql_field_type);
PHP_FUNCTION(mysql_field_flags);
-typedef struct {
+ZEND_BEGIN_MODULE_GLOBALS(mysql)
long default_link;
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
long default_port;
char *default_host, *default_user, *default_password;
-} php_mysql_globals;
+ZEND_END_MODULE_GLOBALS(mysql);
-
#ifdef ZTS
-# define MySLS_D php_mysql_globals *mysql_globals
+# define MySLS_D zend_mysql_globals *mysql_globals
# define MySLS_DC , MySLS_D
# define MySLS_C mysql_globals
# define MySLS_CC , MySLS_C
# define MySG(v) (mysql_globals->v)
-# define MySLS_FETCH() php_mysql_globals *mysql_globals = ts_resource(mysql_globals_id)
+# define MySLS_FETCH() zend_mysql_globals *mysql_globals = ts_resource(mysql_module_entry.globals_id)
#else
# define MySLS_D
# define MySLS_DC
@@ -104,7 +103,6 @@
# define MySLS_CC
# define MySG(v) (mysql_globals.v)
# define MySLS_FETCH()
-extern PHP_MYSQL_API php_mysql_globals mysql_globals;
#endif
-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe <email protected> For additional commands, e-mail: php4beta-help <email protected> To contact the list administrators, e-mail: php4beta-admin <email protected>
- Next message: Zeev Suraski: "[PHP4BETA] cvs: /php4/ext/imap imap.dsp /php4/ext/ldap ldap.dsp"
- Previous message: Sam Ruby: "[PHP4BETA] cvs: /php4/ext/java config.m4"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

