#include "portable.h"
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
int
--- /dev/null
+/* This file is necessary because both PERL headers */
+/* and OpenLDAP define a number of macros without */
+/* checking wether they're already defined */
+
+#ifndef ASPERL_UNDEFS_H
+#define ASPERL_UNDEFS_H
+
+/* ActiveState Win32 PERL port support */
+/* set in ldap/include/portable.h */
+# ifdef HAVE_WIN32_ASPERL
+/* The following macros are undefined to prevent */
+/* redefinition in PERL headers*/
+# undef gid_t
+# undef uid_t
+# undef mode_t
+# undef caddr_t
+# undef WIN32_LEAN_AND_MEAN
+# endif
+#endif
+
--- /dev/null
+# Microsoft Developer Studio Project File - Name="backperl" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
+\r
+CFG=backperl - Win32 Single Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "backperl.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "backperl.mak" CFG="backperl - Win32 Single Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "backperl - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "backperl - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "backperl - Win32 Single Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "backperl - Win32 Single Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "backperl - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "..\..\..\Release"\r
+# PROP Intermediate_Dir "..\..\..\Release\backperl"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c\r
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_CONSOLE" /D "NO_STRICT" /D "HAVE_DES_CRYPT" /D "PERL_IMPLICIT_CONTEXT" /D "PERL_IMPLICIT_SYS" /D "PERL_MSVCRT_READFIX" /D "MULTIPLICITY" /YX /FD /c\r
+# ADD BASE RSC /l 0x409\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF "$(CFG)" == "backperl - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "..\..\..\Debug"\r
+# PROP Intermediate_Dir "..\..\..\Debug\backperl"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c\r
+# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PERL_IMPLICIT_CONTEXT" /D "PERL_IMPLICIT_SYS" /D "NO_STRICT" /D "HAVE_DES_FCRYPT" /D "PERL_MSVCRT_READFIX" /FR /YX /FD /c\r
+# ADD BASE RSC /l 0x409\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF "$(CFG)" == "backperl - Win32 Single Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "backperl"\r
+# PROP BASE Intermediate_Dir "backperl"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "..\..\..\SDebug"\r
+# PROP Intermediate_Dir "..\..\..\SDebug\backperl"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c\r
+# ADD BASE RSC /l 0x409\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF "$(CFG)" == "backperl - Win32 Single Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "backldb0"\r
+# PROP BASE Intermediate_Dir "backldb0"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "..\..\..\SRelease"\r
+# PROP Intermediate_Dir "..\..\..\SRelease\backperl"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "D:\perl\lib\CORE" /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_CONSOLE" /D "NO_STRICT" /D "HAVE_DES_FCRYPT" /D "PERL_IMPLICIT_CONTEXT" /D "PERL_IMPLICIT_SYS" /D "PERL_MSVCRT_READFIX" /YX /FD /c\r
+# ADD BASE RSC /l 0x409\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "backperl - Win32 Release"\r
+# Name "backperl - Win32 Debug"\r
+# Name "backperl - Win32 Single Debug"\r
+# Name "backperl - Win32 Single Release"\r
+# Begin Source File\r
+\r
+SOURCE=.\add.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\asperl_undefs.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\bind.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\close.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\compare.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\config.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\delete.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\external.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\init.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\modify.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\modrdn.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\perl_back.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\search.c\r
+# End Source File\r
+# End Target\r
+# End Project\r
*/
#include "portable.h"
-/* init.c - initialize shell backend */
+/* init.c - initialize Perl backend */
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
+#include <XSUB.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
PerlBackend *perl_back = (PerlBackend *) be->be_private;
+#ifdef HAVE_WIN32_ASPERL
+ PERL_SET_CONTEXT( PERL_INTERPRETER );
+#endif
+
ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
{
dSP; ENTER; SAVETMPS;
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs( perl_back->pb_obj_ref );
XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0)));
XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len)));
/* init.c - initialize shell backend */
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
/**********************************************************
{
ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
- perl_destruct(perl_interpreter);
+ perl_destruct(PERL_INTERPRETER);
ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
BackendInfo *bd
)
{
- perl_free(perl_interpreter);
- perl_interpreter = NULL;
+ perl_free(PERL_INTERPRETER);
+ PERL_INTERPRETER = NULL;
ldap_pvt_thread_mutex_destroy( &perl_interpreter_mutex );
#include "portable.h"
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
/**********************************************************
*/
#include "portable.h"
-/* init.c - initialize shell backend */
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
#include "portable.h"
#include <stdio.h>
-/* #include <ac/types.h>
-#include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
int
/* init.c - initialize shell backend */
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
-
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
+#include <XSUB.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
-static void perl_back_xs_init LDAP_P((void));
-EXT void boot_DynaLoader LDAP_P((CV* cv));
+static void perl_back_xs_init LDAP_P((PERL_BACK_XS_INIT_PARAMS));
+EXT void boot_DynaLoader LDAP_P((PERL_BACK_BOOT_DYNALOADER_PARAMS));
-PerlInterpreter *perl_interpreter = NULL;
+PerlInterpreter *PERL_INTERPRETER = NULL;
ldap_pvt_thread_mutex_t perl_interpreter_mutex;
#ifdef SLAPD_PERL_DYNAMIC
Debug( LDAP_DEBUG_TRACE, "perl backend open\n", 0, 0, 0 );
- if( perl_interpreter != NULL ) {
+ if( PERL_INTERPRETER != NULL ) {
Debug( LDAP_DEBUG_ANY, "perl backend open: already opened\n",
0, 0, 0 );
return 1;
}
- perl_interpreter = perl_alloc();
- perl_construct(perl_interpreter);
- perl_parse(perl_interpreter, perl_back_xs_init, 3, embedding, (char **)NULL);
- perl_run(perl_interpreter);
+ PERL_INTERPRETER = perl_alloc();
+ perl_construct(PERL_INTERPRETER);
+ perl_parse(PERL_INTERPRETER, perl_back_xs_init, 3, embedding, (char **)NULL);
+ perl_run(PERL_INTERPRETER);
bi->bi_open = perl_back_open;
bi->bi_config = 0;
#include "portable.h"
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
int
#include "portable.h"
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
int
#define PERL_IS_5_6
#endif
-extern PerlInterpreter *perl_interpreter;
extern ldap_pvt_thread_mutex_t perl_interpreter_mutex;
+#ifdef HAVE_WIN32_ASPERL
+/* We should be using the PL_errgv, I think */
+/* All the old style variables are prefixed with PL_ now */
+# define errgv PL_errgv
+# define na PL_na
+#endif
+
+#ifdef HAVE_WIN32_ASPERL
+/* pTHX is needed often now */
+# define PERL_INTERPRETER my_perl
+# define PERL_BACK_XS_INIT_PARAMS pTHX
+# define PERL_BACK_BOOT_DYNALOADER_PARAMS pTHX, CV *cv
+#else
+# define PERL_INTERPRETER perl_interpreter
+# define PERL_BACK_XS_INIT_PARAMS void
+# define PERL_BACK_BOOT_DYNALOADER_PARAMS CV *cv
+#endif
+
+extern PerlInterpreter *PERL_INTERPRETER;
+
+
typedef struct perl_backend_instance {
char *pb_module_name;
SV *pb_obj_ref;
#include "portable.h"
#include <stdio.h>
-/* #include <ac/types.h>
- #include <ac/socket.h>
-*/
+
+#include "slap.h"
+#ifdef HAVE_WIN32_ASPERL
+#include "asperl_undefs.h"
+#endif
#include <EXTERN.h>
#include <perl.h>
-#include "slap.h"
#include "perl_back.h"
/**********************************************************