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);
}
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);
}
}
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 );
}
# 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
!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
"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
# 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
# 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"
# 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
# Name "ldapdelete - Win32 Single Debug"
# Name "ldapdelete - Win32 Single Release"
+# Name "ldapdelete - Win32 Debug"
+# Name "ldapdelete - Win32 Release"
# Begin Source File
SOURCE=.\ldapdelete.c
+/*
+ * 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"
}
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;
}
# 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
!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
"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
# 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
# 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
# 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
Package=<4>
{{{
+ Begin Project Dependency
+ Project_Dep_Name liblber
+ End Project Dependency
}}}
###############################################################################
}
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 );
}
# 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
!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
"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
# 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
# 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"
# 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
# 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
# Name "ldapmodrdn - Win32 Single Debug"
# Name "ldapmodrdn - Win32 Single Release"
+# Name "ldapmodrdn - Win32 Debug"
+# Name "ldapmodrdn - Win32 Release"
# Begin Source File
SOURCE=.\ldapmodrdn.c
#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>
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;
}
/*
}
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)
}
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;
}
( *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 ) {
"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
# 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
# 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"
# 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
# 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
+/*
+ * 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.
#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;
#endif
int ldebug; /* library debug flag */
+#ifndef HAVE_MKVERSION
+char Version[] = "OpenLDAP UserDirectory (ud)";
+#endif
int
main( int argc, char **argv )
#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);
}
# 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
# 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
# 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
# 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"
# 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
# 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
###############################################################################
+Project: "libldif"=..\..\libraries\libldif\libldif.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "liblutil"=..\..\libraries\liblutil\liblutil.dsp - Package Owner=<4>
Package=<5>
Begin Project Dependency
Project_Dep_Name liblutil
End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libldif
+ End Project Dependency
}}}
###############################################################################
+/*
+ * 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.
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;
* 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
#endif /* __alpha && !VMS */
+
+#if defined( WSAEWOULDBLOCK )
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#endif
+
#endif /* _AC_SOCKET_H_ */
# 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 */
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 */
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,
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
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
* 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 ));
#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
* 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.
*/
/*
* 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
* 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>
/* #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 ""
#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
#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 */
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;
* 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;
#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
*/
typedef struct ldapmsg LDAPMessage;
-#define NULLMSG ((LDAPMessage *) NULL)
/*
* structures for ldap getfilter routines
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;
/*
* 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,
/*
* 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,
/*
* 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,
/*
* 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,
/*
* 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));
/*
* 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,
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,
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
#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 */
** 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.
**
/* #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 */
#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
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 */
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,
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
#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
#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 {
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 */
((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
/*
- * 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
/* 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
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
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]));
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
/* --------------------------------------------------- */
/* 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
#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
#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 ));
!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
# 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
# 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
# Name "libavl - Win32 Release"
# Name "libavl - Win32 Debug"
# Name "libavl - Win32 Single Debug"
+# Name "libavl - Win32 Single Release"
# Begin Source File
SOURCE=.\avl.c
# 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
!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
# 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
# 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"
# 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"
# 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
# Name "testavl - Win32 Release"
# Name "testavl - Win32 Debug"
+# Name "testavl - Win32 Single Debug"
+# Name "testavl - Win32 Single Release"
# Begin Source File
SOURCE=.\testavl.c
* 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",
* 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
fmt = va_arg( ap, char * );
#endif
- if ( !lber_log_check( errlvl, loglvl )) {
+ assert( fmt != NULL );
+
+ if ( !ber_log_check( errlvl, loglvl )) {
return 0;
}
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;
}
*/
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;
}
}
void
-ber_bprint(char *data, int len )
+ber_bprint(
+ LDAP_CONST char *data,
+ int len )
{
static const char hexdig[] = "0123456789abcdef";
#define BPLEN 48
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;
}
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;
}
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;
}
}
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",
}
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;
}
}
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
char *tagp;
unsigned int i;
+ assert( ber != NULL );
+
if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
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
}
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 );
}
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,
unsigned long
ber_scanf
#if HAVE_STDARG
- ( BerElement *ber, char *fmt, ... )
+ ( BerElement *ber,
+ LDAP_CONST char *fmt,
+ ... )
#else
( va_alist )
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;
long *l;
unsigned long rc, tag, len;
+ assert( ber != NULL );
+
#ifdef HAVE_STDARG
va_start( ap, fmt );
#else
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 );
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;
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 ) {
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 );
{
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 );
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;
}
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 );
}
# 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
!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
# 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
# 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"
# 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
# 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
# Name "dtest - Win32 Release"
# Name "dtest - Win32 Debug"
+# Name "dtest - Win32 Single Debug"
+# Name "dtest - Win32 Single Release"
# Begin Source File
SOURCE=.\dtest.c
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.
int len, lenlen;
long netnum, mask;
+ assert( ber != NULL );
+
sign = (num < 0);
/*
int
ber_put_enum( BerElement *ber, long num, unsigned long tag )
{
+ assert( ber != NULL );
+
if ( tag == LBER_DEFAULT )
tag = LBER_ENUMERATED;
int
ber_put_int( BerElement *ber, long num, unsigned long tag )
{
+ assert( ber != NULL );
+
if ( tag == LBER_DEFAULT )
tag = LBER_INTEGER;
}
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;
int free_str;
#endif /* STR_TRANSLATION */
+ assert( ber != NULL );
+ assert( str != NULL );
+
if ( tag == LBER_DEFAULT )
tag = LBER_OCTETSTRING;
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;
unsigned char trueval = 0xff;
unsigned char falseval = 0x00;
+ assert( ber != NULL );
+
if ( tag == LBER_DEFAULT )
tag = LBER_BOOLEAN;
{
Seqorset *new;
+ assert( ber != NULL );
+
if ( (new = (Seqorset *) calloc( sizeof(Seqorset), 1 ))
== NULLSEQORSET )
return( -1 );
int
ber_start_seq( BerElement *ber, unsigned long tag )
{
+ assert( ber != NULL );
+
if ( tag == LBER_DEFAULT )
tag = LBER_SEQUENCE;
int
ber_start_set( BerElement *ber, unsigned long tag )
{
+ assert( ber != NULL );
+
if ( tag == LBER_DEFAULT )
tag = LBER_SET;
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
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 ) );
}
int
ber_printf
#ifdef HAVE_STDARG
- ( BerElement *ber, char *fmt, ... )
+ ( BerElement *ber,
+ LDAP_CONST char *fmt,
+ ... )
#else
( va_alist )
va_dcl
char *fmt;
#endif
char *s, **ss;
- struct berval **bv;
+ struct berval *bv, **bvp;
int rc, i;
unsigned long len;
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 );
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 );
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;
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;
char *s, *p;
#endif
int fd, num;
- Seqorset *sos = NULLSEQORSET;
+ Seqorset *sos = NULL;
BerElement *ber;
Sockbuf *sb;
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;
}
}
}
-
#endif
- lber_pvt_sb_free( sb );
+ if ( ber_flush( sb, ber, 1 ) == -1 ) {
+ perror( "ber_flush" );
+ exit( 1 );
+ }
+
+ ber_sockbuf_free( sb );
return( 0 );
}
# 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
!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
# 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
# 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"
# 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
# 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
# Name "etest - Win32 Release"
# Name "etest - Win32 Debug"
+# Name "etest - Win32 Single Debug"
+# Name "etest - Win32 Single Release"
# Begin Source File
SOURCE=.\etest.c
#include "portable.h"
#include <stdio.h>
+#include <stdlib.h>
#ifdef HAVE_PSAP_H
#include <psap.h>
exit( 0 );
#else
fprintf(stderr, "requires ISODE X.500 distribution.\n");
- exit( 1 );
+ return( EXIT_FAILURE );
#endif
}
# 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
!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
# 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
# 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"
# 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
# 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
# Name "idtest - Win32 Release"
# Name "idtest - Win32 Debug"
+# Name "idtest - Win32 Single Debug"
+# Name "idtest - Win32 Single Release"
# Begin Source File
SOURCE=.\idtest.c
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 );
{
unsigned long actuallen, nleft;
+ assert( ber != NULL );
+ assert( buf != NULL );
+
nleft = ber->ber_end - ber->ber_ptr;
actuallen = nleft < len ? nleft : 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 )
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;
void
ber_free( BerElement *ber, int freebuf )
{
+ assert( ber != NULL );
+
if ( freebuf && ber->ber_buf != NULL )
free( ber->ber_buf );
ber->ber_buf = NULL;
{
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 );
}
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;
}
{
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 );
}
}
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;
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;
{
BerElement *ber;
+ assert( bv != NULL );
+
if ( bv == NULL ) {
return NULL;
}
** 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 );
}
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;
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 )
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;
#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.
*/
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" );
}
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) {
}
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) -
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;
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;
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;
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);
}
void ber_clear( BerElement *ber, int freebuf )
{
+ assert( ber != NULL );
+
if ((freebuf) && (ber->ber_buf))
free( ber->ber_buf );
ber->ber_buf = NULL;
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;
-}
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;
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
/*
* 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 */
# 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
# 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
# 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
# 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
#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)
if(item == NULL) {
if(option == LBER_OPT_BER_DEBUG) {
- * (int *) outvalue = lber_int_debug;
+ * (int *) outvalue = ber_int_debug;
return LBER_OPT_SUCCESS;
}
}
int
-lber_set_option(
+ber_set_option(
void *item,
int option,
void *invalue)
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;
}
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 */
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) &&
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);
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)|
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;
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 );
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 );
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 );
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
return -1;
}
- len = (rand() % len)+1;
+ if( len > 0 )
+ len = (rand() % len)+1;
#endif
buf = (char *) buf_arg;
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... */
}
#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 */
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;
#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;
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;
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;
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;
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;
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)
}
#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;
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;
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 ) || \
/*
* 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 );
/*
* 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 */
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;
static int
dgram_release( Sockbuf *sb )
{
+ assert( sb != NULL);
free( sb->sb_iodata );
return 0;
}
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;
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 )
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 */
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);
}
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;
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;
static int
have_no_close( Sockbuf *sb )
{
+ assert( sb != NULL );
assert( 0 );
return -1;
}
#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
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;
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 );
}
}
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 */
if ( ldap_msgdelete( ld, msgid ) == 0 ) {
ld->ld_errno = LDAP_SUCCESS;
- return( 0 );
+ return LDAP_SUCCESS;
}
err = 0;
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;
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 {
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;
if ( err != -1 ) {
ld->ld_errno = LDAP_SUCCESS;
}
- return( err );
+
+ return( ld->ld_errno );
}
#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
* 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;
/* 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... */
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 );
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 );
+}
+
* 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"
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);
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
}
}
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;
}
# 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
!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
# 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
# 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
# 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
###############################################################################
+Project: "liblber"=..\liblber\liblber.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "libldap"=.\libldap.dsp - Package Owner=<4>
Package=<5>
Package=<4>
{{{
+ Begin Project Dependency
+ Project_Dep_Name liblber
+ End Project Dependency
}}}
###############################################################################
*/
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:
* 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 );
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
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",
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;
static int
-chain_contains_dn( LDAPMessage *msg, char *dn )
+chain_contains_dn( LDAPMessage *msg, const char *dn )
{
LDAPMessage *m;
BerElement ber;
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;
}
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 );
--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",
* 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 *)
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 *)
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 */
#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;
/* 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
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
#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
*/
/*
* Duplicate an array of LDAPControl
*/
-LDAPControl **ldap_controls_dup( LDAPControl **controls )
+LDAPControl **ldap_controls_dup( const LDAPControl **controls )
{
LDAPControl **new;
int i;
/*
* Duplicate a LDAPControl
*/
-LDAPControl *ldap_control_dup( LDAPControl *c )
+LDAPControl *ldap_control_dup( const LDAPControl *c )
{
LDAPControl *new;
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
#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;
/* 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 )
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 );
+}
/* depreciated */
void
-ldap_perror( LDAP *ld, char *s )
+ldap_perror( LDAP *ld, LDAP_CONST char *s )
{
int i;
#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;
#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 )
}
char *
-ldap_dn2ufn( char *dn )
+ldap_dn2ufn( LDAP_CONST char *dn )
{
char *p, *ufn, *r;
int state;
}
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 );
}
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;
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 );
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 ) {
#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;
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 );
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;
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;
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;
#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];
}
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];
#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"
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.
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 */
};
#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;
/*
* 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
/*
* 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
/*
* 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 );
* 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 );
/*
* 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
/*
* 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 )
# 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
# 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
# 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
# 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
# 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
!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
# 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
# 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"
# 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
# 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
# Name "ltest - Win32 Release"
# Name "ltest - Win32 Debug"
+# Name "ltest - Win32 Single Release"
+# Name "ltest - Win32 Single Debug"
# Begin Source File
SOURCE=.\test.c
#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[] = {
* { 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;
* }
*/
- 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... */
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 );
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 );
+}
+
#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:
* }
*/
- 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 );
}
*/
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
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;
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 */
#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 */
* ld = ldap_open( host, port );
*/
LDAP *
-ldap_init( char *defhost, int defport )
+ldap_init( LDAP_CONST char *defhost, int defport )
{
LDAP *ld;
/* 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 );
++q;
}
} else {
- curhost = p; /* avoid copy if possible */
+ curhost = (char *) p; /* avoid copy if possible */
q = NULL;
}
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
#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
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:
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;
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++) {
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;
}
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;
}
#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
}
}
- lber_pvt_sb_set_desc( sb, s );
+ ber_pvt_sb_set_desc( sb, s );
if ( connected ) {
void
ldap_close_connection( Sockbuf *sb )
{
- lber_pvt_sb_close( sb );
+ ber_pvt_sb_close( 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 );
}
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 );
}
}
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 );
}
}
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 );
}
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 ));
}
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 ));
}
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
va_end(ap);
- (*lber_pvt_log_print)( buf );
+ (*ber_pvt_log_print)( buf );
return 1;
}
goto free_and_return;
}
- rc = ldap_get_ber_controls( &be, serverctrls );
+ rc = ldap_int_get_controls( &be, serverctrls );
free_and_return:
{
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 {
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 )
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
* 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 );
}
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;
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;
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",
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 */
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 && (
}
#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;
}
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 );
}
}
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 ) );
}
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 :
*/
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;
*/
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;
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
* 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;
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 );
}
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:
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 ) {
return( NULLBER );
}
- filter = strdup( filter );
+ filter = strdup( filter_in );
err = put_filter( ber, filter );
free( 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 );
}
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;
}
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;
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;
}
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 )
{
* 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,
* 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;
*/
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 );
}
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 );
#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;
}
#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 */
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 );
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;
}
/* 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 );
/* 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.
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';
}
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;
}
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 );
}
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 */
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;
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;
# 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
!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
# 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
# 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
# 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
# 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
# End Source File
# Begin Source File
-SOURCE=..\..\include\ldapconfig.h
+SOURCE=..\..\include\ldap_pvt_thread.h
# End Source File
# Begin Source File
# 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
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 */
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;
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;
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;
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;
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;
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;
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;
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));
}
#include "ldap_pvt_thread.h"
#if defined( HAVE_NT_THREADS )
-#include <process.h>
int
ldap_pvt_thread_initialize( void )
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;
}
#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
}
# 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
!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
# 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
# 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
# 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
# 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
# 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
# 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
int
ldif_parse_line(
- char *line,
+ LDAP_CONST char *line,
char **type,
char **value,
int *vlen
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 );
}
/* 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 );
}
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 );
}
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];
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
*/
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;
}
# 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
# 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
# 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
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 ( ;; ) {
* 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
}
}
- if ( lber_pvt_sb_data_ready( &sb ) ||
+ if ( ber_pvt_sb_data_ready( &sb ) ||
FD_ISSET( clientsock, &readfds ) ) {
client_request( &sb, conns, udp );
} else {
#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 ) );
}
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 ) {
{
#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 *)
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 );
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,
# 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
!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
# 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
# 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
# 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
*/
{
- 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;
#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;
}
ldap_pvt_thread_mutex_unlock( &connections_mutex );
- return 0;
+
+ return 0;
}
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
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;
}
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 ) {
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 );
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);
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 );
}
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 */
}
/* 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 );
}
}
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 );
}
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 );
}
#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
}
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",
}
#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" : "",
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 );
}
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 );
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 );
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 );
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 );
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;
slapd_clr_write( wd, 0 );
if ( connection_write( wd ) < 0 ) {
- FD_CLR( wd, &readfds );
+ FD_CLR( (unsigned) wd, &readfds );
slapd_close( wd );
}
}
# 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
!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
# 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
# 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
# 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
# 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
# End Source File
# Begin Source File
+SOURCE=.\slap.h
+# End Source File
+# Begin Source File
+
SOURCE=.\str2filter.c
# End Source File
# Begin Source File
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
int inetd = 0;
int rc;
int tcps;
+#ifdef LDAP_CONNECTIONLESS
int udp;
+#endif
#ifdef LOG_LOCAL4
int syslogUser = DEFAULT_SYSLOG_USER;
#endif
g_argv = argv;
while ( (i = getopt( argc, argv,
- "d:f:ia:p:s:c"
+ "d:f:ia:p:s:"
#ifdef LOG_LOCAL4
"l:"
#endif
#endif
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
"u:g:"
+#endif
+#ifdef LDAP_CONNECTIONLESS
+ "c"
#endif
)) != EOF ) {
switch ( i ) {
}
}
- 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;
-#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;
#include "slap.h"
+/* we need LBER internals */
+#include "../../libraries/liblber/lber-int.h"
+
static void
send_ldap_result2(
Connection *conn,
return;
}
- if ( ber_flush( &conn->c_sb, ber, 1 ) == 0 ) {
+ if ( ber_flush( conn->c_sb, ber, 1 ) == 0 ) {
break;
}
/* 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;
{
#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 ),
return 0;
}
- if ( ber_flush( &conn->c_sb, ber, 1 ) == 0 ) {
+ if ( ber_flush( conn->c_sb, ber, 1 ) == 0 ) {
break;
}
/* 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;
#include "ldap_log.h"
-#include "../../libraries/liblber/lber-int.h"
+#include "lber.h"
#include "ldap.h"
#include "ldap_pvt_thread.h"
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 */
# 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
!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
# 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
# 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
# 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
# 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
###############################################################################
-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>
###############################################################################
-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>
Package=<4>
{{{
+ Begin Project Dependency
+ Project_Dep_Name liblber
+ End Project Dependency
}}}
###############################################################################
# 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
!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
# 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
# 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"
# 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
# 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
# Name "ldbmcat - Win32 Release"
# Name "ldbmcat - Win32 Debug"
+# Name "ldbmcat - Win32 Single Debug"
+# Name "ldbmcat - Win32 Single Release"
# Begin Source File
SOURCE=.\ldbmcat.c
# 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
!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
# 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
# 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
# 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
# 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
!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
# 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
# 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
# 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
# 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
!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
"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
# 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
# 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
# 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
# Name "ldif2id2children - Win32 Release"
# Name "ldif2id2children - Win32 Debug"
+# Name "ldif2id2children - Win32 Single Debug"
+# Name "ldif2id2children - Win32 Single Release"
# Begin Source File
SOURCE=.\ldif2id2children.c
# 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
!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
"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
# 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
# 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
# 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
# Name "ldif2id2entry - Win32 Release"
# Name "ldif2id2entry - Win32 Debug"
+# Name "ldif2id2entry - Win32 Single Debug"
+# Name "ldif2id2entry - Win32 Single Release"
# Begin Source File
SOURCE=.\ldif2id2entry.c
# 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
!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
"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
# 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
# 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
# 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
# Name "ldif2index - Win32 Release"
# Name "ldif2index - Win32 Debug"
+# Name "ldif2index - Win32 Single Debug"
+# Name "ldif2index - Win32 Single Release"
# Begin Source File
SOURCE=.\ldif2index.c
#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[] );
# 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
!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
# 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
# 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
# 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
# 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
+#include "portable.h"
+
#include <winsock2.h>
#define __RETSTR( x ) case x: return #x;
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;