* is provided ``as is'' without express or implied warranty.
*/
-#define DISABLE_BRIDGE
#include "portable.h"
#ifndef lint
--- /dev/null
+# Microsoft Developer Studio Project File - Name="libavl" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libavl - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libavl.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libavl.mak" CFG="libavl - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libavl - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libavl - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "libavl - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# 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 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "libavl - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /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 /out:"..\Debug\libavl.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "libavl - Win32 Release"
+# Name "libavl - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\avl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\avl.h
+# End Source File
+# End Target
+# End Project
--- /dev/null
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libavl"=.\libavl.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
-#define LDAP_BRIDGE /* disable LDAP_BRIDGE code */
#include "portable.h"
#if defined( LDAP_DEBUG ) && defined( LDAP_LIBUI )
#include <stdio.h>
-#include <ac/string.h>
#include <ctype.h>
+
+#include <ac/string.h>
#endif /* LDAP_DEBUG && LDAP_LIBUI */
#include "lber.h"
* is provided ``as is'' without express or implied warranty.
*/
-#define DISABLE_BRIDGE /* disable LDAP_BRIDGE code */
#include "portable.h"
#include <stdio.h>
#endif
#include <ac/string.h>
-
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#ifdef PCNFS
-#include <tklib.h>
-#endif /* PCNFS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
+#include <ac/socket.h>
#include "lber.h"
if ( ber_read( ber, (char *) &netlen + diff, noctets )
!= noctets )
return( LBER_DEFAULT );
- *len = LBER_NTOHL( netlen );
+ *len = NTOHL( netlen );
} else {
*len = lc;
}
sign = (0x80 & *(p+diff) );
if ( sign && len < sizeof(long) ) {
for ( i = 0; i < diff; i++ ) {
- *(p+i) = 0xff;
+ *(p+i) = (char) 0xff;
}
}
- *num = LBER_NTOHL( netnum );
+ *num = NTOHL( netnum );
return( len );
}
if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT )
return( LBER_DEFAULT );
- if ( ber_getnint( ber, num, (int)len ) != len )
+ if ( (unsigned long) ber_getnint( ber, num, (int)len ) != len )
return( LBER_DEFAULT );
else
return( tag );
if ( datalen > (*len - 1) )
return( LBER_DEFAULT );
- if ( ber_read( ber, buf, datalen ) != datalen )
+ if ( (unsigned long) ber_read( ber, buf, datalen ) != datalen )
return( LBER_DEFAULT );
buf[datalen] = '\0';
if ( (*buf = (char *) malloc( (size_t)datalen + 1 )) == NULL )
return( LBER_DEFAULT );
- if ( ber_read( ber, *buf, datalen ) != datalen )
+ if ( (unsigned long) ber_read( ber, *buf, datalen ) != datalen )
return( LBER_DEFAULT );
(*buf)[datalen] = '\0';
if ( ((*bv)->bv_val = (char *) malloc( (size_t)len + 1 )) == NULL )
return( LBER_DEFAULT );
- if ( ber_read( ber, (*bv)->bv_val, len ) != len )
+ if ( (unsigned long) ber_read( ber, (*bv)->bv_val, len ) != len )
return( LBER_DEFAULT );
((*bv)->bv_val)[len] = '\0';
(*bv)->bv_len = len;
if ( ber_read( ber, (char *)&unusedbits, 1 ) != 1 )
return( LBER_DEFAULT );
- if ( ber_read( ber, *buf, datalen ) != datalen )
+ if ( (unsigned long) ber_read( ber, *buf, datalen ) != datalen )
return( LBER_DEFAULT );
*blen = datalen * 8 - unusedbits;
* is provided ``as is'' without express or implied warranty.
*/
-#define DISABLE_BRIDGE
#include "portable.h"
#include <stdio.h>
#include <varargs.h>
#endif
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#ifdef PCNFS
-#include <tklib.h>
-#endif /* PCNFS */
-
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
+#include <ac/socket.h>
#include "lber.h"
taglen = ber_calc_taglen( tag );
- ntag = LBER_HTONL( tag );
+ ntag = HTONL( tag );
return( ber_write( ber, ((char *) &ntag) + sizeof(long) - taglen,
taglen, nosos ) );
*/
if ( len <= 127 ) {
- netlen = LBER_HTONL( len );
+ netlen = HTONL( len );
return( ber_write( ber, (char *) &netlen + sizeof(long) - 1,
1, nosos ) );
}
return( -1 );
/* write the length itself */
- netlen = LBER_HTONL( len );
+ netlen = HTONL( len );
if ( ber_write( ber, (char *) &netlen + (sizeof(long) - i), i, nosos )
!= i )
return( -1 );
if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 )
return( -1 );
i++;
- netnum = LBER_HTONL( num );
+ netnum = HTONL( num );
if ( ber_write( ber, (char *) &netnum + (sizeof(long) - i), i, 0 )
!= i )
return( -1 );
#endif /* STR_TRANSLATION */
if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 ||
- ber_write( ber, str, len, 0 ) != len ) {
+ (unsigned long) ber_write( ber, str, len, 0 ) != len ) {
rc = -1;
} else {
/* return length of tag + length + contents */
return( -1 );
len = ( blen + 7 ) / 8;
- unusedbits = len * 8 - blen;
+ unusedbits = (unsigned char) ((len * 8) - blen);
if ( (lenlen = ber_put_len( ber, len + 1, 0 )) == -1 )
return( -1 );
*/
len = (*sos)->sos_clen;
- netlen = LBER_HTONL( len );
+ netlen = HTONL( len );
if ( sizeof(long) > 4 && len > 0xFFFFFFFFL )
return( -1 );
/* the tag */
taglen = ber_calc_taglen( (*sos)->sos_tag );
- ntag = LBER_HTONL( (*sos)->sos_tag );
+ ntag = HTONL( (*sos)->sos_tag );
SAFEMEMCPY( (*sos)->sos_first, (char *) &ntag +
sizeof(long) - taglen, taglen );
if ( ber->ber_options & LBER_USE_DER ) {
- ltag = (lenlen == 1) ? len : 0x80 + (lenlen - 1);
+ ltag = (lenlen == 1)
+ ? (unsigned char) len
+ : 0x80 + (lenlen - 1);
}
/* one byte of length length */
* is provided ``as is'' without express or implied warranty.
*/
-#define DISABLE_BRIDGE
#include "portable.h"
#include <stdio.h>
#include <ctype.h>
#include <ac/unistd.h>
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS || _WIN32 */
-
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
#include <errno.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifdef PCNFS
-#include <tklib.h>
-#endif /* PCNFS */
-#endif /* MACOS */
+#include <ac/socket.h>
-#ifdef _WIN32
-#include <winsock.h>
+#ifdef HAVE_IO_H
#include <io.h>
-#endif /* _WIN32 */
+#endif
#include "lber.h"
return( -1 );
/* fake error if write was not atomic */
if (rc < towrite) {
-#if !defined( MACOS ) && !defined( DOS )
- errno = EMSGSIZE;
+#if defined( WSAEMSGSIZE )
+ errno = WSAEMSGSIZE;
#endif
return( -1 );
}
noctets ) {
return( LBER_DEFAULT );
}
- *len = LBER_NTOHL( netlen );
+ *len = NTOHL( netlen );
} else {
*len = lc;
}
#endif /* DOS && !_WIN32 */
if ( ( sb->sb_options & LBER_MAX_INCOMING_SIZE ) &&
- *len > sb->sb_max_incoming ) {
+ *len > (unsigned long) sb->sb_max_incoming ) {
return( LBER_DEFAULT );
}
--- /dev/null
+# Microsoft Developer Studio Project File - Name="liblber" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=liblber - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "liblber.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "liblber.mak" CFG="liblber - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "liblber - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "liblber - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "liblber - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# 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 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "liblber - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /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 /out:"..\Debug\liblber.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "liblber - Win32 Release"
+# Name "liblber - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\bprint.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\decode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\encode.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\io.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\lber.h
+# End Source File
+# End Target
+# End Project
--- /dev/null
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "liblber"=.\liblber.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
* abandon.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
-
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS */
-
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
+
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
-#ifdef NEEDPROTOS
-static int do_abandon( LDAP *ld, int origid, int msgid );
-#else /* NEEDPROTOS */
-static int do_abandon();
-#endif /* NEEDPROTOS */
+static int do_abandon LDAP_P(( LDAP *ld, int origid, int msgid ));
+
/*
* ldap_abandon - perform an ldap (and X.500) abandon operation. Parameters:
*
err = 0;
if ( sendabandon ) {
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
err = -1;
ld->ld_errno = LDAP_NO_MEMORY;
} else {
#ifdef LDAP_REFERRALS
if ( lr != NULL ) {
if ( sendabandon ) {
- free_connection( ld, lr->lr_conn, 0, 1 );
+ ldap_free_connection( ld, lr->lr_conn, 0, 1 );
}
if ( origid == msgid ) {
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
}
#endif /* LDAP_REFERRALS */
* add.c
*/
-#ifndef lint
+#include "portable.h"
+
+#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS */
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* !MACOS && !DOS */
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
Debug( LDAP_DEBUG_TRACE, "ldap_add\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
}
/* send the message */
- return( send_initial_request( ld, LDAP_REQ_ADD, dn, ber ));
+ return( ldap_send_initial_request( ld, LDAP_REQ_ADD, dn, ber ));
}
int
* addentry.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+#include <ctype.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
* bind.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include "msdos.h"
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#endif /* DOS */
-#endif /* MACOS */
+
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
* cache.c - local caching support for LDAP
*/
-#define DISABLE_BRIDGE
#include "portable.h"
#ifndef NO_CACHE
#endif
#include <stdio.h>
-#include <ac/string.h>
#include <stdlib.h>
-#ifdef MACOS
-#include <time.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#ifdef WINSOCK
-#include <time.h>
-#endif /* WINSOCK */
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
#include "lber.h"
#include "ldap.h"
/*
* check remaining length and bytes if necessary
*/
- if (( len = r1.ber_end - r1.ber_ptr ) != r2.ber_end - r2.ber_ptr ) {
+ if (( len = r1.ber_end - r1.ber_ptr ) !=
+ (unsigned long) (r2.ber_end - r2.ber_ptr) )
+ {
return( -1 ); /* different lengths */
}
return( memcmp( r1.ber_ptr, r2.ber_ptr, (size_t)len ));
* charset.c
*/
-#if defined( DOS ) || defined( _WIN32 )
-/*
- * This MUST precede "#ifdef STR_TRANSLATION"
- * because STR_TRANSLATION and friends are defined in msdos.h.
- */
-#include "msdos.h"
-#endif /* DOS */
+#include "portable.h"
#ifdef STR_TRANSLATION
#endif
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 ) && !defined(VMS)
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
+#include <ac/string.h>
/* Character set used: ISO 8859-1, ISO 8859-2, ISO 8859-3, ... */
/* #define ISO_8859 1 */
typedef unsigned char Byte;
typedef struct { Byte a, b; } Couple;
-#ifdef NEEDPROTOS
-static Byte *c_to_hh( Byte *o, Byte c );
-static Byte *c_to_cc( Byte *o, Couple *cc, Byte c );
-static int hh_to_c( Byte *h );
-static Byte *cc_to_t61( Byte *o, Byte *s );
-#else /* NEEDPROTOS */
-static Byte *c_to_hh();
-static Byte *c_to_cc();
-static int hh_to_c();
-static Byte *cc_to_t61();
-#endif /* NEEDPROTOS */
+static Byte *c_to_hh LDAP_P(( Byte *o, Byte c ));
+static Byte *c_to_cc LDAP_P(( Byte *o, Couple *cc, Byte c ));
+static int hh_to_c LDAP_P(( Byte *h ));
+static Byte *cc_to_t61 LDAP_P(( Byte *o, Byte *s ));
/*
Character choosed as base in diacritics alone: NO-BREAK SPACE.
* cldap.c - synchronous, retrying interface to the cldap protocol
*/
-#define DISABLE_BRIDGE
#include "portable.h"
#ifdef CLDAP
#endif
#include <stdio.h>
-#include <ac/string.h>
-#include <errno.h>
#include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-#ifdef DOS
-#include "msdos.h"
-#endif /* DOS */
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
+
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
* compare.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
Debug( LDAP_DEBUG_TRACE, "ldap_compare\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
#ifndef NO_CACHE
if ( ld->ld_cache != NULL ) {
- if ( check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) {
+ if ( ldap_check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) {
ber_free( ber, 1 );
ld->ld_errno = LDAP_SUCCESS;
return( ld->ld_msgid );
}
- add_request_to_cache( ld, LDAP_REQ_COMPARE, ber );
+ ldap_add_request_to_cache( ld, LDAP_REQ_COMPARE, ber );
}
#endif /* NO_CACHE */
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber ));
}
int
* delete.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
-
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_DELETE, dn, ber ));
}
* 7 March 1994 by Mark C Smith
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
#include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+#include <ctype.h>
+
+#include <ac/string.h>
+#include <ac/time.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
-#endif /* DOS */
-#endif /* MACOS */
+#endif
+
+#include <ac/unistd.h>
#include "lber.h"
#include "ldap.h"
#include "disptmpl.h"
-#ifndef NEEDPROTOS
-static void free_disptmpl();
-static int read_next_tmpl();
-int next_line_tokens();
-void free_strarray();
-#else /* !NEEDPROTOS */
-static void free_disptmpl( struct ldap_disptmpl *tmpl );
-static int read_next_tmpl( char **bufp, long *blenp,
- struct ldap_disptmpl **tmplp, int dtversion );
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-#endif /* !NEEDPROTOS */
+static void free_disptmpl LDAP_P(( struct ldap_disptmpl *tmpl ));
+static int read_next_tmpl LDAP_P(( char **bufp, long *blenp,
+ struct ldap_disptmpl **tmplp, int dtversion ));
+int next_line_tokens LDAP_P(( char **bufp, long *blenp, char ***toksp ));
+void free_strarray LDAP_P(( char **sap ));
static char *tmploptions[] = {
"addable", "modrdn",
ldap_init_templates_buf( char *buf, long buflen,
struct ldap_disptmpl **tmpllistp )
{
- int rc, version;
+ int rc=-1, version;
char **toks;
struct ldap_disptmpl *prevtmpl, *tmpl;
int i, j, tokcnt, samerow, adsource;
char **toks, *itemopts;
struct ldap_disptmpl *tmpl;
- struct ldap_oclist *ocp, *prevocp;
- struct ldap_adddeflist *adp, *prevadp;
- struct ldap_tmplitem *rowp, *ip, *previp;
+ struct ldap_oclist *ocp, *prevocp = NULL;
+ struct ldap_adddeflist *adp, *prevadp = NULL;
+ struct ldap_tmplitem *rowp = NULL, *ip, *previp = NULL;
*tmplp = NULL;
* 7 March 1994 by Mark C Smith
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+#include <ctype.h>
+
+#include <ac/string.h>
+#include <ac/time.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#include <stdlib.h>
-#endif /* DOS */
-#endif /* MACOS */
+#endif
#include "lber.h"
#include "ldap.h"
-#ifndef NEEDPROTOS
-int next_line_tokens();
-void free_strarray();
-static int next_line();
-static char *next_token();
-#else /* !NEEDPROTOS */
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-static int next_line( char **bufp, long *blenp, char **linep );
-static char *next_token( char ** sp );
-#endif /* !NEEDPROTOS */
+int next_line_tokens LDAP_P(( char **bufp, long *blenp, char ***toksp ));
+void free_strarray LDAP_P(( char **sap ));
+static int next_line LDAP_P(( char **bufp, long *blenp, char **linep ));
+static char *next_token LDAP_P(( char ** sp ));
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "lber.h"
#include "ldap.h"
};
static struct ldaperror ldap_errlist[] = {
- LDAP_SUCCESS, "Success",
- LDAP_OPERATIONS_ERROR, "Operations error",
- LDAP_PROTOCOL_ERROR, "Protocol error",
- LDAP_TIMELIMIT_EXCEEDED, "Timelimit exceeded",
- LDAP_SIZELIMIT_EXCEEDED, "Sizelimit exceeded",
- LDAP_COMPARE_FALSE, "Compare false",
- LDAP_COMPARE_TRUE, "Compare true",
- LDAP_STRONG_AUTH_NOT_SUPPORTED, "Strong authentication not supported",
- LDAP_STRONG_AUTH_REQUIRED, "Strong authentication required",
- LDAP_PARTIAL_RESULTS, "Partial results and referral received",
- LDAP_NO_SUCH_ATTRIBUTE, "No such attribute",
- LDAP_UNDEFINED_TYPE, "Undefined attribute type",
- LDAP_INAPPROPRIATE_MATCHING, "Inappropriate matching",
- LDAP_CONSTRAINT_VIOLATION, "Constraint violation",
- LDAP_TYPE_OR_VALUE_EXISTS, "Type or value exists",
- LDAP_INVALID_SYNTAX, "Invalid syntax",
- LDAP_NO_SUCH_OBJECT, "No such object",
- LDAP_ALIAS_PROBLEM, "Alias problem",
- LDAP_INVALID_DN_SYNTAX, "Invalid DN syntax",
- LDAP_IS_LEAF, "Object is a leaf",
- LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem",
- LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication",
- LDAP_INVALID_CREDENTIALS, "Invalid credentials",
- LDAP_INSUFFICIENT_ACCESS, "Insufficient access",
- LDAP_BUSY, "DSA is busy",
- LDAP_UNAVAILABLE, "DSA is unavailable",
- LDAP_UNWILLING_TO_PERFORM, "DSA is unwilling to perform",
- LDAP_LOOP_DETECT, "Loop detected",
- LDAP_NAMING_VIOLATION, "Naming violation",
- LDAP_OBJECT_CLASS_VIOLATION, "Object class violation",
- LDAP_NOT_ALLOWED_ON_NONLEAF, "Operation not allowed on nonleaf",
- LDAP_NOT_ALLOWED_ON_RDN, "Operation not allowed on RDN",
- LDAP_ALREADY_EXISTS, "Already exists",
- LDAP_NO_OBJECT_CLASS_MODS, "Cannot modify object class",
- LDAP_RESULTS_TOO_LARGE, "Results too large",
- LDAP_OTHER, "Unknown error",
- LDAP_SERVER_DOWN, "Can't contact LDAP server",
- LDAP_LOCAL_ERROR, "Local error",
- LDAP_ENCODING_ERROR, "Encoding error",
- LDAP_DECODING_ERROR, "Decoding error",
- LDAP_TIMEOUT, "Timed out",
- LDAP_AUTH_UNKNOWN, "Unknown authentication method",
- LDAP_FILTER_ERROR, "Bad search filter",
- LDAP_USER_CANCELLED, "User cancelled operation",
- LDAP_PARAM_ERROR, "Bad parameter to an ldap routine",
- LDAP_NO_MEMORY, "Out of memory",
- -1, 0
+ {LDAP_SUCCESS, "Success" },
+ {LDAP_OPERATIONS_ERROR, "Operations error" },
+ {LDAP_PROTOCOL_ERROR, "Protocol error" },
+ {LDAP_TIMELIMIT_EXCEEDED, "Timelimit exceeded" },
+ {LDAP_SIZELIMIT_EXCEEDED, "Sizelimit exceeded" },
+ {LDAP_COMPARE_FALSE, "Compare false" },
+ {LDAP_COMPARE_TRUE, "Compare true" },
+ {LDAP_STRONG_AUTH_NOT_SUPPORTED, "Strong authentication not supported" },
+ {LDAP_STRONG_AUTH_REQUIRED, "Strong authentication required" },
+ {LDAP_PARTIAL_RESULTS, "Partial results and referral received" },
+ {LDAP_NO_SUCH_ATTRIBUTE, "No such attribute" },
+ {LDAP_UNDEFINED_TYPE, "Undefined attribute type" },
+ {LDAP_INAPPROPRIATE_MATCHING, "Inappropriate matching" },
+ {LDAP_CONSTRAINT_VIOLATION, "Constraint violation" },
+ {LDAP_TYPE_OR_VALUE_EXISTS, "Type or value exists" },
+ {LDAP_INVALID_SYNTAX, "Invalid syntax" },
+ {LDAP_NO_SUCH_OBJECT, "No such object" },
+ {LDAP_ALIAS_PROBLEM, "Alias problem" },
+ {LDAP_INVALID_DN_SYNTAX, "Invalid DN syntax" },
+ {LDAP_IS_LEAF, "Object is a leaf" },
+ {LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem" },
+ {LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication" },
+ {LDAP_INVALID_CREDENTIALS, "Invalid credentials" },
+ {LDAP_INSUFFICIENT_ACCESS, "Insufficient access" },
+ {LDAP_BUSY, "DSA is busy" },
+ {LDAP_UNAVAILABLE, "DSA is unavailable" },
+ {LDAP_UNWILLING_TO_PERFORM, "DSA is unwilling to perform" },
+ {LDAP_LOOP_DETECT, "Loop detected" },
+ {LDAP_NAMING_VIOLATION, "Naming violation" },
+ {LDAP_OBJECT_CLASS_VIOLATION, "Object class violation" },
+ {LDAP_NOT_ALLOWED_ON_NONLEAF, "Operation not allowed on nonleaf" },
+ {LDAP_NOT_ALLOWED_ON_RDN, "Operation not allowed on RDN" },
+ {LDAP_ALREADY_EXISTS, "Already exists" },
+ {LDAP_NO_OBJECT_CLASS_MODS, "Cannot modify object class" },
+ {LDAP_RESULTS_TOO_LARGE, "Results too large" },
+ {LDAP_OTHER, "Unknown error" },
+ {LDAP_SERVER_DOWN, "Can't contact LDAP server" },
+ {LDAP_LOCAL_ERROR, "Local error" },
+ {LDAP_ENCODING_ERROR, "Encoding error" },
+ {LDAP_DECODING_ERROR, "Decoding error" },
+ {LDAP_TIMEOUT, "Timed out" },
+ {LDAP_AUTH_UNKNOWN, "Unknown authentication method" },
+ {LDAP_FILTER_ERROR, "Bad search filter" },
+ {LDAP_USER_CANCELLED, "User cancelled operation" },
+ {LDAP_PARAM_ERROR, "Bad parameter to an ldap routine" },
+ {LDAP_NO_MEMORY, "Out of memory" },
+ {-1, 0 }
};
char *
* link in lots of extra code when not using certain features
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
-
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <stdlib.h>
-#endif /* DOS */
-#endif /* MACOS */
+#include <ctype.h>
+
+#include <ac/string.h>
+#include <ac/time.h>
#include "lber.h"
#include "ldap.h"
* friendly.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
-
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS */
+#include <ctype.h>
-#if !defined( MACOS ) && !defined( DOS )
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
* getattr.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+#include <ctype.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
Debug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 );
- if ( (*ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (*ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( NULL );
}
* getdn.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
-#define DISABLE_BRIDGE
-#include "portable.h"
-
#include <stdio.h>
-#include <ctype.h>
-#include <ac/string.h>
#include <stdlib.h>
+#include <ctype.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
+#include "portable.h"
+
#ifdef LDAP_DNS
/*
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
*
- * getdxbyname - retrieve DX records from the DNS (from TXT records for now)
+ * ldap_getdxbyname - retrieve DX records from the DNS (from TXT records for now)
*/
+
#include <stdio.h>
-#include <string.h>
+#include <stdlib.h>
#include <ctype.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
-
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 )
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <resolv.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
-
-
-#ifdef NEEDPROTOS
-static char ** decode_answer( unsigned char *answer, int len );
-#else /* NEEDPROTOS */
-static char **decode_answer();
-#endif /* NEEDPROTOS */
+static char ** decode_answer LDAP_P(( unsigned char *answer, int len ));
extern int h_errno;
extern char *h_errlist[];
/*
- * getdxbyname - lookup DNS DX records for domain and return an ordered
+ * ldap_getdxbyname - lookup DNS DX records for domain and return an ordered
* array.
*/
char **
-getdxbyname( char *domain )
+ldap_getdxbyname( char *domain )
{
unsigned char buf[ PACKETSZ ];
char **dxs;
int rc;
- Debug( LDAP_DEBUG_TRACE, "getdxbyname( %s )\n", domain, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_getdxbyname( %s )\n", domain, 0, 0 );
memset( buf, 0, sizeof( buf ));
int dx_pref[ MAX_TO_SORT ];
#ifdef LDAP_DEBUG
+#ifdef notdef
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
-/* __p_query( answer ); /* */
+ __p_query( answer );
}
+#endif
#endif /* LDAP_DEBUG */
dxs = NULL;
* getentry.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+#include <ctype.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
* getfilter.c -- optional add-on to libldap
*/
-#define DISABLE_BRIDGE
#include "portable.h"
#ifndef lint
#include <stdio.h>
#include <stdlib.h>
-#include <ac/string.h>
#include <ctype.h>
+
+#include <ac/errno.h>
+#include <ac/regex.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
+
#include <sys/types.h>
-#include <regex.h>
-
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#include <sys/errno.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
-#endif /* DOS */
-#endif /* MACOS */
+#endif
#include "lber.h"
#include "ldap.h"
nextflp->lfl_tag = strdup( tag );
nextflp->lfl_pattern = tok[ 0 ];
if ( (rc = regcomp( &re, nextflp->lfl_pattern, 0 )) != 0 ) {
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
char error[512];
regerror(rc, &re, error, sizeof(error));
ldap_getfilter_free( lfdp );
#if !defined( MACOS ) && !defined( DOS )
errno = EINVAL;
#endif
-#endif /* NO_USERINTERFACE */
+#endif /* LDAP_LIBUI */
free_strarray( tok );
return( NULL );
}
*f++ = *p;
}
- if ( f - filtbuf > buflen ) {
+ if ( (unsigned long) (f - filtbuf) > buflen ) {
/* sanity check */
--f;
break;
}
}
- if ( suffix != NULL && ( f - filtbuf ) < buflen ) {
+ if ( suffix != NULL && (
+ (unsigned long) ( f - filtbuf ) < buflen ) )
+ {
strcpy( f, suffix );
} else {
*f = '\0';
* getvalues.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+#include <ctype.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
* kbind.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#ifdef KERBEROS
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include "msdos.h"
-#endif /* DOS */
-#include <krb.h>
-#include <stdlib.h>
-#if !defined(DOS) && !defined( _WIN32 )
-#include <sys/types.h>
-#endif /* !DOS && !_WIN32 */
-#include <sys/time.h>
-#include <sys/socket.h>
-#endif /* MACOS */
+
+#include <ac/krb.h>
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
BerElement *ber;
char *cred;
int rc, credlen;
- char *get_kerberosv4_credentials();
+ char *ldap_get_kerberosv4_credentials();
#ifdef STR_TRANSLATION
int str_translation_on;
#endif /* STR_TRANSLATION */
if ( dn == NULL )
dn = "";
- if ( (cred = get_kerberosv4_credentials( ld, dn, "ldapserver",
+ if ( (cred = ldap_get_kerberosv4_credentials( ld, dn, "ldapserver",
&credlen )) == NULL ) {
return( -1 ); /* ld_errno should already be set */
}
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
free( cred );
return( -1 );
}
#endif /* !NO_CACHE */
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
}
int
BerElement *ber;
char *cred;
int rc, credlen;
- char *get_kerberosv4_credentials();
+ char *ldap_get_kerberosv4_credentials();
#ifdef STR_TRANSLATION
int str_translation_on;
#endif /* STR_TRANSLATION */
if ( dn == NULL )
dn = "";
- if ( (cred = get_kerberosv4_credentials( ld, dn, "x500dsa", &credlen ))
+ if ( (cred = ldap_get_kerberosv4_credentials( ld, dn, "x500dsa", &credlen ))
== NULL ) {
return( -1 ); /* ld_errno should already be set */
}
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
free( cred );
return( -1 );
}
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
}
/* synchronous bind to DSA using kerberos */
#ifndef AUTHMAN
/*
- * get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
+ * ldap_get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
* The dn of the entry to which to bind is supplied. It's assumed the
* user already has a tgt.
*/
char *
-get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
+ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
{
KTEXT_ST ktxt;
int err;
char realm[REALM_SZ], *cred, *krbinstance;
- Debug( LDAP_DEBUG_TRACE, "get_kerberosv4_credentials\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_get_kerberosv4_credentials\n", 0, 0, 0 );
if ( (err = krb_get_tf_realm( tkt_string(), realm )) != KSUCCESS ) {
#ifndef NO_USERINTERFACE
/*
* in cache.c
*/
-#ifdef NEEDPROTOS
-void add_request_to_cache( LDAP *ld, unsigned long msgtype,
- BerElement *request );
-void add_result_to_cache( LDAP *ld, LDAPMessage *result );
-int check_cache( LDAP *ld, unsigned long msgtype, BerElement *request );
-#else /* NEEDPROTOS */
-void add_request_to_cache();
-void add_result_to_cache();
-int check_cache();
-#endif /* NEEDPROTOS */
+void ldap_add_request_to_cache LDAP_P(( LDAP *ld, unsigned long msgtype,
+ BerElement *request ));
+void ldap_add_result_to_cache LDAP_P(( LDAP *ld, LDAPMessage *result ));
+int ldap_check_cache LDAP_P(( LDAP *ld, unsigned long msgtype, BerElement *request ));
#ifdef KERBEROS
/*
* in kerberos.c
*/
-#ifdef NEEDPROTOS
-char *get_kerberosv4_credentials( LDAP *ld, char *who, char *service,
- int *len );
-#else /* NEEDPROTOS */
-char *get_kerberosv4_credentials();
-#endif /* NEEDPROTOS */
+char *ldap_get_kerberosv4_credentials LDAP_P(( LDAP *ld, char *who, char *service,
+ int *len ));
#endif /* KERBEROS */
/*
* in open.c
*/
-#ifdef NEEDPROTOS
int open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport,
char **krbinstancep, int async );
-#else /* NEEDPROTOS */
-int open_ldap_connection();
-#endif /* NEEDPROTOS */
/*
* in os-ip.c
*/
-#ifdef NEEDPROTOS
-int connect_to_host( Sockbuf *sb, char *host, unsigned long address, int port,
+int ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, int port,
int async );
-void close_connection( Sockbuf *sb );
-#else /* NEEDPROTOS */
-int connect_to_host();
-void close_connection();
-#endif /* NEEDPROTOS */
+void ldap_close_connection( Sockbuf *sb );
#ifdef KERBEROS
-#ifdef NEEDPROTOS
-char *host_connected_to( Sockbuf *sb );
-#else /* NEEDPROTOS */
-char *host_connected_to();
-#endif /* NEEDPROTOS */
+char *ldap_host_connected_to( Sockbuf *sb );
#endif /* KERBEROS */
#ifdef LDAP_REFERRALS
-#ifdef NEEDPROTOS
int do_ldap_select( LDAP *ld, struct timeval *timeout );
-void *new_select_info( void );
-void free_select_info( void *sip );
-void mark_select_write( LDAP *ld, Sockbuf *sb );
-void mark_select_read( LDAP *ld, Sockbuf *sb );
-void mark_select_clear( LDAP *ld, Sockbuf *sb );
-int is_read_ready( LDAP *ld, Sockbuf *sb );
-int is_write_ready( LDAP *ld, Sockbuf *sb );
-#else /* NEEDPROTOS */
-int do_ldap_select();
-void *new_select_info();
-void free_select_info();
-void mark_select_write();
-void mark_select_read();
-void mark_select_clear();
-int is_read_ready();
-int is_write_ready();
-#endif /* NEEDPROTOS */
+void *ldap_new_select_info( void );
+void ldap_free_select_info( void *sip );
+void ldap_mark_select_write( LDAP *ld, Sockbuf *sb );
+void ldap_mark_select_read( LDAP *ld, Sockbuf *sb );
+void ldap_mark_select_clear( LDAP *ld, Sockbuf *sb );
+int ldap_is_read_ready( LDAP *ld, Sockbuf *sb );
+int ldap_is_write_ready( LDAP *ld, Sockbuf *sb );
#endif /* LDAP_REFERRALS */
/*
* in request.c
*/
-#ifdef NEEDPROTOS
-int send_initial_request( LDAP *ld, unsigned long msgtype,
+int ldap_send_initial_request( LDAP *ld, unsigned long msgtype,
char *dn, BerElement *ber );
-BerElement *alloc_ber_with_options( LDAP *ld );
-void set_ber_options( LDAP *ld, BerElement *ber );
-#else /* NEEDPROTOS */
-int send_initial_request();
-BerElement *alloc_ber_with_options();
-void set_ber_options();
-#endif /* NEEDPROTOS */
+BerElement *ldap_alloc_ber_with_options( LDAP *ld );
+void ldap_set_ber_options( LDAP *ld, BerElement *ber );
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
-#ifdef NEEDPROTOS
-int send_server_request( LDAP *ld, BerElement *ber, int msgid,
+int ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid,
LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc,
int bind );
-LDAPConn *new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
+LDAPConn *ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
int connect, int bind );
-LDAPRequest *find_request_by_msgid( LDAP *ld, int msgid );
-void free_request( LDAP *ld, LDAPRequest *lr );
-void free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
-void dump_connection( LDAP *ld, LDAPConn *lconns, int all );
-void dump_requests_and_responses( LDAP *ld );
-#else /* NEEDPROTOS */
-int send_server_request();
-LDAPConn *new_connection();
-LDAPRequest *find_request_by_msgid();
-void free_request();
-void free_connection();
-void dump_connection();
-void dump_requests_and_responses();
-#endif /* NEEDPROTOS */
+LDAPRequest *ldap_find_request_by_msgid( LDAP *ld, int msgid );
+void ldap_free_request( LDAP *ld, LDAPRequest *lr );
+void ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
+void ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all );
+void ldap_dump_requests_and_responses( LDAP *ld );
#endif /* LDAP_REFERRALS || LDAP_DNS */
#ifdef LDAP_REFERRALS
-#ifdef NEEDPROTOS
-int chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp );
-int append_referral( LDAP *ld, char **referralsp, char *s );
-#else /* NEEDPROTOS */
-int chase_referrals();
-int append_referral();
-#endif /* NEEDPROTOS */
+int ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp );
+int ldap_append_referral( LDAP *ld, char **referralsp, char *s );
#endif /* LDAP_REFERRALS */
/*
* in search.c
*/
-#ifdef NEEDPROTOS
BerElement *ldap_build_search_req( LDAP *ld, char *base, int scope,
char *filter, char **attrs, int attrsonly );
-#else /* NEEDPROTOS */
-BerElement *ldap_build_search_req();
-#endif /* NEEDPROTOS */
/*
* in unbind.c
*/
-#ifdef NEEDPROTOS
int ldap_ld_free( LDAP *ld, int close );
-int send_unbind( LDAP *ld, Sockbuf *sb );
-#else /* NEEDPROTOS */
-int ldap_ld_free();
-int send_unbind();
-#endif /* NEEDPROTOS */
-
+int ldap_send_unbind( LDAP *ld, Sockbuf *sb );
#ifdef LDAP_DNS
/*
* in getdxbyname.c
*/
-#ifdef NEEDPROTOS
-char **getdxbyname( char *domain );
-#else /* NEEDPROTOS */
-char **getdxbyname();
-#endif /* NEEDPROTOS */
+char **ldap_getdxbyname( char *domain );
#endif /* LDAP_DNS */
+
+#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
+/*
+ * in charset.c
+ *
+ * added-in this stuff so that libldap.a would build, i.e. refs to
+ * these routines from open.c would resolve.
+ * hodges@stanford.edu 5-Feb-96
+ */
+#if LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET
+extern
+int ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input );
+extern
+int ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input );
+#endif /* LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET */
+#endif /* STR_TRANSLATION && LDAP_DEFAULT_CHARSET */
--- /dev/null
+# Microsoft Developer Studio Project File - Name="libldap" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libldap - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libldap.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libldap.mak" CFG="libldap - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libldap - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libldap - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "libldap - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# 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 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "libldap - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /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 /out:"..\Debug\libldap.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "libldap - Win32 Release"
+# Name "libldap - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\abandon.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\add.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\addentry.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\bind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cache.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\charset.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cldap.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\compare.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\delete.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\disptmpl.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\dsparse.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\error.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\free.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\friendly.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getattr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getdn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getdxbyname.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getentry.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getfilter.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getvalues.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\kbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\ldap-int.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\modify.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\modrdn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\open.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\os-ip.c"
+# End Source File
+# Begin Source File
+
+SOURCE=.\request.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\result.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\search.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sort.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\srchpref.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ufn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\unbind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\url.c
+# End Source File
+# End Target
+# End Project
--- /dev/null
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libldap"=.\libldap.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
* modify.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
}
/* send the message */
- return( send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber ));
+ return( ldap_send_initial_request( ld, LDAP_REQ_MODIFY, dn, ber ));
}
int
* modrdn.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
Debug( LDAP_DEBUG_TRACE, "ldap_modrdn\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
}
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_MODRDN, dn, ber ));
}
int
* open.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#include <stdlib.h>
-#endif /* DOS */
+#include <ac/socket.h>
+#include <ac/string.h>
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 )
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#ifndef VMS
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#include <netinet/in.h>
-#endif
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
}
srv->lsrv_port = ld->ld_defport;
- if (( ld->ld_defconn = new_connection( ld, &srv, 1,1,0 )) == NULL ) {
+ 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 );
}
#ifdef LDAP_REFERRALS
- if (( ld->ld_selectinfo = new_select_info()) == NULL ) {
+ if (( ld->ld_selectinfo = ldap_new_select_info()) == NULL ) {
free( (char*)ld );
return( NULL );
}
if ( defhost != NULL &&
( ld->ld_defhost = strdup( defhost )) == NULL ) {
#ifdef LDAP_REFERRALS
- free_select_info( ld->ld_selectinfo );
+ ldap_free_select_info( ld->ld_selectinfo );
#endif /* LDAP_REFERRALS */
free( (char*)ld );
return( NULL );
ld->ld_lberoptions = LBER_USE_DER;
ld->ld_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT;
+#ifdef LDAP_REFERRALS
+ ld->ld_options |= LDAP_OPT_REFERRALS;
+#endif /* LDAP_REFERRALS */
+
#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
ld->ld_lberoptions |= LBER_TRANSLATE_STRINGS;
#if LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET
open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport,
char **krbinstancep, int async )
{
- int rc, port;
+ int rc = -1;
+ int port;
char *p, *q, *r;
char *curhost, hostname[ 2*MAXHOSTNAMELEN ];
Debug( LDAP_DEBUG_TRACE, "open_ldap_connection\n", 0, 0, 0 );
- defport = htons( defport );
+ defport = htons( (short) defport );
if ( host != NULL ) {
for ( p = host; p != NULL && *p != '\0'; p = q ) {
port = defport;
}
- if (( rc = connect_to_host( sb, curhost, 0L,
+ if (( rc = ldap_connect_to_host( sb, curhost, 0L,
port, async )) != -1 ) {
break;
}
}
} else {
- rc = connect_to_host( sb, NULL, htonl( INADDR_LOOPBACK ),
+ rc = ldap_connect_to_host( sb, NULL, htonl( INADDR_LOOPBACK ),
defport, async );
}
if ( krbinstancep != NULL ) {
#ifdef KERBEROS
- if (( *krbinstancep = host_connected_to( sb )) != NULL &&
+ if (( *krbinstancep = ldap_host_connected_to( sb )) != NULL &&
( p = strchr( *krbinstancep, '.' )) != NULL ) {
*p = '\0';
}
* os-ip.c -- platform-specific TCP & UDP related code
*/
-#ifndef lint
-static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
-#define DISABLE_BRIDGE
#include "portable.h"
#include <stdio.h>
#include <stdlib.h>
+
+#include <ac/errno.h>
+#include <ac/socket.h>
#include <ac/string.h>
-#include <errno.h>
+#include <ac/unistd.h>
-#ifdef _WIN32
+#ifdef HAVE_IO_H
#include <io.h>
-#include "msdos.h"
-#else /* _WIN32 */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <unistd.h>
-#endif /* _WIN32 */
-#ifdef _AIX
-#include <sys/select.h>
-#endif /* _AIX */
-#ifdef VMS
-#include "ucx_select.h"
-#endif /* VMS */
-
-#include "portable.h"
-#include "lber.h"
-#include "ldap.h"
+#endif /* HAVE_IO_H */
-#ifdef LDAP_REFERRALS
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
-#ifdef notyet
-#ifdef NEED_FILIO
+#if defined( HAVE_SYS_FILIO_H )
#include <sys/filio.h>
-#else /* NEED_FILIO */
+#elif defined( HAVE_SYS_IOCTL_H )
#include <sys/ioctl.h>
-#endif /* NEED_FILIO */
-#endif /* notyet */
-#endif /* LDAP_REFERRALS */
-
-#ifdef MACOS
-#define tcp_close( s ) tcpclose( s )
-#else /* MACOS */
-#ifdef DOS
-#ifdef PCNFS
-#define tcp_close( s ) close( s )
-#endif /* PCNFS */
-#ifdef NCSA
-#define tcp_close( s ) netclose( s ); netshut()
-#endif /* NCSA */
-#ifdef WINSOCK
-#define tcp_close( s ) closesocket( s ); WSACleanup();
-#endif /* WINSOCK */
-#else /* DOS */
-#define tcp_close( s ) close( s )
-#endif /* DOS */
-#endif /* MACOS */
+#endif
+#include "lber.h"
+#include "ldap.h"
#include "ldap-int.h"
int
#endif /* notyet */
Debug( LDAP_DEBUG_TRACE, "ldap_connect_to_host: %s:%d\n",
- ( host == NULL ) ? "(by address)" : host, ntohs( port ), 0 );
+ ( host == NULL ) ? "(by address)" : host, (int) ntohs( (short) port ), 0 );
connected = use_hp = 0;
sip = (struct selectinfo *)ld->ld_selectinfo;
if ( !FD_ISSET( sb->sb_sd, &sip->si_writefds )) {
- FD_SET( sb->sb_sd, &sip->si_writefds );
+ FD_SET( (u_int) sb->sb_sd, &sip->si_writefds );
}
}
sip = (struct selectinfo *)ld->ld_selectinfo;
if ( !FD_ISSET( sb->sb_sd, &sip->si_readfds )) {
- FD_SET( sb->sb_sd, &sip->si_readfds );
+ FD_SET( (u_int) sb->sb_sd, &sip->si_readfds );
}
}
sip = (struct selectinfo *)ld->ld_selectinfo;
- FD_CLR( sb->sb_sd, &sip->si_writefds );
- FD_CLR( sb->sb_sd, &sip->si_readfds );
+ FD_CLR( (u_int) sb->sb_sd, &sip->si_writefds );
+ FD_CLR( (u_int) sb->sb_sd, &sip->si_readfds );
}
Debug( LDAP_DEBUG_TRACE, "do_ldap_select\n", 0, 0, 0 );
if ( tblsize == 0 ) {
-#ifdef USE_SYSCONF
+#if defined( HAVE_SYSCONF )
tblsize = sysconf( _SC_OPEN_MAX );
-#else /* !USE_SYSCONF */
+#elif defined( HAVE_GETDTABLESIZE )
tblsize = getdtablesize();
#endif /* !USE_SYSCONF */
* request.c - sending of ldap requests; handling of referrals
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include <time.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#include <time.h>
-#include <stdlib.h>
-#ifdef PCNFS
-#include <tklib.h>
-#include <tk_errno.h>
-#include <bios.h>
-#endif /* PCNFS */
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <errno.h>
-#ifdef _AIX
-#include <sys/select.h>
-#endif /* _AIX */
-#include "portable.h"
-#endif /* DOS */
-#endif /* MACOS */
-#ifdef VMS
-#include "ucx_select.h"
-#endif
+
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
-
-
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
-#ifdef NEEDPROTOS
-static LDAPConn *find_connection( LDAP *ld, LDAPServer *srv, int any );
-static void use_connection( LDAP *ld, LDAPConn *lc );
-static void free_servers( LDAPServer *srvlist );
-#else /* NEEDPROTOS */
-static LDAPConn *find_connection();
-static void use_connection();
-static void free_servers();
-#endif /* NEEDPROTOS */
+static LDAPConn *find_connection LDAP_P(( LDAP *ld, LDAPServer *srv, int any ));
+static void use_connection LDAP_P(( LDAP *ld, LDAPConn *lc ));
+static void free_servers LDAP_P(( LDAPServer *srvlist ));
#endif /* LDAP_REFERRALS || LDAP_DNS */
#ifdef LDAP_DNS
-#ifdef NEEDPROTOS
-static LDAPServer *dn2servers( LDAP *ld, char *dn );
-#else /* NEEDPROTOS */
-static LDAPServer *dn2servers();
-#endif /* NEEDPROTOS */
+#tatic LDAPServer *dn2servers LDAP_P(( LDAP *ld, char *dn ));
#endif /* LDAP_DNS */
#ifdef LDAP_REFERRALS
-#ifdef NEEDPROTOS
-static BerElement *re_encode_request( LDAP *ld, BerElement *origber,
- int msgid, char **dnp );
-#else /* NEEDPROTOS */
-static BerElement *re_encode_request();
-#endif /* NEEDPROTOS */
+static BerElement *re_encode_request LDAP_P(( LDAP *ld, BerElement *origber,
+ int msgid, char **dnp ));
#endif /* LDAP_REFERRALS */
BerElement *
-alloc_ber_with_options( LDAP *ld )
+ldap_alloc_ber_with_options( LDAP *ld )
{
BerElement *ber;
ld->ld_errno = LDAP_NO_MEMORY;
#ifdef STR_TRANSLATION
} else {
- set_ber_options( ld, ber );
+ ldap_set_ber_options( ld, ber );
#endif /* STR_TRANSLATION */
}
void
-set_ber_options( LDAP *ld, BerElement *ber )
+ldap_set_ber_options( LDAP *ld, BerElement *ber )
{
ber->ber_options = ld->ld_lberoptions;
#ifdef STR_TRANSLATION
int
-send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
+ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
BerElement *ber )
{
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
LDAPServer *servers;
#endif /* LDAP_REFERRALS || LDAP_DNS */
- Debug( LDAP_DEBUG_TRACE, "send_initial_request\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 );
#if !defined( LDAP_REFERRALS ) && !defined( LDAP_DNS )
if ( ber_flush( &ld->ld_sb, ber, 1 ) != 0 ) {
}
#endif /* LDAP_DNS */
- return( send_server_request( ld, ber, ld->ld_msgid, NULL, servers,
+ return( ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, servers,
NULL, 0 ));
#endif /* !LDAP_REFERRALS && !LDAP_DNS */
}
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
int
-send_server_request( LDAP *ld, BerElement *ber, int msgid, LDAPRequest
+ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid, LDAPRequest
*parentreq, LDAPServer *srvlist, LDAPConn *lc, int bind )
{
LDAPRequest *lr;
+ int incparent;
- Debug( LDAP_DEBUG_TRACE, "send_server_request\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_send_server_request\n", 0, 0, 0 );
+ incparent = 0;
ld->ld_errno = LDAP_SUCCESS; /* optimistic */
if ( lc == NULL ) {
} else {
if (( lc = find_connection( ld, srvlist, 1 )) ==
NULL ) {
- lc = new_connection( ld, &srvlist, 0, 1, bind );
+ if ( bind && (parentreq != NULL) ) {
+ /* Remember the bind in the parent */
+ incparent = 1;
+ ++parentreq->lr_outrefcnt;
+ }
+ lc = ldap_new_connection( ld, &srvlist, 0, 1, bind );
}
free_servers( srvlist );
}
if ( ld->ld_errno == LDAP_SUCCESS ) {
ld->ld_errno = LDAP_SERVER_DOWN;
}
+ if ( incparent ) {
+ /* Forget about the bind */
+ --parentreq->lr_outrefcnt;
+ }
return( -1 );
}
if (( lr = (LDAPRequest *)calloc( 1, sizeof( LDAPRequest ))) ==
NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
- free_connection( ld, lc, 0, 0 );
+ ldap_free_connection( ld, lc, 0, 0 );
ber_free( ber, 1 );
+ if ( incparent ) {
+ /* Forget about the bind */
+ --parentreq->lr_outrefcnt;
+ }
return( -1 );
}
lr->lr_msgid = msgid;
lr->lr_ber = ber;
lr->lr_conn = lc;
if ( parentreq != NULL ) { /* sub-request */
- ++parentreq->lr_outrefcnt;
+ if ( !incparent ) {
+ /* Increment if we didn't do it before the bind */
+ ++parentreq->lr_outrefcnt;
+ }
lr->lr_origid = parentreq->lr_origid;
lr->lr_parentcnt = parentreq->lr_parentcnt + 1;
lr->lr_parent = parentreq;
if ( errno == EWOULDBLOCK ) {
/* need to continue write later */
lr->lr_status = LDAP_REQST_WRITING;
- mark_select_write( ld, lc->lconn_sb );
+ ldap_mark_select_write( ld, lc->lconn_sb );
} else {
#else /* notyet */
ld->ld_errno = LDAP_SERVER_DOWN;
- free_request( ld, lr );
- free_connection( ld, lc, 0, 0 );
+ ldap_free_request( ld, lr );
+ ldap_free_connection( ld, lc, 0, 0 );
return( -1 );
#endif /* notyet */
#ifdef notyet
}
/* sent -- waiting for a response */
- mark_select_read( ld, lc->lconn_sb );
+ ldap_mark_select_read( ld, lc->lconn_sb );
}
ld->ld_errno = LDAP_SUCCESS;
LDAPConn *
-new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
+ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
int connect, int bind )
{
LDAPConn *lc;
}
if ( err != 0 ) {
- free_connection( ld, lc, 1, 0 );
+ ldap_free_connection( ld, lc, 1, 0 );
lc = NULL;
}
}
void
-free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
+ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
{
LDAPConn *tmplc, *prevlc;
- Debug( LDAP_DEBUG_TRACE, "free_connection\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_free_connection\n", 0, 0, 0 );
if ( force || --lc->lconn_refcnt <= 0 ) {
if ( lc->lconn_status == LDAP_CONNST_CONNECTED ) {
- mark_select_clear( ld, lc->lconn_sb );
+ ldap_mark_select_clear( ld, lc->lconn_sb );
if ( unbind ) {
- send_unbind( ld, lc->lconn_sb );
+ ldap_send_unbind( ld, lc->lconn_sb );
}
- close_connection( lc->lconn_sb );
+ ldap_close_connection( lc->lconn_sb );
if ( lc->lconn_sb->sb_ber.ber_buf != NULL ) {
free( lc->lconn_sb->sb_ber.ber_buf );
}
}
break;
}
+ prevlc = tmplc;
}
free_servers( lc->lconn_server );
if ( lc->lconn_krbinstance != NULL ) {
free( (char *)lc->lconn_sb );
}
free( lc );
- Debug( LDAP_DEBUG_TRACE, "free_connection: actually freed\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: actually freed\n",
0, 0, 0 );
} else {
lc->lconn_lastused = time( 0 );
- Debug( LDAP_DEBUG_TRACE, "free_connection: refcnt %d\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: refcnt %d\n",
lc->lconn_refcnt, 0, 0 );
}
}
#ifdef LDAP_DEBUG
void
-dump_connection( LDAP *ld, LDAPConn *lconns, int all )
+ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all )
{
LDAPConn *lc;
void
-dump_requests_and_responses( LDAP *ld )
+ldap_dump_requests_and_responses( LDAP *ld )
{
LDAPRequest *lr;
LDAPMessage *lm, *l;
void
-free_request( LDAP *ld, LDAPRequest *lr )
+ldap_free_request( LDAP *ld, LDAPRequest *lr )
{
LDAPRequest *tmplr, *nextlr;
- Debug( LDAP_DEBUG_TRACE, "free_request (origid %d, msgid %d)\n",
+ Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n",
lr->lr_origid, lr->lr_msgid, 0 );
if ( lr->lr_parent != NULL ) {
/* free all referrals (child requests) */
for ( tmplr = lr->lr_refnext; tmplr != NULL; tmplr = nextlr ) {
nextlr = tmplr->lr_refnext;
- free_request( ld, tmplr );
+ ldap_free_request( ld, tmplr );
}
}
* XXX merging of errors in this routine needs to be improved
*/
int
-chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
+ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
{
int rc, count, len, newdn;
#ifdef LDAP_DNS
LDAPServer *srv;
BerElement *ber;
- Debug( LDAP_DEBUG_TRACE, "chase_referrals\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_chase_referrals\n", 0, 0, 0 );
ld->ld_errno = LDAP_SUCCESS; /* optimistic */
*hadrefp = 0;
} else {
Debug( LDAP_DEBUG_TRACE,
"ignoring unknown referral <%s>\n", ref, 0, 0 );
- rc = append_referral( ld, &unfollowed, ref );
+ rc = ldap_append_referral( ld, &unfollowed, ref );
*hadrefp = 1;
continue;
}
}
#endif /* LDAP_DNS */
- if ( srv != NULL && send_server_request( ld, ber, ld->ld_msgid,
+ if ( srv != NULL && ldap_send_server_request( ld, ber, ld->ld_msgid,
lr, srv, NULL, 1 ) >= 0 ) {
++count;
} else {
Debug( LDAP_DEBUG_ANY,
"Unable to chase referral (%s)\n",
ldap_err2string( ld->ld_errno ), 0, 0 );
- rc = append_referral( ld, &unfollowed, ref );
+ rc = ldap_append_referral( ld, &unfollowed, ref );
}
if ( !newdn && refdn != NULL ) {
int
-append_referral( LDAP *ld, char **referralsp, char *s )
+ldap_append_referral( LDAP *ld, char **referralsp, char *s )
{
int first;
return( NULL );
}
- if (( ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if (( ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( NULL );
}
LDAPRequest *
-find_request_by_msgid( LDAP *ld, int msgid )
+ldap_find_request_by_msgid( LDAP *ld, int msgid )
{
LDAPRequest *lr;
domain = dn;
}
- if (( dxs = getdxbyname( domain )) == NULL ) {
+ if (( dxs = ldap_getdxbyname( domain )) == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( NULL );
}
* result.c - wait for an ldap result
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include <time.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <time.h>
-#include "msdos.h"
-#ifdef PCNFS
-#include <tklib.h>
-#include <tk_errno.h>
-#include <bios.h>
-#endif /* PCNFS */
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#ifdef _AIX
-#include <sys/select.h>
-#endif /* _AIX */
-#include "portable.h"
-#endif /* DOS */
-#endif /* MACOS */
-#ifdef VMS
-#include "ucx_select.h"
-#endif
+
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
-
-#ifdef NEEDPROTOS
-static int ldap_abandoned( LDAP *ld, int msgid );
-static int ldap_mark_abandoned( LDAP *ld, int msgid );
-static int wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
- LDAPMessage **result );
+
+static int ldap_abandoned LDAP_P(( LDAP *ld, int msgid ));
+static int ldap_mark_abandoned LDAP_P(( LDAP *ld, int msgid ));
+static int wait4msg LDAP_P(( LDAP *ld, int msgid, int all, struct timeval *timeout,
+ LDAPMessage **result ));
#ifdef LDAP_REFERRALS
-static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc,
- LDAPMessage **result );
-static int build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr );
-static void merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr );
+static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc,
+ LDAPMessage **result ));
+static int build_result_ber LDAP_P(( LDAP *ld, BerElement *ber, LDAPRequest *lr ));
+static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
#else /* LDAP_REFERRALS */
-static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
- LDAPMessage **result );
+static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb,
+ LDAPMessage **result ));
#endif /* LDAP_REFERRALS */
#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
-static int ldap_select1( LDAP *ld, struct timeval *timeout );
-#endif
-#else /* NEEDPROTOS */
-static int ldap_abandoned();
-static int ldap_mark_abandoned();
-static int wait4msg();
-static int read1msg();
-#ifdef LDAP_REFERRALS
-static int build_result_ber();
-static void merge_error_info();
-#endif /* LDAP_REFERRALS */
-#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
-static int ldap_select1();
-#endif
-#endif /* NEEDPROTOS */
-
-#if !defined( MACOS ) && !defined( DOS )
-extern int errno;
+static int ldap_select1 LDAP_P(( LDAP *ld, struct timeval *timeout ));
#endif
{
int rc;
struct timeval tv, *tvp;
- long start_time, tmp_time;
+ time_t start_time = 0;
+ time_t tmp_time;
#ifdef LDAP_REFERRALS
LDAPConn *lc, *nextlc;
#endif /* LDAP_REFERRALS */
} else {
tv = *timeout;
tvp = &tv;
- start_time = (long)time( NULL );
+ start_time = time( NULL );
}
rc = -2;
#else /* !LDAP_REFERRALS */
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_TRACE ) {
- dump_connection( ld, ld->ld_conns, 1 );
- dump_requests_and_responses( ld );
+ ldap_dump_connection( ld, ld->ld_conns, 1 );
+ ldap_dump_requests_and_responses( ld );
}
#endif /* LDAP_DEBUG */
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
nextlc = lc->lconn_next;
if ( lc->lconn_status ==
LDAP_CONNST_CONNECTED &&
- is_read_ready( ld,
+ ldap_is_read_ready( ld,
lc->lconn_sb )) {
rc = read1msg( ld, msgid, all,
lc->lconn_sb, lc, result );
#endif /* !LDAP_REFERRALS */
if ( rc == -2 && tvp != NULL ) {
- tmp_time = (long)time( NULL );
+ tmp_time = time( NULL );
if (( tv.tv_sec -= ( tmp_time - start_time )) <= 0 ) {
rc = 0; /* timed out */
ld->ld_errno = LDAP_TIMEOUT;
Debug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 );
ber_init( &ber, 0 );
- set_ber_options( ld, &ber );
+ ldap_set_ber_options( ld, &ber );
/* get the next message */
if ( (tag = ber_get_next( sb, &len, &ber ))
}
#ifdef LDAP_REFERRALS
- if (( lr = find_request_by_msgid( ld, id )) == NULL ) {
+ if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
"no request for response with msgid %ld (tossing)\n",
id, 0, 0 );
!= LBER_ERROR ) {
if ( lderr != LDAP_SUCCESS ) {
/* referrals are in error string */
- refer_cnt = chase_referrals( ld, lr,
+ refer_cnt = ldap_chase_referrals( ld, lr,
&lr->lr_res_error, &hadref );
}
}
}
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
if ( lc != NULL ) {
- free_connection( ld, lc, 0, 1 );
+ ldap_free_connection( ld, lc, 0, 1 );
}
}
}
#ifndef NO_CACHE
if ( ld->ld_cache != NULL ) {
- add_result_to_cache( ld, new );
+ ldap_add_result_to_cache( ld, new );
}
#endif /* NO_CACHE */
prev->lm_next = l->lm_next;
*result = l;
ld->ld_errno = LDAP_SUCCESS;
+#ifdef LDAP_WORLD_P16
+ /*
+ * XXX questionable fix; see text for [P16] on
+ * http://www.critical-angle.com/ldapworld/patch/
+ *
+ * inclusion of this patch causes searchs to hang on
+ * multiple platforms
+ */
+ return( l->lm_msgtype );
+#else /* LDAP_WORLD_P16 */
return( tag );
+#endif /* !LDAP_WORLD_P16 */
}
return( -2 ); /* continue looking */
long along;
ber_init( ber, 0 );
- set_ber_options( ld, ber );
+ ldap_set_ber_options( ld, ber );
if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid,
(long)lr->lr_res_msgtype, lr->lr_res_errno,
lr->lr_res_matched ? lr->lr_res_matched : "",
if ( lr->lr_res_errno == LDAP_PARTIAL_RESULTS ) {
parentr->lr_res_errno = lr->lr_res_errno;
if ( lr->lr_res_error != NULL ) {
- (void)append_referral( ld, &parentr->lr_res_error,
+ (void)ldap_append_referral( ld, &parentr->lr_res_error,
lr->lr_res_error );
}
} else if ( lr->lr_res_errno != LDAP_SUCCESS &&
if ( tblsize == 0 ) {
#ifdef USE_SYSCONF
tblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
+#else /* !USE_SYSCONF */
tblsize = getdtablesize();
-#endif /* USE_SYSCONF */
+#endif /* !USE_SYSCONF */
+#ifdef FD_SETSIZE
+ if ( tblsize > FD_SETSIZE ) {
+ tblsize = FD_SETSIZE;
+ }
+#endif /* FD_SETSIZE */
}
FD_ZERO( &readfds );
* sbind.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-#if !defined( MACOS ) && !defined( DOS )
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
passwd = "";
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( -1 );
}
#endif /* !NO_CACHE */
/* send the message */
- return( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+ return( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
}
/*
* search.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
#include <ctype.h>
-
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
+#include <ac/socket.h>
+#include <ac/string.h>
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 )
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
-#ifdef NEEDPROTOS
-static char *find_right_paren( char *s );
-static char *put_complex_filter( BerElement *ber, char *str,
- unsigned long tag, int not );
-static int put_filter( BerElement *ber, char *str );
-static int put_simple_filter( BerElement *ber, char *str );
-static int put_substring_filter( BerElement *ber, char *type, char *str );
-static int put_filter_list( BerElement *ber, char *str );
-#else
-static char *find_right_paren();
-static char *put_complex_filter();
-static int put_filter();
-static int put_simple_filter();
-static int put_substring_filter();
-static int put_filter_list();
-#endif /* NEEDPROTOS */
+static char *find_right_paren LDAP_P(( char *s ));
+static char *put_complex_filter LDAP_P(( BerElement *ber, char *str,
+ unsigned long tag, int not ));
+static int put_filter LDAP_P(( BerElement *ber, char *str ));
+static int put_simple_filter LDAP_P(( BerElement *ber, char *str ));
+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:
#ifndef NO_CACHE
if ( ld->ld_cache != NULL ) {
- if ( check_cache( ld, LDAP_REQ_SEARCH, ber ) == 0 ) {
+ if ( ldap_check_cache( ld, LDAP_REQ_SEARCH, ber ) == 0 ) {
ber_free( ber, 1 );
ld->ld_errno = LDAP_SUCCESS;
return( ld->ld_msgid );
}
- add_request_to_cache( ld, LDAP_REQ_SEARCH, ber );
+ ldap_add_request_to_cache( ld, LDAP_REQ_SEARCH, ber );
}
#endif /* NO_CACHE */
/* send the message */
- return ( send_initial_request( ld, LDAP_REQ_SEARCH, base, ber ));
+ return ( ldap_send_initial_request( ld, LDAP_REQ_SEARCH, base, ber ));
}
*/
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( NULLBER );
}
* sort.c: LDAP library entry and value sort routines
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
#include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS */
-#endif /* MACOS */
+#include <ctype.h>
+
+#include <ac/string.h>
+#include <ac/time.h>
#include "lber.h"
#include "ldap.h"
+
struct entrything {
char **et_vals;
LDAPMessage *et_msg;
};
-#ifndef NEEDPROTOS
-static int (*et_cmp_fn)();
-static int et_cmp();
-#else /* !NEEDPROTOS */
-static int (*et_cmp_fn)( char *a, char *b );
-static int et_cmp( void *aa, void *bb);
-#endif /* !NEEDPROTOS */
+static int (*et_cmp_fn) LDAP_P(( char *a, char *b ));
+static int et_cmp LDAP_P(( void *aa, void *bb));
+
int
ldap_sort_strcasecmp(
ldap_sort_values(
LDAP *ld,
char **vals,
- int (*cmp)()
+ int (*cmp) LDAP_P((const void *, const void *))
)
{
int nel;
for ( nel = 0; vals[nel] != NULL; nel++ )
; /* NULL */
- qsort( vals, nel, sizeof(char *), cmp );
+ qsort( vals, nel, sizeof(char *), (void *) cmp );
return( 0 );
}
* 17 May 1994 by Gordon Good
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
#include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+#include <ctype.h>
+
+#include <ac/string.h>
+#include <ac/unistd.h>
+#include <ac/time.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
-#endif /* DOS */
-#endif /* MACOS */
+#endif
#include "lber.h"
#include "ldap.h"
#include "srchpref.h"
-#ifndef NEEDPROTOS
-int next_line_tokens();
-void free_strarray();
-static void free_searchobj();
-static int read_next_searchobj();
-#else /* !NEEDPROTOS */
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-static void free_searchobj( struct ldap_searchobj *so );
-static int read_next_searchobj( char **bufp, long *blenp,
- struct ldap_searchobj **sop, int soversion );
-#endif /* !NEEDPROTOS */
+int next_line_tokens LDAP_P(( char **bufp, long *blenp, char ***toksp ));
+void free_strarray LDAP_P(( char **sap ));
+static void free_searchobj LDAP_P(( struct ldap_searchobj *so ));
+static int read_next_searchobj LDAP_P(( char **bufp, long *blenp,
+ struct ldap_searchobj **sop, int soversion ));
static char *sobjoptions[] = {
ldap_init_searchprefs_buf( char *buf, long buflen,
struct ldap_searchobj **solistp )
{
- int rc, version;
+ int rc = -1, version;
char **toks;
struct ldap_searchobj *prevso, *so;
* ufn.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
+#include <ac/string.h>
#include <ctype.h>
-
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+
+#include <ac/socket.h>
#include "lber.h"
#include "ldap.h"
-#ifdef NEEDPROTOS
-typedef int (*cancelptype)( void *cancelparm );
-#else /* NEEDPROTOS */
-typedef int (*cancelptype)();
-#endif /* NEEDPROTOS */
+#include "ldapconfig.h"
+
+typedef int (*cancelptype) LDAP_P(( void *cancelparm ));
-#ifdef NEEDPROTOS
-static int ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp,
+static int ldap_ufn_search_ctx LDAP_P(( LDAP *ld, char **ufncomp, int ncomp,
char *prefix, char **attrs, int attrsonly, LDAPMessage **res,
cancelptype cancelproc, void *cancelparm, char *tag1, char *tag2,
- char *tag3 );
-static LDAPMessage *ldap_msg_merge( LDAP *ld, LDAPMessage *a, LDAPMessage *b );
-static LDAPMessage *ldap_ufn_expand( LDAP *ld, cancelptype cancelproc,
+ char *tag3 ));
+static LDAPMessage *ldap_msg_merge LDAP_P(( LDAP *ld, LDAPMessage *a, LDAPMessage *b ));
+static LDAPMessage *ldap_ufn_expand LDAP_P(( LDAP *ld, cancelptype cancelproc,
void *cancelparm, char **dns, char *filter, int scope,
- char **attrs, int aonly, int *err );
-LDAPFiltDesc *ldap_ufn_setfilter( LDAP *ld, char *fname );
-#else /* NEEDPROTOS */
-static LDAPMessage *ldap_msg_merge();
-static LDAPMessage *ldap_ufn_expand();
-LDAPFiltDesc *ldap_ufn_setfilter();
-#endif /* NEEDPROTOS */
+ char **attrs, int aonly, int *err ));
+LDAPFiltDesc *ldap_ufn_setfilter LDAP_P(( LDAP *ld, char *fname ));
/*
* ldap_ufn_search_ctx - do user friendly searching; provide cancel feature;
char **attrs, int attrsonly, LDAPMessage **res, cancelptype cancelproc,
void *cancelparm, char *tag1, char *tag2, char *tag3 )
{
- char *dn, *ftag;
- char **dns;
- int max, i, err, scope, phase, tries;
+ char *dn, *ftag = NULL;
+ char **dns = NULL;
+ int max, i, err, scope = 0, phase, tries;
LDAPFiltInfo *fi;
LDAPMessage *tmpcand;
LDAPMessage *candidates;
{
char **ufncomp, **prefixcomp;
char *pbuf;
- int ncomp, pcomp, i, err;
+ int ncomp, pcomp, i, err = 0;
/* initialize the getfilter stuff if it's not already */
if ( ld->ld_filtd == NULL && ldap_ufn_setfilter( ld, FILTERFILE )
* unbind.c
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
/* free LDAP structure and outstanding requests/responses */
for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) {
nextlr = lr->lr_next;
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
/* free and unbind from all open connections */
while ( ld->ld_conns != NULL ) {
- free_connection( ld, ld->ld_conns, 1, close );
+ ldap_free_connection( ld, ld->ld_conns, 1, close );
}
#else /* LDAP_REFERRALS */
if ( close ) {
- err = send_unbind( ld, &ld->ld_sb );
- close_connection( &ld->ld_sb );
+ err = ldap_send_unbind( ld, &ld->ld_sb );
+ ldap_close_connection( &ld->ld_sb );
}
#endif /* LDAP_REFERRALS */
} else {
#ifdef LDAP_REFERRALS
if ( ld->ld_selectinfo != NULL )
- free_select_info( ld->ld_selectinfo );
+ ldap_free_select_info( ld->ld_selectinfo );
#endif /* LDAP_REFERRALS */
if ( ld->ld_defhost != NULL )
int
-send_unbind( LDAP *ld, Sockbuf *sb )
+ldap_send_unbind( LDAP *ld, Sockbuf *sb )
{
BerElement *ber;
- Debug( LDAP_DEBUG_TRACE, "send_unbind\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_send_unbind\n", 0, 0, 0 );
/* create a message to send */
- if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+ if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
return( ld->ld_errno );
}
* We also tolerate URLs that look like: <ldapurl> and <URL:ldapurl>
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1996 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
#include <stdlib.h>
+#include <ctype.h>
-#ifdef MACOS
-#include "macos.h"
-#endif /* MACOS */
-
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS || _WIN32 */
-
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 )
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* !MACOS && !DOS && !_WIN32 */
+#include <ac/socket.h>
+#include <ac/string.h>
#include "lber.h"
#include "ldap.h"
--- /dev/null
+# Microsoft Developer Studio Project File - Name="libldbm" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libldbm - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libldbm.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libldbm.mak" CFG="libldbm - Win32 Debug"
+!MESSAGE
+!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
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "libldbm - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# 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 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "libldbm - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /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 /out:"..\Debug\libldbm.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "libldbm - Win32 Release"
+# Name "libldbm - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\ldbm.c
+# End Source File
+# End Target
+# End Project
--- /dev/null
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libldbm"=.\libldbm.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
--- /dev/null
+# Microsoft Developer Studio Project File - Name="libldif" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=libldif - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libldif.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libldif.mak" CFG="libldif - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libldif - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "libldif - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "libldif - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# 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 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "libldif - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /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 /out:"..\Debug\libldif.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "libldif - Win32 Release"
+# Name "libldif - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\line64.c
+# End Source File
+# End Target
+# End Project
--- /dev/null
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libldif"=.\libldif.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
/* line64.c - routines for dealing with the slapd line format */
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
#include <ctype.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "lber.h"
#include "ldap.h"
#include "ldif.h"
--- /dev/null
+# Microsoft Developer Studio Project File - Name="liblthread" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=liblthread - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "liblthread.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "liblthread.mak" CFG="liblthread - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "liblthread - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "liblthread - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "liblthread - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# 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 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "liblthread - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /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 /out:"..\Debug\liblthread.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "liblthread - Win32 Release"
+# Name "liblthread - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\rdwr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\stack.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\thread.c
+# End Source File
+# End Target
+# End Project
--- /dev/null
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "liblthread"=.\liblthread.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
--- /dev/null
+/*
+ * Modified by Kurt D. Zeilenga for inclusion into OpenLDAP
+ */
+
+/*
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "portable.h"
+
+#include <stdlib.h>
+#include <stddef.h>
+
+#include <ac/string.h>
+
+/* include socket.h to get sys/types.h and/or winsock2.h */
+#include <ac/socket.h>
+
+#include "lutil.h"
+
+#define Assert(Cond) if (!(Cond)) abort()
+
+static const char Base64[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char Pad64 = '=';
+
+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
+ The following encoding technique is taken from RFC 1521 by Borenstein
+ and Freed. It is reproduced here in a slightly edited form for
+ convenience.
+
+ A 65-character subset of US-ASCII is used, enabling 6 bits to be
+ represented per printable character. (The extra 65th character, "=",
+ is used to signify a special processing function.)
+
+ The encoding process represents 24-bit groups of input bits as output
+ strings of 4 encoded characters. Proceeding from left to right, a
+ 24-bit input group is formed by concatenating 3 8-bit input groups.
+ These 24 bits are then treated as 4 concatenated 6-bit groups, each
+ of which is translated into a single digit in the base64 alphabet.
+
+ Each 6-bit group is used as an index into an array of 64 printable
+ characters. The character referenced by the index is placed in the
+ output string.
+
+ Table 1: The Base64 Alphabet
+
+ Value Encoding Value Encoding Value Encoding Value Encoding
+ 0 A 17 R 34 i 51 z
+ 1 B 18 S 35 j 52 0
+ 2 C 19 T 36 k 53 1
+ 3 D 20 U 37 l 54 2
+ 4 E 21 V 38 m 55 3
+ 5 F 22 W 39 n 56 4
+ 6 G 23 X 40 o 57 5
+ 7 H 24 Y 41 p 58 6
+ 8 I 25 Z 42 q 59 7
+ 9 J 26 a 43 r 60 8
+ 10 K 27 b 44 s 61 9
+ 11 L 28 c 45 t 62 +
+ 12 M 29 d 46 u 63 /
+ 13 N 30 e 47 v
+ 14 O 31 f 48 w (pad) =
+ 15 P 32 g 49 x
+ 16 Q 33 h 50 y
+
+ Special processing is performed if fewer than 24 bits are available
+ at the end of the data being encoded. A full encoding quantum is
+ always completed at the end of a quantity. When fewer than 24 input
+ bits are available in an input group, zero bits are added (on the
+ right) to form an integral number of 6-bit groups. Padding at the
+ end of the data is performed using the '=' character.
+
+ Since all base64 input is an integral number of octets, only the
+ -------------------------------------------------
+ following cases can arise:
+
+ (1) the final quantum of encoding input is an integral
+ multiple of 24 bits; here, the final unit of encoded
+ output will be an integral multiple of 4 characters
+ with no "=" padding,
+ (2) the final quantum of encoding input is exactly 8 bits;
+ here, the final unit of encoded output will be two
+ characters followed by two "=" padding characters, or
+ (3) the final quantum of encoding input is exactly 16 bits;
+ here, the final unit of encoded output will be three
+ characters followed by one "=" padding character.
+ */
+
+int
+b64_ntop(
+ u_char const *src,
+ size_t srclength,
+ char *target,
+ size_t targsize)
+{
+ size_t datalength = 0;
+ u_char input[3];
+ u_char output[4];
+ size_t i;
+
+ while (2 < srclength) {
+ input[0] = *src++;
+ input[1] = *src++;
+ input[2] = *src++;
+ srclength -= 3;
+
+ output[0] = input[0] >> 2;
+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+ output[3] = input[2] & 0x3f;
+ Assert(output[0] < 64);
+ Assert(output[1] < 64);
+ Assert(output[2] < 64);
+ Assert(output[3] < 64);
+
+ if (datalength + 4 > targsize)
+ return (-1);
+ target[datalength++] = Base64[output[0]];
+ target[datalength++] = Base64[output[1]];
+ target[datalength++] = Base64[output[2]];
+ target[datalength++] = Base64[output[3]];
+ }
+
+ /* Now we worry about padding. */
+ if (0 != srclength) {
+ /* Get what's left. */
+ input[0] = input[1] = input[2] = '\0';
+ for (i = 0; i < srclength; i++)
+ input[i] = *src++;
+
+ output[0] = input[0] >> 2;
+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+ Assert(output[0] < 64);
+ Assert(output[1] < 64);
+ Assert(output[2] < 64);
+
+ if (datalength + 4 > targsize)
+ return (-1);
+ target[datalength++] = Base64[output[0]];
+ target[datalength++] = Base64[output[1]];
+ if (srclength == 1)
+ target[datalength++] = Pad64;
+ else
+ target[datalength++] = Base64[output[2]];
+ target[datalength++] = Pad64;
+ }
+ if (datalength >= targsize)
+ return (-1);
+ target[datalength] = '\0'; /* Returned value doesn't count \0. */
+ return (datalength);
+}
+
+/* skips all whitespace anywhere.
+ converts characters, four at a time, starting at (or after)
+ src from base - 64 numbers into three 8 bit bytes in the target area.
+ it returns the number of data bytes stored at the target, or -1 on error.
+ */
+
+int
+b64_pton(
+ char const *src,
+ u_char *target,
+ size_t targsize)
+{
+ int tarindex, state, ch;
+ char *pos;
+
+ state = 0;
+ tarindex = 0;
+
+ while ((ch = *src++) != '\0') {
+ if (isspace(ch)) /* Skip whitespace anywhere. */
+ continue;
+
+ if (ch == Pad64)
+ break;
+
+ pos = strchr(Base64, ch);
+ if (pos == 0) /* A non-base64 character. */
+ return (-1);
+
+ switch (state) {
+ case 0:
+ if (target) {
+ if ((size_t)tarindex >= targsize)
+ return (-1);
+ target[tarindex] = (pos - Base64) << 2;
+ }
+ state = 1;
+ break;
+ case 1:
+ if (target) {
+ if ((size_t)tarindex + 1 >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64) >> 4;
+ target[tarindex+1] = ((pos - Base64) & 0x0f)
+ << 4 ;
+ }
+ tarindex++;
+ state = 2;
+ break;
+ case 2:
+ if (target) {
+ if ((size_t)tarindex + 1 >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64) >> 2;
+ target[tarindex+1] = ((pos - Base64) & 0x03)
+ << 6;
+ }
+ tarindex++;
+ state = 3;
+ break;
+ case 3:
+ if (target) {
+ if ((size_t)tarindex >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64);
+ }
+ tarindex++;
+ state = 0;
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /*
+ * We are done decoding Base-64 chars. Let's see if we ended
+ * on a byte boundary, and/or with erroneous trailing characters.
+ */
+
+ if (ch == Pad64) { /* We got a pad char. */
+ ch = *src++; /* Skip it, get next. */
+ switch (state) {
+ case 0: /* Invalid = in first position */
+ case 1: /* Invalid = in second position */
+ return (-1);
+
+ case 2: /* Valid, means one byte of info */
+ /* Skip any number of spaces. */
+ for ((void)NULL; ch != '\0'; ch = *src++)
+ if (!isspace(ch))
+ break;
+ /* Make sure there is another trailing = sign. */
+ if (ch != Pad64)
+ return (-1);
+ ch = *src++; /* Skip the = */
+ /* Fall through to "single trailing =" case. */
+ /* FALLTHROUGH */
+
+ case 3: /* Valid, means two bytes of info */
+ /*
+ * We know this char is an =. Is there anything but
+ * whitespace after it?
+ */
+ for ((void)NULL; ch != '\0'; ch = *src++)
+ if (!isspace(ch))
+ return (-1);
+
+ /*
+ * Now make sure for cases 2 and 3 that the "extra"
+ * bits that slopped past the last full byte were
+ * zeros. If we don't check them, they become a
+ * subliminal channel.
+ */
+ if (target && target[tarindex] != 0)
+ return (-1);
+ }
+ } else {
+ /*
+ * We ended by seeing the end of the string. Make sure we
+ * have no partial bytes lying around.
+ */
+ if (state != 0)
+ return (-1);
+ }
+
+ return (tarindex);
+}
--- /dev/null
+# Microsoft Developer Studio Project File - Name="liblutil" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=liblutil - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "liblutil.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "liblutil.mak" CFG="liblutil - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "liblutil - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "liblutil - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF "$(CFG)" == "liblutil - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# 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 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "liblutil - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /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 /out:"..\Debug\liblutil.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "liblutil - Win32 Release"
+# Name "liblutil - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\lutil.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\lutil_md5.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\lutil_sha1.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\md5.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sha1.c
+# End Source File
+# End Target
+# End Project
--- /dev/null
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "liblutil"=.\liblutil.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
#include <ac/string.h>
+/* include socket.h to get sys/types.h and/or winsock2.h */
+#include <ac/socket.h>
+
#include <lutil_md5.h>
/* Little-endian byte-swapping routines. Note that these do not
*/
-#define DISABLE_BRIDGE
#include "portable.h"
+#include <ac/string.h>
+
+/* include socket.h to get sys/types.h and/or winsock2.h */
+#include <ac/socket.h>
+#if defined(HAVE_SYS_PARAM_H)
#include <sys/param.h>
-#include <ac/string.h>
+#endif
#include "lutil_sha1.h"
static char rcsid[] = "$OpenBSD: sha1hl.c,v 1.1 1997/07/12 20:06:03 millert Exp $";
#endif /* LIBC_SCCS and not lint */
-#include <stdlib.h>
#include <stdio.h>
-#include <errno.h>
+#include <stdlib.h>
+
+#include <ac/errno.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
-#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
-#include <unistd.h>
+#endif
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
/* ARGSUSED */
char *