From 588a458d78d95467281af477e9b3cbc24423bfcf Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 6 Mar 1999 00:57:25 +0000 Subject: [PATCH] MSVC5 cleanup... lber: ifdef'ed out lber_..set_nonblock() function because it used ioctl's. If it remains, it needs to be written to support various methods for setting non-blocking. ioctls should probably be last choice. configure could detect existance of fcntl(), ioctl(), etc. bdb2: added .dsp/.dsw files and did some basic cleanup (still needs work). --- include/portable.h.nt | 29 ++++++--- libraries/liblber/liblber.dsp | 4 ++ libraries/liblber/sockbuf.c | 13 ++-- servers/slapd/back-bdb2/abandon.c | 4 +- servers/slapd/back-bdb2/backbdb2.dsp | 78 +++++++++++++++++++++++ servers/slapd/back-bdb2/backbdb2.dsw | 29 +++++++++ servers/slapd/back-bdb2/cache.c | 5 -- servers/slapd/back-bdb2/id2children.c | 4 -- servers/slapd/back-bdb2/idl.c | 6 +- servers/slapd/back-bdb2/index.c | 1 - servers/slapd/back-bdb2/init.c | 1 - servers/slapd/back-bdb2/modify.c | 2 +- servers/slapd/back-bdb2/proto-back-bdb2.h | 4 +- servers/slapd/back-bdb2/search.c | 7 +- servers/slapd/back-bdb2/startup.c | 5 ++ servers/slapd/back-bdb2/timing.c | 4 +- 16 files changed, 157 insertions(+), 39 deletions(-) create mode 100644 servers/slapd/back-bdb2/backbdb2.dsp create mode 100644 servers/slapd/back-bdb2/backbdb2.dsw diff --git a/include/portable.h.nt b/include/portable.h.nt index 47b02791aa..e9d3640c9f 100644 --- a/include/portable.h.nt +++ b/include/portable.h.nt @@ -31,10 +31,14 @@ #define strdup _strdup #define vsnprintf _vsnprintf #define vsprintf _vsprintf +#define sleep _sleep /* define type for caddr_t */ typedef char * caddr_t; +/* we have NT threads */ +#define HAVE_NT_THREADS 1 + /* we have spawnlp instead of fork/execlp */ #define HAVE_SPAWNLP 1 @@ -47,12 +51,20 @@ typedef char * caddr_t; /* we have */ #define HAVE_CONIO_H 1 +/* we have */ +#define HAVE_DIRECT_H 1 + /* we have */ #define HAVE_IO_H 1 /* we have */ #define HAVE_PROCESS_H 1 +#define LDAP_SIGUSR1 SIGILL +#define LDAP_SIGUSR2 SIGTERM + +#define MAXPATHLEN _MAX_PATH + /* end of MSVC5 specific entries */ /* --------------------------------------------------- */ @@ -164,7 +176,7 @@ typedef char * caddr_t; /* #undef HAVE_BERKELEY_DB */ /* define if you have berkeley db2 */ -/* #undef HAVE_BERKELEY_DB2 */ +#define HAVE_BERKELEY_DB2 1 /* define if you have crypt */ /* #undef HAVE_CRYPT */ @@ -209,25 +221,25 @@ typedef char * caddr_t; /* #undef LDAP_SYSLOG */ /* define this to use DBBTREE w/ LDBM backend */ -/* #undef LDBM_USE_DBBTREE */ +#define LDBM_USE_DBBTREE 1 /* define this to use DBHASH w/ LDBM backend */ /* #undef LDBM_USE_DBHASH */ /* define this for ACL Group support */ -/* #undef SLAPD_ACLGROUPS */ +#define SLAPD_ACLGROUPS 1 /* define this to use SLAPD Berkeley DB2 backend */ -/* #undef SLAPD_BDB2 */ +#define SLAPD_BDB2 1 /* define this for ClearText password support */ -/* #undef SLAPD_CLEARTEXT */ +#define SLAPD_CLEARTEXT 1 /* define this for crypt(3) password support */ /* #undef SLAPD_CRYPT */ /* define this to use SLAPD LDBM backend */ -/* #undef SLAPD_LDBM */ +/* #define SLAPD_LDBM 1 */ /* define this to use SLAPD passwd backend */ /* #undef SLAPD_PASSWD */ @@ -412,7 +424,7 @@ typedef char * caddr_t; /* #undef HAVE_CRYPT_H */ /* Define if you have the header file. */ -/* #undef HAVE_DB_H */ +#define HAVE_DB_H 1 /* Define if you have the header file. */ /* #undef HAVE_DB_185_H */ @@ -456,9 +468,6 @@ typedef char * caddr_t; /* Define if you have the header file. */ #define HAVE_LIMITS_H 1 -/* Define if you have the header file. */ -#define HAVE_LOCALE_H 1 - /* Define if you have the header file. */ /* #undef HAVE_LWP_LWP_H */ diff --git a/libraries/liblber/liblber.dsp b/libraries/liblber/liblber.dsp index 3932704e0d..446002ed9c 100644 --- a/libraries/liblber/liblber.dsp +++ b/libraries/liblber/liblber.dsp @@ -122,5 +122,9 @@ SOURCE=.\options.c SOURCE=..\..\include\portable.h # End Source File +# Begin Source File + +SOURCE=.\sockbuf.c +# End Source File # End Target # End Project diff --git a/libraries/liblber/sockbuf.c b/libraries/liblber/sockbuf.c index 4fec6f9f8f..574c3f2c75 100644 --- a/libraries/liblber/sockbuf.c +++ b/libraries/liblber/sockbuf.c @@ -72,19 +72,20 @@ update_status( Sockbuf *sb ) static int status_is_ok( Sockbuf *sb ) { - int obr; - int osr; - obr = sb->sb_buf_ready; + int obr = sb->sb_buf_ready; #ifdef USE_SASL - osr = sb->sb_sec_ready; + int osr = sb->sb_sec_ready; #endif + update_status(sb); if (obr!=sb->sb_buf_ready) return 0; + #ifdef USE_SASL if (osr!=sb->sb_sec_ready) return 0; #endif + return 1; } #endif @@ -538,6 +539,8 @@ long lber_pvt_sb_write( Sockbuf *sb, void *buf, long len_arg ) #ifdef USE_SASL } #endif + + return ret; } int lber_pvt_sb_close( Sockbuf *sb ) @@ -561,6 +564,7 @@ int lber_pvt_sb_set_readahead( Sockbuf *sb, int rh ) return 0; } +#ifdef USE_NONBLOCK int lber_pvt_sb_set_nonblock( Sockbuf *sb, int nb ) { assert( status_is_ok(sb) ); @@ -583,6 +587,7 @@ int lber_pvt_sb_set_nonblock( Sockbuf *sb, int nb ) } return 0; } +#endif #define sockbuf_buf_init( bb ) \ (bb)->buf_base=NULL;\ diff --git a/servers/slapd/back-bdb2/abandon.c b/servers/slapd/back-bdb2/abandon.c index 3e69e15f48..8e3d70fecc 100644 --- a/servers/slapd/back-bdb2/abandon.c +++ b/servers/slapd/back-bdb2/abandon.c @@ -3,10 +3,10 @@ #include "portable.h" #include -#include -#include #include +#include +#include #include "slap.h" #include "back-bdb2.h" diff --git a/servers/slapd/back-bdb2/backbdb2.dsp b/servers/slapd/back-bdb2/backbdb2.dsp new file mode 100644 index 0000000000..a9ce0c5c86 --- /dev/null +++ b/servers/slapd/back-bdb2/backbdb2.dsp @@ -0,0 +1,78 @@ +# Microsoft Developer Studio Project File - Name="backbdb2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 5.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=backbdb2 - 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 "backbdb2.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 "backbdb2.mak" CFG="backbdb2 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "backbdb2 - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "backbdb2 - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe + +!IF "$(CFG)" == "backbdb2 - 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)" == "backbdb2 - 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 /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 + +!ENDIF + +# Begin Target + +# Name "backbdb2 - Win32 Release" +# Name "backbdb2 - Win32 Debug" +# End Target +# End Project diff --git a/servers/slapd/back-bdb2/backbdb2.dsw b/servers/slapd/back-bdb2/backbdb2.dsw new file mode 100644 index 0000000000..918770d8e5 --- /dev/null +++ b/servers/slapd/back-bdb2/backbdb2.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 5.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "backbdb2"=".\backbdb2.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/servers/slapd/back-bdb2/cache.c b/servers/slapd/back-bdb2/cache.c index 3c0963935c..0e89067cce 100644 --- a/servers/slapd/back-bdb2/cache.c +++ b/servers/slapd/back-bdb2/cache.c @@ -38,8 +38,6 @@ static void lru_print(struct cache *cache); static int cache_entry_private_init( Entry*e ) { - struct ldbm_entry_info *lei; - #ifdef LDAP_DEBUG assert( e->e_private == NULL ); #endif @@ -57,8 +55,6 @@ cache_entry_private_init( Entry*e ) static int cache_entry_private_destroy( Entry*e ) { - struct ldbm_entry_info *lei; - #ifdef LDAP_DEBUG assert( e->e_private ); #endif @@ -444,7 +440,6 @@ bdb2i_cache_find_entry_id( e.e_id = id; -try_again: /* set cache mutex */ ldap_pvt_thread_mutex_lock( &cache->c_mutex ); diff --git a/servers/slapd/back-bdb2/id2children.c b/servers/slapd/back-bdb2/id2children.c index 83db5d07a8..d4784d5bd8 100644 --- a/servers/slapd/back-bdb2/id2children.c +++ b/servers/slapd/back-bdb2/id2children.c @@ -19,8 +19,6 @@ bdb2i_id2children_add( { struct dbcache *db; Datum key; - int len, rc; - ID_BLOCK *idl; char buf[20]; ldbm_datum_init( key ); @@ -63,8 +61,6 @@ bdb2i_id2children_remove( { struct dbcache *db; Datum key; - int len, rc; - ID_BLOCK *idl; char buf[20]; Debug( LDAP_DEBUG_TRACE, "=> bdb2i_id2children_remove( %ld, %ld )\n", diff --git a/servers/slapd/back-bdb2/idl.c b/servers/slapd/back-bdb2/idl.c index 3b8f1bd24c..b8fe82a9e1 100644 --- a/servers/slapd/back-bdb2/idl.c +++ b/servers/slapd/back-bdb2/idl.c @@ -15,7 +15,7 @@ static ID_BLOCK* idl_dup( ID_BLOCK *idl ); /* Allocate an ID_BLOCK with room for nids ids */ ID_BLOCK * -bdb2i_idl_alloc( int nids ) +bdb2i_idl_alloc( unsigned long nids ) { ID_BLOCK *new; @@ -615,9 +615,9 @@ bdb2i_idl_insert_key( * 3 id not inserted, block must be split */ int -bdb2i_idl_insert( ID_BLOCK **idl, ID id, int maxids ) +bdb2i_idl_insert( ID_BLOCK **idl, ID id, unsigned long maxids ) { - unsigned int i, j; + unsigned long i, j; if ( ID_BLOCK_ALLIDS( *idl ) ) { return( 2 ); /* already there */ diff --git a/servers/slapd/back-bdb2/index.c b/servers/slapd/back-bdb2/index.c index 6cd9d31cf7..b4a58b1180 100644 --- a/servers/slapd/back-bdb2/index.c +++ b/servers/slapd/back-bdb2/index.c @@ -20,7 +20,6 @@ bdb2i_index_add_entry( ) { Attribute *ap; - char *dnval; struct berval bv; struct berval *bvals[2]; diff --git a/servers/slapd/back-bdb2/init.c b/servers/slapd/back-bdb2/init.c index c540e2a609..d1725f5f59 100644 --- a/servers/slapd/back-bdb2/init.c +++ b/servers/slapd/back-bdb2/init.c @@ -123,7 +123,6 @@ bdb2i_back_db_init_internal( { struct ldbminfo *li; char *argv[ 4 ]; - int i; /* allocate backend-database-specific stuff */ li = (struct ldbminfo *) ch_calloc( 1, sizeof(struct ldbminfo) ); diff --git a/servers/slapd/back-bdb2/modify.c b/servers/slapd/back-bdb2/modify.c index 749955329f..ae5d3b208f 100644 --- a/servers/slapd/back-bdb2/modify.c +++ b/servers/slapd/back-bdb2/modify.c @@ -25,7 +25,7 @@ bdb2i_back_modify_internal( char *matched; LDAPModList *ml; Entry *e; - int i, err; + int err; Debug(LDAP_DEBUG_ARGS, "bdb2i_back_modify:\n", 0, 0, 0); diff --git a/servers/slapd/back-bdb2/proto-back-bdb2.h b/servers/slapd/back-bdb2/proto-back-bdb2.h index 83974b96e6..0d8b4610dc 100644 --- a/servers/slapd/back-bdb2/proto-back-bdb2.h +++ b/servers/slapd/back-bdb2/proto-back-bdb2.h @@ -101,12 +101,12 @@ Entry * bdb2i_id2entry_rw LDAP_P(( BackendDB *be, ID id, int rw )); * idl.c */ -ID_BLOCK * bdb2i_idl_alloc LDAP_P(( int nids )); +ID_BLOCK * bdb2i_idl_alloc LDAP_P(( unsigned long nids )); ID_BLOCK * bdb2i_idl_allids LDAP_P(( BackendDB *be )); void bdb2i_idl_free LDAP_P(( ID_BLOCK *idl )); ID_BLOCK * bdb2i_idl_fetch LDAP_P(( BackendDB *be, struct dbcache *db, Datum key )); int bdb2i_idl_insert_key LDAP_P(( BackendDB *be, struct dbcache *db, Datum key, ID id )); -int bdb2i_idl_insert LDAP_P(( ID_BLOCK **idl, ID id, int maxids )); +int bdb2i_idl_insert LDAP_P(( ID_BLOCK **idl, ID id, unsigned long maxids )); int bdb2i_idl_delete_key LDAP_P(( BackendDB *be, struct dbcache *db, Datum key, ID id )); ID_BLOCK * bdb2i_idl_intersection LDAP_P(( BackendDB *be, ID_BLOCK *a, ID_BLOCK *b )); ID_BLOCK * bdb2i_idl_union LDAP_P(( BackendDB *be, ID_BLOCK *a, ID_BLOCK *b )); diff --git a/servers/slapd/back-bdb2/search.c b/servers/slapd/back-bdb2/search.c index d2523da41e..2206f962f0 100644 --- a/servers/slapd/back-bdb2/search.c +++ b/servers/slapd/back-bdb2/search.c @@ -6,6 +6,7 @@ #include #include +#include #include "slap.h" #include "back-bdb2.h" @@ -51,7 +52,7 @@ bdb2i_back_search_internal( Attribute *ref; char *matched = NULL; int rmaxsize, nrefs; - char *rbuf, *rcur, *r; + char *rbuf, *rcur; int nentries = 0; char *realBase; @@ -186,7 +187,7 @@ bdb2i_back_search_internal( strncmp( e->e_ndn, "REF=", 4 ) == 0 && (ref = attr_find( e->e_attrs, "ref" )) != NULL ) { - int i, len; + int i; if ( ref->a_vals == NULL ) { Debug( LDAP_DEBUG_ANY, "null ref in (%s)\n", @@ -368,8 +369,6 @@ base_candidates( ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; - int rc; - ID id; ID_BLOCK *idl; Entry *e; diff --git a/servers/slapd/back-bdb2/startup.c b/servers/slapd/back-bdb2/startup.c index e3c48e70d2..a34974eb59 100644 --- a/servers/slapd/back-bdb2/startup.c +++ b/servers/slapd/back-bdb2/startup.c @@ -6,6 +6,11 @@ #include #include +#include + +#ifdef HAVE_DIRECT_H +#include +#endif #include "ldapconfig.h" #include "slap.h" diff --git a/servers/slapd/back-bdb2/timing.c b/servers/slapd/back-bdb2/timing.c index d1e757aaa0..f707e45276 100644 --- a/servers/slapd/back-bdb2/timing.c +++ b/servers/slapd/back-bdb2/timing.c @@ -3,10 +3,10 @@ #include "portable.h" #include -#include -#include #include +#include +#include #include "slap.h" #include "back-bdb2.h" -- 2.39.5