mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 00:59:45 -05:00
Vienna Bulk Commit
This commit includes many changes. All changes compile under NT but
have not been tested under UNIX.
A Summary of changes (likely incomplete):
NT changes:
Removed lint.
Clean up configuration support for "Debug", "Release", "SDebug",
and "SRelease" configurations.
Share output directories for clients, libraries,
and slapd. (maybe they should be combined further
and moved to build/{,S}{Debug,Release}).
Enable threading when _MT is defined.
Enable debuging when _DEBUG is defined.
Disable setting of NDEBUG under Release/SRelease. Asserts
are disabled in <ac/assert.h> when LDAP_DEBUG is not
defined.
Added 'build/main.dsp' Master project.
Removed non-slapd projects from slapd.dsp (see main.dsp).
Removed replaced many uses of _WIN32 macro with feature based
macros.
ldap_cdefs.h changes
#define LDAP_CONST const
(see below)
#define LDAP_F(type) LDAP_F_PRE type LDAP_F_POST
To allow specifiers to be added before and after
the type declaration. (For DLL handling)
LBER/LDAP changes
Namespace changes:
s/lber_/ber_/ for here and there.
s/NAME_ERROR/LDAP_NAME_ERROR/g
Deleted NULLMSG and other NULL* macros for namespace reasons.
"const" libraries. Installed headers (ie: lber.h, ldap.h)
use LDAP_CONST macro. Normally set to 'const' when
__STDC__. Can be set externally to enable/disable
'constification' of external interface. Internal
interface always uses 'const'. Did not fix warnings
in -lldif (in lieu of new LDIF parser).
Added _ext API implementations (excepting search and bind).
Need to implement ldap_int_get_controls() for reponses
with controls.
Added numberous assert() checks.
LDAP_R
_MT defines HAVE_NT_THREADS
Added numberous assert() checks.
Changed ldap_pthread_t back to unsigned long. Used cast
to HANDLE in _join().
LDBM
Replaced _WIN32 with HAVE_SYSLOG
ud
Added version string if MKVERSION is not defined. (MKVERSION
needs to be set under UNIX).
slapd
Made connection sockbuf field a pointer to a sockbuf. This
removed slap.h dependency on lber-int.h. lber-int.h now only
included by those files needing to mess with the sockbuf.
Used ber_* functions/macros to access sockbuf internals whenever
possible.
Added version string if MKVERSION is not defined. (MKVERSION
needs to be set under UNIX).
Removed FD_SET unsigned lint
slapd/tools
Used EXEEXT to added ".exe" to routines. Need to define EXEEXT
under UNIX.
ldappasswd
Added ldappasswd.dsp. Ported to NT. Used getpid() to seed rand().
nt_debug
Minor cleanup. Added "portable.h" include and used <ac/*.h> where
appropriate. Added const to char* format argument.
This commit is contained in:
parent
29a7d6229a
commit
dc07e765f2
123 changed files with 4584 additions and 1817 deletions
|
|
@ -171,7 +171,7 @@ main( int argc, char **argv )
|
|||
myname = strdup( myname + 1 );
|
||||
|
||||
if ( debug ) {
|
||||
lber_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug);
|
||||
ber_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug);
|
||||
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ main (int argc, char **argv )
|
|||
myname = strdup( myname + 1 );
|
||||
|
||||
if ( debug ) {
|
||||
lber_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug);
|
||||
ber_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug);
|
||||
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ main( int argc, char **argv )
|
|||
}
|
||||
|
||||
if ( debug ) {
|
||||
lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=ldapdelete - Win32 Single Debug
|
||||
CFG=ldapdelete - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,7 +13,7 @@ CFG=ldapdelete - Win32 Single Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ldapdelete.mak" CFG="ldapdelete - Win32 Single Debug"
|
||||
!MESSAGE NMAKE /f "ldapdelete.mak" CFG="ldapdelete - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
|
|
@ -21,6 +21,10 @@ CFG=ldapdelete - Win32 Single Debug
|
|||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapdelete - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapdelete - Win32 Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapdelete - Win32 Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -39,8 +43,8 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "ldapdele"
|
||||
# PROP Intermediate_Dir "ldapdele"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\ldapdelete"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
|
|
@ -52,7 +56,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\SDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapdelete - Win32 Single Release"
|
||||
|
||||
|
|
@ -64,19 +68,69 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ldapdel0"
|
||||
# PROP Intermediate_Dir "ldapdel0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\ldapdelete"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 /out:"SRelease/ldapdelete.exe" /libpath:"..\..\libraries\SRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapdelete - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "ldapdel1"
|
||||
# PROP BASE Intermediate_Dir "ldapdel1"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\ldapdelete"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapdelete - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ldapdel2"
|
||||
# PROP BASE Intermediate_Dir "ldapdel2"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\ldapdelete"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapdelete.exe" /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapdelete.exe" /libpath:"..\..\libraries\Release"
|
||||
|
||||
!ENDIF
|
||||
|
|
@ -85,6 +139,8 @@ LINK32=link.exe
|
|||
|
||||
# Name "ldapdelete - Win32 Single Debug"
|
||||
# Name "ldapdelete - Win32 Single Release"
|
||||
# Name "ldapdelete - Win32 Debug"
|
||||
# Name "ldapdelete - Win32 Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ldapdelete.c
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
/*
|
||||
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/* ldapmodify.c - generic program to modify or add entries using LDAP */
|
||||
|
||||
#include "portable.h"
|
||||
|
|
@ -200,7 +204,7 @@ main( int argc, char **argv )
|
|||
}
|
||||
|
||||
if ( debug ) {
|
||||
lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
||||
ldif_debug = debug;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=ldapmodify - Win32 Single Debug
|
||||
CFG=ldapmodify - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,7 +13,7 @@ CFG=ldapmodify - Win32 Single Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ldapmodify.mak" CFG="ldapmodify - Win32 Single Debug"
|
||||
!MESSAGE NMAKE /f "ldapmodify.mak" CFG="ldapmodify - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
|
|
@ -21,6 +21,10 @@ CFG=ldapmodify - Win32 Single Debug
|
|||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapmodify - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapmodify - Win32 Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapmodify - Win32 Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -39,8 +43,8 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "ldapmodi"
|
||||
# PROP Intermediate_Dir "ldapmodi"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\ldapmodify"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
|
|
@ -64,8 +68,8 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ldapmod0"
|
||||
# PROP Intermediate_Dir "ldapmod0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\ldapmodify"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
|
|
@ -79,27 +83,67 @@ LINK32=link.exe
|
|||
# ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\libraries\Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapmodify - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "ldapmod1"
|
||||
# PROP BASE Intermediate_Dir "ldapmod1"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\ldapmodify"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Release/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Release/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapmodify - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ldapmod2"
|
||||
# PROP BASE Intermediate_Dir "ldapmod2"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\ldapmodify"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\libraries\Release"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "ldapmodify - Win32 Single Debug"
|
||||
# Name "ldapmodify - Win32 Single Release"
|
||||
# Begin Group "Source"
|
||||
|
||||
# PROP Default_Filter ".c"
|
||||
# Name "ldapmodify - Win32 Debug"
|
||||
# Name "ldapmodify - Win32 Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ldapmodify.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Headers"
|
||||
|
||||
# PROP Default_Filter ".h"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\portable.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ Package=<5>
|
|||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name liblber
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if ( debug ) {
|
||||
lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=ldapmodrdn - Win32 Single Debug
|
||||
CFG=ldapmodrdn - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,7 +13,7 @@ CFG=ldapmodrdn - Win32 Single Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ldapmodrdn.mak" CFG="ldapmodrdn - Win32 Single Debug"
|
||||
!MESSAGE NMAKE /f "ldapmodrdn.mak" CFG="ldapmodrdn - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
|
|
@ -21,6 +21,10 @@ CFG=ldapmodrdn - Win32 Single Debug
|
|||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapmodrdn - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapmodrdn - Win32 Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapmodrdn - Win32 Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -39,8 +43,8 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "ldapmodr"
|
||||
# PROP Intermediate_Dir "ldapmodr"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\ldapmodrdn"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
|
|
@ -52,7 +56,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\SDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Single Release"
|
||||
|
||||
|
|
@ -64,12 +68,12 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ldapmod0"
|
||||
# PROP Intermediate_Dir "ldapmod0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\ldapmodrdn"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -77,6 +81,56 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\libraries\SRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "ldapmod1"
|
||||
# PROP BASE Intermediate_Dir "ldapmod1"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\ldapmodrdn"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ldapmod2"
|
||||
# PROP BASE Intermediate_Dir "ldapmod2"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\ldapmodrdn"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\libraries\Release"
|
||||
|
||||
!ENDIF
|
||||
|
|
@ -85,6 +139,8 @@ LINK32=link.exe
|
|||
|
||||
# Name "ldapmodrdn - Win32 Single Debug"
|
||||
# Name "ldapmodrdn - Win32 Single Release"
|
||||
# Name "ldapmodrdn - Win32 Debug"
|
||||
# Name "ldapmodrdn - Win32 Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ldapmodrdn.c
|
||||
|
|
|
|||
|
|
@ -15,13 +15,14 @@
|
|||
|
||||
#include "portable.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/signal.h>
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
|
||||
#include <lber.h>
|
||||
|
|
@ -121,20 +122,15 @@ pw_encode (unsigned char *passwd, Salt * salt, unsigned int len)
|
|||
void
|
||||
make_salt (Salt * salt, unsigned int len)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
if (!salt)
|
||||
return;
|
||||
|
||||
/* seed random number generator */
|
||||
gettimeofday (&tv, NULL);
|
||||
srand (tv.tv_usec);
|
||||
|
||||
salt->len = len;
|
||||
salt->salt = (unsigned char *)malloc (len);
|
||||
|
||||
for (len = 0; len < salt->len; len++)
|
||||
salt->salt[len] = (tv.tv_usec ^ rand ()) & 0xff;
|
||||
salt->salt[len] = rand () & 0xff;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -561,13 +557,26 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
if ( debug ) {
|
||||
lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
||||
}
|
||||
|
||||
#ifdef SIGPIPE
|
||||
(void) SIGNAL( SIGPIPE, SIG_IGN );
|
||||
#endif
|
||||
/* seed random number generator */
|
||||
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
/* this is of questionable value
|
||||
* gettimeofday not provide much usec
|
||||
*/
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
srand (tv.tv_usec);
|
||||
#else
|
||||
/* The traditional seed */
|
||||
srand((unsigned)time( NULL ));
|
||||
#endif
|
||||
|
||||
/* connect to server */
|
||||
if ((ld = ldap_init (ldaphost, ldapport)) == NULL)
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ main( int argc, char **argv )
|
|||
}
|
||||
|
||||
if ( debug ) {
|
||||
lber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug );
|
||||
ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug );
|
||||
ldif_debug = debug;
|
||||
}
|
||||
|
|
@ -406,7 +406,7 @@ static int dosearch(
|
|||
( *sortattr == '\0' ) ? NULL : sortattr, strcasecmp );
|
||||
matches = 0;
|
||||
first = 1;
|
||||
for ( e = ldap_first_entry( ld, res ); e != NULLMSG;
|
||||
for ( e = ldap_first_entry( ld, res ); e != NULL;
|
||||
e = ldap_next_entry( ld, e ) ) {
|
||||
matches++;
|
||||
if ( !first ) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ CFG=ldapsearch - Win32 Single Debug
|
|||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapsearch - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapsearch - Win32 Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ldapsearch - Win32 Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -39,8 +43,8 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "ldapsear"
|
||||
# PROP Intermediate_Dir "ldapsear"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\ldapsearch"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
|
|
@ -52,7 +56,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\SDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapsearch - Win32 Single Release"
|
||||
|
||||
|
|
@ -64,12 +68,12 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ldapsea0"
|
||||
# PROP Intermediate_Dir "ldapsea0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\ldapsearch"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -77,14 +81,66 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\SRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapsearch - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ldapsea1"
|
||||
# PROP BASE Intermediate_Dir "ldapsea1"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\ldapsearch"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\SRelease"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ldapsearch - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ldapsea2"
|
||||
# PROP BASE Intermediate_Dir "ldapsea2"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\ldapsearch"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\SRelease"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "ldapsearch - Win32 Single Debug"
|
||||
# Name "ldapsearch - Win32 Single Release"
|
||||
# Name "ldapsearch - Win32 Release"
|
||||
# Name "ldapsearch - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ldapsearch.c
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
/*
|
||||
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993
|
||||
* Regents of the University of Michigan. All rights reserved.
|
||||
|
|
@ -43,18 +47,13 @@
|
|||
#include <ldapconfig.h>
|
||||
#include "ud.h"
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1991, 1992, 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Used with change_base() to indicate which base we are changing.
|
||||
*/
|
||||
#define BASE_SEARCH 0
|
||||
#define BASE_GROUPS 1
|
||||
|
||||
#define iscom(x) (!strncasecmp(x, cmd, strlen(cmd)))
|
||||
#define iscom(x) (!strncasecmp((x), cmd, strlen(cmd)))
|
||||
|
||||
static char *server = NULL;
|
||||
static char *config_file = UD_CONFIG_FILE;
|
||||
|
|
@ -83,6 +82,9 @@ int debug; /* debug flag */
|
|||
#endif
|
||||
int ldebug; /* library debug flag */
|
||||
|
||||
#ifndef HAVE_MKVERSION
|
||||
char Version[] = "OpenLDAP UserDirectory (ud)";
|
||||
#endif
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
|
|
@ -552,7 +554,7 @@ initialize_client( void )
|
|||
#endif
|
||||
|
||||
if (ldebug) {
|
||||
lber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldebug);
|
||||
ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldebug);
|
||||
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldebug);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\ud"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -63,12 +63,12 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\ud"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -88,8 +88,8 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "ud___Wi0"
|
||||
# PROP Intermediate_Dir "ud___Wi0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\ud"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
|
|
@ -101,7 +101,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release"
|
||||
# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\SRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ud - Win32 Single Debug"
|
||||
|
||||
|
|
@ -113,8 +113,8 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "ud___Wi1"
|
||||
# PROP Intermediate_Dir "ud___Wi1"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\ud"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
|
|
@ -126,7 +126,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
|
||||
# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\SDebug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,18 @@ Package=<4>
|
|||
|
||||
###############################################################################
|
||||
|
||||
Project: "libldif"=..\..\libraries\libldif\libldif.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "liblutil"=..\..\libraries\liblutil\liblutil.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
|
@ -56,6 +68,9 @@ Package=<4>
|
|||
Begin Project Dependency
|
||||
Project_Dep_Name liblutil
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name libldif
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
/*
|
||||
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted only
|
||||
* as authorized by the OpenLDAP Public License. A copy of this
|
||||
* license is available at http://www.OpenLDAP.org/license.html or
|
||||
* in file LICENSE in the top-level directory of the distribution.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993
|
||||
* Regents of the University of Michigan. All rights reserved.
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ int main(int argc, char **argv)
|
|||
case 'd':
|
||||
#ifdef LDAP_DEBUG
|
||||
tmp = atoi(optarg);
|
||||
lber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &tmp);
|
||||
ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &tmp);
|
||||
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &tmp);
|
||||
#endif
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
* create a replacement and hope it works
|
||||
*/
|
||||
|
||||
void lber_pvt_assert(char* file, int line, char* test);
|
||||
void ber_pvt_assert(char* file, int line, char* test);
|
||||
#define assert(test) \
|
||||
((test) \
|
||||
? (void)0 \
|
||||
: lber_pvt_assert( __FILE__, __LINE__, LDAP_STRING(test)) )
|
||||
: ber_pvt_assert( __FILE__, __LINE__, LDAP_STRING(test)) )
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -104,4 +104,9 @@
|
|||
|
||||
#endif /* __alpha && !VMS */
|
||||
|
||||
|
||||
#if defined( WSAEWOULDBLOCK )
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#endif
|
||||
|
||||
#endif /* _AC_SOCKET_H_ */
|
||||
|
|
|
|||
|
|
@ -17,13 +17,11 @@
|
|||
# include <time.h>
|
||||
#elif HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# ifdef HAVE_SYS_TIMEB_H
|
||||
# include <sys/timeb.h>
|
||||
# endif
|
||||
#else
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <sys/types.h>
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#endif /* _AC_TIME_H */
|
||||
|
|
|
|||
|
|
@ -55,43 +55,43 @@ typedef int (*AVL_CMP) LDAP_P((void*, void*));
|
|||
typedef int (*AVL_DUP) LDAP_P((void*, void*));
|
||||
typedef void (*AVL_FREE) LDAP_P((void*));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
avl_free LDAP_P(( Avlnode *root, AVL_FREE dfree ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
avl_insert LDAP_P((Avlnode **, void*, AVL_CMP, AVL_DUP));
|
||||
|
||||
LDAP_F void*
|
||||
LDAP_F( void* )
|
||||
avl_delete LDAP_P((Avlnode **, void*, AVL_CMP));
|
||||
|
||||
LDAP_F void*
|
||||
LDAP_F( void* )
|
||||
avl_find LDAP_P((Avlnode *, void*, AVL_CMP));
|
||||
|
||||
LDAP_F void*
|
||||
LDAP_F( void* )
|
||||
avl_find_lin LDAP_P((Avlnode *, void*, AVL_CMP));
|
||||
|
||||
LDAP_F void*
|
||||
LDAP_F( void* )
|
||||
avl_getfirst LDAP_P((Avlnode *));
|
||||
|
||||
#ifdef AVL_REENTRANT
|
||||
/* ??? avl.c does not provide this version ??? */
|
||||
LDAP_F void*
|
||||
LDAP_F( void* )
|
||||
avl_getnext LDAP_P((Avlnode *, void* ));
|
||||
#else
|
||||
LDAP_F void*
|
||||
LDAP_F( void* )
|
||||
avl_getnext LDAP_P((void));
|
||||
#endif
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
avl_dup_error LDAP_P((void*, void*));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
avl_dup_ok LDAP_P((void*, void*));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
avl_apply LDAP_P((Avlnode *, AVL_APPLY, void*, int, int));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
avl_prefixapply LDAP_P((Avlnode *, void*, AVL_CMP, void*, AVL_CMP, void*, int));
|
||||
|
||||
/* apply traversal types */
|
||||
|
|
|
|||
|
|
@ -231,88 +231,88 @@ struct ldap_disptmpl {
|
|||
|
||||
typedef int (*writeptype) LDAP_P(( void *writeparm, char *p, int len ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_init_templates LDAP_P(( char *file, struct ldap_disptmpl **tmpllistp ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_init_templates_buf LDAP_P(( char *buf,
|
||||
long buflen,
|
||||
struct ldap_disptmpl **tmpllistp ));
|
||||
|
||||
LDAP_F void
|
||||
LDAP_F( void )
|
||||
ldap_free_templates LDAP_P(( struct ldap_disptmpl *tmpllist ));
|
||||
|
||||
LDAP_F struct ldap_disptmpl *
|
||||
LDAP_F( struct ldap_disptmpl * )
|
||||
ldap_first_disptmpl LDAP_P(( struct ldap_disptmpl *tmpllist ));
|
||||
|
||||
LDAP_F struct ldap_disptmpl *
|
||||
LDAP_F( struct ldap_disptmpl * )
|
||||
ldap_next_disptmpl LDAP_P(( struct ldap_disptmpl *tmpllist,
|
||||
struct ldap_disptmpl *tmpl ));
|
||||
|
||||
LDAP_F struct ldap_disptmpl *
|
||||
LDAP_F( struct ldap_disptmpl * )
|
||||
ldap_name2template LDAP_P(( char *name,
|
||||
struct ldap_disptmpl *tmpllist ));
|
||||
|
||||
LDAP_F struct ldap_disptmpl *
|
||||
LDAP_F( struct ldap_disptmpl * )
|
||||
ldap_oc2template LDAP_P(( char **oclist,
|
||||
struct ldap_disptmpl *tmpllist ));
|
||||
|
||||
LDAP_F char **
|
||||
LDAP_F( char ** )
|
||||
ldap_tmplattrs LDAP_P(( struct ldap_disptmpl *tmpl,
|
||||
char **includeattrs,
|
||||
int exclude,
|
||||
unsigned long syntaxmask ));
|
||||
|
||||
LDAP_F struct ldap_tmplitem *
|
||||
LDAP_F( struct ldap_tmplitem * )
|
||||
ldap_first_tmplrow LDAP_P(( struct ldap_disptmpl *tmpl ));
|
||||
|
||||
LDAP_F struct ldap_tmplitem *
|
||||
LDAP_F( struct ldap_tmplitem * )
|
||||
ldap_next_tmplrow LDAP_P(( struct ldap_disptmpl *tmpl,
|
||||
struct ldap_tmplitem *row ));
|
||||
|
||||
LDAP_F struct ldap_tmplitem *
|
||||
LDAP_F( struct ldap_tmplitem * )
|
||||
ldap_first_tmplcol LDAP_P(( struct ldap_disptmpl *tmpl,
|
||||
struct ldap_tmplitem *row ));
|
||||
|
||||
LDAP_F struct ldap_tmplitem *
|
||||
LDAP_F( struct ldap_tmplitem * )
|
||||
ldap_next_tmplcol LDAP_P(( struct ldap_disptmpl *tmpl,
|
||||
struct ldap_tmplitem *row,
|
||||
struct ldap_tmplitem *col ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_entry2text LDAP_P(( LDAP *ld,
|
||||
char *buf, LDAPMessage *entry,
|
||||
struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
|
||||
writeptype writeproc, void *writeparm, char *eol, int rdncount,
|
||||
unsigned long opts ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_vals2text LDAP_P(( LDAP *ld,
|
||||
char *buf, char **vals, char *label, int labelwidth,
|
||||
unsigned long syntaxid, writeptype writeproc, void *writeparm,
|
||||
char *eol, int rdncount ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_entry2text_search LDAP_P(( LDAP *ld,
|
||||
char *dn, char *base, LDAPMessage *entry,
|
||||
struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
|
||||
writeptype writeproc, void *writeparm, char *eol, int rdncount,
|
||||
unsigned long opts ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_entry2html LDAP_P(( LDAP *ld,
|
||||
char *buf, LDAPMessage *entry,
|
||||
struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
|
||||
writeptype writeproc, void *writeparm, char *eol, int rdncount,
|
||||
unsigned long opts, char *urlprefix, char *base ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_vals2html LDAP_P(( LDAP *ld,
|
||||
char *buf, char **vals, char *label, int labelwidth,
|
||||
unsigned long syntaxid, writeptype writeproc, void *writeparm,
|
||||
char *eol, int rdncount, char *urlprefix ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_entry2html_search LDAP_P(( LDAP
|
||||
*ld, char *dn, char *base, LDAPMessage *entry,
|
||||
struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,11 @@ LDAP_BEGIN_DECL
|
|||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
LDAP_F int getopt LDAP_P((int, char * const [], const char *));
|
||||
LDAP_F( int )
|
||||
getopt LDAP_P((
|
||||
int,
|
||||
char * const [],
|
||||
const char *));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
|
|
|
|||
392
include/lber.h
392
include/lber.h
|
|
@ -26,20 +26,37 @@
|
|||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/* Overview of LBER tag construction
|
||||
*
|
||||
* Bits
|
||||
* ______
|
||||
* 8 7 | CLASS
|
||||
* 0 0 = UNIVERSAL
|
||||
* 0 1 = APPLICATION
|
||||
* 1 0 = CONTEXT-SPECIFIC
|
||||
* 1 1 = PRIVATE
|
||||
* _____
|
||||
* | 6 | DATA-TYPE
|
||||
* 0 = PRIMITIVE
|
||||
* 1 = CONSTRUCTED
|
||||
* ___________
|
||||
* | 5 ... 1 | TAG-NUMBER
|
||||
*/
|
||||
|
||||
/* BER classes and mask */
|
||||
#define LBER_CLASS_UNIVERSAL 0x00
|
||||
#define LBER_CLASS_APPLICATION 0x40
|
||||
#define LBER_CLASS_CONTEXT 0x80
|
||||
#define LBER_CLASS_PRIVATE 0xc0
|
||||
#define LBER_CLASS_MASK 0xc0
|
||||
#define LBER_CLASS_UNIVERSAL 0x00UL
|
||||
#define LBER_CLASS_APPLICATION 0x40UL
|
||||
#define LBER_CLASS_CONTEXT 0x80UL
|
||||
#define LBER_CLASS_PRIVATE 0xc0UL
|
||||
#define LBER_CLASS_MASK 0xc0UL
|
||||
|
||||
/* BER encoding type and mask */
|
||||
#define LBER_PRIMITIVE 0x00
|
||||
#define LBER_CONSTRUCTED 0x20
|
||||
#define LBER_ENCODING_MASK 0x20
|
||||
#define LBER_PRIMITIVE 0x00UL
|
||||
#define LBER_CONSTRUCTED 0x20UL
|
||||
#define LBER_ENCODING_MASK 0x20UL
|
||||
|
||||
#define LBER_BIG_TAG_MASK 0x1f
|
||||
#define LBER_MORE_TAG_MASK 0x80
|
||||
#define LBER_BIG_TAG_MASK 0x1fUL
|
||||
#define LBER_MORE_TAG_MASK 0x80UL
|
||||
|
||||
/*
|
||||
* Note that LBER_ERROR and LBER_DEFAULT are values that can never appear
|
||||
|
|
@ -47,24 +64,26 @@ LDAP_BEGIN_DECL
|
|||
* fact, any tag for which the following is true is invalid:
|
||||
* (( tag & 0x00000080 ) != 0 ) && (( tag & 0xFFFFFF00 ) != 0 )
|
||||
*/
|
||||
#define LBER_ERROR 0xffffffffL
|
||||
#define LBER_DEFAULT 0xffffffffL
|
||||
/* #define LBER_END_SEQORSET 0xfffffffeL *//* no part of LDAP C-API */
|
||||
#define LBER_INVALID(tag) ( ( (tag) & 0xFFFFFF80UL ) != 0 )
|
||||
#define LBER_ERROR 0xffffffffUL
|
||||
#define LBER_DEFAULT 0xffffffffUL
|
||||
/* #define LBER_END_SEQORSET 0xfffffffeUL *//* no part of LDAP C-API */
|
||||
|
||||
/* general BER types we know about */
|
||||
#define LBER_BOOLEAN 0x01L
|
||||
#define LBER_INTEGER 0x02L
|
||||
#define LBER_BITSTRING 0x03L
|
||||
#define LBER_OCTETSTRING 0x04L
|
||||
#define LBER_NULL 0x05L
|
||||
#define LBER_ENUMERATED 0x0aL
|
||||
#define LBER_SEQUENCE 0x30L /* constructed */
|
||||
#define LBER_SET 0x31L /* constructed */
|
||||
#define 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 0x10L /* w/o constructed bit - broken */
|
||||
#define OLD_LBER_SET 0x11L /* w/o constructed bit - broken */
|
||||
#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,
|
||||
typedef int (*BERTranslateProc) LDAP_P((
|
||||
char **bufp,
|
||||
unsigned long *buflenp,
|
||||
int free_input ));
|
||||
|
||||
|
|
@ -101,114 +120,311 @@ typedef void (*BER_LOG_PRINT_FN) LDAP_P(( char *buf ));
|
|||
#define LBER_OPT_ERROR (-1)
|
||||
|
||||
typedef struct berelement BerElement;
|
||||
#define NULLBER ((BerElement *) 0)
|
||||
|
||||
typedef struct sockbuf Sockbuf;
|
||||
|
||||
typedef struct seqorset Seqorset;
|
||||
#define NULLSEQORSET ((Seqorset *) 0)
|
||||
|
||||
/* structure for returning a sequence of octet strings + length */
|
||||
struct berval {
|
||||
typedef struct berval {
|
||||
unsigned long bv_len;
|
||||
char *bv_val;
|
||||
};
|
||||
} BerValue;
|
||||
|
||||
/*
|
||||
* in bprint.c:
|
||||
*/
|
||||
LDAP_F void ber_print_error LDAP_P(( char *data ));
|
||||
LDAP_F void ber_bprint LDAP_P(( char *data, int len ));
|
||||
#define lber_bprint(d,l) ber_bprint((d),(l))
|
||||
LDAP_F( void )
|
||||
ber_print_error LDAP_P((
|
||||
LDAP_CONST char *data ));
|
||||
|
||||
LDAP_F void ber_dump LDAP_P(( BerElement *ber, int inout ));
|
||||
LDAP_F void ber_sos_dump LDAP_P(( Seqorset *sos ));
|
||||
LDAP_F( void )
|
||||
ber_bprint LDAP_P((
|
||||
LDAP_CONST char *data, int len ));
|
||||
|
||||
LDAP_F( void )
|
||||
ber_dump LDAP_P((
|
||||
LDAP_CONST BerElement *ber, int inout ));
|
||||
|
||||
LDAP_F( void )
|
||||
ber_sos_dump LDAP_P((
|
||||
LDAP_CONST Seqorset *sos ));
|
||||
|
||||
|
||||
/*
|
||||
* in decode.c:
|
||||
*/
|
||||
LDAP_F unsigned long ber_get_tag LDAP_P(( BerElement *ber ));
|
||||
LDAP_F unsigned long ber_skip_tag LDAP_P(( BerElement *ber, unsigned long *len ));
|
||||
LDAP_F unsigned long ber_peek_tag LDAP_P(( BerElement *ber, unsigned long *len ));
|
||||
LDAP_F unsigned long ber_get_int LDAP_P(( BerElement *ber, long *num ));
|
||||
LDAP_F unsigned long ber_get_stringb LDAP_P(( BerElement *ber, char *buf,
|
||||
typedef int (*BERDecodeCallback) LDAP_P((
|
||||
BerElement *ber,
|
||||
void *data,
|
||||
int mode ));
|
||||
|
||||
LDAP_F( unsigned long )
|
||||
ber_get_tag LDAP_P((
|
||||
BerElement *ber ));
|
||||
|
||||
LDAP_F( unsigned long )
|
||||
ber_skip_tag LDAP_P((
|
||||
BerElement *ber,
|
||||
unsigned long *len ));
|
||||
LDAP_F unsigned long ber_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_peek_tag LDAP_P((
|
||||
LDAP_CONST BerElement *ber, /* not const in c-api-02 */
|
||||
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_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_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_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_int LDAP_P((
|
||||
BerElement *ber,
|
||||
long num,
|
||||
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_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,
|
||||
LDAP_CONST char *str,
|
||||
unsigned long tag ));
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* in file LICENSE in the top-level directory of the distribution.
|
||||
*/
|
||||
/*
|
||||
* lber_pvt.h - Header for lber_pvt_ functions. These are meant to be used
|
||||
* lber_pvt.h - Header for ber_pvt_ functions. These are meant to be used
|
||||
* by the OpenLDAP distribution only.
|
||||
*/
|
||||
|
||||
|
|
@ -22,12 +22,13 @@ LDAP_BEGIN_DECL
|
|||
/*
|
||||
* bprint.c
|
||||
*/
|
||||
extern BER_LOG_PRINT_FN lber_pvt_log_print;
|
||||
extern BER_LOG_PRINT_FN ber_pvt_log_print;
|
||||
|
||||
LDAP_F int lber_pvt_log_printf LDAP_P((
|
||||
LDAP_F( int )
|
||||
ber_pvt_log_printf LDAP_P((
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
char *fmt,
|
||||
const char *fmt,
|
||||
... ));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
|
|
|||
1146
include/ldap.h
1146
include/ldap.h
File diff suppressed because it is too large
Load diff
|
|
@ -49,12 +49,22 @@
|
|||
#endif /* no prototypes */
|
||||
|
||||
|
||||
#ifndef LDAP_F
|
||||
#ifndef LDAP_F_PRE
|
||||
# ifdef _WIN32
|
||||
# define LDAP_F __declspec( dllexport )
|
||||
# define LDAP_F_PRE extern __declspec( dllexport )
|
||||
# else /* ! _WIN32 */
|
||||
# define LDAP_F extern
|
||||
# define LDAP_F_PRE extern
|
||||
# endif /* _WIN32 */
|
||||
#endif /* LDAP_FDECL */
|
||||
#ifndef LDAP_F_POST
|
||||
# ifdef _WIN32
|
||||
# define LDAP_F_POST
|
||||
# else /* ! _WIN32 */
|
||||
# define LDAP_F_POST
|
||||
# endif /* _WIN32 */
|
||||
#endif /* LDAP_FDECL */
|
||||
#ifndef LDAP_F
|
||||
#define LDAP_F(type) LDAP_F_PRE type LDAP_F_POST
|
||||
#endif
|
||||
|
||||
#endif /* _LDAP_CDEFS_H */
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
** LDAP_API_FEATURE_OPERATION_THREAD_SAFE
|
||||
**
|
||||
** The preprocessor flag LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
|
||||
** can be used to determine if -lldap_r is available at compile
|
||||
** can be used to determine if -lldap_r is availalbe at compile
|
||||
** time. You must define LDAP_THREAD_SAFE if and only if you
|
||||
** link with -lldap_r.
|
||||
**
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
/* #undef LDAP_API_FEATURE_X_OPENLDAP_REENTRANT */
|
||||
|
||||
/* is threadsafe version of -lldap (ie: -lldap_r) *available* or not */
|
||||
/* #undef LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE */
|
||||
#define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE LDAP_VENDOR_VERSION
|
||||
|
||||
/* LDAP v2 DNS */
|
||||
/* #undef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ LDAP_BEGIN_DECL
|
|||
#define LDAP_DEBUG_SHELL 0x0400
|
||||
#define LDAP_DEBUG_PARSE 0x0800
|
||||
|
||||
#define LDAP_DEBUG_DEPRECIATED 0x1000
|
||||
#define LDAP_DEBUG_DEPRECATED 0x1000
|
||||
#define LDAP_DEBUG_NONE 0x8000
|
||||
#define LDAP_DEBUG_ANY -1
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ extern int ldap_syslog_level;
|
|||
fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \
|
||||
} while ( 0 )
|
||||
#else /* !WINSOCK */
|
||||
extern void Debug( int level, char* fmt, ... );
|
||||
extern void Debug( int level, const char* fmt, ... );
|
||||
#endif /* !WINSOCK */
|
||||
#endif /* LDAP_SYSLOG */
|
||||
#else /* LDAP_DEBUG */
|
||||
|
|
|
|||
|
|
@ -21,14 +21,21 @@ LDAP_BEGIN_DECL
|
|||
|
||||
struct hostent; /* avoid pulling in <netdb.h> */
|
||||
|
||||
LDAP_F char *ldap_pvt_ctime LDAP_P(( const time_t *tp, char *buf ));
|
||||
LDAP_F int ldap_pvt_gethostbyname_a LDAP_P((
|
||||
LDAP_F( char * )
|
||||
ldap_pvt_ctime LDAP_P((
|
||||
const time_t *tp,
|
||||
char *buf ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_gethostbyname_a LDAP_P((
|
||||
const char *name,
|
||||
struct hostent *resbuf,
|
||||
char **buf,
|
||||
struct hostent **result,
|
||||
int *herrno_ptr ));
|
||||
LDAP_F int ldap_pvt_gethostbyaddr_a LDAP_P((
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_gethostbyaddr_a LDAP_P((
|
||||
const char *addr,
|
||||
int len,
|
||||
int type,
|
||||
|
|
@ -36,7 +43,9 @@ LDAP_F int ldap_pvt_gethostbyaddr_a LDAP_P((
|
|||
char **buf,
|
||||
struct hostent **result,
|
||||
int *herrno_ptr ));
|
||||
LDAP_F void ldap_pvt_init_utils LDAP_P(( void ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_pvt_init_utils LDAP_P(( void ));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
|
|
|
|||
|
|
@ -120,14 +120,15 @@ LDAP_END_DECL
|
|||
|
||||
#elif HAVE_NT_THREADS
|
||||
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
typedef HANDLE ldap_pvt_thread_t;
|
||||
typedef HANDLE ldap_pvt_thread_mutex_t;
|
||||
typedef HANDLE ldap_pvt_thread_cond_t;
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <process.h>
|
||||
#include <windows.h>
|
||||
|
||||
typedef unsigned long ldap_pvt_thread_t;
|
||||
typedef HANDLE ldap_pvt_thread_mutex_t;
|
||||
typedef HANDLE ldap_pvt_thread_cond_t;
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
|
|
@ -156,84 +157,85 @@ LDAP_END_DECL
|
|||
|
||||
#ifndef NO_THREADS
|
||||
# define HAVE_THREADS 1
|
||||
|
||||
#endif
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_initialize LDAP_P(( void ));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_destroy LDAP_P(( void ));
|
||||
|
||||
LDAP_F unsigned int
|
||||
LDAP_F( unsigned int )
|
||||
ldap_pvt_thread_sleep LDAP_P(( unsigned int s ));
|
||||
|
||||
#ifdef HAVE_GETCONCURRENCY
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_get_concurrency LDAP_P(( void ));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SETCONCURRENCY
|
||||
# ifndef LDAP_THREAD_CONCURRENCY
|
||||
/* three concurrent threads should be enough */
|
||||
# define LDAP_THREAD_CONCURRENCY 3
|
||||
# endif
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_set_concurrency LDAP_P(( int ));
|
||||
#endif
|
||||
|
||||
#define LDAP_PVT_THREAD_CREATE_JOINABLE 0
|
||||
#define LDAP_PVT_THREAD_CREATE_DETACHED 1
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_create LDAP_P((
|
||||
ldap_pvt_thread_t * thread,
|
||||
int detach,
|
||||
void *(*start_routine)( void * ),
|
||||
void *arg));
|
||||
|
||||
LDAP_F void
|
||||
LDAP_F( void )
|
||||
ldap_pvt_thread_exit LDAP_P(( void *retval ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_join LDAP_P(( ldap_pvt_thread_t thread, void **status ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_kill LDAP_P(( ldap_pvt_thread_t thread, int signo ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_yield LDAP_P(( void ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_cond_init LDAP_P(( ldap_pvt_thread_cond_t *cond ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_cond_destroy LDAP_P(( ldap_pvt_thread_cond_t *cond ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_cond_signal LDAP_P(( ldap_pvt_thread_cond_t *cond ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_cond_broadcast LDAP_P(( ldap_pvt_thread_cond_t *cond ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_cond_wait LDAP_P((
|
||||
ldap_pvt_thread_cond_t *cond,
|
||||
ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_init LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_destroy LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_lock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_trylock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_mutex_unlock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
|
||||
|
||||
typedef struct ldap_pvt_thread_rdwr_var {
|
||||
|
|
@ -248,29 +250,38 @@ typedef struct ldap_pvt_thread_rdwr_var {
|
|||
int ltrw_w_wait;
|
||||
} ldap_pvt_thread_rdwr_t;
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_init LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_destroy LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_rlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_rtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_runlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_wlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_wtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_wunlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_readers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_writers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
LDAP_F int
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_pvt_thread_rdwr_active LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
|
|
|
|||
|
|
@ -47,17 +47,26 @@ extern int ldif_debug;
|
|||
((tlen) + 4 + LDIF_BASE64_LEN(vlen) \
|
||||
+ ((LDIF_BASE64_LEN(vlen) + (tlen) + 3) / LDIF_LINE_WIDTH * 2 ))
|
||||
|
||||
LDAP_F int
|
||||
ldif_parse_line LDAP_P(( char *line, char **type, char **value, int *vlen));
|
||||
LDAP_F( int )
|
||||
ldif_parse_line LDAP_P((
|
||||
LDAP_CONST char *line,
|
||||
char **type, char **value, int *vlen));
|
||||
|
||||
LDAP_F char *
|
||||
LDAP_F( char * )
|
||||
ldif_getline LDAP_P(( char **next ));
|
||||
|
||||
LDAP_F void
|
||||
ldif_put_type_and_value LDAP_P(( char **out, char *t, char *val, int vlen ));
|
||||
LDAP_F( void )
|
||||
ldif_put_type_and_value LDAP_P((
|
||||
char **out,
|
||||
LDAP_CONST char *t,
|
||||
LDAP_CONST char *val,
|
||||
int vlen ));
|
||||
|
||||
LDAP_F char
|
||||
*ldif_type_and_value LDAP_P(( char *type, char *val, int vlen ));
|
||||
LDAP_F( char * )
|
||||
ldif_type_and_value LDAP_P((
|
||||
LDAP_CONST char *type,
|
||||
LDAP_CONST char *val,
|
||||
int vlen ));
|
||||
|
||||
|
||||
LDAP_END_DECL
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
/*
|
||||
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted only
|
||||
* as authorized by the OpenLDAP Public License. A copy of this
|
||||
* license is available at http://www.OpenLDAP.org/license.html or
|
||||
* in file LICENSE in the top-level directory of the distribution.
|
||||
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
#ifndef _LUTIL_H
|
||||
|
|
@ -20,12 +15,31 @@ LDAP_BEGIN_DECL
|
|||
|
||||
/* ISC Base64 Routines */
|
||||
/* base64.c */
|
||||
LDAP_F int lutil_b64_ntop LDAP_P((unsigned char const *, size_t, char *, size_t));
|
||||
LDAP_F int lutil_b64_pton LDAP_P((char const *, unsigned char *, size_t));
|
||||
|
||||
LDAP_F( int )
|
||||
lutil_b64_ntop LDAP_P((
|
||||
unsigned char const *,
|
||||
size_t,
|
||||
char *,
|
||||
size_t));
|
||||
|
||||
LDAP_F( int )
|
||||
lutil_b64_pton LDAP_P((
|
||||
char const *,
|
||||
unsigned char *,
|
||||
size_t));
|
||||
|
||||
/* detach.c */
|
||||
LDAP_F void lutil_detach LDAP_P((int debug, int do_close));
|
||||
LDAP_F( void )
|
||||
lutil_detach LDAP_P((
|
||||
int debug,
|
||||
int do_close));
|
||||
|
||||
/* passwd.c */
|
||||
LDAP_F int lutil_passwd LDAP_P((const char *cred, const char *passwd));
|
||||
LDAP_F( int )
|
||||
lutil_passwd LDAP_P((
|
||||
const char *cred,
|
||||
const char *passwd));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,11 @@
|
|||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
LDAP_F int lutil_lockf LDAP_P(( int fd ));
|
||||
LDAP_F int lutil_unlockf LDAP_P(( int fd ));
|
||||
LDAP_F( int )
|
||||
lutil_lockf LDAP_P(( int fd ));
|
||||
|
||||
LDAP_F( int )
|
||||
lutil_unlockf LDAP_P(( int fd ));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
|
|
|
|||
|
|
@ -35,19 +35,23 @@ struct lutil_MD5Context {
|
|||
unsigned char in[64];
|
||||
};
|
||||
|
||||
LDAP_F void lutil_MD5Init LDAP_P((
|
||||
LDAP_F( void )
|
||||
lutil_MD5Init LDAP_P((
|
||||
struct lutil_MD5Context *context));
|
||||
|
||||
LDAP_F void lutil_MD5Update LDAP_P((
|
||||
LDAP_F( void )
|
||||
lutil_MD5Update LDAP_P((
|
||||
struct lutil_MD5Context *context,
|
||||
unsigned char const *buf,
|
||||
unsigned len));
|
||||
|
||||
LDAP_F void lutil_MD5Final LDAP_P((
|
||||
LDAP_F( void )
|
||||
lutil_MD5Final LDAP_P((
|
||||
unsigned char digest[16],
|
||||
struct lutil_MD5Context *context));
|
||||
|
||||
LDAP_F void lutil_MD5Transform LDAP_P((
|
||||
LDAP_F( void )
|
||||
lutil_MD5Transform LDAP_P((
|
||||
uint32 buf[4],
|
||||
const unsigned char in[64]));
|
||||
|
||||
|
|
|
|||
|
|
@ -36,25 +36,32 @@ typedef struct {
|
|||
unsigned char buffer[64];
|
||||
} lutil_SHA1_CTX;
|
||||
|
||||
LDAP_F void lutil_SHA1Transform
|
||||
LDAP_F( void )
|
||||
lutil_SHA1Transform
|
||||
LDAP_P((uint32 state[5], const unsigned char buffer[64]));
|
||||
|
||||
LDAP_F void lutil_SHA1Init
|
||||
LDAP_F( void )
|
||||
lutil_SHA1Init
|
||||
LDAP_P((lutil_SHA1_CTX *context));
|
||||
|
||||
LDAP_F void lutil_SHA1Update
|
||||
LDAP_F( void )
|
||||
lutil_SHA1Update
|
||||
LDAP_P((lutil_SHA1_CTX *context, const unsigned char *data, uint32 len));
|
||||
|
||||
LDAP_F void lutil_SHA1Final
|
||||
LDAP_F( void )
|
||||
lutil_SHA1Final
|
||||
LDAP_P((unsigned char digest[20], lutil_SHA1_CTX *context));
|
||||
|
||||
LDAP_F char *lutil_SHA1End
|
||||
LDAP_F( char * )
|
||||
lutil_SHA1End
|
||||
LDAP_P((lutil_SHA1_CTX *, char *));
|
||||
|
||||
LDAP_F char *lutil_SHA1File
|
||||
LDAP_F( char * )
|
||||
lutil_SHA1File
|
||||
LDAP_P((char *, char *));
|
||||
|
||||
LDAP_F char *lutil_SHA1Data
|
||||
LDAP_F( char * )
|
||||
lutil_SHA1Data
|
||||
LDAP_P((const unsigned char *, size_t, char *));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
|
|
|||
|
|
@ -18,6 +18,12 @@
|
|||
/* --------------------------------------------------- */
|
||||
/* begin of MSVC5 specific entries */
|
||||
|
||||
#define EXEEXT ".exe"
|
||||
|
||||
#if defined( _DEBUG ) && !defined( LDAP_DEBUG )
|
||||
#define LDAP_DEBUG 1
|
||||
#endif
|
||||
|
||||
/* MSVC5 doesn't define _STDC_ but supports _STDC_ features */
|
||||
#define __NEED_PROTOTYPES 1
|
||||
#define HAVE_STDARG 1
|
||||
|
|
@ -34,17 +40,21 @@
|
|||
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#define vsprintf _vsprintf
|
||||
|
||||
/* #define vsprintf _vsprintf */
|
||||
|
||||
/* define type for caddr_t */
|
||||
typedef char * caddr_t;
|
||||
|
||||
#define LOG_DEBUG 0
|
||||
#define openlog( a, b )
|
||||
#define closelog()
|
||||
|
||||
/* we have NT threads */
|
||||
#ifdef _MT
|
||||
#define HAVE_NT_THREADS 1
|
||||
#else
|
||||
#define NO_THREADS 1
|
||||
#endif
|
||||
|
||||
/* we have spawnlp instead of fork/execlp */
|
||||
#define HAVE_SPAWNLP 1
|
||||
|
|
|
|||
|
|
@ -79,22 +79,22 @@ struct ldap_searchobj {
|
|||
#define LDAP_SEARCHPREF_ERR_FILE 4
|
||||
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_init_searchprefs LDAP_P(( char *file,
|
||||
struct ldap_searchobj **solistp ));
|
||||
|
||||
LDAP_F int
|
||||
LDAP_F( int )
|
||||
ldap_init_searchprefs_buf LDAP_P(( char *buf,
|
||||
long buflen,
|
||||
struct ldap_searchobj **solistp ));
|
||||
|
||||
LDAP_F void
|
||||
LDAP_F( void )
|
||||
ldap_free_searchprefs LDAP_P(( struct ldap_searchobj *solist ));
|
||||
|
||||
LDAP_F struct ldap_searchobj *
|
||||
LDAP_F( struct ldap_searchobj * )
|
||||
ldap_first_searchobj LDAP_P(( struct ldap_searchobj *solist ));
|
||||
|
||||
LDAP_F struct ldap_searchobj *
|
||||
LDAP_F( struct ldap_searchobj * )
|
||||
ldap_next_searchobj LDAP_P(( struct ldap_searchobj *sollist,
|
||||
struct ldap_searchobj *so ));
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ CFG=libavl - Win32 Single Debug
|
|||
!MESSAGE "libavl - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libavl - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libavl - Win32 Single Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libavl - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -36,8 +38,8 @@ CPP=cl.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\libavl"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
|
@ -78,11 +80,32 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "libavl__"
|
||||
# PROP Intermediate_Dir "libavl__"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\libavl"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /ML /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "libavl - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "libavl_0"
|
||||
# PROP BASE Intermediate_Dir "libavl_0"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\libavl"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
|
|
@ -97,6 +120,7 @@ LIB32=link.exe -lib
|
|||
# Name "libavl - Win32 Release"
|
||||
# Name "libavl - Win32 Debug"
|
||||
# Name "libavl - Win32 Single Debug"
|
||||
# Name "libavl - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\avl.c
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=testavl - Win32 Debug
|
||||
CFG=testavl - Win32 Single Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,12 +13,16 @@ CFG=testavl - Win32 Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "testavl.mak" CFG="testavl - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "testavl.mak" CFG="testavl - Win32 Single Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "testavl - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "testavl - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "testavl - Win32 Single Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "testavl - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -36,11 +40,12 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release\testavl"
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\testavl"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -48,7 +53,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "testavl - Win32 Debug"
|
||||
|
||||
|
|
@ -59,10 +64,35 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug\testavl"
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\testavl"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ELSEIF "$(CFG)" == "testavl - Win32 Single Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "testavl_"
|
||||
# PROP BASE Intermediate_Dir "testavl_"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\testavl"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
|
@ -71,7 +101,31 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ELSEIF "$(CFG)" == "testavl - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "testavl0"
|
||||
# PROP BASE Intermediate_Dir "testavl0"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\testavl"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
@ -79,6 +133,8 @@ LINK32=link.exe
|
|||
|
||||
# Name "testavl - Win32 Release"
|
||||
# Name "testavl - Win32 Debug"
|
||||
# Name "testavl - Win32 Single Debug"
|
||||
# Name "testavl - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\testavl.c
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* issue for now.
|
||||
*/
|
||||
|
||||
void lber_pvt_assert(char* file, int line, char* test)
|
||||
void ber_pvt_assert(char* file, int line, char* test)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Assertion failed: %s, file %s, line %d\n",
|
||||
|
|
|
|||
|
|
@ -17,26 +17,28 @@
|
|||
* Print stuff
|
||||
*/
|
||||
static void
|
||||
lber_error_print( char *data )
|
||||
ber_error_print( char *data )
|
||||
{
|
||||
assert( data != NULL );
|
||||
|
||||
fputs( data, stderr );
|
||||
fflush( stderr );
|
||||
}
|
||||
|
||||
BER_LOG_PRINT_FN lber_pvt_log_print = lber_error_print;
|
||||
BER_LOG_PRINT_FN ber_pvt_log_print = ber_error_print;
|
||||
|
||||
/*
|
||||
* lber log
|
||||
*/
|
||||
|
||||
static int lber_log_check( int errlvl, int loglvl )
|
||||
static int ber_log_check( int errlvl, int loglvl )
|
||||
{
|
||||
return errlvl & loglvl ? 1 : 0;
|
||||
}
|
||||
|
||||
int lber_pvt_log_printf
|
||||
int ber_pvt_log_printf
|
||||
#ifdef HAVE_STDARG
|
||||
(int errlvl, int loglvl, char *fmt, ...)
|
||||
(int errlvl, int loglvl, const char *fmt, ...)
|
||||
#else
|
||||
( va_alist )
|
||||
va_dcl
|
||||
|
|
@ -58,7 +60,9 @@ va_dcl
|
|||
fmt = va_arg( ap, char * );
|
||||
#endif
|
||||
|
||||
if ( !lber_log_check( errlvl, loglvl )) {
|
||||
assert( fmt != NULL );
|
||||
|
||||
if ( !ber_log_check( errlvl, loglvl )) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -69,22 +73,24 @@ va_dcl
|
|||
vsprintf( buf, fmt, ap ); /* hope it's not too long */
|
||||
#else
|
||||
/* use doprnt() */
|
||||
chokeme = "choke me! I don't have a doprnt manual handy!";
|
||||
#error "vsprintf() required."
|
||||
#endif
|
||||
|
||||
va_end(ap);
|
||||
|
||||
(*lber_pvt_log_print)( buf );
|
||||
(*ber_pvt_log_print)( buf );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lber_log_puts(int errlvl, int loglvl, char *buf)
|
||||
static int ber_log_puts(int errlvl, int loglvl, char *buf)
|
||||
{
|
||||
if ( !lber_log_check( errlvl, loglvl )) {
|
||||
assert( buf != NULL );
|
||||
|
||||
if ( !ber_log_check( errlvl, loglvl )) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
(*lber_pvt_log_print)( buf );
|
||||
(*ber_pvt_log_print)( buf );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -93,9 +99,14 @@ static int lber_log_puts(int errlvl, int loglvl, char *buf)
|
|||
*/
|
||||
|
||||
int
|
||||
lber_log_bprint(int errlvl, int loglvl, char *data, int len )
|
||||
ber_log_bprint(int errlvl,
|
||||
int loglvl,
|
||||
const char *data,
|
||||
int len )
|
||||
{
|
||||
if ( !lber_log_check( errlvl, loglvl )) {
|
||||
assert( data != NULL );
|
||||
|
||||
if ( !ber_log_check( errlvl, loglvl )) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +115,9 @@ lber_log_bprint(int errlvl, int loglvl, char *data, int len )
|
|||
}
|
||||
|
||||
void
|
||||
ber_bprint(char *data, int len )
|
||||
ber_bprint(
|
||||
LDAP_CONST char *data,
|
||||
int len )
|
||||
{
|
||||
static const char hexdig[] = "0123456789abcdef";
|
||||
#define BPLEN 48
|
||||
|
|
@ -112,11 +125,13 @@ ber_bprint(char *data, int len )
|
|||
char buf[ BPLEN + sizeof("\t%s\n") ];
|
||||
int i = 0;
|
||||
|
||||
assert( data != NULL );
|
||||
|
||||
memset( out, 0, BPLEN );
|
||||
for ( ;; ) {
|
||||
if ( len < 1 ) {
|
||||
sprintf( buf, "\t%s\n", ( i == 0 ) ? "(end)" : out );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
(*ber_pvt_log_print)( buf );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +153,7 @@ ber_bprint(char *data, int len )
|
|||
if ( i > BPLEN - 2 ) {
|
||||
char data[128 + BPLEN];
|
||||
sprintf( data, "\t%s\n", out );
|
||||
(*lber_pvt_log_print)(data);
|
||||
(*ber_pvt_log_print)(data);
|
||||
memset( out, 0, BPLEN );
|
||||
i = 0;
|
||||
continue;
|
||||
|
|
@ -148,9 +163,15 @@ ber_bprint(char *data, int len )
|
|||
}
|
||||
|
||||
int
|
||||
lber_log_dump( int errlvl, int loglvl, BerElement *ber, int inout )
|
||||
ber_log_dump(
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
const BerElement *ber,
|
||||
int inout )
|
||||
{
|
||||
if ( !lber_log_check( errlvl, loglvl )) {
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( !ber_log_check( errlvl, loglvl )) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -159,16 +180,20 @@ lber_log_dump( int errlvl, int loglvl, BerElement *ber, int inout )
|
|||
}
|
||||
|
||||
void
|
||||
ber_dump( BerElement *ber, int inout )
|
||||
ber_dump(
|
||||
LDAP_CONST BerElement *ber,
|
||||
int inout )
|
||||
{
|
||||
char buf[132];
|
||||
|
||||
assert( ber != NULL );
|
||||
|
||||
sprintf( buf, "ber_dump: buf 0x%lx, ptr 0x%lx, end 0x%lx\n",
|
||||
(long) ber->ber_buf,
|
||||
(long) ber->ber_ptr,
|
||||
(long) ber->ber_end );
|
||||
|
||||
(*lber_pvt_log_print)( buf );
|
||||
(*ber_pvt_log_print)( buf );
|
||||
|
||||
if ( inout == 1 ) {
|
||||
sprintf( buf, " current len %ld, contents:\n",
|
||||
|
|
@ -184,9 +209,14 @@ ber_dump( BerElement *ber, int inout )
|
|||
}
|
||||
|
||||
int
|
||||
lber_log_sos_dump( int errlvl, int loglvl, Seqorset *sos )
|
||||
lber_log_sos_dump(
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
const Seqorset *sos )
|
||||
{
|
||||
if ( !lber_log_check( errlvl, loglvl )) {
|
||||
assert( sos != NULL );
|
||||
|
||||
if ( !ber_log_check( errlvl, loglvl )) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -195,26 +225,28 @@ lber_log_sos_dump( int errlvl, int loglvl, Seqorset *sos )
|
|||
}
|
||||
|
||||
void
|
||||
ber_sos_dump( Seqorset *sos )
|
||||
ber_sos_dump(
|
||||
LDAP_CONST Seqorset *sos )
|
||||
{
|
||||
char buf[132];
|
||||
|
||||
(*lber_pvt_log_print)( "*** sos dump ***\n" );
|
||||
assert( sos != NULL );
|
||||
|
||||
(*ber_pvt_log_print)( "*** sos dump ***\n" );
|
||||
|
||||
while ( sos != NULLSEQORSET ) {
|
||||
sprintf( buf, "ber_sos_dump: clen %ld first 0x%lx ptr 0x%lx\n",
|
||||
(long) sos->sos_clen, (long) sos->sos_first, (long) sos->sos_ptr );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
(*ber_pvt_log_print)( buf );
|
||||
|
||||
sprintf( buf, " current len %ld contents:\n",
|
||||
(long) (sos->sos_ptr - sos->sos_first) );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
(*ber_pvt_log_print)( buf );
|
||||
|
||||
ber_bprint( sos->sos_first, sos->sos_ptr - sos->sos_first );
|
||||
|
||||
sos = sos->sos_next;
|
||||
}
|
||||
|
||||
(*lber_pvt_log_print)( "*** end dump ***\n" );
|
||||
}
|
||||
|
||||
(*ber_pvt_log_print)( "*** end dump ***\n" );
|
||||
}
|
||||
|
|
@ -38,6 +38,8 @@ ber_get_tag( BerElement *ber )
|
|||
char *tagp;
|
||||
unsigned int i;
|
||||
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 )
|
||||
return( LBER_DEFAULT );
|
||||
|
||||
|
|
@ -72,6 +74,9 @@ ber_skip_tag( BerElement *ber, unsigned long *len )
|
|||
int noctets, diff;
|
||||
unsigned long netlen;
|
||||
|
||||
assert( ber != NULL );
|
||||
assert( len != NULL );
|
||||
|
||||
/*
|
||||
* Any ber element looks like this: tag length contents.
|
||||
* Assuming everything's ok, we return the tag byte (we
|
||||
|
|
@ -116,15 +121,20 @@ ber_skip_tag( BerElement *ber, unsigned long *len )
|
|||
}
|
||||
|
||||
unsigned long
|
||||
ber_peek_tag( BerElement *ber, unsigned long *len )
|
||||
ber_peek_tag(
|
||||
LDAP_CONST BerElement *ber_in, /* not const per c-api-02 */
|
||||
unsigned long *len )
|
||||
{
|
||||
char *save;
|
||||
unsigned long tag;
|
||||
BerElement *ber = ber_dup( ber_in );
|
||||
|
||||
if( ber == NULL ) {
|
||||
return LBER_ERROR;
|
||||
}
|
||||
|
||||
save = ber->ber_ptr;
|
||||
tag = ber_skip_tag( ber, len );
|
||||
ber->ber_ptr = save;
|
||||
|
||||
ber_free( ber, 1 );
|
||||
return( tag );
|
||||
}
|
||||
|
||||
|
|
@ -135,6 +145,9 @@ ber_getnint( BerElement *ber, long *num, int len )
|
|||
long netnum;
|
||||
char *p;
|
||||
|
||||
assert( ber != NULL );
|
||||
assert( num != NULL );
|
||||
|
||||
/*
|
||||
* The tag and length have already been stripped off. We should
|
||||
* be sitting right before len bytes of 2's complement integer,
|
||||
|
|
@ -396,7 +409,9 @@ ber_next_element( BerElement *ber, unsigned long *len, char *last )
|
|||
unsigned long
|
||||
ber_scanf
|
||||
#if HAVE_STDARG
|
||||
( BerElement *ber, char *fmt, ... )
|
||||
( BerElement *ber,
|
||||
LDAP_CONST char *fmt,
|
||||
... )
|
||||
#else
|
||||
( va_alist )
|
||||
va_dcl
|
||||
|
|
@ -407,7 +422,7 @@ va_dcl
|
|||
BerElement *ber;
|
||||
char *fmt;
|
||||
#endif
|
||||
char *fmt_reset;
|
||||
LDAP_CONST char *fmt_reset;
|
||||
char *last;
|
||||
char *s, **ss, ***sss;
|
||||
struct berval ***bv, **bvp, *bval;
|
||||
|
|
@ -415,6 +430,8 @@ va_dcl
|
|||
long *l;
|
||||
unsigned long rc, tag, len;
|
||||
|
||||
assert( ber != NULL );
|
||||
|
||||
#ifdef HAVE_STDARG
|
||||
va_start( ap, fmt );
|
||||
#else
|
||||
|
|
@ -422,18 +439,32 @@ va_dcl
|
|||
ber = va_arg( ap, BerElement * );
|
||||
fmt = va_arg( ap, char * );
|
||||
#endif
|
||||
|
||||
assert( ber != NULL );
|
||||
assert( fmt != NULL );
|
||||
|
||||
fmt_reset = fmt;
|
||||
|
||||
if ( ber->ber_debug ) {
|
||||
lber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
|
||||
ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
|
||||
"ber_scanf fmt (%s) ber:\n", fmt );
|
||||
lber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
|
||||
ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
|
||||
}
|
||||
|
||||
for ( rc = 0; *fmt && rc != LBER_DEFAULT; fmt++ ) {
|
||||
/* When this is modified, remember to update
|
||||
* the error-cleanup code below accordingly. */
|
||||
switch ( *fmt ) {
|
||||
case '!': { /* Hook */
|
||||
BERDecodeCallback *f;
|
||||
void *p;
|
||||
|
||||
f = va_arg( ap, BERDecodeCallback * );
|
||||
p = va_arg( ap, void * );
|
||||
|
||||
rc = (*f)( ber, p, 0 );
|
||||
} break;
|
||||
|
||||
case 'a': /* octet string - allocate storage as needed */
|
||||
ss = va_arg( ap, char ** );
|
||||
rc = ber_get_stringa( ber, ss );
|
||||
|
|
@ -576,7 +607,7 @@ va_dcl
|
|||
|
||||
default:
|
||||
if( ber->ber_debug ) {
|
||||
lber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug,
|
||||
ber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug,
|
||||
"ber_scanf: unknown fmt %c\n", *fmt );
|
||||
}
|
||||
rc = LBER_DEFAULT;
|
||||
|
|
@ -601,6 +632,16 @@ va_dcl
|
|||
|
||||
for ( ; fmt_reset < fmt; fmt_reset++ ) {
|
||||
switch ( *fmt_reset ) {
|
||||
case '!': { /* Hook */
|
||||
BERDecodeCallback *f;
|
||||
void *p;
|
||||
|
||||
f = va_arg( ap, BERDecodeCallback * );
|
||||
p = va_arg( ap, void * );
|
||||
|
||||
(void) (*f)( ber, p, 1 );
|
||||
} break;
|
||||
|
||||
case 'a': /* octet string - allocate storage as needed */
|
||||
ss = va_arg( ap, char ** );
|
||||
if ( *ss ) {
|
||||
|
|
@ -689,9 +730,8 @@ va_dcl
|
|||
void
|
||||
ber_bvfree( struct berval *bv )
|
||||
{
|
||||
#ifdef LBER_ASSERT
|
||||
assert(bv != NULL); /* bv damn better point to something */
|
||||
#endif
|
||||
|
||||
if ( bv->bv_val != NULL )
|
||||
free( bv->bv_val );
|
||||
free( (char *) bv );
|
||||
|
|
@ -702,19 +742,25 @@ ber_bvecfree( struct berval **bv )
|
|||
{
|
||||
int i;
|
||||
|
||||
#ifdef LBER_ASSERT
|
||||
assert(bv != NULL); /* bv damn better point to something */
|
||||
#endif
|
||||
|
||||
for ( i = 0; bv[i] != NULL; i++ )
|
||||
ber_bvfree( bv[i] );
|
||||
free( (char *) bv );
|
||||
}
|
||||
|
||||
struct berval *
|
||||
ber_bvdup( struct berval *bv )
|
||||
ber_bvdup(
|
||||
LDAP_CONST struct berval *bv )
|
||||
{
|
||||
struct berval *new;
|
||||
|
||||
assert( bv != NULL );
|
||||
|
||||
if( bv == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( (new = (struct berval *) malloc( sizeof(struct berval) ))
|
||||
== NULL ) {
|
||||
return( NULL );
|
||||
|
|
@ -744,6 +790,8 @@ void
|
|||
ber_set_string_translators( BerElement *ber, BERTranslateProc encode_proc,
|
||||
BERTranslateProc decode_proc )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
ber->ber_encode_translate_proc = encode_proc;
|
||||
ber->ber_decode_translate_proc = decode_proc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,25 +49,25 @@ main( int argc, char **argv )
|
|||
cshow( stdout );
|
||||
#endif /* MACOS */
|
||||
|
||||
sb = lber_pvt_sb_alloc_fd( fileno(stdin) );
|
||||
sb = ber_sockbuf_alloc_fd( fileno(stdin) );
|
||||
|
||||
if( (ber = ber_alloc_t(LBER_USE_DER)) == NULL ) {
|
||||
perror( "ber_alloc_t" );
|
||||
exit( 1 );
|
||||
return( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
if ( (tag = ber_get_next( sb, &len, ber )) == -1 ) {
|
||||
perror( "ber_get_next" );
|
||||
exit( 1 );
|
||||
return( EXIT_FAILURE );
|
||||
}
|
||||
printf( "message has tag 0x%x and length %ld\n", tag, len );
|
||||
|
||||
if ( ber_scanf( ber, "i", &i ) == LBER_ERROR ) {
|
||||
fprintf( stderr, "ber_scanf returns -1\n" );
|
||||
exit( 1 );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
printf( "got int %ld\n", i );
|
||||
|
||||
lber_pvt_sb_free( sb );
|
||||
return( 0 );
|
||||
ber_sockbuf_free( sb );
|
||||
return( EXIT_SUCCESS );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=dtest - Win32 Debug
|
||||
CFG=dtest - Win32 Single Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,12 +13,16 @@ CFG=dtest - Win32 Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "dtest.mak" CFG="dtest - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "dtest.mak" CFG="dtest - Win32 Single Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "dtest - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "dtest - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "dtest - Win32 Single Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "dtest - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -36,12 +40,12 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release\dtest"
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\dtest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -49,7 +53,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "dtest - Win32 Debug"
|
||||
|
||||
|
|
@ -60,12 +64,12 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug\dtest"
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\dtest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -73,7 +77,57 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "dtest - Win32 Single Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "dtest___"
|
||||
# PROP BASE Intermediate_Dir "dtest___"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\dtest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "dtest - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "dtest__0"
|
||||
# PROP BASE Intermediate_Dir "dtest__0"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\dtest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
@ -81,6 +135,8 @@ LINK32=link.exe
|
|||
|
||||
# Name "dtest - Win32 Release"
|
||||
# Name "dtest - Win32 Debug"
|
||||
# Name "dtest - Win32 Single Debug"
|
||||
# Name "dtest - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dtest.c
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ ber_put_len( BerElement *ber, unsigned long len, int nosos )
|
|||
long mask;
|
||||
unsigned long netlen;
|
||||
|
||||
assert( ber != NULL );
|
||||
|
||||
/*
|
||||
* short len if it's less than 128 - one byte giving the len,
|
||||
* with bit 8 0.
|
||||
|
|
@ -151,6 +153,8 @@ ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag )
|
|||
int len, lenlen;
|
||||
long netnum, mask;
|
||||
|
||||
assert( ber != NULL );
|
||||
|
||||
sign = (num < 0);
|
||||
|
||||
/*
|
||||
|
|
@ -199,6 +203,8 @@ ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag )
|
|||
int
|
||||
ber_put_enum( BerElement *ber, long num, unsigned long tag )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( tag == LBER_DEFAULT )
|
||||
tag = LBER_ENUMERATED;
|
||||
|
||||
|
|
@ -208,6 +214,8 @@ ber_put_enum( BerElement *ber, long num, unsigned long tag )
|
|||
int
|
||||
ber_put_int( BerElement *ber, long num, unsigned long tag )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( tag == LBER_DEFAULT )
|
||||
tag = LBER_INTEGER;
|
||||
|
||||
|
|
@ -215,7 +223,10 @@ ber_put_int( BerElement *ber, long num, unsigned long tag )
|
|||
}
|
||||
|
||||
int
|
||||
ber_put_ostring( BerElement *ber, char *str, unsigned long len,
|
||||
ber_put_ostring(
|
||||
BerElement *ber,
|
||||
LDAP_CONST char *str,
|
||||
unsigned long len,
|
||||
unsigned long tag )
|
||||
{
|
||||
int taglen, lenlen, rc;
|
||||
|
|
@ -223,6 +234,9 @@ ber_put_ostring( BerElement *ber, char *str, unsigned long len,
|
|||
int free_str;
|
||||
#endif /* STR_TRANSLATION */
|
||||
|
||||
assert( ber != NULL );
|
||||
assert( str != NULL );
|
||||
|
||||
if ( tag == LBER_DEFAULT )
|
||||
tag = LBER_OCTETSTRING;
|
||||
|
||||
|
|
@ -258,20 +272,47 @@ ber_put_ostring( BerElement *ber, char *str, unsigned long len,
|
|||
|
||||
return( rc );
|
||||
}
|
||||
int
|
||||
ber_put_berval(
|
||||
BerElement *ber,
|
||||
LDAP_CONST struct berval *bv,
|
||||
unsigned long tag )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
assert( bv != NULL );
|
||||
|
||||
if( bv == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ber_put_ostring( ber, bv->bv_val, bv->bv_len, tag );
|
||||
}
|
||||
|
||||
int
|
||||
ber_put_string( BerElement *ber, char *str, unsigned long tag )
|
||||
ber_put_string(
|
||||
BerElement *ber,
|
||||
LDAP_CONST char *str,
|
||||
unsigned long tag )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
assert( str != NULL );
|
||||
|
||||
return( ber_put_ostring( ber, str, strlen( str ), tag ));
|
||||
}
|
||||
|
||||
int
|
||||
ber_put_bitstring( BerElement *ber, char *str,
|
||||
unsigned long blen /* in bits */, unsigned long tag )
|
||||
ber_put_bitstring(
|
||||
BerElement *ber,
|
||||
LDAP_CONST char *str,
|
||||
unsigned long blen /* in bits */,
|
||||
unsigned long tag )
|
||||
{
|
||||
int taglen, lenlen, len;
|
||||
unsigned char unusedbits;
|
||||
|
||||
assert( ber != NULL );
|
||||
assert( str != NULL );
|
||||
|
||||
if ( tag == LBER_DEFAULT )
|
||||
tag = LBER_BITSTRING;
|
||||
|
||||
|
|
@ -317,6 +358,8 @@ ber_put_boolean( BerElement *ber, int boolval, unsigned long tag )
|
|||
unsigned char trueval = 0xff;
|
||||
unsigned char falseval = 0x00;
|
||||
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( tag == LBER_DEFAULT )
|
||||
tag = LBER_BOOLEAN;
|
||||
|
||||
|
|
@ -340,6 +383,8 @@ ber_start_seqorset( BerElement *ber, unsigned long tag )
|
|||
{
|
||||
Seqorset *new;
|
||||
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( (new = (Seqorset *) calloc( sizeof(Seqorset), 1 ))
|
||||
== NULLSEQORSET )
|
||||
return( -1 );
|
||||
|
|
@ -362,6 +407,8 @@ ber_start_seqorset( BerElement *ber, unsigned long tag )
|
|||
int
|
||||
ber_start_seq( BerElement *ber, unsigned long tag )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( tag == LBER_DEFAULT )
|
||||
tag = LBER_SEQUENCE;
|
||||
|
||||
|
|
@ -371,6 +418,8 @@ ber_start_seq( BerElement *ber, unsigned long tag )
|
|||
int
|
||||
ber_start_set( BerElement *ber, unsigned long tag )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( tag == LBER_DEFAULT )
|
||||
tag = LBER_SET;
|
||||
|
||||
|
|
@ -386,6 +435,8 @@ ber_put_seqorset( BerElement *ber )
|
|||
Seqorset *next;
|
||||
Seqorset **sos = &ber->ber_sos;
|
||||
|
||||
assert( ber != NULL );
|
||||
|
||||
/*
|
||||
* If this is the toplevel sequence or set, we need to actually
|
||||
* write the stuff out. Otherwise, it's already been put in
|
||||
|
|
@ -496,12 +547,14 @@ ber_put_seqorset( BerElement *ber )
|
|||
int
|
||||
ber_put_seq( BerElement *ber )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
return( ber_put_seqorset( ber ) );
|
||||
}
|
||||
|
||||
int
|
||||
ber_put_set( BerElement *ber )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
return( ber_put_seqorset( ber ) );
|
||||
}
|
||||
|
||||
|
|
@ -509,7 +562,9 @@ ber_put_set( BerElement *ber )
|
|||
int
|
||||
ber_printf
|
||||
#ifdef HAVE_STDARG
|
||||
( BerElement *ber, char *fmt, ... )
|
||||
( BerElement *ber,
|
||||
LDAP_CONST char *fmt,
|
||||
... )
|
||||
#else
|
||||
( va_alist )
|
||||
va_dcl
|
||||
|
|
@ -521,7 +576,7 @@ va_dcl
|
|||
char *fmt;
|
||||
#endif
|
||||
char *s, **ss;
|
||||
struct berval **bv;
|
||||
struct berval *bv, **bvp;
|
||||
int rc, i;
|
||||
unsigned long len;
|
||||
|
||||
|
|
@ -533,8 +588,21 @@ va_dcl
|
|||
fmt = va_arg( ap, char * );
|
||||
#endif
|
||||
|
||||
assert( ber != NULL );
|
||||
assert( fmt != NULL );
|
||||
|
||||
for ( rc = 0; *fmt && rc != -1; fmt++ ) {
|
||||
switch ( *fmt ) {
|
||||
case '!': { /* hook */
|
||||
BEREncodeCallback *f;
|
||||
void *p;
|
||||
|
||||
f = va_arg( ap, BEREncodeCallback * );
|
||||
p = va_arg( ap, void * );
|
||||
|
||||
rc = (*f)( ber, p );
|
||||
} break;
|
||||
|
||||
case 'b': /* boolean */
|
||||
i = va_arg( ap, int );
|
||||
rc = ber_put_boolean( ber, i, ber->ber_tag );
|
||||
|
|
@ -560,6 +628,12 @@ va_dcl
|
|||
rc = ber_put_ostring( ber, s, len, ber->ber_tag );
|
||||
break;
|
||||
|
||||
case 'O': /* berval octet string */
|
||||
bv = va_arg( ap, struct berval * );
|
||||
if( bv == NULL ) break;
|
||||
rc = ber_put_berval( ber, bv, ber->ber_tag );
|
||||
break;
|
||||
|
||||
case 's': /* string */
|
||||
s = va_arg( ap, char * );
|
||||
rc = ber_put_string( ber, s, ber->ber_tag );
|
||||
|
|
@ -587,11 +661,11 @@ va_dcl
|
|||
break;
|
||||
|
||||
case 'V': /* sequences of strings + lengths */
|
||||
if ( (bv = va_arg( ap, struct berval ** )) == NULL )
|
||||
if ( (bvp = va_arg( ap, struct berval ** )) == NULL )
|
||||
break;
|
||||
for ( i = 0; bv[i] != NULL; i++ ) {
|
||||
if ( (rc = ber_put_ostring( ber, bv[i]->bv_val,
|
||||
bv[i]->bv_len, ber->ber_tag )) == -1 )
|
||||
for ( i = 0; bvp[i] != NULL; i++ ) {
|
||||
if ( (rc = ber_put_ostring( ber, bvp[i]->bv_val,
|
||||
bvp[i]->bv_len, ber->ber_tag )) == -1 )
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
@ -614,7 +688,7 @@ va_dcl
|
|||
|
||||
default:
|
||||
if( ber->ber_debug ) {
|
||||
lber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug,
|
||||
ber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug,
|
||||
"ber_printf: unknown fmt %c\n", *fmt );
|
||||
}
|
||||
rc = -1;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ main( int argc, char **argv )
|
|||
char *s, *p;
|
||||
#endif
|
||||
int fd, num;
|
||||
Seqorset *sos = NULLSEQORSET;
|
||||
Seqorset *sos = NULL;
|
||||
BerElement *ber;
|
||||
Sockbuf *sb;
|
||||
|
||||
|
|
@ -58,24 +58,26 @@ main( int argc, char **argv )
|
|||
fd = fileno(stdout);
|
||||
#endif /* MACOS */
|
||||
|
||||
sb = lber_pvt_sb_alloc_fd( fd );
|
||||
sb = ber_sockbuf_alloc_fd( fd);
|
||||
|
||||
if ( (ber = ber_alloc()) == NULLBER ) {
|
||||
if( sb == NULL ) {
|
||||
perror( "lber_sockbuf_alloc_fd" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
if ( (ber = ber_alloc_t( LBER_USE_DER )) == NULL ) {
|
||||
perror( "ber_alloc" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
#ifndef notdef
|
||||
num = 7;
|
||||
if ( ber_printf( ber, "{ti}", 0x1f44, num ) == -1 ) {
|
||||
fprintf( stderr, "ber_printf returns -1" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
if ( ber_flush( sb, ber, 1 ) == -1 ) {
|
||||
perror( "ber_flush" );
|
||||
exit( 1 );
|
||||
}
|
||||
#ifdef notdef
|
||||
#else
|
||||
for ( s = argv[1]; *s; s++ ) {
|
||||
if ( fgets( buf, sizeof(buf), stdin ) == NULL )
|
||||
break;
|
||||
|
|
@ -168,9 +170,13 @@ main( int argc, char **argv )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
lber_pvt_sb_free( sb );
|
||||
if ( ber_flush( sb, ber, 1 ) == -1 ) {
|
||||
perror( "ber_flush" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
ber_sockbuf_free( sb );
|
||||
return( 0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=etest - Win32 Debug
|
||||
CFG=etest - Win32 Single Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,12 +13,16 @@ CFG=etest - Win32 Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "etest.mak" CFG="etest - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "etest.mak" CFG="etest - Win32 Single Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "etest - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "etest - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "etest - Win32 Single Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "etest - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -36,12 +40,12 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release\etest"
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\etest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -49,7 +53,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "etest - Win32 Debug"
|
||||
|
||||
|
|
@ -60,12 +64,12 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug\etest"
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\etest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -73,7 +77,57 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "etest - Win32 Single Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "etest___"
|
||||
# PROP BASE Intermediate_Dir "etest___"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\etest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "etest - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "etest__0"
|
||||
# PROP BASE Intermediate_Dir "etest__0"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\etest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
@ -81,6 +135,8 @@ LINK32=link.exe
|
|||
|
||||
# Name "etest - Win32 Release"
|
||||
# Name "etest - Win32 Debug"
|
||||
# Name "etest - Win32 Single Debug"
|
||||
# Name "etest - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\etest.c
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_PSAP_H
|
||||
#include <psap.h>
|
||||
|
|
@ -67,6 +68,6 @@ main( int argc, char **argv )
|
|||
exit( 0 );
|
||||
#else
|
||||
fprintf(stderr, "requires ISODE X.500 distribution.\n");
|
||||
exit( 1 );
|
||||
return( EXIT_FAILURE );
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=idtest - Win32 Debug
|
||||
CFG=idtest - Win32 Single Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,12 +13,16 @@ CFG=idtest - Win32 Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "idtest.mak" CFG="idtest - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "idtest.mak" CFG="idtest - Win32 Single Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "idtest - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "idtest - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "idtest - Win32 Single Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "idtest - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -36,12 +40,12 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release\idtest"
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\idtest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -49,7 +53,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "idtest - Win32 Debug"
|
||||
|
||||
|
|
@ -60,12 +64,12 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug\idtest"
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\idtest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -73,7 +77,57 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "idtest - Win32 Single Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "idtest__"
|
||||
# PROP BASE Intermediate_Dir "idtest__"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\idtest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "idtest - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "idtest_0"
|
||||
# PROP BASE Intermediate_Dir "idtest_0"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\idtest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
@ -81,6 +135,8 @@ LINK32=link.exe
|
|||
|
||||
# Name "idtest - Win32 Release"
|
||||
# Name "idtest - Win32 Debug"
|
||||
# Name "idtest - Win32 Single Debug"
|
||||
# Name "idtest - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\idtest.c
|
||||
|
|
|
|||
|
|
@ -51,8 +51,11 @@ BerRead( Sockbuf *sb, char *buf, long len )
|
|||
int c;
|
||||
long nread = 0;
|
||||
|
||||
assert( sb != NULL );
|
||||
assert( buf != NULL );
|
||||
|
||||
while ( len > 0 ) {
|
||||
if ( (c = lber_pvt_sb_read( sb, buf, len )) <= 0 ) {
|
||||
if ( (c = ber_pvt_sb_read( sb, buf, len )) <= 0 ) {
|
||||
if ( nread > 0 )
|
||||
break;
|
||||
return( c );
|
||||
|
|
@ -70,6 +73,9 @@ ber_read( BerElement *ber, char *buf, unsigned long len )
|
|||
{
|
||||
unsigned long actuallen, nleft;
|
||||
|
||||
assert( ber != NULL );
|
||||
assert( buf != NULL );
|
||||
|
||||
nleft = ber->ber_end - ber->ber_ptr;
|
||||
actuallen = nleft < len ? nleft : len;
|
||||
|
||||
|
|
@ -81,8 +87,15 @@ ber_read( BerElement *ber, char *buf, unsigned long len )
|
|||
}
|
||||
|
||||
long
|
||||
ber_write( BerElement *ber, char *buf, unsigned long len, int nosos )
|
||||
ber_write(
|
||||
BerElement *ber,
|
||||
LDAP_CONST char *buf,
|
||||
unsigned long len,
|
||||
int nosos )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
assert( buf != NULL );
|
||||
|
||||
if ( nosos || ber->ber_sos == NULL ) {
|
||||
if ( ber->ber_ptr + len > ber->ber_end ) {
|
||||
if ( ber_realloc( ber, len ) != 0 )
|
||||
|
|
@ -111,6 +124,9 @@ ber_realloc( BerElement *ber, unsigned long len )
|
|||
long off;
|
||||
char *oldbuf;
|
||||
|
||||
assert( ber != NULL );
|
||||
assert( len > 0 );
|
||||
|
||||
have = (ber->ber_end - ber->ber_buf) / EXBUFSIZ;
|
||||
need = (len < EXBUFSIZ ? 1 : (len + (EXBUFSIZ - 1)) / EXBUFSIZ);
|
||||
total = have * EXBUFSIZ + need * EXBUFSIZ;
|
||||
|
|
@ -150,6 +166,8 @@ ber_realloc( BerElement *ber, unsigned long len )
|
|||
void
|
||||
ber_free( BerElement *ber, int freebuf )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( freebuf && ber->ber_buf != NULL )
|
||||
free( ber->ber_buf );
|
||||
ber->ber_buf = NULL;
|
||||
|
|
@ -161,17 +179,20 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
|
|||
{
|
||||
long nwritten, towrite, rc;
|
||||
|
||||
assert( sb != NULL );
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( ber->ber_rwptr == NULL ) {
|
||||
ber->ber_rwptr = ber->ber_buf;
|
||||
}
|
||||
towrite = ber->ber_ptr - ber->ber_rwptr;
|
||||
|
||||
if ( sb->sb_debug ) {
|
||||
lber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
|
||||
ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
|
||||
"ber_flush: %ld bytes to sd %ld%s\n", towrite,
|
||||
(long) sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)"
|
||||
: "" );
|
||||
lber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
|
||||
ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
|
||||
ber->ber_rwptr, towrite );
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +207,7 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
|
|||
|
||||
nwritten = 0;
|
||||
do {
|
||||
rc = lber_pvt_sb_write( sb, ber->ber_rwptr, towrite );
|
||||
rc = ber_pvt_sb_write( sb, ber->ber_rwptr, towrite );
|
||||
if (rc<=0) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -206,11 +227,14 @@ ber_alloc_t( int options )
|
|||
{
|
||||
BerElement *ber;
|
||||
|
||||
if ( (ber = (BerElement *) calloc( 1, sizeof(BerElement) )) == NULLBER )
|
||||
ber = (BerElement *) calloc( 1, sizeof(BerElement) );
|
||||
|
||||
if ( ber == NULLBER )
|
||||
return( NULLBER );
|
||||
|
||||
ber->ber_tag = LBER_DEFAULT;
|
||||
ber->ber_options = options;
|
||||
ber->ber_debug = lber_int_debug;
|
||||
ber->ber_debug = ber_int_debug;
|
||||
|
||||
return( ber );
|
||||
}
|
||||
|
|
@ -228,12 +252,14 @@ der_alloc( void )
|
|||
}
|
||||
|
||||
BerElement *
|
||||
ber_dup( BerElement *ber )
|
||||
ber_dup( LDAP_CONST BerElement *ber )
|
||||
{
|
||||
BerElement *new;
|
||||
|
||||
if ( (new = ber_alloc()) == NULLBER )
|
||||
return( NULLBER );
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( (new = ber_alloc()) == NULL )
|
||||
return( NULL );
|
||||
|
||||
*new = *ber;
|
||||
|
||||
|
|
@ -245,6 +271,8 @@ ber_dup( BerElement *ber )
|
|||
void
|
||||
ber_init_w_nullc( BerElement *ber, int options )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
(void) memset( (char *)ber, '\0', sizeof( BerElement ));
|
||||
ber->ber_tag = LBER_DEFAULT;
|
||||
ber->ber_options = (char) options;
|
||||
|
|
@ -259,6 +287,8 @@ ber_init( struct berval *bv )
|
|||
{
|
||||
BerElement *ber;
|
||||
|
||||
assert( bv != NULL );
|
||||
|
||||
if ( bv == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -288,11 +318,13 @@ ber_init( struct berval *bv )
|
|||
** the returned berval.
|
||||
*/
|
||||
int ber_flatten(
|
||||
BerElement *ber,
|
||||
LDAP_CONST BerElement *ber,
|
||||
struct berval **bvPtr)
|
||||
{
|
||||
struct berval *bv;
|
||||
|
||||
assert( bvPtr != NULL );
|
||||
|
||||
if(bvPtr == NULL) {
|
||||
return( -1 );
|
||||
}
|
||||
|
|
@ -327,6 +359,8 @@ int ber_flatten(
|
|||
void
|
||||
ber_reset( BerElement *ber, int was_writing )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( was_writing ) {
|
||||
ber->ber_end = ber->ber_ptr;
|
||||
ber->ber_ptr = ber->ber_buf;
|
||||
|
|
@ -347,7 +381,9 @@ get_tag( Sockbuf *sb )
|
|||
char *tagp;
|
||||
unsigned int i;
|
||||
|
||||
if ( lber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 )
|
||||
assert( sb != NULL );
|
||||
|
||||
if ( ber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 )
|
||||
return( LBER_DEFAULT );
|
||||
|
||||
if ( (xbyte & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK )
|
||||
|
|
@ -356,7 +392,7 @@ get_tag( Sockbuf *sb )
|
|||
tagp = (char *) &tag;
|
||||
tagp[0] = xbyte;
|
||||
for ( i = 1; i < sizeof(long); i++ ) {
|
||||
if ( lber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 )
|
||||
if ( ber_pvt_sb_read( sb, (char *) &xbyte, 1 ) != 1 )
|
||||
return( LBER_DEFAULT );
|
||||
|
||||
tagp[i] = xbyte;
|
||||
|
|
@ -375,7 +411,7 @@ get_tag( Sockbuf *sb )
|
|||
#endif
|
||||
|
||||
/*
|
||||
* A rewrite of get_get_next that can safely be called multiple times
|
||||
* A rewrite of ber_get_next that can safely be called multiple times
|
||||
* for the same packet. It will simply continue were it stopped until
|
||||
* a full packet is read.
|
||||
*/
|
||||
|
|
@ -383,8 +419,12 @@ get_tag( Sockbuf *sb )
|
|||
unsigned long
|
||||
ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
|
||||
{
|
||||
assert( sb != NULL );
|
||||
assert( len != NULL );
|
||||
assert( ber != NULL );
|
||||
|
||||
if ( ber->ber_debug ) {
|
||||
lber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
|
||||
ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
|
||||
"ber_get_next\n" );
|
||||
}
|
||||
|
||||
|
|
@ -411,7 +451,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
|
|||
|
||||
if (PTR_IN_VAR(ber->ber_rwptr, ber->ber_tag)) {
|
||||
if (ber->ber_rwptr == (char *) &ber->ber_tag) {
|
||||
if (lber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0)
|
||||
if (ber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0)
|
||||
return LBER_DEFAULT;
|
||||
if ((ber->ber_rwptr[0] & LBER_BIG_TAG_MASK)
|
||||
!= LBER_BIG_TAG_MASK) {
|
||||
|
|
@ -423,7 +463,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
|
|||
}
|
||||
do {
|
||||
/* reading the tag... */
|
||||
if (lber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0)
|
||||
if (ber_pvt_sb_read( sb, ber->ber_rwptr, 1)<=0)
|
||||
return LBER_DEFAULT;
|
||||
if (! (ber->ber_rwptr[0] & LBER_MORE_TAG_MASK) ) {
|
||||
ber->ber_tag>>=sizeof(ber->ber_tag) -
|
||||
|
|
@ -438,7 +478,7 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
|
|||
get_lenbyte:
|
||||
if (ber->ber_rwptr==(char *) &ber->ber_usertag) {
|
||||
unsigned char c;
|
||||
if (lber_pvt_sb_read( sb, (char *) &c, 1)<=0)
|
||||
if (ber_pvt_sb_read( sb, (char *) &c, 1)<=0)
|
||||
return LBER_DEFAULT;
|
||||
if (c & 0x80) {
|
||||
int len = c & 0x7f;
|
||||
|
|
@ -460,7 +500,7 @@ get_lenbyte:
|
|||
to_go = (char *) &ber->ber_len + sizeof( ber->ber_len ) -
|
||||
ber->ber_rwptr;
|
||||
assert( to_go > 0 );
|
||||
res = lber_pvt_sb_read( sb, ber->ber_rwptr, to_go );
|
||||
res = ber_pvt_sb_read( sb, ber->ber_rwptr, to_go );
|
||||
if (res <=0)
|
||||
return LBER_DEFAULT;
|
||||
ber->ber_rwptr += res;
|
||||
|
|
@ -498,7 +538,7 @@ fill_buffer:
|
|||
to_go = ber->ber_end - ber->ber_rwptr;
|
||||
assert( to_go > 0 );
|
||||
|
||||
res = lber_pvt_sb_read( sb, ber->ber_rwptr, to_go );
|
||||
res = ber_pvt_sb_read( sb, ber->ber_rwptr, to_go );
|
||||
if (res<=0)
|
||||
return LBER_DEFAULT;
|
||||
ber->ber_rwptr+=res;
|
||||
|
|
@ -515,10 +555,10 @@ fill_buffer:
|
|||
ber->ber_rwptr = NULL;
|
||||
*len = ber->ber_len;
|
||||
if ( ber->ber_debug ) {
|
||||
lber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
|
||||
ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
|
||||
"ber_get_next: tag 0x%lx len %ld contents:\n",
|
||||
ber->ber_tag, ber->ber_len );
|
||||
lber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
|
||||
ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
|
||||
}
|
||||
return (ber->ber_tag);
|
||||
}
|
||||
|
|
@ -528,6 +568,8 @@ fill_buffer:
|
|||
|
||||
void ber_clear( BerElement *ber, int freebuf )
|
||||
{
|
||||
assert( ber != NULL );
|
||||
|
||||
if ((freebuf) && (ber->ber_buf))
|
||||
free( ber->ber_buf );
|
||||
ber->ber_buf = NULL;
|
||||
|
|
@ -535,34 +577,3 @@ void ber_clear( BerElement *ber, int freebuf )
|
|||
ber->ber_end = NULL;
|
||||
}
|
||||
|
||||
Sockbuf *lber_pvt_sb_alloc( void )
|
||||
{
|
||||
Sockbuf *sb = calloc(1, sizeof(Sockbuf));
|
||||
lber_pvt_sb_init( sb );
|
||||
return sb;
|
||||
}
|
||||
|
||||
Sockbuf *lber_pvt_sb_alloc_fd( int fd )
|
||||
{
|
||||
Sockbuf *sb = lber_pvt_sb_alloc();
|
||||
lber_pvt_sb_set_desc( sb, fd );
|
||||
lber_pvt_sb_set_io( sb, &lber_pvt_sb_io_tcp, NULL );
|
||||
return sb;
|
||||
}
|
||||
|
||||
void lber_pvt_sb_free( Sockbuf *sb )
|
||||
{
|
||||
if(sb == NULL) return;
|
||||
lber_pvt_sb_destroy( sb );
|
||||
free(sb);
|
||||
}
|
||||
|
||||
int lber_pvt_sb_get_option( Sockbuf *sb, int opt, void *outvalue )
|
||||
{
|
||||
return LBER_OPT_ERROR;
|
||||
}
|
||||
|
||||
int lber_pvt_sb_set_option( Sockbuf *sb, int opt, void *invalue )
|
||||
{
|
||||
return LBER_OPT_ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
extern int lber_int_debug;
|
||||
#define lber_log_printf lber_pvt_log_printf
|
||||
extern int ber_int_debug;
|
||||
#define ber_log_printf ber_pvt_log_printf
|
||||
|
||||
struct lber_options {
|
||||
short lbo_item_type;
|
||||
|
|
@ -88,15 +88,15 @@ typedef struct sockbuf_io Sockbuf_IO;
|
|||
typedef struct sockbuf_sec Sockbuf_Sec;
|
||||
typedef struct sockbuf_buf Sockbuf_Buf;
|
||||
|
||||
#define lber_pvt_sb_get_desc( sb ) ((sb)->sb_sd)
|
||||
#define lber_pvt_sb_set_desc( sb, val ) ((sb)->sb_sd =(val))
|
||||
#define lber_pvt_sb_in_use( sb ) ((sb)->sb_sd!=-1)
|
||||
#define ber_pvt_sb_get_desc( sb ) ((sb)->sb_sd)
|
||||
#define ber_pvt_sb_set_desc( sb, val ) ((sb)->sb_sd =(val))
|
||||
#define ber_pvt_sb_in_use( sb ) ((sb)->sb_sd!=-1)
|
||||
|
||||
#ifdef USE_SASL
|
||||
#define lber_pvt_sb_data_ready( sb ) \
|
||||
#define ber_pvt_sb_data_ready( sb ) \
|
||||
(((sb)->sb_buf_ready) || ((sb)->sb_trans_ready) || ((sb)->sb_sec_ready))
|
||||
#else
|
||||
#define lber_pvt_sb_data_ready( sb ) \
|
||||
#define ber_pvt_sb_data_ready( sb ) \
|
||||
(((sb)->sb_buf_ready) || ((sb)->sb_trans_ready))
|
||||
#endif
|
||||
|
||||
|
|
@ -154,50 +154,70 @@ struct seqorset {
|
|||
/*
|
||||
* bprint.c
|
||||
*/
|
||||
LDAP_F int lber_log_bprint LDAP_P((
|
||||
LDAP_F( int )
|
||||
ber_log_bprint LDAP_P((
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
char *data,
|
||||
const char *data,
|
||||
int len ));
|
||||
|
||||
LDAP_F int lber_log_dump LDAP_P((
|
||||
LDAP_F( int )
|
||||
ber_log_dump LDAP_P((
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
BerElement *ber,
|
||||
const BerElement *ber,
|
||||
int inout ));
|
||||
|
||||
LDAP_F int lber_log_sos_dump LDAP_P((
|
||||
LDAP_F( int )
|
||||
ber_log_sos_dump LDAP_P((
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
Seqorset *sos ));
|
||||
|
||||
/* io.c */
|
||||
LDAP_F Sockbuf *lber_pvt_sb_alloc LDAP_P(( void ));
|
||||
LDAP_F Sockbuf *lber_pvt_sb_alloc_fd LDAP_P(( int ));
|
||||
LDAP_F Sockbuf *lber_pvt_sb_alloc_fd LDAP_P(( int ));
|
||||
LDAP_F void lber_pvt_sb_free LDAP_P(( Sockbuf * ));
|
||||
LDAP_F int lber_pvt_sb_get_option LDAP_P(( Sockbuf *, int, void * ));
|
||||
LDAP_F int lber_pvt_sb_set_option LDAP_P(( Sockbuf *, int, void * ));
|
||||
const Seqorset *sos ));
|
||||
|
||||
/* sockbuf.c */
|
||||
|
||||
LDAP_F int lber_pvt_sb_init LDAP_P(( Sockbuf *sb ));
|
||||
LDAP_F int lber_pvt_sb_destroy LDAP_P(( Sockbuf *sb ));
|
||||
#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 ));
|
||||
#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 ));
|
||||
LDAP_F( int )
|
||||
ber_pvt_sb_init 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_destroy LDAP_P(( Sockbuf *sb ));
|
||||
#ifdef USE_SASL
|
||||
|
||||
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 )
|
||||
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 */
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ CPP=cl.exe
|
|||
# PROP Intermediate_Dir "Release\liblber"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
|
|
@ -80,8 +80,8 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "liblber_"
|
||||
# PROP Intermediate_Dir "liblber_"
|
||||
# PROP Output_Dir "..\Sdebug"
|
||||
# PROP Intermediate_Dir "SDebug\liblber"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
|
||||
|
|
@ -101,11 +101,11 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "liblber0"
|
||||
# PROP Intermediate_Dir "liblber0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\liblber"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
|
|
@ -151,26 +151,10 @@ SOURCE=..\..\include\lber_pvt.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldap_cdefs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldap_features.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldap_log.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\options.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\portable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sockbuf.c
|
||||
# End Source File
|
||||
# End Target
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
#include "lber-int.h"
|
||||
|
||||
int lber_int_debug = 0;
|
||||
int ber_int_debug = 0;
|
||||
|
||||
int
|
||||
lber_get_option(
|
||||
ber_get_option(
|
||||
void *item,
|
||||
int option,
|
||||
void *outvalue)
|
||||
|
|
@ -26,7 +26,7 @@ lber_get_option(
|
|||
|
||||
if(item == NULL) {
|
||||
if(option == LBER_OPT_BER_DEBUG) {
|
||||
* (int *) outvalue = lber_int_debug;
|
||||
* (int *) outvalue = ber_int_debug;
|
||||
return LBER_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ lber_get_option(
|
|||
}
|
||||
|
||||
int
|
||||
lber_set_option(
|
||||
ber_set_option(
|
||||
void *item,
|
||||
int option,
|
||||
void *invalue)
|
||||
|
|
@ -69,11 +69,11 @@ lber_set_option(
|
|||
|
||||
if(item == NULL) {
|
||||
if(option == LBER_OPT_BER_DEBUG) {
|
||||
lber_int_debug = * (int *) invalue;
|
||||
ber_int_debug = * (int *) invalue;
|
||||
return LBER_OPT_SUCCESS;
|
||||
|
||||
} else if(option == LBER_OPT_LOG_PRINT_FN) {
|
||||
lber_pvt_log_print = (BER_LOG_PRINT_FN) invalue;
|
||||
ber_pvt_log_print = (BER_LOG_PRINT_FN) invalue;
|
||||
return LBER_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static long have_no_read( Sockbuf *sb, void *buf, long len );
|
|||
static long have_no_write( Sockbuf *sb, void *buf, long len );
|
||||
static int have_no_close( Sockbuf *sb );
|
||||
|
||||
static Sockbuf_IO lber_pvt_sb_IO_None=
|
||||
static Sockbuf_IO sb_IO_None=
|
||||
{
|
||||
NULL, /* sbi_setup */
|
||||
NULL, /* sbi_release */
|
||||
|
|
@ -57,6 +57,8 @@ static Sockbuf_IO lber_pvt_sb_IO_None=
|
|||
static void
|
||||
update_status( Sockbuf *sb )
|
||||
{
|
||||
assert( sb != NULL );
|
||||
|
||||
sb->sb_buf_ready = (sb->sb_buf.buf_ptr < sb->sb_buf.buf_end);
|
||||
#ifdef USE_SASL
|
||||
sb->sb_sec_ready = ((sb->sb_sec_buf_in.buf_end!=0) &&
|
||||
|
|
@ -69,9 +71,16 @@ update_status( Sockbuf *sb )
|
|||
static int
|
||||
status_is_ok( Sockbuf *sb )
|
||||
{
|
||||
int obr = sb->sb_buf_ready;
|
||||
int obr;
|
||||
#ifdef USE_SASL
|
||||
int osr = sb->sb_sec_ready;
|
||||
int osr;
|
||||
#endif
|
||||
|
||||
assert( sb != NULL );
|
||||
|
||||
obr = sb->sb_buf_ready;
|
||||
#ifdef USE_SASL
|
||||
osr = sb->sb_sec_ready;
|
||||
#endif
|
||||
|
||||
update_status(sb);
|
||||
|
|
@ -92,6 +101,9 @@ static long
|
|||
packet_length( char *buf )
|
||||
{
|
||||
long size;
|
||||
|
||||
assert( buf != NULL );
|
||||
|
||||
size = (((unsigned long)buf[0])<<24)|
|
||||
(((unsigned long)buf[1])<<16)|
|
||||
(((unsigned long)buf[2])<<8)|
|
||||
|
|
@ -112,9 +124,11 @@ packet_length( char *buf )
|
|||
static int
|
||||
grow_buffer( Sockbuf_Buf * buf, long minsize )
|
||||
{
|
||||
long pw=MIN_BUF_SIZE;
|
||||
long pw;;
|
||||
|
||||
for(;(pw<minsize);pw<<=1) {
|
||||
assert( buf != NULL );
|
||||
|
||||
for( pw=MIN_BUF_SIZE; pw<minsize; pw<<=1 ) {
|
||||
if (pw > MAX_BUF_SIZE) {
|
||||
/* this could mean that somebody is trying to crash us. */
|
||||
return -1;
|
||||
|
|
@ -161,6 +175,9 @@ sockbuf_sec_release( Sockbuf *sb, char *buf, long len )
|
|||
char *end;
|
||||
long size;
|
||||
|
||||
assert( buf != NULL );
|
||||
assert( sb != NULL );
|
||||
|
||||
assert( sb->sb_sec );
|
||||
assert( sb->sb_sec->sbs_release );
|
||||
assert( sb->sb_sec_buf_in.sb_ptr >= sb->sb_sec_buf_in.sb_end );
|
||||
|
|
@ -237,6 +254,9 @@ sockbuf_sec_protect( Sockbuf *sb, char *buf, long len )
|
|||
long blen;
|
||||
long total;
|
||||
|
||||
assert( buf != NULL );
|
||||
|
||||
assert( sb != NULL );
|
||||
assert( sb->sb_sec_out.buf_end == 0 );
|
||||
assert( sb->sb_sec_out.buf_ptr == 0 );
|
||||
|
||||
|
|
@ -279,7 +299,12 @@ static long
|
|||
sockbuf_copy_out( Sockbuf *sb, char **buf, long len )
|
||||
{
|
||||
long blen = (sb->sb_buf.buf_end - sb->sb_buf.buf_ptr );
|
||||
|
||||
assert( buf != NULL );
|
||||
|
||||
assert( sb != NULL );
|
||||
assert( status_is_ok(sb) );
|
||||
|
||||
if (blen) {
|
||||
long rlen = (blen<len) ? blen : len;
|
||||
memcpy( *buf, sb->sb_buf.buf_base + sb->sb_buf.buf_ptr, rlen );
|
||||
|
|
@ -297,17 +322,46 @@ sockbuf_copy_out( Sockbuf *sb, char **buf, long len )
|
|||
return len;
|
||||
}
|
||||
|
||||
Sockbuf *ber_sockbuf_alloc( void )
|
||||
{
|
||||
Sockbuf *sb = calloc(1, sizeof(Sockbuf));
|
||||
|
||||
if( sb == NULL ) return NULL;
|
||||
|
||||
ber_pvt_sb_init( sb );
|
||||
return sb;
|
||||
}
|
||||
|
||||
Sockbuf *ber_sockbuf_alloc_fd( int fd )
|
||||
{
|
||||
Sockbuf *sb = ber_sockbuf_alloc();
|
||||
|
||||
if( sb == NULL ) return NULL;
|
||||
|
||||
ber_pvt_sb_set_desc( sb, fd );
|
||||
ber_pvt_sb_set_io( sb, &ber_pvt_sb_io_tcp, NULL );
|
||||
return sb;
|
||||
}
|
||||
|
||||
void ber_sockbuf_free( Sockbuf *sb )
|
||||
{
|
||||
assert(sb != NULL);
|
||||
ber_pvt_sb_destroy( sb );
|
||||
free(sb);
|
||||
}
|
||||
|
||||
long
|
||||
lber_pvt_sb_read( Sockbuf *sb, void *buf_arg, long len )
|
||||
ber_pvt_sb_read( Sockbuf *sb, void *buf_arg, long len )
|
||||
{
|
||||
char *buf;
|
||||
long ret;
|
||||
|
||||
assert( buf_arg != NULL );
|
||||
assert( sb != NULL );
|
||||
assert( status_is_ok(sb) );
|
||||
#if 0
|
||||
/* breaks slapd :-) */
|
||||
assert( lber_pvt_sb_in_use( sb ) );
|
||||
/* breaks slapd :-< */
|
||||
assert( ber_pvt_sb_in_use( sb ) );
|
||||
#endif
|
||||
|
||||
#ifdef TEST_PARTIAL_READ
|
||||
|
|
@ -316,7 +370,8 @@ lber_pvt_sb_read( Sockbuf *sb, void *buf_arg, long len )
|
|||
return -1;
|
||||
}
|
||||
|
||||
len = (rand() % len)+1;
|
||||
if( len > 0 )
|
||||
len = (rand() % len)+1;
|
||||
#endif
|
||||
|
||||
buf = (char *) buf_arg;
|
||||
|
|
@ -461,6 +516,9 @@ do_return:
|
|||
long sockbuf_do_write( Sockbuf *sb )
|
||||
{
|
||||
long to_go;
|
||||
|
||||
assert( sb != NULL );
|
||||
|
||||
to_go = sb->sb_sec_out.buf_end - sb->sb_sec_out.buf_ptr;
|
||||
assert( to_go > 0 );
|
||||
/* there is something left of the last time... */
|
||||
|
|
@ -482,14 +540,14 @@ long sockbuf_do_write( Sockbuf *sb )
|
|||
}
|
||||
#endif
|
||||
|
||||
long lber_pvt_sb_write( Sockbuf *sb, void *buf, long len_arg )
|
||||
long ber_pvt_sb_write( Sockbuf *sb, void *buf, long len_arg )
|
||||
{
|
||||
long ret;
|
||||
long len = len_arg;
|
||||
assert( status_is_ok(sb) );
|
||||
#if 0
|
||||
/* unfortunately breaks slapd */
|
||||
assert( lber_pvt_sb_in_use( sb ) );
|
||||
assert( ber_pvt_sb_in_use( sb ) );
|
||||
#endif
|
||||
#ifdef TEST_PARTIAL_WRITE
|
||||
if ((rand() & 3)==1) { /* 1 out of 4 */
|
||||
|
|
@ -540,22 +598,25 @@ long lber_pvt_sb_write( Sockbuf *sb, void *buf, long len_arg )
|
|||
return ret;
|
||||
}
|
||||
|
||||
int lber_pvt_sb_close( Sockbuf *sb )
|
||||
int ber_pvt_sb_close( Sockbuf *sb )
|
||||
{
|
||||
int ret;
|
||||
|
||||
assert( sb != NULL );
|
||||
assert( sb->sb_io );
|
||||
assert( sb->sb_io->sbi_close );
|
||||
assert( status_is_ok(sb) );
|
||||
assert( lber_pvt_sb_in_use( sb ) );
|
||||
assert( ber_pvt_sb_in_use( sb ) );
|
||||
|
||||
ret = sb->sb_io->sbi_close( sb );
|
||||
lber_pvt_sb_set_desc( sb, -1 );
|
||||
ber_pvt_sb_set_desc( sb, -1 );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int lber_pvt_sb_set_readahead( Sockbuf *sb, int rh )
|
||||
int ber_pvt_sb_set_readahead( Sockbuf *sb, int rh )
|
||||
{
|
||||
assert( sb != NULL );
|
||||
assert( status_is_ok(sb) );
|
||||
sb->sb_read_ahead = (rh!=0);
|
||||
return 0;
|
||||
|
|
@ -563,8 +624,9 @@ int lber_pvt_sb_set_readahead( Sockbuf *sb, int rh )
|
|||
|
||||
#define USE_NONBLOCK
|
||||
#ifdef USE_NONBLOCK
|
||||
int lber_pvt_sb_set_nonblock( Sockbuf *sb, int nb )
|
||||
int ber_pvt_sb_set_nonblock( Sockbuf *sb, int nb )
|
||||
{
|
||||
assert( sb != NULL );
|
||||
assert( status_is_ok(sb) );
|
||||
if (nb) {
|
||||
sb->sb_non_block = 1;
|
||||
|
|
@ -577,16 +639,16 @@ int lber_pvt_sb_set_nonblock( Sockbuf *sb, int nb )
|
|||
sb->sb_read_ahead = 0;
|
||||
#endif
|
||||
}
|
||||
if (lber_pvt_sb_in_use(sb)) {
|
||||
if (ber_pvt_sb_in_use(sb)) {
|
||||
#if HAVE_FCNTL
|
||||
int flags = fcntl(lber_pvt_sb_get_desc(sb), F_GETFL);
|
||||
int flags = fcntl(ber_pvt_sb_get_desc(sb), F_GETFL);
|
||||
flags |= O_NONBLOCK;
|
||||
return fcntl(lber_pvt_sb_get_desc(sb), F_SETFL, flags);
|
||||
return fcntl(ber_pvt_sb_get_desc(sb), F_SETFL, flags);
|
||||
|
||||
#elif defined( FIONBIO )
|
||||
/* WINSOCK requires the status to be a long */
|
||||
ioctl_t status = (nb!=0);
|
||||
return ioctl( lber_pvt_sb_get_desc(sb), FIONBIO, &status );
|
||||
return ioctl( ber_pvt_sb_get_desc(sb), FIONBIO, &status );
|
||||
#endif /* FIONBIO */
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -604,14 +666,18 @@ int lber_pvt_sb_set_nonblock( Sockbuf *sb, int nb )
|
|||
static int
|
||||
sockbuf_buf_destroy( Sockbuf_Buf *buf )
|
||||
{
|
||||
assert( buf != NULL);
|
||||
|
||||
if (buf->buf_base)
|
||||
free( buf->buf_base );
|
||||
sockbuf_buf_init( buf );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lber_pvt_sb_init( Sockbuf *sb )
|
||||
int ber_pvt_sb_init( Sockbuf *sb )
|
||||
{
|
||||
assert( sb != NULL);
|
||||
|
||||
sb->sb_item_type=LBER_ITEM_SOCKBUF;
|
||||
sb->sb_options = 0;
|
||||
sb->sb_debug = 0;
|
||||
|
|
@ -624,7 +690,7 @@ int lber_pvt_sb_init( Sockbuf *sb )
|
|||
sb->sb_non_block = 0;
|
||||
sb->sb_fd = -1;
|
||||
sb->sb_iodata = NULL;
|
||||
sb->sb_io = &lber_pvt_sb_IO_None;
|
||||
sb->sb_io = &sb_IO_None;
|
||||
sb->sb_sd = -1;
|
||||
#ifdef DEADWOOD
|
||||
sb->sb_max_incoming = 0;
|
||||
|
|
@ -640,22 +706,24 @@ int lber_pvt_sb_init( Sockbuf *sb )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lber_pvt_sb_destroy( Sockbuf *sb )
|
||||
int ber_pvt_sb_destroy( Sockbuf *sb )
|
||||
{
|
||||
assert( sb != NULL);
|
||||
#ifdef USE_SASL
|
||||
lber_pvt_sb_clear_sec(sb);
|
||||
ber_pvt_sb_clear_sec(sb);
|
||||
sockbuf_buf_destroy( &(sb->sb_sec_buf_in) );
|
||||
sockbuf_buf_destroy( &(sb->sb_sec_buf_out) );
|
||||
#endif
|
||||
lber_pvt_sb_clear_io(sb);
|
||||
ber_pvt_sb_clear_io(sb);
|
||||
sockbuf_buf_destroy( &(sb->sb_buf) );
|
||||
return lber_pvt_sb_init( sb );
|
||||
return ber_pvt_sb_init( sb );
|
||||
}
|
||||
|
||||
#ifdef USE_SASL
|
||||
int lber_pvt_sb_set_sec( Sockbuf *sb, Sockbuf_Sec * sec, void *arg )
|
||||
int ber_pvt_sb_set_sec( Sockbuf *sb, Sockbuf_Sec * sec, void *arg )
|
||||
{
|
||||
int len;
|
||||
assert( sb != NULL);
|
||||
if ((sb->sb_sec) || (sec==NULL))
|
||||
return -1;
|
||||
|
||||
|
|
@ -681,8 +749,10 @@ int lber_pvt_sb_set_sec( Sockbuf *sb, Sockbuf_Sec * sec, void *arg )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lber_pvt_sb_clear_sec( Sockbuf *sb )
|
||||
int ber_pvt_sb_clear_sec( Sockbuf *sb )
|
||||
{
|
||||
assert( sb != NULL);
|
||||
|
||||
if (sb->sb_buf.buf_ptr!=0)
|
||||
return -1;
|
||||
if (sb->sb_sec==NULL)
|
||||
|
|
@ -710,9 +780,10 @@ int lber_pvt_sb_clear_sec( Sockbuf *sb )
|
|||
}
|
||||
#endif
|
||||
|
||||
int lber_pvt_sb_set_io( Sockbuf *sb, Sockbuf_IO *trans, void *arg )
|
||||
int ber_pvt_sb_set_io( Sockbuf *sb, Sockbuf_IO *trans, void *arg )
|
||||
{
|
||||
assert( sb->sb_io == &lber_pvt_sb_IO_None );
|
||||
assert( sb != NULL);
|
||||
assert( sb->sb_io == &sb_IO_None );
|
||||
|
||||
if (trans==NULL)
|
||||
return -1;
|
||||
|
|
@ -725,15 +796,16 @@ int lber_pvt_sb_set_io( Sockbuf *sb, Sockbuf_IO *trans, void *arg )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lber_pvt_sb_clear_io( Sockbuf *sb )
|
||||
int ber_pvt_sb_clear_io( Sockbuf *sb )
|
||||
{
|
||||
if (sb->sb_io==&lber_pvt_sb_IO_None)
|
||||
assert( sb != NULL);
|
||||
if (sb->sb_io==&sb_IO_None)
|
||||
return -1;
|
||||
|
||||
if ((sb->sb_io->sbi_remove) && (sb->sb_io->sbi_remove( sb )<0))
|
||||
return -1;
|
||||
|
||||
sb->sb_io = &lber_pvt_sb_IO_None;
|
||||
sb->sb_io = &sb_IO_None;
|
||||
|
||||
sb->sb_trans_ready = 0;
|
||||
|
||||
|
|
@ -747,11 +819,13 @@ int lber_pvt_sb_clear_io( Sockbuf *sb )
|
|||
static long
|
||||
stream_read( Sockbuf *sb, void *buf, long len )
|
||||
{
|
||||
assert( sb != NULL);
|
||||
|
||||
#if defined(MACOS)
|
||||
/*
|
||||
* MacTCP/OpenTransport
|
||||
*/
|
||||
return tcpread( lber_pvt_sb_get_desc(sb), 0, (unsigned char *)buf,
|
||||
return tcpread( ber_pvt_sb_get_desc(sb), 0, (unsigned char *)buf,
|
||||
len, NULL );
|
||||
|
||||
#elif defined( HAVE_PCNFS ) || \
|
||||
|
|
@ -765,33 +839,36 @@ stream_read( Sockbuf *sb, void *buf, long len )
|
|||
/*
|
||||
* 32-bit Windows Socket API (under Windows NT or Windows 95)
|
||||
*/
|
||||
{
|
||||
int rc;
|
||||
rc = recv( lber_pvt_sb_get_desc(sb), buf, len, 0 );
|
||||
rc = recv( ber_pvt_sb_get_desc(sb), buf, len, 0 );
|
||||
#ifdef HAVE_WINSOCK
|
||||
if ( rc < 0 ) errno = WSAGetLastError();
|
||||
#endif
|
||||
return rc;
|
||||
|
||||
}
|
||||
#elif defined( HAVE_NCSA )
|
||||
/*
|
||||
* NCSA Telnet TCP/IP stack (under DOS)
|
||||
*/
|
||||
return nread( lber_pvt_sb_get_desc(sb), buf, len );
|
||||
return nread( ber_pvt_sb_get_desc(sb), buf, len );
|
||||
|
||||
#else
|
||||
return read( lber_pvt_sb_get_desc(sb), buf, len );
|
||||
return read( ber_pvt_sb_get_desc(sb), buf, len );
|
||||
#endif
|
||||
}
|
||||
|
||||
static long
|
||||
stream_write( Sockbuf *sb, void *buf, long len )
|
||||
{
|
||||
assert( sb != NULL);
|
||||
|
||||
#if defined(MACOS)
|
||||
/*
|
||||
* MacTCP/OpenTransport
|
||||
*/
|
||||
#define MAX_WRITE 65535
|
||||
return tcpwrite( lber_pvt_sb_get_desc(sb),
|
||||
return tcpwrite( ber_pvt_sb_get_desc(sb),
|
||||
(unsigned char *)(buf),
|
||||
(len<MAX_WRITE)? len : MAX_WRITE );
|
||||
|
||||
|
|
@ -806,36 +883,40 @@ stream_write( Sockbuf *sb, void *buf, long len )
|
|||
/*
|
||||
* 32-bit Windows Socket API (under Windows NT or Windows 95)
|
||||
*/
|
||||
|
||||
{
|
||||
int rc;
|
||||
rc = send( lber_pvt_sb_get_desc(sb), buf, len, 0 );
|
||||
rc = send( ber_pvt_sb_get_desc(sb), buf, len, 0 );
|
||||
#ifdef HAVE_WINSOCK
|
||||
if ( rc < 0 ) errno = WSAGetLastError();
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
#elif defined(HAVE_NCSA)
|
||||
return netwrite( lber_pvt_sb_get_desc(sb), buf, len );
|
||||
return netwrite( ber_pvt_sb_get_desc(sb), buf, len );
|
||||
|
||||
#elif defined(VMS)
|
||||
/*
|
||||
* VMS -- each write must be 64K or smaller
|
||||
*/
|
||||
#define MAX_WRITE 65535
|
||||
return write( lber_pvt_sb_get_desc(sb), buf,
|
||||
return write( ber_pvt_sb_get_desc(sb), buf,
|
||||
(len<MAX_WRITE)? len : MAX_WRITE);
|
||||
#else
|
||||
return write( lber_pvt_sb_get_desc(sb), buf, len );
|
||||
return write( ber_pvt_sb_get_desc(sb), buf, len );
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
stream_close( Sockbuf *sb )
|
||||
{
|
||||
tcp_close( lber_pvt_sb_get_desc( sb ) );
|
||||
assert( sb != NULL);
|
||||
tcp_close( ber_pvt_sb_get_desc( sb ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
Sockbuf_IO lber_pvt_sb_io_tcp=
|
||||
Sockbuf_IO ber_pvt_sb_io_tcp=
|
||||
{
|
||||
NULL, /* sbi_setup */
|
||||
NULL, /* sbi_release */
|
||||
|
|
@ -857,6 +938,7 @@ struct dgram_data
|
|||
static int
|
||||
dgram_setup( Sockbuf *sb, void *arg )
|
||||
{
|
||||
assert( sb != NULL);
|
||||
sb->sb_iodata = malloc( sizeof( struct dgram_data ) );
|
||||
if (sb->sb_iodata==NULL)
|
||||
return -1;
|
||||
|
|
@ -867,6 +949,7 @@ dgram_setup( Sockbuf *sb, void *arg )
|
|||
static int
|
||||
dgram_release( Sockbuf *sb )
|
||||
{
|
||||
assert( sb != NULL);
|
||||
free( sb->sb_iodata );
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -879,17 +962,20 @@ dgram_read( Sockbuf *sb, void *buf, long len )
|
|||
int addrlen;
|
||||
struct dgram_data *dd;
|
||||
|
||||
assert( sb != NULL );
|
||||
assert( buf != NULL );
|
||||
|
||||
dd = (struct dgram_data *)(sb->sb_iodata);
|
||||
|
||||
addrlen = sizeof( struct sockaddr );
|
||||
rc=recvfrom( lber_pvt_sb_get_desc(sb), buf, len, 0, &(dd->src), &addrlen );
|
||||
rc=recvfrom( ber_pvt_sb_get_desc(sb), buf, len, 0, &(dd->src), &addrlen );
|
||||
|
||||
if ( sb->sb_debug ) {
|
||||
lber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
|
||||
ber_log_printf( LDAP_DEBUG_ANY, sb->sb_debug,
|
||||
"dgram_read udp_read %d bytes\n",
|
||||
rc );
|
||||
if ( rc > 0 )
|
||||
lber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
|
||||
ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
|
||||
buf, rc );
|
||||
}
|
||||
return rc;
|
||||
|
|
@ -905,9 +991,12 @@ dgram_write( Sockbuf *sb, void *buf, long len )
|
|||
int rc;
|
||||
struct dgram_data *dd;
|
||||
|
||||
assert( sb != NULL );
|
||||
assert( buf != NULL );
|
||||
|
||||
dd = (struct dgram_data *)(sb->sb_iodata);
|
||||
|
||||
rc=sendto( lber_pvt_sb_get_desc(sb), buf, len, 0, &(dd->dst),
|
||||
rc=sendto( ber_pvt_sb_get_desc(sb), buf, len, 0, &(dd->dst),
|
||||
sizeof( struct sockaddr ) );
|
||||
|
||||
if ( rc <= 0 )
|
||||
|
|
@ -929,11 +1018,13 @@ dgram_write( Sockbuf *sb, void *buf, long len )
|
|||
static int
|
||||
dgram_close( Sockbuf *sb )
|
||||
{
|
||||
tcp_close( lber_pvt_sb_get_desc(sb) );
|
||||
assert( sb != NULL );
|
||||
|
||||
tcp_close( ber_pvt_sb_get_desc(sb) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
Sockbuf_IO lber_pvt_sb_io_udp=
|
||||
Sockbuf_IO ber_pvt_sb_io_udp=
|
||||
{
|
||||
dgram_setup, /* sbi_setup */
|
||||
dgram_release, /* sbi_release */
|
||||
|
|
@ -942,19 +1033,21 @@ Sockbuf_IO lber_pvt_sb_io_udp=
|
|||
dgram_close, /* sbi_close */
|
||||
};
|
||||
|
||||
int lber_pvt_sb_udp_set_dst(Sockbuf *sb, void *addr )
|
||||
int ber_pvt_sb_udp_set_dst(Sockbuf *sb, void *addr )
|
||||
{
|
||||
struct dgram_data *dd;
|
||||
assert( sb->sb_io == &lber_pvt_sb_io_udp );
|
||||
assert( sb != NULL );
|
||||
assert( sb->sb_io == &ber_pvt_sb_io_udp );
|
||||
dd = (struct dgram_data *) (sb->sb_iodata);
|
||||
memcpy( &(dd->dst), addr, sizeof( struct sockaddr ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *lber_pvt_sb_udp_get_src( Sockbuf *sb )
|
||||
void *ber_pvt_sb_udp_get_src( Sockbuf *sb )
|
||||
{
|
||||
struct dgram_data *dd;
|
||||
assert( sb->sb_io == &lber_pvt_sb_io_udp );
|
||||
assert( sb != NULL );
|
||||
assert( sb->sb_io == &ber_pvt_sb_io_udp );
|
||||
dd = (struct dgram_data *) (sb->sb_iodata);
|
||||
return &(dd->src);
|
||||
}
|
||||
|
|
@ -970,7 +1063,8 @@ void *lber_pvt_sb_udp_get_src( Sockbuf *sb )
|
|||
static long
|
||||
have_no_read( Sockbuf *sb, void *buf, long len )
|
||||
{
|
||||
lber_log_printf( LDAP_DEBUG_ANY, lber_int_debug,
|
||||
assert( sb != NULL );
|
||||
ber_log_printf( LDAP_DEBUG_ANY, ber_int_debug,
|
||||
"warning: reading from uninitialized sockbuf\n");
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
|
|
@ -979,7 +1073,8 @@ have_no_read( Sockbuf *sb, void *buf, long len )
|
|||
static long
|
||||
have_no_write( Sockbuf *sb, void *buf, long len )
|
||||
{
|
||||
lber_log_printf( LDAP_DEBUG_ANY, lber_int_debug,
|
||||
assert( sb != NULL );
|
||||
ber_log_printf( LDAP_DEBUG_ANY, ber_int_debug,
|
||||
"warning: writing to uninitialized sockbuf\n");
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
|
|
@ -988,6 +1083,7 @@ have_no_write( Sockbuf *sb, void *buf, long len )
|
|||
static int
|
||||
have_no_close( Sockbuf *sb )
|
||||
{
|
||||
assert( sb != NULL );
|
||||
assert( 0 );
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,43 @@
|
|||
|
||||
#include "ldap-int.h"
|
||||
|
||||
static int do_abandon LDAP_P(( LDAP *ld, int origid, int msgid ));
|
||||
static int do_abandon LDAP_P((
|
||||
LDAP *ld,
|
||||
int origid,
|
||||
int msgid,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls));
|
||||
|
||||
/*
|
||||
* ldap_abandon - perform an ldap (and X.500) abandon operation. Parameters:
|
||||
* ldap_abandon_ext - perform an ldap extended abandon operation.
|
||||
*
|
||||
* Parameters:
|
||||
* ld LDAP descriptor
|
||||
* msgid The message id of the operation to abandon
|
||||
* scntrls Server Controls
|
||||
* ccntrls Client Controls
|
||||
*
|
||||
* ldap_abandon_ext returns a LDAP error code.
|
||||
* (LDAP_SUCCESS if everything went ok)
|
||||
*
|
||||
* Example:
|
||||
* ldap_abandon_ext( ld, msgid, scntrls, ccntrls );
|
||||
*/
|
||||
int
|
||||
ldap_abandon_ext(
|
||||
LDAP *ld,
|
||||
int msgid,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_abandon_ext %d\n", msgid, 0, 0 );
|
||||
|
||||
return do_abandon( ld, msgid, msgid, sctrls, cctrls );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ldap_abandon - perform an ldap abandon operation. Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* msgid The message id of the operation to abandon
|
||||
|
|
@ -37,12 +70,18 @@ int
|
|||
ldap_abandon( LDAP *ld, int msgid )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0 );
|
||||
return( do_abandon( ld, msgid, msgid ));
|
||||
return do_abandon( ld, msgid, msgid, NULL, NULL ) == LDAP_SUCCESS
|
||||
? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_abandon( LDAP *ld, int origid, int msgid )
|
||||
do_abandon(
|
||||
LDAP *ld,
|
||||
int origid,
|
||||
int msgid,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls)
|
||||
{
|
||||
BerElement *ber;
|
||||
int i, err, sendabandon;
|
||||
|
|
@ -67,8 +106,9 @@ do_abandon( LDAP *ld, int origid, int msgid )
|
|||
if ( lr->lr_msgid == msgid ) { /* this message */
|
||||
break;
|
||||
}
|
||||
if ( lr->lr_origid == msgid ) { /* child: abandon it */
|
||||
do_abandon( ld, msgid, lr->lr_msgid );
|
||||
if ( lr->lr_origid == msgid ) {/* child: abandon it */
|
||||
(void) do_abandon( ld,
|
||||
msgid, lr->lr_msgid, sctrls, cctrls );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +116,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
|
|||
if ( origid == msgid && lr->lr_parent != NULL ) {
|
||||
/* don't let caller abandon child requests! */
|
||||
ld->ld_errno = LDAP_PARAM_ERROR;
|
||||
return( -1 );
|
||||
return( LDAP_PARAM_ERROR );
|
||||
}
|
||||
if ( lr->lr_status != LDAP_REQST_INPROGRESS ) {
|
||||
/* no need to send abandon message */
|
||||
|
|
@ -87,7 +127,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
|
|||
|
||||
if ( ldap_msgdelete( ld, msgid ) == 0 ) {
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
return( 0 );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
err = 0;
|
||||
|
|
@ -96,34 +136,57 @@ do_abandon( LDAP *ld, int origid, int msgid )
|
|||
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
err = -1;
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
|
||||
} else {
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if ( ld->ld_cldapnaddr > 0 ) {
|
||||
err = ber_printf( ber, "{isti}",
|
||||
err = ber_printf( ber, "{isti", /* leave open '}' */
|
||||
++ld->ld_msgid, ld->ld_cldapdn,
|
||||
LDAP_REQ_ABANDON, msgid );
|
||||
} else {
|
||||
} else
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
err = ber_printf( ber, "{iti}", ++ld->ld_msgid,
|
||||
{
|
||||
err = ber_printf( ber, "{iti", /* leave open '}' */
|
||||
++ld->ld_msgid,
|
||||
LDAP_REQ_ABANDON, msgid );
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
}
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
|
||||
if( err == -1 ) {
|
||||
/* 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 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
|
||||
} else {
|
||||
/* send the message */
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|
||||
if ( lr != NULL ) {
|
||||
sb = lr->lr_conn->lconn_sb;
|
||||
} else {
|
||||
} else
|
||||
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
{
|
||||
sb = &ld->ld_sb;
|
||||
}
|
||||
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
sb = &ld->ld_sb;
|
||||
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
|
||||
if ( ber_flush( sb, ber, 1 ) != 0 ) {
|
||||
ld->ld_errno = LDAP_SERVER_DOWN;
|
||||
err = -1;
|
||||
|
|
@ -150,7 +213,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
|
|||
if ( (ld->ld_abandoned = (int *) malloc( 2 * sizeof(int) ))
|
||||
== NULL ) {
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
return( -1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
i = 0;
|
||||
} else {
|
||||
|
|
@ -159,7 +222,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
|
|||
if ( (ld->ld_abandoned = (int *) realloc( (char *)
|
||||
ld->ld_abandoned, (i + 2) * sizeof(int) )) == NULL ) {
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
return( -1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
}
|
||||
ld->ld_abandoned[i] = msgid;
|
||||
|
|
@ -168,5 +231,6 @@ do_abandon( LDAP *ld, int origid, int msgid )
|
|||
if ( err != -1 ) {
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
}
|
||||
return( err );
|
||||
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
/*
|
||||
* ldap_add - initiate an ldap (and X.500) add operation. Parameters:
|
||||
* ldap_add - initiate an ldap add operation. Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the entry to add
|
||||
|
|
@ -39,7 +39,47 @@
|
|||
* msgid = ldap_add( ld, dn, attrs );
|
||||
*/
|
||||
int
|
||||
ldap_add( LDAP *ld, char *dn, LDAPMod **attrs )
|
||||
ldap_add( LDAP *ld, LDAP_CONST char *dn, LDAPMod **attrs )
|
||||
{
|
||||
int rc;
|
||||
int msgid;
|
||||
|
||||
rc = ldap_add_ext( ld, dn, attrs, NULL, NULL, &msgid );
|
||||
|
||||
if ( rc != LDAP_SUCCESS )
|
||||
return -1;
|
||||
|
||||
return msgid;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ldap_add_ext - initiate an ldap extended add operation. Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the entry to add
|
||||
* mods List of attributes for the entry. This is a null-
|
||||
* terminated array of pointers to LDAPMod structures.
|
||||
* only the type and values in the structures need be
|
||||
* filled in.
|
||||
* sctrl Server Controls
|
||||
* cctrl Client Controls
|
||||
* msgidp Message ID pointer
|
||||
*
|
||||
* Example:
|
||||
* LDAPMod *attrs[] = {
|
||||
* { 0, "cn", { "babs jensen", "babs", 0 } },
|
||||
* { 0, "sn", { "jensen", 0 } },
|
||||
* { 0, "objectClass", { "person", 0 } },
|
||||
* 0
|
||||
* }
|
||||
* rc = ldap_add_ext( ld, dn, attrs, NULL, NULL, &msgid );
|
||||
*/
|
||||
int
|
||||
ldap_add_ext( LDAP *ld, LDAP_CONST char *dn, LDAPMod **attrs,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls,
|
||||
int *msgidp )
|
||||
{
|
||||
BerElement *ber;
|
||||
int i, rc;
|
||||
|
|
@ -59,14 +99,17 @@ ldap_add( LDAP *ld, char *dn, LDAPMod **attrs )
|
|||
|
||||
/* create a message to send */
|
||||
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
return( -1 );
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "{it{s{", ++ld->ld_msgid, LDAP_REQ_ADD, dn )
|
||||
== -1 ) {
|
||||
rc = ber_printf( ber, "{it{s{", /* leave open '}}}' */
|
||||
++ld->ld_msgid, LDAP_REQ_ADD, dn );
|
||||
|
||||
if ( rc == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( -1 );
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
/* for each attribute in the entry... */
|
||||
|
|
@ -81,28 +124,54 @@ ldap_add( LDAP *ld, char *dn, LDAPMod **attrs )
|
|||
if ( rc == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( -1 );
|
||||
return ld->ld_errno;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "}}}" ) == -1 ) {
|
||||
/* close '{{' */
|
||||
if ( ber_printf( ber, "}}" ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( -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 ld->ld_errno;
|
||||
}
|
||||
|
||||
/* send the message */
|
||||
return( ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber ));
|
||||
*msgidp = ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber );
|
||||
|
||||
if(*msgidp < 0)
|
||||
return ld->ld_errno;
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_add_s( LDAP *ld, char *dn, LDAPMod **attrs )
|
||||
ldap_add_ext_s(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAPMod **attrs,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
int msgid;
|
||||
int msgid, rc;
|
||||
LDAPMessage *res;
|
||||
|
||||
if ( (msgid = ldap_add( ld, dn, attrs )) == -1 )
|
||||
return( ld->ld_errno );
|
||||
rc = ldap_add_ext( ld, dn, attrs, sctrls, cctrls, &msgid );
|
||||
|
||||
if ( rc != LDAP_SUCCESS )
|
||||
return( rc );
|
||||
|
||||
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
|
||||
return( ld->ld_errno );
|
||||
|
|
@ -110,3 +179,9 @@ ldap_add_s( LDAP *ld, char *dn, LDAPMod **attrs )
|
|||
return( ldap_result2error( ld, res, 1 ) );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_add_s( LDAP *ld, LDAP_CONST char *dn, LDAPMod **attrs )
|
||||
{
|
||||
return ldap_add_ext_s( ld, dn, attrs, NULL, NULL );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,8 @@
|
|||
* OpenLDAP API Test
|
||||
* Written by: Kurt Zeilenga
|
||||
*
|
||||
* This program is designed to test API features of libldap.
|
||||
*
|
||||
* The API specification can be found in:
|
||||
*
|
||||
* draft-api-ldapext-ldap-c-api-01.txt
|
||||
*
|
||||
* and discussions on ietf-ldapext mailing list.
|
||||
* This program is designed to test API features of implementations
|
||||
* of the IETF draft specifications.
|
||||
*
|
||||
*/
|
||||
#include "portable.h"
|
||||
|
|
@ -30,52 +25,67 @@ main(int argc, char **argv)
|
|||
int ival;
|
||||
char *sval;
|
||||
|
||||
printf("Compile time API Information\n");
|
||||
|
||||
#ifdef LDAP_API_INFO_VERSION
|
||||
api.ldapai_info_version = LDAP_API_INFO_VERSION;
|
||||
printf(" API Info version: %d\n", (int) api.ldapai_info_version);
|
||||
#else
|
||||
api.ldapai_info_version = 1;
|
||||
printf(" API Info version: unknown\n");
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_FEATURE_INFO_VERSION
|
||||
printf(" Feature Info version: %d\n", (int) LDAP_FEATURE_INFO_VERSION);
|
||||
#else
|
||||
printf(" Feature Info version: unknown\n");
|
||||
api.ldapai_info_version = 1;
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_API_VERSION
|
||||
printf(" API version: %d\n", (int) LDAP_API_VERSION);
|
||||
#else
|
||||
printf(" API version: unknown\n");
|
||||
#endif
|
||||
|
||||
printf("Compile time API Information\n");
|
||||
printf(" API Info version: %d\n", api.ldapai_info_version);
|
||||
printf(" API version: %d\n", LDAP_API_VERSION);
|
||||
#ifdef LDAP_VERSION
|
||||
printf(" Protocol Version: %d\n", LDAP_VERSION);
|
||||
printf(" Protocol Version: %d\n", (int) LDAP_VERSION);
|
||||
#else
|
||||
printf(" Protocol Version: unknown\n");
|
||||
#endif
|
||||
#ifdef LDAP_VERSION_MIN
|
||||
printf(" Protocol Min: %d\n", LDAP_VERSION_MIN);
|
||||
printf(" Protocol Min: %d\n", (int) LDAP_VERSION_MIN);
|
||||
#else
|
||||
printf(" Protocol Min: unknown\n");
|
||||
#endif
|
||||
#ifdef LDAP_VERSION_MAX
|
||||
printf(" Protocol Max: %d\n", LDAP_VERSION_MAX);
|
||||
printf(" Protocol Max: %d\n", (int) LDAP_VERSION_MAX);
|
||||
#else
|
||||
printf(" Protocol Max: unknown\n");
|
||||
#endif
|
||||
#ifdef LDAP_VENDOR_NAME
|
||||
printf(" Vendor Name: %s\n", LDAP_VENDOR_NAME);
|
||||
printf(" Vendor Name: %s\n", (int) LDAP_VENDOR_NAME);
|
||||
#else
|
||||
printf(" Vendor Name: unknown\n");
|
||||
#endif
|
||||
#ifdef LDAP_VENDOR_VERSION
|
||||
printf(" Vendor Version: %d\n", LDAP_VENDOR_VERSION);
|
||||
printf(" Vendor Version: %d\n", (int) LDAP_VENDOR_VERSION);
|
||||
#else
|
||||
printf(" Vendor Version: unknown\n");
|
||||
#endif
|
||||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) != LDAP_SUCCESS) {
|
||||
fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
|
||||
exit(-1);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("\nExecution time API Information\n");
|
||||
printf(" API Info version: %d\n", api.ldapai_info_version);
|
||||
|
||||
if (api.ldapai_info_version != LDAP_API_INFO_VERSION) {
|
||||
printf(" API INFO version mismatch!\n");
|
||||
exit(-1);
|
||||
printf(" API INFO version mismatch: got %d, expected %d\n",
|
||||
api.ldapai_info_version, LDAP_API_INFO_VERSION);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf(" API Version: %d\n", api.ldapai_api_version);
|
||||
|
|
@ -89,18 +99,33 @@ main(int argc, char **argv)
|
|||
for(i=0; api.ldapai_extensions[i] != NULL; i++) /* empty */;
|
||||
printf(" Extensions: %d\n", i);
|
||||
for(i=0; api.ldapai_extensions[i] != NULL; i++) {
|
||||
#ifndef LDAP_API_FEATURE_INFO
|
||||
printf(" %s\n",
|
||||
api.ldapai_extensions[i]);
|
||||
#else
|
||||
#ifdef LDAP_OPT_API_FEATURE_INFO
|
||||
LDAPAPIFeatureInfo fi;
|
||||
fi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION;
|
||||
fi.ldapaif_name = api.ldapai_extensions[i];
|
||||
fi.ldapaif_version = 0;
|
||||
|
||||
ldap_get_option(NULL, LDAP_OPT_API_FEATURE_INFO, &fi);
|
||||
if( ldap_get_option(NULL, LDAP_OPT_API_FEATURE_INFO, &fi) == LDAP_SUCCESS ) {
|
||||
if(fi.ldapaif_info_version != LDAP_FEATURE_INFO_VERSION) {
|
||||
printf(" %s feature info mismatch: got %d, expected %d\n",
|
||||
api.ldapai_extensions[i],
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
fi.ldapaif_info_version);
|
||||
|
||||
printf(" %s (%d)\n",
|
||||
api.ldapai_extensions[i], fi.ldapaif_version);
|
||||
} else {
|
||||
printf(" %s: version %d\n",
|
||||
fi.ldapaif_name,
|
||||
fi.ldapaif_version);
|
||||
}
|
||||
|
||||
} else {
|
||||
printf(" %s (NO FEATURE INFO)\n",
|
||||
api.ldapai_extensions[i]);
|
||||
}
|
||||
|
||||
#else
|
||||
printf(" %s\n",
|
||||
api.ldapai_extensions[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -112,48 +137,47 @@ main(int argc, char **argv)
|
|||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_DEREF, &ival) != LDAP_SUCCESS) {
|
||||
fprintf(stderr, "%s: ldap_get_option(api) failed\n", argv[0]);
|
||||
exit(-1);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf(" DEREF: %d\n", ival);
|
||||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_SIZELIMIT, &ival) != LDAP_SUCCESS) {
|
||||
fprintf(stderr, "%s: ldap_get_option(sizelimit) failed\n", argv[0]);
|
||||
exit(-1);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf(" SIZELIMIT: %d\n", ival);
|
||||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_TIMELIMIT, &ival) != LDAP_SUCCESS) {
|
||||
fprintf(stderr, "%s: ldap_get_option(timelimit) failed\n", argv[0]);
|
||||
exit(-1);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf(" TIMELIMIT: %d\n", ival);
|
||||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_REFERRALS, &ival) != LDAP_SUCCESS) {
|
||||
fprintf(stderr, "%s: ldap_get_option(referrals) failed\n", argv[0]);
|
||||
exit(-1);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf(" REFERRALS: %s\n",
|
||||
ival == (int) LDAP_OPT_ON ? "on" : "off");
|
||||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_RESTART, &ival) != LDAP_SUCCESS) {
|
||||
fprintf(stderr, "%s: ldap_get_option(restart) failed\n", argv[0]);
|
||||
exit(-1);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf(" RESTART: %s\n",
|
||||
ival == (int) LDAP_OPT_ON ? "on" : "off");
|
||||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ival) != LDAP_SUCCESS) {
|
||||
fprintf(stderr, "%s: ldap_get_option(protocol version) failed\n", argv[0]);
|
||||
exit(-1);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf(" PROTOCOL VERSION: %d\n", ival);
|
||||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_HOST_NAME, &sval) != LDAP_SUCCESS) {
|
||||
fprintf(stderr, "%s: ldap_get_option(host name) failed\n", argv[0]);
|
||||
exit(-1);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf(" HOST NAME: %s\n", sval);
|
||||
|
||||
exit(0);
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=apitest - Win32 Debug
|
||||
CFG=apitest - Win32 Single Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,12 +13,16 @@ CFG=apitest - Win32 Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "apitest.mak" CFG="apitest - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "apitest.mak" CFG="apitest - Win32 Single Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "apitest - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "apitest - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "apitest - Win32 Single Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "apitest - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -41,7 +45,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -65,7 +69,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -75,12 +79,64 @@ LINK32=link.exe
|
|||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apitest - Win32 Single Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "apitest_"
|
||||
# PROP BASE Intermediate_Dir "apitest_"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\apitest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apitest - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "apitest0"
|
||||
# PROP BASE Intermediate_Dir "apitest0"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\apitest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "apitest - Win32 Release"
|
||||
# Name "apitest - Win32 Debug"
|
||||
# Name "apitest - Win32 Single Debug"
|
||||
# Name "apitest - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\apitest.c
|
||||
|
|
|
|||
|
|
@ -18,6 +18,18 @@ Package=<4>
|
|||
|
||||
###############################################################################
|
||||
|
||||
Project: "liblber"=..\liblber\liblber.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "libldap"=.\libldap.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
|
@ -26,6 +38,9 @@ Package=<5>
|
|||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name liblber
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
int
|
||||
ldap_bind( LDAP *ld, char *dn, char *passwd, int authmethod )
|
||||
ldap_bind( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd, int authmethod )
|
||||
{
|
||||
/*
|
||||
* The bind request looks like this:
|
||||
|
|
@ -88,7 +88,11 @@ ldap_bind( LDAP *ld, char *dn, char *passwd, int authmethod )
|
|||
* NULL, LDAP_AUTH_KRBV4 )
|
||||
*/
|
||||
int
|
||||
ldap_bind_s( LDAP *ld, char *dn, char *passwd, int authmethod )
|
||||
ldap_bind_s(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *passwd,
|
||||
int authmethod )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_bind_s\n", 0, 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@
|
|||
static int cache_hash LDAP_P(( BerElement *ber ));
|
||||
static LDAPMessage *msg_dup LDAP_P(( LDAPMessage *msg ));
|
||||
static int request_cmp LDAP_P(( BerElement *req1, BerElement *req2 ));
|
||||
static int chain_contains_dn LDAP_P(( LDAPMessage *msg, char *dn ));
|
||||
static int chain_contains_dn LDAP_P(( LDAPMessage *msg, LDAP_CONST char *dn ));
|
||||
static long msg_size LDAP_P(( LDAPMessage *msg ));
|
||||
static void check_cache_memused LDAP_P(( LDAPCache *lc ));
|
||||
static void uncache_entry_or_req LDAP_P(( LDAP *ld, char *dn, int msgid ));
|
||||
static void uncache_entry_or_req LDAP_P(( LDAP *ld, LDAP_CONST char *dn, int msgid ));
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ ldap_uncache_request( LDAP *ld, int msgid )
|
|||
|
||||
|
||||
void
|
||||
ldap_uncache_entry( LDAP *ld, char *dn )
|
||||
ldap_uncache_entry( LDAP *ld, LDAP_CONST char *dn )
|
||||
{
|
||||
#ifndef LDAP_NOCACHE
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %lx\n",
|
||||
|
|
@ -153,7 +153,7 @@ ldap_uncache_entry( LDAP *ld, char *dn )
|
|||
|
||||
static void
|
||||
uncache_entry_or_req( LDAP *ld,
|
||||
char *dn, /* if non-NULL, uncache entry */
|
||||
const char *dn, /* if non-NULL, uncache entry */
|
||||
int msgid ) /* request to uncache (if dn == NULL) */
|
||||
{
|
||||
int i;
|
||||
|
|
@ -540,7 +540,7 @@ request_cmp( BerElement *req1, BerElement *req2 )
|
|||
|
||||
|
||||
static int
|
||||
chain_contains_dn( LDAPMessage *msg, char *dn )
|
||||
chain_contains_dn( LDAPMessage *msg, const char *dn )
|
||||
{
|
||||
LDAPMessage *m;
|
||||
BerElement ber;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ cldap_open( char *host, int port )
|
|||
ld->ld_cldapnaddr = 0;
|
||||
ld->ld_cldapaddrs = NULL;
|
||||
|
||||
if (lber_pvt_sb_set_io( &(ld->ld_sb), &lber_pvt_sb_io_udp, NULL )<0) {
|
||||
if (ber_pvt_sb_set_io( &(ld->ld_sb), &ber_pvt_sb_io_udp, NULL )<0) {
|
||||
ldap_ld_free(ld, 1 );
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ cldap_open( char *host, int port )
|
|||
DO_RETURN( NULL );
|
||||
}
|
||||
|
||||
lber_pvt_sb_udp_set_dst( &ld->ld_sb, ld->ld_cldapaddrs[0] );
|
||||
ber_pvt_sb_udp_set_dst( &ld->ld_sb, ld->ld_cldapaddrs[0] );
|
||||
|
||||
cldap_setretryinfo( ld, 0, 0 );
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ cldap_search_s( LDAP *ld, char *base, int scope, char *filter, char **attrs,
|
|||
--ld->ld_msgid; /* use same id as before */
|
||||
}
|
||||
|
||||
lber_pvt_sb_udp_set_dst( &(ld->ld_sb),
|
||||
ber_pvt_sb_udp_set_dst( &(ld->ld_sb),
|
||||
ld->ld_cldapaddrs[ cri.cri_useaddr ] );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "cldap_search_s try %d (to %s)\n",
|
||||
|
|
@ -358,7 +358,7 @@ cldap_result( LDAP *ld, int msgid, LDAPMessage **res,
|
|||
* got a result: determine which server it came from
|
||||
* decode into ldap message chain
|
||||
*/
|
||||
src = (struct sockaddr_in *) lber_pvt_sb_udp_get_src( sb );
|
||||
src = (struct sockaddr_in *) ber_pvt_sb_udp_get_src( sb );
|
||||
|
||||
for ( fromaddr = 0; fromaddr < ld->ld_cldapnaddr; ++fromaddr ) {
|
||||
if ( memcmp( &((struct sockaddr_in *)
|
||||
|
|
@ -394,7 +394,7 @@ cldap_result( LDAP *ld, int msgid, LDAPMessage **res,
|
|||
if ( i == fromaddr ) {
|
||||
continue;
|
||||
}
|
||||
lber_pvt_sb_udp_set_dst( sb, ld->ld_cldapaddrs[i] );
|
||||
ber_pvt_sb_udp_set_dst( sb, ld->ld_cldapaddrs[i] );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "cldap_result abandoning id %d (to %s)\n",
|
||||
msgid, inet_ntoa( ((struct sockaddr_in *)
|
||||
|
|
@ -497,7 +497,7 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
|
|||
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
|
||||
fprintf( stderr, "cldap_parsemsg add message id %d type %d:\n",
|
||||
ldm->lm_msgid, ldm->lm_msgtype );
|
||||
lber_log_dump( LDAP_DEBUG_BER, ldap_debug, ldm->lm_ber, 1 );
|
||||
ber_log_dump( LDAP_DEBUG_BER, ldap_debug, ldm->lm_ber, 1 );
|
||||
}
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
|
|
|
|||
|
|
@ -20,15 +20,25 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
/*
|
||||
* ldap_compare - perform an ldap (and X.500) compare operation. The dn
|
||||
* ldap_compare_ext - perform an ldap extended compare operation. The dn
|
||||
* of the entry to compare to and the attribute and value to compare (in
|
||||
* attr and value) are supplied. The msgid of the response is returned.
|
||||
*
|
||||
* Example:
|
||||
* ldap_compare( ld, "c=us@cn=bob", "userPassword", "secret" )
|
||||
* struct berval bvalue = { "secret", strlen("secret") };
|
||||
* rc = ldap_compare( ld, "c=us@cn=bob",
|
||||
* "userPassword", &bvalue,
|
||||
* sctrl, cctrl, &msgid )
|
||||
*/
|
||||
int
|
||||
ldap_compare( LDAP *ld, char *dn, char *attr, char *value )
|
||||
ldap_compare_ext(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *attr,
|
||||
struct berval *bvalue,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls,
|
||||
int *msgidp )
|
||||
{
|
||||
BerElement *ber;
|
||||
|
||||
|
|
@ -47,14 +57,28 @@ ldap_compare( LDAP *ld, char *dn, char *attr, char *value )
|
|||
|
||||
/* create a message to send */
|
||||
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
return( -1 );
|
||||
return( LDAP_NO_MEMORY );
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "{it{s{ss}}}", ++ld->ld_msgid, LDAP_REQ_COMPARE,
|
||||
dn, attr, value ) == -1 ) {
|
||||
if ( ber_printf( ber, "{it{s{sO}}", /* leave open '}' */
|
||||
++ld->ld_msgid,
|
||||
LDAP_REQ_COMPARE, dn, attr, &bvalue ) == -1 )
|
||||
{
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( -1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
/* Put Server Controls */
|
||||
if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
|
||||
ber_free( ber, 1 );
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
if( ber_printf( ber, "}" ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
|
|
@ -62,27 +86,78 @@ ldap_compare( LDAP *ld, char *dn, char *attr, char *value )
|
|||
if ( ldap_check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) {
|
||||
ber_free( ber, 1 );
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
return( ld->ld_msgid );
|
||||
*msgidp = ld->ld_msgid;
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
ldap_add_request_to_cache( ld, LDAP_REQ_COMPARE, ber );
|
||||
}
|
||||
#endif /* LDAP_NOCACHE */
|
||||
|
||||
/* send the message */
|
||||
return ( ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber ));
|
||||
*msgidp = ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber );
|
||||
return ( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
|
||||
}
|
||||
|
||||
/*
|
||||
* ldap_compare_ext - perform an ldap extended compare operation. The dn
|
||||
* of the entry to compare to and the attribute and value to compare (in
|
||||
* attr and value) are supplied. The msgid of the response is returned.
|
||||
*
|
||||
* Example:
|
||||
* msgid = ldap_compare( ld, "c=us@cn=bob", "userPassword", "secret" )
|
||||
*/
|
||||
int
|
||||
ldap_compare(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *attr,
|
||||
LDAP_CONST char *value )
|
||||
{
|
||||
int msgid;
|
||||
struct berval bvalue;
|
||||
|
||||
bvalue.bv_val = (char *) value;
|
||||
bvalue.bv_len = (value == NULL) ? 0 : strlen( value );
|
||||
|
||||
return ldap_compare_ext( ld, dn, attr, &bvalue, NULL, NULL, &msgid ) == LDAP_SUCCESS
|
||||
? msgid : -1;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_compare_s( LDAP *ld, char *dn, char *attr, char *value )
|
||||
ldap_compare_ext_s(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *attr,
|
||||
struct berval *bvalue,
|
||||
LDAPControl **sctrl,
|
||||
LDAPControl **cctrl )
|
||||
{
|
||||
int rc;
|
||||
int msgid;
|
||||
LDAPMessage *res;
|
||||
|
||||
if ( (msgid = ldap_compare( ld, dn, attr, value )) == -1 )
|
||||
return( ld->ld_errno );
|
||||
rc = ldap_compare_ext( ld, dn, attr, bvalue, sctrl, cctrl, &msgid );
|
||||
|
||||
if ( rc != LDAP_SUCCESS )
|
||||
return( rc );
|
||||
|
||||
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
|
||||
return( ld->ld_errno );
|
||||
|
||||
return( ldap_result2error( ld, res, 1 ) );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_compare_s(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *attr,
|
||||
LDAP_CONST char *value )
|
||||
{
|
||||
struct berval bvalue;
|
||||
|
||||
bvalue.bv_val = (char *) value;
|
||||
bvalue.bv_len = (value == NULL) ? 0 : strlen( value );
|
||||
|
||||
return ldap_compare_ext_s( ld, dn, attr, &bvalue, NULL, NULL );
|
||||
}
|
||||
|
|
@ -15,6 +15,102 @@
|
|||
|
||||
#include "ldap-int.h"
|
||||
|
||||
|
||||
/*
|
||||
* ldap_int_put_controls
|
||||
*/
|
||||
|
||||
int ldap_int_put_controls(
|
||||
LDAP *ld,
|
||||
LDAPControl **ctrls,
|
||||
BerElement *ber )
|
||||
{
|
||||
LDAPControl **c;
|
||||
|
||||
assert( ld != NULL );
|
||||
assert( ber != NULL );
|
||||
|
||||
if( ctrls == NULL ) {
|
||||
/* use default server controls */
|
||||
ctrls = ld->ld_sctrls;
|
||||
}
|
||||
|
||||
if( ctrls == NULL || *ctrls == NULL ) {
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
if ( ld->ld_version < LDAP_VERSION3 ) {
|
||||
/* LDAPv2 doesn't support controls,
|
||||
* error if any control is critical
|
||||
*/
|
||||
for( c = ctrls ; *c != NULL; c++ ) {
|
||||
if( (*c)->ldctl_iscritical ) {
|
||||
ld->ld_errno = LDAP_NOT_SUPPORTED;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
}
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
/* Controls are encoded as a sequence of sequences */
|
||||
if( ber_printf( ber, "t{", LDAP_TAG_CONTROLS ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
for( c = ctrls ; *c != NULL; c++ ) {
|
||||
if ( ber_printf( ber, "{s",
|
||||
(*c)->ldctl_oid ) == -1 )
|
||||
{
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
if( (*c)->ldctl_iscritical /* only if true */
|
||||
&& ( ber_printf( ber, "b",
|
||||
(*c)->ldctl_iscritical ) == -1 ) )
|
||||
{
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
if( (*c)->ldctl_value.bv_val != NULL /* only if we have a value */
|
||||
&& ( ber_printf( ber, "O",
|
||||
&((*c)->ldctl_value) ) == -1 ) )
|
||||
{
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
|
||||
if( ber_printf( ber, "}" ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( ber_printf( ber, "}" ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
int ldap_int_get_controls LDAP_P((
|
||||
BerElement *be,
|
||||
LDAPControl ***ctrls ))
|
||||
{
|
||||
assert( be != NULL );
|
||||
assert( ctrls != NULL );
|
||||
|
||||
**ctrls = NULL;
|
||||
|
||||
return LDAP_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free a LDAPControl
|
||||
*/
|
||||
|
|
@ -54,7 +150,7 @@ ldap_controls_free( LDAPControl **controls )
|
|||
/*
|
||||
* Duplicate an array of LDAPControl
|
||||
*/
|
||||
LDAPControl **ldap_controls_dup( LDAPControl **controls )
|
||||
LDAPControl **ldap_controls_dup( const LDAPControl **controls )
|
||||
{
|
||||
LDAPControl **new;
|
||||
int i;
|
||||
|
|
@ -96,7 +192,7 @@ LDAPControl **ldap_controls_dup( LDAPControl **controls )
|
|||
/*
|
||||
* Duplicate a LDAPControl
|
||||
*/
|
||||
LDAPControl *ldap_control_dup( LDAPControl *c )
|
||||
LDAPControl *ldap_control_dup( const LDAPControl *c )
|
||||
{
|
||||
LDAPControl *new;
|
||||
|
||||
|
|
@ -145,10 +241,4 @@ LDAPControl *ldap_control_dup( LDAPControl *c )
|
|||
|
||||
new->ldctl_iscritical = c->ldctl_iscritical;
|
||||
return new;
|
||||
}
|
||||
|
||||
/* get the controls from the BerElement */
|
||||
int ldap_get_ber_controls( BerElement *be, LDAPControl ***cp)
|
||||
{
|
||||
return LDAP_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,16 +20,24 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
/*
|
||||
* ldap_delete - initiate an ldap (and X.500) delete operation. Parameters:
|
||||
* ldap_delete_ext - initiate an ldap extended delete operation. Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the object to delete
|
||||
* sctrls Server Controls
|
||||
* cctrls Client Controls
|
||||
* msgidp Message Id Pointer
|
||||
*
|
||||
* Example:
|
||||
* msgid = ldap_delete( ld, dn );
|
||||
* rc = ldap_delete( ld, dn, sctrls, cctrls, msgidp );
|
||||
*/
|
||||
int
|
||||
ldap_delete( LDAP *ld, char *dn )
|
||||
ldap_delete_ext(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char* dn,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls,
|
||||
int *msgidp )
|
||||
{
|
||||
BerElement *ber;
|
||||
|
||||
|
|
@ -42,28 +50,55 @@ ldap_delete( LDAP *ld, char *dn )
|
|||
|
||||
/* create a message to send */
|
||||
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
return( -1 );
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "{its}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn )
|
||||
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;
|
||||
}
|
||||
|
||||
/* close '{' */
|
||||
if ( ber_printf( ber, "}", ++ld->ld_msgid, LDAP_REQ_DELETE, dn )
|
||||
== -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( -1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
/* send the message */
|
||||
return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
|
||||
*msgidp = ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber );
|
||||
|
||||
if(*msgidp < 0)
|
||||
return ld->ld_errno;
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ldap_delete_s( LDAP *ld, char *dn )
|
||||
ldap_delete_ext_s(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
int msgid;
|
||||
int msgid;
|
||||
int rc;
|
||||
LDAPMessage *res;
|
||||
|
||||
if ( (msgid = ldap_delete( ld, dn )) == -1 )
|
||||
rc = ldap_delete_ext( ld, dn, sctrls, cctrls, &msgid );
|
||||
|
||||
if( rc != LDAP_SUCCESS )
|
||||
return( ld->ld_errno );
|
||||
|
||||
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
|
||||
|
|
@ -71,3 +106,34 @@ ldap_delete_s( LDAP *ld, char *dn )
|
|||
|
||||
return( ldap_result2error( ld, res, 1 ) );
|
||||
}
|
||||
/*
|
||||
* ldap_delete - initiate an ldap (and X.500) delete operation. Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the object to delete
|
||||
*
|
||||
* Example:
|
||||
* msgid = ldap_delete( ld, dn );
|
||||
*/
|
||||
int
|
||||
ldap_delete( LDAP *ld, LDAP_CONST char *dn )
|
||||
{
|
||||
int msgid;
|
||||
|
||||
/*
|
||||
* A delete request looks like this:
|
||||
* DelRequet ::= DistinguishedName,
|
||||
*/
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
|
||||
|
||||
return ldap_delete_ext( ld, dn, NULL, NULL, &msgid ) == LDAP_SUCCESS
|
||||
? msgid : -1 ;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ldap_delete_s( LDAP *ld, LDAP_CONST char *dn )
|
||||
{
|
||||
return ldap_delete_ext_s( ld, dn, NULL, NULL );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ ldap_err2string( int err )
|
|||
|
||||
/* depreciated */
|
||||
void
|
||||
ldap_perror( LDAP *ld, char *s )
|
||||
ldap_perror( LDAP *ld, LDAP_CONST char *s )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
char *
|
||||
ldap_friendly_name( char *filename, char *uname, LDAPFriendlyMap **map )
|
||||
ldap_friendly_name(
|
||||
LDAP_CONST char *filename,
|
||||
/* LDAP_CONST */ char *uname,
|
||||
LDAPFriendlyMap **map )
|
||||
{
|
||||
int i, entries;
|
||||
FILE *fp;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "ldap-int.h"
|
||||
|
||||
static char **explode_name( char *name, int notypes, int is_dn );
|
||||
static char **explode_name( LDAP_CONST char *name, int notypes, int is_dn );
|
||||
|
||||
char *
|
||||
ldap_get_dn( LDAP *ld, LDAPMessage *entry )
|
||||
|
|
@ -46,7 +46,7 @@ ldap_get_dn( LDAP *ld, LDAPMessage *entry )
|
|||
}
|
||||
|
||||
char *
|
||||
ldap_dn2ufn( char *dn )
|
||||
ldap_dn2ufn( LDAP_CONST char *dn )
|
||||
{
|
||||
char *p, *ufn, *r;
|
||||
int state;
|
||||
|
|
@ -119,37 +119,51 @@ ldap_dn2ufn( char *dn )
|
|||
}
|
||||
|
||||
char **
|
||||
ldap_explode_dns( char *dn )
|
||||
ldap_explode_dns( LDAP_CONST char *dn_in )
|
||||
{
|
||||
int ncomps, maxcomps;
|
||||
char *s;
|
||||
char **rdns;
|
||||
char *tok_r;
|
||||
char *dn;
|
||||
|
||||
if ( (rdns = (char **) malloc( 8 * sizeof(char *) )) == NULL ) {
|
||||
int ncomps;
|
||||
int maxcomps = 8;
|
||||
|
||||
if ( (dn = strdup( dn_in )) == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if ( (rdns = (char **) malloc( maxcomps * sizeof(char *) )) == NULL ) {
|
||||
free( dn );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
maxcomps = 8;
|
||||
ncomps = 0;
|
||||
for ( s = ldap_pvt_strtok( dn, "@.", &tok_r ); s != NULL;
|
||||
s = ldap_pvt_strtok( NULL, "@.", &tok_r ) ) {
|
||||
s = ldap_pvt_strtok( NULL, "@.", &tok_r ) )
|
||||
{
|
||||
if ( ncomps == maxcomps ) {
|
||||
maxcomps *= 2;
|
||||
if ( (rdns = (char **) realloc( rdns, maxcomps *
|
||||
sizeof(char *) )) == NULL ) {
|
||||
return( NULL );
|
||||
sizeof(char *) )) == NULL )
|
||||
{
|
||||
free( dn );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rdns[ncomps++] = strdup( s );
|
||||
}
|
||||
free(dn);
|
||||
|
||||
rdns[ncomps] = NULL;
|
||||
|
||||
/* trim rdns */
|
||||
rdns = (char **) realloc( rdns, (ncomps+1) * sizeof(char*) );
|
||||
return( rdns );
|
||||
}
|
||||
|
||||
char **
|
||||
ldap_explode_dn( char *dn, int notypes )
|
||||
ldap_explode_dn( LDAP_CONST char *dn, int notypes )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_explode_dn\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -160,16 +174,17 @@ ldap_explode_dn( char *dn, int notypes )
|
|||
}
|
||||
|
||||
char **
|
||||
ldap_explode_rdn( char *rdn, int notypes )
|
||||
ldap_explode_rdn( LDAP_CONST char *rdn, int notypes )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_explode_rdn\n", 0, 0, 0 );
|
||||
return explode_name( rdn, notypes, 0 );
|
||||
}
|
||||
|
||||
static char **
|
||||
explode_name( char *name, int notypes, int is_dn )
|
||||
explode_name( LDAP_CONST char *name, int notypes, int is_dn )
|
||||
{
|
||||
char *p, *q, **parts = NULL;
|
||||
const char *p, *q;
|
||||
char **parts = NULL;
|
||||
int state, count = 0, endquote, len;
|
||||
|
||||
p = name-1;
|
||||
|
|
@ -261,7 +276,7 @@ explode_name( char *name, int notypes, int is_dn )
|
|||
|
||||
|
||||
int
|
||||
ldap_is_dns_dn( char *dn )
|
||||
ldap_is_dns_dn( LDAP_CONST char *dn )
|
||||
{
|
||||
return( dn[ 0 ] != '\0' && strchr( dn, '=' ) == NULL &&
|
||||
strchr( dn, ',' ) == NULL );
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ ldap_get_entry_controls(
|
|||
goto cleanup_and_return;
|
||||
}
|
||||
|
||||
rc = ldap_get_ber_controls( &be, serverctrls );
|
||||
rc = ldap_int_get_controls( &be, serverctrls );
|
||||
|
||||
cleanup_and_return:
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
|
|
|
|||
|
|
@ -27,12 +27,15 @@
|
|||
|
||||
#include "ldap-int.h"
|
||||
|
||||
static int break_into_words LDAP_P(( char *str, char *delims, char ***wordsp ));
|
||||
static int break_into_words LDAP_P((
|
||||
/* LDAP_CONST */ char *str,
|
||||
LDAP_CONST char *delims,
|
||||
char ***wordsp ));
|
||||
|
||||
#define FILT_MAX_LINE_LEN 1024
|
||||
|
||||
LDAPFiltDesc *
|
||||
ldap_init_getfilter( char *fname )
|
||||
ldap_init_getfilter( LDAP_CONST char *fname )
|
||||
{
|
||||
FILE *fp;
|
||||
char *buf;
|
||||
|
|
@ -205,7 +208,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
|
|||
|
||||
|
||||
void
|
||||
ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix )
|
||||
ldap_setfilteraffixes( LDAPFiltDesc *lfdp, LDAP_CONST char *prefix, LDAP_CONST char *suffix )
|
||||
{
|
||||
if ( lfdp->lfd_filtprefix != NULL ) {
|
||||
free( lfdp->lfd_filtprefix );
|
||||
|
|
@ -220,7 +223,10 @@ ldap_setfilteraffixes( LDAPFiltDesc *lfdp, char *prefix, char *suffix )
|
|||
|
||||
|
||||
LDAPFiltInfo *
|
||||
ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
|
||||
ldap_getfirstfilter(
|
||||
LDAPFiltDesc *lfdp,
|
||||
/* LDAP_CONST */ char *tagpat,
|
||||
/* LDAP_CONST */ char *value )
|
||||
{
|
||||
LDAPFiltList *flp;
|
||||
int rc;
|
||||
|
|
@ -305,10 +311,18 @@ ldap_getnextfilter( LDAPFiltDesc *lfdp )
|
|||
|
||||
|
||||
void
|
||||
ldap_build_filter( char *filtbuf, unsigned long buflen, char *pattern,
|
||||
char *prefix, char *suffix, char *attr, char *value, char **valwords )
|
||||
ldap_build_filter(
|
||||
char *filtbuf,
|
||||
unsigned long buflen,
|
||||
LDAP_CONST char *pattern,
|
||||
LDAP_CONST char *prefix,
|
||||
LDAP_CONST char *suffix,
|
||||
LDAP_CONST char *attr,
|
||||
LDAP_CONST char *value,
|
||||
char **valwords )
|
||||
{
|
||||
char *p, *f;
|
||||
const char *p;
|
||||
char *f;
|
||||
size_t slen;
|
||||
int i, wordcount, wordnum, endwordnum;
|
||||
|
||||
|
|
@ -401,7 +415,7 @@ ldap_build_filter( char *filtbuf, unsigned long buflen, char *pattern,
|
|||
|
||||
|
||||
static int
|
||||
break_into_words( char *str, char *delims, char ***wordsp )
|
||||
break_into_words( /* LDAP_CONST */ char *str, LDAP_CONST char *delims, char ***wordsp )
|
||||
{
|
||||
char *word, **words;
|
||||
int count;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
char **
|
||||
ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target )
|
||||
ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
|
||||
{
|
||||
BerElement ber;
|
||||
char attr[LDAP_MAX_ATTR_LEN];
|
||||
|
|
@ -70,7 +70,7 @@ ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target )
|
|||
}
|
||||
|
||||
struct berval **
|
||||
ldap_get_values_len( LDAP *ld, LDAPMessage *entry, char *target )
|
||||
ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
|
||||
{
|
||||
BerElement ber;
|
||||
char attr[LDAP_MAX_ATTR_LEN];
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ LDAP_BEGIN_DECL
|
|||
#define LDAP_URL_PREFIX_LEN 7
|
||||
#define LDAP_URL_URLCOLON "URL:"
|
||||
#define LDAP_URL_URLCOLON_LEN 4
|
||||
#define NULLLDAPURLDESC ((LDAPURLDesc *)NULL)
|
||||
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|
||||
#define LDAP_REF_STR "Referral:\n"
|
||||
|
|
@ -73,7 +74,7 @@ struct ldapmsg {
|
|||
struct ldapmsg *lm_next; /* next response */
|
||||
unsigned int lm_time; /* used to maintain cache */
|
||||
};
|
||||
|
||||
#define NULLMSG ((LDAPMessage *)NULL)
|
||||
/*
|
||||
* structure representing get/set'able options
|
||||
* which have global defaults.
|
||||
|
|
@ -95,8 +96,8 @@ struct ldapoptions {
|
|||
int ldo_refhoplimit; /* limit on referral nesting */
|
||||
|
||||
/* LDAPv3 server and client controls */
|
||||
LDAPControl **ldo_server_controls;
|
||||
LDAPControl **ldo_client_controls;
|
||||
LDAPControl **ldo_sctrls;
|
||||
LDAPControl **ldo_cctrls;
|
||||
|
||||
LDAP_BOOLEANS ldo_booleans; /* boolean options */
|
||||
};
|
||||
|
|
@ -201,6 +202,9 @@ struct ldap {
|
|||
#define ld_cldaptimeout ld_options.ldo_cldaptimeout
|
||||
#define ld_refhoplimit ld_options.ldo_refhoplimit
|
||||
|
||||
#define ld_sctrls ld_options.ldo_sctrls
|
||||
#define ld_cctrls ld_options.ldo_cctrls
|
||||
|
||||
int ld_version; /* version connected at */
|
||||
char *ld_host;
|
||||
int ld_port;
|
||||
|
|
@ -257,7 +261,7 @@ void openldap_ldap_initialize LDAP_P((void));
|
|||
/*
|
||||
* in print.c
|
||||
*/
|
||||
int ldap_log_printf LDAP_P((LDAP *ld, int level, char *fmt, ...));
|
||||
int ldap_log_printf LDAP_P((LDAP *ld, int level, const char *fmt, ...));
|
||||
|
||||
/*
|
||||
* in cache.c
|
||||
|
|
@ -270,9 +274,17 @@ int ldap_check_cache LDAP_P(( LDAP *ld, unsigned long msgtype, BerElement *reque
|
|||
/*
|
||||
* in controls.c
|
||||
*/
|
||||
LDAPControl *ldap_control_dup LDAP_P(( LDAPControl *ctrl ));
|
||||
LDAPControl **ldap_controls_dup LDAP_P(( LDAPControl **ctrl ));
|
||||
int ldap_get_ber_controls LDAP_P(( BerElement *be, LDAPControl ***cp));
|
||||
LDAPControl *ldap_control_dup LDAP_P(( const LDAPControl *ctrl ));
|
||||
LDAPControl **ldap_controls_dup LDAP_P(( const LDAPControl **ctrls ));
|
||||
|
||||
int ldap_int_get_controls LDAP_P((
|
||||
BerElement *be,
|
||||
LDAPControl ***cp));
|
||||
|
||||
int ldap_int_put_controls LDAP_P((
|
||||
LDAP *ld,
|
||||
LDAPControl **ctrls,
|
||||
BerElement *ber ));
|
||||
|
||||
/*
|
||||
* in dsparse.c
|
||||
|
|
@ -293,14 +305,14 @@ char *ldap_get_kerberosv4_credentials LDAP_P(( LDAP *ld, char *who, char *servic
|
|||
/*
|
||||
* in open.c
|
||||
*/
|
||||
int open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport,
|
||||
int open_ldap_connection( LDAP *ld, Sockbuf *sb, const char *host, int defport,
|
||||
char **krbinstancep, int async );
|
||||
|
||||
|
||||
/*
|
||||
* in os-ip.c
|
||||
*/
|
||||
int ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, int port,
|
||||
int ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address, int port,
|
||||
int async );
|
||||
void ldap_close_connection( Sockbuf *sb );
|
||||
|
||||
|
|
@ -324,11 +336,12 @@ int ldap_is_write_ready( LDAP *ld, Sockbuf *sb );
|
|||
* in request.c
|
||||
*/
|
||||
int ldap_send_initial_request( LDAP *ld, unsigned long msgtype,
|
||||
char *dn, BerElement *ber );
|
||||
const char *dn, BerElement *ber );
|
||||
BerElement *ldap_alloc_ber_with_options( LDAP *ld );
|
||||
void ldap_set_ber_options( LDAP *ld, BerElement *ber );
|
||||
|
||||
#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS )
|
||||
#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) \
|
||||
|| defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS )
|
||||
int ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid,
|
||||
LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc,
|
||||
int bind );
|
||||
|
|
@ -356,8 +369,9 @@ LDAP_F int cldap_getmsg ( LDAP *ld, struct timeval *timeout, BerElement *ber );
|
|||
/*
|
||||
* in search.c
|
||||
*/
|
||||
BerElement *ldap_build_search_req( LDAP *ld, char *base, int scope,
|
||||
char *filter, char **attrs, int attrsonly );
|
||||
BerElement *ldap_build_search_req( LDAP *ld, const char *base, int scope,
|
||||
const char *filter, char **attrs, int attrsonly,
|
||||
LDAPControl **sctrls, LDAPControl **cctrls );
|
||||
|
||||
/*
|
||||
* in strdup.c
|
||||
|
|
@ -367,14 +381,23 @@ char *ldap_strdup LDAP_P(( const char * ));
|
|||
/*
|
||||
* in unbind.c
|
||||
*/
|
||||
int ldap_ld_free( LDAP *ld, int close );
|
||||
int ldap_send_unbind( LDAP *ld, Sockbuf *sb );
|
||||
int ldap_ld_free LDAP_P((
|
||||
LDAP *ld,
|
||||
int close,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls ));
|
||||
|
||||
int ldap_send_unbind LDAP_P((
|
||||
LDAP *ld,
|
||||
Sockbuf *sb,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls ));
|
||||
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
|
||||
/*
|
||||
* in getdxbyname.c
|
||||
*/
|
||||
char **ldap_getdxbyname( char *domain );
|
||||
char **ldap_getdxbyname( const char *domain );
|
||||
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
|
||||
|
||||
#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ CPP=cl.exe
|
|||
# PROP Intermediate_Dir "Release\libldap"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
|
|
@ -80,8 +80,8 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "libldap_"
|
||||
# PROP Intermediate_Dir "libldap_"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\libldap"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
|
@ -101,11 +101,11 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "libldap0"
|
||||
# PROP Intermediate_Dir "libldap0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\libldap"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
|
|
@ -219,18 +219,6 @@ SOURCE=.\kbind.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\liblber\lber-int.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\lber.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\lber_pvt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\ldap-int.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=ltest - Win32 Debug
|
||||
CFG=ltest - Win32 Single Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,12 +13,16 @@ CFG=ltest - Win32 Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ltest.mak" CFG="ltest - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "ltest.mak" CFG="ltest - Win32 Single Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ltest - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "ltest - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "ltest - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE "ltest - Win32 Single Debug" (based on\
|
||||
"Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -36,11 +40,12 @@ RSC=rc.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release\ltest"
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release\ltest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -48,7 +53,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ltest - Win32 Debug"
|
||||
|
||||
|
|
@ -59,11 +64,12 @@ LINK32=link.exe
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug\ltest"
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug\ltest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -71,7 +77,55 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ltest - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ltest___"
|
||||
# PROP BASE Intermediate_Dir "ltest___"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\ltest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release"
|
||||
# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\SRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ltest - Win32 Single Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "ltest__0"
|
||||
# PROP BASE Intermediate_Dir "ltest__0"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\ltest"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug"
|
||||
# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\SDebug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
|
@ -79,6 +133,8 @@ LINK32=link.exe
|
|||
|
||||
# Name "ltest - Win32 Release"
|
||||
# Name "ltest - Win32 Debug"
|
||||
# Name "ltest - Win32 Single Release"
|
||||
# Name "ltest - Win32 Single Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\test.c
|
||||
|
|
|
|||
|
|
@ -20,13 +20,18 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
/*
|
||||
* ldap_modify - initiate an ldap (and X.500) modify operation. Parameters:
|
||||
* ldap_modify_ext - initiate an ldap extended modify operation.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the object to modify
|
||||
* mods List of modifications to make. This is null-terminated
|
||||
* array of struct ldapmod's, specifying the modifications
|
||||
* to perform.
|
||||
* sctrls Server Controls
|
||||
* cctrls Client Controls
|
||||
* msgidp Message ID pointer
|
||||
*
|
||||
* Example:
|
||||
* LDAPMod *mods[] = {
|
||||
|
|
@ -34,10 +39,15 @@
|
|||
* { LDAP_MOD_REPLACE, "sn", { "jensen", 0 } },
|
||||
* 0
|
||||
* }
|
||||
* msgid = ldap_modify( ld, dn, mods );
|
||||
* rc= ldap_modify_ext( ld, dn, mods, sctrls, cctrls, &msgid );
|
||||
*/
|
||||
int
|
||||
ldap_modify( LDAP *ld, char *dn, LDAPMod **mods )
|
||||
ldap_modify_ext( LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAPMod **mods,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls,
|
||||
int *msgidp )
|
||||
{
|
||||
BerElement *ber;
|
||||
int i, rc;
|
||||
|
|
@ -60,18 +70,18 @@ ldap_modify( LDAP *ld, char *dn, LDAPMod **mods )
|
|||
* }
|
||||
*/
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_modify_ext\n", 0, 0, 0 );
|
||||
|
||||
/* create a message to send */
|
||||
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
return( -1 );
|
||||
return( LDAP_NO_MEMORY );
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "{it{s{", ++ld->ld_msgid, LDAP_REQ_MODIFY, dn )
|
||||
== -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( -1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
/* for each modification to be performed... */
|
||||
|
|
@ -88,28 +98,79 @@ ldap_modify( LDAP *ld, char *dn, LDAPMod **mods )
|
|||
if ( rc == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( -1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "}}}" ) == -1 ) {
|
||||
if ( ber_printf( ber, "}}" ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( -1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
/* Put Server Controls */
|
||||
if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
|
||||
ber_free( ber, 1 );
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "}" ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
/* send the message */
|
||||
return( ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber ));
|
||||
*msgidp = ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber );
|
||||
return( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
|
||||
}
|
||||
|
||||
/*
|
||||
* ldap_modify - initiate an ldap modify operation.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the object to modify
|
||||
* mods List of modifications to make. This is null-terminated
|
||||
* array of struct ldapmod's, specifying the modifications
|
||||
* to perform.
|
||||
*
|
||||
* Example:
|
||||
* LDAPMod *mods[] = {
|
||||
* { LDAP_MOD_ADD, "cn", { "babs jensen", "babs", 0 } },
|
||||
* { LDAP_MOD_REPLACE, "sn", { "jensen", 0 } },
|
||||
* 0
|
||||
* }
|
||||
* msgid = ldap_modify( ld, dn, mods );
|
||||
*/
|
||||
int
|
||||
ldap_modify( LDAP *ld, LDAP_CONST char *dn, LDAPMod **mods )
|
||||
{
|
||||
int rc, msgid;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 );
|
||||
|
||||
rc = ldap_modify_ext( ld, dn, mods, NULL, NULL, &msgid );
|
||||
|
||||
if ( rc != LDAP_SUCCESS )
|
||||
return -1;
|
||||
|
||||
return msgid;
|
||||
}
|
||||
|
||||
int
|
||||
ldap_modify_s( LDAP *ld, char *dn, LDAPMod **mods )
|
||||
ldap_modify_ext_s( LDAP *ld, LDAP_CONST char *dn,
|
||||
LDAPMod **mods, LDAPControl **sctrl, LDAPControl **cctrl )
|
||||
{
|
||||
int rc;
|
||||
int msgid;
|
||||
LDAPMessage *res;
|
||||
|
||||
if ( (msgid = ldap_modify( ld, dn, mods )) == -1 )
|
||||
return( ld->ld_errno );
|
||||
rc = ldap_modify_ext( ld, dn, mods, sctrl, cctrl, &msgid );
|
||||
|
||||
if ( rc != LDAP_SUCCESS )
|
||||
return( rc );
|
||||
|
||||
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res ) == -1 )
|
||||
return( ld->ld_errno );
|
||||
|
|
@ -117,3 +178,9 @@ ldap_modify_s( LDAP *ld, char *dn, LDAPMod **mods )
|
|||
return( ldap_result2error( ld, res, 1 ) );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_modify_s( LDAP *ld, LDAP_CONST char *dn, LDAPMod **mods )
|
||||
{
|
||||
return ldap_modify_ext_s( ld, dn, mods, NULL, NULL );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,21 +33,28 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
/*
|
||||
* ldap_rename2 - initiate an ldap (and X.500) modifyDN operation. Parameters:
|
||||
* (LDAP V3 MODIFYDN REQUEST)
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the object to modify
|
||||
* newrdn RDN to give the object
|
||||
* ldap_rename - initiate an ldap extended modifyDN operation.
|
||||
*
|
||||
* Parameters:
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the object to modify
|
||||
* newrdn RDN to give the object
|
||||
* deleteoldrdn nonzero means to delete old rdn values from the entry
|
||||
* newSuperior DN of the new parent if applicable
|
||||
* newSuperior DN of the new parent if applicable
|
||||
*
|
||||
* Returns the LDAP error code.
|
||||
*/
|
||||
|
||||
int
|
||||
ldap_rename2( LDAP *ld,
|
||||
char *dn,
|
||||
char *newrdn,
|
||||
int deleteoldrdn,
|
||||
char *newSuperior )
|
||||
ldap_rename(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *newrdn,
|
||||
int deleteoldrdn,
|
||||
LDAP_CONST char *newSuperior,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls,
|
||||
int *msgidp )
|
||||
{
|
||||
/*
|
||||
* A modify rdn request looks like this:
|
||||
|
|
@ -59,48 +66,104 @@ ldap_rename2( LDAP *ld,
|
|||
* }
|
||||
*/
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_rename2\n", 0, 0, 0 );
|
||||
BerElement *ber;
|
||||
int rc;
|
||||
|
||||
if( newSuperior != NULL ) {
|
||||
BerElement *ber;
|
||||
|
||||
/* create a message to send */
|
||||
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "{it{ssbts}}",
|
||||
++ld->ld_msgid,
|
||||
LDAP_REQ_MODRDN,
|
||||
dn,
|
||||
newrdn,
|
||||
deleteoldrdn,
|
||||
LDAP_TAG_NEWSUPERIOR,
|
||||
newSuperior )
|
||||
== -1 ) {
|
||||
|
||||
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 );
|
||||
|
||||
} else {
|
||||
|
||||
/* If no newSuperior fall through to ldap_modrdn2() */
|
||||
|
||||
return ldap_modrdn2( ld, dn, newrdn, deleteoldrdn );
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_rename\n", 0, 0, 0 );
|
||||
|
||||
/* create a message to send */
|
||||
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
return( LDAP_NO_MEMORY );
|
||||
}
|
||||
|
||||
}/* int ldap_rename2() */
|
||||
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 );
|
||||
|
||||
} else {
|
||||
rc = ber_printf( ber, "{it{ssb}", /* leave '}' for later */
|
||||
++ld->ld_msgid, LDAP_REQ_MODDN,
|
||||
dn, newrdn, deleteoldrdn );
|
||||
}
|
||||
|
||||
if ( rc < 0 ) {
|
||||
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 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 );
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
* ldap_rename2 uses a U-Mich Style API. It returns the msgid.
|
||||
*/
|
||||
|
||||
int
|
||||
ldap_rename2(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *newrdn,
|
||||
int deleteoldrdn,
|
||||
LDAP_CONST char *newSuperior )
|
||||
{
|
||||
int msgid;
|
||||
int rc;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_rename2\n", 0, 0, 0 );
|
||||
|
||||
rc = ldap_rename( ld, dn, newrdn, deleteoldrdn, newSuperior,
|
||||
NULL, NULL, &msgid );
|
||||
|
||||
return rc == LDAP_SUCCESS ? msgid : -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ldap_modrdn2 - initiate an ldap modifyRDN operation. Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* dn DN of the object to modify
|
||||
|
|
@ -111,85 +174,71 @@ ldap_rename2( LDAP *ld,
|
|||
* msgid = ldap_modrdn( ld, dn, newrdn );
|
||||
*/
|
||||
int
|
||||
ldap_modrdn2( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn )
|
||||
ldap_modrdn2( LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *newrdn,
|
||||
int deleteoldrdn )
|
||||
{
|
||||
BerElement *ber;
|
||||
return ldap_rename2( ld, dn, newrdn, deleteoldrdn, NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
* A modify rdn request looks like this:
|
||||
* ModifyRDNRequest ::= SEQUENCE {
|
||||
* entry DistinguishedName,
|
||||
* newrdn RelativeDistinguishedName,
|
||||
* deleteoldrdn BOOLEAN
|
||||
* }
|
||||
*/
|
||||
int
|
||||
ldap_modrdn( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn )
|
||||
{
|
||||
return( ldap_rename2( ld, dn, newrdn, 1, NULL ) );
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_modrdn\n", 0, 0, 0 );
|
||||
|
||||
/* create a message to send */
|
||||
if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
return( -1 );
|
||||
int
|
||||
ldap_rename_s(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *newrdn,
|
||||
int deleteoldrdn,
|
||||
LDAP_CONST char *newSuperior,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
int rc;
|
||||
int msgid;
|
||||
LDAPMessage *res;
|
||||
|
||||
rc = ldap_rename( ld, dn, newrdn, deleteoldrdn,
|
||||
newSuperior, sctrls, cctrls, &msgid );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
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 );
|
||||
rc = ldap_result( ld, msgid, 1, NULL, &res );
|
||||
|
||||
if( rc == -1 ) {
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
/* send the message */
|
||||
return ( ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber ));
|
||||
return ldap_result2error( ld, res, 1 );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_modrdn( LDAP *ld, char *dn, char *newrdn )
|
||||
ldap_rename2_s(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *dn,
|
||||
LDAP_CONST char *newrdn,
|
||||
int deleteoldrdn,
|
||||
LDAP_CONST char *newSuperior )
|
||||
{
|
||||
return( ldap_modrdn2( ld, dn, newrdn, 1 ) );
|
||||
return ldap_rename_s( ld, dn, newrdn, deleteoldrdn, newSuperior, NULL, NULL );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_rename2_s( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn,
|
||||
char *newSuperior )
|
||||
ldap_modrdn2_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, int deleteoldrdn )
|
||||
{
|
||||
int msgid;
|
||||
LDAPMessage *res;
|
||||
|
||||
|
||||
if ( (msgid = ldap_rename2( ld,
|
||||
dn,
|
||||
newrdn,
|
||||
deleteoldrdn,
|
||||
newSuperior ))
|
||||
== -1 )
|
||||
return( ld->ld_errno );
|
||||
|
||||
if ( ldap_result( ld, msgid, 1, (struct timeval *) NULL, &res )
|
||||
== -1 )
|
||||
return( ld->ld_errno );
|
||||
|
||||
return( ldap_result2error( ld, res, 1 ) );
|
||||
|
||||
return ldap_rename_s( ld, dn, newrdn, deleteoldrdn, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_modrdn2_s( LDAP *ld, char *dn, char *newrdn, int deleteoldrdn )
|
||||
ldap_modrdn_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn )
|
||||
{
|
||||
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_result2error( ld, res, 1 ) );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_modrdn_s( LDAP *ld, char *dn, char *newrdn )
|
||||
{
|
||||
return( ldap_modrdn2_s( ld, dn, newrdn, 1 ) );
|
||||
return ldap_rename_s( ld, dn, newrdn, 1, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
|
||||
LDAP *
|
||||
ldap_open( char *host, int port )
|
||||
ldap_open( LDAP_CONST char *host, int port )
|
||||
{
|
||||
LDAP *ld;
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|
||||
|
|
@ -54,7 +54,7 @@ ldap_open( char *host, int port )
|
|||
NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host =
|
||||
strdup( ld->ld_defhost )) == NULL )) {
|
||||
if(srv != NULL) free( (char*) srv );
|
||||
ldap_ld_free( ld, 0 );
|
||||
ldap_ld_free( ld, 0, NULL, NULL );
|
||||
return( NULL );
|
||||
}
|
||||
srv->lsrv_port = ld->ld_defport;
|
||||
|
|
@ -62,7 +62,7 @@ ldap_open( char *host, int port )
|
|||
if (( ld->ld_defconn = ldap_new_connection( ld, &srv, 1,1,0 )) == NULL ) {
|
||||
if ( ld->ld_defhost != NULL ) free( srv->lsrv_host );
|
||||
free( (char *)srv );
|
||||
ldap_ld_free( ld, 0 );
|
||||
ldap_ld_free( ld, 0, NULL, NULL );
|
||||
return( NULL );
|
||||
}
|
||||
++ld->ld_defconn->lconn_refcnt; /* so it never gets closed/freed */
|
||||
|
|
@ -70,7 +70,7 @@ ldap_open( char *host, int port )
|
|||
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
if ( open_ldap_connection( ld, &ld->ld_sb, ld->ld_defhost,
|
||||
ld->ld_defport, &ld->ld_host, 0 ) < 0 ) {
|
||||
ldap_ld_free( ld, 0 );
|
||||
ldap_ld_free( ld, 0, NULL, NULL );
|
||||
return( NULL );
|
||||
}
|
||||
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
|
|
@ -92,7 +92,7 @@ ldap_open( char *host, int port )
|
|||
* ld = ldap_open( host, port );
|
||||
*/
|
||||
LDAP *
|
||||
ldap_init( char *defhost, int defport )
|
||||
ldap_init( LDAP_CONST char *defhost, int defport )
|
||||
{
|
||||
LDAP *ld;
|
||||
|
||||
|
|
@ -199,20 +199,20 @@ ldap_init( char *defhost, int defport )
|
|||
/* we'll assume we're talking version 2 for now */
|
||||
ld->ld_version = LDAP_VERSION2;
|
||||
|
||||
lber_pvt_sb_init( &(ld->ld_sb) );
|
||||
ber_pvt_sb_init( &(ld->ld_sb) );
|
||||
|
||||
return( ld );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport,
|
||||
open_ldap_connection( LDAP *ld, Sockbuf *sb, const char *host, int defport,
|
||||
char **krbinstancep, int async )
|
||||
{
|
||||
int rc = -1;
|
||||
int port;
|
||||
char *p, *q, *r;
|
||||
char *curhost, hostname[ 2*MAXHOSTNAMELEN ];
|
||||
const char *p, *q;
|
||||
char *r, *curhost, hostname[ 2*MAXHOSTNAMELEN ];
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "open_ldap_connection\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport,
|
|||
++q;
|
||||
}
|
||||
} else {
|
||||
curhost = p; /* avoid copy if possible */
|
||||
curhost = (char *) p; /* avoid copy if possible */
|
||||
q = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport,
|
|||
return( rc );
|
||||
}
|
||||
|
||||
lber_pvt_sb_set_io( sb, &lber_pvt_sb_io_tcp, NULL );
|
||||
ber_pvt_sb_set_io( sb, &ber_pvt_sb_io_tcp, NULL );
|
||||
|
||||
if ( krbinstancep != NULL ) {
|
||||
#ifdef HAVE_KERBEROS
|
||||
|
|
|
|||
|
|
@ -14,32 +14,65 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
static const LDAPAPIFeatureInfo features[] = {
|
||||
#ifdef LDAP_API_FEATURE_INFO
|
||||
{"INFO", LDAP_API_FEATURE_INFO},
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP
|
||||
{ /* OpenLDAP Extensions API Feature */
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
"X_OPENLDAP",
|
||||
LDAP_API_FEATURE_X_OPENLDAP
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_API_FEATURE_THREAD_SAFE
|
||||
{"THREAD_SAFE", LDAP_API_FEATURE_THREAD_SAFE},
|
||||
{ /* Basic Thread Safe */
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
"THREAD_SAFE",
|
||||
LDAP_API_FEATURE_THREAD_SAFE
|
||||
},
|
||||
#endif
|
||||
#ifdef LDAP_API_FEATURE_SESSION_THREAD_SAFE
|
||||
{"SESSION_THREAD_SAFE", LDAP_API_FEATURE_SESSION_THREAD_SAFE},
|
||||
{ /* Session Thread Safe */
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
"SESSION_THREAD_SAFE",
|
||||
LDAP_API_FEATURE_SESSION_THREAD_SAFE
|
||||
},
|
||||
#endif
|
||||
#ifdef LDAP_API_FEATURE_OPERATION_THREAD_SAFE
|
||||
{"OPERATION_THREAD_SAFE", LDAP_API_FEATURE_OPERATION_THREAD_SAFE},
|
||||
{ /* Operation Thread Safe */
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
"OPERATION_THREAD_SAFE",
|
||||
LDAP_API_FEATURE_OPERATION_THREAD_SAFE
|
||||
},
|
||||
#endif
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
|
||||
{"X_OPENLDAP_REENTRANT", LDAP_API_FEATURE_X_OPENLDAP_REENTRANT},
|
||||
{ /* OpenLDAP Reentrant */
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
"X_OPENLDAP_REENTRANT",
|
||||
LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
|
||||
},
|
||||
#endif
|
||||
#if defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ) && \
|
||||
defined( LDAP_THREAD_SAFE )
|
||||
{"X_OPENLDAP_THREAD_SAFE", LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE},
|
||||
{ /* OpenLDAP Thread Safe */
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
"X_OPENLDAP_THREAD_SAFE",
|
||||
LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
|
||||
},
|
||||
#endif
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
|
||||
{"X_OPENLDAP_V2_DNS", LDAP_API_FEATURE_X_OPENLDAP_V2_DNS},
|
||||
{ /* DNS */
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
"X_OPENLDAP_V2_DNS",
|
||||
LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
|
||||
},
|
||||
#endif
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|
||||
{"X_OPENLDAP_V2_REFERRALS", LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS},
|
||||
{ /* V2 Referrals */
|
||||
LDAP_FEATURE_INFO_VERSION,
|
||||
"X_OPENLDAP_V2_REFERRALS",
|
||||
LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|
||||
},
|
||||
#endif
|
||||
{NULL, 0}
|
||||
{0, NULL, 0}
|
||||
};
|
||||
|
||||
int
|
||||
|
|
@ -111,7 +144,7 @@ ldap_get_option(
|
|||
break;
|
||||
}
|
||||
|
||||
* (int *) outvalue = lber_pvt_sb_get_desc( &(ld->ld_sb) );
|
||||
* (int *) outvalue = ber_pvt_sb_get_desc( &(ld->ld_sb) );
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_DEREF:
|
||||
|
|
@ -151,13 +184,13 @@ ldap_get_option(
|
|||
|
||||
case LDAP_OPT_SERVER_CONTROLS:
|
||||
* (LDAPControl ***) outvalue =
|
||||
ldap_controls_dup( lo->ldo_server_controls );
|
||||
ldap_controls_dup( lo->ldo_sctrls );
|
||||
|
||||
return 0;
|
||||
|
||||
case LDAP_OPT_CLIENT_CONTROLS:
|
||||
* (LDAPControl ***) outvalue =
|
||||
ldap_controls_dup( lo->ldo_client_controls );
|
||||
ldap_controls_dup( lo->ldo_cctrls );
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
@ -203,6 +236,13 @@ ldap_get_option(
|
|||
int i;
|
||||
|
||||
if(info == NULL) return -1;
|
||||
|
||||
if(info->ldapaif_info_version != LDAP_FEATURE_INFO_VERSION) {
|
||||
/* api info version mismatch */
|
||||
info->ldapaif_info_version = LDAP_FEATURE_INFO_VERSION;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(info->ldapaif_name == NULL) return -1;
|
||||
|
||||
for(i=0; features[i].ldapaif_name != NULL; i++) {
|
||||
|
|
@ -298,17 +338,17 @@ ldap_set_option(
|
|||
case LDAP_OPT_SERVER_CONTROLS: {
|
||||
LDAPControl **controls = (LDAPControl **) invalue;
|
||||
|
||||
ldap_controls_free( lo->ldo_server_controls );
|
||||
ldap_controls_free( lo->ldo_sctrls );
|
||||
|
||||
if( controls == NULL || *controls == NULL ) {
|
||||
lo->ldo_server_controls = NULL;
|
||||
lo->ldo_sctrls = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lo->ldo_server_controls =
|
||||
lo->ldo_sctrls =
|
||||
ldap_controls_dup( (LDAPControl **) invalue );
|
||||
|
||||
if(lo->ldo_server_controls == NULL) {
|
||||
if(lo->ldo_sctrls == NULL) {
|
||||
/* memory allocation error ? */
|
||||
break;
|
||||
}
|
||||
|
|
@ -317,17 +357,17 @@ ldap_set_option(
|
|||
case LDAP_OPT_CLIENT_CONTROLS: {
|
||||
LDAPControl **controls = (LDAPControl **) invalue;
|
||||
|
||||
ldap_controls_free( lo->ldo_client_controls );
|
||||
ldap_controls_free( lo->ldo_cctrls );
|
||||
|
||||
if( controls == NULL || *controls == NULL ) {
|
||||
lo->ldo_client_controls = NULL;
|
||||
lo->ldo_cctrls = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lo->ldo_client_controls =
|
||||
lo->ldo_cctrls =
|
||||
ldap_controls_dup( (LDAPControl **) invalue );
|
||||
|
||||
if(lo->ldo_client_controls == NULL) {
|
||||
if(lo->ldo_cctrls == NULL) {
|
||||
/* memory allocation error ? */
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include "ldap-int.h"
|
||||
|
||||
int
|
||||
ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
||||
ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address,
|
||||
int port, int async )
|
||||
/*
|
||||
* if host == NULL, connect using address
|
||||
|
|
@ -140,7 +140,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
|||
}
|
||||
}
|
||||
|
||||
lber_pvt_sb_set_desc( sb, s );
|
||||
ber_pvt_sb_set_desc( sb, s );
|
||||
|
||||
if ( connected ) {
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
|||
void
|
||||
ldap_close_connection( Sockbuf *sb )
|
||||
{
|
||||
lber_pvt_sb_close( sb );
|
||||
ber_pvt_sb_close( sb );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ ldap_host_connected_to( Sockbuf *sb )
|
|||
(void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in ));
|
||||
len = sizeof( sin );
|
||||
|
||||
if ( getpeername( lber_pvt_sb_get_desc(sb), (struct sockaddr *)&sin, &len ) == -1 ) {
|
||||
if ( getpeername( ber_pvt_sb_get_desc(sb), (struct sockaddr *)&sin, &len ) == -1 ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ ldap_mark_select_write( LDAP *ld, Sockbuf *sb )
|
|||
|
||||
sip = (struct selectinfo *)ld->ld_selectinfo;
|
||||
|
||||
if ( !FD_ISSET( lber_pvt_sb_get_desc(sb), &sip->si_writefds )) {
|
||||
if ( !FD_ISSET( ber_pvt_sb_get_desc(sb), &sip->si_writefds )) {
|
||||
FD_SET( (u_int) sb->sb_sd, &sip->si_writefds );
|
||||
}
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ ldap_mark_select_read( LDAP *ld, Sockbuf *sb )
|
|||
|
||||
sip = (struct selectinfo *)ld->ld_selectinfo;
|
||||
|
||||
if ( !FD_ISSET( lber_pvt_sb_get_desc(sb), &sip->si_readfds )) {
|
||||
if ( !FD_ISSET( ber_pvt_sb_get_desc(sb), &sip->si_readfds )) {
|
||||
FD_SET( (u_int) sb->sb_sd, &sip->si_readfds );
|
||||
}
|
||||
}
|
||||
|
|
@ -259,8 +259,8 @@ ldap_mark_select_clear( LDAP *ld, Sockbuf *sb )
|
|||
|
||||
sip = (struct selectinfo *)ld->ld_selectinfo;
|
||||
|
||||
FD_CLR( (u_int) lber_pvt_sb_get_desc(sb), &sip->si_writefds );
|
||||
FD_CLR( (u_int) lber_pvt_sb_get_desc(sb), &sip->si_readfds );
|
||||
FD_CLR( (u_int) ber_pvt_sb_get_desc(sb), &sip->si_writefds );
|
||||
FD_CLR( (u_int) ber_pvt_sb_get_desc(sb), &sip->si_readfds );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ ldap_is_write_ready( LDAP *ld, Sockbuf *sb )
|
|||
|
||||
sip = (struct selectinfo *)ld->ld_selectinfo;
|
||||
|
||||
return( FD_ISSET( lber_pvt_sb_get_desc(sb), &sip->si_use_writefds ));
|
||||
return( FD_ISSET( ber_pvt_sb_get_desc(sb), &sip->si_use_writefds ));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ ldap_is_read_ready( LDAP *ld, Sockbuf *sb )
|
|||
|
||||
sip = (struct selectinfo *)ld->ld_selectinfo;
|
||||
|
||||
return( FD_ISSET( lber_pvt_sb_get_desc(sb), &sip->si_use_readfds ));
|
||||
return( FD_ISSET( ber_pvt_sb_get_desc(sb), &sip->si_use_readfds ));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ static int ldap_log_check( LDAP *ld, int loglvl )
|
|||
|
||||
int ldap_log_printf
|
||||
#ifdef HAVE_STDARG
|
||||
( LDAP *ld, int loglvl, char *fmt, ... )
|
||||
( LDAP *ld, int loglvl, const char *fmt, ... )
|
||||
#else
|
||||
( va_alist )
|
||||
va_dcl
|
||||
|
|
@ -72,6 +72,6 @@ va_dcl
|
|||
|
||||
va_end(ap);
|
||||
|
||||
(*lber_pvt_log_print)( buf );
|
||||
(*ber_pvt_log_print)( buf );
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ ldap_parse_reference(
|
|||
goto free_and_return;
|
||||
}
|
||||
|
||||
rc = ldap_get_ber_controls( &be, serverctrls );
|
||||
rc = ldap_int_get_controls( &be, serverctrls );
|
||||
|
||||
free_and_return:
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ ldap_alloc_ber_with_options( LDAP *ld )
|
|||
{
|
||||
BerElement *ber;
|
||||
|
||||
if (( ber = ber_alloc_t( ld->ld_lberoptions )) == NULLBER ) {
|
||||
if (( ber = ber_alloc_t( ld->ld_lberoptions )) == NULLBER ) {
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
#ifdef STR_TRANSLATION
|
||||
} else {
|
||||
|
|
@ -72,7 +72,10 @@ ldap_set_ber_options( LDAP *ld, BerElement *ber )
|
|||
|
||||
|
||||
int
|
||||
ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
|
||||
ldap_send_initial_request(
|
||||
LDAP *ld,
|
||||
unsigned long msgtype,
|
||||
const char *dn,
|
||||
BerElement *ber )
|
||||
{
|
||||
#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS )
|
||||
|
|
@ -81,7 +84,7 @@ ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
|
|||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 );
|
||||
|
||||
if ( ! lber_pvt_sb_in_use(&ld->ld_sb ) ) {
|
||||
if ( ! ber_pvt_sb_in_use(&ld->ld_sb ) ) {
|
||||
/* not connected yet */
|
||||
|
||||
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|
||||
|
|
@ -300,7 +303,7 @@ ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
|
|||
* XXX open connection synchronously for now
|
||||
*/
|
||||
if (( lc = (LDAPConn *)calloc( 1, sizeof( LDAPConn ))) == NULL ||
|
||||
( !use_ldsb && ( (sb = lber_pvt_sb_alloc()) == NULL ))) {
|
||||
( !use_ldsb && ( (sb = ber_sockbuf_alloc()) == NULL ))) {
|
||||
if ( lc != NULL ) {
|
||||
free( (char *)lc );
|
||||
}
|
||||
|
|
@ -324,7 +327,7 @@ ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
|
|||
|
||||
if ( srv == NULL ) {
|
||||
if ( !use_ldsb ) {
|
||||
lber_pvt_sb_free( lc->lconn_sb );
|
||||
ber_sockbuf_free( lc->lconn_sb );
|
||||
}
|
||||
free( (char *)lc );
|
||||
ld->ld_errno = LDAP_SERVER_DOWN;
|
||||
|
|
@ -444,10 +447,10 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
|
|||
if ( lc->lconn_status == LDAP_CONNST_CONNECTED ) {
|
||||
ldap_mark_select_clear( ld, lc->lconn_sb );
|
||||
if ( unbind ) {
|
||||
ldap_send_unbind( ld, lc->lconn_sb );
|
||||
ldap_send_unbind( ld, lc->lconn_sb, NULL, NULL );
|
||||
}
|
||||
ldap_close_connection( lc->lconn_sb );
|
||||
lber_pvt_sb_destroy( lc->lconn_sb );
|
||||
ber_pvt_sb_destroy( lc->lconn_sb );
|
||||
ber_clear( &lc->lconn_ber, 1 );
|
||||
}
|
||||
prevlc = NULL;
|
||||
|
|
@ -468,7 +471,7 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
|
|||
free( lc->lconn_krbinstance );
|
||||
}
|
||||
if ( lc->lconn_sb != &ld->ld_sb ) {
|
||||
lber_pvt_sb_free( lc->lconn_sb );
|
||||
ber_sockbuf_free( lc->lconn_sb );
|
||||
}
|
||||
free( lc );
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: actually freed\n",
|
||||
|
|
@ -878,7 +881,7 @@ re_encode_request( LDAP *ld, BerElement *origber, int msgid, char **dnp )
|
|||
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "re_encode_request new request is:\n",
|
||||
0, 0, 0 );
|
||||
lber_log_dump( LDAP_DEBUG_BER, ldap_debug, ber, 0 );
|
||||
ber_log_dump( LDAP_DEBUG_BER, ldap_debug, ber, 0 );
|
||||
}
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
|
|||
while ( rc == -2 ) {
|
||||
#ifndef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|
||||
/* hack attack */
|
||||
if ( ! lber_pvt_sb_data_ready(&ld->ld_sb) ) {
|
||||
if ( ! ber_pvt_sb_data_ready(&ld->ld_sb) ) {
|
||||
rc = ldap_select1( ld, tvp );
|
||||
|
||||
if ( rc == 0 || ( rc == -1 && (
|
||||
|
|
@ -192,7 +192,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
|
|||
}
|
||||
#endif /* LDAP_DEBUG */
|
||||
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
|
||||
if ( lber_pvt_sb_data_ready(lc->lconn_sb) ) {
|
||||
if ( ber_pvt_sb_data_ready(lc->lconn_sb) ) {
|
||||
rc = try_read1msg( ld, msgid, all, lc->lconn_sb,
|
||||
lc, result );
|
||||
break;
|
||||
|
|
@ -578,7 +578,7 @@ merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )
|
|||
}
|
||||
parentr->lr_res_error = lr->lr_res_error;
|
||||
lr->lr_res_error = NULL;
|
||||
if ( NAME_ERROR( lr->lr_res_errno )) {
|
||||
if ( LDAP_NAME_ERROR( lr->lr_res_errno )) {
|
||||
if ( parentr->lr_res_matched != NULL ) {
|
||||
free( parentr->lr_res_matched );
|
||||
}
|
||||
|
|
@ -622,7 +622,7 @@ ldap_select1( LDAP *ld, struct timeval *timeout )
|
|||
}
|
||||
|
||||
FD_ZERO( &readfds );
|
||||
FD_SET( lber_pvt_sb_get_desc(&ld->ld_sb), &readfds );
|
||||
FD_SET( ber_pvt_sb_get_desc(&ld->ld_sb), &readfds );
|
||||
|
||||
return( select( tblsize, &readfds, 0, 0, timeout ) );
|
||||
}
|
||||
|
|
@ -744,7 +744,7 @@ cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber )
|
|||
int rc;
|
||||
unsigned long tag, len;
|
||||
|
||||
if ( ! lber_pvt_sb_data_ready(&ld->ld_sb) ) {
|
||||
if ( ! ber_pvt_sb_data_ready(&ld->ld_sb) ) {
|
||||
rc = ldap_select1( ld, timeout );
|
||||
if ( rc == -1 || rc == 0 ) {
|
||||
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
int
|
||||
ldap_simple_bind( LDAP *ld, char *dn, char *passwd )
|
||||
ldap_simple_bind( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd )
|
||||
{
|
||||
BerElement *ber;
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ ldap_simple_bind( LDAP *ld, char *dn, char *passwd )
|
|||
*/
|
||||
|
||||
int
|
||||
ldap_simple_bind_s( LDAP *ld, char *dn, char *passwd )
|
||||
ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd )
|
||||
{
|
||||
int msgid;
|
||||
LDAPMessage *result;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ static int put_substring_filter LDAP_P(( BerElement *ber, char *type, char *str
|
|||
static int put_filter_list LDAP_P(( BerElement *ber, char *str ));
|
||||
|
||||
/*
|
||||
* ldap_search - initiate an ldap (and X.500) search operation. Parameters:
|
||||
* ldap_search - initiate an ldap search operation.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* ld LDAP descriptor
|
||||
* base DN of the base object
|
||||
|
|
@ -47,7 +49,7 @@ static int put_filter_list LDAP_P(( BerElement *ber, char *str ));
|
|||
* attrs, attrsonly );
|
||||
*/
|
||||
int
|
||||
ldap_search( LDAP *ld, char *base, int scope, char *filter,
|
||||
ldap_search( LDAP *ld, LDAP_CONST char *base, int scope, LDAP_CONST char *filter,
|
||||
char **attrs, int attrsonly )
|
||||
{
|
||||
BerElement *ber;
|
||||
|
|
@ -55,7 +57,7 @@ ldap_search( LDAP *ld, char *base, int scope, char *filter,
|
|||
Debug( LDAP_DEBUG_TRACE, "ldap_search\n", 0, 0, 0 );
|
||||
|
||||
if (( ber = ldap_build_search_req( ld, base, scope, filter, attrs,
|
||||
attrsonly )) == NULLBER ) {
|
||||
attrsonly, NULL, NULL )) == NULLBER ) {
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
|
@ -76,11 +78,20 @@ ldap_search( LDAP *ld, char *base, int scope, char *filter,
|
|||
|
||||
|
||||
BerElement *
|
||||
ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter,
|
||||
char **attrs, int attrsonly )
|
||||
ldap_build_search_req(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *base_in,
|
||||
int scope,
|
||||
LDAP_CONST char *filter_in,
|
||||
char **attrs,
|
||||
int attrsonly,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
BerElement *ber;
|
||||
int err;
|
||||
char *base;
|
||||
char *filter;
|
||||
|
||||
/*
|
||||
* Create the search request. It looks like this:
|
||||
|
|
@ -111,9 +122,11 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter,
|
|||
return( NULLBER );
|
||||
}
|
||||
|
||||
if ( base == NULL ) {
|
||||
if ( base_in == NULL ) {
|
||||
/* no base provided, use session default base */
|
||||
base = ld->ld_options.ldo_defbase;
|
||||
} else {
|
||||
base = (char *) base_in;
|
||||
}
|
||||
|
||||
if ( base == NULL ) {
|
||||
|
|
@ -141,7 +154,7 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter,
|
|||
return( NULLBER );
|
||||
}
|
||||
|
||||
filter = strdup( filter );
|
||||
filter = strdup( filter_in );
|
||||
err = put_filter( ber, filter );
|
||||
free( filter );
|
||||
|
||||
|
|
@ -151,7 +164,19 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter,
|
|||
return( NULLBER );
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "{v}}}", attrs ) == -1 ) {
|
||||
if ( ber_printf( ber, "{v}}", attrs ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( NULLBER );
|
||||
}
|
||||
|
||||
/* Put Server Controls */
|
||||
if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
|
||||
ber_free( ber, 1 );
|
||||
return( NULLBER );
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "}", attrs ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( NULLBER );
|
||||
|
|
@ -519,7 +544,9 @@ put_substring_filter( BerElement *ber, char *type, char *val )
|
|||
}
|
||||
|
||||
int
|
||||
ldap_search_st( LDAP *ld, char *base, int scope, char *filter, char **attrs,
|
||||
ldap_search_st(
|
||||
LDAP *ld, LDAP_CONST char *base, int scope,
|
||||
LDAP_CONST char *filter, char **attrs,
|
||||
int attrsonly, struct timeval *timeout, LDAPMessage **res )
|
||||
{
|
||||
int msgid;
|
||||
|
|
@ -541,8 +568,14 @@ ldap_search_st( LDAP *ld, char *base, int scope, char *filter, char **attrs,
|
|||
}
|
||||
|
||||
int
|
||||
ldap_search_s( LDAP *ld, char *base, int scope, char *filter, char **attrs,
|
||||
int attrsonly, LDAPMessage **res )
|
||||
ldap_search_s(
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *base,
|
||||
int scope,
|
||||
LDAP_CONST char *filter,
|
||||
char **attrs,
|
||||
int attrsonly,
|
||||
LDAPMessage **res )
|
||||
{
|
||||
int msgid;
|
||||
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ int
|
|||
ldap_sort_entries(
|
||||
LDAP *ld,
|
||||
LDAPMessage **chain,
|
||||
char *attr, /* NULL => sort by DN */
|
||||
int (*cmp) (const char *, const char *)
|
||||
LDAP_CONST char *attr, /* NULL => sort by DN */
|
||||
int (*cmp) (LDAP_CONST char *, LDAP_CONST char *)
|
||||
)
|
||||
{
|
||||
int i, count;
|
||||
|
|
|
|||
|
|
@ -217,7 +217,8 @@ ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix,
|
|||
}
|
||||
|
||||
int
|
||||
ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly,
|
||||
ldap_ufn_search_ct(
|
||||
LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly,
|
||||
LDAPMessage **res, cancelptype cancelproc, void *cancelparm,
|
||||
char *tag1, char *tag2, char *tag3 )
|
||||
{
|
||||
|
|
@ -302,7 +303,8 @@ ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly,
|
|||
* ldapfilter.conf tags.
|
||||
*/
|
||||
int
|
||||
ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs, int attrsonly,
|
||||
ldap_ufn_search_c(
|
||||
LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly,
|
||||
LDAPMessage **res, cancelptype cancelproc, void *cancelparm )
|
||||
{
|
||||
return( ldap_ufn_search_ct( ld, ufn, attrs, attrsonly, res, cancelproc,
|
||||
|
|
@ -313,7 +315,8 @@ ldap_ufn_search_c( LDAP *ld, char *ufn, char **attrs, int attrsonly,
|
|||
* same as ldap_ufn_search_c without the cancel function
|
||||
*/
|
||||
int
|
||||
ldap_ufn_search_s( LDAP *ld, char *ufn, char **attrs, int attrsonly,
|
||||
ldap_ufn_search_s(
|
||||
LDAP *ld, LDAP_CONST char *ufn, char **attrs, int attrsonly,
|
||||
LDAPMessage **res )
|
||||
{
|
||||
struct timeval tv;
|
||||
|
|
@ -459,7 +462,7 @@ ldap_ufn_expand( LDAP *ld, cancelptype cancelproc, void *cancelparm,
|
|||
*/
|
||||
|
||||
LDAPFiltDesc *
|
||||
ldap_ufn_setfilter( LDAP *ld, char *fname )
|
||||
ldap_ufn_setfilter( LDAP *ld, LDAP_CONST char *fname )
|
||||
{
|
||||
if ( ld->ld_filtd != NULL )
|
||||
ldap_getfilter_free( ld->ld_filtd );
|
||||
|
|
@ -468,7 +471,7 @@ ldap_ufn_setfilter( LDAP *ld, char *fname )
|
|||
}
|
||||
|
||||
void
|
||||
ldap_ufn_setprefix( LDAP *ld, char *prefix )
|
||||
ldap_ufn_setprefix( LDAP *ld, LDAP_CONST char *prefix )
|
||||
{
|
||||
if ( ld->ld_ufnprefix != NULL )
|
||||
free( ld->ld_ufnprefix );
|
||||
|
|
|
|||
|
|
@ -20,18 +20,30 @@
|
|||
|
||||
#include "ldap-int.h"
|
||||
|
||||
int
|
||||
ldap_unbind_ext(
|
||||
LDAP *ld,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
return ldap_ld_free( ld, 1, sctrls, cctrls );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_unbind( LDAP *ld )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_unbind\n", 0, 0, 0 );
|
||||
|
||||
return( ldap_ld_free( ld, 1 ));
|
||||
return( ldap_unbind_ext( ld, NULL, NULL ) );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ldap_ld_free( LDAP *ld, int close )
|
||||
ldap_ld_free(
|
||||
LDAP *ld,
|
||||
int close,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
LDAPMessage *lm, *next;
|
||||
int err = LDAP_SUCCESS;
|
||||
|
|
@ -53,7 +65,7 @@ ldap_ld_free( LDAP *ld, int close )
|
|||
}
|
||||
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
if ( close ) {
|
||||
err = ldap_send_unbind( ld, &ld->ld_sb );
|
||||
err = ldap_send_unbind( ld, &ld->ld_sb, sctrls, cctrls );
|
||||
ldap_close_connection( &ld->ld_sb );
|
||||
}
|
||||
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
|
|
@ -101,7 +113,7 @@ ldap_ld_free( LDAP *ld, int close )
|
|||
if ( ld->ld_options.ldo_defhost != NULL )
|
||||
free( ld->ld_options.ldo_defhost );
|
||||
|
||||
lber_pvt_sb_destroy( &(ld->ld_sb) );
|
||||
ber_pvt_sb_destroy( &(ld->ld_sb) );
|
||||
|
||||
free( (char *) ld );
|
||||
|
||||
|
|
@ -113,12 +125,16 @@ ldap_ld_free( LDAP *ld, int close )
|
|||
int
|
||||
ldap_unbind_s( LDAP *ld )
|
||||
{
|
||||
return( ldap_ld_free( ld, 1 ));
|
||||
return( ldap_unbind_ext( ld, NULL, NULL ) );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ldap_send_unbind( LDAP *ld, Sockbuf *sb )
|
||||
ldap_send_unbind(
|
||||
LDAP *ld,
|
||||
Sockbuf *sb,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
BerElement *ber;
|
||||
|
||||
|
|
@ -130,7 +146,20 @@ ldap_send_unbind( LDAP *ld, Sockbuf *sb )
|
|||
}
|
||||
|
||||
/* fill it in */
|
||||
if ( ber_printf( ber, "{itn}", ++ld->ld_msgid,
|
||||
if ( ber_printf( ber, "{itn", ++ld->ld_msgid,
|
||||
LDAP_REQ_UNBIND ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
/* Put Server Controls */
|
||||
if( ldap_int_put_controls( ld, sctrls, ber ) != LDAP_SUCCESS ) {
|
||||
ber_free( ber, 1 );
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
if ( ber_printf( ber, "}", ++ld->ld_msgid,
|
||||
LDAP_REQ_UNBIND ) == -1 ) {
|
||||
ld->ld_errno = LDAP_ENCODING_ERROR;
|
||||
ber_free( ber, 1 );
|
||||
|
|
|
|||
|
|
@ -35,60 +35,65 @@
|
|||
|
||||
|
||||
/* local functions */
|
||||
static int skip_url_prefix LDAP_P(( char **urlp, int *enclosedp ));
|
||||
static const char* skip_url_prefix LDAP_P(( const char *url, int *enclosedp ));
|
||||
static void hex_unescape LDAP_P(( char *s ));
|
||||
static int unhex( char c );
|
||||
|
||||
|
||||
int
|
||||
ldap_is_ldap_url( char *url )
|
||||
ldap_is_ldap_url( LDAP_CONST char *url )
|
||||
{
|
||||
int enclosed;
|
||||
|
||||
return( url != NULL && skip_url_prefix( &url, &enclosed ));
|
||||
return( url != NULL && skip_url_prefix( url, &enclosed ) != NULL );
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
skip_url_prefix( char **urlp, int *enclosedp )
|
||||
static const char*
|
||||
skip_url_prefix( const char *url, int *enclosedp )
|
||||
{
|
||||
/*
|
||||
* return non-zero if this looks like a LDAP URL; zero if not
|
||||
* if non-zero returned, *urlp will be moved past "ldap://" part of URL
|
||||
*/
|
||||
if ( *urlp == NULL ) {
|
||||
return( 0 );
|
||||
char* p;
|
||||
|
||||
if ( url == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
p = (char *) url;
|
||||
|
||||
/* skip leading '<' (if any) */
|
||||
if ( **urlp == '<' ) {
|
||||
if ( *p == '<' ) {
|
||||
*enclosedp = 1;
|
||||
++*urlp;
|
||||
++p;
|
||||
} else {
|
||||
*enclosedp = 0;
|
||||
}
|
||||
|
||||
/* skip leading "URL:" (if any) */
|
||||
if ( strlen( *urlp ) >= LDAP_URL_URLCOLON_LEN && strncasecmp(
|
||||
*urlp, LDAP_URL_URLCOLON, LDAP_URL_URLCOLON_LEN ) == 0 ) {
|
||||
*urlp += LDAP_URL_URLCOLON_LEN;
|
||||
if ( strlen( p ) >= LDAP_URL_URLCOLON_LEN
|
||||
&& strncasecmp( p, LDAP_URL_URLCOLON, LDAP_URL_URLCOLON_LEN ) == 0 )
|
||||
{
|
||||
p += LDAP_URL_URLCOLON_LEN;
|
||||
}
|
||||
|
||||
/* check for missing "ldap://" prefix */
|
||||
if ( strlen( *urlp ) < LDAP_URL_PREFIX_LEN ||
|
||||
strncasecmp( *urlp, LDAP_URL_PREFIX, LDAP_URL_PREFIX_LEN ) != 0 ) {
|
||||
return( 0 );
|
||||
if ( strlen( p ) < LDAP_URL_PREFIX_LEN ||
|
||||
strncasecmp( p, LDAP_URL_PREFIX, LDAP_URL_PREFIX_LEN ) != 0 ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
/* skip over "ldap://" prefix and return success */
|
||||
*urlp += LDAP_URL_PREFIX_LEN;
|
||||
return( 1 );
|
||||
p += LDAP_URL_PREFIX_LEN;
|
||||
return( p );
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
ldap_url_parse( char *url, LDAPURLDesc **ludpp )
|
||||
ldap_url_parse( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
|
||||
{
|
||||
/*
|
||||
* Pick apart the pieces of an LDAP URL.
|
||||
|
|
@ -97,26 +102,32 @@ ldap_url_parse( char *url, LDAPURLDesc **ludpp )
|
|||
LDAPURLDesc *ludp;
|
||||
char *attrs, *p, *q;
|
||||
int enclosed, i, nattrs;
|
||||
const char *url_tmp;
|
||||
char *url;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_url_parse(%s)\n", url, 0, 0 );
|
||||
|
||||
*ludpp = NULL; /* pessimistic */
|
||||
|
||||
if ( !skip_url_prefix( &url, &enclosed )) {
|
||||
url_tmp = skip_url_prefix( url_in, &enclosed );
|
||||
|
||||
if ( url_tmp == NULL ) {
|
||||
return( LDAP_URL_ERR_NOTLDAP );
|
||||
}
|
||||
|
||||
/* make working copy of the remainder of the URL */
|
||||
if (( url = strdup( url_tmp )) == NULL ) {
|
||||
return( LDAP_URL_ERR_MEM );
|
||||
}
|
||||
|
||||
/* allocate return struct */
|
||||
if (( ludp = (LDAPURLDesc *)calloc( 1, sizeof( LDAPURLDesc )))
|
||||
== NULLLDAPURLDESC ) {
|
||||
== NULLLDAPURLDESC )
|
||||
{
|
||||
free( url );
|
||||
return( LDAP_URL_ERR_MEM );
|
||||
}
|
||||
|
||||
/* make working copy of the remainder of the URL */
|
||||
if (( url = strdup( url )) == NULL ) {
|
||||
ldap_free_urldesc( ludp );
|
||||
return( LDAP_URL_ERR_MEM );
|
||||
}
|
||||
|
||||
if ( enclosed && *((p = url + strlen( url ) - 1)) == '>' ) {
|
||||
*p = '\0';
|
||||
|
|
@ -239,7 +250,7 @@ ldap_free_urldesc( LDAPURLDesc *ludp )
|
|||
|
||||
|
||||
int
|
||||
ldap_url_search( LDAP *ld, char *url, int attrsonly )
|
||||
ldap_url_search( LDAP *ld, LDAP_CONST char *url, int attrsonly )
|
||||
{
|
||||
int err;
|
||||
LDAPURLDesc *ludp;
|
||||
|
|
@ -254,7 +265,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
|
|||
}
|
||||
|
||||
if (( ber = ldap_build_search_req( ld, ludp->lud_dn, ludp->lud_scope,
|
||||
ludp->lud_filter, ludp->lud_attrs, attrsonly )) == NULLBER ) {
|
||||
ludp->lud_filter, ludp->lud_attrs, attrsonly, NULL, NULL )) == NULLBER ) {
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +285,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
|
|||
if ( ludp->lud_port == 0 ) {
|
||||
srv->lsrv_port = openldap_ldap_global_options.ldo_defport;
|
||||
} else {
|
||||
srv->lsrv_port = ludp->lud_port;
|
||||
srv->lsrv_port = ludp->lud_port;
|
||||
}
|
||||
}
|
||||
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
|
||||
|
|
@ -302,7 +313,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
|
|||
|
||||
|
||||
int
|
||||
ldap_url_search_st( LDAP *ld, char *url, int attrsonly,
|
||||
ldap_url_search_st( LDAP *ld, LDAP_CONST char *url, int attrsonly,
|
||||
struct timeval *timeout, LDAPMessage **res )
|
||||
{
|
||||
int msgid;
|
||||
|
|
@ -326,7 +337,8 @@ ldap_url_search_st( LDAP *ld, char *url, int attrsonly,
|
|||
|
||||
|
||||
int
|
||||
ldap_url_search_s( LDAP *ld, char *url, int attrsonly, LDAPMessage **res )
|
||||
ldap_url_search_s(
|
||||
LDAP *ld, LDAP_CONST char *url, int attrsonly, LDAPMessage **res )
|
||||
{
|
||||
int msgid;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=libldap_r - Win32 Debug
|
||||
CFG=libldap_r - Win32 Single Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,12 +13,16 @@ CFG=libldap_r - Win32 Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "libldap_r.mak" CFG="libldap_r - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "libldap_r.mak" CFG="libldap_r - Win32 Single Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "libldap_r - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libldap_r - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libldap_r - Win32 Single Debug" (based on\
|
||||
"Win32 (x86) Static Library")
|
||||
!MESSAGE "libldap_r - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -36,10 +40,10 @@ CPP=cl.exe
|
|||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release\libldap_r"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
|
|
@ -57,10 +61,10 @@ LIB32=link.exe -lib
|
|||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug\libldap_r"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "_DEBUG" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
|
|
@ -68,12 +72,56 @@ LIB32=link.exe -lib
|
|||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\Debug\oldap_r.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "libldap_r - Win32 Single Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "libldap_"
|
||||
# PROP BASE Intermediate_Dir "libldap_"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\libldap_r"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "_DEBUG" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "_DEBUG" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo /out:"..\Debug\oldap_r.lib"
|
||||
# ADD LIB32 /nologo /out:"..\SDebug\oldap_r.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "libldap_r - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "libldap0"
|
||||
# PROP BASE Intermediate_Dir "libldap0"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\libldap_r"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "LDAP_R_COMPILE" /D "WIN32" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo /out:"..\Release\oldap_r.lib"
|
||||
# ADD LIB32 /nologo /out:"..\SRelease\oldap_r.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "libldap_r - Win32 Release"
|
||||
# Name "libldap_r - Win32 Debug"
|
||||
# Name "libldap_r - Win32 Single Debug"
|
||||
# Name "libldap_r - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libldap\abandon.c
|
||||
|
|
@ -172,18 +220,6 @@ SOURCE=..\libldap\kbind.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\liblber\lber-int.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\lber.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\lber_pvt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\libldap\ldap-int.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
@ -208,7 +244,7 @@ SOURCE=..\..\include\ldap_pvt.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldapconfig.h
|
||||
SOURCE=..\..\include\ldap_pvt_thread.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
|
@ -232,10 +268,6 @@ SOURCE="..\libldap\os-ip.c"
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\portable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libldap\print.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
int
|
||||
ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw )
|
||||
{
|
||||
assert( rw != NULL );
|
||||
|
||||
memset( rw, 0, sizeof(ldap_pvt_thread_rdwr_t) );
|
||||
|
||||
/* we should check return results */
|
||||
|
|
@ -41,6 +43,9 @@ ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw )
|
|||
int
|
||||
ldap_pvt_thread_rdwr_destroy( ldap_pvt_thread_rdwr_t *rw )
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
|
||||
return LDAP_PVT_THREAD_EINVAL;
|
||||
|
||||
|
|
@ -71,6 +76,9 @@ ldap_pvt_thread_rdwr_destroy( ldap_pvt_thread_rdwr_t *rw )
|
|||
|
||||
int ldap_pvt_thread_rdwr_rlock( ldap_pvt_thread_rdwr_t *rw )
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
|
||||
return LDAP_PVT_THREAD_EINVAL;
|
||||
|
||||
|
|
@ -98,6 +106,9 @@ int ldap_pvt_thread_rdwr_rlock( ldap_pvt_thread_rdwr_t *rw )
|
|||
|
||||
int ldap_pvt_thread_rdwr_rtrylock( ldap_pvt_thread_rdwr_t *rw )
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
|
||||
return LDAP_PVT_THREAD_EINVAL;
|
||||
|
||||
|
|
@ -117,6 +128,9 @@ int ldap_pvt_thread_rdwr_rtrylock( ldap_pvt_thread_rdwr_t *rw )
|
|||
|
||||
int ldap_pvt_thread_rdwr_runlock( ldap_pvt_thread_rdwr_t *rw )
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
|
||||
return LDAP_PVT_THREAD_EINVAL;
|
||||
|
||||
|
|
@ -135,6 +149,9 @@ int ldap_pvt_thread_rdwr_runlock( ldap_pvt_thread_rdwr_t *rw )
|
|||
|
||||
int ldap_pvt_thread_rdwr_wlock( ldap_pvt_thread_rdwr_t *rw )
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
|
||||
return LDAP_PVT_THREAD_EINVAL;
|
||||
|
||||
|
|
@ -160,6 +177,9 @@ int ldap_pvt_thread_rdwr_wlock( ldap_pvt_thread_rdwr_t *rw )
|
|||
|
||||
int ldap_pvt_thread_rdwr_wtrylock( ldap_pvt_thread_rdwr_t *rw )
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
|
||||
return LDAP_PVT_THREAD_EINVAL;
|
||||
|
||||
|
|
@ -179,6 +199,9 @@ int ldap_pvt_thread_rdwr_wtrylock( ldap_pvt_thread_rdwr_t *rw )
|
|||
|
||||
int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw )
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
if( rw->ltrw_valid != LDAP_PVT_THREAD_RDWR_VALID )
|
||||
return LDAP_PVT_THREAD_EINVAL;
|
||||
|
||||
|
|
@ -212,16 +235,25 @@ int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw )
|
|||
|
||||
int ldap_pvt_thread_rdwr_readers(ldap_pvt_thread_rdwr_t *rw)
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
return( rw->ltrw_r_active );
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_rdwr_writers(ldap_pvt_thread_rdwr_t *rw)
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
return( rw->ltrw_w_active );
|
||||
}
|
||||
|
||||
int ldap_pvt_thread_rdwr_active(ldap_pvt_thread_rdwr_t *rw)
|
||||
{
|
||||
assert( rw != NULL );
|
||||
assert( rw->ltrw_valid == LDAP_PVT_THREAD_RDWR_VALID );
|
||||
|
||||
return(ldap_pvt_thread_rdwr_readers(rw) +
|
||||
ldap_pvt_thread_rdwr_writers(rw));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#include "ldap_pvt_thread.h"
|
||||
|
||||
#if defined( HAVE_NT_THREADS )
|
||||
#include <process.h>
|
||||
|
||||
int
|
||||
ldap_pvt_thread_initialize( void )
|
||||
|
|
@ -49,7 +48,7 @@ int
|
|||
ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
|
||||
{
|
||||
DWORD status;
|
||||
status = WaitForSingleObject( thread, INFINITE );
|
||||
status = WaitForSingleObject( (HANDLE) thread, INFINITE );
|
||||
if (status == WAIT_FAILED) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,26 +80,26 @@ int ldbm_shutdown( void )
|
|||
|
||||
#else
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef HAVE_SYSLOG
|
||||
#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 ));
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSLOG
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
#include "syslog.h"
|
||||
#else
|
||||
/* quick hack */
|
||||
#define LOG_INFO 1
|
||||
extern int syslog(int, char*, ...);
|
||||
#endif
|
||||
#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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=libldbm - Win32 Debug
|
||||
CFG=libldbm - Win32 Single Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
|
|
@ -13,12 +13,15 @@ CFG=libldbm - Win32 Debug
|
|||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "libldbm.mak" CFG="libldbm - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "libldbm.mak" CFG="libldbm - Win32 Single Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "libldbm - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libldbm - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libldbm - Win32 Single Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "libldbm - Win32 Single Release" (based on\
|
||||
"Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
|
|
@ -36,7 +39,7 @@ CPP=cl.exe
|
|||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release\libldbm"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
|
@ -57,7 +60,7 @@ LIB32=link.exe -lib
|
|||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug\libldbm"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
|
@ -68,15 +71,63 @@ LIB32=link.exe -lib
|
|||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\Debug\oldbm32.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "libldbm - Win32 Single Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "libldbm_"
|
||||
# PROP BASE Intermediate_Dir "libldbm_"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\libldbm"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo /out:"..\Debug\oldbm32.lib"
|
||||
# ADD LIB32 /nologo /out:"..\Debug\oldbm32.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "libldbm - Win32 Single Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "libldbm0"
|
||||
# PROP BASE Intermediate_Dir "libldbm0"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\libldbm"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo /out:"..\Release\oldbm32.lib"
|
||||
# ADD LIB32 /nologo /out:"..\Release\oldbm32.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "libldbm - Win32 Release"
|
||||
# Name "libldbm - Win32 Debug"
|
||||
# Name "libldbm - Win32 Single Debug"
|
||||
# Name "libldbm - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ldbm.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldbm.h
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "libldif_"
|
||||
# PROP Intermediate_Dir "libldif_"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\libldif"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
|
@ -101,8 +101,8 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "libldif0"
|
||||
# PROP Intermediate_Dir "libldif0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\libldif"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
|
@ -123,35 +123,11 @@ LIB32=link.exe -lib
|
|||
# Name "libldif - Win32 Single Release"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\lber.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\lber_pvt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldap_cdefs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldap_features.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldap_log.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldif.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\line64.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\portable.h
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ static const unsigned char b642nib[0x80] = {
|
|||
|
||||
int
|
||||
ldif_parse_line(
|
||||
char *line,
|
||||
LDAP_CONST char *line,
|
||||
char **type,
|
||||
char **value,
|
||||
int *vlen
|
||||
|
|
@ -70,7 +70,7 @@ ldif_parse_line(
|
|||
for ( s = line; *s && *s != ':'; s++ )
|
||||
; /* NULL */
|
||||
if ( *s == '\0' ) {
|
||||
lber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug,
|
||||
ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug,
|
||||
"ldif_parse_line missing ':'\n");
|
||||
return( -1 );
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ ldif_parse_line(
|
|||
|
||||
/* if no value is present, error out */
|
||||
if ( *s == '\0' ) {
|
||||
lber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug,
|
||||
ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug,
|
||||
"ldif_parse_line missing value\n");
|
||||
return( -1 );
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ ldif_parse_line(
|
|||
for ( i = 0; i < 4; i++ ) {
|
||||
if ( p[i] != '=' && (p[i] & 0x80 ||
|
||||
b642nib[ p[i] & 0x7f ] > 0x3f) ) {
|
||||
lber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
|
||||
ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
|
||||
"ldif_parse_line: invalid base 64 encoding char (%c) 0x%x\n",
|
||||
p[i], p[i] );
|
||||
return( -1 );
|
||||
|
|
@ -198,7 +198,11 @@ ldif_getline( char **next )
|
|||
}
|
||||
|
||||
void
|
||||
ldif_put_type_and_value( char **out, char *t, char *val, int vlen )
|
||||
ldif_put_type_and_value(
|
||||
char **out,
|
||||
LDAP_CONST char *t,
|
||||
LDAP_CONST char *val,
|
||||
int vlen )
|
||||
{
|
||||
unsigned char *byte, *p, *stop;
|
||||
unsigned char buf[3];
|
||||
|
|
@ -294,7 +298,7 @@ ldif_put_type_and_value( char **out, char *t, char *val, int vlen )
|
|||
|
||||
|
||||
char *
|
||||
ldif_type_and_value( char *type, char *val, int vlen )
|
||||
ldif_type_and_value( LDAP_CONST char *type, LDAP_CONST char *val, int vlen )
|
||||
/*
|
||||
* return malloc'd, zero-terminated LDIF line
|
||||
*/
|
||||
|
|
@ -306,7 +310,7 @@ ldif_type_and_value( char *type, char *val, int vlen )
|
|||
if (( buf = (char *) malloc( LDIF_SIZE_NEEDED( tlen, vlen ) + 1 ))
|
||||
== NULL )
|
||||
{
|
||||
lber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
|
||||
ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
|
||||
"ldif_type_and_value: malloc failed!" );
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "liblutil"
|
||||
# PROP Intermediate_Dir "liblutil"
|
||||
# PROP Output_Dir "..\SDebug"
|
||||
# PROP Intermediate_Dir "SDebug\liblutil"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
|
@ -102,8 +102,8 @@ LIB32=link.exe -lib
|
|||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "libluti0"
|
||||
# PROP Intermediate_Dir "libluti0"
|
||||
# PROP Output_Dir "..\SRelease"
|
||||
# PROP Intermediate_Dir "SRelease\liblutil"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
|
|
@ -144,10 +144,6 @@ SOURCE=..\..\include\ldap_cdefs.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\ldap_features.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\lockf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
|||
|
|
@ -515,10 +515,10 @@ do_queries(
|
|||
conn_init();
|
||||
}
|
||||
|
||||
lber_pvt_sb_init( &sb );
|
||||
lber_pvt_sb_set_desc( &sb, clientsock );
|
||||
lber_pvt_sb_set_io( &sb, (udp) ? &lber_pvt_sb_io_udp :
|
||||
&lber_pvt_sb_io_tcp, NULL );
|
||||
ber_pvt_sb_init( &sb );
|
||||
ber_pvt_sb_set_desc( &sb, clientsock );
|
||||
ber_pvt_sb_set_io( &sb, (udp) ? &ber_pvt_sb_io_udp :
|
||||
&ber_pvt_sb_io_tcp, NULL );
|
||||
timeout.tv_sec = idletime;
|
||||
timeout.tv_usec = 0;
|
||||
for ( ;; ) {
|
||||
|
|
@ -547,7 +547,7 @@ do_queries(
|
|||
* already waiting for us on the client sock.
|
||||
*/
|
||||
|
||||
if ( ! lber_pvt_sb_data_ready( &sb ) ) {
|
||||
if ( ! ber_pvt_sb_data_ready( &sb ) ) {
|
||||
if ( (rc = select( dtblsize, &readfds, 0, 0,
|
||||
udp ? 0 : &timeout )) < 1 ) {
|
||||
#ifdef LDAP_DEBUG
|
||||
|
|
@ -573,7 +573,7 @@ do_queries(
|
|||
}
|
||||
}
|
||||
|
||||
if ( lber_pvt_sb_data_ready( &sb ) ||
|
||||
if ( ber_pvt_sb_data_ready( &sb ) ||
|
||||
FD_ISSET( clientsock, &readfds ) ) {
|
||||
client_request( &sb, conns, udp );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ client_request(
|
|||
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if ( udp && dosyslog ) {
|
||||
sai = (struct sockaddr_in *)lber_pvt_sb_udp_get_src( &clientsb );
|
||||
sai = (struct sockaddr_in *)ber_pvt_sb_udp_get_src( &clientsb );
|
||||
syslog( LOG_INFO, "UDP request from unknown (%s)",
|
||||
inet_ntoa( sai->sin_addr ) );
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ client_request(
|
|||
free( ber.ber_buf );
|
||||
return;
|
||||
}
|
||||
sai = (struct sockaddr_in *) lber_pvt_sb_udp_get_src( &clientsb );
|
||||
sai = (struct sockaddr_in *) ber_pvt_sb_udp_get_src( &clientsb );
|
||||
|
||||
if ( get_cldap_msg( msgid, tag,
|
||||
(struct sockaddr *)sai ) != NULL ) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue