diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index 54fff23d9239d2fbcacc037549ea4ffdea436e2e..fa9d9b37a26bcc77edab761c2c17898bd0303ba6 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -171,7 +171,7 @@ main( int argc, char **argv ) myname = strdup( myname + 1 ); if ( debug ) { - lber_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug); + ber_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug); ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug); } diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c index 09c6df2a4913fd3f45e93bf130f6f8c65f2e9cd3..eeb4784fdb19698c9363addaf5d02e6098782c49 100644 --- a/clients/gopher/go500gw.c +++ b/clients/gopher/go500gw.c @@ -195,7 +195,7 @@ main (int argc, char **argv ) myname = strdup( myname + 1 ); if ( debug ) { - lber_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug); + ber_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug); ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug); } diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 35b3af8fba71a281917202f8a8c1ebcffcb9aea8..2d6f00351f860f4ab62714ed8bd0497619aaf3e3 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -114,7 +114,7 @@ main( int argc, char **argv ) } if ( debug ) { - lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); + ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ); } diff --git a/clients/tools/ldapdelete.dsp b/clients/tools/ldapdelete.dsp index 59aa552e5d68f84a7ce4bf111be15c24dddc328b..6a2045132a74fb823efcd71150177c0af4cf9ea0 100644 --- a/clients/tools/ldapdelete.dsp +++ b/clients/tools/ldapdelete.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldapdelete - Win32 Single Debug +CFG=ldapdelete - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,7 +13,7 @@ CFG=ldapdelete - Win32 Single Debug !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 "ldapdelete.mak" CFG="ldapdelete - Win32 Single Debug" +!MESSAGE NMAKE /f "ldapdelete.mak" CFG="ldapdelete - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -21,6 +21,10 @@ CFG=ldapdelete - Win32 Single Debug "Win32 (x86) Console Application") !MESSAGE "ldapdelete - Win32 Single Release" (based on\ "Win32 (x86) Console Application") +!MESSAGE "ldapdelete - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldapdelete - Win32 Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -39,8 +43,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ldapdele" -# PROP Intermediate_Dir "ldapdele" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\ldapdelete" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -52,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\SDebug" !ELSEIF "$(CFG)" == "ldapdelete - Win32 Single Release" @@ -64,19 +68,69 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ldapdel0" -# PROP Intermediate_Dir "ldapdel0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\ldapdelete" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" +# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 /out:"SRelease/ldapdelete.exe" /libpath:"..\..\libraries\SRelease" + +!ELSEIF "$(CFG)" == "ldapdelete - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldapdel1" +# PROP BASE Intermediate_Dir "ldapdel1" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "Debug\ldapdelete" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" + +!ELSEIF "$(CFG)" == "ldapdelete - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldapdel2" +# PROP BASE Intermediate_Dir "ldapdel2" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "Release\ldapdelete" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapdelete.exe" /libpath:"..\..\libraries\Release" # ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapdelete.exe" /libpath:"..\..\libraries\Release" !ENDIF @@ -85,6 +139,8 @@ LINK32=link.exe # Name "ldapdelete - Win32 Single Debug" # Name "ldapdelete - Win32 Single Release" +# Name "ldapdelete - Win32 Debug" +# Name "ldapdelete - Win32 Release" # Begin Source File SOURCE=.\ldapdelete.c diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 44c04d00587ff65873cd40f3f399e1c8ef00ea9f..d5926b6dd6d6ea826ba0682b5118c280730fb90f 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -1,3 +1,7 @@ +/* + * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ /* ldapmodify.c - generic program to modify or add entries using LDAP */ #include "portable.h" @@ -200,7 +204,7 @@ main( int argc, char **argv ) } if ( debug ) { - lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); + ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ); ldif_debug = debug; } diff --git a/clients/tools/ldapmodify.dsp b/clients/tools/ldapmodify.dsp index f633dea9a40ca311bf21ab5c622ffbe423d5d2a6..e260802ab24903b540128e62bdbe49d1e4d289b5 100644 --- a/clients/tools/ldapmodify.dsp +++ b/clients/tools/ldapmodify.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldapmodify - Win32 Single Debug +CFG=ldapmodify - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,7 +13,7 @@ CFG=ldapmodify - Win32 Single Debug !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 "ldapmodify.mak" CFG="ldapmodify - Win32 Single Debug" +!MESSAGE NMAKE /f "ldapmodify.mak" CFG="ldapmodify - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -21,6 +21,10 @@ CFG=ldapmodify - Win32 Single Debug "Win32 (x86) Console Application") !MESSAGE "ldapmodify - Win32 Single Release" (based on\ "Win32 (x86) Console Application") +!MESSAGE "ldapmodify - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldapmodify - Win32 Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -39,8 +43,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ldapmodi" -# PROP Intermediate_Dir "ldapmodi" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\ldapmodify" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -64,8 +68,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ldapmod0" -# PROP Intermediate_Dir "ldapmod0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\ldapmodify" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -79,27 +83,67 @@ LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" # ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\libraries\Release" +!ELSEIF "$(CFG)" == "ldapmodify - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldapmod1" +# PROP BASE Intermediate_Dir "ldapmod1" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "Debug\ldapmodify" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Release/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\libraries\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Release/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\libraries\Debug" + +!ELSEIF "$(CFG)" == "ldapmodify - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldapmod2" +# PROP BASE Intermediate_Dir "ldapmod2" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "Release\ldapmodify" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\libraries\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\libraries\Release" + !ENDIF # Begin Target # Name "ldapmodify - Win32 Single Debug" # Name "ldapmodify - Win32 Single Release" -# Begin Group "Source" - -# PROP Default_Filter ".c" +# Name "ldapmodify - Win32 Debug" +# Name "ldapmodify - Win32 Release" # Begin Source File SOURCE=.\ldapmodify.c # End Source File -# End Group -# Begin Group "Headers" - -# PROP Default_Filter ".h" -# Begin Source File - -SOURCE=..\..\include\portable.h -# End Source File -# End Group # End Target # End Project diff --git a/clients/tools/ldapmodify.dsw b/clients/tools/ldapmodify.dsw index 64470316b93e48728ee0714d20971c6054589f95..c8186761c36bd3cffd47274c45525df8c389e58a 100644 --- a/clients/tools/ldapmodify.dsw +++ b/clients/tools/ldapmodify.dsw @@ -47,6 +47,9 @@ Package=<5> Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name liblber + End Project Dependency }}} ############################################################################### diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index 9e0b92072666ebec2c494b4b7ec569be2ea94fee..446c24bfb03b1ffb71e75922020c72f162176305 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -165,7 +165,7 @@ main(int argc, char **argv) } if ( debug ) { - lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); + ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ); } diff --git a/clients/tools/ldapmodrdn.dsp b/clients/tools/ldapmodrdn.dsp index 39d6474a9a0b9bb21ab16d72576d22f065f457df..bdb46da26d1d891e88567295939031370d5c7379 100644 --- a/clients/tools/ldapmodrdn.dsp +++ b/clients/tools/ldapmodrdn.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldapmodrdn - Win32 Single Debug +CFG=ldapmodrdn - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,7 +13,7 @@ CFG=ldapmodrdn - Win32 Single Debug !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 "ldapmodrdn.mak" CFG="ldapmodrdn - Win32 Single Debug" +!MESSAGE NMAKE /f "ldapmodrdn.mak" CFG="ldapmodrdn - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -21,6 +21,10 @@ CFG=ldapmodrdn - Win32 Single Debug "Win32 (x86) Console Application") !MESSAGE "ldapmodrdn - Win32 Single Release" (based on\ "Win32 (x86) Console Application") +!MESSAGE "ldapmodrdn - Win32 Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldapmodrdn - Win32 Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -39,8 +43,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ldapmodr" -# PROP Intermediate_Dir "ldapmodr" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\ldapmodrdn" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -52,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\SDebug" !ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Single Release" @@ -64,12 +68,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ldapmod0" -# PROP Intermediate_Dir "ldapmod0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\ldapmodrdn" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -77,6 +81,56 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\libraries\SRelease" + +!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldapmod1" +# PROP BASE Intermediate_Dir "ldapmod1" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "Debug\ldapmodrdn" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" + +!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldapmod2" +# PROP BASE Intermediate_Dir "ldapmod2" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "Release\ldapmodrdn" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\libraries\Release" # ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\libraries\Release" !ENDIF @@ -85,6 +139,8 @@ LINK32=link.exe # Name "ldapmodrdn - Win32 Single Debug" # Name "ldapmodrdn - Win32 Single Release" +# Name "ldapmodrdn - Win32 Debug" +# Name "ldapmodrdn - Win32 Release" # Begin Source File SOURCE=.\ldapmodrdn.c diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index fad4c106db3ceb0f63d142c340757122fd2f9c89..4b5ac508a08f5fda2f85e2a76992be01b6ec3368 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -15,13 +15,14 @@ #include "portable.h" -#include <ctype.h> #include <stdio.h> #include <stdlib.h> -#include <sys/time.h> +#include <ac/ctype.h> #include <ac/signal.h> +#include <ac/socket.h> #include <ac/string.h> +#include <ac/time.h> #include <ac/unistd.h> #include <lber.h> @@ -121,20 +122,15 @@ pw_encode (unsigned char *passwd, Salt * salt, unsigned int len) void make_salt (Salt * salt, unsigned int len) { - struct timeval tv; if (!salt) return; - /* seed random number generator */ - gettimeofday (&tv, NULL); - srand (tv.tv_usec); - salt->len = len; salt->salt = (unsigned char *)malloc (len); for (len = 0; len < salt->len; len++) - salt->salt[len] = (tv.tv_usec ^ rand ()) & 0xff; + salt->salt[len] = rand () & 0xff; } /* @@ -561,13 +557,26 @@ main (int argc, char *argv[]) } if ( debug ) { - lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); + ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ); } #ifdef SIGPIPE (void) SIGNAL( SIGPIPE, SIG_IGN ); #endif + /* seed random number generator */ + +#ifdef HAVE_GETTIMEOFDAY + /* this is of questionable value + * gettimeofday not provide much usec + */ + struct timeval tv; + gettimeofday (&tv, NULL); + srand (tv.tv_usec); +#else + /* The traditional seed */ + srand((unsigned)time( NULL )); +#endif /* connect to server */ if ((ld = ldap_init (ldaphost, ldapport)) == NULL) diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index b55c46121d226e58af40ae640b7b362dcf91cef6..315a6ad60dd52a08574bc214e82710dce78f9a9d 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -255,7 +255,7 @@ main( int argc, char **argv ) } if ( debug ) { - lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); + ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ); ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ); ldif_debug = debug; } @@ -406,7 +406,7 @@ static int dosearch( ( *sortattr == '\0' ) ? NULL : sortattr, strcasecmp ); matches = 0; first = 1; - for ( e = ldap_first_entry( ld, res ); e != NULLMSG; + for ( e = ldap_first_entry( ld, res ); e != NULL; e = ldap_next_entry( ld, e ) ) { matches++; if ( !first ) { diff --git a/clients/tools/ldapsearch.dsp b/clients/tools/ldapsearch.dsp index 6eddc3297d24e8001689bc39c7f34c251c75d0ad..4e3a4448ce1878a047f94464aee5e9f5085b9b8f 100644 --- a/clients/tools/ldapsearch.dsp +++ b/clients/tools/ldapsearch.dsp @@ -21,6 +21,10 @@ CFG=ldapsearch - Win32 Single Debug "Win32 (x86) Console Application") !MESSAGE "ldapsearch - Win32 Single Release" (based on\ "Win32 (x86) Console Application") +!MESSAGE "ldapsearch - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldapsearch - Win32 Debug" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -39,8 +43,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ldapsear" -# PROP Intermediate_Dir "ldapsear" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\ldapsearch" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -52,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\SDebug" !ELSEIF "$(CFG)" == "ldapsearch - Win32 Single Release" @@ -64,12 +68,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ldapsea0" -# PROP Intermediate_Dir "ldapsea0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\ldapsearch" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -77,14 +81,66 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\SRelease" + +!ELSEIF "$(CFG)" == "ldapsearch - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldapsea1" +# PROP BASE Intermediate_Dir "ldapsea1" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "Release\ldapsearch" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\SRelease" # ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\Release" +!ELSEIF "$(CFG)" == "ldapsearch - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldapsea2" +# PROP BASE Intermediate_Dir "ldapsea2" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "Debug\ldapsearch" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\SRelease" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\Debug" + !ENDIF # Begin Target # Name "ldapsearch - Win32 Single Debug" # Name "ldapsearch - Win32 Single Release" +# Name "ldapsearch - Win32 Release" +# Name "ldapsearch - Win32 Debug" # Begin Source File SOURCE=.\ldapsearch.c diff --git a/clients/ud/main.c b/clients/ud/main.c index 61de28d4724a9d484f0fdfddca632fd956f9fef6..42395a042ec1f19ec997bf785ee836974c154264 100644 --- a/clients/ud/main.c +++ b/clients/ud/main.c @@ -1,3 +1,7 @@ +/* + * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ /* * Copyright (c) 1991, 1992, 1993 * Regents of the University of Michigan. All rights reserved. @@ -43,18 +47,13 @@ #include <ldapconfig.h> #include "ud.h" -#ifndef lint -char copyright[] = -"@(#) Copyright (c) 1991, 1992, 1993 Regents of the University of Michigan.\nAll rights reserved.\n"; -#endif - /* * Used with change_base() to indicate which base we are changing. */ #define BASE_SEARCH 0 #define BASE_GROUPS 1 -#define iscom(x) (!strncasecmp(x, cmd, strlen(cmd))) +#define iscom(x) (!strncasecmp((x), cmd, strlen(cmd))) static char *server = NULL; static char *config_file = UD_CONFIG_FILE; @@ -83,6 +82,9 @@ int debug; /* debug flag */ #endif int ldebug; /* library debug flag */ +#ifndef HAVE_MKVERSION +char Version[] = "OpenLDAP UserDirectory (ud)"; +#endif int main( int argc, char **argv ) @@ -552,7 +554,7 @@ initialize_client( void ) #endif if (ldebug) { - lber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldebug); + ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldebug); ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldebug); } diff --git a/clients/ud/ud.dsp b/clients/ud/ud.dsp index f8ec50b5cda31e1cc4f8812321eaad2a8c8eb9c3..5b8da9391f13ad40c1850c5f5b90dc10603fdae0 100644 --- a/clients/ud/ud.dsp +++ b/clients/ud/ud.dsp @@ -39,12 +39,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "Release\ud" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -63,12 +63,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "Debug\ud" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -88,8 +88,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ud___Wi0" -# PROP Intermediate_Dir "ud___Wi0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\ud" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -101,7 +101,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" -# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" +# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\SRelease" !ELSEIF "$(CFG)" == "ud - Win32 Single Debug" @@ -113,8 +113,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ud___Wi1" -# PROP Intermediate_Dir "ud___Wi1" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\ud" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -126,7 +126,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" +# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\SDebug" !ENDIF diff --git a/clients/ud/ud.dsw b/clients/ud/ud.dsw index 5350cb77ed05ec0eed2176baee224cd84df81a4e..873331beab59c4900ea1a988787ec7beb0dea343 100644 --- a/clients/ud/ud.dsw +++ b/clients/ud/ud.dsw @@ -27,6 +27,18 @@ Package=<4> ############################################################################### +Project: "libldif"=..\..\libraries\libldif\libldif.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "liblutil"=..\..\libraries\liblutil\liblutil.dsp - Package Owner=<4> Package=<5> @@ -56,6 +68,9 @@ Package=<4> Begin Project Dependency Project_Dep_Name liblutil End Project Dependency + Begin Project Dependency + Project_Dep_Name libldif + End Project Dependency }}} ############################################################################### diff --git a/clients/ud/ud.h b/clients/ud/ud.h index a90765f6e8c6d8f7e14c9b3b6c29a9aab88e2291..4de87a0116adfb52d9b869e2375992c6dfbef601 100644 --- a/clients/ud/ud.h +++ b/clients/ud/ud.h @@ -1,3 +1,12 @@ +/* + * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted only + * as authorized by the OpenLDAP Public License. A copy of this + * license is available at http://www.OpenLDAP.org/license.html or + * in file LICENSE in the top-level directory of the distribution. + */ /* * Copyright (c) 1991, 1992, 1993 * Regents of the University of Michigan. All rights reserved. diff --git a/contrib/saucer/main.c b/contrib/saucer/main.c index 8d866dcd44faee7e9e71c8651ccd063decf41523..59ea5e4d85a2aae88ac944bad3b20cba7189228c 100644 --- a/contrib/saucer/main.c +++ b/contrib/saucer/main.c @@ -613,7 +613,7 @@ int main(int argc, char **argv) case 'd': #ifdef LDAP_DEBUG tmp = atoi(optarg); - lber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &tmp); + ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &tmp); ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &tmp); #endif break; diff --git a/include/ac/assert.h b/include/ac/assert.h index 7a9044dab04665d96ef496615b3f2151ff80c0d5..a65e1c0cc2abbc07d83b83126acc6a68414cbb45 100644 --- a/include/ac/assert.h +++ b/include/ac/assert.h @@ -25,11 +25,11 @@ * create a replacement and hope it works */ -void lber_pvt_assert(char* file, int line, char* test); +void ber_pvt_assert(char* file, int line, char* test); #define assert(test) \ ((test) \ ? (void)0 \ - : lber_pvt_assert( __FILE__, __LINE__, LDAP_STRING(test)) ) + : ber_pvt_assert( __FILE__, __LINE__, LDAP_STRING(test)) ) #endif diff --git a/include/ac/socket.h b/include/ac/socket.h index 8fd3dce772b12ff84a4b86fb91e42d2a7a1c8611..d0767631467726cd511ac38668daf8383a063364 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -104,4 +104,9 @@ #endif /* __alpha && !VMS */ + +#if defined( WSAEWOULDBLOCK ) +#define EWOULDBLOCK WSAEWOULDBLOCK +#endif + #endif /* _AC_SOCKET_H_ */ diff --git a/include/ac/time.h b/include/ac/time.h index 3da6ddfe07728777941cfc3835b08f04d87abceb..e1d6dc3836fbaeda902c86271eb001ced01783ac 100644 --- a/include/ac/time.h +++ b/include/ac/time.h @@ -17,13 +17,11 @@ # include <time.h> #elif HAVE_SYS_TIME_H # include <sys/time.h> +# ifdef HAVE_SYS_TIMEB_H +# include <sys/timeb.h> +# endif #else # include <time.h> #endif -#ifdef WIN32 -#include <sys/types.h> -#include <sys/timeb.h> -#endif - #endif /* _AC_TIME_H */ diff --git a/include/avl.h b/include/avl.h index 2f8ad2124dfc98c88b7ded39c2bfd28ebdc85dd3..757931c9b59567740451b373a72ea6a97099faa5 100644 --- a/include/avl.h +++ b/include/avl.h @@ -55,43 +55,43 @@ typedef int (*AVL_CMP) LDAP_P((void*, void*)); typedef int (*AVL_DUP) LDAP_P((void*, void*)); typedef void (*AVL_FREE) LDAP_P((void*)); -LDAP_F int +LDAP_F( int ) avl_free LDAP_P(( Avlnode *root, AVL_FREE dfree )); -LDAP_F int +LDAP_F( int ) avl_insert LDAP_P((Avlnode **, void*, AVL_CMP, AVL_DUP)); -LDAP_F void* +LDAP_F( void* ) avl_delete LDAP_P((Avlnode **, void*, AVL_CMP)); -LDAP_F void* +LDAP_F( void* ) avl_find LDAP_P((Avlnode *, void*, AVL_CMP)); -LDAP_F void* +LDAP_F( void* ) avl_find_lin LDAP_P((Avlnode *, void*, AVL_CMP)); -LDAP_F void* +LDAP_F( void* ) avl_getfirst LDAP_P((Avlnode *)); #ifdef AVL_REENTRANT /* ??? avl.c does not provide this version ??? */ -LDAP_F void* +LDAP_F( void* ) avl_getnext LDAP_P((Avlnode *, void* )); #else -LDAP_F void* +LDAP_F( void* ) avl_getnext LDAP_P((void)); #endif -LDAP_F int +LDAP_F( int ) avl_dup_error LDAP_P((void*, void*)); -LDAP_F int +LDAP_F( int ) avl_dup_ok LDAP_P((void*, void*)); -LDAP_F int +LDAP_F( int ) avl_apply LDAP_P((Avlnode *, AVL_APPLY, void*, int, int)); -LDAP_F int +LDAP_F( int ) avl_prefixapply LDAP_P((Avlnode *, void*, AVL_CMP, void*, AVL_CMP, void*, int)); /* apply traversal types */ diff --git a/include/disptmpl.h b/include/disptmpl.h index 1ab3449b1b2dfdbaf7b517f4666b2bd12cbf6e86..f5fc9e80a5091d8725b92989791002eed5372dc6 100644 --- a/include/disptmpl.h +++ b/include/disptmpl.h @@ -231,88 +231,88 @@ struct ldap_disptmpl { typedef int (*writeptype) LDAP_P(( void *writeparm, char *p, int len )); -LDAP_F int +LDAP_F( int ) ldap_init_templates LDAP_P(( char *file, struct ldap_disptmpl **tmpllistp )); -LDAP_F int +LDAP_F( int ) ldap_init_templates_buf LDAP_P(( char *buf, long buflen, struct ldap_disptmpl **tmpllistp )); -LDAP_F void +LDAP_F( void ) ldap_free_templates LDAP_P(( struct ldap_disptmpl *tmpllist )); -LDAP_F struct ldap_disptmpl * +LDAP_F( struct ldap_disptmpl * ) ldap_first_disptmpl LDAP_P(( struct ldap_disptmpl *tmpllist )); -LDAP_F struct ldap_disptmpl * +LDAP_F( struct ldap_disptmpl * ) ldap_next_disptmpl LDAP_P(( struct ldap_disptmpl *tmpllist, struct ldap_disptmpl *tmpl )); -LDAP_F struct ldap_disptmpl * +LDAP_F( struct ldap_disptmpl * ) ldap_name2template LDAP_P(( char *name, struct ldap_disptmpl *tmpllist )); -LDAP_F struct ldap_disptmpl * +LDAP_F( struct ldap_disptmpl * ) ldap_oc2template LDAP_P(( char **oclist, struct ldap_disptmpl *tmpllist )); -LDAP_F char ** +LDAP_F( char ** ) ldap_tmplattrs LDAP_P(( struct ldap_disptmpl *tmpl, char **includeattrs, int exclude, unsigned long syntaxmask )); -LDAP_F struct ldap_tmplitem * +LDAP_F( struct ldap_tmplitem * ) ldap_first_tmplrow LDAP_P(( struct ldap_disptmpl *tmpl )); -LDAP_F struct ldap_tmplitem * +LDAP_F( struct ldap_tmplitem * ) ldap_next_tmplrow LDAP_P(( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row )); -LDAP_F struct ldap_tmplitem * +LDAP_F( struct ldap_tmplitem * ) ldap_first_tmplcol LDAP_P(( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row )); -LDAP_F struct ldap_tmplitem * +LDAP_F( struct ldap_tmplitem * ) ldap_next_tmplcol LDAP_P(( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row, struct ldap_tmplitem *col )); -LDAP_F int +LDAP_F( int ) ldap_entry2text LDAP_P(( LDAP *ld, char *buf, LDAPMessage *entry, struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, writeptype writeproc, void *writeparm, char *eol, int rdncount, unsigned long opts )); -LDAP_F int +LDAP_F( int ) ldap_vals2text LDAP_P(( LDAP *ld, char *buf, char **vals, char *label, int labelwidth, unsigned long syntaxid, writeptype writeproc, void *writeparm, char *eol, int rdncount )); -LDAP_F int +LDAP_F( int ) ldap_entry2text_search LDAP_P(( LDAP *ld, char *dn, char *base, LDAPMessage *entry, struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, writeptype writeproc, void *writeparm, char *eol, int rdncount, unsigned long opts )); -LDAP_F int +LDAP_F( int ) ldap_entry2html LDAP_P(( LDAP *ld, char *buf, LDAPMessage *entry, struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals, writeptype writeproc, void *writeparm, char *eol, int rdncount, unsigned long opts, char *urlprefix, char *base )); -LDAP_F int +LDAP_F( int ) ldap_vals2html LDAP_P(( LDAP *ld, char *buf, char **vals, char *label, int labelwidth, unsigned long syntaxid, writeptype writeproc, void *writeparm, char *eol, int rdncount, char *urlprefix )); -LDAP_F int +LDAP_F( int ) ldap_entry2html_search LDAP_P(( LDAP *ld, char *dn, char *base, LDAPMessage *entry, struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals, diff --git a/include/getopt-compat.h b/include/getopt-compat.h index 438eb533880098b86d6c447371b3e033df5a736e..f155719f9b43deee76e84d8a0c9666666f3cea60 100644 --- a/include/getopt-compat.h +++ b/include/getopt-compat.h @@ -20,7 +20,11 @@ LDAP_BEGIN_DECL extern char *optarg; extern int optind, opterr, optopt; -LDAP_F int getopt LDAP_P((int, char * const [], const char *)); +LDAP_F( int ) +getopt LDAP_P(( + int, + char * const [], + const char *)); LDAP_END_DECL diff --git a/include/lber.h b/include/lber.h index bf939f90b31a44449621c6106830f797745cb657..64664fbccadbde9ef872074a84db98169972b928 100644 --- a/include/lber.h +++ b/include/lber.h @@ -26,20 +26,37 @@ LDAP_BEGIN_DECL +/* Overview of LBER tag construction + * + * Bits + * ______ + * 8 7 | CLASS + * 0 0 = UNIVERSAL + * 0 1 = APPLICATION + * 1 0 = CONTEXT-SPECIFIC + * 1 1 = PRIVATE + * _____ + * | 6 | DATA-TYPE + * 0 = PRIMITIVE + * 1 = CONSTRUCTED + * ___________ + * | 5 ... 1 | TAG-NUMBER + */ + /* BER classes and mask */ -#define LBER_CLASS_UNIVERSAL 0x00 -#define LBER_CLASS_APPLICATION 0x40 -#define LBER_CLASS_CONTEXT 0x80 -#define LBER_CLASS_PRIVATE 0xc0 -#define LBER_CLASS_MASK 0xc0 +#define LBER_CLASS_UNIVERSAL 0x00UL +#define LBER_CLASS_APPLICATION 0x40UL +#define LBER_CLASS_CONTEXT 0x80UL +#define LBER_CLASS_PRIVATE 0xc0UL +#define LBER_CLASS_MASK 0xc0UL /* BER encoding type and mask */ -#define LBER_PRIMITIVE 0x00 -#define LBER_CONSTRUCTED 0x20 -#define LBER_ENCODING_MASK 0x20 +#define LBER_PRIMITIVE 0x00UL +#define LBER_CONSTRUCTED 0x20UL +#define LBER_ENCODING_MASK 0x20UL -#define LBER_BIG_TAG_MASK 0x1f -#define LBER_MORE_TAG_MASK 0x80 +#define LBER_BIG_TAG_MASK 0x1fUL +#define LBER_MORE_TAG_MASK 0x80UL /* * Note that LBER_ERROR and LBER_DEFAULT are values that can never appear @@ -47,24 +64,26 @@ LDAP_BEGIN_DECL * fact, any tag for which the following is true is invalid: * (( tag & 0x00000080 ) != 0 ) && (( tag & 0xFFFFFF00 ) != 0 ) */ -#define LBER_ERROR 0xffffffffL -#define LBER_DEFAULT 0xffffffffL -/* #define LBER_END_SEQORSET 0xfffffffeL *//* no part of LDAP C-API */ +#define LBER_INVALID(tag) ( ( (tag) & 0xFFFFFF80UL ) != 0 ) +#define LBER_ERROR 0xffffffffUL +#define LBER_DEFAULT 0xffffffffUL +/* #define LBER_END_SEQORSET 0xfffffffeUL *//* no part of LDAP C-API */ /* general BER types we know about */ -#define LBER_BOOLEAN 0x01L -#define LBER_INTEGER 0x02L -#define LBER_BITSTRING 0x03L -#define LBER_OCTETSTRING 0x04L -#define LBER_NULL 0x05L -#define LBER_ENUMERATED 0x0aL -#define LBER_SEQUENCE 0x30L /* constructed */ -#define LBER_SET 0x31L /* constructed */ - -#define OLD_LBER_SEQUENCE 0x10L /* w/o constructed bit - broken */ -#define OLD_LBER_SET 0x11L /* w/o constructed bit - broken */ - -typedef int (*BERTranslateProc) LDAP_P(( char **bufp, +#define LBER_BOOLEAN 0x01UL +#define LBER_INTEGER 0x02UL +#define LBER_BITSTRING 0x03UL +#define LBER_OCTETSTRING 0x04UL +#define LBER_NULL 0x05UL +#define LBER_ENUMERATED 0x0aUL +#define LBER_SEQUENCE 0x30UL /* constructed */ +#define LBER_SET 0x31UL /* constructed */ + +#define OLD_LBER_SEQUENCE 0x10UL /* w/o constructed bit - broken */ +#define OLD_LBER_SET 0x11UL /* w/o constructed bit - broken */ + +typedef int (*BERTranslateProc) LDAP_P(( + char **bufp, unsigned long *buflenp, int free_input )); @@ -101,114 +120,311 @@ typedef void (*BER_LOG_PRINT_FN) LDAP_P(( char *buf )); #define LBER_OPT_ERROR (-1) typedef struct berelement BerElement; -#define NULLBER ((BerElement *) 0) - typedef struct sockbuf Sockbuf; - typedef struct seqorset Seqorset; -#define NULLSEQORSET ((Seqorset *) 0) /* structure for returning a sequence of octet strings + length */ -struct berval { +typedef struct berval { unsigned long bv_len; char *bv_val; -}; +} BerValue; /* * in bprint.c: */ -LDAP_F void ber_print_error LDAP_P(( char *data )); -LDAP_F void ber_bprint LDAP_P(( char *data, int len )); -#define lber_bprint(d,l) ber_bprint((d),(l)) +LDAP_F( void ) +ber_print_error LDAP_P(( + LDAP_CONST char *data )); -LDAP_F void ber_dump LDAP_P(( BerElement *ber, int inout )); -LDAP_F void ber_sos_dump LDAP_P(( Seqorset *sos )); +LDAP_F( void ) +ber_bprint LDAP_P(( + LDAP_CONST char *data, int len )); + +LDAP_F( void ) +ber_dump LDAP_P(( + LDAP_CONST BerElement *ber, int inout )); + +LDAP_F( void ) +ber_sos_dump LDAP_P(( + LDAP_CONST Seqorset *sos )); /* * in decode.c: */ -LDAP_F unsigned long ber_get_tag LDAP_P(( BerElement *ber )); -LDAP_F unsigned long ber_skip_tag LDAP_P(( BerElement *ber, unsigned long *len )); -LDAP_F unsigned long ber_peek_tag LDAP_P(( BerElement *ber, unsigned long *len )); -LDAP_F unsigned long ber_get_int LDAP_P(( BerElement *ber, long *num )); -LDAP_F unsigned long ber_get_stringb LDAP_P(( BerElement *ber, char *buf, +typedef int (*BERDecodeCallback) LDAP_P(( + BerElement *ber, + void *data, + int mode )); + +LDAP_F( unsigned long ) +ber_get_tag LDAP_P(( + BerElement *ber )); + +LDAP_F( unsigned long ) +ber_skip_tag LDAP_P(( + BerElement *ber, + unsigned long *len )); + +LDAP_F( unsigned long ) +ber_peek_tag LDAP_P(( + LDAP_CONST BerElement *ber, /* not const in c-api-02 */ unsigned long *len )); -LDAP_F unsigned long ber_get_stringa LDAP_P(( BerElement *ber, char **buf )); -LDAP_F unsigned long ber_get_stringal LDAP_P(( BerElement *ber, struct berval **bv )); -LDAP_F unsigned long ber_get_bitstringa LDAP_P(( BerElement *ber, char **buf, + +LDAP_F( unsigned long ) +ber_get_int LDAP_P(( + BerElement *ber, + long *num )); + +LDAP_F( unsigned long ) +ber_get_stringb LDAP_P(( + BerElement *ber, + char *buf, unsigned long *len )); -LDAP_F unsigned long ber_get_null LDAP_P(( BerElement *ber )); -LDAP_F unsigned long ber_get_boolean LDAP_P(( BerElement *ber, int *boolval )); -LDAP_F unsigned long ber_first_element LDAP_P(( BerElement *ber, unsigned long *len, + +LDAP_F( unsigned long ) +ber_get_stringa LDAP_P(( + BerElement *ber, char **buf )); + +LDAP_F( unsigned long ) +ber_get_stringal LDAP_P(( + BerElement *ber, + struct berval **bv )); + +LDAP_F( unsigned long ) +ber_get_bitstringa LDAP_P(( + BerElement *ber, + char **buf, + unsigned long *len )); + +LDAP_F( unsigned long ) +ber_get_null LDAP_P(( + BerElement *ber )); + +LDAP_F( unsigned long ) +ber_get_boolean LDAP_P(( + BerElement *ber, + int *boolval )); + +LDAP_F( unsigned long ) +ber_first_element LDAP_P(( + BerElement *ber, + unsigned long *len, char **last )); -LDAP_F unsigned long ber_next_element LDAP_P(( BerElement *ber, unsigned long *len, + +LDAP_F( unsigned long ) +ber_next_element LDAP_P(( + BerElement *ber, + unsigned long *len, char *last )); -LDAP_F unsigned long ber_scanf LDAP_P(( BerElement *ber, char *fmt, ... )); -LDAP_F void ber_bvfree LDAP_P(( struct berval *bv )); -LDAP_F void ber_bvecfree LDAP_P(( struct berval **bv )); -LDAP_F struct berval *ber_bvdup LDAP_P(( struct berval *bv )); -LDAP_F void ber_set_string_translators LDAP_P(( BerElement *ber, - BERTranslateProc encode_proc, BERTranslateProc decode_proc )); + +LDAP_F( unsigned long ) +ber_scanf LDAP_P(( + BerElement *ber, + LDAP_CONST char *fmt, + ... )); + +LDAP_F( void ) +ber_bvfree LDAP_P(( + struct berval *bv )); + +LDAP_F( void ) +ber_bvecfree LDAP_P(( + struct berval **bv )); + +LDAP_F( struct berval * ) +ber_bvdup LDAP_P(( + LDAP_CONST struct berval *bv )); + +LDAP_F( void ) +ber_set_string_translators LDAP_P(( + BerElement *ber, + BERTranslateProc encode_proc, + BERTranslateProc decode_proc )); /* * in encode.c */ -LDAP_F int ber_put_enum LDAP_P(( BerElement *ber, long num, unsigned long tag )); -LDAP_F int ber_put_int LDAP_P(( BerElement *ber, long num, unsigned long tag )); -LDAP_F int ber_put_ostring LDAP_P(( BerElement *ber, char *str, unsigned long len, +typedef int (*BEREncodeCallback) LDAP_P(( + BerElement *ber, + void *data )); + +LDAP_F( int ) +ber_put_enum LDAP_P(( + BerElement *ber, + long num, + unsigned long tag )); + +LDAP_F( int ) +ber_put_int LDAP_P(( + BerElement *ber, + long num, + unsigned long tag )); + +LDAP_F( int ) +ber_put_ostring LDAP_P(( + BerElement *ber, + LDAP_CONST char *str, + unsigned long len, + unsigned long tag )); + +LDAP_F( int ) +ber_put_berval LDAP_P(( + BerElement *ber, + LDAP_CONST struct berval *bv, unsigned long tag )); -LDAP_F int ber_put_string LDAP_P(( BerElement *ber, char *str, unsigned long tag )); -LDAP_F int ber_put_bitstring LDAP_P(( BerElement *ber, char *str, - unsigned long bitlen, unsigned long tag )); -LDAP_F int ber_put_null LDAP_P(( BerElement *ber, unsigned long tag )); -LDAP_F int ber_put_boolean LDAP_P(( BerElement *ber, int boolval, + +LDAP_F( int ) +ber_put_string LDAP_P(( + BerElement *ber, + LDAP_CONST char *str, unsigned long tag )); -LDAP_F int ber_start_seq LDAP_P(( BerElement *ber, unsigned long tag )); -LDAP_F int ber_start_set LDAP_P(( BerElement *ber, unsigned long tag )); -LDAP_F int ber_put_seq LDAP_P(( BerElement *ber )); -LDAP_F int ber_put_set LDAP_P(( BerElement *ber )); -LDAP_F int ber_printf LDAP_P(( BerElement *ber, char *fmt, ... )); + +LDAP_F( int ) +ber_put_bitstring LDAP_P(( + BerElement *ber, + LDAP_CONST char *str, + unsigned long bitlen, + unsigned long tag )); + +LDAP_F( int ) +ber_put_null LDAP_P(( + BerElement *ber, + unsigned long tag )); + +LDAP_F( int ) +ber_put_boolean LDAP_P(( + BerElement *ber, + int boolval, + unsigned long tag )); + +LDAP_F( int ) +ber_start_seq LDAP_P(( + BerElement *ber, + unsigned long tag )); + +LDAP_F( int ) +ber_start_set LDAP_P(( + BerElement *ber, + unsigned long tag )); + +LDAP_F( int ) +ber_put_seq LDAP_P(( + BerElement *ber )); + +LDAP_F( int ) +ber_put_set LDAP_P(( + BerElement *ber )); + +LDAP_F( int ) +ber_printf LDAP_P(( + BerElement *ber, + LDAP_CONST char *fmt, + ... )); /* * in io.c: */ -LDAP_F long ber_read LDAP_P(( BerElement *ber, char *buf, unsigned long len )); -LDAP_F long ber_write LDAP_P(( BerElement *ber, char *buf, unsigned long len, +LDAP_F( long ) +ber_read LDAP_P(( + BerElement *ber, + char *buf, + unsigned long len )); + +LDAP_F( long ) +ber_write LDAP_P(( + BerElement *ber, + LDAP_CONST char *buf, + unsigned long len, int nosos )); -LDAP_F void ber_free LDAP_P(( BerElement *ber, int freebuf )); -LDAP_F void ber_clear LDAP_P(( BerElement *ber, int freebuf )); -LDAP_F int ber_flush LDAP_P(( Sockbuf *sb, BerElement *ber, int freeit )); -LDAP_F BerElement *ber_alloc LDAP_P(( void )); -LDAP_F BerElement *der_alloc LDAP_P(( void )); -LDAP_F BerElement *ber_alloc_t LDAP_P(( int options )); -LDAP_F BerElement *ber_dup LDAP_P(( BerElement *ber )); -LDAP_F unsigned long ber_get_next LDAP_P(( Sockbuf *sb, unsigned long *len, + +LDAP_F( void ) +ber_free LDAP_P(( + BerElement *ber, + int freebuf )); + +LDAP_F( void ) +ber_clear LDAP_P(( + BerElement *ber, + int freebuf )); + +LDAP_F( int ) +ber_flush LDAP_P(( + Sockbuf *sb, BerElement *ber, int freeit )); + +LDAP_F( BerElement * ) +ber_alloc LDAP_P(( void )); /* DEPRECATED */ + +LDAP_F( BerElement * ) +der_alloc LDAP_P(( void )); /* DEPRECATED */ + +LDAP_F( BerElement * ) +ber_alloc_t LDAP_P(( + int options )); + +LDAP_F( BerElement * ) +ber_dup LDAP_P(( + LDAP_CONST BerElement *ber )); + +LDAP_F( unsigned long ) +ber_get_next LDAP_P(( + Sockbuf *sb, + unsigned long *len, BerElement *ber )); -LDAP_F void ber_init_w_nullc LDAP_P(( BerElement *ber, int options )); -LDAP_F void ber_reset LDAP_P(( BerElement *ber, int was_writing )); + +LDAP_F( void ) +ber_init_w_nullc LDAP_P(( + BerElement *ber, + int options )); + +LDAP_F( void ) +ber_reset LDAP_P(( + BerElement *ber, + int was_writing )); /* * LBER draft-ietf-ldapext-ldap-c-api-01 routines */ -LDAP_F BerElement *ber_init LDAP_P(( struct berval *bv )); -LDAP_F int ber_flatten LDAP_P(( BerElement *ber, struct berval **bvPtr )); +LDAP_F( BerElement * ) +ber_init LDAP_P(( + struct berval *bv )); + +LDAP_F( int ) +ber_flatten LDAP_P(( + LDAP_CONST BerElement *ber, + struct berval **bvPtr )); /* * LBER ber accessor functions */ -LDAP_F int -lber_get_option LDAP_P((void *item, int option, void *outvalue)); -LDAP_F int -lber_set_option LDAP_P((void *item, int option, void *invalue)); +LDAP_F( int ) +ber_get_option LDAP_P(( + void *item, + int option, + void *outvalue)); + +LDAP_F( int ) +ber_set_option LDAP_P(( + void *item, + int option, + LDAP_CONST void *invalue)); /* - * LBER Sockbuf functions + * LBER sockbuf.c */ -LDAP_F Sockbuf *lber_pvt_sk_alloc LDAP_P((void)); -LDAP_F Sockbuf *lber_pvt_sb_alloc_fd LDAP_P((int fd)); -LDAP_F void lber_pvt_sb_free LDAP_P((Sockbuf *sb)); + +LDAP_F( Sockbuf * ) +ber_sockbuf_alloc( void ); + +LDAP_F( Sockbuf * ) +ber_sockbuf_alloc_fd( + int fd ); + +LDAP_F( void ) +ber_sockbuf_free( + Sockbuf *sb ); + LDAP_END_DECL diff --git a/include/lber_pvt.h b/include/lber_pvt.h index fc8091e0aa6376aebf42f7f67c85d407e8f8414f..c083d9fee7d4985e2fd264d8cc04e28bb2ad9763 100644 --- a/include/lber_pvt.h +++ b/include/lber_pvt.h @@ -8,7 +8,7 @@ * in file LICENSE in the top-level directory of the distribution. */ /* - * lber_pvt.h - Header for lber_pvt_ functions. These are meant to be used + * lber_pvt.h - Header for ber_pvt_ functions. These are meant to be used * by the OpenLDAP distribution only. */ @@ -22,12 +22,13 @@ LDAP_BEGIN_DECL /* * bprint.c */ -extern BER_LOG_PRINT_FN lber_pvt_log_print; +extern BER_LOG_PRINT_FN ber_pvt_log_print; -LDAP_F int lber_pvt_log_printf LDAP_P(( +LDAP_F( int ) +ber_pvt_log_printf LDAP_P(( int errlvl, int loglvl, - char *fmt, + const char *fmt, ... )); LDAP_END_DECL diff --git a/include/ldap.h b/include/ldap.h index 4102153162d9feeed5d0cd1b0ab210ff65650651..71ef37c176a08578349c5c8c0bfb9e4d9e969e1a 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -39,13 +39,13 @@ LDAP_BEGIN_DECL * As such, the number will be above the old RFC but below * whatever number does finally get assigned */ -#define LDAP_API_VERSION 2001 +#define LDAP_API_VERSION 2002 #define LDAP_VENDOR_NAME "OpenLDAP" /* We'll eventually release as 200 */ -#define LDAP_VENDOR_VERSION 190 +#define LDAP_VENDOR_VERSION 192 /* OpenLDAP API Features */ -#define LDAP_API_FEATURE_X_OPENLDAP 1 +#define LDAP_API_FEATURE_X_OPENLDAP LDAP_VENDOR_VERSION /* include LDAP_API_FEATURE defines */ #include <ldap_features.h> @@ -63,13 +63,6 @@ LDAP_BEGIN_DECL /* #define LDAP_API_OPERATION_SESSION_SAFE 1 */ #endif -#define LDAP_API_FEATURE_INFO 1 - -typedef struct ldap_apifeature_info { - char* ldapaif_name; /* matches LDAP_API_FEATURE_... less the prefix */ - int ldapaif_version; /* matches the value LDAP_API_FEATURE_... */ -} LDAPAPIFeatureInfo; - #define LDAP_PORT 389 #define LDAP_ROOT_DSE "" @@ -82,7 +75,7 @@ typedef struct ldap_apifeature_info { #define LDAP_COMPAT #endif -/* LDAP_OPTions defined by draft-ldapext-ldap-c-api-01 */ +/* LDAP_OPTions defined by draft-ldapext-ldap-c-api-02 */ #define LDAP_OPT_API_INFO 0x0000 #define LDAP_OPT_DESC 0x0001 #define LDAP_OPT_DEREF 0x0002 @@ -95,14 +88,14 @@ typedef struct ldap_apifeature_info { #define LDAP_OPT_PROTOCOL_VERSION 0x0011 #define LDAP_OPT_SERVER_CONTROLS 0x0012 #define LDAP_OPT_CLIENT_CONTROLS 0x0013 -/* 0x14 - 0x2f not defined by current draft */ +/* 0x14 not defined by current draft */ +#define LDAP_OPT_API_FEATURE_INFO 0x0015 + +/* 0x16 - 0x2f not defined by current draft */ #define LDAP_OPT_HOST_NAME 0x0030 #define LDAP_OPT_ERROR_NUMBER 0x0031 #define LDAP_OPT_ERROR_STRING 0x0032 -/* LDAP_OPTions under IETF discussion */ -#define LDAP_OPT_API_FEATURE_INFO 0x0100 - /* not defined by current draft */ /* for LDAPv2 compatibility */ #define LDAP_OPT_DNS 0x1001 /* use DN & DNS */ @@ -127,8 +120,15 @@ typedef struct ldapapiinfo { int ldapai_vendor_version; /* supplier-specific version * 100 */ } LDAPAPIInfo; +#define LDAP_FEATURE_INFO_VERSION 1 /* version of api feature structure */ +typedef struct ldap_apifeature_info { + int ldapaif_info_version; /* version of this struct (1) */ + char* ldapaif_name; /* matches LDAP_API_FEATURE_... less the prefix */ + int ldapaif_version; /* matches the value LDAP_API_FEATURE_... */ +} LDAPAPIFeatureInfo; + typedef struct ldapcontrol { - char *ldctl_oid; + char * ldctl_oid; struct berval ldctl_value; char ldctl_iscritical; } LDAPControl, *PLDAPControl; @@ -139,170 +139,175 @@ typedef struct ldapcontrol { * specific LDAP instantiations of BER types we know about */ -/* general stuff */ -#define LDAP_TAG_MESSAGE 0x30L /* tag is 16 + constructed bit */ -#define OLD_LDAP_TAG_MESSAGE 0x10L /* forgot the constructed bit */ -#define LDAP_TAG_MSGID 0x02L -/* need to add other LDAP_TAGs here */ - -/* Overview of tag construction in ASN.1: - * _______ - * Bit # | 8 7 | CLASS: UNIVERSAL 00 - * APPLICATION 01 - * CONTEXT-SPECIFIC 10 - * PRIVATE 11 +/* Overview of LBER tag construction + * + * Bits + * ______ + * 8 7 | CLASS + * 0 0 = UNIVERSAL + * 0 1 = APPLICATION + * 1 0 = CONTEXT-SPECIFIC + * 1 1 = PRIVATE * _____ - * | 6 | DATA-TYPE: PRIMITIVE 0 - * CONSTRUCTED 1 - * ___________ - * | 5 ... 1 | TAG-NUMBER + * | 6 | DATA-TYPE + * 0 = PRIMITIVE + * 1 = CONSTRUCTED + * ___________ + * | 5 ... 1 | TAG-NUMBER */ - -#define LDAP_TAG_NEWSUPERIOR 0x80L /* context-specific + primitive + - * tag # ==> [0] - */ + +/* general stuff */ +#define LDAP_TAG_MESSAGE 0x30UL /* constructed + 16 */ +#define OLD_LDAP_TAG_MESSAGE 0x10UL /* forgot the constructed bit */ +#define LDAP_TAG_MSGID 0x02UL /* integer */ +#define LDAP_TAG_LDAPDN 0x04UL /* octect string */ +#define LDAP_TAG_CONTROLS 0xa0UL /* context specific + constructed + 0 */ +#define LDAP_TAG_REFERRAL 0xa3UL /* context specific + constructed + 3 */ +#define LDAP_TAG_NEWSUPERIOR 0x80UL /* context-specific + primitive + 0 */ + +#define LDAP_TAG_SASL_RES_CREDS 0x87UL /* context specific + primitive */ /* possible operations a client can invoke */ -#define LDAP_REQ_BIND 0x60L /* application + constructed */ -#define LDAP_REQ_UNBIND 0x42L /* application + primitive */ -#define LDAP_REQ_SEARCH 0x63L /* application + constructed */ -#define LDAP_REQ_MODIFY 0x66L /* application + constructed */ -#define LDAP_REQ_ADD 0x68L /* application + constructed */ -#define LDAP_REQ_DELETE 0x4aL /* application + primitive */ -#define LDAP_REQ_MODRDN 0x6cL /* application + constructed */ +#define LDAP_REQ_BIND 0x60UL /* application + constructed */ +#define LDAP_REQ_UNBIND 0x42UL /* application + primitive */ +#define LDAP_REQ_SEARCH 0x63UL /* application + constructed */ +#define LDAP_REQ_MODIFY 0x66UL /* application + constructed */ +#define LDAP_REQ_ADD 0x68UL /* application + constructed */ +#define LDAP_REQ_DELETE 0x4aUL /* application + primitive */ +#define LDAP_REQ_MODRDN 0x6cUL /* application + constructed */ #define LDAP_REQ_MODDN LDAP_REQ_MODRDN #define LDAP_REQ_RENAME LDAP_REQ_MODRDN -#define LDAP_REQ_COMPARE 0x6eL /* application + constructed */ -#define LDAP_REQ_ABANDON 0x50L /* application + primitive */ -#define LDAP_REQ_EXTENDED 0x77L /* application + constructed */ +#define LDAP_REQ_COMPARE 0x6eUL /* application + constructed */ +#define LDAP_REQ_ABANDON 0x50UL /* application + primitive */ +#define LDAP_REQ_EXTENDED 0x77UL /* application + constructed */ /* U-Mich version 3.0 compatibility stuff */ -#define LDAP_REQ_UNBIND_30 0x62L -#define LDAP_REQ_DELETE_30 0x6aL -#define LDAP_REQ_ABANDON_30 0x70L +#define LDAP_REQ_UNBIND_30 0x62UL +#define LDAP_REQ_DELETE_30 0x6aUL +#define LDAP_REQ_ABANDON_30 0x70UL /* * old broken stuff for backwards compatibility - forgot application tag * and constructed/primitive bit */ -#define OLD_LDAP_REQ_BIND 0x00L -#define OLD_LDAP_REQ_UNBIND 0x02L -#define OLD_LDAP_REQ_SEARCH 0x03L -#define OLD_LDAP_REQ_MODIFY 0x06L -#define OLD_LDAP_REQ_ADD 0x08L -#define OLD_LDAP_REQ_DELETE 0x0aL -#define OLD_LDAP_REQ_MODRDN 0x0cL -#define OLD_LDAP_REQ_COMPARE 0x0eL -#define OLD_LDAP_REQ_ABANDON 0x10L +#define OLD_LDAP_REQ_BIND 0x00UL +#define OLD_LDAP_REQ_UNBIND 0x02UL +#define OLD_LDAP_REQ_SEARCH 0x03UL +#define OLD_LDAP_REQ_MODIFY 0x06UL +#define OLD_LDAP_REQ_ADD 0x08UL +#define OLD_LDAP_REQ_DELETE 0x0aUL +#define OLD_LDAP_REQ_MODRDN 0x0cUL +#define OLD_LDAP_REQ_COMPARE 0x0eUL +#define OLD_LDAP_REQ_ABANDON 0x10UL /* possible result types a server can return */ -#define LDAP_RES_BIND 0x61L /* application + constructed */ -#define LDAP_RES_SEARCH_ENTRY 0x64L /* application + constructed */ -#define LDAP_RES_SEARCH_REFERENCE 0x73L /* V3: application + constructed */ -#define LDAP_RES_SEARCH_RESULT 0x65L /* application + constructed */ -#define LDAP_RES_MODIFY 0x67L /* application + constructed */ -#define LDAP_RES_ADD 0x69L /* application + constructed */ -#define LDAP_RES_DELETE 0x6bL /* application + constructed */ -#define LDAP_RES_MODRDN 0x6dL /* application + constructed */ +#define LDAP_RES_BIND 0x61UL /* application + constructed */ +#define LDAP_RES_SEARCH_ENTRY 0x64UL /* application + constructed */ +#define LDAP_RES_SEARCH_REFERENCE 0x73UL /* V3: application + constructed */ +#define LDAP_RES_SEARCH_RESULT 0x65UL /* application + constructed */ +#define LDAP_RES_MODIFY 0x67UL /* application + constructed */ +#define LDAP_RES_ADD 0x69UL /* application + constructed */ +#define LDAP_RES_DELETE 0x6bUL /* application + constructed */ +#define LDAP_RES_MODRDN 0x6dUL /* application + constructed */ #define LDAP_RES_MODDN LDAP_RES_MODRDN /* application + constructed */ #define LDAP_RES_RENAME LDAP_RES_MODRDN /* application + constructed */ -#define LDAP_RES_COMPARE 0x6fL /* application + constructed */ -#define LDAP_RES_EXTENDED 0x78L /* V3: application + constructed */ -#define LDAP_RES_ANY (-1L) +#define LDAP_RES_COMPARE 0x6fUL /* application + constructed */ +#define LDAP_RES_EXTENDED 0x78UL /* V3: application + constructed */ +#define LDAP_RES_ANY ((unsigned long)(-1)) /* old broken stuff for backwards compatibility */ -#define OLD_LDAP_RES_BIND 0x01L -#define OLD_LDAP_RES_SEARCH_ENTRY 0x04L -#define OLD_LDAP_RES_SEARCH_RESULT 0x05L -#define OLD_LDAP_RES_MODIFY 0x07L -#define OLD_LDAP_RES_ADD 0x09L -#define OLD_LDAP_RES_DELETE 0x0bL -#define OLD_LDAP_RES_MODRDN 0x0dL +#define OLD_LDAP_RES_BIND 0x01UL +#define OLD_LDAP_RES_SEARCH_ENTRY 0x04UL +#define OLD_LDAP_RES_SEARCH_RESULT 0x05UL +#define OLD_LDAP_RES_MODIFY 0x07UL +#define OLD_LDAP_RES_ADD 0x09UL +#define OLD_LDAP_RES_DELETE 0x0bUL +#define OLD_LDAP_RES_MODRDN 0x0dUL #define OLD_LDAP_RES_MODDN OLD_LDAP_RES_MODRDN -#define OLD_LDAP_RES_COMPARE 0x0fL +#define OLD_LDAP_RES_COMPARE 0x0fUL /* sasl methods */ #define LDAP_SASL_SIMPLE NULL /* authentication methods available */ -#define LDAP_AUTH_NONE 0x00L /* no authentication */ -#define LDAP_AUTH_SIMPLE 0x80L /* context specific + primitive */ -#define LDAP_AUTH_SASL 0xa3L /* context specific + primitive */ -#define LDAP_AUTH_KRBV4 0xffL /* means do both of the following */ -#define LDAP_AUTH_KRBV41 0x81L /* context specific + primitive */ -#define LDAP_AUTH_KRBV42 0x82L /* context specific + primitive */ +#define LDAP_AUTH_NONE 0x00UL /* no authentication */ +#define LDAP_AUTH_SIMPLE 0x80UL /* context specific + primitive */ +#define LDAP_AUTH_SASL 0xa3UL /* context specific + primitive */ +#define LDAP_AUTH_KRBV4 0xffUL /* means do both of the following */ +#define LDAP_AUTH_KRBV41 0x81UL /* context specific + primitive */ +#define LDAP_AUTH_KRBV42 0x82UL /* context specific + primitive */ /* U-Mich version 3.0 compatibility auth methods */ -#define LDAP_AUTH_SIMPLE_30 0xa0L /* context specific + constructed */ -#define LDAP_AUTH_KRBV41_30 0xa1L /* context specific + constructed */ -#define LDAP_AUTH_KRBV42_30 0xa2L /* context specific + constructed */ +#define LDAP_AUTH_SIMPLE_30 0xa0UL /* context specific + constructed */ +#define LDAP_AUTH_KRBV41_30 0xa1UL /* context specific + constructed */ +#define LDAP_AUTH_KRBV42_30 0xa2UL /* context specific + constructed */ /* old broken stuff */ -#define OLD_LDAP_AUTH_SIMPLE 0x00L -#define OLD_LDAP_AUTH_KRBV4 0x01L -#define OLD_LDAP_AUTH_KRBV42 0x02L +#define OLD_LDAP_AUTH_SIMPLE 0x00UL +#define OLD_LDAP_AUTH_KRBV4 0x01UL +#define OLD_LDAP_AUTH_KRBV42 0x02UL /* filter types */ -#define LDAP_FILTER_AND 0xa0L /* context specific + constructed */ -#define LDAP_FILTER_OR 0xa1L /* context specific + constructed */ -#define LDAP_FILTER_NOT 0xa2L /* context specific + constructed */ -#define LDAP_FILTER_EQUALITY 0xa3L /* context specific + constructed */ -#define LDAP_FILTER_SUBSTRINGS 0xa4L /* context specific + constructed */ -#define LDAP_FILTER_GE 0xa5L /* context specific + constructed */ -#define LDAP_FILTER_LE 0xa6L /* context specific + constructed */ -#define LDAP_FILTER_PRESENT 0x87L /* context specific + primitive */ -#define LDAP_FILTER_APPROX 0xa8L /* context specific + constructed */ -#define LDAP_FILTER_EXTENDED 0xa9L /* context specific + constructed */ +#define LDAP_FILTER_AND 0xa0UL /* context specific + constructed */ +#define LDAP_FILTER_OR 0xa1UL /* context specific + constructed */ +#define LDAP_FILTER_NOT 0xa2UL /* context specific + constructed */ +#define LDAP_FILTER_EQUALITY 0xa3UL /* context specific + constructed */ +#define LDAP_FILTER_SUBSTRINGS 0xa4UL /* context specific + constructed */ +#define LDAP_FILTER_GE 0xa5UL /* context specific + constructed */ +#define LDAP_FILTER_LE 0xa6UL /* context specific + constructed */ +#define LDAP_FILTER_PRESENT 0x87UL /* context specific + primitive */ +#define LDAP_FILTER_APPROX 0xa8UL /* context specific + constructed */ +#define LDAP_FILTER_EXTENDED 0xa9UL /* context specific + constructed */ /* U-Mich version 3.0 compatibility filter types */ -#define LDAP_FILTER_PRESENT_30 0xa7L /* context specific + constructed */ +#define LDAP_FILTER_PRESENT_30 0xa7UL /* context specific + constructed */ /* old broken stuff */ -#define OLD_LDAP_FILTER_AND 0x00L -#define OLD_LDAP_FILTER_OR 0x01L -#define OLD_LDAP_FILTER_NOT 0x02L -#define OLD_LDAP_FILTER_EQUALITY 0x03L -#define OLD_LDAP_FILTER_SUBSTRINGS 0x04L -#define OLD_LDAP_FILTER_GE 0x05L -#define OLD_LDAP_FILTER_LE 0x06L -#define OLD_LDAP_FILTER_PRESENT 0x07L -#define OLD_LDAP_FILTER_APPROX 0x08L +#define OLD_LDAP_FILTER_AND 0x00UL +#define OLD_LDAP_FILTER_OR 0x01UL +#define OLD_LDAP_FILTER_NOT 0x02UL +#define OLD_LDAP_FILTER_EQUALITY 0x03UL +#define OLD_LDAP_FILTER_SUBSTRINGS 0x04UL +#define OLD_LDAP_FILTER_GE 0x05UL +#define OLD_LDAP_FILTER_LE 0x06UL +#define OLD_LDAP_FILTER_PRESENT 0x07UL +#define OLD_LDAP_FILTER_APPROX 0x08UL /* extended filter component types */ -#define LDAP_FILTER_EXTENDED_OID 0x81L /* context specific */ -#define LDAP_FILTER_EXTENDED_TYPE 0x82L /* context specific */ -#define LDAP_FILTER_EXTENDED_VALUE 0x83L /* context specific */ -#define LDAP_FILTER_EXTENDED_DNATTRS 0x84L /* context specific */ +#define LDAP_FILTER_EXTENDED_OID 0x81UL /* context specific */ +#define LDAP_FILTER_EXTENDED_TYPE 0x82UL /* context specific */ +#define LDAP_FILTER_EXTENDED_VALUE 0x83UL /* context specific */ +#define LDAP_FILTER_EXTENDED_DNATTRS 0x84UL /* context specific */ /* substring filter component types */ -#define LDAP_SUBSTRING_INITIAL 0x80L /* context specific */ -#define LDAP_SUBSTRING_ANY 0x81L /* context specific */ -#define LDAP_SUBSTRING_FINAL 0x82L /* context specific */ +#define LDAP_SUBSTRING_INITIAL 0x80UL /* context specific */ +#define LDAP_SUBSTRING_ANY 0x81UL /* context specific */ +#define LDAP_SUBSTRING_FINAL 0x82UL /* context specific */ /* U-Mich version 3.0 compatibility substring filter component types */ -#define LDAP_SUBSTRING_INITIAL_30 0xa0L /* context specific */ -#define LDAP_SUBSTRING_ANY_30 0xa1L /* context specific */ -#define LDAP_SUBSTRING_FINAL_30 0xa2L /* context specific */ +#define LDAP_SUBSTRING_INITIAL_30 0xa0UL /* context specific */ +#define LDAP_SUBSTRING_ANY_30 0xa1UL /* context specific */ +#define LDAP_SUBSTRING_FINAL_30 0xa2UL /* context specific */ /* old broken stuff */ -#define OLD_LDAP_SUBSTRING_INITIAL 0x00L -#define OLD_LDAP_SUBSTRING_ANY 0x01L -#define OLD_LDAP_SUBSTRING_FINAL 0x02L +#define OLD_LDAP_SUBSTRING_INITIAL 0x00UL +#define OLD_LDAP_SUBSTRING_ANY 0x01UL +#define OLD_LDAP_SUBSTRING_FINAL 0x02UL /* search scopes */ -#define LDAP_SCOPE_BASE 0x00 -#define LDAP_SCOPE_ONELEVEL 0x01 -#define LDAP_SCOPE_SUBTREE 0x02 +#define LDAP_SCOPE_BASE 0x0000 +#define LDAP_SCOPE_ONELEVEL 0x0001 +#define LDAP_SCOPE_SUBTREE 0x0002 /* for modifications */ typedef struct ldapmod { int mod_op; -#define LDAP_MOD_ADD 0x00 -#define LDAP_MOD_DELETE 0x01 -#define LDAP_MOD_REPLACE 0x02 -#define LDAP_MOD_BVALUES 0x80 +#define LDAP_MOD_ADD 0x0000 +#define LDAP_MOD_DELETE 0x0001 +#define LDAP_MOD_REPLACE 0x0002 +#define LDAP_MOD_BVALUES 0x0080 char *mod_type; - union { + union mod_vals_u { char **modv_strvals; struct berval **modv_bvals; } mod_vals; @@ -345,8 +350,7 @@ typedef struct ldapmod { #define LDAP_IS_LEAF 0x23 /* not LDAPv3 */ #define LDAP_ALIAS_DEREF_PROBLEM 0x24 -#define LDAP_NAME_ERROR(n) (((n) & 0xf0) == 0x20) -#define NAME_ERROR(n) LDAP_NAME_ERROR(n) /* depreciated */ +#define LDAP_NAME_ERROR(n) (((n) & 0x00f0) == 0x0020) #define LDAP_INAPPROPRIATE_AUTH 0x30 #define LDAP_INVALID_CREDENTIALS 0x31 @@ -395,7 +399,6 @@ typedef struct ldapmod { */ typedef struct ldapmsg LDAPMessage; -#define NULLMSG ((LDAPMessage *) NULL) /* * structures for ldap getfilter routines @@ -472,12 +475,11 @@ typedef struct ldap_url_desc { char *lud_filter; char *lud_string; /* for internal use only */ } LDAPURLDesc; -#define NULLLDAPURLDESC ((LDAPURLDesc *)NULL) -#define LDAP_URL_ERR_NOTLDAP 1 /* URL doesn't begin with "ldap://" */ -#define LDAP_URL_ERR_NODN 2 /* URL has no DN (required) */ -#define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */ -#define LDAP_URL_ERR_MEM 4 /* can't allocate memory space */ +#define LDAP_URL_ERR_NOTLDAP 0x01 /* URL doesn't begin with "ldap://" */ +#define LDAP_URL_ERR_NODN 0x02 /* URL has no DN (required) */ +#define LDAP_URL_ERR_BADSCOPE 0x03 /* URL scope string is invalid */ +#define LDAP_URL_ERR_MEM 0x04 /* can't allocate memory space */ /* avoid pulling in headers */ struct timeval; @@ -485,31 +487,47 @@ struct timeval; /* * in options.c: */ -LDAP_F int ldap_get_option LDAP_P((LDAP *ld, int option, void *outvalue)); -LDAP_F int ldap_set_option LDAP_P((LDAP *ld, int option, void *invalue)); +LDAP_F( int ) +ldap_get_option LDAP_P(( + LDAP *ld, + int option, + void *outvalue)); + +LDAP_F( int ) +ldap_set_option LDAP_P(( + LDAP *ld, + int option, + LDAP_CONST void *invalue)); /* * in controls.c: */ -LDAP_F void ldap_control_free LDAP_P(( LDAPControl *ctrl )); -LDAP_F void ldap_controls_free LDAP_P(( LDAPControl **ctrls )); +LDAP_F( void ) +ldap_control_free LDAP_P(( + LDAPControl *ctrl )); + +LDAP_F( void ) +ldap_controls_free LDAP_P(( + LDAPControl **ctrls )); /* * in extended.c: */ -LDAP_F int ldap_extended_operation LDAP_P(( +LDAP_F( int ) +ldap_extended_operation LDAP_P(( LDAP *ld, - char *exoid, + LDAP_CONST char *exoid, struct berval *exdata, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp )); -LDAP_F int ldap_extended_operation_s LDAP_P(( +LDAP_F( int ) +ldap_extended_operation_s LDAP_P(( LDAP *ld, - char *exoid, + LDAP_CONST char *exoid, struct berval *exdata, LDAPControl **serverctrls, LDAPControl **clientctrls, @@ -519,8 +537,13 @@ LDAP_F int ldap_extended_operation_s LDAP_P(( /* * in abandon.c: */ -LDAP_F int ldap_abandon LDAP_P(( LDAP *ld, int msgid )); -LDAP_F int ldap_abandon_ext LDAP_P(( +LDAP_F( int ) +ldap_abandon LDAP_P(( + LDAP *ld, + int msgid )); + +LDAP_F( int ) +ldap_abandon_ext LDAP_P(( LDAP *ld, int msgid, LDAPControl **serverctrls, @@ -530,42 +553,54 @@ LDAP_F int ldap_abandon_ext LDAP_P(( /* * in add.c: */ -LDAP_F int ldap_add_ext LDAP_P(( +LDAP_F( int ) +ldap_add_ext LDAP_P(( LDAP *ld, - char *dn, + LDAP_CONST char *dn, LDAPMod **attrs, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp )); -LDAP_F int ldap_add_ext_s LDAP_P(( +LDAP_F( int ) +ldap_add_ext_s LDAP_P(( LDAP *ld, - char *dn, + LDAP_CONST char *dn, LDAPMod **attrs, LDAPControl **serverctrls, - LDAPControl **clientctrls, - LDAPMessage **res )); + LDAPControl **clientctrls )); -LDAP_F int ldap_add LDAP_P(( LDAP *ld, char *dn, LDAPMod **attrs )); -LDAP_F int ldap_add_s LDAP_P(( LDAP *ld, char *dn, LDAPMod **attrs )); +LDAP_F( int ) +ldap_add LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAPMod **attrs )); + +LDAP_F( int ) +ldap_add_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAPMod **attrs )); /* * in saslbind.c: */ -LDAP_F int ldap_sasl_bind LDAP_P(( +LDAP_F( int ) +ldap_sasl_bind LDAP_P(( LDAP *ld, - char *dn, - char *mechanism, - struct berval *cred, + LDAP_CONST char *dn, + LDAP_CONST char *mechanism, + struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls, int msgidp )); -LDAP_F int ldap_sasl_bind_s LDAP_P(( +LDAP_F( int ) +ldap_sasl_bind_s LDAP_P(( LDAP *ld, - char *dn, - char *mechanism, + LDAP_CONST char *dn, + LDAP_CONST char *mechanism, struct berval *cred, LDAPControl **serverctrls, LDAPControl **clientctrls, @@ -574,182 +609,339 @@ LDAP_F int ldap_sasl_bind_s LDAP_P(( /* * in bind.c: - * (depreciated) + * (deprecated) */ -LDAP_F int ldap_bind LDAP_P(( LDAP *ld, char *who, char *passwd, int authmethod )); -LDAP_F int ldap_bind_s LDAP_P(( LDAP *ld, char *who, char *cred, int method )); -LDAP_F void ldap_set_rebind_proc LDAP_P(( LDAP *ld, - int (*rebindproc) LDAP_P(( LDAP *ld, char **dnp, char **passwdp, int *authmethodp, int freeit )) -)); +LDAP_F( int ) +ldap_bind LDAP_P(( + LDAP *ld, + LDAP_CONST char *who, + LDAP_CONST char *passwd, + int authmethod )); + +LDAP_F( int ) +ldap_bind_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *who, + LDAP_CONST char *cred, + int authmethod )); + +LDAP_F( void ) +ldap_set_rebind_proc LDAP_P(( + LDAP *ld, + int (*rebindproc) LDAP_P(( + LDAP *ld, + char **dnp, + char **passwdp, + int *authmethodp, + int freeit )))); /* * in sbind.c: */ -LDAP_F int ldap_simple_bind LDAP_P(( LDAP *ld, char *who, char *passwd )); -LDAP_F int ldap_simple_bind_s LDAP_P(( LDAP *ld, char *who, char *passwd )); +LDAP_F( int ) +ldap_simple_bind LDAP_P(( + LDAP *ld, + LDAP_CONST char *who, + LDAP_CONST char *passwd )); + +LDAP_F( int ) +ldap_simple_bind_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *who, + LDAP_CONST char *passwd )); /* * in kbind.c: - * (depreciated) + * (deprecated) */ -LDAP_F int ldap_kerberos_bind_s LDAP_P(( LDAP *ld, char *who )); -LDAP_F int ldap_kerberos_bind1 LDAP_P(( LDAP *ld, char *who )); -LDAP_F int ldap_kerberos_bind1_s LDAP_P(( LDAP *ld, char *who )); -LDAP_F int ldap_kerberos_bind2 LDAP_P(( LDAP *ld, char *who )); -LDAP_F int ldap_kerberos_bind2_s LDAP_P(( LDAP *ld, char *who )); - +LDAP_F( int ) +ldap_kerberos_bind_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *who )); + +LDAP_F( int ) +ldap_kerberos_bind1 LDAP_P(( + LDAP *ld, + LDAP_CONST char *who )); + +LDAP_F( int ) +ldap_kerberos_bind1_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *who )); + +LDAP_F( int ) +ldap_kerberos_bind2 LDAP_P(( + LDAP *ld, + LDAP_CONST char *who )); + +LDAP_F( int ) +ldap_kerberos_bind2_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *who )); /* * in cache.c + * DEPRECATED */ -LDAP_F int ldap_enable_cache LDAP_P(( LDAP *ld, long timeout, long maxmem )); -LDAP_F void ldap_disable_cache LDAP_P(( LDAP *ld )); -LDAP_F void ldap_set_cache_options LDAP_P(( LDAP *ld, unsigned long opts )); -LDAP_F void ldap_destroy_cache LDAP_P(( LDAP *ld )); -LDAP_F void ldap_flush_cache LDAP_P(( LDAP *ld )); -LDAP_F void ldap_uncache_entry LDAP_P(( LDAP *ld, char *dn )); -LDAP_F void ldap_uncache_request LDAP_P(( LDAP *ld, int msgid )); +LDAP_F( int ) +ldap_enable_cache LDAP_P(( LDAP *ld, long timeout, long maxmem )); + +LDAP_F( void ) +ldap_disable_cache LDAP_P(( LDAP *ld )); + +LDAP_F( void ) +ldap_set_cache_options LDAP_P(( LDAP *ld, unsigned long opts )); + +LDAP_F( void ) +ldap_destroy_cache LDAP_P(( LDAP *ld )); + +LDAP_F( void ) +ldap_flush_cache LDAP_P(( LDAP *ld )); + +LDAP_F( void ) +ldap_uncache_entry LDAP_P(( LDAP *ld, LDAP_CONST char *dn )); + +LDAP_F( void ) +ldap_uncache_request LDAP_P(( LDAP *ld, int msgid )); /* * in compare.c: */ -LDAP_F int ldap_compare_ext LDAP_P(( +LDAP_F( int ) +ldap_compare_ext LDAP_P(( LDAP *ld, - char *dn, - char *attr, + LDAP_CONST char *dn, + LDAP_CONST char *attr, struct berval *bvalue, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp )); -LDAP_F int ldap_compare_ext_s LDAP_P(( +LDAP_F( int ) +ldap_compare_ext_s LDAP_P(( LDAP *ld, - char *dn, - char *attr, + LDAP_CONST char *dn, + LDAP_CONST char *attr, struct berval *bvalue, LDAPControl **serverctrls, - LDAPControl **clientctrls, - LDAPMessage **res )); + LDAPControl **clientctrls )); + +LDAP_F( int ) +ldap_compare LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *attr, + LDAP_CONST char *value )); -LDAP_F int ldap_compare LDAP_P(( LDAP *ld, char *dn, char *attr, char *value )); -LDAP_F int ldap_compare_s LDAP_P(( LDAP *ld, char *dn, char *attr, char *value )); +LDAP_F( int ) +ldap_compare_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *attr, + LDAP_CONST char *value )); /* * in delete.c: */ -LDAP_F int ldap_delete_ext LDAP_P(( +LDAP_F( int ) +ldap_delete_ext LDAP_P(( LDAP *ld, - char *dn, + LDAP_CONST char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp )); -LDAP_F int ldap_delete_ext_s LDAP_P(( +LDAP_F( int ) +ldap_delete_ext_s LDAP_P(( LDAP *ld, - char *dn, + LDAP_CONST char *dn, LDAPControl **serverctrls, - LDAPControl **clientctrls, - LDAPMessage **res )); + LDAPControl **clientctrls )); + +LDAP_F( int ) +ldap_delete LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn )); -LDAP_F int ldap_delete LDAP_P(( LDAP *ld, char *dn )); -LDAP_F int ldap_delete_s LDAP_P(( LDAP *ld, char *dn )); +LDAP_F( int ) +ldap_delete_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn )); /* * in error.c: */ -LDAP_F int ldap_result2error LDAP_P(( LDAP *ld, LDAPMessage *r, int freeit )); -LDAP_F char *ldap_err2string LDAP_P(( int err )); -LDAP_F void ldap_perror LDAP_P(( LDAP *ld, char *s )); +LDAP_F( int ) +ldap_result2error LDAP_P(( LDAP *ld, LDAPMessage *r, int freeit )); +LDAP_F( char *) +ldap_err2string LDAP_P(( int err )); +LDAP_F( void ) +ldap_perror LDAP_P(( + LDAP *ld, + LDAP_CONST char *s )); /* * in modify.c: */ -LDAP_F int ldap_modify_ext LDAP_P(( +LDAP_F( int ) +ldap_modify_ext LDAP_P(( LDAP *ld, - char *dn, + LDAP_CONST char *dn, LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp )); -LDAP_F int ldap_modify_ext_s LDAP_P(( +LDAP_F( int ) +ldap_modify_ext_s LDAP_P(( LDAP *ld, - char *dn, + LDAP_CONST char *dn, LDAPMod **mods, LDAPControl **serverctrls, - LDAPControl **clientctrls, - LDAPMessage **res )); + LDAPControl **clientctrls )); + +LDAP_F( int ) +ldap_modify LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAPMod **mods )); -LDAP_F int ldap_modify LDAP_P(( LDAP *ld, char *dn, LDAPMod **mods )); -LDAP_F int ldap_modify_s LDAP_P(( LDAP *ld, char *dn, LDAPMod **mods )); +LDAP_F( int ) +ldap_modify_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAPMod **mods )); /* * in rename.c: */ -LDAP_F int ldap_rename_ext LDAP_P(( +LDAP_F( int ) +ldap_rename_ext LDAP_P(( LDAP *ld, - char *dn, - char *newrdn, - char *newparent, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + LDAP_CONST char *newparent, int deleteoldrdn, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp )); -LDAP_F int ldap_rename_ext_s LDAP_P(( +LDAP_F( int ) +ldap_rename_ext_s LDAP_P(( LDAP *ld, - char *dn, - char *newrdn, - char *newparent, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + LDAP_CONST char *newparent, int deleteoldrdn, LDAPControl **serverctrls, - LDAPControl **clientctrls, - LDAPMessage **res )); + LDAPControl **clientctrls )); /* * in modrdn.c: */ -LDAP_F int ldap_modrdn LDAP_P(( LDAP *ld, char *dn, char *newrdn )); -LDAP_F int ldap_modrdn_s LDAP_P(( LDAP *ld, char *dn, char *newrdn )); -LDAP_F int ldap_modrdn2 LDAP_P(( LDAP *ld, char *dn, char *newrdn, +LDAP_F( int ) +ldap_modrdn LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn )); + +LDAP_F( int ) +ldap_modrdn_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn )); + +LDAP_F( int ) +ldap_modrdn2 LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, int deleteoldrdn )); -LDAP_F int ldap_modrdn2_s LDAP_P(( LDAP *ld, char *dn, char *newrdn, + +LDAP_F( int ) +ldap_modrdn2_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, int deleteoldrdn)); -LDAP_F int ldap_rename2 LDAP_P(( LDAP *ld, char *dn, char *newrdn, - int deleteoldrdn, char *newSuperior )); -LDAP_F int ldap_rename2_s LDAP_P(( LDAP *ld, char *dn, char *newrdn, - int deleteoldrdn, char *newSuperior)); + +LDAP_F( int ) +ldap_rename2 LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + int deleteoldrdn, + LDAP_CONST char *newSuperior )); + +LDAP_F( int ) +ldap_rename2_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + int deleteoldrdn, + LDAP_CONST char *newSuperior)); /* * in open.c: */ -LDAP_F LDAP *ldap_open LDAP_P(( char *host, int port )); -LDAP_F LDAP *ldap_init LDAP_P(( char *host, int port )); +LDAP_F( LDAP *) +ldap_open LDAP_P(( + LDAP_CONST char *host, + int port )); + +LDAP_F( LDAP *) +ldap_init LDAP_P(( + LDAP_CONST char *host, + int port )); /* * in messages.c: */ -LDAP_F LDAPMessage *ldap_first_message LDAP_P(( LDAP *ld, LDAPMessage *chain )); -LDAP_F LDAPMessage *ldap_next_message LDAP_P(( LDAP *ld, LDAPMessage *msg )); -LDAP_F int ldap_count_messages LDAP_P(( LDAP *ld, LDAPMessage *chain )); +LDAP_F( LDAPMessage *) +ldap_first_message LDAP_P(( + LDAP *ld, + LDAPMessage *chain )); + +LDAP_F( LDAPMessage *) +ldap_next_message LDAP_P(( + LDAP *ld, + LDAPMessage *msg )); + +LDAP_F( int ) +ldap_count_messages LDAP_P(( + LDAP *ld, + LDAPMessage *chain )); /* * in references.c: */ -LDAP_F LDAPMessage *ldap_first_reference LDAP_P(( LDAP *ld, LDAPMessage *chain )); -LDAP_F LDAPMessage *ldap_next_reference LDAP_P(( LDAP *ld, LDAPMessage *ref )); -LDAP_F int ldap_count_references LDAP_P(( LDAP *ld, LDAPMessage *chain )); -LDAP_F int ldap_parse_reference LDAP_P(( +LDAP_F( LDAPMessage *) +ldap_first_reference LDAP_P(( + LDAP *ld, + LDAPMessage *chain )); + +LDAP_F( LDAPMessage *) +ldap_next_reference LDAP_P(( + LDAP *ld, + LDAPMessage *ref )); + +LDAP_F( int ) +ldap_count_references LDAP_P(( + LDAP *ld, + LDAPMessage *chain )); + +LDAP_F( int ) +ldap_parse_reference LDAP_P(( LDAP *ld, LDAPMessage *ref, char ***referralsp, @@ -760,10 +952,23 @@ LDAP_F int ldap_parse_reference LDAP_P(( /* * in getentry.c: */ -LDAP_F LDAPMessage *ldap_first_entry LDAP_P(( LDAP *ld, LDAPMessage *chain )); -LDAP_F LDAPMessage *ldap_next_entry LDAP_P(( LDAP *ld, LDAPMessage *entry )); -LDAP_F int ldap_count_entries LDAP_P(( LDAP *ld, LDAPMessage *chain )); -LDAP_F int ldap_get_entry_controls LDAP_P(( +LDAP_F( LDAPMessage *) +ldap_first_entry LDAP_P(( + LDAP *ld, + LDAPMessage *chain )); + +LDAP_F( LDAPMessage *) +ldap_next_entry LDAP_P(( + LDAP *ld, + LDAPMessage *entry )); + +LDAP_F( int ) +ldap_count_entries LDAP_P(( + LDAP *ld, + LDAPMessage *chain )); + +LDAP_F( int ) +ldap_get_entry_controls LDAP_P(( LDAP *ld, LDAPMessage *entry, LDAPControl ***serverctrls)); @@ -772,62 +977,145 @@ LDAP_F int ldap_get_entry_controls LDAP_P(( /* * in addentry.c */ -LDAP_F LDAPMessage *ldap_delete_result_entry LDAP_P(( LDAPMessage **list, +LDAP_F( LDAPMessage *) +ldap_delete_result_entry LDAP_P(( + LDAPMessage **list, + LDAPMessage *e )); + +LDAP_F( void ) +ldap_add_result_entry LDAP_P(( + LDAPMessage **list, LDAPMessage *e )); -LDAP_F void ldap_add_result_entry LDAP_P(( LDAPMessage **list, LDAPMessage *e )); /* * in getdn.c */ -LDAP_F char *ldap_get_dn LDAP_P(( LDAP *ld, LDAPMessage *entry )); -LDAP_F char *ldap_dn2ufn LDAP_P(( char *dn )); -LDAP_F char **ldap_explode_dn LDAP_P(( char *dn, int notypes )); -LDAP_F char **ldap_explode_rdn LDAP_P(( char *rdn, int notypes )); -LDAP_F char **ldap_explode_dns LDAP_P(( char *dn )); -LDAP_F int ldap_is_dns_dn LDAP_P(( char *dn )); +LDAP_F( char *) +ldap_get_dn LDAP_P(( + LDAP *ld, + LDAPMessage *entry )); + +LDAP_F( char *) +ldap_dn2ufn LDAP_P(( + LDAP_CONST char *dn )); + +LDAP_F( char **) +ldap_explode_dn LDAP_P(( + LDAP_CONST char *dn, + int notypes )); + +LDAP_F( char **) +ldap_explode_rdn LDAP_P(( + LDAP_CONST char *rdn, + int notypes )); + +LDAP_F( char *) +ldap_parent_dn LDAP_P(( /* new (from slapd) */ + LDAP_CONST char *dn )); + +LDAP_F( char *) +ldap_relative_dn LDAP_P(( /* new (from slapd) */ + LDAP_CONST char *dn )); + +LDAP_F( char *) +ldap_normalize_dn LDAP_P(( /* new (from slapd) */ + LDAP_CONST char *dn )); + +LDAP_F( char **) +ldap_explode_dns LDAP_P(( /* deprecated */ + LDAP_CONST char *dn )); + +LDAP_F( int ) +ldap_is_dns_dn LDAP_P(( /* deprecated */ + LDAP_CONST char *dn )); /* * in getattr.c */ -LDAP_F char *ldap_first_attribute LDAP_P(( LDAP *ld, LDAPMessage *entry, +LDAP_F( char *) +ldap_first_attribute LDAP_P(( + LDAP *ld, + LDAPMessage *entry, BerElement **ber )); -LDAP_F char *ldap_next_attribute LDAP_P(( LDAP *ld, LDAPMessage *entry, + +LDAP_F( char *) +ldap_next_attribute LDAP_P(( + LDAP *ld, + LDAPMessage *entry, BerElement *ber )); /* * in getvalues.c */ -LDAP_F char **ldap_get_values LDAP_P(( LDAP *ld, LDAPMessage *entry, char *target )); -LDAP_F struct berval **ldap_get_values_len LDAP_P(( LDAP *ld, LDAPMessage *entry, - char *target )); -LDAP_F int ldap_count_values LDAP_P(( char **vals )); -LDAP_F int ldap_count_values_len LDAP_P(( struct berval **vals )); -LDAP_F void ldap_value_free LDAP_P(( char **vals )); -LDAP_F void ldap_value_free_len LDAP_P(( struct berval **vals )); - +LDAP_F( char **) +ldap_get_values LDAP_P(( + LDAP *ld, + LDAPMessage *entry, + LDAP_CONST char *target )); + +LDAP_F( struct berval **) +ldap_get_values_len LDAP_P(( + LDAP *ld, + LDAPMessage *entry, + LDAP_CONST char *target )); + +LDAP_F( int ) +ldap_count_values LDAP_P(( + char **vals )); + +LDAP_F( int ) +ldap_count_values_len LDAP_P(( + struct berval **vals )); + +LDAP_F( void ) +ldap_value_free LDAP_P(( + char **vals )); + +LDAP_F( void ) +ldap_value_free_len LDAP_P(( + struct berval **vals )); /* * in result.c: */ -LDAP_F int ldap_result LDAP_P(( LDAP *ld, int msgid, int all, - struct timeval *timeout, LDAPMessage **result )); -LDAP_F int ldap_msgtype LDAP_P(( LDAPMessage *lm )); -LDAP_F int ldap_msgid LDAP_P(( LDAPMessage *lm )); -LDAP_F int ldap_msgfree LDAP_P(( LDAPMessage *lm )); -LDAP_F int ldap_msgdelete LDAP_P(( LDAP *ld, int msgid )); +LDAP_F( int ) +ldap_result LDAP_P(( + LDAP *ld, + int msgid, + int all, + struct timeval *timeout, + LDAPMessage **result )); + +LDAP_F( int ) +ldap_msgtype LDAP_P(( + LDAPMessage *lm )); + +LDAP_F( int ) +ldap_msgid LDAP_P(( + LDAPMessage *lm )); + +LDAP_F( int ) +ldap_msgfree LDAP_P(( + LDAPMessage *lm )); + +LDAP_F( int ) +ldap_msgdelete LDAP_P(( + LDAP *ld, + int msgid )); /* * in search.c: */ -LDAP_F int ldap_search_ext LDAP_P(( +LDAP_F( int ) +ldap_search_ext LDAP_P(( LDAP *ld, - char *base, + LDAP_CONST char *base, int scope, - char *filter, + LDAP_CONST char *filter, char **attrs, LDAPControl **serverctrls, LDAPControl **clientctrls, @@ -835,11 +1123,12 @@ LDAP_F int ldap_search_ext LDAP_P(( int sizelimit, int *msgidp )); -LDAP_F int ldap_search_ext_s LDAP_P(( +LDAP_F( int ) +ldap_search_ext_s LDAP_P(( LDAP *ld, - char *base, + LDAP_CONST char *base, int scope, - char *filter, + LDAP_CONST char *filter, char **attrs, LDAPControl **serverctrls, LDAPControl **clientctrls, @@ -847,116 +1136,309 @@ LDAP_F int ldap_search_ext_s LDAP_P(( int sizelimit, LDAPMessage **res )); -LDAP_F int ldap_search LDAP_P(( LDAP *ld, char *base, int scope, char *filter, - char **attrs, int attrsonly )); -LDAP_F int ldap_search_s LDAP_P(( LDAP *ld, char *base, int scope, char *filter, - char **attrs, int attrsonly, LDAPMessage **res )); -LDAP_F int ldap_search_st LDAP_P(( LDAP *ld, char *base, int scope, char *filter, - char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res )); +LDAP_F( int ) +ldap_search LDAP_P(( + LDAP *ld, + LDAP_CONST char *base, + int scope, + LDAP_CONST char *filter, + char **attrs, + int attrsonly )); + +LDAP_F( int ) +ldap_search_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *base, + int scope, + LDAP_CONST char *filter, + char **attrs, + int attrsonly, + LDAPMessage **res )); + +LDAP_F( int ) +ldap_search_st LDAP_P(( + LDAP *ld, + LDAP_CONST char *base, + int scope, + LDAP_CONST char *filter, + char **attrs, + int attrsonly, + struct timeval *timeout, + LDAPMessage **res )); /* * in ufn.c */ -LDAP_F int ldap_ufn_search_c LDAP_P(( LDAP *ld, char *ufn, char **attrs, - int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ), +LDAP_F( int ) +ldap_ufn_search_c LDAP_P(( + LDAP *ld, + LDAP_CONST char *ufn, + char **attrs, + int attrsonly, + LDAPMessage **res, + int (*cancelproc)( void *cl ), void *cancelparm )); -LDAP_F int ldap_ufn_search_ct LDAP_P(( LDAP *ld, char *ufn, char **attrs, - int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ), - void *cancelparm, char *tag1, char *tag2, char *tag3 )); -LDAP_F int ldap_ufn_search_s LDAP_P(( LDAP *ld, char *ufn, char **attrs, - int attrsonly, LDAPMessage **res )); -LDAP_F LDAPFiltDesc *ldap_ufn_setfilter LDAP_P(( LDAP *ld, char *fname )); -LDAP_F void ldap_ufn_setprefix LDAP_P(( LDAP *ld, char *prefix )); -LDAP_F int ldap_ufn_timeout LDAP_P(( void *tvparam )); + +LDAP_F( int ) +ldap_ufn_search_ct LDAP_P(( + LDAP *ld, + LDAP_CONST char *ufn, + char **attrs, + int attrsonly, + LDAPMessage **res, + int (*cancelproc)( void *cl ), + void *cancelparm, + char *tag1, + char *tag2, + char *tag3 )); + +LDAP_F( int ) +ldap_ufn_search_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *ufn, + char **attrs, + int attrsonly, + LDAPMessage **res )); + +LDAP_F( LDAPFiltDesc *) +ldap_ufn_setfilter LDAP_P(( + LDAP *ld, + LDAP_CONST char *fname )); + +LDAP_F( void ) +ldap_ufn_setprefix LDAP_P(( + LDAP *ld, + LDAP_CONST char *prefix )); + +LDAP_F( int ) +ldap_ufn_timeout LDAP_P(( + void *tvparam )); /* * in unbind.c */ -LDAP_F int ldap_unbind LDAP_P(( LDAP *ld )); -LDAP_F int ldap_unbind_s LDAP_P(( LDAP *ld )); +LDAP_F( int ) +ldap_unbind LDAP_P(( + LDAP *ld )); + +LDAP_F( int ) +ldap_unbind_s LDAP_P(( + LDAP *ld )); + +LDAP_F( int ) +ldap_unbind_ext LDAP_P(( + LDAP *ld, + LDAPControl **serverctrls, + LDAPControl **clientctrls)); +LDAP_F( int ) +ldap_unbind_ext_s LDAP_P(( + LDAP *ld, + LDAPControl **serverctrls, + LDAPControl **clientctrls)); /* * in getfilter.c */ -LDAP_F LDAPFiltDesc *ldap_init_getfilter LDAP_P(( char *fname )); -LDAP_F LDAPFiltDesc *ldap_init_getfilter_buf LDAP_P(( char *buf, long buflen )); -LDAP_F LDAPFiltInfo *ldap_getfirstfilter LDAP_P(( LDAPFiltDesc *lfdp, char *tagpat, - char *value )); -LDAP_F LDAPFiltInfo *ldap_getnextfilter LDAP_P(( LDAPFiltDesc *lfdp )); -LDAP_F void ldap_setfilteraffixes LDAP_P(( LDAPFiltDesc *lfdp, char *prefix, char *suffix )); -LDAP_F void ldap_build_filter LDAP_P(( char *buf, unsigned long buflen, - char *pattern, char *prefix, char *suffix, char *attr, - char *value, char **valwords )); +LDAP_F( LDAPFiltDesc *) +ldap_init_getfilter LDAP_P(( + LDAP_CONST char *fname )); + +LDAP_F( LDAPFiltDesc *) +ldap_init_getfilter_buf LDAP_P(( + /* LDAP_CONST */ char *buf, + long buflen )); + +LDAP_F( LDAPFiltInfo *) +ldap_getfirstfilter LDAP_P(( + LDAPFiltDesc *lfdp, + /* LDAP_CONST */ char *tagpat, + /* LDAP_CONST */ char *value )); + +LDAP_F( LDAPFiltInfo *) +ldap_getnextfilter LDAP_P(( + LDAPFiltDesc *lfdp )); + +LDAP_F( void ) +ldap_setfilteraffixes LDAP_P(( + LDAPFiltDesc *lfdp, + LDAP_CONST char *prefix, + LDAP_CONST char *suffix )); + +LDAP_F( void ) +ldap_build_filter LDAP_P(( + char *buf, + unsigned long buflen, + LDAP_CONST char *pattern, + LDAP_CONST char *prefix, + LDAP_CONST char *suffix, + LDAP_CONST char *attr, + LDAP_CONST char *value, + char **valwords )); /* * in free.c */ -LDAP_F void ldap_memfree LDAP_P(( void *p )); -LDAP_F void ldap_getfilter_free LDAP_P(( LDAPFiltDesc *lfdp )); -LDAP_F void ldap_mods_free LDAP_P(( LDAPMod **mods, int freemods )); +LDAP_F( void ) +ldap_memfree LDAP_P(( + void *p )); + +LDAP_F( void ) +ldap_getfilter_free LDAP_P(( + LDAPFiltDesc *lfdp )); + +LDAP_F( void ) +ldap_mods_free LDAP_P(( + LDAPMod **mods, + int freemods )); /* * in friendly.c */ -LDAP_F char *ldap_friendly_name LDAP_P(( char *filename, char *uname, +LDAP_F( char * ) +ldap_friendly_name LDAP_P(( + LDAP_CONST char *filename, + /* LDAP_CONST */ char *uname, + LDAPFriendlyMap **map )); + +LDAP_F( void ) +ldap_free_friendlymap LDAP_P(( LDAPFriendlyMap **map )); -LDAP_F void ldap_free_friendlymap LDAP_P(( LDAPFriendlyMap **map )); /* * in cldap.c */ -LDAP_F LDAP *cldap_open LDAP_P(( char *host, int port )); -LDAP_F void cldap_close LDAP_P(( LDAP *ld )); -LDAP_F int cldap_search_s LDAP_P(( LDAP *ld, char *base, int scope, char *filter, - char **attrs, int attrsonly, LDAPMessage **res, char *logdn )); -LDAP_F void cldap_setretryinfo LDAP_P(( LDAP *ld, int tries, int timeout )); +LDAP_F( LDAP * ) +cldap_open LDAP_P(( + LDAP_CONST char *host, + int port )); + +LDAP_F( void ) +cldap_close LDAP_P(( + LDAP *ld )); + +LDAP_F( int ) +cldap_search_s LDAP_P(( LDAP *ld, + LDAP_CONST char *base, + int scope, + LDAP_CONST char *filter, + char **attrs, + int attrsonly, + LDAPMessage **res, + char *logdn )); + +LDAP_F( void ) +cldap_setretryinfo LDAP_P(( + LDAP *ld, + int tries, + int timeout )); /* * in sort.c */ -LDAP_F int ldap_sort_entries LDAP_P(( LDAP *ld, - LDAPMessage **chain, char *attr, - int (*cmp) (const char *, const char *) )); -LDAP_F int ldap_sort_values LDAP_P(( LDAP *ld, - char **vals, int (*cmp) (const void *, const void *) )); -LDAP_F int ldap_sort_strcasecmp LDAP_P(( const void *a, const void *b )); +LDAP_F( int ) +ldap_sort_entries LDAP_P(( LDAP *ld, + LDAPMessage **chain, + LDAP_CONST char *attr, + int (*cmp) (LDAP_CONST char *, LDAP_CONST char *) )); + +LDAP_F( int ) +ldap_sort_values LDAP_P(( + LDAP *ld, + char **vals, + int (*cmp) (LDAP_CONST void *, LDAP_CONST void *) )); + +LDAP_F( int ) +ldap_sort_strcasecmp LDAP_P(( + LDAP_CONST void *a, + LDAP_CONST void *b )); /* * in url.c + * + * need _ext varients */ -LDAP_F int ldap_is_ldap_url LDAP_P(( char *url )); -LDAP_F int ldap_url_parse LDAP_P(( char *url, LDAPURLDesc **ludpp )); -LDAP_F void ldap_free_urldesc LDAP_P(( LDAPURLDesc *ludp )); -LDAP_F int ldap_url_search LDAP_P(( LDAP *ld, char *url, int attrsonly )); -LDAP_F int ldap_url_search_s LDAP_P(( LDAP *ld, char *url, int attrsonly, +LDAP_F( int ) +ldap_is_ldap_url LDAP_P(( + LDAP_CONST char *url )); + +LDAP_F( int ) +ldap_url_parse LDAP_P(( + LDAP_CONST char *url, + LDAPURLDesc **ludpp )); + +LDAP_F( void ) +ldap_free_urldesc LDAP_P(( + LDAPURLDesc *ludp )); + +LDAP_F( int ) +ldap_url_search LDAP_P(( + LDAP *ld, + LDAP_CONST char *url, + int attrsonly )); + +LDAP_F( int ) +ldap_url_search_s LDAP_P(( + LDAP *ld, + LDAP_CONST char *url, + int attrsonly, + LDAPMessage **res )); + +LDAP_F( int ) +ldap_url_search_st LDAP_P(( + LDAP *ld, + LDAP_CONST char *url, + int attrsonly, + struct timeval *timeout, LDAPMessage **res )); -LDAP_F int ldap_url_search_st LDAP_P(( LDAP *ld, char *url, int attrsonly, - struct timeval *timeout, LDAPMessage **res )); /* * in charset.c + * DEPRECATED */ -LDAP_F void ldap_set_string_translators LDAP_P(( LDAP *ld, - BERTranslateProc encode_proc, BERTranslateProc decode_proc )); -LDAP_F int ldap_translate_from_t61 LDAP_P(( LDAP *ld, char **bufp, - unsigned long *lenp, int free_input )); -LDAP_F int ldap_translate_to_t61 LDAP_P(( LDAP *ld, char **bufp, +LDAP_F( void ) +ldap_set_string_translators LDAP_P(( + LDAP *ld, + BERTranslateProc encode_proc, + BERTranslateProc decode_proc )); + +LDAP_F( int ) +ldap_translate_from_t61 LDAP_P(( + LDAP *ld, + char **bufp, + unsigned long *lenp, + int free_input )); + +LDAP_F( int ) +ldap_translate_to_t61 LDAP_P(( + LDAP *ld, + char **bufp, unsigned long *lenp, int free_input )); -LDAP_F void ldap_enable_translation LDAP_P(( LDAP *ld, LDAPMessage *entry, + +LDAP_F( void ) +ldap_enable_translation LDAP_P(( + LDAP *ld, + LDAPMessage *entry, int enable )); -LDAP_F int ldap_t61_to_8859 LDAP_P(( char **bufp, unsigned long *buflenp, +LDAP_F( int ) +ldap_t61_to_8859 LDAP_P(( + char **bufp, + unsigned long *buflenp, int free_input )); -LDAP_F int ldap_8859_to_t61 LDAP_P(( char **bufp, unsigned long *buflenp, + +LDAP_F( int ) +ldap_8859_to_t61 LDAP_P(( + char **bufp, + unsigned long *buflenp, int free_input )); LDAP_END_DECL diff --git a/include/ldap_cdefs.h b/include/ldap_cdefs.h index cd86d77f97bbec94ff1d99cfd7e1c5c914bad078..b799e9d6c5c9f7260fa08ef255db488a743f8526 100644 --- a/include/ldap_cdefs.h +++ b/include/ldap_cdefs.h @@ -49,12 +49,22 @@ #endif /* no prototypes */ -#ifndef LDAP_F +#ifndef LDAP_F_PRE # ifdef _WIN32 -# define LDAP_F __declspec( dllexport ) +# define LDAP_F_PRE extern __declspec( dllexport ) # else /* ! _WIN32 */ -# define LDAP_F extern +# define LDAP_F_PRE extern # endif /* _WIN32 */ #endif /* LDAP_FDECL */ +#ifndef LDAP_F_POST +# ifdef _WIN32 +# define LDAP_F_POST +# else /* ! _WIN32 */ +# define LDAP_F_POST +# endif /* _WIN32 */ +#endif /* LDAP_FDECL */ +#ifndef LDAP_F +#define LDAP_F(type) LDAP_F_PRE type LDAP_F_POST +#endif #endif /* _LDAP_CDEFS_H */ diff --git a/include/ldap_features.h.nt b/include/ldap_features.h.nt index d6ebe3ed4b70fe2fa5555c2ae6671930d68f7e03..f1c2e3625b25e6fe467147be93e5f08967f43c17 100644 --- a/include/ldap_features.h.nt +++ b/include/ldap_features.h.nt @@ -30,7 +30,7 @@ ** LDAP_API_FEATURE_OPERATION_THREAD_SAFE ** ** The preprocessor flag LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE -** can be used to determine if -lldap_r is available at compile +** can be used to determine if -lldap_r is availalbe at compile ** time. You must define LDAP_THREAD_SAFE if and only if you ** link with -lldap_r. ** @@ -44,7 +44,7 @@ /* #undef LDAP_API_FEATURE_X_OPENLDAP_REENTRANT */ /* is threadsafe version of -lldap (ie: -lldap_r) *available* or not */ -/* #undef LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE */ +#define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE LDAP_VENDOR_VERSION /* LDAP v2 DNS */ /* #undef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */ diff --git a/include/ldap_log.h b/include/ldap_log.h index c5af7c0d52dfdb308ab8e7ac9d6479a385c07df2..0714e952e59edbdb8564c6d5fb982c5383cad210 100644 --- a/include/ldap_log.h +++ b/include/ldap_log.h @@ -39,7 +39,7 @@ LDAP_BEGIN_DECL #define LDAP_DEBUG_SHELL 0x0400 #define LDAP_DEBUG_PARSE 0x0800 -#define LDAP_DEBUG_DEPRECIATED 0x1000 +#define LDAP_DEBUG_DEPRECATED 0x1000 #define LDAP_DEBUG_NONE 0x8000 #define LDAP_DEBUG_ANY -1 @@ -72,7 +72,7 @@ extern int ldap_syslog_level; fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \ } while ( 0 ) #else /* !WINSOCK */ -extern void Debug( int level, char* fmt, ... ); +extern void Debug( int level, const char* fmt, ... ); #endif /* !WINSOCK */ #endif /* LDAP_SYSLOG */ #else /* LDAP_DEBUG */ diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h index a14a2a80a2f849f64078b7ed1a78c9b90062dff9..d7157b1fe253bc423bc00d2746e2d60f1b49e82f 100644 --- a/include/ldap_pvt.h +++ b/include/ldap_pvt.h @@ -21,14 +21,21 @@ LDAP_BEGIN_DECL struct hostent; /* avoid pulling in <netdb.h> */ -LDAP_F char *ldap_pvt_ctime LDAP_P(( const time_t *tp, char *buf )); -LDAP_F int ldap_pvt_gethostbyname_a LDAP_P(( +LDAP_F( char * ) +ldap_pvt_ctime LDAP_P(( + const time_t *tp, + char *buf )); + +LDAP_F( int ) +ldap_pvt_gethostbyname_a LDAP_P(( const char *name, struct hostent *resbuf, char **buf, struct hostent **result, int *herrno_ptr )); -LDAP_F int ldap_pvt_gethostbyaddr_a LDAP_P(( + +LDAP_F( int ) +ldap_pvt_gethostbyaddr_a LDAP_P(( const char *addr, int len, int type, @@ -36,7 +43,9 @@ LDAP_F int ldap_pvt_gethostbyaddr_a LDAP_P(( char **buf, struct hostent **result, int *herrno_ptr )); -LDAP_F void ldap_pvt_init_utils LDAP_P(( void )); + +LDAP_F( void ) +ldap_pvt_init_utils LDAP_P(( void )); LDAP_END_DECL diff --git a/include/ldap_pvt_thread.h b/include/ldap_pvt_thread.h index 77b19031bad0b283e00535007cb161f74e491a6b..cf070b220f3e31f42494ac6a3e20447c5f7405cc 100644 --- a/include/ldap_pvt_thread.h +++ b/include/ldap_pvt_thread.h @@ -120,14 +120,15 @@ LDAP_END_DECL #elif HAVE_NT_THREADS -#include <windows.h> -#include <process.h> - LDAP_BEGIN_DECL -typedef HANDLE ldap_pvt_thread_t; -typedef HANDLE ldap_pvt_thread_mutex_t; -typedef HANDLE ldap_pvt_thread_cond_t; +#define WIN32_LEAN_AND_MEAN +#include <process.h> +#include <windows.h> + +typedef unsigned long ldap_pvt_thread_t; +typedef HANDLE ldap_pvt_thread_mutex_t; +typedef HANDLE ldap_pvt_thread_cond_t; LDAP_END_DECL @@ -156,84 +157,85 @@ LDAP_END_DECL #ifndef NO_THREADS # define HAVE_THREADS 1 - #endif LDAP_BEGIN_DECL -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_initialize LDAP_P(( void )); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_destroy LDAP_P(( void )); -LDAP_F unsigned int +LDAP_F( unsigned int ) ldap_pvt_thread_sleep LDAP_P(( unsigned int s )); #ifdef HAVE_GETCONCURRENCY -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_get_concurrency LDAP_P(( void )); #endif + #ifdef HAVE_SETCONCURRENCY # ifndef LDAP_THREAD_CONCURRENCY /* three concurrent threads should be enough */ # define LDAP_THREAD_CONCURRENCY 3 # endif -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_set_concurrency LDAP_P(( int )); #endif #define LDAP_PVT_THREAD_CREATE_JOINABLE 0 #define LDAP_PVT_THREAD_CREATE_DETACHED 1 -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_create LDAP_P(( ldap_pvt_thread_t * thread, int detach, void *(*start_routine)( void * ), void *arg)); -LDAP_F void +LDAP_F( void ) ldap_pvt_thread_exit LDAP_P(( void *retval )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_join LDAP_P(( ldap_pvt_thread_t thread, void **status )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_kill LDAP_P(( ldap_pvt_thread_t thread, int signo )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_yield LDAP_P(( void )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_cond_init LDAP_P(( ldap_pvt_thread_cond_t *cond )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_cond_destroy LDAP_P(( ldap_pvt_thread_cond_t *cond )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_cond_signal LDAP_P(( ldap_pvt_thread_cond_t *cond )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_cond_broadcast LDAP_P(( ldap_pvt_thread_cond_t *cond )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_cond_wait LDAP_P(( ldap_pvt_thread_cond_t *cond, ldap_pvt_thread_mutex_t *mutex )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_mutex_init LDAP_P(( ldap_pvt_thread_mutex_t *mutex )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_mutex_destroy LDAP_P(( ldap_pvt_thread_mutex_t *mutex )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_mutex_lock LDAP_P(( ldap_pvt_thread_mutex_t *mutex )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_mutex_trylock LDAP_P(( ldap_pvt_thread_mutex_t *mutex )); -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_mutex_unlock LDAP_P(( ldap_pvt_thread_mutex_t *mutex )); typedef struct ldap_pvt_thread_rdwr_var { @@ -248,29 +250,38 @@ typedef struct ldap_pvt_thread_rdwr_var { int ltrw_w_wait; } ldap_pvt_thread_rdwr_t; -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_rdwr_init LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_destroy LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_rlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_rtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_runlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_wlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_wtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_wunlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); #ifdef LDAP_DEBUG -LDAP_F int +LDAP_F( int ) ldap_pvt_thread_rdwr_readers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_writers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); -LDAP_F int + +LDAP_F( int ) ldap_pvt_thread_rdwr_active LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp)); #endif /* LDAP_DEBUG */ diff --git a/include/ldif.h b/include/ldif.h index 691c8bb52f6d45f8d4b527636a00e9b08a58bb7f..ee0fac490312a63058b832602b1c3fafd357e7e9 100644 --- a/include/ldif.h +++ b/include/ldif.h @@ -47,17 +47,26 @@ extern int ldif_debug; ((tlen) + 4 + LDIF_BASE64_LEN(vlen) \ + ((LDIF_BASE64_LEN(vlen) + (tlen) + 3) / LDIF_LINE_WIDTH * 2 )) -LDAP_F int -ldif_parse_line LDAP_P(( char *line, char **type, char **value, int *vlen)); +LDAP_F( int ) +ldif_parse_line LDAP_P(( + LDAP_CONST char *line, + char **type, char **value, int *vlen)); -LDAP_F char * +LDAP_F( char * ) ldif_getline LDAP_P(( char **next )); -LDAP_F void -ldif_put_type_and_value LDAP_P(( char **out, char *t, char *val, int vlen )); +LDAP_F( void ) +ldif_put_type_and_value LDAP_P(( + char **out, + LDAP_CONST char *t, + LDAP_CONST char *val, + int vlen )); -LDAP_F char -*ldif_type_and_value LDAP_P(( char *type, char *val, int vlen )); +LDAP_F( char * ) +ldif_type_and_value LDAP_P(( + LDAP_CONST char *type, + LDAP_CONST char *val, + int vlen )); LDAP_END_DECL diff --git a/include/lutil.h b/include/lutil.h index be87d7168f8213b3cde48911e48705483eaa3a0f..56aea51f378d2ddaa4055e5a8e45f04555ad0525 100644 --- a/include/lutil.h +++ b/include/lutil.h @@ -1,11 +1,6 @@ /* - * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted only - * as authorized by the OpenLDAP Public License. A copy of this - * license is available at http://www.OpenLDAP.org/license.html or - * in file LICENSE in the top-level directory of the distribution. + * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ #ifndef _LUTIL_H @@ -20,12 +15,31 @@ LDAP_BEGIN_DECL /* ISC Base64 Routines */ /* base64.c */ -LDAP_F int lutil_b64_ntop LDAP_P((unsigned char const *, size_t, char *, size_t)); -LDAP_F int lutil_b64_pton LDAP_P((char const *, unsigned char *, size_t)); + +LDAP_F( int ) +lutil_b64_ntop LDAP_P(( + unsigned char const *, + size_t, + char *, + size_t)); + +LDAP_F( int ) +lutil_b64_pton LDAP_P(( + char const *, + unsigned char *, + size_t)); + /* detach.c */ -LDAP_F void lutil_detach LDAP_P((int debug, int do_close)); +LDAP_F( void ) +lutil_detach LDAP_P(( + int debug, + int do_close)); + /* passwd.c */ -LDAP_F int lutil_passwd LDAP_P((const char *cred, const char *passwd)); +LDAP_F( int ) +lutil_passwd LDAP_P(( + const char *cred, + const char *passwd)); LDAP_END_DECL diff --git a/include/lutil_lockf.h b/include/lutil_lockf.h index 2ff75b9bb0a014c0a0da1ca20f9e0b0d0983d64d..86fc9cebd6956c8811ba63b8bab1d8fe177a155a 100644 --- a/include/lutil_lockf.h +++ b/include/lutil_lockf.h @@ -18,8 +18,11 @@ LDAP_BEGIN_DECL -LDAP_F int lutil_lockf LDAP_P(( int fd )); -LDAP_F int lutil_unlockf LDAP_P(( int fd )); +LDAP_F( int ) +lutil_lockf LDAP_P(( int fd )); + +LDAP_F( int ) +lutil_unlockf LDAP_P(( int fd )); LDAP_END_DECL diff --git a/include/lutil_md5.h b/include/lutil_md5.h index 892f30ba326b21923c4f96021e425ef28208fbfc..f3cbbc69cf875748ca41b14ef8de4163533fcb40 100644 --- a/include/lutil_md5.h +++ b/include/lutil_md5.h @@ -35,19 +35,23 @@ struct lutil_MD5Context { unsigned char in[64]; }; -LDAP_F void lutil_MD5Init LDAP_P(( +LDAP_F( void ) +lutil_MD5Init LDAP_P(( struct lutil_MD5Context *context)); -LDAP_F void lutil_MD5Update LDAP_P(( +LDAP_F( void ) +lutil_MD5Update LDAP_P(( struct lutil_MD5Context *context, unsigned char const *buf, unsigned len)); -LDAP_F void lutil_MD5Final LDAP_P(( +LDAP_F( void ) +lutil_MD5Final LDAP_P(( unsigned char digest[16], struct lutil_MD5Context *context)); -LDAP_F void lutil_MD5Transform LDAP_P(( +LDAP_F( void ) +lutil_MD5Transform LDAP_P(( uint32 buf[4], const unsigned char in[64])); diff --git a/include/lutil_sha1.h b/include/lutil_sha1.h index da40db8fb67452e3ce203dfbde9939d112c944a4..b51da64e66670eec9a4858fe9980b77316df7aeb 100644 --- a/include/lutil_sha1.h +++ b/include/lutil_sha1.h @@ -36,25 +36,32 @@ typedef struct { unsigned char buffer[64]; } lutil_SHA1_CTX; -LDAP_F void lutil_SHA1Transform +LDAP_F( void ) +lutil_SHA1Transform LDAP_P((uint32 state[5], const unsigned char buffer[64])); -LDAP_F void lutil_SHA1Init +LDAP_F( void ) +lutil_SHA1Init LDAP_P((lutil_SHA1_CTX *context)); -LDAP_F void lutil_SHA1Update +LDAP_F( void ) +lutil_SHA1Update LDAP_P((lutil_SHA1_CTX *context, const unsigned char *data, uint32 len)); -LDAP_F void lutil_SHA1Final +LDAP_F( void ) +lutil_SHA1Final LDAP_P((unsigned char digest[20], lutil_SHA1_CTX *context)); -LDAP_F char *lutil_SHA1End +LDAP_F( char * ) +lutil_SHA1End LDAP_P((lutil_SHA1_CTX *, char *)); -LDAP_F char *lutil_SHA1File +LDAP_F( char * ) +lutil_SHA1File LDAP_P((char *, char *)); -LDAP_F char *lutil_SHA1Data +LDAP_F( char * ) +lutil_SHA1Data LDAP_P((const unsigned char *, size_t, char *)); LDAP_END_DECL diff --git a/include/portable.h.nt b/include/portable.h.nt index 4236fa4a67745d5bd83122e7725dad65a5d46fcc..408ff5091554da86c4f06f9644a76a20b2c588fc 100644 --- a/include/portable.h.nt +++ b/include/portable.h.nt @@ -18,6 +18,12 @@ /* --------------------------------------------------- */ /* begin of MSVC5 specific entries */ +#define EXEEXT ".exe" + +#if defined( _DEBUG ) && !defined( LDAP_DEBUG ) +#define LDAP_DEBUG 1 +#endif + /* MSVC5 doesn't define _STDC_ but supports _STDC_ features */ #define __NEED_PROTOTYPES 1 #define HAVE_STDARG 1 @@ -34,17 +40,21 @@ #define snprintf _snprintf #define vsnprintf _vsnprintf -#define vsprintf _vsprintf - +/* #define vsprintf _vsprintf */ /* define type for caddr_t */ typedef char * caddr_t; #define LOG_DEBUG 0 #define openlog( a, b ) +#define closelog() /* we have NT threads */ +#ifdef _MT #define HAVE_NT_THREADS 1 +#else +#define NO_THREADS 1 +#endif /* we have spawnlp instead of fork/execlp */ #define HAVE_SPAWNLP 1 diff --git a/include/srchpref.h b/include/srchpref.h index cff3f95705e48c97c0700e832e537dc921ea87c2..13995d14bbbe2a4946b6c5aa68a67bb1e657efce 100644 --- a/include/srchpref.h +++ b/include/srchpref.h @@ -79,22 +79,22 @@ struct ldap_searchobj { #define LDAP_SEARCHPREF_ERR_FILE 4 -LDAP_F int +LDAP_F( int ) ldap_init_searchprefs LDAP_P(( char *file, struct ldap_searchobj **solistp )); -LDAP_F int +LDAP_F( int ) ldap_init_searchprefs_buf LDAP_P(( char *buf, long buflen, struct ldap_searchobj **solistp )); -LDAP_F void +LDAP_F( void ) ldap_free_searchprefs LDAP_P(( struct ldap_searchobj *solist )); -LDAP_F struct ldap_searchobj * +LDAP_F( struct ldap_searchobj * ) ldap_first_searchobj LDAP_P(( struct ldap_searchobj *solist )); -LDAP_F struct ldap_searchobj * +LDAP_F( struct ldap_searchobj * ) ldap_next_searchobj LDAP_P(( struct ldap_searchobj *sollist, struct ldap_searchobj *so )); diff --git a/libraries/libavl/libavl.dsp b/libraries/libavl/libavl.dsp index 66b966f1feda0315cf11bab14a73cc41eac8ca49..756a1f31906b969e48ff96a6fd969e2f5de62b54 100644 --- a/libraries/libavl/libavl.dsp +++ b/libraries/libavl/libavl.dsp @@ -20,6 +20,8 @@ CFG=libavl - Win32 Single Debug !MESSAGE "libavl - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "libavl - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "libavl - Win32 Single Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "libavl - Win32 Single Release" (based on\ + "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -36,8 +38,8 @@ CPP=cl.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "Release\libavl" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c @@ -78,11 +80,32 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "libavl__" -# PROP Intermediate_Dir "libavl__" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\libavl" # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /ML /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libavl - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "libavl_0" +# PROP BASE Intermediate_Dir "libavl_0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\libavl" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -97,6 +120,7 @@ LIB32=link.exe -lib # Name "libavl - Win32 Release" # Name "libavl - Win32 Debug" # Name "libavl - Win32 Single Debug" +# Name "libavl - Win32 Single Release" # Begin Source File SOURCE=.\avl.c diff --git a/libraries/libavl/testavl.dsp b/libraries/libavl/testavl.dsp index b6501e9acd83d33991b986a3b9dab26c3c7ba197..9899b40e847a6e2a7a01027c16b62429fe3426af 100644 --- a/libraries/libavl/testavl.dsp +++ b/libraries/libavl/testavl.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=testavl - Win32 Debug +CFG=testavl - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=testavl - Win32 Debug !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 "testavl.mak" CFG="testavl - Win32 Debug" +!MESSAGE NMAKE /f "testavl.mak" CFG="testavl - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "testavl - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "testavl - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "testavl - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "testavl - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -36,11 +40,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release\testavl" +# PROP Output_Dir "..\Release" # PROP Intermediate_Dir "Release\testavl" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -48,7 +53,7 @@ BSC32=bscmake.exe # 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 /subsystem:console /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 /nologo /subsystem:console /machine:I386 +# ADD LINK32 /nologo /subsystem:console /machine:I386 !ELSEIF "$(CFG)" == "testavl - Win32 Debug" @@ -59,10 +64,35 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug\testavl" +# PROP Output_Dir "..\Debug" # PROP Intermediate_Dir "Debug\testavl" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "testavl - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "testavl_" +# PROP BASE Intermediate_Dir "testavl_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\testavl" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" @@ -71,7 +101,31 @@ BSC32=bscmake.exe # 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 /subsystem:console /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "testavl - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "testavl0" +# PROP BASE Intermediate_Dir "testavl0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\testavl" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 /subsystem:console /machine:I386 +# ADD LINK32 /nologo /subsystem:console /machine:I386 !ENDIF @@ -79,6 +133,8 @@ LINK32=link.exe # Name "testavl - Win32 Release" # Name "testavl - Win32 Debug" +# Name "testavl - Win32 Single Debug" +# Name "testavl - Win32 Single Release" # Begin Source File SOURCE=.\testavl.c diff --git a/libraries/liblber/assert.c b/libraries/liblber/assert.c index 1ee56cc3e8465e894719244ef4908d40f3e93f28..d61306d29f8cf34b53e36497ccab3f9c23295076 100644 --- a/libraries/liblber/assert.c +++ b/libraries/liblber/assert.c @@ -22,7 +22,7 @@ * issue for now. */ -void lber_pvt_assert(char* file, int line, char* test) +void ber_pvt_assert(char* file, int line, char* test) { fprintf(stderr, "Assertion failed: %s, file %s, line %d\n", diff --git a/libraries/liblber/bprint.c b/libraries/liblber/bprint.c index 12862427d489e841a913df8b3f14f8fc206d81ef..34832a6b2c01da2e8e4c077455256fb701ff26af 100644 --- a/libraries/liblber/bprint.c +++ b/libraries/liblber/bprint.c @@ -17,26 +17,28 @@ * Print stuff */ static void -lber_error_print( char *data ) +ber_error_print( char *data ) { + assert( data != NULL ); + fputs( data, stderr ); fflush( stderr ); } -BER_LOG_PRINT_FN lber_pvt_log_print = lber_error_print; +BER_LOG_PRINT_FN ber_pvt_log_print = ber_error_print; /* * lber log */ -static int lber_log_check( int errlvl, int loglvl ) +static int ber_log_check( int errlvl, int loglvl ) { return errlvl & loglvl ? 1 : 0; } -int lber_pvt_log_printf +int ber_pvt_log_printf #ifdef HAVE_STDARG - (int errlvl, int loglvl, char *fmt, ...) + (int errlvl, int loglvl, const char *fmt, ...) #else ( va_alist ) va_dcl @@ -58,7 +60,9 @@ va_dcl fmt = va_arg( ap, char * ); #endif - if ( !lber_log_check( errlvl, loglvl )) { + assert( fmt != NULL ); + + if ( !ber_log_check( errlvl, loglvl )) { return 0; } @@ -69,22 +73,24 @@ va_dcl vsprintf( buf, fmt, ap ); /* hope it's not too long */ #else /* use doprnt() */ - chokeme = "choke me! I don't have a doprnt manual handy!"; +#error "vsprintf() required." #endif va_end(ap); - (*lber_pvt_log_print)( buf ); + (*ber_pvt_log_print)( buf ); return 1; } -static int lber_log_puts(int errlvl, int loglvl, char *buf) +static int ber_log_puts(int errlvl, int loglvl, char *buf) { - if ( !lber_log_check( errlvl, loglvl )) { + assert( buf != NULL ); + + if ( !ber_log_check( errlvl, loglvl )) { return 0; } - (*lber_pvt_log_print)( buf ); + (*ber_pvt_log_print)( buf ); return 1; } @@ -93,9 +99,14 @@ static int lber_log_puts(int errlvl, int loglvl, char *buf) */ int -lber_log_bprint(int errlvl, int loglvl, char *data, int len ) +ber_log_bprint(int errlvl, + int loglvl, + const char *data, + int len ) { - if ( !lber_log_check( errlvl, loglvl )) { + assert( data != NULL ); + + if ( !ber_log_check( errlvl, loglvl )) { return 0; } @@ -104,7 +115,9 @@ lber_log_bprint(int errlvl, int loglvl, char *data, int len ) } void -ber_bprint(char *data, int len ) +ber_bprint( + LDAP_CONST char *data, + int len ) { static const char hexdig[] = "0123456789abcdef"; #define BPLEN 48 @@ -112,11 +125,13 @@ ber_bprint(char *data, int len ) char buf[ BPLEN + sizeof("\t%s\n") ]; int i = 0; + assert( data != NULL ); + memset( out, 0, BPLEN ); for ( ;; ) { if ( len < 1 ) { sprintf( buf, "\t%s\n", ( i == 0 ) ? "(end)" : out ); - (*lber_pvt_log_print)( buf ); + (*ber_pvt_log_print)( buf ); break; } @@ -138,7 +153,7 @@ ber_bprint(char *data, int len ) if ( i > BPLEN - 2 ) { char data[128 + BPLEN]; sprintf( data, "\t%s\n", out ); - (*lber_pvt_log_print)(data); + (*ber_pvt_log_print)(data); memset( out, 0, BPLEN ); i = 0; continue; @@ -148,9 +163,15 @@ ber_bprint(char *data, int len ) } int -lber_log_dump( int errlvl, int loglvl, BerElement *ber, int inout ) +ber_log_dump( + int errlvl, + int loglvl, + const BerElement *ber, + int inout ) { - if ( !lber_log_check( errlvl, loglvl )) { + assert( ber != NULL ); + + if ( !ber_log_check( errlvl, loglvl )) { return 0; } @@ -159,16 +180,20 @@ lber_log_dump( int errlvl, int loglvl, BerElement *ber, int inout ) } void -ber_dump( BerElement *ber, int inout ) +ber_dump( + LDAP_CONST BerElement *ber, + int inout ) { char buf[132]; + assert( ber != NULL ); + sprintf( buf, "ber_dump: buf 0x%lx, ptr 0x%lx, end 0x%lx\n", (long) ber->ber_buf, (long) ber->ber_ptr, (long) ber->ber_end ); - (*lber_pvt_log_print)( buf ); + (*ber_pvt_log_print)( buf ); if ( inout == 1 ) { sprintf( buf, " current len %ld, contents:\n", @@ -184,9 +209,14 @@ ber_dump( BerElement *ber, int inout ) } int -lber_log_sos_dump( int errlvl, int loglvl, Seqorset *sos ) +lber_log_sos_dump( + int errlvl, + int loglvl, + const Seqorset *sos ) { - if ( !lber_log_check( errlvl, loglvl )) { + assert( sos != NULL ); + + if ( !ber_log_check( errlvl, loglvl )) { return 0; } @@ -195,26 +225,28 @@ lber_log_sos_dump( int errlvl, int loglvl, Seqorset *sos ) } void -ber_sos_dump( Seqorset *sos ) +ber_sos_dump( + LDAP_CONST Seqorset *sos ) { char buf[132]; - (*lber_pvt_log_print)( "*** sos dump ***\n" ); + assert( sos != NULL ); + + (*ber_pvt_log_print)( "*** sos dump ***\n" ); while ( sos != NULLSEQORSET ) { sprintf( buf, "ber_sos_dump: clen %ld first 0x%lx ptr 0x%lx\n", (long) sos->sos_clen, (long) sos->sos_first, (long) sos->sos_ptr ); - (*lber_pvt_log_print)( buf ); + (*ber_pvt_log_print)( buf ); sprintf( buf, " current len %ld contents:\n", (long) (sos->sos_ptr - sos->sos_first) ); - (*lber_pvt_log_print)( buf ); + (*ber_pvt_log_print)( buf ); ber_bprint( sos->sos_first, sos->sos_ptr - sos->sos_first ); sos = sos->sos_next; } - (*lber_pvt_log_print)( "*** end dump ***\n" ); -} - + (*ber_pvt_log_print)( "*** end dump ***\n" ); +} \ No newline at end of file diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index 75ec399433d9b33ff3e408adcdd2a755cd5e4880..1d87539e8af19947ee0cf369845683da7d2f3f83 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -38,6 +38,8 @@ ber_get_tag( BerElement *ber ) char *tagp; unsigned int i; + assert( ber != NULL ); + if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 ) return( LBER_DEFAULT ); @@ -72,6 +74,9 @@ ber_skip_tag( BerElement *ber, unsigned long *len ) int noctets, diff; unsigned long netlen; + assert( ber != NULL ); + assert( len != NULL ); + /* * Any ber element looks like this: tag length contents. * Assuming everything's ok, we return the tag byte (we @@ -116,15 +121,20 @@ ber_skip_tag( BerElement *ber, unsigned long *len ) } unsigned long -ber_peek_tag( BerElement *ber, unsigned long *len ) +ber_peek_tag( + LDAP_CONST BerElement *ber_in, /* not const per c-api-02 */ + unsigned long *len ) { - char *save; unsigned long tag; + BerElement *ber = ber_dup( ber_in ); + + if( ber == NULL ) { + return LBER_ERROR; + } - save = ber->ber_ptr; tag = ber_skip_tag( ber, len ); - ber->ber_ptr = save; + ber_free( ber, 1 ); return( tag ); } @@ -135,6 +145,9 @@ ber_getnint( BerElement *ber, long *num, int len ) long netnum; char *p; + assert( ber != NULL ); + assert( num != NULL ); + /* * The tag and length have already been stripped off. We should * be sitting right before len bytes of 2's complement integer, @@ -396,7 +409,9 @@ ber_next_element( BerElement *ber, unsigned long *len, char *last ) unsigned long ber_scanf #if HAVE_STDARG - ( BerElement *ber, char *fmt, ... ) + ( BerElement *ber, + LDAP_CONST char *fmt, + ... ) #else ( va_alist ) va_dcl @@ -407,7 +422,7 @@ va_dcl BerElement *ber; char *fmt; #endif - char *fmt_reset; + LDAP_CONST char *fmt_reset; char *last; char *s, **ss, ***sss; struct berval ***bv, **bvp, *bval; @@ -415,6 +430,8 @@ va_dcl long *l; unsigned long rc, tag, len; + assert( ber != NULL ); + #ifdef HAVE_STDARG va_start( ap, fmt ); #else @@ -422,18 +439,32 @@ va_dcl ber = va_arg( ap, BerElement * ); fmt = va_arg( ap, char * ); #endif + + assert( ber != NULL ); + assert( fmt != NULL ); + fmt_reset = fmt; if ( ber->ber_debug ) { - lber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, + ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, "ber_scanf fmt (%s) ber:\n", fmt ); - lber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 ); + ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 ); } for ( rc = 0; *fmt && rc != LBER_DEFAULT; fmt++ ) { /* When this is modified, remember to update * the error-cleanup code below accordingly. */ switch ( *fmt ) { + case '!': { /* Hook */ + BERDecodeCallback *f; + void *p; + + f = va_arg( ap, BERDecodeCallback * ); + p = va_arg( ap, void * ); + + rc = (*f)( ber, p, 0 ); + } break; + case 'a': /* octet string - allocate storage as needed */ ss = va_arg( ap, char ** ); rc = ber_get_stringa( ber, ss ); @@ -576,7 +607,7 @@ va_dcl default: if( ber->ber_debug ) { - lber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug, + ber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug, "ber_scanf: unknown fmt %c\n", *fmt ); } rc = LBER_DEFAULT; @@ -601,6 +632,16 @@ va_dcl for ( ; fmt_reset < fmt; fmt_reset++ ) { switch ( *fmt_reset ) { + case '!': { /* Hook */ + BERDecodeCallback *f; + void *p; + + f = va_arg( ap, BERDecodeCallback * ); + p = va_arg( ap, void * ); + + (void) (*f)( ber, p, 1 ); + } break; + case 'a': /* octet string - allocate storage as needed */ ss = va_arg( ap, char ** ); if ( *ss ) { @@ -689,9 +730,8 @@ va_dcl void ber_bvfree( struct berval *bv ) { -#ifdef LBER_ASSERT assert(bv != NULL); /* bv damn better point to something */ -#endif + if ( bv->bv_val != NULL ) free( bv->bv_val ); free( (char *) bv ); @@ -702,19 +742,25 @@ ber_bvecfree( struct berval **bv ) { int i; -#ifdef LBER_ASSERT assert(bv != NULL); /* bv damn better point to something */ -#endif + for ( i = 0; bv[i] != NULL; i++ ) ber_bvfree( bv[i] ); free( (char *) bv ); } struct berval * -ber_bvdup( struct berval *bv ) +ber_bvdup( + LDAP_CONST struct berval *bv ) { struct berval *new; + assert( bv != NULL ); + + if( bv == NULL ) { + return NULL; + } + if ( (new = (struct berval *) malloc( sizeof(struct berval) )) == NULL ) { return( NULL ); @@ -744,6 +790,8 @@ void ber_set_string_translators( BerElement *ber, BERTranslateProc encode_proc, BERTranslateProc decode_proc ) { + assert( ber != NULL ); + ber->ber_encode_translate_proc = encode_proc; ber->ber_decode_translate_proc = decode_proc; } diff --git a/libraries/liblber/dtest.c b/libraries/liblber/dtest.c index beeac06718a2cc62b060a9f78aad05b015d0481e..4d84ea5999ff8ae3ef997327508644e551102d42 100644 --- a/libraries/liblber/dtest.c +++ b/libraries/liblber/dtest.c @@ -49,25 +49,25 @@ main( int argc, char **argv ) cshow( stdout ); #endif /* MACOS */ - sb = lber_pvt_sb_alloc_fd( fileno(stdin) ); + sb = ber_sockbuf_alloc_fd( fileno(stdin) ); if( (ber = ber_alloc_t(LBER_USE_DER)) == NULL ) { perror( "ber_alloc_t" ); - exit( 1 ); + return( EXIT_FAILURE ); } if ( (tag = ber_get_next( sb, &len, ber )) == -1 ) { perror( "ber_get_next" ); - exit( 1 ); + return( EXIT_FAILURE ); } printf( "message has tag 0x%x and length %ld\n", tag, len ); if ( ber_scanf( ber, "i", &i ) == LBER_ERROR ) { fprintf( stderr, "ber_scanf returns -1\n" ); - exit( 1 ); + exit( EXIT_FAILURE ); } printf( "got int %ld\n", i ); - lber_pvt_sb_free( sb ); - return( 0 ); + ber_sockbuf_free( sb ); + return( EXIT_SUCCESS ); } diff --git a/libraries/liblber/dtest.dsp b/libraries/liblber/dtest.dsp index 61c1d691ff6205833fc9ce511dcc37bad56418a3..abf4c679b30839237d0fb641ccf5de5cf0c6b7b1 100644 --- a/libraries/liblber/dtest.dsp +++ b/libraries/liblber/dtest.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=dtest - Win32 Debug +CFG=dtest - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=dtest - Win32 Debug !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 "dtest.mak" CFG="dtest - Win32 Debug" +!MESSAGE NMAKE /f "dtest.mak" CFG="dtest - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "dtest - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "dtest - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "dtest - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "dtest - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -36,12 +40,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release\dtest" +# PROP Output_Dir "..\Release" # PROP Intermediate_Dir "Release\dtest" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -49,7 +53,7 @@ BSC32=bscmake.exe # 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 /subsystem:console /machine:I386 -# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" !ELSEIF "$(CFG)" == "dtest - Win32 Debug" @@ -60,12 +64,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug\dtest" +# PROP Output_Dir "..\Debug" # PROP Intermediate_Dir "Debug\dtest" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -73,7 +77,57 @@ BSC32=bscmake.exe # 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 /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" + +!ELSEIF "$(CFG)" == "dtest - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dtest___" +# PROP BASE Intermediate_Dir "dtest___" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\dtest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug" + +!ELSEIF "$(CFG)" == "dtest - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "dtest__0" +# PROP BASE Intermediate_Dir "dtest__0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\dtest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease" !ENDIF @@ -81,6 +135,8 @@ LINK32=link.exe # Name "dtest - Win32 Release" # Name "dtest - Win32 Debug" +# Name "dtest - Win32 Single Debug" +# Name "dtest - Win32 Single Release" # Begin Source File SOURCE=.\dtest.c diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index c72fb990201ee8355026f2d6162c6a0c7e9b70d6..d3914c6151b7b931d9c9e3b2a52a48d9bcebc595 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -103,6 +103,8 @@ ber_put_len( BerElement *ber, unsigned long len, int nosos ) long mask; unsigned long netlen; + assert( ber != NULL ); + /* * short len if it's less than 128 - one byte giving the len, * with bit 8 0. @@ -151,6 +153,8 @@ ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag ) int len, lenlen; long netnum, mask; + assert( ber != NULL ); + sign = (num < 0); /* @@ -199,6 +203,8 @@ ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag ) int ber_put_enum( BerElement *ber, long num, unsigned long tag ) { + assert( ber != NULL ); + if ( tag == LBER_DEFAULT ) tag = LBER_ENUMERATED; @@ -208,6 +214,8 @@ ber_put_enum( BerElement *ber, long num, unsigned long tag ) int ber_put_int( BerElement *ber, long num, unsigned long tag ) { + assert( ber != NULL ); + if ( tag == LBER_DEFAULT ) tag = LBER_INTEGER; @@ -215,7 +223,10 @@ ber_put_int( BerElement *ber, long num, unsigned long tag ) } int -ber_put_ostring( BerElement *ber, char *str, unsigned long len, +ber_put_ostring( + BerElement *ber, + LDAP_CONST char *str, + unsigned long len, unsigned long tag ) { int taglen, lenlen, rc; @@ -223,6 +234,9 @@ ber_put_ostring( BerElement *ber, char *str, unsigned long len, int free_str; #endif /* STR_TRANSLATION */ + assert( ber != NULL ); + assert( str != NULL ); + if ( tag == LBER_DEFAULT ) tag = LBER_OCTETSTRING; @@ -258,20 +272,47 @@ ber_put_ostring( BerElement *ber, char *str, unsigned long len, return( rc ); } +int +ber_put_berval( + BerElement *ber, + LDAP_CONST struct berval *bv, + unsigned long tag ) +{ + assert( ber != NULL ); + assert( bv != NULL ); + + if( bv == NULL ) { + return -1; + } + + return ber_put_ostring( ber, bv->bv_val, bv->bv_len, tag ); +} int -ber_put_string( BerElement *ber, char *str, unsigned long tag ) +ber_put_string( + BerElement *ber, + LDAP_CONST char *str, + unsigned long tag ) { + assert( ber != NULL ); + assert( str != NULL ); + return( ber_put_ostring( ber, str, strlen( str ), tag )); } int -ber_put_bitstring( BerElement *ber, char *str, - unsigned long blen /* in bits */, unsigned long tag ) +ber_put_bitstring( + BerElement *ber, + LDAP_CONST char *str, + unsigned long blen /* in bits */, + unsigned long tag ) { int taglen, lenlen, len; unsigned char unusedbits; + assert( ber != NULL ); + assert( str != NULL ); + if ( tag == LBER_DEFAULT ) tag = LBER_BITSTRING; @@ -317,6 +358,8 @@ ber_put_boolean( BerElement *ber, int boolval, unsigned long tag ) unsigned char trueval = 0xff; unsigned char falseval = 0x00; + assert( ber != NULL ); + if ( tag == LBER_DEFAULT ) tag = LBER_BOOLEAN; @@ -340,6 +383,8 @@ ber_start_seqorset( BerElement *ber, unsigned long tag ) { Seqorset *new; + assert( ber != NULL ); + if ( (new = (Seqorset *) calloc( sizeof(Seqorset), 1 )) == NULLSEQORSET ) return( -1 ); @@ -362,6 +407,8 @@ ber_start_seqorset( BerElement *ber, unsigned long tag ) int ber_start_seq( BerElement *ber, unsigned long tag ) { + assert( ber != NULL ); + if ( tag == LBER_DEFAULT ) tag = LBER_SEQUENCE; @@ -371,6 +418,8 @@ ber_start_seq( BerElement *ber, unsigned long tag ) int ber_start_set( BerElement *ber, unsigned long tag ) { + assert( ber != NULL ); + if ( tag == LBER_DEFAULT ) tag = LBER_SET; @@ -386,6 +435,8 @@ ber_put_seqorset( BerElement *ber ) Seqorset *next; Seqorset **sos = &ber->ber_sos; + assert( ber != NULL ); + /* * If this is the toplevel sequence or set, we need to actually * write the stuff out. Otherwise, it's already been put in @@ -496,12 +547,14 @@ ber_put_seqorset( BerElement *ber ) int ber_put_seq( BerElement *ber ) { + assert( ber != NULL ); return( ber_put_seqorset( ber ) ); } int ber_put_set( BerElement *ber ) { + assert( ber != NULL ); return( ber_put_seqorset( ber ) ); } @@ -509,7 +562,9 @@ ber_put_set( BerElement *ber ) int ber_printf #ifdef HAVE_STDARG - ( BerElement *ber, char *fmt, ... ) + ( BerElement *ber, + LDAP_CONST char *fmt, + ... ) #else ( va_alist ) va_dcl @@ -521,7 +576,7 @@ va_dcl char *fmt; #endif char *s, **ss; - struct berval **bv; + struct berval *bv, **bvp; int rc, i; unsigned long len; @@ -533,8 +588,21 @@ va_dcl fmt = va_arg( ap, char * ); #endif + assert( ber != NULL ); + assert( fmt != NULL ); + for ( rc = 0; *fmt && rc != -1; fmt++ ) { switch ( *fmt ) { + case '!': { /* hook */ + BEREncodeCallback *f; + void *p; + + f = va_arg( ap, BEREncodeCallback * ); + p = va_arg( ap, void * ); + + rc = (*f)( ber, p ); + } break; + case 'b': /* boolean */ i = va_arg( ap, int ); rc = ber_put_boolean( ber, i, ber->ber_tag ); @@ -560,6 +628,12 @@ va_dcl rc = ber_put_ostring( ber, s, len, ber->ber_tag ); break; + case 'O': /* berval octet string */ + bv = va_arg( ap, struct berval * ); + if( bv == NULL ) break; + rc = ber_put_berval( ber, bv, ber->ber_tag ); + break; + case 's': /* string */ s = va_arg( ap, char * ); rc = ber_put_string( ber, s, ber->ber_tag ); @@ -587,11 +661,11 @@ va_dcl break; case 'V': /* sequences of strings + lengths */ - if ( (bv = va_arg( ap, struct berval ** )) == NULL ) + if ( (bvp = va_arg( ap, struct berval ** )) == NULL ) break; - for ( i = 0; bv[i] != NULL; i++ ) { - if ( (rc = ber_put_ostring( ber, bv[i]->bv_val, - bv[i]->bv_len, ber->ber_tag )) == -1 ) + for ( i = 0; bvp[i] != NULL; i++ ) { + if ( (rc = ber_put_ostring( ber, bvp[i]->bv_val, + bvp[i]->bv_len, ber->ber_tag )) == -1 ) break; } break; @@ -614,7 +688,7 @@ va_dcl default: if( ber->ber_debug ) { - lber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug, + ber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug, "ber_printf: unknown fmt %c\n", *fmt ); } rc = -1; diff --git a/libraries/liblber/etest.c b/libraries/liblber/etest.c index 3e8ff55ced81b6f1540e07b81d9be23b86813e92..66ae72d585204741647835d737f47a81ecce426f 100644 --- a/libraries/liblber/etest.c +++ b/libraries/liblber/etest.c @@ -35,7 +35,7 @@ main( int argc, char **argv ) char *s, *p; #endif int fd, num; - Seqorset *sos = NULLSEQORSET; + Seqorset *sos = NULL; BerElement *ber; Sockbuf *sb; @@ -58,24 +58,26 @@ main( int argc, char **argv ) fd = fileno(stdout); #endif /* MACOS */ - sb = lber_pvt_sb_alloc_fd( fd ); + sb = ber_sockbuf_alloc_fd( fd); - if ( (ber = ber_alloc()) == NULLBER ) { + if( sb == NULL ) { + perror( "lber_sockbuf_alloc_fd" ); + exit( 1 ); + } + + if ( (ber = ber_alloc_t( LBER_USE_DER )) == NULL ) { perror( "ber_alloc" ); exit( 1 ); } +#ifndef notdef num = 7; if ( ber_printf( ber, "{ti}", 0x1f44, num ) == -1 ) { fprintf( stderr, "ber_printf returns -1" ); exit( 1 ); } - if ( ber_flush( sb, ber, 1 ) == -1 ) { - perror( "ber_flush" ); - exit( 1 ); - } -#ifdef notdef +#else for ( s = argv[1]; *s; s++ ) { if ( fgets( buf, sizeof(buf), stdin ) == NULL ) break; @@ -168,9 +170,13 @@ main( int argc, char **argv ) } } } - #endif - lber_pvt_sb_free( sb ); + if ( ber_flush( sb, ber, 1 ) == -1 ) { + perror( "ber_flush" ); + exit( 1 ); + } + + ber_sockbuf_free( sb ); return( 0 ); } diff --git a/libraries/liblber/etest.dsp b/libraries/liblber/etest.dsp index 521024a3004e0f28749f6c4f830c9fd628d0de0b..1dab68a7b883a349449d808f07e5fea59bd81180 100644 --- a/libraries/liblber/etest.dsp +++ b/libraries/liblber/etest.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=etest - Win32 Debug +CFG=etest - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=etest - Win32 Debug !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 "etest.mak" CFG="etest - Win32 Debug" +!MESSAGE NMAKE /f "etest.mak" CFG="etest - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "etest - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "etest - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "etest - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "etest - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -36,12 +40,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release\etest" +# PROP Output_Dir "..\Release" # PROP Intermediate_Dir "Release\etest" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -49,7 +53,7 @@ BSC32=bscmake.exe # 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 /subsystem:console /machine:I386 -# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" !ELSEIF "$(CFG)" == "etest - Win32 Debug" @@ -60,12 +64,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug\etest" +# PROP Output_Dir "..\Debug" # PROP Intermediate_Dir "Debug\etest" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -73,7 +77,57 @@ BSC32=bscmake.exe # 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 /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" + +!ELSEIF "$(CFG)" == "etest - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "etest___" +# PROP BASE Intermediate_Dir "etest___" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\etest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug" + +!ELSEIF "$(CFG)" == "etest - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "etest__0" +# PROP BASE Intermediate_Dir "etest__0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\etest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease" !ENDIF @@ -81,6 +135,8 @@ LINK32=link.exe # Name "etest - Win32 Release" # Name "etest - Win32 Debug" +# Name "etest - Win32 Single Debug" +# Name "etest - Win32 Single Release" # Begin Source File SOURCE=.\etest.c diff --git a/libraries/liblber/idtest.c b/libraries/liblber/idtest.c index 6a5f9b2ed350b6e361d9184d47f103b48e51f261..cc747152c3376878f2b9d69757c1401506e0bed6 100644 --- a/libraries/liblber/idtest.c +++ b/libraries/liblber/idtest.c @@ -18,6 +18,7 @@ #include "portable.h" #include <stdio.h> +#include <stdlib.h> #ifdef HAVE_PSAP_H #include <psap.h> @@ -67,6 +68,6 @@ main( int argc, char **argv ) exit( 0 ); #else fprintf(stderr, "requires ISODE X.500 distribution.\n"); - exit( 1 ); + return( EXIT_FAILURE ); #endif } diff --git a/libraries/liblber/idtest.dsp b/libraries/liblber/idtest.dsp index 2d49b3a765fe16ac418b38b755bc91d63611bdc2..043fe4269b1dd34d93705ca3e0b0babdbdb8621a 100644 --- a/libraries/liblber/idtest.dsp +++ b/libraries/liblber/idtest.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=idtest - Win32 Debug +CFG=idtest - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=idtest - Win32 Debug !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 "idtest.mak" CFG="idtest - Win32 Debug" +!MESSAGE NMAKE /f "idtest.mak" CFG="idtest - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "idtest - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "idtest - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "idtest - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "idtest - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -36,12 +40,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release\idtest" +# PROP Output_Dir "..\Release" # PROP Intermediate_Dir "Release\idtest" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -49,7 +53,7 @@ BSC32=bscmake.exe # 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 /subsystem:console /machine:I386 -# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" !ELSEIF "$(CFG)" == "idtest - Win32 Debug" @@ -60,12 +64,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug\idtest" +# PROP Output_Dir "..\Debug" # PROP Intermediate_Dir "Debug\idtest" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -73,7 +77,57 @@ BSC32=bscmake.exe # 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 /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" + +!ELSEIF "$(CFG)" == "idtest - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "idtest__" +# PROP BASE Intermediate_Dir "idtest__" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\idtest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug" + +!ELSEIF "$(CFG)" == "idtest - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "idtest_0" +# PROP BASE Intermediate_Dir "idtest_0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\idtest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease" !ENDIF @@ -81,6 +135,8 @@ LINK32=link.exe # Name "idtest - Win32 Release" # Name "idtest - Win32 Debug" +# Name "idtest - Win32 Single Debug" +# Name "idtest - Win32 Single Release" # Begin Source File SOURCE=.\idtest.c diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 085f1a9bc599a93560e67397bf061116f0a3d4b5..31e872c647af420cdfa50f842afbf807adbccea4 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -51,8 +51,11 @@ BerRead( Sockbuf *sb, char *buf, long len ) int c; long nread = 0; + assert( sb != NULL ); + assert( buf != NULL ); + while ( len > 0 ) { - if ( (c = lber_pvt_sb_read( sb, buf, len )) <= 0 ) { + if ( (c = ber_pvt_sb_read( sb, buf, len )) <= 0 ) { if ( nread > 0 ) break; return( c ); @@ -70,6 +73,9 @@ ber_read( BerElement *ber, char *buf, unsigned long len ) { unsigned long actuallen, nleft; + assert( ber != NULL ); + assert( buf != NULL ); + nleft = ber->ber_end - ber->ber_ptr; actuallen = nleft < len ? nleft : len; @@ -81,8 +87,15 @@ ber_read( BerElement *ber, char *buf, unsigned long len ) } long -ber_write( BerElement *ber, char *buf, unsigned long len, int nosos ) +ber_write( + BerElement *ber, + LDAP_CONST char *buf, + unsigned long len, + int nosos ) { + assert( ber != NULL ); + assert( buf != NULL ); + if ( nosos || ber->ber_sos == NULL ) { if ( ber->ber_ptr + len > ber->ber_end ) { if ( ber_realloc( ber, len ) != 0 ) @@ -111,6 +124,9 @@ ber_realloc( BerElement *ber, unsigned long len ) long off; char *oldbuf; + assert( ber != NULL ); + assert( len > 0 ); + have = (ber->ber_end - ber->ber_buf) / EXBUFSIZ; need = (len < EXBUFSIZ ? 1 : (len + (EXBUFSIZ - 1)) / EXBUFSIZ); total = have * EXBUFSIZ + need * EXBUFSIZ; @@ -150,6 +166,8 @@ ber_realloc( BerElement *ber, unsigned long len ) void ber_free( BerElement *ber, int freebuf ) { + assert( ber != NULL ); + if ( freebuf && ber->ber_buf != NULL ) free( ber->ber_buf ); ber->ber_buf = NULL; @@ -161,17 +179,20 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) { long nwritten, towrite, rc; + assert( sb != NULL ); + assert( ber != NULL ); + if ( ber->ber_rwptr == NULL ) { ber->ber_rwptr = ber->ber_buf; } towrite = ber->ber_ptr - ber->ber_rwptr; if ( sb->sb_debug ) { - lber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug, + ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug, "ber_flush: %ld bytes to sd %ld%s\n", towrite, (long) sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)" : "" ); - lber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug, + ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug, ber->ber_rwptr, towrite ); } @@ -186,7 +207,7 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit ) nwritten = 0; do { - rc = lber_pvt_sb_write( sb, ber->ber_rwptr, towrite ); + rc = ber_pvt_sb_write( sb, ber->ber_rwptr, towrite ); if (rc<=0) { return -1; } @@ -206,11 +227,14 @@ ber_alloc_t( int options ) { BerElement *ber; - if ( (ber = (BerElement *) calloc( 1, sizeof(BerElement) )) == NULLBER ) + ber = (BerElement *) calloc( 1, sizeof(BerElement) ); + + if ( ber == NULLBER ) return( NULLBER ); + ber->ber_tag = LBER_DEFAULT; ber->ber_options = options; - ber->ber_debug = lber_int_debug; + ber->ber_debug = ber_int_debug; return( ber ); } @@ -228,12 +252,14 @@ der_alloc( void ) } BerElement * -ber_dup( BerElement *ber ) +ber_dup( LDAP_CONST BerElement *ber ) { BerElement *new; - if ( (new = ber_alloc()) == NULLBER ) - return( NULLBER ); + assert( ber != NULL ); + + if ( (new = ber_alloc()) == NULL ) + return( NULL ); *new = *ber; @@ -245,6 +271,8 @@ ber_dup( BerElement *ber ) void ber_init_w_nullc( BerElement *ber, int options ) { + assert( ber != NULL ); + (void) memset( (char *)ber, '\0', sizeof( BerElement )); ber->ber_tag = LBER_DEFAULT; ber->ber_options = (char) options; @@ -259,6 +287,8 @@ ber_init( struct berval *bv ) { BerElement *ber; + assert( bv != NULL ); + if ( bv == NULL ) { return NULL; } @@ -288,11 +318,13 @@ ber_init( struct berval *bv ) ** the returned berval. */ int ber_flatten( - BerElement *ber, + LDAP_CONST BerElement *ber, struct berval **bvPtr) { struct berval *bv; + assert( bvPtr != NULL ); + if(bvPtr == NULL) { return( -1 ); } @@ -327,6 +359,8 @@ int ber_flatten( void ber_reset( BerElement *ber, int was_writing ) { + assert( ber != NULL ); + if ( was_writing ) { ber->ber_end = ber->ber_ptr; ber->ber_ptr = ber->ber_buf; @@ -347,7 +381,9 @@ get_tag( Sockbuf *sb ) char *tagp; unsigned int i; - if ( lber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 ) + assert( sb != NULL ); + + if ( ber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 ) return( LBER_DEFAULT ); if ( (xbyte & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK ) @@ -356,7 +392,7 @@ get_tag( Sockbuf *sb ) tagp = (char *) &tag; tagp[0] = xbyte; for ( i = 1; i < sizeof(long); i++ ) { - if ( lber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 ) + if ( ber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 ) return( LBER_DEFAULT ); tagp[i] = xbyte; @@ -375,7 +411,7 @@ get_tag( Sockbuf *sb ) #endif /* - * A rewrite of get_get_next that can safely be called multiple times + * A rewrite of ber_get_next that can safely be called multiple times * for the same packet. It will simply continue were it stopped until * a full packet is read. */ @@ -383,8 +419,12 @@ get_tag( Sockbuf *sb ) unsigned long ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber ) { + assert( sb != NULL ); + assert( len != NULL ); + assert( ber != NULL ); + if ( ber->ber_debug ) { - lber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, + ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, "ber_get_next\n" ); } @@ -411,7 +451,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber ) if (PTR_IN_VAR(ber->ber_rwptr, ber->ber_tag)) { if (ber->ber_rwptr == (char *) &ber->ber_tag) { - if (lber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0) + if (ber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0) return LBER_DEFAULT; if ((ber->ber_rwptr[0] & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK) { @@ -423,7 +463,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber ) } do { /* reading the tag... */ - if (lber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0) + if (ber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0) return LBER_DEFAULT; if (! (ber->ber_rwptr[0] & LBER_MORE_TAG_MASK) ) { ber->ber_tag>>=sizeof(ber->ber_tag) - @@ -438,7 +478,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber ) get_lenbyte: if (ber->ber_rwptr==(char *) &ber->ber_usertag) { unsigned char c; - if (lber_pvt_sb_read( sb, (char *) &c, 1)<=0) + if (ber_pvt_sb_read( sb, (char *) &c, 1)<=0) return LBER_DEFAULT; if (c & 0x80) { int len = c & 0x7f; @@ -460,7 +500,7 @@ get_lenbyte: to_go = (char *) &ber->ber_len + sizeof( ber->ber_len ) - ber->ber_rwptr; assert( to_go > 0 ); - res = lber_pvt_sb_read( sb, ber->ber_rwptr, to_go ); + res = ber_pvt_sb_read( sb, ber->ber_rwptr, to_go ); if (res <=0) return LBER_DEFAULT; ber->ber_rwptr += res; @@ -498,7 +538,7 @@ fill_buffer: to_go = ber->ber_end - ber->ber_rwptr; assert( to_go > 0 ); - res = lber_pvt_sb_read( sb, ber->ber_rwptr, to_go ); + res = ber_pvt_sb_read( sb, ber->ber_rwptr, to_go ); if (res<=0) return LBER_DEFAULT; ber->ber_rwptr+=res; @@ -515,10 +555,10 @@ fill_buffer: ber->ber_rwptr = NULL; *len = ber->ber_len; if ( ber->ber_debug ) { - lber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, + ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug, "ber_get_next: tag 0x%lx len %ld contents:\n", ber->ber_tag, ber->ber_len ); - lber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 ); + ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 ); } return (ber->ber_tag); } @@ -528,6 +568,8 @@ fill_buffer: void ber_clear( BerElement *ber, int freebuf ) { + assert( ber != NULL ); + if ((freebuf) && (ber->ber_buf)) free( ber->ber_buf ); ber->ber_buf = NULL; @@ -535,34 +577,3 @@ void ber_clear( BerElement *ber, int freebuf ) ber->ber_end = NULL; } -Sockbuf *lber_pvt_sb_alloc( void ) -{ - Sockbuf *sb = calloc(1, sizeof(Sockbuf)); - lber_pvt_sb_init( sb ); - return sb; -} - -Sockbuf *lber_pvt_sb_alloc_fd( int fd ) -{ - Sockbuf *sb = lber_pvt_sb_alloc(); - lber_pvt_sb_set_desc( sb, fd ); - lber_pvt_sb_set_io( sb, &lber_pvt_sb_io_tcp, NULL ); - return sb; -} - -void lber_pvt_sb_free( Sockbuf *sb ) -{ - if(sb == NULL) return; - lber_pvt_sb_destroy( sb ); - free(sb); -} - -int lber_pvt_sb_get_option( Sockbuf *sb, int opt, void *outvalue ) -{ - return LBER_OPT_ERROR; -} - -int lber_pvt_sb_set_option( Sockbuf *sb, int opt, void *invalue ) -{ - return LBER_OPT_ERROR; -} diff --git a/libraries/liblber/lber-int.h b/libraries/liblber/lber-int.h index c9b9b29d532c315f81009e3057e1e0a15bcb67c8..2d5847e204cffec3bf643e1527f0e32132ff7f39 100644 --- a/libraries/liblber/lber-int.h +++ b/libraries/liblber/lber-int.h @@ -23,8 +23,8 @@ LDAP_BEGIN_DECL -extern int lber_int_debug; -#define lber_log_printf lber_pvt_log_printf +extern int ber_int_debug; +#define ber_log_printf ber_pvt_log_printf struct lber_options { short lbo_item_type; @@ -88,15 +88,15 @@ typedef struct sockbuf_io Sockbuf_IO; typedef struct sockbuf_sec Sockbuf_Sec; typedef struct sockbuf_buf Sockbuf_Buf; -#define lber_pvt_sb_get_desc( sb ) ((sb)->sb_sd) -#define lber_pvt_sb_set_desc( sb, val ) ((sb)->sb_sd =(val)) -#define lber_pvt_sb_in_use( sb ) ((sb)->sb_sd!=-1) +#define ber_pvt_sb_get_desc( sb ) ((sb)->sb_sd) +#define ber_pvt_sb_set_desc( sb, val ) ((sb)->sb_sd =(val)) +#define ber_pvt_sb_in_use( sb ) ((sb)->sb_sd!=-1) #ifdef USE_SASL -#define lber_pvt_sb_data_ready( sb ) \ +#define ber_pvt_sb_data_ready( sb ) \ (((sb)->sb_buf_ready) || ((sb)->sb_trans_ready) || ((sb)->sb_sec_ready)) #else -#define lber_pvt_sb_data_ready( sb ) \ +#define ber_pvt_sb_data_ready( sb ) \ (((sb)->sb_buf_ready) || ((sb)->sb_trans_ready)) #endif @@ -154,50 +154,70 @@ struct seqorset { /* * bprint.c */ -LDAP_F int lber_log_bprint LDAP_P(( +LDAP_F( int ) +ber_log_bprint LDAP_P(( int errlvl, int loglvl, - char *data, + const char *data, int len )); -LDAP_F int lber_log_dump LDAP_P(( +LDAP_F( int ) +ber_log_dump LDAP_P(( int errlvl, int loglvl, - BerElement *ber, + const BerElement *ber, int inout )); -LDAP_F int lber_log_sos_dump LDAP_P(( +LDAP_F( int ) +ber_log_sos_dump LDAP_P(( int errlvl, int loglvl, - Seqorset *sos )); - -/* io.c */ -LDAP_F Sockbuf *lber_pvt_sb_alloc LDAP_P(( void )); -LDAP_F Sockbuf *lber_pvt_sb_alloc_fd LDAP_P(( int )); -LDAP_F Sockbuf *lber_pvt_sb_alloc_fd LDAP_P(( int )); -LDAP_F void lber_pvt_sb_free LDAP_P(( Sockbuf * )); -LDAP_F int lber_pvt_sb_get_option LDAP_P(( Sockbuf *, int, void * )); -LDAP_F int lber_pvt_sb_set_option LDAP_P(( Sockbuf *, int, void * )); + const Seqorset *sos )); /* sockbuf.c */ -LDAP_F int lber_pvt_sb_init LDAP_P(( Sockbuf *sb )); -LDAP_F int lber_pvt_sb_destroy LDAP_P(( Sockbuf *sb )); +LDAP_F( int ) +ber_pvt_sb_init LDAP_P(( Sockbuf *sb )); + +LDAP_F( int ) +ber_pvt_sb_destroy LDAP_P(( Sockbuf *sb )); #ifdef USE_SASL -LDAP_F int lber_pvt_sb_set_sec LDAP_P(( Sockbuf *sb, Sockbuf_Sec *sec, void *arg )); -LDAP_F int lber_pvt_sb_clear_sec LDAP_P(( Sockbuf *sb )); + +LDAP_F( int ) +ber_pvt_sb_set_sec LDAP_P(( Sockbuf *sb, Sockbuf_Sec *sec, void *arg )); + +LDAP_F( int ) +ber_pvt_sb_clear_sec LDAP_P(( Sockbuf *sb )); #endif -LDAP_F int lber_pvt_sb_set_io LDAP_P(( Sockbuf *sb, Sockbuf_IO *layer, void *arg )); -LDAP_F int lber_pvt_sb_clear_io LDAP_P(( Sockbuf *sb )); -LDAP_F int lber_pvt_sb_close LDAP_P((Sockbuf *sb )); -LDAP_F int lber_pvt_sb_set_nonblock LDAP_P(( Sockbuf *sb, int nb )); -LDAP_F int lber_pvt_sb_set_readahead LDAP_P(( Sockbuf *sb, int rh )); -LDAP_F long lber_pvt_sb_read LDAP_P(( Sockbuf *sb, void *buf, long len )); -LDAP_F long lber_pvt_sb_write LDAP_P(( Sockbuf *sb, void *buf, long len )); -LDAP_F int lber_pvt_sb_udp_set_dst LDAP_P((Sockbuf *sb, void *addr )); -LDAP_F void *lber_pvt_sb_udp_get_src LDAP_P((Sockbuf *sb )); - -extern Sockbuf_IO lber_pvt_sb_io_tcp; -extern Sockbuf_IO lber_pvt_sb_io_udp; + +LDAP_F( int ) +ber_pvt_sb_set_io LDAP_P(( Sockbuf *sb, Sockbuf_IO *layer, void *arg )); + +LDAP_F( int ) +ber_pvt_sb_clear_io LDAP_P(( Sockbuf *sb )); + +LDAP_F( int ) +ber_pvt_sb_close LDAP_P((Sockbuf *sb )); + +LDAP_F( int ) +ber_pvt_sb_set_nonblock LDAP_P(( Sockbuf *sb, int nb )); + +LDAP_F( int ) +ber_pvt_sb_set_readahead LDAP_P(( Sockbuf *sb, int rh )); + +LDAP_F( long ) +ber_pvt_sb_read LDAP_P(( Sockbuf *sb, void *buf, long len )); + +LDAP_F( long ) +ber_pvt_sb_write LDAP_P(( Sockbuf *sb, void *buf, long len )); + +LDAP_F( int ) +ber_pvt_sb_udp_set_dst LDAP_P((Sockbuf *sb, void *addr )); + +LDAP_F( void * ) +ber_pvt_sb_udp_get_src LDAP_P((Sockbuf *sb )); + +extern Sockbuf_IO ber_pvt_sb_io_tcp; +extern Sockbuf_IO ber_pvt_sb_io_udp; #endif /* _LBER_INT_H */ diff --git a/libraries/liblber/liblber.dsp b/libraries/liblber/liblber.dsp index 07df76cb765698f9f6cafb3b7e8c1403e5b8ff87..ceaf8ca80e6ec055bba6d58b1d2d2cd7184d6698 100644 --- a/libraries/liblber/liblber.dsp +++ b/libraries/liblber/liblber.dsp @@ -42,7 +42,7 @@ CPP=cl.exe # PROP Intermediate_Dir "Release\liblber" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -80,8 +80,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "liblber_" -# PROP Intermediate_Dir "liblber_" +# PROP Output_Dir "..\Sdebug" +# PROP Intermediate_Dir "SDebug\liblber" # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c # ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c @@ -101,11 +101,11 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "liblber0" -# PROP Intermediate_Dir "liblber0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\liblber" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -151,26 +151,10 @@ SOURCE=..\..\include\lber_pvt.h # End Source File # Begin Source File -SOURCE=..\..\include\ldap_cdefs.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\ldap_features.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\ldap_log.h -# End Source File -# Begin Source File - SOURCE=.\options.c # End Source File # Begin Source File -SOURCE=..\..\include\portable.h -# End Source File -# Begin Source File - SOURCE=.\sockbuf.c # End Source File # End Target diff --git a/libraries/liblber/options.c b/libraries/liblber/options.c index 6bdacc6bfcd4943fe0c6d93528901ae7341df82e..4546861619dc8b2e4551e740be95f269d789271c 100644 --- a/libraries/liblber/options.c +++ b/libraries/liblber/options.c @@ -8,10 +8,10 @@ #include "lber-int.h" -int lber_int_debug = 0; +int ber_int_debug = 0; int -lber_get_option( +ber_get_option( void *item, int option, void *outvalue) @@ -26,7 +26,7 @@ lber_get_option( if(item == NULL) { if(option == LBER_OPT_BER_DEBUG) { - * (int *) outvalue = lber_int_debug; + * (int *) outvalue = ber_int_debug; return LBER_OPT_SUCCESS; } @@ -54,7 +54,7 @@ lber_get_option( } int -lber_set_option( +ber_set_option( void *item, int option, void *invalue) @@ -69,11 +69,11 @@ lber_set_option( if(item == NULL) { if(option == LBER_OPT_BER_DEBUG) { - lber_int_debug = * (int *) invalue; + ber_int_debug = * (int *) invalue; return LBER_OPT_SUCCESS; } else if(option == LBER_OPT_LOG_PRINT_FN) { - lber_pvt_log_print = (BER_LOG_PRINT_FN) invalue; + ber_pvt_log_print = (BER_LOG_PRINT_FN) invalue; return LBER_OPT_SUCCESS; } diff --git a/libraries/liblber/sockbuf.c b/libraries/liblber/sockbuf.c index 8f2696d9498b832138a310cab33975346d426cfb..af6bbaef40fec1bb91f8e583ce4ef817f427a703 100644 --- a/libraries/liblber/sockbuf.c +++ b/libraries/liblber/sockbuf.c @@ -45,7 +45,7 @@ static long have_no_read( Sockbuf *sb, void *buf, long len ); static long have_no_write( Sockbuf *sb, void *buf, long len ); static int have_no_close( Sockbuf *sb ); -static Sockbuf_IO lber_pvt_sb_IO_None= +static Sockbuf_IO sb_IO_None= { NULL, /* sbi_setup */ NULL, /* sbi_release */ @@ -57,6 +57,8 @@ static Sockbuf_IO lber_pvt_sb_IO_None= static void update_status( Sockbuf *sb ) { + assert( sb != NULL ); + sb->sb_buf_ready = (sb->sb_buf.buf_ptr < sb->sb_buf.buf_end); #ifdef USE_SASL sb->sb_sec_ready = ((sb->sb_sec_buf_in.buf_end!=0) && @@ -69,9 +71,16 @@ update_status( Sockbuf *sb ) static int status_is_ok( Sockbuf *sb ) { - int obr = sb->sb_buf_ready; + int obr; +#ifdef USE_SASL + int osr; +#endif + + assert( sb != NULL ); + + obr = sb->sb_buf_ready; #ifdef USE_SASL - int osr = sb->sb_sec_ready; + osr = sb->sb_sec_ready; #endif update_status(sb); @@ -92,6 +101,9 @@ static long packet_length( char *buf ) { long size; + + assert( buf != NULL ); + size = (((unsigned long)buf[0])<<24)| (((unsigned long)buf[1])<<16)| (((unsigned long)buf[2])<<8)| @@ -112,9 +124,11 @@ packet_length( char *buf ) static int grow_buffer( Sockbuf_Buf * buf, long minsize ) { - long pw=MIN_BUF_SIZE; + long pw;; - for(;(pw<minsize);pw<<=1) { + assert( buf != NULL ); + + for( pw=MIN_BUF_SIZE; pw<minsize; pw<<=1 ) { if (pw > MAX_BUF_SIZE) { /* this could mean that somebody is trying to crash us. */ return -1; @@ -161,6 +175,9 @@ sockbuf_sec_release( Sockbuf *sb, char *buf, long len ) char *end; long size; + assert( buf != NULL ); + assert( sb != NULL ); + assert( sb->sb_sec ); assert( sb->sb_sec->sbs_release ); assert( sb->sb_sec_buf_in.sb_ptr >= sb->sb_sec_buf_in.sb_end ); @@ -237,6 +254,9 @@ sockbuf_sec_protect( Sockbuf *sb, char *buf, long len ) long blen; long total; + assert( buf != NULL ); + + assert( sb != NULL ); assert( sb->sb_sec_out.buf_end == 0 ); assert( sb->sb_sec_out.buf_ptr == 0 ); @@ -279,7 +299,12 @@ static long sockbuf_copy_out( Sockbuf *sb, char **buf, long len ) { long blen = (sb->sb_buf.buf_end - sb->sb_buf.buf_ptr ); + + assert( buf != NULL ); + + assert( sb != NULL ); assert( status_is_ok(sb) ); + if (blen) { long rlen = (blen<len) ? blen : len; memcpy( *buf, sb->sb_buf.buf_base + sb->sb_buf.buf_ptr, rlen ); @@ -297,17 +322,46 @@ sockbuf_copy_out( Sockbuf *sb, char **buf, long len ) return len; } +Sockbuf *ber_sockbuf_alloc( void ) +{ + Sockbuf *sb = calloc(1, sizeof(Sockbuf)); + + if( sb == NULL ) return NULL; + + ber_pvt_sb_init( sb ); + return sb; +} + +Sockbuf *ber_sockbuf_alloc_fd( int fd ) +{ + Sockbuf *sb = ber_sockbuf_alloc(); + + if( sb == NULL ) return NULL; + + ber_pvt_sb_set_desc( sb, fd ); + ber_pvt_sb_set_io( sb, &ber_pvt_sb_io_tcp, NULL ); + return sb; +} + +void ber_sockbuf_free( Sockbuf *sb ) +{ + assert(sb != NULL); + ber_pvt_sb_destroy( sb ); + free(sb); +} long -lber_pvt_sb_read( Sockbuf *sb, void *buf_arg, long len ) +ber_pvt_sb_read( Sockbuf *sb, void *buf_arg, long len ) { char *buf; long ret; + assert( buf_arg != NULL ); + assert( sb != NULL ); assert( status_is_ok(sb) ); #if 0 - /* breaks slapd :-) */ - assert( lber_pvt_sb_in_use( sb ) ); + /* breaks slapd :-< */ + assert( ber_pvt_sb_in_use( sb ) ); #endif #ifdef TEST_PARTIAL_READ @@ -316,7 +370,8 @@ lber_pvt_sb_read( Sockbuf *sb, void *buf_arg, long len ) return -1; } - len = (rand() % len)+1; + if( len > 0 ) + len = (rand() % len)+1; #endif buf = (char *) buf_arg; @@ -461,6 +516,9 @@ do_return: long sockbuf_do_write( Sockbuf *sb ) { long to_go; + + assert( sb != NULL ); + to_go = sb->sb_sec_out.buf_end - sb->sb_sec_out.buf_ptr; assert( to_go > 0 ); /* there is something left of the last time... */ @@ -482,14 +540,14 @@ long sockbuf_do_write( Sockbuf *sb ) } #endif -long lber_pvt_sb_write( Sockbuf *sb, void *buf, long len_arg ) +long ber_pvt_sb_write( Sockbuf *sb, void *buf, long len_arg ) { long ret; long len = len_arg; assert( status_is_ok(sb) ); #if 0 /* unfortunately breaks slapd */ - assert( lber_pvt_sb_in_use( sb ) ); + assert( ber_pvt_sb_in_use( sb ) ); #endif #ifdef TEST_PARTIAL_WRITE if ((rand() & 3)==1) { /* 1 out of 4 */ @@ -540,22 +598,25 @@ long lber_pvt_sb_write( Sockbuf *sb, void *buf, long len_arg ) return ret; } -int lber_pvt_sb_close( Sockbuf *sb ) +int ber_pvt_sb_close( Sockbuf *sb ) { int ret; + + assert( sb != NULL ); assert( sb->sb_io ); assert( sb->sb_io->sbi_close ); assert( status_is_ok(sb) ); - assert( lber_pvt_sb_in_use( sb ) ); + assert( ber_pvt_sb_in_use( sb ) ); ret = sb->sb_io->sbi_close( sb ); - lber_pvt_sb_set_desc( sb, -1 ); + ber_pvt_sb_set_desc( sb, -1 ); return ret; } -int lber_pvt_sb_set_readahead( Sockbuf *sb, int rh ) +int ber_pvt_sb_set_readahead( Sockbuf *sb, int rh ) { + assert( sb != NULL ); assert( status_is_ok(sb) ); sb->sb_read_ahead = (rh!=0); return 0; @@ -563,8 +624,9 @@ int lber_pvt_sb_set_readahead( Sockbuf *sb, int rh ) #define USE_NONBLOCK #ifdef USE_NONBLOCK -int lber_pvt_sb_set_nonblock( Sockbuf *sb, int nb ) +int ber_pvt_sb_set_nonblock( Sockbuf *sb, int nb ) { + assert( sb != NULL ); assert( status_is_ok(sb) ); if (nb) { sb->sb_non_block = 1; @@ -577,16 +639,16 @@ int lber_pvt_sb_set_nonblock( Sockbuf *sb, int nb ) sb->sb_read_ahead = 0; #endif } - if (lber_pvt_sb_in_use(sb)) { + if (ber_pvt_sb_in_use(sb)) { #if HAVE_FCNTL - int flags = fcntl(lber_pvt_sb_get_desc(sb), F_GETFL); + int flags = fcntl(ber_pvt_sb_get_desc(sb), F_GETFL); flags |= O_NONBLOCK; - return fcntl(lber_pvt_sb_get_desc(sb), F_SETFL, flags); + return fcntl(ber_pvt_sb_get_desc(sb), F_SETFL, flags); #elif defined( FIONBIO ) /* WINSOCK requires the status to be a long */ ioctl_t status = (nb!=0); - return ioctl( lber_pvt_sb_get_desc(sb), FIONBIO, &status ); + return ioctl( ber_pvt_sb_get_desc(sb), FIONBIO, &status ); #endif /* FIONBIO */ } return 0; @@ -604,14 +666,18 @@ int lber_pvt_sb_set_nonblock( Sockbuf *sb, int nb ) static int sockbuf_buf_destroy( Sockbuf_Buf *buf ) { + assert( buf != NULL); + if (buf->buf_base) free( buf->buf_base ); sockbuf_buf_init( buf ); return 0; } -int lber_pvt_sb_init( Sockbuf *sb ) +int ber_pvt_sb_init( Sockbuf *sb ) { + assert( sb != NULL); + sb->sb_item_type=LBER_ITEM_SOCKBUF; sb->sb_options = 0; sb->sb_debug = 0; @@ -624,7 +690,7 @@ int lber_pvt_sb_init( Sockbuf *sb ) sb->sb_non_block = 0; sb->sb_fd = -1; sb->sb_iodata = NULL; - sb->sb_io = &lber_pvt_sb_IO_None; + sb->sb_io = &sb_IO_None; sb->sb_sd = -1; #ifdef DEADWOOD sb->sb_max_incoming = 0; @@ -640,22 +706,24 @@ int lber_pvt_sb_init( Sockbuf *sb ) return 0; } -int lber_pvt_sb_destroy( Sockbuf *sb ) +int ber_pvt_sb_destroy( Sockbuf *sb ) { + assert( sb != NULL); #ifdef USE_SASL - lber_pvt_sb_clear_sec(sb); + ber_pvt_sb_clear_sec(sb); sockbuf_buf_destroy( &(sb->sb_sec_buf_in) ); sockbuf_buf_destroy( &(sb->sb_sec_buf_out) ); #endif - lber_pvt_sb_clear_io(sb); + ber_pvt_sb_clear_io(sb); sockbuf_buf_destroy( &(sb->sb_buf) ); - return lber_pvt_sb_init( sb ); + return ber_pvt_sb_init( sb ); } #ifdef USE_SASL -int lber_pvt_sb_set_sec( Sockbuf *sb, Sockbuf_Sec * sec, void *arg ) +int ber_pvt_sb_set_sec( Sockbuf *sb, Sockbuf_Sec * sec, void *arg ) { int len; + assert( sb != NULL); if ((sb->sb_sec) || (sec==NULL)) return -1; @@ -681,8 +749,10 @@ int lber_pvt_sb_set_sec( Sockbuf *sb, Sockbuf_Sec * sec, void *arg ) return 0; } -int lber_pvt_sb_clear_sec( Sockbuf *sb ) +int ber_pvt_sb_clear_sec( Sockbuf *sb ) { + assert( sb != NULL); + if (sb->sb_buf.buf_ptr!=0) return -1; if (sb->sb_sec==NULL) @@ -710,9 +780,10 @@ int lber_pvt_sb_clear_sec( Sockbuf *sb ) } #endif -int lber_pvt_sb_set_io( Sockbuf *sb, Sockbuf_IO *trans, void *arg ) +int ber_pvt_sb_set_io( Sockbuf *sb, Sockbuf_IO *trans, void *arg ) { - assert( sb->sb_io == &lber_pvt_sb_IO_None ); + assert( sb != NULL); + assert( sb->sb_io == &sb_IO_None ); if (trans==NULL) return -1; @@ -725,15 +796,16 @@ int lber_pvt_sb_set_io( Sockbuf *sb, Sockbuf_IO *trans, void *arg ) return 0; } -int lber_pvt_sb_clear_io( Sockbuf *sb ) +int ber_pvt_sb_clear_io( Sockbuf *sb ) { - if (sb->sb_io==&lber_pvt_sb_IO_None) + assert( sb != NULL); + if (sb->sb_io==&sb_IO_None) return -1; if ((sb->sb_io->sbi_remove) && (sb->sb_io->sbi_remove( sb )<0)) return -1; - sb->sb_io = &lber_pvt_sb_IO_None; + sb->sb_io = &sb_IO_None; sb->sb_trans_ready = 0; @@ -747,11 +819,13 @@ int lber_pvt_sb_clear_io( Sockbuf *sb ) static long stream_read( Sockbuf *sb, void *buf, long len ) { + assert( sb != NULL); + #if defined(MACOS) /* * MacTCP/OpenTransport */ - return tcpread( lber_pvt_sb_get_desc(sb), 0, (unsigned char *)buf, + return tcpread( ber_pvt_sb_get_desc(sb), 0, (unsigned char *)buf, len, NULL ); #elif defined( HAVE_PCNFS ) || \ @@ -765,33 +839,36 @@ stream_read( Sockbuf *sb, void *buf, long len ) /* * 32-bit Windows Socket API (under Windows NT or Windows 95) */ + { int rc; - rc = recv( lber_pvt_sb_get_desc(sb), buf, len, 0 ); + rc = recv( ber_pvt_sb_get_desc(sb), buf, len, 0 ); #ifdef HAVE_WINSOCK if ( rc < 0 ) errno = WSAGetLastError(); #endif return rc; - + } #elif defined( HAVE_NCSA ) /* * NCSA Telnet TCP/IP stack (under DOS) */ - return nread( lber_pvt_sb_get_desc(sb), buf, len ); + return nread( ber_pvt_sb_get_desc(sb), buf, len ); #else - return read( lber_pvt_sb_get_desc(sb), buf, len ); + return read( ber_pvt_sb_get_desc(sb), buf, len ); #endif } static long stream_write( Sockbuf *sb, void *buf, long len ) { + assert( sb != NULL); + #if defined(MACOS) /* * MacTCP/OpenTransport */ #define MAX_WRITE 65535 - return tcpwrite( lber_pvt_sb_get_desc(sb), + return tcpwrite( ber_pvt_sb_get_desc(sb), (unsigned char *)(buf), (len<MAX_WRITE)? len : MAX_WRITE ); @@ -806,36 +883,40 @@ stream_write( Sockbuf *sb, void *buf, long len ) /* * 32-bit Windows Socket API (under Windows NT or Windows 95) */ + + { int rc; - rc = send( lber_pvt_sb_get_desc(sb), buf, len, 0 ); + rc = send( ber_pvt_sb_get_desc(sb), buf, len, 0 ); #ifdef HAVE_WINSOCK if ( rc < 0 ) errno = WSAGetLastError(); #endif return rc; + } #elif defined(HAVE_NCSA) - return netwrite( lber_pvt_sb_get_desc(sb), buf, len ); + return netwrite( ber_pvt_sb_get_desc(sb), buf, len ); #elif defined(VMS) /* * VMS -- each write must be 64K or smaller */ #define MAX_WRITE 65535 - return write( lber_pvt_sb_get_desc(sb), buf, + return write( ber_pvt_sb_get_desc(sb), buf, (len<MAX_WRITE)? len : MAX_WRITE); #else - return write( lber_pvt_sb_get_desc(sb), buf, len ); + return write( ber_pvt_sb_get_desc(sb), buf, len ); #endif } static int stream_close( Sockbuf *sb ) { - tcp_close( lber_pvt_sb_get_desc( sb ) ); + assert( sb != NULL); + tcp_close( ber_pvt_sb_get_desc( sb ) ); return 0; } -Sockbuf_IO lber_pvt_sb_io_tcp= +Sockbuf_IO ber_pvt_sb_io_tcp= { NULL, /* sbi_setup */ NULL, /* sbi_release */ @@ -857,6 +938,7 @@ struct dgram_data static int dgram_setup( Sockbuf *sb, void *arg ) { + assert( sb != NULL); sb->sb_iodata = malloc( sizeof( struct dgram_data ) ); if (sb->sb_iodata==NULL) return -1; @@ -867,6 +949,7 @@ dgram_setup( Sockbuf *sb, void *arg ) static int dgram_release( Sockbuf *sb ) { + assert( sb != NULL); free( sb->sb_iodata ); return 0; } @@ -879,17 +962,20 @@ dgram_read( Sockbuf *sb, void *buf, long len ) int addrlen; struct dgram_data *dd; + assert( sb != NULL ); + assert( buf != NULL ); + dd = (struct dgram_data *)(sb->sb_iodata); addrlen = sizeof( struct sockaddr ); - rc=recvfrom( lber_pvt_sb_get_desc(sb), buf, len, 0, &(dd->src), &addrlen ); + rc=recvfrom( ber_pvt_sb_get_desc(sb), buf, len, 0, &(dd->src), &addrlen ); if ( sb->sb_debug ) { - lber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug, + ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug, "dgram_read udp_read %d bytes\n", rc ); if ( rc > 0 ) - lber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug, + ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug, buf, rc ); } return rc; @@ -905,9 +991,12 @@ dgram_write( Sockbuf *sb, void *buf, long len ) int rc; struct dgram_data *dd; + assert( sb != NULL ); + assert( buf != NULL ); + dd = (struct dgram_data *)(sb->sb_iodata); - rc=sendto( lber_pvt_sb_get_desc(sb), buf, len, 0, &(dd->dst), + rc=sendto( ber_pvt_sb_get_desc(sb), buf, len, 0, &(dd->dst), sizeof( struct sockaddr ) ); if ( rc <= 0 ) @@ -929,11 +1018,13 @@ dgram_write( Sockbuf *sb, void *buf, long len ) static int dgram_close( Sockbuf *sb ) { - tcp_close( lber_pvt_sb_get_desc(sb) ); + assert( sb != NULL ); + + tcp_close( ber_pvt_sb_get_desc(sb) ); return 0; } -Sockbuf_IO lber_pvt_sb_io_udp= +Sockbuf_IO ber_pvt_sb_io_udp= { dgram_setup, /* sbi_setup */ dgram_release, /* sbi_release */ @@ -942,19 +1033,21 @@ Sockbuf_IO lber_pvt_sb_io_udp= dgram_close, /* sbi_close */ }; -int lber_pvt_sb_udp_set_dst(Sockbuf *sb, void *addr ) +int ber_pvt_sb_udp_set_dst(Sockbuf *sb, void *addr ) { struct dgram_data *dd; - assert( sb->sb_io == &lber_pvt_sb_io_udp ); + assert( sb != NULL ); + assert( sb->sb_io == &ber_pvt_sb_io_udp ); dd = (struct dgram_data *) (sb->sb_iodata); memcpy( &(dd->dst), addr, sizeof( struct sockaddr ) ); return 0; } -void *lber_pvt_sb_udp_get_src( Sockbuf *sb ) +void *ber_pvt_sb_udp_get_src( Sockbuf *sb ) { struct dgram_data *dd; - assert( sb->sb_io == &lber_pvt_sb_io_udp ); + assert( sb != NULL ); + assert( sb->sb_io == &ber_pvt_sb_io_udp ); dd = (struct dgram_data *) (sb->sb_iodata); return &(dd->src); } @@ -970,7 +1063,8 @@ void *lber_pvt_sb_udp_get_src( Sockbuf *sb ) static long have_no_read( Sockbuf *sb, void *buf, long len ) { - lber_log_printf( LDAP_DEBUG_ANY, lber_int_debug, + assert( sb != NULL ); + ber_log_printf( LDAP_DEBUG_ANY, ber_int_debug, "warning: reading from uninitialized sockbuf\n"); errno = EBADF; return -1; @@ -979,7 +1073,8 @@ have_no_read( Sockbuf *sb, void *buf, long len ) static long have_no_write( Sockbuf *sb, void *buf, long len ) { - lber_log_printf( LDAP_DEBUG_ANY, lber_int_debug, + assert( sb != NULL ); + ber_log_printf( LDAP_DEBUG_ANY, ber_int_debug, "warning: writing to uninitialized sockbuf\n"); errno = EBADF; return -1; @@ -988,6 +1083,7 @@ have_no_write( Sockbuf *sb, void *buf, long len ) static int have_no_close( Sockbuf *sb ) { + assert( sb != NULL ); assert( 0 ); return -1; } diff --git a/libraries/libldap/abandon.c b/libraries/libldap/abandon.c index 2fac95f770c667226d2e36a93ae5522c8e5a659c..b2b2b83009c7133e2642bf83760c1efc8de74426 100644 --- a/libraries/libldap/abandon.c +++ b/libraries/libldap/abandon.c @@ -20,10 +20,43 @@ #include "ldap-int.h" -static int do_abandon LDAP_P(( LDAP *ld, int origid, int msgid )); +static int do_abandon LDAP_P(( + LDAP *ld, + int origid, + int msgid, + LDAPControl **sctrls, + LDAPControl **cctrls)); /* - * ldap_abandon - perform an ldap (and X.500) abandon operation. Parameters: + * ldap_abandon_ext - perform an ldap extended abandon operation. + * + * Parameters: + * ld LDAP descriptor + * msgid The message id of the operation to abandon + * scntrls Server Controls + * ccntrls Client Controls + * + * ldap_abandon_ext returns a LDAP error code. + * (LDAP_SUCCESS if everything went ok) + * + * Example: + * ldap_abandon_ext( ld, msgid, scntrls, ccntrls ); + */ +int +ldap_abandon_ext( + LDAP *ld, + int msgid, + LDAPControl **sctrls, + LDAPControl **cctrls ) +{ + Debug( LDAP_DEBUG_TRACE, "ldap_abandon_ext %d\n", msgid, 0, 0 ); + + return do_abandon( ld, msgid, msgid, sctrls, cctrls ); +} + + +/* + * ldap_abandon - perform an ldap abandon operation. Parameters: * * ld LDAP descriptor * msgid The message id of the operation to abandon @@ -37,12 +70,18 @@ int ldap_abandon( LDAP *ld, int msgid ) { Debug( LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0 ); - return( do_abandon( ld, msgid, msgid )); + return do_abandon( ld, msgid, msgid, NULL, NULL ) == LDAP_SUCCESS + ? 0 : -1; } static int -do_abandon( LDAP *ld, int origid, int msgid ) +do_abandon( + LDAP *ld, + int origid, + int msgid, + LDAPControl **sctrls, + LDAPControl **cctrls) { BerElement *ber; int i, err, sendabandon; @@ -67,8 +106,9 @@ do_abandon( LDAP *ld, int origid, int msgid ) if ( lr->lr_msgid == msgid ) { /* this message */ break; } - if ( lr->lr_origid == msgid ) { /* child: abandon it */ - do_abandon( ld, msgid, lr->lr_msgid ); + if ( lr->lr_origid == msgid ) {/* child: abandon it */ + (void) do_abandon( ld, + msgid, lr->lr_msgid, sctrls, cctrls ); } } @@ -76,7 +116,7 @@ do_abandon( LDAP *ld, int origid, int msgid ) if ( origid == msgid && lr->lr_parent != NULL ) { /* don't let caller abandon child requests! */ ld->ld_errno = LDAP_PARAM_ERROR; - return( -1 ); + return( LDAP_PARAM_ERROR ); } if ( lr->lr_status != LDAP_REQST_INPROGRESS ) { /* no need to send abandon message */ @@ -87,7 +127,7 @@ do_abandon( LDAP *ld, int origid, int msgid ) if ( ldap_msgdelete( ld, msgid ) == 0 ) { ld->ld_errno = LDAP_SUCCESS; - return( 0 ); + return LDAP_SUCCESS; } err = 0; @@ -96,34 +136,57 @@ do_abandon( LDAP *ld, int origid, int msgid ) if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) { err = -1; ld->ld_errno = LDAP_NO_MEMORY; + } else { #ifdef LDAP_CONNECTIONLESS if ( ld->ld_cldapnaddr > 0 ) { - err = ber_printf( ber, "{isti}", + err = ber_printf( ber, "{isti", /* leave open '}' */ ++ld->ld_msgid, ld->ld_cldapdn, LDAP_REQ_ABANDON, msgid ); - } else { + } else #endif /* LDAP_CONNECTIONLESS */ - err = ber_printf( ber, "{iti}", ++ld->ld_msgid, + { + err = ber_printf( ber, "{iti", /* leave open '}' */ + ++ld->ld_msgid, LDAP_REQ_ABANDON, msgid ); -#ifdef LDAP_CONNECTIONLESS } -#endif /* LDAP_CONNECTIONLESS */ - if ( err == -1 ) { + if( err == -1 ) { + /* encoding error */ ld->ld_errno = LDAP_ENCODING_ERROR; + + } else { + /* Put Server Controls */ + if ( ldap_int_put_controls( ld, sctrls, ber ) + != LDAP_SUCCESS ) + { + err = -1; + + } else { + /* close '{' */ + err = ber_printf( ber, "}" ); + + if( err == -1 ) { + /* encoding error */ + ld->ld_errno = LDAP_ENCODING_ERROR; + } + } + } + + if ( err == -1 ) { ber_free( ber, 1 ); + } else { /* send the message */ #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS if ( lr != NULL ) { sb = lr->lr_conn->lconn_sb; - } else { + } else +#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ + { sb = &ld->ld_sb; } -#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ - sb = &ld->ld_sb; -#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ + if ( ber_flush( sb, ber, 1 ) != 0 ) { ld->ld_errno = LDAP_SERVER_DOWN; err = -1; @@ -150,7 +213,7 @@ do_abandon( LDAP *ld, int origid, int msgid ) if ( (ld->ld_abandoned = (int *) malloc( 2 * sizeof(int) )) == NULL ) { ld->ld_errno = LDAP_NO_MEMORY; - return( -1 ); + return( ld->ld_errno ); } i = 0; } else { @@ -159,7 +222,7 @@ do_abandon( LDAP *ld, int origid, int msgid ) if ( (ld->ld_abandoned = (int *) realloc( (char *) ld->ld_abandoned, (i + 2) * sizeof(int) )) == NULL ) { ld->ld_errno = LDAP_NO_MEMORY; - return( -1 ); + return( ld->ld_errno ); } } ld->ld_abandoned[i] = msgid; @@ -168,5 +231,6 @@ do_abandon( LDAP *ld, int origid, int msgid ) if ( err != -1 ) { ld->ld_errno = LDAP_SUCCESS; } - return( err ); + + return( ld->ld_errno ); } diff --git a/libraries/libldap/add.c b/libraries/libldap/add.c index 5bdcf6e919113a6dba0c1d73196430abbc4745f9..4732249382c37162862dd6632cb1411fbf1768a2 100644 --- a/libraries/libldap/add.c +++ b/libraries/libldap/add.c @@ -20,7 +20,7 @@ #include "ldap-int.h" /* - * ldap_add - initiate an ldap (and X.500) add operation. Parameters: + * ldap_add - initiate an ldap add operation. Parameters: * * ld LDAP descriptor * dn DN of the entry to add @@ -39,7 +39,47 @@ * msgid = ldap_add( ld, dn, attrs ); */ int -ldap_add( LDAP *ld, char *dn, LDAPMod **attrs ) +ldap_add( LDAP *ld, LDAP_CONST char *dn, LDAPMod **attrs ) +{ + int rc; + int msgid; + + rc = ldap_add_ext( ld, dn, attrs, NULL, NULL, &msgid ); + + if ( rc != LDAP_SUCCESS ) + return -1; + + return msgid; +} + + +/* + * ldap_add_ext - initiate an ldap extended add operation. Parameters: + * + * ld LDAP descriptor + * dn DN of the entry to add + * mods List of attributes for the entry. This is a null- + * terminated array of pointers to LDAPMod structures. + * only the type and values in the structures need be + * filled in. + * sctrl Server Controls + * cctrl Client Controls + * msgidp Message ID pointer + * + * Example: + * LDAPMod *attrs[] = { + * { 0, "cn", { "babs jensen", "babs", 0 } }, + * { 0, "sn", { "jensen", 0 } }, + * { 0, "objectClass", { "person", 0 } }, + * 0 + * } + * rc = ldap_add_ext( ld, dn, attrs, NULL, NULL, &msgid ); + */ +int +ldap_add_ext( LDAP *ld, LDAP_CONST char *dn, LDAPMod **attrs, + LDAPControl **sctrls, + LDAPControl **cctrls, + int *msgidp ) { BerElement *ber; int i, rc; @@ -59,14 +99,17 @@ ldap_add( LDAP *ld, char *dn, LDAPMod **attrs ) /* create a message to send */ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) { - return( -1 ); + ld->ld_errno = LDAP_NO_MEMORY; + return ld->ld_errno; } - if ( ber_printf( ber, "{it{s{", ++ld->ld_msgid, LDAP_REQ_ADD, dn ) - == -1 ) { + rc = ber_printf( ber, "{it{s{", /* leave open '}}}' */ + ++ld->ld_msgid, LDAP_REQ_ADD, dn ); + + if ( rc == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); - return( -1 ); + return ld->ld_errno; } /* for each attribute in the entry... */ @@ -81,28 +124,54 @@ ldap_add( LDAP *ld, char *dn, LDAPMod **attrs ) if ( rc == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); - return( -1 ); + return ld->ld_errno; } } - if ( ber_printf( ber, "}}}" ) == -1 ) { + /* close '{{' */ + if ( ber_printf( ber, "}}" ) == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + ber_free( ber, 1 ); + return ld->ld_errno; + } + + /* Put Server Controls */ + if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { + ber_free( ber, 1 ); + return ld->ld_errno; + } + + /* close '{' */ + if ( ber_printf( ber, "}" ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); - return( -1 ); + return ld->ld_errno; } /* send the message */ - return( ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber )); + *msgidp = ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber ); + + if(*msgidp < 0) + return ld->ld_errno; + + return LDAP_SUCCESS; } int -ldap_add_s( LDAP *ld, char *dn, LDAPMod **attrs ) +ldap_add_ext_s( + LDAP *ld, + LDAP_CONST char *dn, + LDAPMod **attrs, + LDAPControl **sctrls, + LDAPControl **cctrls ) { - int msgid; + int msgid, rc; LDAPMessage *res; - if ( (msgid = ldap_add( ld, dn, attrs )) == -1 ) - return( ld->ld_errno ); + rc = ldap_add_ext( ld, dn, attrs, sctrls, cctrls, &msgid ); + + if ( rc != LDAP_SUCCESS ) + return( rc ); if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) return( ld->ld_errno ); @@ -110,3 +179,9 @@ ldap_add_s( LDAP *ld, char *dn, LDAPMod **attrs ) return( ldap_result2error( ld, res, 1 ) ); } +int +ldap_add_s( LDAP *ld, LDAP_CONST char *dn, LDAPMod **attrs ) +{ + return ldap_add_ext_s( ld, dn, attrs, NULL, NULL ); +} + diff --git a/libraries/libldap/apitest.c b/libraries/libldap/apitest.c index 40fbf484a5c6f87a223f67620303eb394b72f370..0cb60e47a203c0c18eac0ff438cc24c6e598ec90 100644 --- a/libraries/libldap/apitest.c +++ b/libraries/libldap/apitest.c @@ -6,13 +6,8 @@ * OpenLDAP API Test * Written by: Kurt Zeilenga * - * This program is designed to test API features of libldap. - * - * The API specification can be found in: - * - * draft-api-ldapext-ldap-c-api-01.txt - * - * and discussions on ietf-ldapext mailing list. + * This program is designed to test API features of implementations + * of the IETF draft specifications. * */ #include "portable.h" @@ -30,52 +25,67 @@ main(int argc, char **argv) int ival; char *sval; + printf("Compile time API Information\n"); + #ifdef LDAP_API_INFO_VERSION api.ldapai_info_version = LDAP_API_INFO_VERSION; + printf(" API Info version: %d\n", (int) api.ldapai_info_version); #else api.ldapai_info_version = 1; + printf(" API Info version: unknown\n"); +#endif + +#ifdef LDAP_FEATURE_INFO_VERSION + printf(" Feature Info version: %d\n", (int) LDAP_FEATURE_INFO_VERSION); +#else + printf(" Feature Info version: unknown\n"); + api.ldapai_info_version = 1; +#endif + +#ifdef LDAP_API_VERSION + printf(" API version: %d\n", (int) LDAP_API_VERSION); +#else + printf(" API version: unknown\n"); #endif - printf("Compile time API Information\n"); - printf(" API Info version: %d\n", api.ldapai_info_version); - printf(" API version: %d\n", LDAP_API_VERSION); #ifdef LDAP_VERSION - printf(" Protocol Version: %d\n", LDAP_VERSION); + printf(" Protocol Version: %d\n", (int) LDAP_VERSION); #else printf(" Protocol Version: unknown\n"); #endif #ifdef LDAP_VERSION_MIN - printf(" Protocol Min: %d\n", LDAP_VERSION_MIN); + printf(" Protocol Min: %d\n", (int) LDAP_VERSION_MIN); #else printf(" Protocol Min: unknown\n"); #endif #ifdef LDAP_VERSION_MAX - printf(" Protocol Max: %d\n", LDAP_VERSION_MAX); + printf(" Protocol Max: %d\n", (int) LDAP_VERSION_MAX); #else printf(" Protocol Max: unknown\n"); #endif #ifdef LDAP_VENDOR_NAME - printf(" Vendor Name: %s\n", LDAP_VENDOR_NAME); + printf(" Vendor Name: %s\n", (int) LDAP_VENDOR_NAME); #else printf(" Vendor Name: unknown\n"); #endif #ifdef LDAP_VENDOR_VERSION - printf(" Vendor Version: %d\n", LDAP_VENDOR_VERSION); + printf(" Vendor Version: %d\n", (int) LDAP_VENDOR_VERSION); #else printf(" Vendor Version: unknown\n"); #endif if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]); - exit(-1); + return EXIT_FAILURE; } printf("\nExecution time API Information\n"); printf(" API Info version: %d\n", api.ldapai_info_version); if (api.ldapai_info_version != LDAP_API_INFO_VERSION) { - printf(" API INFO version mismatch!\n"); - exit(-1); + printf(" API INFO version mismatch: got %d, expected %d\n", + api.ldapai_info_version, LDAP_API_INFO_VERSION); + return EXIT_FAILURE; } printf(" API Version: %d\n", api.ldapai_api_version); @@ -89,18 +99,33 @@ main(int argc, char **argv) for(i=0; api.ldapai_extensions[i] != NULL; i++) /* empty */; printf(" Extensions: %d\n", i); for(i=0; api.ldapai_extensions[i] != NULL; i++) { -#ifndef LDAP_API_FEATURE_INFO - printf(" %s\n", - api.ldapai_extensions[i]); -#else +#ifdef LDAP_OPT_API_FEATURE_INFO LDAPAPIFeatureInfo fi; + fi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION; fi.ldapaif_name = api.ldapai_extensions[i]; fi.ldapaif_version = 0; - ldap_get_option(NULL, LDAP_OPT_API_FEATURE_INFO, &fi); + if( ldap_get_option(NULL, LDAP_OPT_API_FEATURE_INFO, &fi) == LDAP_SUCCESS ) { + if(fi.ldapaif_info_version != LDAP_FEATURE_INFO_VERSION) { + printf(" %s feature info mismatch: got %d, expected %d\n", + api.ldapai_extensions[i], + LDAP_FEATURE_INFO_VERSION, + fi.ldapaif_info_version); - printf(" %s (%d)\n", - api.ldapai_extensions[i], fi.ldapaif_version); + } else { + printf(" %s: version %d\n", + fi.ldapaif_name, + fi.ldapaif_version); + } + + } else { + printf(" %s (NO FEATURE INFO)\n", + api.ldapai_extensions[i]); + } + +#else + printf(" %s\n", + api.ldapai_extensions[i]); #endif } } @@ -112,48 +137,47 @@ main(int argc, char **argv) if(ldap_get_option(NULL, LDAP_OPT_DEREF, &ival) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]); - exit(-1); + return EXIT_FAILURE; } printf(" DEREF: %d\n", ival); if(ldap_get_option(NULL, LDAP_OPT_SIZELIMIT, &ival) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(sizelimit) failed\n", argv[0]); - exit(-1); + return EXIT_FAILURE; } printf(" SIZELIMIT: %d\n", ival); if(ldap_get_option(NULL, LDAP_OPT_TIMELIMIT, &ival) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(timelimit) failed\n", argv[0]); - exit(-1); + return EXIT_FAILURE; } printf(" TIMELIMIT: %d\n", ival); if(ldap_get_option(NULL, LDAP_OPT_REFERRALS, &ival) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(referrals) failed\n", argv[0]); - exit(-1); + return EXIT_FAILURE; } printf(" REFERRALS: %s\n", ival == (int) LDAP_OPT_ON ? "on" : "off"); if(ldap_get_option(NULL, LDAP_OPT_RESTART, &ival) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(restart) failed\n", argv[0]); - exit(-1); + return EXIT_FAILURE; } printf(" RESTART: %s\n", ival == (int) LDAP_OPT_ON ? "on" : "off"); if(ldap_get_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ival) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(protocol version) failed\n", argv[0]); - exit(-1); + return EXIT_FAILURE; } printf(" PROTOCOL VERSION: %d\n", ival); if(ldap_get_option(NULL, LDAP_OPT_HOST_NAME, &sval) != LDAP_SUCCESS) { fprintf(stderr, "%s: ldap_get_option(host name) failed\n", argv[0]); - exit(-1); + return EXIT_FAILURE; } printf(" HOST NAME: %s\n", sval); - exit(0); - return 0; + return EXIT_SUCCESS; } diff --git a/libraries/libldap/apitest.dsp b/libraries/libldap/apitest.dsp index 6cb9698b3fd9f228da0dd6cab620bdb7bd6ffc41..5b3b905535919d71348f008199a0b5179501f473 100644 --- a/libraries/libldap/apitest.dsp +++ b/libraries/libldap/apitest.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=apitest - Win32 Debug +CFG=apitest - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=apitest - Win32 Debug !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 "apitest.mak" CFG="apitest - Win32 Debug" +!MESSAGE NMAKE /f "apitest.mak" CFG="apitest - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "apitest - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "apitest - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "apitest - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "apitest - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -41,7 +45,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -65,7 +69,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -75,12 +79,64 @@ 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 /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +!ELSEIF "$(CFG)" == "apitest - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "apitest_" +# PROP BASE Intermediate_Dir "apitest_" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\apitest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug" + +!ELSEIF "$(CFG)" == "apitest - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "apitest0" +# PROP BASE Intermediate_Dir "apitest0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\apitest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease" + !ENDIF # Begin Target # Name "apitest - Win32 Release" # Name "apitest - Win32 Debug" +# Name "apitest - Win32 Single Debug" +# Name "apitest - Win32 Single Release" # Begin Source File SOURCE=.\apitest.c diff --git a/libraries/libldap/apitest.dsw b/libraries/libldap/apitest.dsw index 49079d3c40ea3dfc9693389ad0ce84a8caefb596..bb514f16e21798172752943e4fbe8c88351c178b 100644 --- a/libraries/libldap/apitest.dsw +++ b/libraries/libldap/apitest.dsw @@ -18,6 +18,18 @@ Package=<4> ############################################################################### +Project: "liblber"=..\liblber\liblber.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "libldap"=.\libldap.dsp - Package Owner=<4> Package=<5> @@ -26,6 +38,9 @@ Package=<5> Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name liblber + End Project Dependency }}} ############################################################################### diff --git a/libraries/libldap/bind.c b/libraries/libldap/bind.c index f7211f8a3dd6364f1f5bf35e633a4db78b796eed..2ef983f64928b4889ff19b45078a6a31cc2805bf 100644 --- a/libraries/libldap/bind.c +++ b/libraries/libldap/bind.c @@ -35,7 +35,7 @@ */ int -ldap_bind( LDAP *ld, char *dn, char *passwd, int authmethod ) +ldap_bind( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd, int authmethod ) { /* * The bind request looks like this: @@ -88,7 +88,11 @@ ldap_bind( LDAP *ld, char *dn, char *passwd, int authmethod ) * NULL, LDAP_AUTH_KRBV4 ) */ int -ldap_bind_s( LDAP *ld, char *dn, char *passwd, int authmethod ) +ldap_bind_s( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *passwd, + int authmethod ) { Debug( LDAP_DEBUG_TRACE, "ldap_bind_s\n", 0, 0, 0 ); diff --git a/libraries/libldap/cache.c b/libraries/libldap/cache.c index 936488a3a9df8e56f46b40491af5749757192bf4..46b2078d51817e57b32679e3ce2153ad3f470a48 100644 --- a/libraries/libldap/cache.c +++ b/libraries/libldap/cache.c @@ -25,10 +25,10 @@ static int cache_hash LDAP_P(( BerElement *ber )); static LDAPMessage *msg_dup LDAP_P(( LDAPMessage *msg )); static int request_cmp LDAP_P(( BerElement *req1, BerElement *req2 )); -static int chain_contains_dn LDAP_P(( LDAPMessage *msg, char *dn )); +static int chain_contains_dn LDAP_P(( LDAPMessage *msg, LDAP_CONST char *dn )); static long msg_size LDAP_P(( LDAPMessage *msg )); static void check_cache_memused LDAP_P(( LDAPCache *lc )); -static void uncache_entry_or_req LDAP_P(( LDAP *ld, char *dn, int msgid )); +static void uncache_entry_or_req LDAP_P(( LDAP *ld, LDAP_CONST char *dn, int msgid )); #endif @@ -138,7 +138,7 @@ ldap_uncache_request( LDAP *ld, int msgid ) void -ldap_uncache_entry( LDAP *ld, char *dn ) +ldap_uncache_entry( LDAP *ld, LDAP_CONST char *dn ) { #ifndef LDAP_NOCACHE Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %lx\n", @@ -153,7 +153,7 @@ ldap_uncache_entry( LDAP *ld, char *dn ) static void uncache_entry_or_req( LDAP *ld, - char *dn, /* if non-NULL, uncache entry */ + const char *dn, /* if non-NULL, uncache entry */ int msgid ) /* request to uncache (if dn == NULL) */ { int i; @@ -540,7 +540,7 @@ request_cmp( BerElement *req1, BerElement *req2 ) static int -chain_contains_dn( LDAPMessage *msg, char *dn ) +chain_contains_dn( LDAPMessage *msg, const char *dn ) { LDAPMessage *m; BerElement ber; diff --git a/libraries/libldap/cldap.c b/libraries/libldap/cldap.c index 126e1695b4cbdbb8c13a2f7e554ec649ed4b584b..145633e921d6312c65ab19051b8162141ff67e19 100644 --- a/libraries/libldap/cldap.c +++ b/libraries/libldap/cldap.c @@ -92,7 +92,7 @@ cldap_open( char *host, int port ) ld->ld_cldapnaddr = 0; ld->ld_cldapaddrs = NULL; - if (lber_pvt_sb_set_io( &(ld->ld_sb), &lber_pvt_sb_io_udp, NULL )<0) { + if (ber_pvt_sb_set_io( &(ld->ld_sb), &ber_pvt_sb_io_udp, NULL )<0) { ldap_ld_free(ld, 1 ); return NULL; } @@ -164,7 +164,7 @@ cldap_open( char *host, int port ) DO_RETURN( NULL ); } - lber_pvt_sb_udp_set_dst( &ld->ld_sb, ld->ld_cldapaddrs[0] ); + ber_pvt_sb_udp_set_dst( &ld->ld_sb, ld->ld_cldapaddrs[0] ); cldap_setretryinfo( ld, 0, 0 ); @@ -219,7 +219,7 @@ cldap_search_s( LDAP *ld, char *base, int scope, char *filter, char **attrs, --ld->ld_msgid; /* use same id as before */ } - lber_pvt_sb_udp_set_dst( &(ld->ld_sb), + ber_pvt_sb_udp_set_dst( &(ld->ld_sb), ld->ld_cldapaddrs[ cri.cri_useaddr ] ); Debug( LDAP_DEBUG_TRACE, "cldap_search_s try %d (to %s)\n", @@ -358,7 +358,7 @@ cldap_result( LDAP *ld, int msgid, LDAPMessage **res, * got a result: determine which server it came from * decode into ldap message chain */ - src = (struct sockaddr_in *) lber_pvt_sb_udp_get_src( sb ); + src = (struct sockaddr_in *) ber_pvt_sb_udp_get_src( sb ); for ( fromaddr = 0; fromaddr < ld->ld_cldapnaddr; ++fromaddr ) { if ( memcmp( &((struct sockaddr_in *) @@ -394,7 +394,7 @@ cldap_result( LDAP *ld, int msgid, LDAPMessage **res, if ( i == fromaddr ) { continue; } - lber_pvt_sb_udp_set_dst( sb, ld->ld_cldapaddrs[i] ); + ber_pvt_sb_udp_set_dst( sb, ld->ld_cldapaddrs[i] ); Debug( LDAP_DEBUG_TRACE, "cldap_result abandoning id %d (to %s)\n", msgid, inet_ntoa( ((struct sockaddr_in *) @@ -497,7 +497,7 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber, if ( ldap_debug & LDAP_DEBUG_PACKETS ) { fprintf( stderr, "cldap_parsemsg add message id %d type %d:\n", ldm->lm_msgid, ldm->lm_msgtype ); - lber_log_dump( LDAP_DEBUG_BER, ldap_debug, ldm->lm_ber, 1 ); + ber_log_dump( LDAP_DEBUG_BER, ldap_debug, ldm->lm_ber, 1 ); } #endif /* LDAP_DEBUG */ diff --git a/libraries/libldap/compare.c b/libraries/libldap/compare.c index ab64d198652d84fc01419134159e3d1573711435..489905b9703270097c505c523351b369563b5069 100644 --- a/libraries/libldap/compare.c +++ b/libraries/libldap/compare.c @@ -20,15 +20,25 @@ #include "ldap-int.h" /* - * ldap_compare - perform an ldap (and X.500) compare operation. The dn + * ldap_compare_ext - perform an ldap extended compare operation. The dn * of the entry to compare to and the attribute and value to compare (in * attr and value) are supplied. The msgid of the response is returned. * * Example: - * ldap_compare( ld, "c=us@cn=bob", "userPassword", "secret" ) + * struct berval bvalue = { "secret", strlen("secret") }; + * rc = ldap_compare( ld, "c=us@cn=bob", + * "userPassword", &bvalue, + * sctrl, cctrl, &msgid ) */ int -ldap_compare( LDAP *ld, char *dn, char *attr, char *value ) +ldap_compare_ext( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *attr, + struct berval *bvalue, + LDAPControl **sctrls, + LDAPControl **cctrls, + int *msgidp ) { BerElement *ber; @@ -47,14 +57,28 @@ ldap_compare( LDAP *ld, char *dn, char *attr, char *value ) /* create a message to send */ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) { - return( -1 ); + return( LDAP_NO_MEMORY ); } - if ( ber_printf( ber, "{it{s{ss}}}", ++ld->ld_msgid, LDAP_REQ_COMPARE, - dn, attr, value ) == -1 ) { + if ( ber_printf( ber, "{it{s{sO}}", /* leave open '}' */ + ++ld->ld_msgid, + LDAP_REQ_COMPARE, dn, attr, &bvalue ) == -1 ) + { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); - return( -1 ); + return( ld->ld_errno ); + } + + /* Put Server Controls */ + if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { + ber_free( ber, 1 ); + return ld->ld_errno; + } + + if( ber_printf( ber, "}" ) == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + ber_free( ber, 1 ); + return( ld->ld_errno ); } #ifndef LDAP_NOCACHE @@ -62,27 +86,78 @@ ldap_compare( LDAP *ld, char *dn, char *attr, char *value ) if ( ldap_check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) { ber_free( ber, 1 ); ld->ld_errno = LDAP_SUCCESS; - return( ld->ld_msgid ); + *msgidp = ld->ld_msgid; + return( ld->ld_errno ); } ldap_add_request_to_cache( ld, LDAP_REQ_COMPARE, ber ); } #endif /* LDAP_NOCACHE */ /* send the message */ - return ( ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber )); + *msgidp = ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber ); + return ( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS ); +} + +/* + * ldap_compare_ext - perform an ldap extended compare operation. The dn + * of the entry to compare to and the attribute and value to compare (in + * attr and value) are supplied. The msgid of the response is returned. + * + * Example: + * msgid = ldap_compare( ld, "c=us@cn=bob", "userPassword", "secret" ) + */ +int +ldap_compare( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *attr, + LDAP_CONST char *value ) +{ + int msgid; + struct berval bvalue; + + bvalue.bv_val = (char *) value; + bvalue.bv_len = (value == NULL) ? 0 : strlen( value ); + + return ldap_compare_ext( ld, dn, attr, &bvalue, NULL, NULL, &msgid ) == LDAP_SUCCESS + ? msgid : -1; } int -ldap_compare_s( LDAP *ld, char *dn, char *attr, char *value ) +ldap_compare_ext_s( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *attr, + struct berval *bvalue, + LDAPControl **sctrl, + LDAPControl **cctrl ) { + int rc; int msgid; LDAPMessage *res; - if ( (msgid = ldap_compare( ld, dn, attr, value )) == -1 ) - return( ld->ld_errno ); + rc = ldap_compare_ext( ld, dn, attr, bvalue, sctrl, cctrl, &msgid ); + + if ( rc != LDAP_SUCCESS ) + return( rc ); if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) return( ld->ld_errno ); return( ldap_result2error( ld, res, 1 ) ); } + +int +ldap_compare_s( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *attr, + LDAP_CONST char *value ) +{ + struct berval bvalue; + + bvalue.bv_val = (char *) value; + bvalue.bv_len = (value == NULL) ? 0 : strlen( value ); + + return ldap_compare_ext_s( ld, dn, attr, &bvalue, NULL, NULL ); +} \ No newline at end of file diff --git a/libraries/libldap/controls.c b/libraries/libldap/controls.c index bac038e3048c8e6873f3e8356b695dd280d0b02e..1043d99ca100a4c542ee9cedaa18450de81b7804 100644 --- a/libraries/libldap/controls.c +++ b/libraries/libldap/controls.c @@ -15,6 +15,102 @@ #include "ldap-int.h" + +/* + * ldap_int_put_controls + */ + +int ldap_int_put_controls( + LDAP *ld, + LDAPControl **ctrls, + BerElement *ber ) +{ + LDAPControl **c; + + assert( ld != NULL ); + assert( ber != NULL ); + + if( ctrls == NULL ) { + /* use default server controls */ + ctrls = ld->ld_sctrls; + } + + if( ctrls == NULL || *ctrls == NULL ) { + return LDAP_SUCCESS; + } + + if ( ld->ld_version < LDAP_VERSION3 ) { + /* LDAPv2 doesn't support controls, + * error if any control is critical + */ + for( c = ctrls ; *c != NULL; c++ ) { + if( (*c)->ldctl_iscritical ) { + ld->ld_errno = LDAP_NOT_SUPPORTED; + return ld->ld_errno; + } + } + + return LDAP_SUCCESS; + } + + /* Controls are encoded as a sequence of sequences */ + if( ber_printf( ber, "t{", LDAP_TAG_CONTROLS ) == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + return ld->ld_errno; + } + + for( c = ctrls ; *c != NULL; c++ ) { + if ( ber_printf( ber, "{s", + (*c)->ldctl_oid ) == -1 ) + { + ld->ld_errno = LDAP_ENCODING_ERROR; + return ld->ld_errno; + } + + if( (*c)->ldctl_iscritical /* only if true */ + && ( ber_printf( ber, "b", + (*c)->ldctl_iscritical ) == -1 ) ) + { + ld->ld_errno = LDAP_ENCODING_ERROR; + return ld->ld_errno; + } + + if( (*c)->ldctl_value.bv_val != NULL /* only if we have a value */ + && ( ber_printf( ber, "O", + &((*c)->ldctl_value) ) == -1 ) ) + { + ld->ld_errno = LDAP_ENCODING_ERROR; + return ld->ld_errno; + } + + + if( ber_printf( ber, "}" ) == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + return ld->ld_errno; + } + } + + + if( ber_printf( ber, "}" ) == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + return ld->ld_errno; + } + + return LDAP_SUCCESS; +} + +int ldap_int_get_controls LDAP_P(( + BerElement *be, + LDAPControl ***ctrls )) +{ + assert( be != NULL ); + assert( ctrls != NULL ); + + **ctrls = NULL; + + return LDAP_NOT_SUPPORTED; +} + /* * Free a LDAPControl */ @@ -54,7 +150,7 @@ ldap_controls_free( LDAPControl **controls ) /* * Duplicate an array of LDAPControl */ -LDAPControl **ldap_controls_dup( LDAPControl **controls ) +LDAPControl **ldap_controls_dup( const LDAPControl **controls ) { LDAPControl **new; int i; @@ -96,7 +192,7 @@ LDAPControl **ldap_controls_dup( LDAPControl **controls ) /* * Duplicate a LDAPControl */ -LDAPControl *ldap_control_dup( LDAPControl *c ) +LDAPControl *ldap_control_dup( const LDAPControl *c ) { LDAPControl *new; @@ -145,10 +241,4 @@ LDAPControl *ldap_control_dup( LDAPControl *c ) new->ldctl_iscritical = c->ldctl_iscritical; return new; -} - -/* get the controls from the BerElement */ -int ldap_get_ber_controls( BerElement *be, LDAPControl ***cp) -{ - return LDAP_NOT_SUPPORTED; -} +} \ No newline at end of file diff --git a/libraries/libldap/delete.c b/libraries/libldap/delete.c index 5b28038944046a49eb34c69bf6cbdc6606c0bcf6..bc260b205e718eb7a625d62dd78d8ed8e929ef09 100644 --- a/libraries/libldap/delete.c +++ b/libraries/libldap/delete.c @@ -20,16 +20,24 @@ #include "ldap-int.h" /* - * ldap_delete - initiate an ldap (and X.500) delete operation. Parameters: + * ldap_delete_ext - initiate an ldap extended delete operation. Parameters: * * ld LDAP descriptor * dn DN of the object to delete + * sctrls Server Controls + * cctrls Client Controls + * msgidp Message Id Pointer * * Example: - * msgid = ldap_delete( ld, dn ); + * rc = ldap_delete( ld, dn, sctrls, cctrls, msgidp ); */ int -ldap_delete( LDAP *ld, char *dn ) +ldap_delete_ext( + LDAP *ld, + LDAP_CONST char* dn, + LDAPControl **sctrls, + LDAPControl **cctrls, + int *msgidp ) { BerElement *ber; @@ -42,28 +50,55 @@ ldap_delete( LDAP *ld, char *dn ) /* create a message to send */ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) { - return( -1 ); + ld->ld_errno = LDAP_NO_MEMORY; + return( ld->ld_errno ); + } + + if ( ber_printf( ber, "{its", /* leave open - '}' */ + ++ld->ld_msgid, LDAP_REQ_DELETE, dn ) == -1 ) + { + ld->ld_errno = LDAP_ENCODING_ERROR; + ber_free( ber, 1 ); + return( ld->ld_errno ); + } + + /* Put Server Controls */ + if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { + ber_free( ber, 1 ); + return ld->ld_errno; } - if ( ber_printf( ber, "{its}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn ) + /* close '{' */ + if ( ber_printf( ber, "}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); - return( -1 ); + return( ld->ld_errno ); } /* send the message */ - return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber )); -} + *msgidp = ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ); + if(*msgidp < 0) + return ld->ld_errno; + + return LDAP_SUCCESS; +} int -ldap_delete_s( LDAP *ld, char *dn ) +ldap_delete_ext_s( + LDAP *ld, + LDAP_CONST char *dn, + LDAPControl **sctrls, + LDAPControl **cctrls ) { - int msgid; + int msgid; + int rc; LDAPMessage *res; - if ( (msgid = ldap_delete( ld, dn )) == -1 ) + rc = ldap_delete_ext( ld, dn, sctrls, cctrls, &msgid ); + + if( rc != LDAP_SUCCESS ) return( ld->ld_errno ); if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) @@ -71,3 +106,34 @@ ldap_delete_s( LDAP *ld, char *dn ) return( ldap_result2error( ld, res, 1 ) ); } +/* + * ldap_delete - initiate an ldap (and X.500) delete operation. Parameters: + * + * ld LDAP descriptor + * dn DN of the object to delete + * + * Example: + * msgid = ldap_delete( ld, dn ); + */ +int +ldap_delete( LDAP *ld, LDAP_CONST char *dn ) +{ + int msgid; + + /* + * A delete request looks like this: + * DelRequet ::= DistinguishedName, + */ + + Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 ); + + return ldap_delete_ext( ld, dn, NULL, NULL, &msgid ) == LDAP_SUCCESS + ? msgid : -1 ; +} + + +int +ldap_delete_s( LDAP *ld, LDAP_CONST char *dn ) +{ + return ldap_delete_ext_s( ld, dn, NULL, NULL ); +} diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index 96883b3471168ff6ad3ae223d9db4cbe7accc21b..1c5279da7ef563a9bfdc30bc0c02a9051779c85d 100644 --- a/libraries/libldap/error.c +++ b/libraries/libldap/error.c @@ -108,7 +108,7 @@ ldap_err2string( int err ) /* depreciated */ void -ldap_perror( LDAP *ld, char *s ) +ldap_perror( LDAP *ld, LDAP_CONST char *s ) { int i; diff --git a/libraries/libldap/friendly.c b/libraries/libldap/friendly.c index ef07adc82b2793d40802cc93c6bd6ef314b7cc90..9c7b966844dd0d777d9fbb9ea5f73f39b81a33c0 100644 --- a/libraries/libldap/friendly.c +++ b/libraries/libldap/friendly.c @@ -23,7 +23,10 @@ #include "ldap-int.h" char * -ldap_friendly_name( char *filename, char *uname, LDAPFriendlyMap **map ) +ldap_friendly_name( + LDAP_CONST char *filename, + /* LDAP_CONST */ char *uname, + LDAPFriendlyMap **map ) { int i, entries; FILE *fp; diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index fd229f2247d416f5a1b76a886c205c650815f541..6691f333e4d2953ba02c37049a406ac9774ae790 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -21,7 +21,7 @@ #include "ldap-int.h" -static char **explode_name( char *name, int notypes, int is_dn ); +static char **explode_name( LDAP_CONST char *name, int notypes, int is_dn ); char * ldap_get_dn( LDAP *ld, LDAPMessage *entry ) @@ -46,7 +46,7 @@ ldap_get_dn( LDAP *ld, LDAPMessage *entry ) } char * -ldap_dn2ufn( char *dn ) +ldap_dn2ufn( LDAP_CONST char *dn ) { char *p, *ufn, *r; int state; @@ -119,37 +119,51 @@ ldap_dn2ufn( char *dn ) } char ** -ldap_explode_dns( char *dn ) +ldap_explode_dns( LDAP_CONST char *dn_in ) { - int ncomps, maxcomps; char *s; char **rdns; char *tok_r; + char *dn; - if ( (rdns = (char **) malloc( 8 * sizeof(char *) )) == NULL ) { + int ncomps; + int maxcomps = 8; + + if ( (dn = strdup( dn_in )) == NULL ) { + return( NULL ); + } + + if ( (rdns = (char **) malloc( maxcomps * sizeof(char *) )) == NULL ) { + free( dn ); return( NULL ); } - maxcomps = 8; ncomps = 0; for ( s = ldap_pvt_strtok( dn, "@.", &tok_r ); s != NULL; - s = ldap_pvt_strtok( NULL, "@.", &tok_r ) ) { + s = ldap_pvt_strtok( NULL, "@.", &tok_r ) ) + { if ( ncomps == maxcomps ) { maxcomps *= 2; if ( (rdns = (char **) realloc( rdns, maxcomps * - sizeof(char *) )) == NULL ) { - return( NULL ); + sizeof(char *) )) == NULL ) + { + free( dn ); + return NULL; } } rdns[ncomps++] = strdup( s ); } + free(dn); + rdns[ncomps] = NULL; + /* trim rdns */ + rdns = (char **) realloc( rdns, (ncomps+1) * sizeof(char*) ); return( rdns ); } char ** -ldap_explode_dn( char *dn, int notypes ) +ldap_explode_dn( LDAP_CONST char *dn, int notypes ) { Debug( LDAP_DEBUG_TRACE, "ldap_explode_dn\n", 0, 0, 0 ); @@ -160,16 +174,17 @@ ldap_explode_dn( char *dn, int notypes ) } char ** -ldap_explode_rdn( char *rdn, int notypes ) +ldap_explode_rdn( LDAP_CONST char *rdn, int notypes ) { Debug( LDAP_DEBUG_TRACE, "ldap_explode_rdn\n", 0, 0, 0 ); return explode_name( rdn, notypes, 0 ); } static char ** -explode_name( char *name, int notypes, int is_dn ) +explode_name( LDAP_CONST char *name, int notypes, int is_dn ) { - char *p, *q, **parts = NULL; + const char *p, *q; + char **parts = NULL; int state, count = 0, endquote, len; p = name-1; @@ -261,7 +276,7 @@ explode_name( char *name, int notypes, int is_dn ) int -ldap_is_dns_dn( char *dn ) +ldap_is_dns_dn( LDAP_CONST char *dn ) { return( dn[ 0 ] != '\0' && strchr( dn, '=' ) == NULL && strchr( dn, ',' ) == NULL ); diff --git a/libraries/libldap/getentry.c b/libraries/libldap/getentry.c index a718acebb77113eaef9e5b5e810ed643bad4f228..5dc62fdf42ac72b4a83899ba433ce890f1db2e7d 100644 --- a/libraries/libldap/getentry.c +++ b/libraries/libldap/getentry.c @@ -97,7 +97,7 @@ ldap_get_entry_controls( goto cleanup_and_return; } - rc = ldap_get_ber_controls( &be, serverctrls ); + rc = ldap_int_get_controls( &be, serverctrls ); cleanup_and_return: if( rc != LDAP_SUCCESS ) { diff --git a/libraries/libldap/getfilter.c b/libraries/libldap/getfilter.c index d69ff0e9e881f17e3c1443a87c2105dbe9d6c583..94f73c3c77d804c8014b9678cfa21c507b15b9ce 100644 --- a/libraries/libldap/getfilter.c +++ b/libraries/libldap/getfilter.c @@ -27,12 +27,15 @@ #include "ldap-int.h" -static int break_into_words LDAP_P(( char *str, char *delims, char ***wordsp )); +static int break_into_words LDAP_P(( + /* LDAP_CONST */ char *str, + LDAP_CONST char *delims, + char ***wordsp )); #define FILT_MAX_LINE_LEN 1024 LDAPFiltDesc * -ldap_init_getfilter( char *fname ) +ldap_init_getfilter( LDAP_CONST char *fname ) { FILE *fp; char *buf; @@ -205,7 +208,7 @@ ldap_init_getfilter_buf( char *buf, long buflen ) void -ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix ) +ldap_setfilteraffixes( LDAPFiltDesc *lfdp, LDAP_CONST char *prefix, LDAP_CONST char *suffix ) { if ( lfdp->lfd_filtprefix != NULL ) { free( lfdp->lfd_filtprefix ); @@ -220,7 +223,10 @@ ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix ) LDAPFiltInfo * -ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value ) +ldap_getfirstfilter( + LDAPFiltDesc *lfdp, + /* LDAP_CONST */ char *tagpat, + /* LDAP_CONST */ char *value ) { LDAPFiltList *flp; int rc; @@ -305,10 +311,18 @@ ldap_getnextfilter( LDAPFiltDesc *lfdp ) void -ldap_build_filter( char *filtbuf, unsigned long buflen, char *pattern, - char *prefix, char *suffix, char *attr, char *value, char **valwords ) +ldap_build_filter( + char *filtbuf, + unsigned long buflen, + LDAP_CONST char *pattern, + LDAP_CONST char *prefix, + LDAP_CONST char *suffix, + LDAP_CONST char *attr, + LDAP_CONST char *value, + char **valwords ) { - char *p, *f; + const char *p; + char *f; size_t slen; int i, wordcount, wordnum, endwordnum; @@ -401,7 +415,7 @@ ldap_build_filter( char *filtbuf, unsigned long buflen, char *pattern, static int -break_into_words( char *str, char *delims, char ***wordsp ) +break_into_words( /* LDAP_CONST */ char *str, LDAP_CONST char *delims, char ***wordsp ) { char *word, **words; int count; diff --git a/libraries/libldap/getvalues.c b/libraries/libldap/getvalues.c index 724963a1a3b3f085aae95cb75abfdd9fd0818d91..f593e045be148fd71be9e1fac19e1f775a41a455 100644 --- a/libraries/libldap/getvalues.c +++ b/libraries/libldap/getvalues.c @@ -22,7 +22,7 @@ #include "ldap-int.h" char ** -ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target ) +ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target ) { BerElement ber; char attr[LDAP_MAX_ATTR_LEN]; @@ -70,7 +70,7 @@ ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target ) } struct berval ** -ldap_get_values_len( LDAP *ld, LDAPMessage *entry, char *target ) +ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target ) { BerElement ber; char attr[LDAP_MAX_ATTR_LEN]; diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index 7cae7d94dc3863277ac85d6c7e0240eb52997776..bef3ba50f1730bbf1af7135b475ec6c38cb6b0c0 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -35,6 +35,7 @@ LDAP_BEGIN_DECL #define LDAP_URL_PREFIX_LEN 7 #define LDAP_URL_URLCOLON "URL:" #define LDAP_URL_URLCOLON_LEN 4 +#define NULLLDAPURLDESC ((LDAPURLDesc *)NULL) #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS #define LDAP_REF_STR "Referral:\n" @@ -73,7 +74,7 @@ struct ldapmsg { struct ldapmsg *lm_next; /* next response */ unsigned int lm_time; /* used to maintain cache */ }; - +#define NULLMSG ((LDAPMessage *)NULL) /* * structure representing get/set'able options * which have global defaults. @@ -95,8 +96,8 @@ struct ldapoptions { int ldo_refhoplimit; /* limit on referral nesting */ /* LDAPv3 server and client controls */ - LDAPControl **ldo_server_controls; - LDAPControl **ldo_client_controls; + LDAPControl **ldo_sctrls; + LDAPControl **ldo_cctrls; LDAP_BOOLEANS ldo_booleans; /* boolean options */ }; @@ -201,6 +202,9 @@ struct ldap { #define ld_cldaptimeout ld_options.ldo_cldaptimeout #define ld_refhoplimit ld_options.ldo_refhoplimit +#define ld_sctrls ld_options.ldo_sctrls +#define ld_cctrls ld_options.ldo_cctrls + int ld_version; /* version connected at */ char *ld_host; int ld_port; @@ -257,7 +261,7 @@ void openldap_ldap_initialize LDAP_P((void)); /* * in print.c */ -int ldap_log_printf LDAP_P((LDAP *ld, int level, char *fmt, ...)); +int ldap_log_printf LDAP_P((LDAP *ld, int level, const char *fmt, ...)); /* * in cache.c @@ -270,9 +274,17 @@ int ldap_check_cache LDAP_P(( LDAP *ld, unsigned long msgtype, BerElement *reque /* * in controls.c */ -LDAPControl *ldap_control_dup LDAP_P(( LDAPControl *ctrl )); -LDAPControl **ldap_controls_dup LDAP_P(( LDAPControl **ctrl )); -int ldap_get_ber_controls LDAP_P(( BerElement *be, LDAPControl ***cp)); +LDAPControl *ldap_control_dup LDAP_P(( const LDAPControl *ctrl )); +LDAPControl **ldap_controls_dup LDAP_P(( const LDAPControl **ctrls )); + +int ldap_int_get_controls LDAP_P(( + BerElement *be, + LDAPControl ***cp)); + +int ldap_int_put_controls LDAP_P(( + LDAP *ld, + LDAPControl **ctrls, + BerElement *ber )); /* * in dsparse.c @@ -293,14 +305,14 @@ char *ldap_get_kerberosv4_credentials LDAP_P(( LDAP *ld, char *who, char *servic /* * in open.c */ -int open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport, +int open_ldap_connection( LDAP *ld, Sockbuf *sb, const char *host, int defport, char **krbinstancep, int async ); /* * in os-ip.c */ -int ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, int port, +int ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address, int port, int async ); void ldap_close_connection( Sockbuf *sb ); @@ -324,11 +336,12 @@ int ldap_is_write_ready( LDAP *ld, Sockbuf *sb ); * in request.c */ int ldap_send_initial_request( LDAP *ld, unsigned long msgtype, - char *dn, BerElement *ber ); + const char *dn, BerElement *ber ); BerElement *ldap_alloc_ber_with_options( LDAP *ld ); void ldap_set_ber_options( LDAP *ld, BerElement *ber ); -#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS ) +#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) \ + || defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS ) int ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid, LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc, int bind ); @@ -356,8 +369,9 @@ LDAP_F int cldap_getmsg ( LDAP *ld, struct timeval *timeout, BerElement *ber ); /* * in search.c */ -BerElement *ldap_build_search_req( LDAP *ld, char *base, int scope, - char *filter, char **attrs, int attrsonly ); +BerElement *ldap_build_search_req( LDAP *ld, const char *base, int scope, + const char *filter, char **attrs, int attrsonly, + LDAPControl **sctrls, LDAPControl **cctrls ); /* * in strdup.c @@ -367,14 +381,23 @@ char *ldap_strdup LDAP_P(( const char * )); /* * in unbind.c */ -int ldap_ld_free( LDAP *ld, int close ); -int ldap_send_unbind( LDAP *ld, Sockbuf *sb ); +int ldap_ld_free LDAP_P(( + LDAP *ld, + int close, + LDAPControl **sctrls, + LDAPControl **cctrls )); + +int ldap_send_unbind LDAP_P(( + LDAP *ld, + Sockbuf *sb, + LDAPControl **sctrls, + LDAPControl **cctrls )); #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS /* * in getdxbyname.c */ -char **ldap_getdxbyname( char *domain ); +char **ldap_getdxbyname( const char *domain ); #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */ #if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET ) diff --git a/libraries/libldap/libldap.dsp b/libraries/libldap/libldap.dsp index 4a767617a2b8febe02021468cc9cc21a4d0717f9..0b90aa04e3f713da6558ff688a42ba1b8d02e473 100644 --- a/libraries/libldap/libldap.dsp +++ b/libraries/libldap/libldap.dsp @@ -42,7 +42,7 @@ CPP=cl.exe # PROP Intermediate_Dir "Release\libldap" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -80,8 +80,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "libldap_" -# PROP Intermediate_Dir "libldap_" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\libldap" # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c @@ -101,11 +101,11 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "libldap0" -# PROP Intermediate_Dir "libldap0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\libldap" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -219,18 +219,6 @@ SOURCE=.\kbind.c # End Source File # Begin Source File -SOURCE="..\liblber\lber-int.h" -# End Source File -# Begin Source File - -SOURCE=..\..\include\lber.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\lber_pvt.h -# End Source File -# Begin Source File - SOURCE=".\ldap-int.h" # End Source File # Begin Source File diff --git a/libraries/libldap/ltest.dsp b/libraries/libldap/ltest.dsp index 60979e8e0fcda4d85a56461e00454e58423eec81..d2d89f13b523b4c0f23a11bd58740cb3245a75bd 100644 --- a/libraries/libldap/ltest.dsp +++ b/libraries/libldap/ltest.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ltest - Win32 Debug +CFG=ltest - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=ltest - Win32 Debug !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 "ltest.mak" CFG="ltest - Win32 Debug" +!MESSAGE NMAKE /f "ltest.mak" CFG="ltest - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "ltest - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "ltest - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "ltest - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ltest - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -36,11 +40,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release\ltest" +# PROP Output_Dir "..\Release" # PROP Intermediate_Dir "Release\ltest" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -48,7 +53,7 @@ BSC32=bscmake.exe # 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 /subsystem:console /machine:I386 -# ADD LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" !ELSEIF "$(CFG)" == "ltest - Win32 Debug" @@ -59,11 +64,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug\ltest" +# PROP Output_Dir "..\Debug" # PROP Intermediate_Dir "Debug\ltest" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -71,7 +77,55 @@ BSC32=bscmake.exe # 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 /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" + +!ELSEIF "$(CFG)" == "ltest - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ltest___" +# PROP BASE Intermediate_Dir "ltest___" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\ltest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" +# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease" + +!ELSEIF "$(CFG)" == "ltest - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ltest__0" +# PROP BASE Intermediate_Dir "ltest__0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\ltest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" +# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug" !ENDIF @@ -79,6 +133,8 @@ LINK32=link.exe # Name "ltest - Win32 Release" # Name "ltest - Win32 Debug" +# Name "ltest - Win32 Single Release" +# Name "ltest - Win32 Single Debug" # Begin Source File SOURCE=.\test.c diff --git a/libraries/libldap/modify.c b/libraries/libldap/modify.c index f10f082da23f60cbd99fb0d76dec947e2e2690d1..71abe8aba1b40af10119037eb91a1d3fefe3d9e1 100644 --- a/libraries/libldap/modify.c +++ b/libraries/libldap/modify.c @@ -20,13 +20,18 @@ #include "ldap-int.h" /* - * ldap_modify - initiate an ldap (and X.500) modify operation. Parameters: + * ldap_modify_ext - initiate an ldap extended modify operation. + * + * Parameters: * * ld LDAP descriptor * dn DN of the object to modify * mods List of modifications to make. This is null-terminated * array of struct ldapmod's, specifying the modifications * to perform. + * sctrls Server Controls + * cctrls Client Controls + * msgidp Message ID pointer * * Example: * LDAPMod *mods[] = { @@ -34,10 +39,15 @@ * { LDAP_MOD_REPLACE, "sn", { "jensen", 0 } }, * 0 * } - * msgid = ldap_modify( ld, dn, mods ); + * rc= ldap_modify_ext( ld, dn, mods, sctrls, cctrls, &msgid ); */ int -ldap_modify( LDAP *ld, char *dn, LDAPMod **mods ) +ldap_modify_ext( LDAP *ld, + LDAP_CONST char *dn, + LDAPMod **mods, + LDAPControl **sctrls, + LDAPControl **cctrls, + int *msgidp ) { BerElement *ber; int i, rc; @@ -60,18 +70,18 @@ ldap_modify( LDAP *ld, char *dn, LDAPMod **mods ) * } */ - Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_TRACE, "ldap_modify_ext\n", 0, 0, 0 ); /* create a message to send */ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) { - return( -1 ); + return( LDAP_NO_MEMORY ); } if ( ber_printf( ber, "{it{s{", ++ld->ld_msgid, LDAP_REQ_MODIFY, dn ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); - return( -1 ); + return( ld->ld_errno ); } /* for each modification to be performed... */ @@ -88,28 +98,79 @@ ldap_modify( LDAP *ld, char *dn, LDAPMod **mods ) if ( rc == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); - return( -1 ); + return( ld->ld_errno ); } } - if ( ber_printf( ber, "}}}" ) == -1 ) { + if ( ber_printf( ber, "}}" ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); - return( -1 ); + return( ld->ld_errno ); + } + + /* Put Server Controls */ + if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { + ber_free( ber, 1 ); + return ld->ld_errno; + } + + if ( ber_printf( ber, "}" ) == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + ber_free( ber, 1 ); + return( ld->ld_errno ); } /* send the message */ - return( ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber )); + *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber ); + return( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS ); +} + +/* + * ldap_modify - initiate an ldap modify operation. + * + * Parameters: + * + * ld LDAP descriptor + * dn DN of the object to modify + * mods List of modifications to make. This is null-terminated + * array of struct ldapmod's, specifying the modifications + * to perform. + * + * Example: + * LDAPMod *mods[] = { + * { LDAP_MOD_ADD, "cn", { "babs jensen", "babs", 0 } }, + * { LDAP_MOD_REPLACE, "sn", { "jensen", 0 } }, + * 0 + * } + * msgid = ldap_modify( ld, dn, mods ); + */ +int +ldap_modify( LDAP *ld, LDAP_CONST char *dn, LDAPMod **mods ) +{ + int rc, msgid; + + Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 ); + + rc = ldap_modify_ext( ld, dn, mods, NULL, NULL, &msgid ); + + if ( rc != LDAP_SUCCESS ) + return -1; + + return msgid; } int -ldap_modify_s( LDAP *ld, char *dn, LDAPMod **mods ) +ldap_modify_ext_s( LDAP *ld, LDAP_CONST char *dn, + LDAPMod **mods, LDAPControl **sctrl, LDAPControl **cctrl ) { + int rc; int msgid; LDAPMessage *res; - if ( (msgid = ldap_modify( ld, dn, mods )) == -1 ) - return( ld->ld_errno ); + rc = ldap_modify_ext( ld, dn, mods, sctrl, cctrl, &msgid ); + + if ( rc != LDAP_SUCCESS ) + return( rc ); if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) return( ld->ld_errno ); @@ -117,3 +178,9 @@ ldap_modify_s( LDAP *ld, char *dn, LDAPMod **mods ) return( ldap_result2error( ld, res, 1 ) ); } +int +ldap_modify_s( LDAP *ld, LDAP_CONST char *dn, LDAPMod **mods ) +{ + return ldap_modify_ext_s( ld, dn, mods, NULL, NULL ); +} + diff --git a/libraries/libldap/modrdn.c b/libraries/libldap/modrdn.c index d148ab552b2b6e9f38bd6bb13015a25736b67a33..8debf4997170827880801f59869401b74093769b 100644 --- a/libraries/libldap/modrdn.c +++ b/libraries/libldap/modrdn.c @@ -33,21 +33,28 @@ #include "ldap-int.h" /* - * ldap_rename2 - initiate an ldap (and X.500) modifyDN operation. Parameters: - * (LDAP V3 MODIFYDN REQUEST) - * ld LDAP descriptor - * dn DN of the object to modify - * newrdn RDN to give the object + * ldap_rename - initiate an ldap extended modifyDN operation. + * + * Parameters: + * ld LDAP descriptor + * dn DN of the object to modify + * newrdn RDN to give the object * deleteoldrdn nonzero means to delete old rdn values from the entry - * newSuperior DN of the new parent if applicable + * newSuperior DN of the new parent if applicable + * + * Returns the LDAP error code. */ int -ldap_rename2( LDAP *ld, - char *dn, - char *newrdn, - int deleteoldrdn, - char *newSuperior ) +ldap_rename( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + int deleteoldrdn, + LDAP_CONST char *newSuperior, + LDAPControl **sctrls, + LDAPControl **cctrls, + int *msgidp ) { /* * A modify rdn request looks like this: @@ -59,137 +66,179 @@ ldap_rename2( LDAP *ld, * } */ - Debug( LDAP_DEBUG_TRACE, "ldap_rename2\n", 0, 0, 0 ); + BerElement *ber; + int rc; - if( newSuperior != NULL ) { - BerElement *ber; - - /* create a message to send */ - if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) { - return( -1 ); - } - - if ( ber_printf( ber, "{it{ssbts}}", - ++ld->ld_msgid, - LDAP_REQ_MODRDN, - dn, - newrdn, - deleteoldrdn, - LDAP_TAG_NEWSUPERIOR, - newSuperior ) - == -1 ) { + Debug( LDAP_DEBUG_TRACE, "ldap_rename\n", 0, 0, 0 ); - ld->ld_errno = LDAP_ENCODING_ERROR; - ber_free( ber, 1 ); - return( -1 ); + /* create a message to send */ + if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) { + return( LDAP_NO_MEMORY ); + } - } + if( newSuperior != NULL ) { + /* must be version 3 (or greater) */ + if ( ld->ld_version == 0 ) { + ld->ld_version = LDAP_VERSION3; + } + + if ( ld->ld_version < LDAP_VERSION3 ) { + ld->ld_errno = LDAP_NOT_SUPPORTED; + ber_free( ber, 1 ); + return( ld->ld_errno ); + } + + rc = ber_printf( ber, "{it{ssbts}", /* leave '}' for later */ + ++ld->ld_msgid, LDAP_REQ_MODDN, + dn, newrdn, deleteoldrdn, + LDAP_TAG_NEWSUPERIOR, newSuperior ); - /* send the message */ - return ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber ); - } else { + rc = ber_printf( ber, "{it{ssb}", /* leave '}' for later */ + ++ld->ld_msgid, LDAP_REQ_MODDN, + dn, newrdn, deleteoldrdn ); + } - /* If no newSuperior fall through to ldap_modrdn2() */ + if ( rc < 0 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + ber_free( ber, 1 ); + return( ld->ld_errno ); + } - return ldap_modrdn2( ld, dn, newrdn, deleteoldrdn ); + /* Put Server Controls */ + if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { + ber_free( ber, 1 ); + return ld->ld_errno; + } + + /* close the '{' */ + rc = ber_printf( ber, "}" ); + if ( rc < 0 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + ber_free( ber, 1 ); + return( ld->ld_errno ); + } + /* send the message */ + *msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber ); + + if( *msgidp < 0 ) { + return( ld->ld_errno ); } -}/* int ldap_rename2() */ + return LDAP_SUCCESS; +} /* - * ldap_modrdn2 - initiate an ldap (and X.500) modifyRDN operation. Parameters: - * + * ldap_rename2 - initiate an ldap (and X.500) modifyDN operation. Parameters: + * (LDAP V3 MODIFYDN REQUEST) * ld LDAP descriptor * dn DN of the object to modify * newrdn RDN to give the object * deleteoldrdn nonzero means to delete old rdn values from the entry + * newSuperior DN of the new parent if applicable * - * Example: - * msgid = ldap_modrdn( ld, dn, newrdn ); + * ldap_rename2 uses a U-Mich Style API. It returns the msgid. */ + int -ldap_modrdn2( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn ) +ldap_rename2( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + int deleteoldrdn, + LDAP_CONST char *newSuperior ) { - BerElement *ber; + int msgid; + int rc; - /* - * A modify rdn request looks like this: - * ModifyRDNRequest ::= SEQUENCE { - * entry DistinguishedName, - * newrdn RelativeDistinguishedName, - * deleteoldrdn BOOLEAN - * } - */ + Debug( LDAP_DEBUG_TRACE, "ldap_rename2\n", 0, 0, 0 ); - Debug( LDAP_DEBUG_TRACE, "ldap_modrdn\n", 0, 0, 0 ); + rc = ldap_rename( ld, dn, newrdn, deleteoldrdn, newSuperior, + NULL, NULL, &msgid ); - /* create a message to send */ - if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) { - return( -1 ); - } + return rc == LDAP_SUCCESS ? msgid : -1; +} - if ( ber_printf( ber, "{it{ssb}}", ++ld->ld_msgid, LDAP_REQ_MODRDN, dn, - newrdn, deleteoldrdn ) == -1 ) { - ld->ld_errno = LDAP_ENCODING_ERROR; - ber_free( ber, 1 ); - return( -1 ); - } - /* send the message */ - return ( ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber )); +/* + * ldap_modrdn2 - initiate an ldap modifyRDN operation. Parameters: + * + * ld LDAP descriptor + * dn DN of the object to modify + * newrdn RDN to give the object + * deleteoldrdn nonzero means to delete old rdn values from the entry + * + * Example: + * msgid = ldap_modrdn( ld, dn, newrdn ); + */ +int +ldap_modrdn2( LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + int deleteoldrdn ) +{ + return ldap_rename2( ld, dn, newrdn, deleteoldrdn, NULL ); } int -ldap_modrdn( LDAP *ld, char *dn, char *newrdn ) +ldap_modrdn( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn ) { - return( ldap_modrdn2( ld, dn, newrdn, 1 ) ); + return( ldap_rename2( ld, dn, newrdn, 1, NULL ) ); } + int -ldap_rename2_s( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn, - char *newSuperior ) +ldap_rename_s( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + int deleteoldrdn, + LDAP_CONST char *newSuperior, + LDAPControl **sctrls, + LDAPControl **cctrls ) { - int msgid; - LDAPMessage *res; + int rc; + int msgid; + LDAPMessage *res; + rc = ldap_rename( ld, dn, newrdn, deleteoldrdn, + newSuperior, sctrls, cctrls, &msgid ); - if ( (msgid = ldap_rename2( ld, - dn, - newrdn, - deleteoldrdn, - newSuperior )) - == -1 ) - return( ld->ld_errno ); + if( rc != LDAP_SUCCESS ) { + return rc; + } - if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) - == -1 ) - return( ld->ld_errno ); + rc = ldap_result( ld, msgid, 1, NULL, &res ); - return( ldap_result2error( ld, res, 1 ) ); + if( rc == -1 ) { + return ld->ld_errno; + } + return ldap_result2error( ld, res, 1 ); } int -ldap_modrdn2_s( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn ) +ldap_rename2_s( + LDAP *ld, + LDAP_CONST char *dn, + LDAP_CONST char *newrdn, + int deleteoldrdn, + LDAP_CONST char *newSuperior ) { - int msgid; - LDAPMessage *res; - - if ( (msgid = ldap_modrdn2( ld, dn, newrdn, deleteoldrdn )) == -1 ) - return( ld->ld_errno ); - - if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 ) - return( ld->ld_errno ); + return ldap_rename_s( ld, dn, newrdn, deleteoldrdn, newSuperior, NULL, NULL ); +} - return( ldap_result2error( ld, res, 1 ) ); +int +ldap_modrdn2_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, int deleteoldrdn ) +{ + return ldap_rename_s( ld, dn, newrdn, deleteoldrdn, NULL, NULL, NULL ); } int -ldap_modrdn_s( LDAP *ld, char *dn, char *newrdn ) +ldap_modrdn_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn ) { - return( ldap_modrdn2_s( ld, dn, newrdn, 1 ) ); + return ldap_rename_s( ld, dn, newrdn, 1, NULL, NULL, NULL ); } diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c index a1db516cbb49b2ca5999d1f76e073b33fb680eb3..e42c95cd0ee650c825359a8cd9ab2c6f5d08c4a0 100644 --- a/libraries/libldap/open.c +++ b/libraries/libldap/open.c @@ -36,7 +36,7 @@ */ LDAP * -ldap_open( char *host, int port ) +ldap_open( LDAP_CONST char *host, int port ) { LDAP *ld; #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS @@ -54,7 +54,7 @@ ldap_open( char *host, int port ) NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host = strdup( ld->ld_defhost )) == NULL )) { if(srv != NULL) free( (char*) srv ); - ldap_ld_free( ld, 0 ); + ldap_ld_free( ld, 0, NULL, NULL ); return( NULL ); } srv->lsrv_port = ld->ld_defport; @@ -62,7 +62,7 @@ ldap_open( char *host, int port ) if (( ld->ld_defconn = ldap_new_connection( ld, &srv, 1,1,0 )) == NULL ) { if ( ld->ld_defhost != NULL ) free( srv->lsrv_host ); free( (char *)srv ); - ldap_ld_free( ld, 0 ); + ldap_ld_free( ld, 0, NULL, NULL ); return( NULL ); } ++ld->ld_defconn->lconn_refcnt; /* so it never gets closed/freed */ @@ -70,7 +70,7 @@ ldap_open( char *host, int port ) #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ if ( open_ldap_connection( ld, &ld->ld_sb, ld->ld_defhost, ld->ld_defport, &ld->ld_host, 0 ) < 0 ) { - ldap_ld_free( ld, 0 ); + ldap_ld_free( ld, 0, NULL, NULL ); return( NULL ); } #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ @@ -92,7 +92,7 @@ ldap_open( char *host, int port ) * ld = ldap_open( host, port ); */ LDAP * -ldap_init( char *defhost, int defport ) +ldap_init( LDAP_CONST char *defhost, int defport ) { LDAP *ld; @@ -199,20 +199,20 @@ ldap_init( char *defhost, int defport ) /* we'll assume we're talking version 2 for now */ ld->ld_version = LDAP_VERSION2; - lber_pvt_sb_init( &(ld->ld_sb) ); + ber_pvt_sb_init( &(ld->ld_sb) ); return( ld ); } int -open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport, +open_ldap_connection( LDAP *ld, Sockbuf *sb, const char *host, int defport, char **krbinstancep, int async ) { int rc = -1; int port; - char *p, *q, *r; - char *curhost, hostname[ 2*MAXHOSTNAMELEN ]; + const char *p, *q; + char *r, *curhost, hostname[ 2*MAXHOSTNAMELEN ]; Debug( LDAP_DEBUG_TRACE, "open_ldap_connection\n", 0, 0, 0 ); @@ -228,7 +228,7 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport, ++q; } } else { - curhost = p; /* avoid copy if possible */ + curhost = (char *) p; /* avoid copy if possible */ q = NULL; } @@ -258,7 +258,7 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport, return( rc ); } - lber_pvt_sb_set_io( sb, &lber_pvt_sb_io_tcp, NULL ); + ber_pvt_sb_set_io( sb, &ber_pvt_sb_io_tcp, NULL ); if ( krbinstancep != NULL ) { #ifdef HAVE_KERBEROS diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index e8d2f30af665b108bcb6a396df2a8f772e899838..0ea0ae81bc4f9435643f521df72f2dc58a6966bd 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -14,32 +14,65 @@ #include "ldap-int.h" static const LDAPAPIFeatureInfo features[] = { -#ifdef LDAP_API_FEATURE_INFO - {"INFO", LDAP_API_FEATURE_INFO}, +#ifdef LDAP_API_FEATURE_X_OPENLDAP + { /* OpenLDAP Extensions API Feature */ + LDAP_FEATURE_INFO_VERSION, + "X_OPENLDAP", + LDAP_API_FEATURE_X_OPENLDAP + }, #endif + #ifdef LDAP_API_FEATURE_THREAD_SAFE - {"THREAD_SAFE", LDAP_API_FEATURE_THREAD_SAFE}, + { /* Basic Thread Safe */ + LDAP_FEATURE_INFO_VERSION, + "THREAD_SAFE", + LDAP_API_FEATURE_THREAD_SAFE + }, #endif #ifdef LDAP_API_FEATURE_SESSION_THREAD_SAFE - {"SESSION_THREAD_SAFE", LDAP_API_FEATURE_SESSION_THREAD_SAFE}, + { /* Session Thread Safe */ + LDAP_FEATURE_INFO_VERSION, + "SESSION_THREAD_SAFE", + LDAP_API_FEATURE_SESSION_THREAD_SAFE + }, #endif #ifdef LDAP_API_FEATURE_OPERATION_THREAD_SAFE - {"OPERATION_THREAD_SAFE", LDAP_API_FEATURE_OPERATION_THREAD_SAFE}, + { /* Operation Thread Safe */ + LDAP_FEATURE_INFO_VERSION, + "OPERATION_THREAD_SAFE", + LDAP_API_FEATURE_OPERATION_THREAD_SAFE + }, #endif #ifdef LDAP_API_FEATURE_X_OPENLDAP_REENTRANT - {"X_OPENLDAP_REENTRANT", LDAP_API_FEATURE_X_OPENLDAP_REENTRANT}, + { /* OpenLDAP Reentrant */ + LDAP_FEATURE_INFO_VERSION, + "X_OPENLDAP_REENTRANT", + LDAP_API_FEATURE_X_OPENLDAP_REENTRANT + }, #endif #if defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ) && \ defined( LDAP_THREAD_SAFE ) - {"X_OPENLDAP_THREAD_SAFE", LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE}, + { /* OpenLDAP Thread Safe */ + LDAP_FEATURE_INFO_VERSION, + "X_OPENLDAP_THREAD_SAFE", + LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE + }, #endif #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS - {"X_OPENLDAP_V2_DNS", LDAP_API_FEATURE_X_OPENLDAP_V2_DNS}, + { /* DNS */ + LDAP_FEATURE_INFO_VERSION, + "X_OPENLDAP_V2_DNS", + LDAP_API_FEATURE_X_OPENLDAP_V2_DNS + }, #endif #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS - {"X_OPENLDAP_V2_REFERRALS", LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS}, + { /* V2 Referrals */ + LDAP_FEATURE_INFO_VERSION, + "X_OPENLDAP_V2_REFERRALS", + LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS + }, #endif - {NULL, 0} + {0, NULL, 0} }; int @@ -111,7 +144,7 @@ ldap_get_option( break; } - * (int *) outvalue = lber_pvt_sb_get_desc( &(ld->ld_sb) ); + * (int *) outvalue = ber_pvt_sb_get_desc( &(ld->ld_sb) ); return 0; case LDAP_OPT_DEREF: @@ -151,13 +184,13 @@ ldap_get_option( case LDAP_OPT_SERVER_CONTROLS: * (LDAPControl ***) outvalue = - ldap_controls_dup( lo->ldo_server_controls ); + ldap_controls_dup( lo->ldo_sctrls ); return 0; case LDAP_OPT_CLIENT_CONTROLS: * (LDAPControl ***) outvalue = - ldap_controls_dup( lo->ldo_client_controls ); + ldap_controls_dup( lo->ldo_cctrls ); return 0; @@ -203,6 +236,13 @@ ldap_get_option( int i; if(info == NULL) return -1; + + if(info->ldapaif_info_version != LDAP_FEATURE_INFO_VERSION) { + /* api info version mismatch */ + info->ldapaif_info_version = LDAP_FEATURE_INFO_VERSION; + return -1; + } + if(info->ldapaif_name == NULL) return -1; for(i=0; features[i].ldapaif_name != NULL; i++) { @@ -298,17 +338,17 @@ ldap_set_option( case LDAP_OPT_SERVER_CONTROLS: { LDAPControl **controls = (LDAPControl **) invalue; - ldap_controls_free( lo->ldo_server_controls ); + ldap_controls_free( lo->ldo_sctrls ); if( controls == NULL || *controls == NULL ) { - lo->ldo_server_controls = NULL; + lo->ldo_sctrls = NULL; return 0; } - lo->ldo_server_controls = + lo->ldo_sctrls = ldap_controls_dup( (LDAPControl **) invalue ); - if(lo->ldo_server_controls == NULL) { + if(lo->ldo_sctrls == NULL) { /* memory allocation error ? */ break; } @@ -317,17 +357,17 @@ ldap_set_option( case LDAP_OPT_CLIENT_CONTROLS: { LDAPControl **controls = (LDAPControl **) invalue; - ldap_controls_free( lo->ldo_client_controls ); + ldap_controls_free( lo->ldo_cctrls ); if( controls == NULL || *controls == NULL ) { - lo->ldo_client_controls = NULL; + lo->ldo_cctrls = NULL; return 0; } - lo->ldo_client_controls = + lo->ldo_cctrls = ldap_controls_dup( (LDAPControl **) invalue ); - if(lo->ldo_client_controls == NULL) { + if(lo->ldo_cctrls == NULL) { /* memory allocation error ? */ break; } diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 54e068b2a19b60a4dc88e6bee73a60dc11f8d42a..e30fcb5a82e16de63c6af7d72f7544a509a416fd 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -33,7 +33,7 @@ #include "ldap-int.h" int -ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, +ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address, int port, int async ) /* * if host == NULL, connect using address @@ -140,7 +140,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, } } - lber_pvt_sb_set_desc( sb, s ); + ber_pvt_sb_set_desc( sb, s ); if ( connected ) { @@ -167,7 +167,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, void ldap_close_connection( Sockbuf *sb ) { - lber_pvt_sb_close( sb ); + ber_pvt_sb_close( sb ); } @@ -189,7 +189,7 @@ ldap_host_connected_to( Sockbuf *sb ) (void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in )); len = sizeof( sin ); - if ( getpeername( lber_pvt_sb_get_desc(sb), (struct sockaddr *)&sin, &len ) == -1 ) { + if ( getpeername( ber_pvt_sb_get_desc(sb), (struct sockaddr *)&sin, &len ) == -1 ) { return( NULL ); } @@ -233,7 +233,7 @@ ldap_mark_select_write( LDAP *ld, Sockbuf *sb ) sip = (struct selectinfo *)ld->ld_selectinfo; - if ( !FD_ISSET( lber_pvt_sb_get_desc(sb), &sip->si_writefds )) { + if ( !FD_ISSET( ber_pvt_sb_get_desc(sb), &sip->si_writefds )) { FD_SET( (u_int) sb->sb_sd, &sip->si_writefds ); } } @@ -246,7 +246,7 @@ ldap_mark_select_read( LDAP *ld, Sockbuf *sb ) sip = (struct selectinfo *)ld->ld_selectinfo; - if ( !FD_ISSET( lber_pvt_sb_get_desc(sb), &sip->si_readfds )) { + if ( !FD_ISSET( ber_pvt_sb_get_desc(sb), &sip->si_readfds )) { FD_SET( (u_int) sb->sb_sd, &sip->si_readfds ); } } @@ -259,8 +259,8 @@ ldap_mark_select_clear( LDAP *ld, Sockbuf *sb ) sip = (struct selectinfo *)ld->ld_selectinfo; - FD_CLR( (u_int) lber_pvt_sb_get_desc(sb), &sip->si_writefds ); - FD_CLR( (u_int) lber_pvt_sb_get_desc(sb), &sip->si_readfds ); + FD_CLR( (u_int) ber_pvt_sb_get_desc(sb), &sip->si_writefds ); + FD_CLR( (u_int) ber_pvt_sb_get_desc(sb), &sip->si_readfds ); } @@ -271,7 +271,7 @@ ldap_is_write_ready( LDAP *ld, Sockbuf *sb ) sip = (struct selectinfo *)ld->ld_selectinfo; - return( FD_ISSET( lber_pvt_sb_get_desc(sb), &sip->si_use_writefds )); + return( FD_ISSET( ber_pvt_sb_get_desc(sb), &sip->si_use_writefds )); } @@ -282,7 +282,7 @@ ldap_is_read_ready( LDAP *ld, Sockbuf *sb ) sip = (struct selectinfo *)ld->ld_selectinfo; - return( FD_ISSET( lber_pvt_sb_get_desc(sb), &sip->si_use_readfds )); + return( FD_ISSET( ber_pvt_sb_get_desc(sb), &sip->si_use_readfds )); } diff --git a/libraries/libldap/print.c b/libraries/libldap/print.c index ee021296fa374d8dc351ecd31e17bd2a1f629e48..f8203c1604def10e36157f19abad00dd34caee2a 100644 --- a/libraries/libldap/print.c +++ b/libraries/libldap/print.c @@ -33,7 +33,7 @@ static int ldap_log_check( LDAP *ld, int loglvl ) int ldap_log_printf #ifdef HAVE_STDARG - ( LDAP *ld, int loglvl, char *fmt, ... ) + ( LDAP *ld, int loglvl, const char *fmt, ... ) #else ( va_alist ) va_dcl @@ -72,6 +72,6 @@ va_dcl va_end(ap); - (*lber_pvt_log_print)( buf ); + (*ber_pvt_log_print)( buf ); return 1; } diff --git a/libraries/libldap/references.c b/libraries/libldap/references.c index fd56c9ce00bff1baafc54db5001731880eab6c1b..176a72c9ec4628ada2c588114c5fc3e98feb0d0a 100644 --- a/libraries/libldap/references.c +++ b/libraries/libldap/references.c @@ -107,7 +107,7 @@ ldap_parse_reference( goto free_and_return; } - rc = ldap_get_ber_controls( &be, serverctrls ); + rc = ldap_int_get_controls( &be, serverctrls ); free_and_return: diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index ed56a0563bbb61bf2ee7f590336660e5f7046c34..24c9d218501bd8486db21f8a44baa464bd7a2584 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -45,7 +45,7 @@ ldap_alloc_ber_with_options( LDAP *ld ) { BerElement *ber; - if (( ber = ber_alloc_t( ld->ld_lberoptions )) == NULLBER ) { + if (( ber = ber_alloc_t( ld->ld_lberoptions )) == NULLBER ) { ld->ld_errno = LDAP_NO_MEMORY; #ifdef STR_TRANSLATION } else { @@ -72,7 +72,10 @@ ldap_set_ber_options( LDAP *ld, BerElement *ber ) int -ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn, +ldap_send_initial_request( + LDAP *ld, + unsigned long msgtype, + const char *dn, BerElement *ber ) { #if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS ) @@ -81,7 +84,7 @@ ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn, Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 ); - if ( ! lber_pvt_sb_in_use(&ld->ld_sb ) ) { + if ( ! ber_pvt_sb_in_use(&ld->ld_sb ) ) { /* not connected yet */ #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS @@ -300,7 +303,7 @@ ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb, * XXX open connection synchronously for now */ if (( lc = (LDAPConn *)calloc( 1, sizeof( LDAPConn ))) == NULL || - ( !use_ldsb && ( (sb = lber_pvt_sb_alloc()) == NULL ))) { + ( !use_ldsb && ( (sb = ber_sockbuf_alloc()) == NULL ))) { if ( lc != NULL ) { free( (char *)lc ); } @@ -324,7 +327,7 @@ ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb, if ( srv == NULL ) { if ( !use_ldsb ) { - lber_pvt_sb_free( lc->lconn_sb ); + ber_sockbuf_free( lc->lconn_sb ); } free( (char *)lc ); ld->ld_errno = LDAP_SERVER_DOWN; @@ -444,10 +447,10 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind ) if ( lc->lconn_status == LDAP_CONNST_CONNECTED ) { ldap_mark_select_clear( ld, lc->lconn_sb ); if ( unbind ) { - ldap_send_unbind( ld, lc->lconn_sb ); + ldap_send_unbind( ld, lc->lconn_sb, NULL, NULL ); } ldap_close_connection( lc->lconn_sb ); - lber_pvt_sb_destroy( lc->lconn_sb ); + ber_pvt_sb_destroy( lc->lconn_sb ); ber_clear( &lc->lconn_ber, 1 ); } prevlc = NULL; @@ -468,7 +471,7 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind ) free( lc->lconn_krbinstance ); } if ( lc->lconn_sb != &ld->ld_sb ) { - lber_pvt_sb_free( lc->lconn_sb ); + ber_sockbuf_free( lc->lconn_sb ); } free( lc ); Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: actually freed\n", @@ -878,7 +881,7 @@ re_encode_request( LDAP *ld, BerElement *origber, int msgid, char **dnp ) if ( ldap_debug & LDAP_DEBUG_PACKETS ) { Debug( LDAP_DEBUG_ANY, "re_encode_request new request is:\n", 0, 0, 0 ); - lber_log_dump( LDAP_DEBUG_BER, ldap_debug, ber, 0 ); + ber_log_dump( LDAP_DEBUG_BER, ldap_debug, ber, 0 ); } #endif /* LDAP_DEBUG */ diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index 40729f18c5d0fc3eaa942f623624edc404a7a36f..affb590d46552f20d21fd5219ce785ce23aa4744 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -166,7 +166,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout, while ( rc == -2 ) { #ifndef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS /* hack attack */ - if ( ! lber_pvt_sb_data_ready(&ld->ld_sb) ) { + if ( ! ber_pvt_sb_data_ready(&ld->ld_sb) ) { rc = ldap_select1( ld, tvp ); if ( rc == 0 || ( rc == -1 && ( @@ -192,7 +192,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout, } #endif /* LDAP_DEBUG */ for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) { - if ( lber_pvt_sb_data_ready(lc->lconn_sb) ) { + if ( ber_pvt_sb_data_ready(lc->lconn_sb) ) { rc = try_read1msg( ld, msgid, all, lc->lconn_sb, lc, result ); break; @@ -578,7 +578,7 @@ merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ) } parentr->lr_res_error = lr->lr_res_error; lr->lr_res_error = NULL; - if ( NAME_ERROR( lr->lr_res_errno )) { + if ( LDAP_NAME_ERROR( lr->lr_res_errno )) { if ( parentr->lr_res_matched != NULL ) { free( parentr->lr_res_matched ); } @@ -622,7 +622,7 @@ ldap_select1( LDAP *ld, struct timeval *timeout ) } FD_ZERO( &readfds ); - FD_SET( lber_pvt_sb_get_desc(&ld->ld_sb), &readfds ); + FD_SET( ber_pvt_sb_get_desc(&ld->ld_sb), &readfds ); return( select( tblsize, &readfds, 0, 0, timeout ) ); } @@ -744,7 +744,7 @@ cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber ) int rc; unsigned long tag, len; - if ( ! lber_pvt_sb_data_ready(&ld->ld_sb) ) { + if ( ! ber_pvt_sb_data_ready(&ld->ld_sb) ) { rc = ldap_select1( ld, timeout ); if ( rc == -1 || rc == 0 ) { ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN : diff --git a/libraries/libldap/sbind.c b/libraries/libldap/sbind.c index e4753c3497977aa4668799231fbc0ea5301b9264..e6a4f96bd4e6bdca03bc71f5015e4e05834f1bef 100644 --- a/libraries/libldap/sbind.c +++ b/libraries/libldap/sbind.c @@ -31,7 +31,7 @@ */ int -ldap_simple_bind( LDAP *ld, char *dn, char *passwd ) +ldap_simple_bind( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd ) { BerElement *ber; @@ -89,7 +89,7 @@ ldap_simple_bind( LDAP *ld, char *dn, char *passwd ) */ int -ldap_simple_bind_s( LDAP *ld, char *dn, char *passwd ) +ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd ) { int msgid; LDAPMessage *result; diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index 117d5f4d2ee1f7b9db238d6ca25502433bee531a..dd7f26f734fe3a1a82876cb618929722dfb17280 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -30,7 +30,9 @@ static int put_substring_filter LDAP_P(( BerElement *ber, char *type, char *str static int put_filter_list LDAP_P(( BerElement *ber, char *str )); /* - * ldap_search - initiate an ldap (and X.500) search operation. Parameters: + * ldap_search - initiate an ldap search operation. + * + * Parameters: * * ld LDAP descriptor * base DN of the base object @@ -47,7 +49,7 @@ static int put_filter_list LDAP_P(( BerElement *ber, char *str )); * attrs, attrsonly ); */ int -ldap_search( LDAP *ld, char *base, int scope, char *filter, +ldap_search( LDAP *ld, LDAP_CONST char *base, int scope, LDAP_CONST char *filter, char **attrs, int attrsonly ) { BerElement *ber; @@ -55,7 +57,7 @@ ldap_search( LDAP *ld, char *base, int scope, char *filter, Debug( LDAP_DEBUG_TRACE, "ldap_search\n", 0, 0, 0 ); if (( ber = ldap_build_search_req( ld, base, scope, filter, attrs, - attrsonly )) == NULLBER ) { + attrsonly, NULL, NULL )) == NULLBER ) { return( -1 ); } @@ -76,11 +78,20 @@ ldap_search( LDAP *ld, char *base, int scope, char *filter, BerElement * -ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter, - char **attrs, int attrsonly ) +ldap_build_search_req( + LDAP *ld, + LDAP_CONST char *base_in, + int scope, + LDAP_CONST char *filter_in, + char **attrs, + int attrsonly, + LDAPControl **sctrls, + LDAPControl **cctrls ) { BerElement *ber; int err; + char *base; + char *filter; /* * Create the search request. It looks like this: @@ -111,9 +122,11 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter, return( NULLBER ); } - if ( base == NULL ) { + if ( base_in == NULL ) { /* no base provided, use session default base */ base = ld->ld_options.ldo_defbase; + } else { + base = (char *) base_in; } if ( base == NULL ) { @@ -141,7 +154,7 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter, return( NULLBER ); } - filter = strdup( filter ); + filter = strdup( filter_in ); err = put_filter( ber, filter ); free( filter ); @@ -151,7 +164,19 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter, return( NULLBER ); } - if ( ber_printf( ber, "{v}}}", attrs ) == -1 ) { + if ( ber_printf( ber, "{v}}", attrs ) == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + ber_free( ber, 1 ); + return( NULLBER ); + } + + /* Put Server Controls */ + if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { + ber_free( ber, 1 ); + return( NULLBER ); + } + + if ( ber_printf( ber, "}", attrs ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); return( NULLBER ); @@ -519,7 +544,9 @@ put_substring_filter( BerElement *ber, char *type, char *val ) } int -ldap_search_st( LDAP *ld, char *base, int scope, char *filter, char **attrs, +ldap_search_st( + LDAP *ld, LDAP_CONST char *base, int scope, + LDAP_CONST char *filter, char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res ) { int msgid; @@ -541,8 +568,14 @@ ldap_search_st( LDAP *ld, char *base, int scope, char *filter, char **attrs, } int -ldap_search_s( LDAP *ld, char *base, int scope, char *filter, char **attrs, - int attrsonly, LDAPMessage **res ) +ldap_search_s( + LDAP *ld, + LDAP_CONST char *base, + int scope, + LDAP_CONST char *filter, + char **attrs, + int attrsonly, + LDAPMessage **res ) { int msgid; diff --git a/libraries/libldap/sort.c b/libraries/libldap/sort.c index cab92cc7d75759c47e5e31a3339ffde27a0b1ba4..36570bb1331c7ad6c9931f10e7162012a318b2a3 100644 --- a/libraries/libldap/sort.c +++ b/libraries/libldap/sort.c @@ -80,8 +80,8 @@ int ldap_sort_entries( LDAP *ld, LDAPMessage **chain, - char *attr, /* NULL => sort by DN */ - int (*cmp) (const char *, const char *) + LDAP_CONST char *attr, /* NULL => sort by DN */ + int (*cmp) (LDAP_CONST char *, LDAP_CONST char *) ) { int i, count; diff --git a/libraries/libldap/ufn.c b/libraries/libldap/ufn.c index f6dc616e750c538926122a2b03327ec55aa2b7ee..aad63aa341faff00a9b45a40c9d3494ea143dcdd 100644 --- a/libraries/libldap/ufn.c +++ b/libraries/libldap/ufn.c @@ -217,7 +217,8 @@ ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix, } int -ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly, +ldap_ufn_search_ct( + LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly, LDAPMessage **res, cancelptype cancelproc, void *cancelparm, char *tag1, char *tag2, char *tag3 ) { @@ -302,7 +303,8 @@ ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly, * ldapfilter.conf tags. */ int -ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs, int attrsonly, +ldap_ufn_search_c( + LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly, LDAPMessage **res, cancelptype cancelproc, void *cancelparm ) { return( ldap_ufn_search_ct( ld, ufn, attrs, attrsonly, res, cancelproc, @@ -313,7 +315,8 @@ ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs, int attrsonly, * same as ldap_ufn_search_c without the cancel function */ int -ldap_ufn_search_s( LDAP *ld, char *ufn, char **attrs, int attrsonly, +ldap_ufn_search_s( + LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly, LDAPMessage **res ) { struct timeval tv; @@ -459,7 +462,7 @@ ldap_ufn_expand( LDAP *ld, cancelptype cancelproc, void *cancelparm, */ LDAPFiltDesc * -ldap_ufn_setfilter( LDAP *ld, char *fname ) +ldap_ufn_setfilter( LDAP *ld, LDAP_CONST char *fname ) { if ( ld->ld_filtd != NULL ) ldap_getfilter_free( ld->ld_filtd ); @@ -468,7 +471,7 @@ ldap_ufn_setfilter( LDAP *ld, char *fname ) } void -ldap_ufn_setprefix( LDAP *ld, char *prefix ) +ldap_ufn_setprefix( LDAP *ld, LDAP_CONST char *prefix ) { if ( ld->ld_ufnprefix != NULL ) free( ld->ld_ufnprefix ); diff --git a/libraries/libldap/unbind.c b/libraries/libldap/unbind.c index 7f17a1bb7363c24306d15a0f2caf251fcd59f363..fb1c2e4d4d4f2d8b3edb289c71c787cffdf9d7f5 100644 --- a/libraries/libldap/unbind.c +++ b/libraries/libldap/unbind.c @@ -20,18 +20,30 @@ #include "ldap-int.h" +int +ldap_unbind_ext( + LDAP *ld, + LDAPControl **sctrls, + LDAPControl **cctrls ) +{ + return ldap_ld_free( ld, 1, sctrls, cctrls ); +} int ldap_unbind( LDAP *ld ) { Debug( LDAP_DEBUG_TRACE, "ldap_unbind\n", 0, 0, 0 ); - return( ldap_ld_free( ld, 1 )); + return( ldap_unbind_ext( ld, NULL, NULL ) ); } int -ldap_ld_free( LDAP *ld, int close ) +ldap_ld_free( + LDAP *ld, + int close, + LDAPControl **sctrls, + LDAPControl **cctrls ) { LDAPMessage *lm, *next; int err = LDAP_SUCCESS; @@ -53,7 +65,7 @@ ldap_ld_free( LDAP *ld, int close ) } #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ if ( close ) { - err = ldap_send_unbind( ld, &ld->ld_sb ); + err = ldap_send_unbind( ld, &ld->ld_sb, sctrls, cctrls ); ldap_close_connection( &ld->ld_sb ); } #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ @@ -101,7 +113,7 @@ ldap_ld_free( LDAP *ld, int close ) if ( ld->ld_options.ldo_defhost != NULL ) free( ld->ld_options.ldo_defhost ); - lber_pvt_sb_destroy( &(ld->ld_sb) ); + ber_pvt_sb_destroy( &(ld->ld_sb) ); free( (char *) ld ); @@ -113,12 +125,16 @@ ldap_ld_free( LDAP *ld, int close ) int ldap_unbind_s( LDAP *ld ) { - return( ldap_ld_free( ld, 1 )); + return( ldap_unbind_ext( ld, NULL, NULL ) ); } int -ldap_send_unbind( LDAP *ld, Sockbuf *sb ) +ldap_send_unbind( + LDAP *ld, + Sockbuf *sb, + LDAPControl **sctrls, + LDAPControl **cctrls ) { BerElement *ber; @@ -130,7 +146,20 @@ ldap_send_unbind( LDAP *ld, Sockbuf *sb ) } /* fill it in */ - if ( ber_printf( ber, "{itn}", ++ld->ld_msgid, + if ( ber_printf( ber, "{itn", ++ld->ld_msgid, + LDAP_REQ_UNBIND ) == -1 ) { + ld->ld_errno = LDAP_ENCODING_ERROR; + ber_free( ber, 1 ); + return( ld->ld_errno ); + } + + /* Put Server Controls */ + if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) { + ber_free( ber, 1 ); + return ld->ld_errno; + } + + if ( ber_printf( ber, "}", ++ld->ld_msgid, LDAP_REQ_UNBIND ) == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index d7af4a9c43f11e0a7391c62c5f8c6767fe135f5f..781ff2f6f5c2401860740cacdcdd39d027dcce5c 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -35,60 +35,65 @@ /* local functions */ -static int skip_url_prefix LDAP_P(( char **urlp, int *enclosedp )); +static const char* skip_url_prefix LDAP_P(( const char *url, int *enclosedp )); static void hex_unescape LDAP_P(( char *s )); static int unhex( char c ); int -ldap_is_ldap_url( char *url ) +ldap_is_ldap_url( LDAP_CONST char *url ) { int enclosed; - return( url != NULL && skip_url_prefix( &url, &enclosed )); + return( url != NULL && skip_url_prefix( url, &enclosed ) != NULL ); } -static int -skip_url_prefix( char **urlp, int *enclosedp ) +static const char* +skip_url_prefix( const char *url, int *enclosedp ) { /* * return non-zero if this looks like a LDAP URL; zero if not * if non-zero returned, *urlp will be moved past "ldap://" part of URL */ - if ( *urlp == NULL ) { - return( 0 ); + char* p; + + if ( url == NULL ) { + return( NULL ); } + p = (char *) url; + /* skip leading '<' (if any) */ - if ( **urlp == '<' ) { + if ( *p == '<' ) { *enclosedp = 1; - ++*urlp; + ++p; } else { *enclosedp = 0; } /* skip leading "URL:" (if any) */ - if ( strlen( *urlp ) >= LDAP_URL_URLCOLON_LEN && strncasecmp( - *urlp, LDAP_URL_URLCOLON, LDAP_URL_URLCOLON_LEN ) == 0 ) { - *urlp += LDAP_URL_URLCOLON_LEN; + if ( strlen( p ) >= LDAP_URL_URLCOLON_LEN + && strncasecmp( p, LDAP_URL_URLCOLON, LDAP_URL_URLCOLON_LEN ) == 0 ) + { + p += LDAP_URL_URLCOLON_LEN; } /* check for missing "ldap://" prefix */ - if ( strlen( *urlp ) < LDAP_URL_PREFIX_LEN || - strncasecmp( *urlp, LDAP_URL_PREFIX, LDAP_URL_PREFIX_LEN ) != 0 ) { - return( 0 ); + if ( strlen( p ) < LDAP_URL_PREFIX_LEN || + strncasecmp( p, LDAP_URL_PREFIX, LDAP_URL_PREFIX_LEN ) != 0 ) { + return( NULL ); } /* skip over "ldap://" prefix and return success */ - *urlp += LDAP_URL_PREFIX_LEN; - return( 1 ); + p += LDAP_URL_PREFIX_LEN; + return( p ); } int -ldap_url_parse( char *url, LDAPURLDesc **ludpp ) +ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp ) { /* * Pick apart the pieces of an LDAP URL. @@ -97,27 +102,33 @@ ldap_url_parse( char *url, LDAPURLDesc **ludpp ) LDAPURLDesc *ludp; char *attrs, *p, *q; int enclosed, i, nattrs; + const char *url_tmp; + char *url; Debug( LDAP_DEBUG_TRACE, "ldap_url_parse(%s)\n", url, 0, 0 ); *ludpp = NULL; /* pessimistic */ - if ( !skip_url_prefix( &url, &enclosed )) { + url_tmp = skip_url_prefix( url_in, &enclosed ); + + if ( url_tmp == NULL ) { return( LDAP_URL_ERR_NOTLDAP ); } - /* allocate return struct */ - if (( ludp = (LDAPURLDesc *)calloc( 1, sizeof( LDAPURLDesc ))) - == NULLLDAPURLDESC ) { + /* make working copy of the remainder of the URL */ + if (( url = strdup( url_tmp )) == NULL ) { return( LDAP_URL_ERR_MEM ); } - /* make working copy of the remainder of the URL */ - if (( url = strdup( url )) == NULL ) { - ldap_free_urldesc( ludp ); + /* allocate return struct */ + if (( ludp = (LDAPURLDesc *)calloc( 1, sizeof( LDAPURLDesc ))) + == NULLLDAPURLDESC ) + { + free( url ); return( LDAP_URL_ERR_MEM ); } + if ( enclosed && *((p = url + strlen( url ) - 1)) == '>' ) { *p = '\0'; } @@ -239,7 +250,7 @@ ldap_free_urldesc( LDAPURLDesc *ludp ) int -ldap_url_search( LDAP *ld, char *url, int attrsonly ) +ldap_url_search( LDAP *ld, LDAP_CONST char *url, int attrsonly ) { int err; LDAPURLDesc *ludp; @@ -254,7 +265,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly ) } if (( ber = ldap_build_search_req( ld, ludp->lud_dn, ludp->lud_scope, - ludp->lud_filter, ludp->lud_attrs, attrsonly )) == NULLBER ) { + ludp->lud_filter, ludp->lud_attrs, attrsonly, NULL, NULL )) == NULLBER ) { return( -1 ); } @@ -274,7 +285,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly ) if ( ludp->lud_port == 0 ) { srv->lsrv_port = openldap_ldap_global_options.ldo_defport; } else { - srv->lsrv_port = ludp->lud_port; + srv->lsrv_port = ludp->lud_port; } } #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */ @@ -302,7 +313,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly ) int -ldap_url_search_st( LDAP *ld, char *url, int attrsonly, +ldap_url_search_st( LDAP *ld, LDAP_CONST char *url, int attrsonly, struct timeval *timeout, LDAPMessage **res ) { int msgid; @@ -326,7 +337,8 @@ ldap_url_search_st( LDAP *ld, char *url, int attrsonly, int -ldap_url_search_s( LDAP *ld, char *url, int attrsonly, LDAPMessage **res ) +ldap_url_search_s( + LDAP *ld, LDAP_CONST char *url, int attrsonly, LDAPMessage **res ) { int msgid; diff --git a/libraries/libldap_r/libldap_r.dsp b/libraries/libldap_r/libldap_r.dsp index beb07505d6653e5d0c77a91b66a2a9faec7fe6ab..c6028d59727c4f3700effd1e8699032f5a729cc6 100644 --- a/libraries/libldap_r/libldap_r.dsp +++ b/libraries/libldap_r/libldap_r.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Static Library" 0x0104 -CFG=libldap_r - Win32 Debug +CFG=libldap_r - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=libldap_r - Win32 Debug !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 "libldap_r.mak" CFG="libldap_r - Win32 Debug" +!MESSAGE NMAKE /f "libldap_r.mak" CFG="libldap_r - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "libldap_r - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "libldap_r - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "libldap_r - Win32 Single Debug" (based on\ + "Win32 (x86) Static Library") +!MESSAGE "libldap_r - Win32 Single Release" (based on\ + "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -36,10 +40,10 @@ CPP=cl.exe # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\Release" -# PROP Intermediate_Dir "Release" +# PROP Intermediate_Dir "Release\libldap_r" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -57,10 +61,10 @@ LIB32=link.exe -lib # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\Debug" -# PROP Intermediate_Dir "Debug" +# PROP Intermediate_Dir "Debug\libldap_r" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "_DEBUG" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -68,12 +72,56 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\Debug\oldap_r.lib" +!ELSEIF "$(CFG)" == "libldap_r - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "libldap_" +# PROP BASE Intermediate_Dir "libldap_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\libldap_r" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "_DEBUG" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "_DEBUG" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\Debug\oldap_r.lib" +# ADD LIB32 /nologo /out:"..\SDebug\oldap_r.lib" + +!ELSEIF "$(CFG)" == "libldap_r - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "libldap0" +# PROP BASE Intermediate_Dir "libldap0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\libldap_r" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\Release\oldap_r.lib" +# ADD LIB32 /nologo /out:"..\SRelease\oldap_r.lib" + !ENDIF # Begin Target # Name "libldap_r - Win32 Release" # Name "libldap_r - Win32 Debug" +# Name "libldap_r - Win32 Single Debug" +# Name "libldap_r - Win32 Single Release" # Begin Source File SOURCE=..\libldap\abandon.c @@ -172,18 +220,6 @@ SOURCE=..\libldap\kbind.c # End Source File # Begin Source File -SOURCE="..\liblber\lber-int.h" -# End Source File -# Begin Source File - -SOURCE=..\..\include\lber.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\lber_pvt.h -# End Source File -# Begin Source File - SOURCE="..\libldap\ldap-int.h" # End Source File # Begin Source File @@ -208,7 +244,7 @@ SOURCE=..\..\include\ldap_pvt.h # End Source File # Begin Source File -SOURCE=..\..\include\ldapconfig.h +SOURCE=..\..\include\ldap_pvt_thread.h # End Source File # Begin Source File @@ -232,10 +268,6 @@ SOURCE="..\libldap\os-ip.c" # End Source File # Begin Source File -SOURCE=..\..\include\portable.h -# End Source File -# Begin Source File - SOURCE=..\libldap\print.c # End Source File # Begin Source File diff --git a/libraries/libldap_r/rdwr.c b/libraries/libldap_r/rdwr.c index 294fe8054f1dc256024b0a7ddb8f9d3217300187..60e2a420b69da768127daef7d327b1addcc3c40f 100644 --- a/libraries/libldap_r/rdwr.c +++ b/libraries/libldap_r/rdwr.c @@ -27,6 +27,8 @@ int ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw ) { + assert( rw != NULL ); + memset( rw, 0, sizeof(ldap_pvt_thread_rdwr_t) ); /* we should check return results */ @@ -41,6 +43,9 @@ ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw ) int ldap_pvt_thread_rdwr_destroy( ldap_pvt_thread_rdwr_t *rw ) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID ) return LDAP_PVT_THREAD_EINVAL; @@ -71,6 +76,9 @@ ldap_pvt_thread_rdwr_destroy( ldap_pvt_thread_rdwr_t *rw ) int ldap_pvt_thread_rdwr_rlock( ldap_pvt_thread_rdwr_t *rw ) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID ) return LDAP_PVT_THREAD_EINVAL; @@ -98,6 +106,9 @@ int ldap_pvt_thread_rdwr_rlock( ldap_pvt_thread_rdwr_t *rw ) int ldap_pvt_thread_rdwr_rtrylock( ldap_pvt_thread_rdwr_t *rw ) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID ) return LDAP_PVT_THREAD_EINVAL; @@ -117,6 +128,9 @@ int ldap_pvt_thread_rdwr_rtrylock( ldap_pvt_thread_rdwr_t *rw ) int ldap_pvt_thread_rdwr_runlock( ldap_pvt_thread_rdwr_t *rw ) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID ) return LDAP_PVT_THREAD_EINVAL; @@ -135,6 +149,9 @@ int ldap_pvt_thread_rdwr_runlock( ldap_pvt_thread_rdwr_t *rw ) int ldap_pvt_thread_rdwr_wlock( ldap_pvt_thread_rdwr_t *rw ) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID ) return LDAP_PVT_THREAD_EINVAL; @@ -160,6 +177,9 @@ int ldap_pvt_thread_rdwr_wlock( ldap_pvt_thread_rdwr_t *rw ) int ldap_pvt_thread_rdwr_wtrylock( ldap_pvt_thread_rdwr_t *rw ) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID ) return LDAP_PVT_THREAD_EINVAL; @@ -179,6 +199,9 @@ int ldap_pvt_thread_rdwr_wtrylock( ldap_pvt_thread_rdwr_t *rw ) int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw ) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID ) return LDAP_PVT_THREAD_EINVAL; @@ -212,16 +235,25 @@ int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw ) int ldap_pvt_thread_rdwr_readers(ldap_pvt_thread_rdwr_t *rw) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + return( rw->ltrw_r_active ); } int ldap_pvt_thread_rdwr_writers(ldap_pvt_thread_rdwr_t *rw) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + return( rw->ltrw_w_active ); } int ldap_pvt_thread_rdwr_active(ldap_pvt_thread_rdwr_t *rw) { + assert( rw != NULL ); + assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID ); + return(ldap_pvt_thread_rdwr_readers(rw) + ldap_pvt_thread_rdwr_writers(rw)); } diff --git a/libraries/libldap_r/thr_nt.c b/libraries/libldap_r/thr_nt.c index 1a884eba07d03a0d7bd43993b7520b38ab3f9087..a9b72b2e77c50b7251b1eee6bde4ed420e3be134 100644 --- a/libraries/libldap_r/thr_nt.c +++ b/libraries/libldap_r/thr_nt.c @@ -14,7 +14,6 @@ #include "ldap_pvt_thread.h" #if defined( HAVE_NT_THREADS ) -#include <process.h> int ldap_pvt_thread_initialize( void ) @@ -49,7 +48,7 @@ int ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return ) { DWORD status; - status = WaitForSingleObject( thread, INFINITE ); + status = WaitForSingleObject( (HANDLE) thread, INFINITE ); if (status == WAIT_FAILED) { return -1; } diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c index 0ce41481c8213a876c0c8826c69fa0edce2b1e47..2be3d810e38e5bbaaec5f91420de8e43a66f1584 100644 --- a/libraries/libldbm/ldbm.c +++ b/libraries/libldbm/ldbm.c @@ -80,26 +80,26 @@ int ldbm_shutdown( void ) #else -#ifndef WIN32 +void * +ldbm_malloc( size_t size ) +{ + return( calloc( 1, size )); +} + #ifdef HAVE_SYSLOG +#ifdef HAVE_SYSLOG_H #include "syslog.h" #else /* quick hack */ #define LOG_INFO 1 extern int syslog(int, char*, ...); #endif -#endif /* WIN32 */ - -void * -ldbm_malloc( size_t size ) -{ - return( calloc( 1, size )); -} +#endif /* HAVE_SYSLOG */ static void ldbm_db_errcall( const char *prefix, char *message ) { -#ifndef WIN32 +#ifdef HAVE_SYSLOG syslog( LOG_INFO, "ldbm_db_errcall(): %s %s", prefix, message ); #endif } diff --git a/libraries/libldbm/libldbm.dsp b/libraries/libldbm/libldbm.dsp index e44dc460169d6a5a2a4225f805c28e6ec1e4730d..1f4407621f400ebc430b2be067a61e9ead8b1609 100644 --- a/libraries/libldbm/libldbm.dsp +++ b/libraries/libldbm/libldbm.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Static Library" 0x0104 -CFG=libldbm - Win32 Debug +CFG=libldbm - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,15 @@ CFG=libldbm - Win32 Debug !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 "libldbm.mak" CFG="libldbm - Win32 Debug" +!MESSAGE NMAKE /f "libldbm.mak" CFG="libldbm - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "libldbm - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "libldbm - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "libldbm - Win32 Single Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "libldbm - Win32 Single Release" (based on\ + "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -36,7 +39,7 @@ CPP=cl.exe # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\Release" -# PROP Intermediate_Dir "Release" +# PROP Intermediate_Dir "Release\libldbm" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c @@ -57,7 +60,7 @@ LIB32=link.exe -lib # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\Debug" -# PROP Intermediate_Dir "Debug" +# PROP Intermediate_Dir "Debug\libldbm" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c @@ -68,15 +71,63 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\Debug\oldbm32.lib" +!ELSEIF "$(CFG)" == "libldbm - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "libldbm_" +# PROP BASE Intermediate_Dir "libldbm_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\libldbm" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\Debug\oldbm32.lib" +# ADD LIB32 /nologo /out:"..\Debug\oldbm32.lib" + +!ELSEIF "$(CFG)" == "libldbm - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "libldbm0" +# PROP BASE Intermediate_Dir "libldbm0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\libldbm" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\Release\oldbm32.lib" +# ADD LIB32 /nologo /out:"..\Release\oldbm32.lib" + !ENDIF # Begin Target # Name "libldbm - Win32 Release" # Name "libldbm - Win32 Debug" +# Name "libldbm - Win32 Single Debug" +# Name "libldbm - Win32 Single Release" # Begin Source File SOURCE=.\ldbm.c # End Source File +# Begin Source File + +SOURCE=..\..\include\ldbm.h +# End Source File # End Target # End Project diff --git a/libraries/libldif/libldif.dsp b/libraries/libldif/libldif.dsp index c27e653dea8935dd16ea7d1dc5f55b804b83b438..62325148f40fad3f22803e88f41a41e43d3535b3 100644 --- a/libraries/libldif/libldif.dsp +++ b/libraries/libldif/libldif.dsp @@ -80,8 +80,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "libldif_" -# PROP Intermediate_Dir "libldif_" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\libldif" # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c @@ -101,8 +101,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "libldif0" -# PROP Intermediate_Dir "libldif0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\libldif" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c @@ -123,35 +123,11 @@ LIB32=link.exe -lib # Name "libldif - Win32 Single Release" # Begin Source File -SOURCE=..\..\include\lber.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\lber_pvt.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\ldap_cdefs.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\ldap_features.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\ldap_log.h -# End Source File -# Begin Source File - SOURCE=..\..\include\ldif.h # End Source File # Begin Source File SOURCE=.\line64.c # End Source File -# Begin Source File - -SOURCE=..\..\include\portable.h -# End Source File # End Target # End Project diff --git a/libraries/libldif/line64.c b/libraries/libldif/line64.c index 000cf9439e48ccce81bc5dbb68559a979893b22d..65ec9a750e5e82849167538258b57372ad0aaab7 100644 --- a/libraries/libldif/line64.c +++ b/libraries/libldif/line64.c @@ -51,7 +51,7 @@ static const unsigned char b642nib[0x80] = { int ldif_parse_line( - char *line, + LDAP_CONST char *line, char **type, char **value, int *vlen @@ -70,7 +70,7 @@ ldif_parse_line( for ( s = line; *s && *s != ':'; s++ ) ; /* NULL */ if ( *s == '\0' ) { - lber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug, + ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug, "ldif_parse_line missing ':'\n"); return( -1 ); } @@ -98,7 +98,7 @@ ldif_parse_line( /* if no value is present, error out */ if ( *s == '\0' ) { - lber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug, + ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug, "ldif_parse_line missing value\n"); return( -1 ); } @@ -118,7 +118,7 @@ ldif_parse_line( for ( i = 0; i < 4; i++ ) { if ( p[i] != '=' && (p[i] & 0x80 || b642nib[ p[i] & 0x7f ] > 0x3f) ) { - lber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug, + ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug, "ldif_parse_line: invalid base 64 encoding char (%c) 0x%x\n", p[i], p[i] ); return( -1 ); @@ -198,7 +198,11 @@ ldif_getline( char **next ) } void -ldif_put_type_and_value( char **out, char *t, char *val, int vlen ) +ldif_put_type_and_value( + char **out, + LDAP_CONST char *t, + LDAP_CONST char *val, + int vlen ) { unsigned char *byte, *p, *stop; unsigned char buf[3]; @@ -294,7 +298,7 @@ ldif_put_type_and_value( char **out, char *t, char *val, int vlen ) char * -ldif_type_and_value( char *type, char *val, int vlen ) +ldif_type_and_value( LDAP_CONST char *type, LDAP_CONST char *val, int vlen ) /* * return malloc'd, zero-terminated LDIF line */ @@ -306,7 +310,7 @@ ldif_type_and_value( char *type, char *val, int vlen ) if (( buf = (char *) malloc( LDIF_SIZE_NEEDED( tlen, vlen ) + 1 )) == NULL ) { - lber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug, + ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug, "ldif_type_and_value: malloc failed!" ); return NULL; } diff --git a/libraries/liblutil/liblutil.dsp b/libraries/liblutil/liblutil.dsp index 0dd158103863eaa43d9b5662710b83a4ddff4563..e0e7ecf478de8d8fdc32ae1bad5e6287132f88da 100644 --- a/libraries/liblutil/liblutil.dsp +++ b/libraries/liblutil/liblutil.dsp @@ -81,8 +81,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "liblutil" -# PROP Intermediate_Dir "liblutil" +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "SDebug\liblutil" # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c @@ -102,8 +102,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "libluti0" -# PROP Intermediate_Dir "libluti0" +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "SRelease\liblutil" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c @@ -144,10 +144,6 @@ SOURCE=..\..\include\ldap_cdefs.h # End Source File # Begin Source File -SOURCE=..\..\include\ldap_features.h -# End Source File -# Begin Source File - SOURCE=.\lockf.c # End Source File # Begin Source File diff --git a/servers/ldapd/main.c b/servers/ldapd/main.c index 3f0e3d3580a15f4a2294fb559e39a58fb0cc7858..ca74d44b20bac3ffe1e20b7356fa99ddd00ae928 100644 --- a/servers/ldapd/main.c +++ b/servers/ldapd/main.c @@ -515,10 +515,10 @@ do_queries( conn_init(); } - lber_pvt_sb_init( &sb ); - lber_pvt_sb_set_desc( &sb, clientsock ); - lber_pvt_sb_set_io( &sb, (udp) ? &lber_pvt_sb_io_udp : - &lber_pvt_sb_io_tcp, NULL ); + ber_pvt_sb_init( &sb ); + ber_pvt_sb_set_desc( &sb, clientsock ); + ber_pvt_sb_set_io( &sb, (udp) ? &ber_pvt_sb_io_udp : + &ber_pvt_sb_io_tcp, NULL ); timeout.tv_sec = idletime; timeout.tv_usec = 0; for ( ;; ) { @@ -547,7 +547,7 @@ do_queries( * already waiting for us on the client sock. */ - if ( ! lber_pvt_sb_data_ready( &sb ) ) { + if ( ! ber_pvt_sb_data_ready( &sb ) ) { if ( (rc = select( dtblsize, &readfds, 0, 0, udp ? 0 : &timeout )) < 1 ) { #ifdef LDAP_DEBUG @@ -573,7 +573,7 @@ do_queries( } } - if ( lber_pvt_sb_data_ready( &sb ) || + if ( ber_pvt_sb_data_ready( &sb ) || FD_ISSET( clientsock, &readfds ) ) { client_request( &sb, conns, udp ); } else { diff --git a/servers/ldapd/request.c b/servers/ldapd/request.c index 222500b6f9ba59ee03cc59ad548434196476a4cb..00d08540080ebb79555090364156a170055cfaf3 100644 --- a/servers/ldapd/request.c +++ b/servers/ldapd/request.c @@ -88,7 +88,7 @@ client_request( #ifdef LDAP_CONNECTIONLESS if ( udp && dosyslog ) { - sai = (struct sockaddr_in *)lber_pvt_sb_udp_get_src( &clientsb ); + sai = (struct sockaddr_in *)ber_pvt_sb_udp_get_src( &clientsb ); syslog( LOG_INFO, "UDP request from unknown (%s)", inet_ntoa( sai->sin_addr ) ); } @@ -192,7 +192,7 @@ client_request( free( ber.ber_buf ); return; } - sai = (struct sockaddr_in *) lber_pvt_sb_udp_get_src( &clientsb ); + sai = (struct sockaddr_in *) ber_pvt_sb_udp_get_src( &clientsb ); if ( get_cldap_msg( msgid, tag, (struct sockaddr *)sai ) != NULL ) { diff --git a/servers/ldapd/result.c b/servers/ldapd/result.c index 777aec2e68a6da5459f40fb949c957e6dcc324ca..3754251fa83c96e54c774ca6caa176fcbc182cd1 100644 --- a/servers/ldapd/result.c +++ b/servers/ldapd/result.c @@ -280,7 +280,7 @@ send_ldap_msgresult( { #ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) { - lber_pvt_sb_udp_set_dst( &sb, &m->m_clientaddr ); + ber_pvt_sb_udp_set_dst( &sb, &m->m_clientaddr ); Debug( LDAP_DEBUG_TRACE, "UDP response to %s port %d\n", inet_ntoa(((struct sockaddr_in *) @@ -305,7 +305,7 @@ send_ldap_result( int rc; #ifdef LDAP_CONNECTIONLESS int cldap; - cldap = ( sb->sb_io == &lber_pvt_sb_io_udp ); + cldap = ( sb->sb_io == &ber_pvt_sb_io_udp ); #endif Debug( LDAP_DEBUG_TRACE, "send_ldap_result\n", 0, 0, 0 ); diff --git a/servers/ldapd/search.c b/servers/ldapd/search.c index 33afd35713e14984af4c47644dbdb5e20c75c970..840772eb644d53cc7d185449385d8bedde42004b 100644 --- a/servers/ldapd/search.c +++ b/servers/ldapd/search.c @@ -700,7 +700,7 @@ search_result( LDAP_OPERATIONS_ERROR, NULL, "ber_printf" ); return; } - lber_pvt_sb_udp_set_dst( sb, &m->m_clientaddr ); + ber_pvt_sb_udp_set_dst( sb, &m->m_clientaddr ); if ( ber_flush( sb, ber, 1 ) != 0 ) { send_ldap_msgresult( sb, SEARCHRESTAG, m, diff --git a/servers/slapd/back-ldbm/backldbm.dsp b/servers/slapd/back-ldbm/backldbm.dsp index a3ca7e171f6f2186402b5640b7455d612572f87a..c9d2a5faf7884d31ba03a1ab581a2f5c9984e4da 100644 --- a/servers/slapd/back-ldbm/backldbm.dsp +++ b/servers/slapd/back-ldbm/backldbm.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Static Library" 0x0104 -CFG=backldbm - Win32 Debug +CFG=backldbm - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=backldbm - Win32 Debug !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 "backldbm.mak" CFG="backldbm - Win32 Debug" +!MESSAGE NMAKE /f "backldbm.mak" CFG="backldbm - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "backldbm - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "backldbm - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "backldbm - Win32 Single Debug" (based on\ + "Win32 (x86) Static Library") +!MESSAGE "backldbm - Win32 Single Release" (based on\ + "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -35,8 +39,8 @@ CPP=cl.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\backldbm" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c @@ -56,8 +60,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "..\Debug\backldbm" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c @@ -68,12 +72,56 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo +!ELSEIF "$(CFG)" == "backldbm - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "backldbm" +# PROP BASE Intermediate_Dir "backldbm" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "..\SDebug\backldbm" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c +# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "backldbm - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "backldb0" +# PROP BASE Intermediate_Dir "backldb0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "..\SRelease\backldbm" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + !ENDIF # Begin Target # Name "backldbm - Win32 Release" # Name "backldbm - Win32 Debug" +# Name "backldbm - Win32 Single Debug" +# Name "backldbm - Win32 Single Release" # Begin Source File SOURCE=.\abandon.c diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index 223401aa1ba863f0b7ed0dfbe15dc997e8b6a329..778471118278005e13599982e1b837367e2baaeb 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -57,25 +57,27 @@ do_bind( */ { - BerElement tber; + BerElement *tber; unsigned long tlen, ttag; - tber = *op->o_ber; - ttag = ber_skip_tag( &tber, &tlen ); - if ( ber_peek_tag( &tber, &tlen ) == LBER_SEQUENCE ) { - Debug( LDAP_DEBUG_ANY, "version 3.0 detected\n", 0, 0, 0 ); + tber = ber_dup( op->o_ber ); + ttag = ber_skip_tag( tber, &tlen ); + if ( ber_peek_tag( tber, &tlen ) == LBER_SEQUENCE ) { + Debug( LDAP_DEBUG_ANY, "bind: version 3.0 detected\n", 0, 0, 0 ); conn->c_version = 30; rc = ber_scanf(ber, "{{iato}}", &version, &cdn, &method, &cred); } else { rc = ber_scanf( ber, "{iato}", &version, &cdn, &method, &cred ); } + + ber_free( tber, 1 ); } #else rc = ber_scanf( ber, "{iato}", &version, &cdn, &method, &cred ); #endif if ( rc == LBER_ERROR ) { - Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 ); send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR, NULL, "decoding error" ); return; diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index b7ed2d7d62d19f15da87bdf985f0493e8dfb106e..fd75a314f6a167750287592f13ba7fb3ca9141b9 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -10,6 +10,9 @@ #include "slap.h" +/* we need LBER internals */ +#include "../../libraries/liblber/lber-int.h" + /* protected by connections_mutex */ static ldap_pvt_thread_mutex_t connections_mutex; static Connection *connections = NULL; @@ -133,7 +136,8 @@ int connections_shutdown(void) } ldap_pvt_thread_mutex_unlock( &connections_mutex ); - return 0; + + return 0; } static Connection* connection_get( int s ) @@ -149,7 +153,7 @@ static Connection* connection_get( int s ) #ifndef HAVE_WINSOCK assert( connections[s].c_struct_state == SLAP_C_USED ); assert( connections[s].c_conn_state != SLAP_C_INVALID ); - assert( connections[s].c_sb.sb_sd != -1 ); + assert( !ber_pvt_sb_in_use( connections[i].c_sb ) ); c = &connections[s]; #else @@ -159,21 +163,21 @@ static Connection* connection_get( int s ) for(i=0; i<dtblsize; i++) { if( connections[i].c_struct_state == SLAP_C_UNINITIALIZED ) { assert( connections[i].c_conn_state == SLAP_C_INVALID ); - assert( connections[i].c_sb.sb_sd == 0 ); + assert( connections[i].c_sb == 0 ); break; } if( connections[i].c_struct_state == SLAP_C_UNUSED ) { assert( connections[i].c_conn_state == SLAP_C_INVALID ); - assert( connections[i].c_sb.sb_sd == -1 ); + assert( !ber_pvt_sb_in_use( connections[i].c_sb ) ); continue; } assert( connections[i].c_struct_state == SLAP_C_USED ); assert( connections[i].c_conn_state != SLAP_C_INVALID ); - assert( connections[i].c_sb.sb_sd != -1 ); + assert( ber_pvt_sb_in_use( connections[i].c_sb ) ); - if( connections[i].c_sb.sb_sd == s ) { + if( ber_pvt_sb_get_desc( connections[i].c_sb ) == s ) { c = &connections[i]; break; } @@ -226,20 +230,20 @@ long connection_init( for( i=0; i < dtblsize; i++) { if( connections[i].c_struct_state == SLAP_C_UNINITIALIZED ) { - assert( connections[i].c_sb.sb_sd == 0 ); + assert( connections[i].c_sb == 0 ); c = &connections[i]; break; } if( connections[i].c_struct_state == SLAP_C_UNUSED ) { - assert( connections[i].c_sb.sb_sd == -1 ); + assert( !ber_pvt_sb_in_use( connections[i].c_sb )); c = &connections[i]; break; } assert( connections[i].c_struct_state == SLAP_C_USED ); assert( connections[i].c_conn_state != SLAP_C_INVALID ); - assert( connections[i].c_sb.sb_sd != -1 ); + assert( ber_pvt_sb_in_use( connections[i].c_sb )); } if( c == NULL ) { @@ -261,7 +265,7 @@ long connection_init( c->c_ops = NULL; c->c_pending_ops = NULL; - lber_pvt_sb_init( &c->c_sb ); + c->c_sb = ber_sockbuf_alloc( ); /* should check status of thread calls */ ldap_pvt_thread_mutex_init( &c->c_mutex ); @@ -293,10 +297,10 @@ long connection_init( c->c_starttime = slap_get_time(); - lber_pvt_sb_set_desc( &c->c_sb, s ); - lber_pvt_sb_set_io( &c->c_sb, &lber_pvt_sb_io_tcp, NULL ); + ber_pvt_sb_set_desc( c->c_sb, s ); + ber_pvt_sb_set_io( c->c_sb, &ber_pvt_sb_io_tcp, NULL ); - if( lber_pvt_sb_set_nonblock( &c->c_sb, 1 ) < 0 ) { + if( ber_pvt_sb_set_nonblock( c->c_sb, 1 ) < 0 ) { Debug( LDAP_DEBUG_ANY, "connection_init(%d, %s, %s): set nonblocking failed\n", s, c->c_client_name, c->c_client_addr); @@ -348,18 +352,18 @@ connection_destroy( Connection *c ) c->c_client_addr = NULL; } - if ( lber_pvt_sb_in_use(&c->c_sb) ) { - int sd = lber_pvt_sb_get_desc(&c->c_sb); + if ( ber_pvt_sb_in_use(c->c_sb) ) { + int sd = ber_pvt_sb_get_desc(c->c_sb); slapd_remove( sd ); - lber_pvt_sb_close( &c->c_sb ); + ber_pvt_sb_close( c->c_sb ); Statslog( LDAP_DEBUG_STATS, "conn=%d fd=%d closed.\n", c->c_connid, sd, 0, 0, 0 ); } - lber_pvt_sb_destroy( &c->c_sb ); + ber_pvt_sb_destroy( c->c_sb ); ldap_pvt_thread_mutex_unlock( &connections_mutex ); } @@ -389,13 +393,13 @@ void connection_closing( Connection *c ) Debug( LDAP_DEBUG_TRACE, "connection_closing: readying conn=%ld sd=%d for close.\n", - c->c_connid, c->c_sb.sb_sd, 0 ); + c->c_connid, ber_pvt_sb_get_desc( c->c_sb ), 0 ); /* update state to closing */ c->c_conn_state = SLAP_C_CLOSING; /* don't listen on this port anymore */ - slapd_clr_read( c->c_sb.sb_sd, 1 ); + slapd_clr_read( ber_pvt_sb_get_desc( c->c_sb ), 1 ); /* shutdown I/O -- not yet implemented */ @@ -415,7 +419,7 @@ void connection_closing( Connection *c ) } /* wake write blocked operations */ - slapd_clr_write( c->c_sb.sb_sd, 1 ); + slapd_clr_write( ber_pvt_sb_get_desc(c->c_sb), 1 ); ldap_pvt_thread_cond_signal( &c->c_write_cv ); } } @@ -430,13 +434,13 @@ static void connection_close( Connection *c ) if( c->c_ops != NULL ) { Debug( LDAP_DEBUG_TRACE, "connection_close: deferring conn=%ld sd=%d.\n", - c->c_connid, c->c_sb.sb_sd, 0 ); + c->c_connid, ber_pvt_sb_get_desc( c->c_sb ), 0 ); return; } Debug( LDAP_DEBUG_TRACE, "connection_close: conn=%ld sd=%d.\n", - c->c_connid, c->c_sb.sb_sd, 0 ); + c->c_connid, ber_pvt_sb_get_desc( c->c_sb ), 0 ); connection_destroy( c ); } @@ -627,7 +631,7 @@ connection_operation( void *arg_v ) if( conn->c_conn_state == SLAP_C_CLOSING ) { Debug( LDAP_DEBUG_TRACE, "connection_operation: attempting closing conn=%ld sd=%d.\n", - conn->c_connid, conn->c_sb.sb_sd, 0 ); + conn->c_connid, ber_pvt_sb_get_desc( conn->c_sb ), 0 ); connection_close( conn ); } @@ -680,7 +684,7 @@ int connection_read(int s) #define CONNECTION_INPUT_LOOP 1 #ifdef DATA_READY_LOOP - while(!rc && lber_pvt_sb_data_ready(&c->c_sb)) + while(!rc && ber_pvt_sb_data_ready(&c->c_sb)) #elif CONNECTION_INPUT_LOOP while(!rc) #endif @@ -719,14 +723,14 @@ connection_input( } errno = 0; - if ( (tag = ber_get_next( &conn->c_sb, &len, conn->c_currentber )) + if ( (tag = ber_get_next( conn->c_sb, &len, conn->c_currentber )) != LDAP_TAG_MESSAGE ) { int err = errno; Debug( LDAP_DEBUG_TRACE, "ber_get_next on fd %d failed errno %d (%s)\n", - lber_pvt_sb_get_desc(&conn->c_sb), err, + ber_pvt_sb_get_desc( conn->c_sb ), err, err > -1 && err < sys_nerr ? sys_errlist[err] : "unknown" ); Debug( LDAP_DEBUG_TRACE, "\t*** got %ld of %lu so far\n", diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 6bcc98e43012d7ccc802cfd619b3f02bbc0dc011..bb182993f1b7f2872a3452320b714d1e9050300b 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -79,8 +79,8 @@ static void slapd_add(int s) { } #endif - FD_SET( s, &slap_daemon.sd_actives ); - FD_SET( s, &slap_daemon.sd_readers ); + FD_SET( (unsigned) s, &slap_daemon.sd_actives ); + FD_SET( (unsigned) s, &slap_daemon.sd_readers ); Debug( LDAP_DEBUG_CONNS, "daemon: added %d%s%s\n", s, FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "", @@ -101,9 +101,9 @@ void slapd_remove(int s) { FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "", FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" ); - FD_CLR( s, &slap_daemon.sd_actives ); - FD_CLR( s, &slap_daemon.sd_readers ); - FD_CLR( s, &slap_daemon.sd_writers ); + FD_CLR( (unsigned) s, &slap_daemon.sd_actives ); + FD_CLR( (unsigned) s, &slap_daemon.sd_readers ); + FD_CLR( (unsigned) s, &slap_daemon.sd_writers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); } @@ -111,8 +111,8 @@ void slapd_remove(int s) { void slapd_clr_write(int s, int wake) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); - assert( FD_ISSET( s, &slap_daemon.sd_actives) ); - FD_CLR( s, &slap_daemon.sd_writers ); + assert( FD_ISSET( (unsigned) s, &slap_daemon.sd_actives) ); + FD_CLR( (unsigned) s, &slap_daemon.sd_writers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); @@ -123,7 +123,7 @@ void slapd_set_write(int s, int wake) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); assert( FD_ISSET( s, &slap_daemon.sd_actives) ); - FD_SET( s, &slap_daemon.sd_writers ); + FD_SET( (unsigned) s, &slap_daemon.sd_writers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); @@ -134,7 +134,7 @@ void slapd_clr_read(int s, int wake) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); assert( FD_ISSET( s, &slap_daemon.sd_actives) ); - FD_CLR( s, &slap_daemon.sd_readers ); + FD_CLR( (unsigned) s, &slap_daemon.sd_readers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); @@ -145,7 +145,7 @@ void slapd_set_read(int s, int wake) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); assert( FD_ISSET( s, &slap_daemon.sd_actives) ); - FD_SET( s, &slap_daemon.sd_readers ); + FD_SET( (unsigned) s, &slap_daemon.sd_readers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); @@ -313,7 +313,7 @@ slapd_daemon_task( memcpy( &writefds, &slap_daemon.sd_writers, sizeof(fd_set) ); #endif - FD_SET( tcps, &readfds ); + FD_SET( (unsigned) tcps, &readfds ); #ifndef HAVE_WINSOCK nfds = slap_daemon.sd_nfds; @@ -513,7 +513,7 @@ slapd_daemon_task( slapd_clr_write( wd, 0 ); if ( connection_write( wd ) < 0 ) { - FD_CLR( wd, &readfds ); + FD_CLR( (unsigned) wd, &readfds ); slapd_close( wd ); } } diff --git a/servers/slapd/libslapd.dsp b/servers/slapd/libslapd.dsp index 92cf59d677da29adfd8604b14ec99ea582801111..3ae7691b8a1915ae2ca9ce52e6ba09d8de99beaf 100644 --- a/servers/slapd/libslapd.dsp +++ b/servers/slapd/libslapd.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Static Library" 0x0104 -CFG=libslapd - Win32 Debug +CFG=libslapd - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=libslapd - Win32 Debug !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 "libslapd.mak" CFG="libslapd - Win32 Debug" +!MESSAGE NMAKE /f "libslapd.mak" CFG="libslapd - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "libslapd - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "libslapd - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "libslapd - Win32 Single Debug" (based on\ + "Win32 (x86) Static Library") +!MESSAGE "libslapd - Win32 Single Release" (based on\ + "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -35,8 +39,8 @@ CPP=cl.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "libslapd" -# PROP Intermediate_Dir "libslapd" +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release\libslapd" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c @@ -56,8 +60,8 @@ LIB32=link.exe -lib # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "libslap0" -# PROP Intermediate_Dir "libslap0" +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug\libslapd" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c @@ -68,12 +72,56 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo +!ELSEIF "$(CFG)" == "libslapd - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "libslap1" +# PROP BASE Intermediate_Dir "libslap1" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "SDebug" +# PROP Intermediate_Dir "SDebug\libslapd" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libslapd - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "libslap2" +# PROP BASE Intermediate_Dir "libslap2" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "SRelease" +# PROP Intermediate_Dir "SRelease\libslapd" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + !ENDIF # Begin Target # Name "libslapd - Win32 Release" # Name "libslapd - Win32 Debug" +# Name "libslapd - Win32 Single Debug" +# Name "libslapd - Win32 Single Release" # Begin Source File SOURCE=.\abandon.c @@ -188,6 +236,10 @@ SOURCE=.\phonetic.c # End Source File # Begin Source File +SOURCE=".\proto-slap.h" +# End Source File +# Begin Source File + SOURCE=.\repl.c # End Source File # Begin Source File @@ -208,6 +260,10 @@ SOURCE=.\search.c # End Source File # Begin Source File +SOURCE=.\slap.h +# End Source File +# Begin Source File + SOURCE=.\str2filter.c # End Source File # Begin Source File diff --git a/servers/slapd/main.c b/servers/slapd/main.c index c58ffdaf1908fa3274710dc0cd88b36295ee59ce..085e7184fa789282214184d06af4c119bb30d43c 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -19,15 +19,15 @@ static RETSIGTYPE wait4child( int sig ); #endif -#ifdef WIN32 -const char Versionstr[] = "OpenLDAP slapd 1.2 for Windows NT"; -#endif - /* * when more than one slapd is running on one machine, each one might have * it's own LOCAL for syslogging and must have its own pid/args files */ +#ifndef HAVE_MKVERSION +const char Versionstr[] = "OpenLDAP Standalone LDAP Server (slapd)"; +#endif + #ifdef LOG_LOCAL4 #define DEFAULT_SYSLOG_USER LOG_LOCAL4 @@ -87,7 +87,9 @@ main( int argc, char **argv ) int inetd = 0; int rc; int tcps; +#ifdef LDAP_CONNECTIONLESS int udp; +#endif #ifdef LOG_LOCAL4 int syslogUser = DEFAULT_SYSLOG_USER; #endif @@ -109,7 +111,7 @@ main( int argc, char **argv ) g_argv = argv; while ( (i = getopt( argc, argv, - "d:f:ia:p:s:c" + "d:f:ia:p:s:" #ifdef LOG_LOCAL4 "l:" #endif @@ -118,6 +120,9 @@ main( int argc, char **argv ) #endif #if defined(HAVE_SETUID) && defined(HAVE_SETGID) "u:g:" +#endif +#ifdef LDAP_CONNECTIONLESS + "c" #endif )) != EOF ) { switch ( i ) { @@ -232,7 +237,7 @@ main( int argc, char **argv ) } } - lber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug); + ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug); ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &slap_debug); ldif_debug = slap_debug; diff --git a/servers/slapd/nt_debug.c b/servers/slapd/nt_debug.c index a2aa623f955a9c8fc56fdc0478d25d156e131a2c..e892ee0eb9dcafacaf18d8e36534774c5027dde4 100644 --- a/servers/slapd/nt_debug.c +++ b/servers/slapd/nt_debug.c @@ -1,12 +1,16 @@ -#include <stdio.h> -#include <stdarg.h> #include "portable.h" + +#include <stdio.h> + +#include <ac/stdarg.h> +#include <ac/string.h> + #include "slap.h" static FILE *log_file; -void Debug( int level, char *fmt, ... ) +void Debug( int level, const char *fmt, ... ) { char buffer[4096]; va_list vl; diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 77f3b3a9131e648c71c24330130905f67cebfb4e..d73acf27cf7abae68c60907cbf23fb530b513c4c 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -13,6 +13,9 @@ #include "slap.h" +/* we need LBER internals */ +#include "../../libraries/liblber/lber-int.h" + static void send_ldap_result2( Connection *conn, @@ -102,7 +105,7 @@ send_ldap_result2( return; } - if ( ber_flush( &conn->c_sb, ber, 1 ) == 0 ) { + if ( ber_flush( conn->c_sb, ber, 1 ) == 0 ) { break; } @@ -128,7 +131,7 @@ send_ldap_result2( /* wait for socket to be write-ready */ conn->c_writewaiter = 1; - slapd_set_write( conn->c_sb.sb_sd, 1 ); + slapd_set_write( ber_pvt_sb_get_desc( conn->c_sb ), 1 ); ldap_pvt_thread_cond_wait( &conn->c_write_cv, &conn->c_mutex ); conn->c_writewaiter = 0; @@ -159,7 +162,7 @@ send_ldap_result( { #ifdef LDAP_CONNECTIONLESS if ( op->o_cldap ) { - lber_pvt_sb_udp_set_dst( &conn->c_sb, &op->o_clientaddr ); + ber_pvt_sb_udp_set_dst( &conn->c_sb, &op->o_clientaddr ); Debug( LDAP_DEBUG_TRACE, "UDP response to %s port %d\n", inet_ntoa(((struct sockaddr_in *) &op->o_clientaddr)->sin_addr ), @@ -344,7 +347,7 @@ send_search_entry( return 0; } - if ( ber_flush( &conn->c_sb, ber, 1 ) == 0 ) { + if ( ber_flush( conn->c_sb, ber, 1 ) == 0 ) { break; } @@ -370,7 +373,7 @@ send_search_entry( /* wait for socket to be write-ready */ conn->c_writewaiter = 1; - slapd_set_write( conn->c_sb.sb_sd, 1 ); + slapd_set_write( ber_pvt_sb_get_desc( conn->c_sb ), 1 ); ldap_pvt_thread_cond_wait( &conn->c_write_cv, &conn->c_mutex ); conn->c_writewaiter = 0; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 70abfad3ce573f75b71b5840d74a20c25a010445..5b231775b1e1184cadab18493d300844dbe84fd1 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -19,7 +19,7 @@ #include "ldap_log.h" -#include "../../libraries/liblber/lber-int.h" +#include "lber.h" #include "ldap.h" #include "ldap_pvt_thread.h" @@ -418,7 +418,7 @@ typedef struct slap_conn { int c_conn_state; /* connection state */ ldap_pvt_thread_mutex_t c_mutex; /* protect the connection */ - Sockbuf c_sb; /* ber connection stuff */ + Sockbuf *c_sb; /* ber connection stuff */ /* only can be changed by connect_init */ time_t c_starttime; /* when the connection was opened */ diff --git a/servers/slapd/slapd.dsp b/servers/slapd/slapd.dsp index ac8adb5621905d3798f297d206402d601aaae509..3522102349181617a0d6f9984f22e55affcd99e9 100644 --- a/servers/slapd/slapd.dsp +++ b/servers/slapd/slapd.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=slapd - Win32 Debug +CFG=slapd - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=slapd - Win32 Debug !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 "slapd.mak" CFG="slapd - Win32 Debug" +!MESSAGE NMAKE /f "slapd.mak" CFG="slapd - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "slapd - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "slapd - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "slapd - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "slapd - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -37,7 +41,7 @@ RSC=rc.exe # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Intermediate_Dir "Release\slapd" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -61,7 +65,7 @@ LINK32=link.exe # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Intermediate_Dir "Debug\slapd" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -73,7 +77,57 @@ BSC32=bscmake.exe # 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 /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regexd.lib libdbs.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdb.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "slapd - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "slapd___" +# PROP BASE Intermediate_Dir "slapd___" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir ".SDebug" +# PROP Intermediate_Dir "SDebug\slapd" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c +# 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 hs_regexd.lib libdbs.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdb.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "slapd - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "slapd__0" +# PROP BASE Intermediate_Dir "slapd__0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "SRelease" +# PROP Intermediate_Dir "SRelease\slapd" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 hs_regex.lib libdb.lib wsock32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 hs_regex.lib libdb.lib wsock32.lib /nologo /subsystem:console /machine:I386 !ENDIF @@ -81,29 +135,27 @@ LINK32=link.exe # Name "slapd - Win32 Release" # Name "slapd - Win32 Debug" -# Begin Group "Source" +# Name "slapd - Win32 Single Debug" +# Name "slapd - Win32 Single Release" +# Begin Source File -# PROP Default_Filter ".c" +SOURCE=.\daemon.c +# End Source File # Begin Source File SOURCE=.\main.c # End Source File # Begin Source File -SOURCE=.\result.c +SOURCE=".\proto-slap.h" # End Source File -# End Group -# Begin Group "Headers" - -# PROP Default_Filter ".h" # Begin Source File -SOURCE=".\proto-slap.h" +SOURCE=.\result.c # End Source File # Begin Source File SOURCE=.\slap.h # End Source File -# End Group # End Target # End Project diff --git a/servers/slapd/slapd.dsw b/servers/slapd/slapd.dsw index 423864c94d9efafe3353882f606c6e48d3b93131..e9c636c214035b8e168a3a101546b960ee354030 100644 --- a/servers/slapd/slapd.dsw +++ b/servers/slapd/slapd.dsw @@ -15,240 +15,6 @@ Package=<4> ############################################################################### -Project: "ldapdelete"=..\..\clients\tools\ldapdelete.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name liblber - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldap - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblutil - End Project Dependency -}}} - -############################################################################### - -Project: "ldapmodify"=..\..\clients\tools\ldapmodify.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name liblber - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldap - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldif - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblutil - End Project Dependency -}}} - -############################################################################### - -Project: "ldapmodrdn"=..\..\clients\tools\ldapmodrdn.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name liblber - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldap - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblutil - End Project Dependency -}}} - -############################################################################### - -Project: "ldapsearch"=..\..\clients\tools\ldapsearch.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name liblber - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldap - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldif - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblutil - End Project Dependency -}}} - -############################################################################### - -Project: "ldif2id2children"=.\tools\ldif2id2children.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name backldbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name libavl - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblber - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldap_r - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldif - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libslapd - End Project Dependency -}}} - -############################################################################### - -Project: "ldif2id2entry"=.\tools\ldif2id2entry.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name backldbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name libavl - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblber - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldap_r - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldif - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libslapd - End Project Dependency -}}} - -############################################################################### - -Project: "ldif2index"=.\tools\ldif2index.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name backldbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name libavl - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblber - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldap_r - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldif - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libslapd - End Project Dependency -}}} - -############################################################################### - -Project: "ldif2ldbm"=.\tools\ldif2ldbm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name backldbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name libavl - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblber - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldap_r - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldbm - End Project Dependency - Begin Project Dependency - Project_Dep_Name libldif - End Project Dependency - Begin Project Dependency - Project_Dep_Name liblutil - End Project Dependency - Begin Project Dependency - Project_Dep_Name libslapd - End Project Dependency -}}} - -############################################################################### - Project: "libavl"=..\..\libraries\libavl\libavl.dsp - Package Owner=<4> Package=<5> @@ -273,18 +39,6 @@ Package=<4> ############################################################################### -Project: "libldap"=..\..\libraries\libldap\libldap.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - Project: "libldap_r"=..\..\libraries\libldap_r\libldap_r.dsp - Package Owner=<4> Package=<5> @@ -293,6 +47,9 @@ Package=<5> Package=<4> {{{ + Begin Project Dependency + Project_Dep_Name liblber + End Project Dependency }}} ############################################################################### diff --git a/servers/slapd/tools/ldbmcat.dsp b/servers/slapd/tools/ldbmcat.dsp index 0007dc029bdae5da4672ba4c9c90cf5356a8cad1..f51482d398774d41ee98ac9fcafcc09057246865 100644 --- a/servers/slapd/tools/ldbmcat.dsp +++ b/servers/slapd/tools/ldbmcat.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldbmcat - Win32 Debug +CFG=ldbmcat - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=ldbmcat - Win32 Debug !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 "ldbmcat.mak" CFG="ldbmcat - Win32 Debug" +!MESSAGE NMAKE /f "ldbmcat.mak" CFG="ldbmcat - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "ldbmcat - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "ldbmcat - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "ldbmcat - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldbmcat - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -36,8 +40,9 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release\ldbmcat" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\ldbmcat" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -48,7 +53,7 @@ BSC32=bscmake.exe # 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 /subsystem:console /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 libdb.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" +# ADD LINK32 libdb.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" !ELSEIF "$(CFG)" == "ldbmcat - Win32 Debug" @@ -59,8 +64,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug\ldbmcat" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "..\Debug\ldbmcat" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -72,7 +77,56 @@ BSC32=bscmake.exe # 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 /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 oldbm32.lib libdb.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" +# ADD LINK32 libdb.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" + +!ELSEIF "$(CFG)" == "ldbmcat - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldbmcat_" +# PROP BASE Intermediate_Dir "ldbmcat_" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\Sdebug" +# PROP Intermediate_Dir "..\SDebug\ldbmcat" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 oldbm32.lib libdb.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" +# ADD LINK32 libdb.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" + +!ELSEIF "$(CFG)" == "ldbmcat - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldbmcat0" +# PROP BASE Intermediate_Dir "ldbmcat0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "..\SRelease\ldbmcat" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 libdb.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" +# ADD LINK32 libdb.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" !ENDIF @@ -80,6 +134,8 @@ LINK32=link.exe # Name "ldbmcat - Win32 Release" # Name "ldbmcat - Win32 Debug" +# Name "ldbmcat - Win32 Single Debug" +# Name "ldbmcat - Win32 Single Release" # Begin Source File SOURCE=.\ldbmcat.c diff --git a/servers/slapd/tools/ldbmtest.dsp b/servers/slapd/tools/ldbmtest.dsp index 061705772c61ecafd8cca02cf8f9ffbf55e09d28..5c6e01412388e1f2f6ae5d249cf635735d48b425 100644 --- a/servers/slapd/tools/ldbmtest.dsp +++ b/servers/slapd/tools/ldbmtest.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldbmtest - Win32 Debug +CFG=ldbmtest - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,13 +13,17 @@ CFG=ldbmtest - Win32 Debug !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 "ldbmtest.mak" CFG="ldbmtest - Win32 Debug" +!MESSAGE NMAKE /f "ldbmtest.mak" CFG="ldbmtest - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "ldbmtest - Win32 Release" (based on\ "Win32 (x86) Console Application") !MESSAGE "ldbmtest - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "ldbmtest - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldbmtest - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -37,8 +41,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release\ldbmtest" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\ldbmtest" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -60,8 +64,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug\ldbmtest" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "..\Debug\ldbmtest" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -74,12 +78,60 @@ 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 /subsystem:console /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +!ELSEIF "$(CFG)" == "ldbmtest - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldbmtest" +# PROP BASE Intermediate_Dir "ldbmtest" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "..\SDebug\ldbmtest" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 /subsystem:console /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 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldbmtest - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldbmtes0" +# PROP BASE Intermediate_Dir "ldbmtes0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "..\SRelease\ldbmtest" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 /subsystem:console /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 /nologo /subsystem:console /machine:I386 + !ENDIF # Begin Target # Name "ldbmtest - Win32 Release" # Name "ldbmtest - Win32 Debug" +# Name "ldbmtest - Win32 Single Debug" +# Name "ldbmtest - Win32 Single Release" # Begin Source File SOURCE=.\ldbmtest.c diff --git a/servers/slapd/tools/ldif.dsp b/servers/slapd/tools/ldif.dsp index 8e0412d54f107ee851115cd0029112b09b377979..87baf72e8f83b506a649a302e5ca5afc14c9f0a9 100644 --- a/servers/slapd/tools/ldif.dsp +++ b/servers/slapd/tools/ldif.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldif - Win32 Debug +CFG=ldif - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,12 +13,16 @@ CFG=ldif - Win32 Debug !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 "ldif.mak" CFG="ldif - Win32 Debug" +!MESSAGE NMAKE /f "ldif.mak" CFG="ldif - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "ldif - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "ldif - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "ldif - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldif - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -36,12 +40,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release/ldif" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\ldif" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -60,12 +64,12 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug/ldif" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "..\Debug\ldif" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -75,12 +79,64 @@ 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 /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 oldif32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" +!ELSEIF "$(CFG)" == "ldif - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldif___W" +# PROP BASE Intermediate_Dir "ldif___W" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "..\SDebug\ldif" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 oldif32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" +# ADD LINK32 oldif32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" + +!ELSEIF "$(CFG)" == "ldif - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldif___0" +# PROP BASE Intermediate_Dir "ldif___0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "..\SRelease\ldif" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 oldif32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" +# ADD LINK32 oldif32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" + !ENDIF # Begin Target # Name "ldif - Win32 Release" # Name "ldif - Win32 Debug" +# Name "ldif - Win32 Single Debug" +# Name "ldif - Win32 Single Release" # Begin Source File SOURCE=.\ldif.c diff --git a/servers/slapd/tools/ldif2id2children.dsp b/servers/slapd/tools/ldif2id2children.dsp index 29a23780bdf579b4f4dd87e23ec189c085201d95..dcd755325c5a165d5d7750fe144779c0ad9dc863 100644 --- a/servers/slapd/tools/ldif2id2children.dsp +++ b/servers/slapd/tools/ldif2id2children.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldif2id2children - Win32 Debug +CFG=ldif2id2children - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,7 +13,8 @@ CFG=ldif2id2children - Win32 Debug !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 "ldif2id2children.mak" CFG="ldif2id2children - Win32 Debug" +!MESSAGE NMAKE /f "ldif2id2children.mak"\ + CFG="ldif2id2children - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -21,6 +22,10 @@ CFG=ldif2id2children - Win32 Debug "Win32 (x86) Console Application") !MESSAGE "ldif2id2children - Win32 Debug" (based on\ "Win32 (x86) Console Application") +!MESSAGE "ldif2id2children - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldif2id2children - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -38,8 +43,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\ldif2id2children" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -62,8 +67,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "..\Debug\ldif2id2children" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -75,7 +80,57 @@ BSC32=bscmake.exe # 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 /subsystem:console /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 hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldif2id2children - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldif2id2" +# PROP BASE Intermediate_Dir "ldif2id2" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "..\SDebug\ldif2id2children" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldif2id2children - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldif2id0" +# PROP BASE Intermediate_Dir "ldif2id0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "..\SRelease\ldif2id2children" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /machine:I386 !ENDIF @@ -83,6 +138,8 @@ LINK32=link.exe # Name "ldif2id2children - Win32 Release" # Name "ldif2id2children - Win32 Debug" +# Name "ldif2id2children - Win32 Single Debug" +# Name "ldif2id2children - Win32 Single Release" # Begin Source File SOURCE=.\ldif2id2children.c diff --git a/servers/slapd/tools/ldif2id2entry.dsp b/servers/slapd/tools/ldif2id2entry.dsp index ea181eda204039c20ddf61a47b3590c14d275b65..a6e201c172860daef87581e6bf96920565ea120e 100644 --- a/servers/slapd/tools/ldif2id2entry.dsp +++ b/servers/slapd/tools/ldif2id2entry.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldif2id2entry - Win32 Debug +CFG=ldif2id2entry - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,7 +13,7 @@ CFG=ldif2id2entry - Win32 Debug !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 "ldif2id2entry.mak" CFG="ldif2id2entry - Win32 Debug" +!MESSAGE NMAKE /f "ldif2id2entry.mak" CFG="ldif2id2entry - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -21,6 +21,10 @@ CFG=ldif2id2entry - Win32 Debug "Win32 (x86) Console Application") !MESSAGE "ldif2id2entry - Win32 Debug" (based on\ "Win32 (x86) Console Application") +!MESSAGE "ldif2id2entry - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldif2id2entry - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -38,8 +42,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\ldif2id2entry" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -62,8 +66,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "..\Debug\ldif2id2entry" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -75,7 +79,57 @@ BSC32=bscmake.exe # 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 /subsystem:console /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 hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldif2id2entry - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldif2id2" +# PROP BASE Intermediate_Dir "ldif2id2" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "..\SDebug\ldif2id2entry" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldif2id2entry - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldif2id0" +# PROP BASE Intermediate_Dir "ldif2id0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "..\SRelease\ldif2id2entry" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /machine:I386 !ENDIF @@ -83,6 +137,8 @@ LINK32=link.exe # Name "ldif2id2entry - Win32 Release" # Name "ldif2id2entry - Win32 Debug" +# Name "ldif2id2entry - Win32 Single Debug" +# Name "ldif2id2entry - Win32 Single Release" # Begin Source File SOURCE=.\ldif2id2entry.c diff --git a/servers/slapd/tools/ldif2index.dsp b/servers/slapd/tools/ldif2index.dsp index 8ce465e567405c0382512eeeeaeb91baadddcf99..accb5cec6f3d3edd5f6d1ad9ceb7cd92856b4e42 100644 --- a/servers/slapd/tools/ldif2index.dsp +++ b/servers/slapd/tools/ldif2index.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldif2index - Win32 Debug +CFG=ldif2index - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,7 +13,7 @@ CFG=ldif2index - Win32 Debug !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 "ldif2index.mak" CFG="ldif2index - Win32 Debug" +!MESSAGE NMAKE /f "ldif2index.mak" CFG="ldif2index - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -21,6 +21,10 @@ CFG=ldif2index - Win32 Debug "Win32 (x86) Console Application") !MESSAGE "ldif2index - Win32 Debug" (based on\ "Win32 (x86) Console Application") +!MESSAGE "ldif2index - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldif2index - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -38,8 +42,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\ldif2index" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -62,8 +66,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "..\Debug\ldif2index" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -75,7 +79,57 @@ BSC32=bscmake.exe # 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 /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib shell32.lib hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldif2index - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldif2ind" +# PROP BASE Intermediate_Dir "ldif2ind" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "..\SDebug\ldif2index" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 shell32.lib hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldif2index - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldif2in0" +# PROP BASE Intermediate_Dir "ldif2in0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "..\SRelease\ldif2index" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /machine:I386 !ENDIF @@ -83,6 +137,8 @@ LINK32=link.exe # Name "ldif2index - Win32 Release" # Name "ldif2index - Win32 Debug" +# Name "ldif2index - Win32 Single Debug" +# Name "ldif2index - Win32 Single Release" # Begin Source File SOURCE=.\ldif2index.c diff --git a/servers/slapd/tools/ldif2ldbm.c b/servers/slapd/tools/ldif2ldbm.c index d84276b3c20b796cdcc40183c328e2e8f8c2a9d3..df8c2698ce0d96d9204bef76792943fd29f7b9af 100644 --- a/servers/slapd/tools/ldif2ldbm.c +++ b/servers/slapd/tools/ldif2ldbm.c @@ -17,16 +17,10 @@ #include "../back-ldbm/back-ldbm.h" #include "ldif.h" +#define INDEXCMD "ldif2index" EXEEXT +#define ID2ENTRYCMD "ldif2id2entry" EXEEXT +#define ID2CHILDRENCMD "ldif2id2children" EXEEXT -#ifdef WIN32 -#define INDEXCMD "ldif2index.exe" -#define ID2ENTRYCMD "ldif2id2entry.exe" -#define ID2CHILDRENCMD "ldif2id2children.exe" -#else -#define INDEXCMD "ldif2index" -#define ID2ENTRYCMD "ldif2id2entry" -#define ID2CHILDRENCMD "ldif2id2children" -#endif #define MAXARGS 100 static void fork_child( char *prog, char *args[] ); diff --git a/servers/slapd/tools/ldif2ldbm.dsp b/servers/slapd/tools/ldif2ldbm.dsp index a338161c2a3446ad521fb161ed6265efb68edd56..049158b5c77cdb65f901f330f022c63c184c8e32 100644 --- a/servers/slapd/tools/ldif2ldbm.dsp +++ b/servers/slapd/tools/ldif2ldbm.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=ldif2ldbm - Win32 Debug +CFG=ldif2ldbm - Win32 Single Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE @@ -13,13 +13,17 @@ CFG=ldif2ldbm - Win32 Debug !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 "ldif2ldbm.mak" CFG="ldif2ldbm - Win32 Debug" +!MESSAGE NMAKE /f "ldif2ldbm.mak" CFG="ldif2ldbm - Win32 Single Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "ldif2ldbm - Win32 Release" (based on\ "Win32 (x86) Console Application") !MESSAGE "ldif2ldbm - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "ldif2ldbm - Win32 Single Debug" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "ldif2ldbm - Win32 Single Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -37,8 +41,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" +# PROP Output_Dir "..\Release" +# PROP Intermediate_Dir "..\Release\ldif2ldbm" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -61,8 +65,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" +# PROP Output_Dir "..\Debug" +# PROP Intermediate_Dir "..\Debug\ldif2dlbm" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -74,7 +78,57 @@ BSC32=bscmake.exe # 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 /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib shell32.lib hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldif2ldbm - Win32 Single Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ldif2ldb" +# PROP BASE Intermediate_Dir "ldif2ldb" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\SDebug" +# PROP Intermediate_Dir "..\SDebug\ldif2dlbm" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c +# 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 shell32.lib hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ELSEIF "$(CFG)" == "ldif2ldbm - Win32 Single Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ldif2ld0" +# PROP BASE Intermediate_Dir "ldif2ld0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\SRelease" +# PROP Intermediate_Dir "..\SRelease\ldif2dlbm" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# 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 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /machine:I386 !ENDIF @@ -82,6 +136,8 @@ LINK32=link.exe # Name "ldif2ldbm - Win32 Release" # Name "ldif2ldbm - Win32 Debug" +# Name "ldif2ldbm - Win32 Single Debug" +# Name "ldif2ldbm - Win32 Single Release" # Begin Source File SOURCE=..\tools\ldif2ldbm.c diff --git a/servers/slapd/wsa_err.c b/servers/slapd/wsa_err.c index 4492477175370cbc9d397958e4658389079634d2..856f39a0cff83fe747606f91df7bb6a13a5bd863 100644 --- a/servers/slapd/wsa_err.c +++ b/servers/slapd/wsa_err.c @@ -1,3 +1,5 @@ +#include "portable.h" + #include <winsock2.h> #define __RETSTR( x ) case x: return #x; diff --git a/servers/slurpd/args.c b/servers/slurpd/args.c index 57b80c111cfdf93959f9f02a2ac2e129167ec6ad..b1417323e370de1ee180aeced189e0668b1b17e8 100644 --- a/servers/slurpd/args.c +++ b/servers/slurpd/args.c @@ -139,7 +139,7 @@ doargs( sprintf( g->slurpd_status_file, "%s/%s", g->slurpd_rdir, DEFAULT_SLURPD_STATUS_FILE ); - lber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug); + ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug); ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldap_debug); ldif_debug = ldap_debug;