From: Kurt Zeilenga Date: Mon, 8 Nov 1999 15:38:59 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: UCDATA_2_4~233 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f4856214fb8b77cacf1d53823955bdbf3f54b527;p=openldap *** empty log message *** --- diff --git a/build/build.dsp b/build/build.dsp index 9663b97c0c..df80d14b5f 100644 --- a/build/build.dsp +++ b/build/build.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) External Target" 0x0106 -CFG=build - Win32 Single Debug +CFG=build - Win32 DLL 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=build - 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 "build.mak" CFG="build - Win32 Single Debug" +!MESSAGE NMAKE /f "build.mak" CFG="build - Win32 DLL Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -22,6 +22,8 @@ CFG=build - Win32 Single Debug !MESSAGE "build - Win32 Single Debug" (based on "Win32 (x86) External Target") !MESSAGE "build - Win32 Single Release" (based on\ "Win32 (x86) External Target") +!MESSAGE "build - Win32 DLL Debug" (based on "Win32 (x86) External Target") +!MESSAGE "build - Win32 DLL Release" (based on "Win32 (x86) External Target") !MESSAGE # Begin Project @@ -101,6 +103,42 @@ CFG=build - Win32 Single Debug # PROP Bsc_Name "build.bsc" # PROP Target_Dir "" +!ELSEIF "$(CFG)" == "build - Win32 DLL Debug" + +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "build__1" +# PROP BASE Intermediate_Dir "build__1" +# PROP BASE Cmd_Line "" +# PROP BASE Rebuild_Opt "" +# PROP BASE Bsc_Name "" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "build__1" +# PROP Intermediate_Dir "build__1" +# PROP Cmd_Line "" +# PROP Rebuild_Opt "" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "build - Win32 DLL Release" + +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "build__2" +# PROP BASE Intermediate_Dir "build__2" +# PROP BASE Cmd_Line "NMAKE /f build.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "build.exe" +# PROP BASE Bsc_Name "build.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "build__2" +# PROP Intermediate_Dir "build__2" +# PROP Cmd_Line "NMAKE /f build.mak" +# PROP Rebuild_Opt "/a" +# PROP Target_File "build.exe" +# PROP Bsc_Name "build.bsc" +# PROP Target_Dir "" + !ENDIF # Begin Target @@ -109,6 +147,8 @@ CFG=build - Win32 Single Debug # Name "build - Win32 Debug" # Name "build - Win32 Single Debug" # Name "build - Win32 Single Release" +# Name "build - Win32 DLL Debug" +# Name "build - Win32 DLL Release" !IF "$(CFG)" == "build - Win32 Release" @@ -118,6 +158,10 @@ CFG=build - Win32 Single Debug !ELSEIF "$(CFG)" == "build - Win32 Single Release" +!ELSEIF "$(CFG)" == "build - Win32 DLL Debug" + +!ELSEIF "$(CFG)" == "build - Win32 DLL Release" + !ENDIF # End Target diff --git a/include/lber.h b/include/lber.h index 240925517a..b8c24f5c81 100644 --- a/include/lber.h +++ b/include/lber.h @@ -66,41 +66,40 @@ typedef signed LBER_LEN_T ber_slen_t; */ /* BER classes and mask */ -#define LBER_CLASS_UNIVERSAL (ber_tag_t) 0x00U -#define LBER_CLASS_APPLICATION (ber_tag_t) 0x40U -#define LBER_CLASS_CONTEXT (ber_tag_t) 0x80U -#define LBER_CLASS_PRIVATE (ber_tag_t) 0xc0U -#define LBER_CLASS_MASK (ber_tag_t) 0xc0U +#define LBER_CLASS_UNIVERSAL ((ber_tag_t) 0x00U) +#define LBER_CLASS_APPLICATION ((ber_tag_t) 0x40U) +#define LBER_CLASS_CONTEXT ((ber_tag_t) 0x80U) +#define LBER_CLASS_PRIVATE ((ber_tag_t) 0xc0U) +#define LBER_CLASS_MASK ((ber_tag_t) 0xc0U) /* BER encoding type and mask */ -#define LBER_PRIMITIVE (ber_tag_t) 0x00U -#define LBER_CONSTRUCTED (ber_tag_t) 0x20U -#define LBER_ENCODING_MASK (ber_tag_t) 0x20U +#define LBER_PRIMITIVE ((ber_tag_t) 0x00U) +#define LBER_CONSTRUCTED ((ber_tag_t) 0x20U) +#define LBER_ENCODING_MASK ((ber_tag_t) 0x20U) -#define LBER_BIG_TAG_MASK (ber_tag_t) 0x1fU -#define LBER_MORE_TAG_MASK (ber_tag_t) 0x80U +#define LBER_BIG_TAG_MASK ((ber_tag_t) 0x1fU) +#define LBER_MORE_TAG_MASK ((ber_tag_t) 0x80U) /* * Note that LBER_ERROR and LBER_DEFAULT are values that can never appear * as valid BER tags, and so it is safe to use them to report errors. In * fact, any tag for which the following is true is invalid: */ -#define LBER_INVALID(t) (((t) & 0x080) && (((t) & (ber_tag_t) ~ 0x0FF)) -#define LBER_ERROR ((ber_tag_t) ~ 0x0) -#define LBER_DEFAULT ((ber_tag_t) ~ 0x0) +#define LBER_INVALID(t) (((t) & (ber_tag_t) 0x080) \ + && (((t) & (ber_tag_t) ~ 0x0FF)) + +#define LBER_ERROR ((ber_tag_t) -1) +#define LBER_DEFAULT ((ber_tag_t) -1) /* general BER types we know about */ -#define LBER_BOOLEAN (ber_tag_t) 0x01UL -#define LBER_INTEGER (ber_tag_t) 0x02UL -#define LBER_BITSTRING (ber_tag_t) 0x03UL -#define LBER_OCTETSTRING (ber_tag_t) 0x04UL -#define LBER_NULL (ber_tag_t) 0x05UL -#define LBER_ENUMERATED (ber_tag_t) 0x0aUL -#define LBER_SEQUENCE (ber_tag_t) 0x30UL /* constructed */ -#define LBER_SET (ber_tag_t) 0x31UL /* constructed */ - -#define OLD_LBER_SEQUENCE (ber_tag_t) 0x10UL /* w/o constructed bit - broken */ -#define OLD_LBER_SET (ber_tag_t) 0x11UL /* w/o constructed bit - broken */ +#define LBER_BOOLEAN ((ber_tag_t) 0x01UL) +#define LBER_INTEGER ((ber_tag_t) 0x02UL) +#define LBER_BITSTRING ((ber_tag_t) 0x03UL) +#define LBER_OCTETSTRING ((ber_tag_t) 0x04UL) +#define LBER_NULL ((ber_tag_t) 0x05UL) +#define LBER_ENUMERATED ((ber_tag_t) 0x0aUL) +#define LBER_SEQUENCE ((ber_tag_t) 0x30UL) /* constructed */ +#define LBER_SET ((ber_tag_t) 0x31UL) /* constructed */ typedef int (*BERTranslateProc) LDAP_P(( char **bufp, @@ -113,13 +112,22 @@ typedef int (*BERTranslateProc) LDAP_P(( #define LBER_TRANSLATE_STRINGS 0x04 /* get/set options for BerElement */ -#define LBER_OPT_BER_OPTIONS 0x01 -#define LBER_OPT_BER_DEBUG 0x02 +#define LBER_OPT_BER_OPTIONS 0x01 +#define LBER_OPT_BER_DEBUG 0x02 +#define LBER_OPT_BER_REMAINING_BYTES 0x03 +#define LBER_OPT_BER_TOTAL_BYTES 0x04 +#define LBER_OPT_BER_BYTES_TO_WRITE 0x05 #define LBER_OPT_DEBUG_LEVEL LBER_OPT_BER_DEBUG +#define LBER_OPT_REMAINING_BYTES LBER_OPT_BER_REMAINING_BYTES +#define LBER_OPT_TOTAL_BYTES LBER_OPT_BER_TOTAL_BYTES +#define LBER_OPT_BYTES_TO_WRITE LBER_OPT_BER_BYTES_TO_WRITE #define LBER_OPT_LOG_PRINT_FN 0x8001 #define LBER_OPT_MEMORY_FNS 0x8002 +#define LBER_OPT_ERROR_FN 0x8003 + +typedef int* (*BER_ERRNO_FN) LDAP_P(( void )); typedef void (*BER_LOG_PRINT_FN) LDAP_P(( char *buf )); @@ -150,7 +158,7 @@ typedef struct lber_memory_fns { #define LBER_OPT_ON ((void *) 1) #define LBER_OPT_OFF ((void *) 0) -#define LBER_OPT_SUCCESS 0 +#define LBER_OPT_SUCCESS (0) #define LBER_OPT_ERROR (-1) typedef struct berelement BerElement; @@ -260,7 +268,7 @@ LDAP_F( ber_tag_t ) ber_next_element LDAP_P(( BerElement *ber, ber_len_t *len, - char *last )); + LDAP_CONST char *last )); LDAP_F( ber_tag_t ) ber_scanf LDAP_P(( @@ -494,6 +502,16 @@ LDAP_F( char * ) ber_strdup LDAP_P(( LDAP_CONST char * )); +/* + * error.c + */ +LDAP_F( int * ) ber_errno_addr LDAP_P((void)); +#define ber_errno (*(ber_errno_addr)()) + +#define LBER_ERROR_NONE 0 +#define LBER_ERROR_PARAM 0x1 +#define LBER_ERROR_MEMORY 0x2 + LDAP_END_DECL -#endif /* _LBER_H */ +#endif /* _LBER_H */ \ No newline at end of file diff --git a/include/lber_types.nt b/include/lber_types.nt index 884188edcf..b930f7d655 100644 --- a/include/lber_types.nt +++ b/include/lber_types.nt @@ -10,11 +10,12 @@ */ /* - * LBER types for Windows NT + * LBER types for Windows NT (and Win32) + * copied by setup.mak to lber_types.h (when confingure is not used). */ -#ifndef _LBER_TYPES_H_NT -#define _LBER_TYPES_H_NT +#ifndef _LBER_TYPES_H +#define _LBER_TYPES_H /* * NT types: @@ -41,4 +42,4 @@ /* LBER lengths - 32 bits or larger*/ #define LBER_LEN_T int -#endif /* _LBER_TYPES_H_NT */ +#endif /* _LBER_TYPES_H */ diff --git a/include/ldap.h b/include/ldap.h index 9a5ed0bb17..6f6cd3aaff 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -46,7 +46,7 @@ LDAP_BEGIN_DECL #define LDAP_API_VERSION 2004 #define LDAP_VENDOR_NAME "OpenLDAP" /* We'll eventually release as 200 */ -#define LDAP_VENDOR_VERSION 193 +#define LDAP_VENDOR_VERSION 194 /* OpenLDAP API Features */ #define LDAP_API_FEATURE_X_OPENLDAP LDAP_VENDOR_VERSION @@ -205,52 +205,52 @@ typedef struct ldapcontrol { */ /* general stuff */ -#define LDAP_TAG_MESSAGE (ber_tag_t) 0x30U /* constructed + 16 */ -#define LDAP_TAG_MSGID (ber_tag_t) 0x02U /* integer */ -#define LDAP_TAG_LDAPDN (ber_tag_t) 0x04U /* octect string */ -#define LDAP_TAG_LDAPCRED (ber_tag_t) 0x04U /* octect string */ -#define LDAP_TAG_CONTROLS (ber_tag_t) 0xa0U /* context specific + constructed + 0 */ -#define LDAP_TAG_REFERRAL (ber_tag_t) 0xa3U /* context specific + constructed + 3 */ +#define LDAP_TAG_MESSAGE ((ber_tag_t) 0x30U) /* constructed + 16 */ +#define LDAP_TAG_MSGID ((ber_tag_t) 0x02U) /* integer */ +#define LDAP_TAG_LDAPDN ((ber_tag_t) 0x04U) /* octect string */ +#define LDAP_TAG_LDAPCRED ((ber_tag_t) 0x04U) /* octect string */ +#define LDAP_TAG_CONTROLS ((ber_tag_t) 0xa0U) /* context specific + constructed + 0 */ +#define LDAP_TAG_REFERRAL ((ber_tag_t) 0xa3U) /* context specific + constructed + 3 */ -#define LDAP_TAG_NEWSUPERIOR (ber_tag_t) 0x80U /* context-specific + primitive + 0 */ +#define LDAP_TAG_NEWSUPERIOR ((ber_tag_t) 0x80U) /* context-specific + primitive + 0 */ -#define LDAP_TAG_EXOP_REQ_OID (ber_tag_t) 0x80U /* context specific + primitive */ -#define LDAP_TAG_EXOP_REQ_VALUE (ber_tag_t) 0x81U /* context specific + primitive */ -#define LDAP_TAG_EXOP_RES_OID (ber_tag_t) 0x8aU /* context specific + primitive */ -#define LDAP_TAG_EXOP_RES_VALUE (ber_tag_t) 0x8bU /* context specific + primitive */ +#define LDAP_TAG_EXOP_REQ_OID ((ber_tag_t) 0x80U) /* context specific + primitive */ +#define LDAP_TAG_EXOP_REQ_VALUE ((ber_tag_t) 0x81U) /* context specific + primitive */ +#define LDAP_TAG_EXOP_RES_OID ((ber_tag_t) 0x8aU) /* context specific + primitive */ +#define LDAP_TAG_EXOP_RES_VALUE ((ber_tag_t) 0x8bU) /* context specific + primitive */ -#define LDAP_TAG_SASL_RES_CREDS (ber_tag_t) 0x87U /* context specific + primitive */ +#define LDAP_TAG_SASL_RES_CREDS ((ber_tag_t) 0x87U) /* context specific + primitive */ /* possible operations a client can invoke */ -#define LDAP_REQ_BIND (ber_tag_t) 0x60U /* application + constructed */ -#define LDAP_REQ_UNBIND (ber_tag_t) 0x42U /* application + primitive */ -#define LDAP_REQ_SEARCH (ber_tag_t) 0x63U /* application + constructed */ -#define LDAP_REQ_MODIFY (ber_tag_t) 0x66U /* application + constructed */ -#define LDAP_REQ_ADD (ber_tag_t) 0x68U /* application + constructed */ -#define LDAP_REQ_DELETE (ber_tag_t) 0x4aU /* application + primitive */ -#define LDAP_REQ_MODRDN (ber_tag_t) 0x6cU /* application + constructed */ +#define LDAP_REQ_BIND ((ber_tag_t) 0x60U) /* application + constructed */ +#define LDAP_REQ_UNBIND ((ber_tag_t) 0x42U) /* application + primitive */ +#define LDAP_REQ_SEARCH ((ber_tag_t) 0x63U) /* application + constructed */ +#define LDAP_REQ_MODIFY ((ber_tag_t) 0x66U) /* application + constructed */ +#define LDAP_REQ_ADD ((ber_tag_t) 0x68U) /* application + constructed */ +#define LDAP_REQ_DELETE ((ber_tag_t) 0x4aU) /* application + primitive */ +#define LDAP_REQ_MODRDN ((ber_tag_t) 0x6cU) /* application + constructed */ #define LDAP_REQ_MODDN LDAP_REQ_MODRDN #define LDAP_REQ_RENAME LDAP_REQ_MODRDN -#define LDAP_REQ_COMPARE (ber_tag_t) 0x6eU /* application + constructed */ -#define LDAP_REQ_ABANDON (ber_tag_t) 0x50U /* application + primitive */ -#define LDAP_REQ_EXTENDED (ber_tag_t) 0x77U /* application + constructed */ +#define LDAP_REQ_COMPARE ((ber_tag_t) 0x6eU) /* application + constructed */ +#define LDAP_REQ_ABANDON ((ber_tag_t) 0x50U) /* application + primitive */ +#define LDAP_REQ_EXTENDED ((ber_tag_t) 0x77U) /* application + constructed */ /* possible result types a server can return */ -#define LDAP_RES_BIND (ber_tag_t) 0x61U /* application + constructed */ -#define LDAP_RES_SEARCH_ENTRY (ber_tag_t) 0x64U /* application + constructed */ -#define LDAP_RES_SEARCH_REFERENCE (ber_tag_t) 0x73U /* V3: application + constructed */ -#define LDAP_RES_SEARCH_RESULT (ber_tag_t) 0x65U /* application + constructed */ -#define LDAP_RES_MODIFY (ber_tag_t) 0x67U /* application + constructed */ -#define LDAP_RES_ADD (ber_tag_t) 0x69U /* application + constructed */ -#define LDAP_RES_DELETE (ber_tag_t) 0x6bU /* application + constructed */ -#define LDAP_RES_MODRDN (ber_tag_t) 0x6dU /* application + constructed */ +#define LDAP_RES_BIND ((ber_tag_t) 0x61U) /* application + constructed */ +#define LDAP_RES_SEARCH_ENTRY ((ber_tag_t) 0x64U) /* application + constructed */ +#define LDAP_RES_SEARCH_REFERENCE ((ber_tag_t) 0x73U) /* V3: application + constructed */ +#define LDAP_RES_SEARCH_RESULT ((ber_tag_t) 0x65U) /* application + constructed */ +#define LDAP_RES_MODIFY ((ber_tag_t) 0x67U) /* application + constructed */ +#define LDAP_RES_ADD ((ber_tag_t) 0x69U) /* application + constructed */ +#define LDAP_RES_DELETE ((ber_tag_t) 0x6bU) /* application + constructed */ +#define LDAP_RES_MODRDN ((ber_tag_t) 0x6dU) /* application + constructed */ #define LDAP_RES_MODDN LDAP_RES_MODRDN /* application + constructed */ #define LDAP_RES_RENAME LDAP_RES_MODRDN /* application + constructed */ -#define LDAP_RES_COMPARE (ber_tag_t) 0x6fU /* application + constructed */ -#define LDAP_RES_EXTENDED (ber_tag_t) 0x78U /* V3: application + constructed */ +#define LDAP_RES_COMPARE ((ber_tag_t) 0x6fU) /* application + constructed */ +#define LDAP_RES_EXTENDED ((ber_tag_t) 0x78U) /* V3: application + constructed */ #define LDAP_RES_ANY ((ber_tag_t)(-1)) #define LDAP_RES_UNSOLICITED ((ber_tag_t)(0)) @@ -260,50 +260,50 @@ typedef struct ldapcontrol { #define LDAP_SASL_SIMPLE NULL /* authentication methods available */ -#define LDAP_AUTH_NONE (ber_tag_t) 0x00U /* no authentication */ -#define LDAP_AUTH_SIMPLE (ber_tag_t) 0x80U /* context specific + primitive */ -#define LDAP_AUTH_SASL (ber_tag_t) 0xa3U /* context specific + primitive */ -#define LDAP_AUTH_KRBV4 (ber_tag_t) 0xffU /* means do both of the following */ -#define LDAP_AUTH_KRBV41 (ber_tag_t) 0x81U /* context specific + primitive */ -#define LDAP_AUTH_KRBV42 (ber_tag_t) 0x82U /* context specific + primitive */ +#define LDAP_AUTH_NONE ((ber_tag_t) 0x00U) /* no authentication */ +#define LDAP_AUTH_SIMPLE ((ber_tag_t) 0x80U) /* context specific + primitive */ +#define LDAP_AUTH_SASL ((ber_tag_t) 0xa3U) /* context specific + primitive */ +#define LDAP_AUTH_KRBV4 ((ber_tag_t) 0xffU) /* means do both of the following */ +#define LDAP_AUTH_KRBV41 ((ber_tag_t) 0x81U) /* context specific + primitive */ +#define LDAP_AUTH_KRBV42 ((ber_tag_t) 0x82U) /* context specific + primitive */ /* filter types */ -#define LDAP_FILTER_AND (ber_tag_t) 0xa0U /* context specific + constructed */ -#define LDAP_FILTER_OR (ber_tag_t) 0xa1U /* context specific + constructed */ -#define LDAP_FILTER_NOT (ber_tag_t) 0xa2U /* context specific + constructed */ -#define LDAP_FILTER_EQUALITY (ber_tag_t) 0xa3U /* context specific + constructed */ -#define LDAP_FILTER_SUBSTRINGS (ber_tag_t) 0xa4U /* context specific + constructed */ -#define LDAP_FILTER_GE (ber_tag_t) 0xa5U /* context specific + constructed */ -#define LDAP_FILTER_LE (ber_tag_t) 0xa6U /* context specific + constructed */ -#define LDAP_FILTER_PRESENT (ber_tag_t) 0x87U /* context specific + primitive */ -#define LDAP_FILTER_APPROX (ber_tag_t) 0xa8U /* context specific + constructed */ -#define LDAP_FILTER_EXT (ber_tag_t) 0xa9U /* context specific + constructed */ +#define LDAP_FILTER_AND ((ber_tag_t) 0xa0U) /* context specific + constructed */ +#define LDAP_FILTER_OR ((ber_tag_t) 0xa1U) /* context specific + constructed */ +#define LDAP_FILTER_NOT ((ber_tag_t) 0xa2U) /* context specific + constructed */ +#define LDAP_FILTER_EQUALITY ((ber_tag_t) 0xa3U) /* context specific + constructed */ +#define LDAP_FILTER_SUBSTRINGS ((ber_tag_t) 0xa4U) /* context specific + constructed */ +#define LDAP_FILTER_GE ((ber_tag_t) 0xa5U) /* context specific + constructed */ +#define LDAP_FILTER_LE ((ber_tag_t) 0xa6U) /* context specific + constructed */ +#define LDAP_FILTER_PRESENT ((ber_tag_t) 0x87U) /* context specific + primitive */ +#define LDAP_FILTER_APPROX ((ber_tag_t) 0xa8U) /* context specific + constructed */ +#define LDAP_FILTER_EXT ((ber_tag_t) 0xa9U) /* context specific + constructed */ /* extended filter component types */ -#define LDAP_FILTER_EXT_OID (ber_tag_t) 0x81U /* context specific */ -#define LDAP_FILTER_EXT_TYPE (ber_tag_t) 0x82U /* context specific */ -#define LDAP_FILTER_EXT_VALUE (ber_tag_t) 0x83U /* context specific */ -#define LDAP_FILTER_EXT_DNATTRS (ber_tag_t) 0x84U /* context specific */ +#define LDAP_FILTER_EXT_OID ((ber_tag_t) 0x81U) /* context specific */ +#define LDAP_FILTER_EXT_TYPE ((ber_tag_t) 0x82U) /* context specific */ +#define LDAP_FILTER_EXT_VALUE ((ber_tag_t) 0x83U) /* context specific */ +#define LDAP_FILTER_EXT_DNATTRS ((ber_tag_t) 0x84U) /* context specific */ /* substring filter component types */ -#define LDAP_SUBSTRING_INITIAL (ber_tag_t) 0x80U /* context specific */ -#define LDAP_SUBSTRING_ANY (ber_tag_t) 0x81U /* context specific */ -#define LDAP_SUBSTRING_FINAL (ber_tag_t) 0x82U /* context specific */ +#define LDAP_SUBSTRING_INITIAL ((ber_tag_t) 0x80U) /* context specific */ +#define LDAP_SUBSTRING_ANY ((ber_tag_t) 0x81U) /* context specific */ +#define LDAP_SUBSTRING_FINAL ((ber_tag_t) 0x82U) /* context specific */ /* search scopes */ -#define LDAP_SCOPE_BASE (ber_int_t) 0x0000 -#define LDAP_SCOPE_ONELEVEL (ber_int_t) 0x0001 -#define LDAP_SCOPE_SUBTREE (ber_int_t) 0x0002 +#define LDAP_SCOPE_BASE ((ber_int_t) 0x0000) +#define LDAP_SCOPE_ONELEVEL ((ber_int_t) 0x0001) +#define LDAP_SCOPE_SUBTREE ((ber_int_t) 0x0002) /* for modifications */ typedef struct ldapmod { int mod_op; -#define LDAP_MOD_ADD (ber_int_t) 0x0000 -#define LDAP_MOD_DELETE (ber_int_t) 0x0001 -#define LDAP_MOD_REPLACE (ber_int_t) 0x0002 -#define LDAP_MOD_BVALUES (ber_int_t) 0x0080 +#define LDAP_MOD_ADD ((ber_int_t) 0x0000) +#define LDAP_MOD_DELETE ((ber_int_t) 0x0001) +#define LDAP_MOD_REPLACE ((ber_int_t) 0x0002) +#define LDAP_MOD_BVALUES ((ber_int_t) 0x0080) /* IMPORTANT: do not use code 0x1000 (or above), * it is used internally by the backends! * (see ldap/servers/slapd/slap.h) diff --git a/include/ldap_config.nt b/include/ldap_config.nt index ce3597a76b..9d6e962dfb 100644 --- a/include/ldap_config.nt +++ b/include/ldap_config.nt @@ -10,7 +10,7 @@ */ /* - * This file works in confunction with OpenLDAP configure system. + * This file works in confunction with OpenLDAP setup.mak system. * If you do no like the values below, adjust your configure options. */ diff --git a/include/setup.dsp b/include/setup.dsp index 62481a250c..299f29cdeb 100644 --- a/include/setup.dsp +++ b/include/setup.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) External Target" 0x0106 -CFG=setup - Win32 Single Debug +CFG=setup - Win32 DLL 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=setup - 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 "setup.mak" CFG="setup - Win32 Single Debug" +!MESSAGE NMAKE /f "setup.mak" CFG="setup - Win32 DLL Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -22,6 +22,8 @@ CFG=setup - Win32 Single Debug !MESSAGE "setup - Win32 Single Debug" (based on "Win32 (x86) External Target") !MESSAGE "setup - Win32 Single Release" (based on\ "Win32 (x86) External Target") +!MESSAGE "setup - Win32 DLL Debug" (based on "Win32 (x86) External Target") +!MESSAGE "setup - Win32 DLL Release" (based on "Win32 (x86) External Target") !MESSAGE # Begin Project @@ -104,6 +106,44 @@ CFG=setup - Win32 Single Debug # PROP Bsc_Name "setup.bsc" # PROP Target_Dir "" +!ELSEIF "$(CFG)" == "setup - Win32 DLL Debug" + +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "setup__1" +# PROP BASE Intermediate_Dir "setup__1" +# PROP BASE Cmd_Line "NMAKE /f setup.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "setup.txt" +# PROP BASE Bsc_Name "setup.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "setup__1" +# PROP Intermediate_Dir "setup__1" +# PROP Cmd_Line "NMAKE /f setup.mak" +# PROP Rebuild_Opt "/a" +# PROP Target_File "setup.txt" +# PROP Bsc_Name "setup.bsc" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "setup - Win32 DLL Release" + +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "setup__2" +# PROP BASE Intermediate_Dir "setup__2" +# PROP BASE Cmd_Line "NMAKE /f setup.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "setup.txt" +# PROP BASE Bsc_Name "setup.bsc" +# PROP BASE Target_Dir "" +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "setup__2" +# PROP Intermediate_Dir "setup__2" +# PROP Cmd_Line "NMAKE /f setup.mak" +# PROP Rebuild_Opt "/a" +# PROP Target_File "setup.txt" +# PROP Bsc_Name "setup.bsc" +# PROP Target_Dir "" + !ENDIF # Begin Target @@ -112,6 +152,8 @@ CFG=setup - Win32 Single Debug # Name "setup - Win32 Debug" # Name "setup - Win32 Single Debug" # Name "setup - Win32 Single Release" +# Name "setup - Win32 DLL Debug" +# Name "setup - Win32 DLL Release" !IF "$(CFG)" == "setup - Win32 Release" @@ -121,6 +163,10 @@ CFG=setup - Win32 Single Debug !ELSEIF "$(CFG)" == "setup - Win32 Single Release" +!ELSEIF "$(CFG)" == "setup - Win32 DLL Debug" + +!ELSEIF "$(CFG)" == "setup - Win32 DLL Release" + !ENDIF # Begin Source File diff --git a/libraries/liblber/bprint.c b/libraries/liblber/bprint.c index 6492f975d2..6e347da2eb 100644 --- a/libraries/liblber/bprint.c +++ b/libraries/liblber/bprint.c @@ -17,6 +17,22 @@ #include "lber-int.h" +/* + * ber errno + */ +BER_ERRNO_FN ber_int_errno_fn; + +int * ber_errno_addr(void) +{ + static int ber_int_errno = LBER_ERROR_NONE; + + if( ber_int_errno_fn ) { + return (*ber_int_errno_fn)(); + } + + return &ber_int_errno; +} + /* * Print stuff */ diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c index ee2bd49a7a..e8b889d2e7 100644 --- a/libraries/liblber/decode.c +++ b/libraries/liblber/decode.c @@ -135,23 +135,21 @@ ber_peek_tag( BerElement *ber_in, ber_len_t *len ) { - ber_tag_t tag; + char* save; BerElement *ber; + ber_tag_t tag; assert( ber_in != NULL ); assert( BER_VALID( ber_in ) ); - ber = ber_dup( ber_in ); - - if( ber == NULL ) { - return LBER_ERROR; - } - - assert( BER_VALID( ber ) ); + /* save state */ + save = ber->ber_ptr; tag = ber_skip_tag( ber, len ); - ber_free( ber, 0 ); + /* restore state */ + ber->ber_ptr = save; + return( tag ); } @@ -453,8 +451,7 @@ ber_first_element( /* skip the sequence header, use the len to mark where to stop */ if ( ber_skip_tag( ber, len ) == LBER_DEFAULT ) { - *last = NULL; - return( LBER_DEFAULT ); + return( LBER_ERROR ); } *last = ber->ber_ptr + *len; @@ -470,7 +467,7 @@ ber_tag_t ber_next_element( BerElement *ber, ber_len_t *len, - char *last ) + LDAP_CONST char *last ) { assert( ber != NULL ); assert( len != NULL ); @@ -479,6 +476,7 @@ ber_next_element( assert( BER_VALID( ber ) ); if ( ber->ber_ptr == last ) { + /* set last to NULL on end of SEQUENCE */ return( LBER_DEFAULT ); } diff --git a/libraries/liblber/dtest.dsp b/libraries/liblber/dtest.dsp index 7710d23e69..ad00d2c10c 100644 --- a/libraries/liblber/dtest.dsp +++ b/libraries/liblber/dtest.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=dtest - Win32 Single Debug +CFG=dtest - Win32 DLL 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=dtest - 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 "dtest.mak" CFG="dtest - Win32 Single Debug" +!MESSAGE NMAKE /f "dtest.mak" CFG="dtest - Win32 DLL Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -23,6 +23,9 @@ CFG=dtest - Win32 Single Debug "Win32 (x86) Console Application") !MESSAGE "dtest - Win32 Single Release" (based on\ "Win32 (x86) Console Application") +!MESSAGE "dtest - Win32 DLL Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "dtest - Win32 DLL Release" (based on\ + "Win32 (x86) Console Application") !MESSAGE # Begin Project @@ -129,6 +132,56 @@ 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" +!ELSEIF "$(CFG)" == "dtest - Win32 DLL 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 "..\..\DLLDebug" +# PROP Intermediate_Dir "..\..\DLLDebug\dtest" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 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 DLL 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 "dtest__0" +# PROP Intermediate_Dir "dtest__0" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /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 /libpath:"..\..\Release" +# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" + !ENDIF # Begin Target @@ -137,6 +190,8 @@ LINK32=link.exe # Name "dtest - Win32 Debug" # Name "dtest - Win32 Single Debug" # Name "dtest - Win32 Single Release" +# Name "dtest - Win32 DLL Debug" +# Name "dtest - Win32 DLL Release" # Begin Source File SOURCE=.\dtest.c diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index ef515a3369..a24bee2088 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -685,6 +685,7 @@ ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... ) break; case 'B': /* bit string */ + case 'X': /* bit string (deprecated) */ s = va_arg( ap, char * ); len = va_arg( ap, int ); /* in bits */ rc = ber_put_bitstring( ber, s, len, ber->ber_tag ); diff --git a/libraries/liblber/lber-int.h b/libraries/liblber/lber-int.h index 63f979309a..9aec7d9ed2 100644 --- a/libraries/liblber/lber-int.h +++ b/libraries/liblber/lber-int.h @@ -24,6 +24,9 @@ LDAP_BEGIN_DECL +extern BER_ERRNO_FN ber_int_errno_fn; + + /* these have to match lber types settings */ #define LBER_INT_HTON(i) AC_HTONL(i) #define LBER_INT_NTOH(i) AC_NTOHL(i) diff --git a/libraries/liblber/liblber.dsp b/libraries/liblber/liblber.dsp index 9ef29315ef..72e635daf3 100644 --- a/libraries/liblber/liblber.dsp +++ b/libraries/liblber/liblber.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Static Library" 0x0104 -CFG=liblber - Win32 Single Debug +CFG=liblber - Win32 DLL 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=liblber - 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 "liblber.mak" CFG="liblber - Win32 Single Debug" +!MESSAGE NMAKE /f "liblber.mak" CFG="liblber - Win32 DLL Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE @@ -22,6 +22,8 @@ CFG=liblber - Win32 Single Debug !MESSAGE "liblber - Win32 Single Debug" (based on "Win32 (x86) Static Library") !MESSAGE "liblber - Win32 Single Release" (based on\ "Win32 (x86) Static Library") +!MESSAGE "liblber - Win32 DLL Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "liblber - Win32 DLL Release" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -113,6 +115,48 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:"..\Release\olber32.lib" # ADD LIB32 /nologo /out:"..\..\SRelease\olber32.lib" +!ELSEIF "$(CFG)" == "liblber - Win32 DLL Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "liblber_" +# PROP BASE Intermediate_Dir "liblber_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\DLLDebug" +# PROP Intermediate_Dir "..\..\DLLDebug\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 /MDd /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\..\Debug\olber32.lib" +# ADD LIB32 /nologo /out:"..\..\DLLDebug\olber32.lib" + +!ELSEIF "$(CFG)" == "liblber - Win32 DLL Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "liblber0" +# PROP BASE Intermediate_Dir "liblber0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "liblber0" +# PROP Intermediate_Dir "liblber0" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /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 +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\..\Release\olber32.lib" +# ADD LIB32 /nologo /out:"..\..\Release\olber32.lib" + !ENDIF # Begin Target @@ -121,6 +165,8 @@ LIB32=link.exe -lib # Name "liblber - Win32 Debug" # Name "liblber - Win32 Single Debug" # Name "liblber - Win32 Single Release" +# Name "liblber - Win32 DLL Debug" +# Name "liblber - Win32 DLL Release" # Begin Source File SOURCE=.\bprint.c diff --git a/libraries/liblber/options.c b/libraries/liblber/options.c index bf785119d7..27a1de0ac0 100644 --- a/libraries/liblber/options.c +++ b/libraries/liblber/options.c @@ -55,6 +55,18 @@ ber_get_option( * (int *) outvalue = ber->ber_debug; return LBER_OPT_SUCCESS; + case LBER_OPT_BER_REMAINING_BYTES: + *((ber_len_t *) outvalue) = ber->ber_end - ber->ber_ptr; + return LBER_OPT_SUCCESS; + + case LBER_OPT_BER_TOTAL_BYTES: + *((ber_len_t *) outvalue) = ber->ber_end - ber->ber_buf; + return LBER_OPT_SUCCESS; + + case LBER_OPT_BER_BYTES_TO_WRITE: + *((ber_len_t *) outvalue) = ber->ber_ptr - ber->ber_buf; + return LBER_OPT_SUCCESS; + default: /* bad param */ break; @@ -134,6 +146,18 @@ ber_set_option( ber->ber_debug = * (const int *) invalue; return LBER_OPT_SUCCESS; + case LBER_OPT_BER_REMAINING_BYTES: + ber->ber_end = &ber->ber_ptr[* (const ber_len_t *) invalue]; + return LBER_OPT_SUCCESS; + + case LBER_OPT_BER_TOTAL_BYTES: + ber->ber_end = &ber->ber_buf[* (const ber_len_t *) invalue]; + return LBER_OPT_SUCCESS; + + case LBER_OPT_BER_BYTES_TO_WRITE: + ber->ber_ptr = &ber->ber_buf[* (const ber_len_t *) invalue]; + return LBER_OPT_SUCCESS; + default: /* bad param */ break; diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 9014ed7a1c..a0a503b8b5 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -171,7 +171,9 @@ static long send_ldap_ber( Connection *conn, BerElement *ber ) { - ber_len_t bytes = ber_pvt_ber_bytes( ber ); + ber_len_t bytes; + + ber_get_option( ber, LBER_OPT_BER_BYTES_TO_WRITE, &bytes ); /* write only one pdu at a time - wait til it's our turn */ ldap_pvt_thread_mutex_lock( &conn->c_write_mutex );