From: Kurt Zeilenga Date: Sun, 9 Aug 1998 02:28:45 +0000 (+0000) Subject: LDAPworld P1: DEC and other portability issues X-Git-Tag: LDAP_3_3+prerelease~27^2~15 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=860038cff14e03dc74ada45e030e6161ba5d2a0d;p=openldap LDAPworld P1: DEC and other portability issues --- diff --git a/clients/fax500/Make-template b/clients/fax500/Make-template index e3b224d772..7d20fb1366 100644 --- a/clients/fax500/Make-template +++ b/clients/fax500/Make-template @@ -55,7 +55,7 @@ fax5version.c: main.o faxtotpc.o $(LDIR)/libldap.a install: rp500 xrpcomp fax500 FORCE -$(MKDIR) -p $(ETCDIR) $(BINDIR) $(INSTALL) $(INSTALLFLAGS) -m 755 rp500 $(ETCDIR) - $(SED) -e 's%ETCDIR%$(ETCDIR)%' xrpcomp > /tmp/xrpcomp.tmp + $(SED) -e 's%ETCDIR%$(RUNTIMEETCDIR)%' xrpcomp > /tmp/xrpcomp.tmp $(INSTALL) $(INSTALLFLAGS) -m 755 /tmp/xrpcomp.tmp $(BINDIR)/xrpcomp $(RM) /tmp/xrpcomp.tmp $(INSTALL) $(INSTALLFLAGS) -m 755 fax500 $(ETCDIR) diff --git a/clients/fax500/xrpcomp b/clients/fax500/xrpcomp index 3a914eac78..39c59e38aa 100644 --- a/clients/fax500/xrpcomp +++ b/clients/fax500/xrpcomp @@ -1,4 +1,4 @@ -: run this script through /bin/sh +#! /bin/sh RP500=ETCDIR/rp500 diff --git a/clients/ud/util.c b/clients/ud/util.c index 2edb5aa265..389b8a0d62 100644 --- a/clients/ud/util.c +++ b/clients/ud/util.c @@ -226,8 +226,6 @@ FILE *where; fatal(s) char *s; { - void exit(); - if (errno != 0) perror(s); #ifdef KERBEROS diff --git a/include/ldap.h b/include/ldap.h index 1eab5bda62..ee956742e7 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -295,7 +295,7 @@ typedef struct ldapmsg { BerElement *lm_ber; /* the ber encoded message contents */ struct ldapmsg *lm_chain; /* for search - next msg in the resp */ struct ldapmsg *lm_next; /* next response */ - unsigned long lm_time; /* used to maintain cache */ + unsigned int lm_time; /* used to maintain cache */ } LDAPMessage; #define NULLMSG ((LDAPMessage *) NULL) @@ -318,7 +318,7 @@ typedef struct ldap_server { typedef struct ldap_conn { Sockbuf *lconn_sb; int lconn_refcnt; - unsigned long lconn_lastused; /* time */ + unsigned int lconn_lastused; /* time */ int lconn_status; #define LDAP_CONNST_NEEDSOCKET 1 #define LDAP_CONNST_CONNECTING 2 @@ -569,6 +569,8 @@ extern char *strdup(); #else /* NEEDPROTOS */ #if !defined(MACOS) && !defined(DOS) && !defined(_WIN32) && !defined(WINSOCK) +#include +#include #include #endif #if defined(WINSOCK) diff --git a/include/portable.h b/include/portable.h index a91b27a5d5..b64be6c79c 100644 --- a/include/portable.h +++ b/include/portable.h @@ -61,9 +61,9 @@ #endif /* - * on many systems, we should use waitpid() instead of waitN() + * on most systems, we should use waitpid() instead of waitN() */ -#if !defined( USE_WAITPID ) && ( defined( SYSV ) || defined( sunos4 ) || defined( ultrix ) || defined( aix )) +#if !defined( USE_WAITPID ) && !defined( nextstep ) #define USE_WAITPID #endif diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index 10adbe91ff..c44c5910e8 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -187,3 +187,26 @@ char **getdxbyname( char *domain ); char **getdxbyname(); #endif /* NEEDPROTOS */ #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 +#ifdef NEEDPROTOS +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 ); +#else /* NEEDPROTOS */ +extern +int ldap_t61_to_8859(); +extern +int ldap_8859_to_t61(); +#endif /* NEEDPROTOS */ +#endif /* LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET */ +#endif /* STR_TRANSLATION && LDAP_DEFAULT_CHARSET */ diff --git a/libraries/libldap/ldapfilter.conf b/libraries/libldap/ldapfilter.conf index c602f7d2e7..8abae88636 100644 --- a/libraries/libldap/ldapfilter.conf +++ b/libraries/libldap/ldapfilter.conf @@ -24,33 +24,35 @@ # "finger and ud and go500 and go500gw subtree and web500gw subtree and rp500 and rcpt500 and ufn last" + "^$" "" "(objectclass=*)" "default filter" "=" " " "%v" "arbitrary filter" - "^[0-9][0-9-]*$" " " "(telephoneNumber=*%v)" "phone number" + "^[0-9][0-9\-]*$" " " "(telephoneNumber=*%v)" "phone number" "@" " " "(mail=%v)" "email address" "(mail=%v*)" "start of email address" - "^.[. _].*" ". _" "(cn=%v1* %v2-)" "first initial" + "^.[\. _].*" ". _" "(cn=%v1* %v2-)" "first initial" ".*[. _].$" ". _" "(cn=%v1-*)" "last initial" "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact" "(|(sn~=%v1-)(cn~=%v1-))" "approximate" - ".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact" - "(|(cn~=%v1)(sn~=%v1))" "approximate" + ".*" ". " "(|(cn=%v1)(sn=%v1)(ou=%v1))" "exact" + "(|(cn~=%v1)(sn~=%v1)(ou~=%v1))" "approximate" "go500gw onelevel and web500gw onelevel and ufn first and ufn intermediate" + "^$" "" "(!(objectclass=dSA))" "default filter" "=" " " "%v" "arbitrary filter" - "^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact" - "(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))" "approximate" + "^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact2" + "(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))" "approximate2" " " " " "(|(o=%v)(l=%v)(co=%v)(ou=%v))" "exact" "(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))" "approximate" - "\." " " "(associatedDomain=%v)" "exact" + "\." " " "(associatedDomain=%v)" "exact" ".*" " " "(|(o=%v)(l=%v)(co=%v)(ou=%v))" "exact" "(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))" "approximate" diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c index 22cd98e377..3ca73f336d 100644 --- a/libraries/libldap/open.c +++ b/libraries/libldap/open.c @@ -148,6 +148,10 @@ ldap_init( char *defhost, int defport ) 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 diff --git a/libraries/libldap/test.c b/libraries/libldap/test.c index 84f478da80..e9cc1266d2 100644 --- a/libraries/libldap/test.c +++ b/libraries/libldap/test.c @@ -31,6 +31,12 @@ #include "lber.h" #include "ldap.h" +/* including the "internal" defs is legit and nec. since this test routine has + * a-priori knowledge of libldap internal workings. + * hodges@stanford.edu 5-Feb-96 + */ +#include "ldap-int.h" + #if !defined( PCNFS ) && !defined( WINSOCK ) && !defined( MACOS ) #define MOD_USE_BVALS #endif /* !PCNFS && !WINSOCK && !MACOS */ diff --git a/servers/slapd/back-ldbm/Make-template b/servers/slapd/back-ldbm/Make-template index 51ef7a8171..a4b909ded0 100644 --- a/servers/slapd/back-ldbm/Make-template +++ b/servers/slapd/back-ldbm/Make-template @@ -34,7 +34,7 @@ LDFLAGS = -L$(LDIR) $(KRBLIBFLAG) all: FORCE -@echo "$(SLAPD_BACKENDS)" | grep LDAP_LDBM 2>&1 > /dev/null; \ if [ $$? = 0 ]; then \ - $(MAKE) $(MFLAGS) CC=$(CC) libback-ldbm.a; \ + $(MAKE) $(MFLAGS) CC="$(CC)" libback-ldbm.a; \ else \ echo "Include -DLDAP_LDBM in SLAPD_BACKENDS in the"; \ echo "Make-common file to build the ldbm backend"; \ diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 161fb79cf0..0558d1e162 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -1,3 +1,10 @@ + +/* Revision history + * + * 5-Jun-96 hodges + * Added locking of new_conn_mutex when traversing the c[] array. + */ + #include #include #include @@ -164,6 +171,8 @@ daemon( Debug( LDAP_DEBUG_CONNS, "listening for connections on %d, activity on:", tcps, 0, 0 ); + + pthread_mutex_lock( &new_conn_mutex ); for ( i = 0; i < dtblsize; i++ ) { if ( c[i].c_sb.sb_sd != -1 ) { FD_SET( c[i].c_sb.sb_sd, &readfds ); @@ -176,6 +185,7 @@ daemon( } } Debug( LDAP_DEBUG_CONNS, "\n", 0, 0, 0 ); + pthread_mutex_unlock( &new_conn_mutex ); zero.tv_sec = 0; zero.tv_usec = 0; diff --git a/servers/slapd/monitor.c b/servers/slapd/monitor.c index 7dbabc9377..07ead7445d 100644 --- a/servers/slapd/monitor.c +++ b/servers/slapd/monitor.c @@ -10,8 +10,16 @@ * is provided ``as is'' without express or implied warranty. */ +/* Revision history + * + * 5-Jun-96 jeff.hodges@stanford.edu + * Added locking of new_conn_mutex when traversing the c[] array. + * Added locking of currenttime_mutex to protect call(s) to localtime(). + */ + #include #include +#include #include #include #include "slap.h" @@ -32,13 +40,11 @@ extern time_t currenttime; extern time_t starttime; extern int num_conns; +extern pthread_mutex_t new_conn_mutex; +extern pthread_mutex_t currenttime_mutex; extern char Versionstr[]; -/* - * no mutex protection in here - take our chances! - */ - void monitor_info( Connection *conn, Operation *op ) { @@ -73,6 +79,8 @@ monitor_info( Connection *conn, Operation *op ) nconns = 0; nwritewaiters = 0; nreadwaiters = 0; + + pthread_mutex_lock( &new_conn_mutex ); for ( i = 0; i < dtblsize; i++ ) { if ( c[i].c_sb.sb_sd != -1 ) { nconns++; @@ -82,8 +90,11 @@ monitor_info( Connection *conn, Operation *op ) if ( c[i].c_gettingber ) { nreadwaiters++; } + pthread_mutex_lock( ¤ttime_mutex ); ltm = localtime( &c[i].c_starttime ); strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm ); + pthread_mutex_unlock( ¤ttime_mutex ); + pthread_mutex_lock( &c[i].c_dnmutex ); sprintf( buf, "%d : %s : %ld : %ld : %s : %s%s", i, buf2, c[i].c_opsinitiated, c[i].c_opscompleted, @@ -96,6 +107,8 @@ monitor_info( Connection *conn, Operation *op ) attr_merge( e, "connection", vals ); } } + pthread_mutex_unlock( &new_conn_mutex ); + sprintf( buf, "%d", nconns ); val.bv_val = buf; val.bv_len = strlen( buf ); @@ -141,14 +154,18 @@ monitor_info( Connection *conn, Operation *op ) val.bv_len = strlen( buf ); attr_merge( e, "bytessent", vals ); + pthread_mutex_lock( ¤ttime_mutex ); ltm = localtime( ¤ttime ); strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm ); + pthread_mutex_unlock( ¤ttime_mutex ); val.bv_val = buf; val.bv_len = strlen( buf ); attr_merge( e, "currenttime", vals ); + pthread_mutex_lock( ¤ttime_mutex ); ltm = localtime( &starttime ); strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm ); + pthread_mutex_unlock( ¤ttime_mutex ); val.bv_val = buf; val.bv_len = strlen( buf ); attr_merge( e, "starttime", vals );