LDAPworld P1: DEC and other portability issues

This commit is contained in:
Kurt Zeilenga 1998-08-09 02:28:45 +00:00
parent f6c2f2e6ab
commit 860038cff1
12 changed files with 82 additions and 20 deletions

View file

@ -55,7 +55,7 @@ fax5version.c: main.o faxtotpc.o $(LDIR)/libldap.a
install: rp500 xrpcomp fax500 FORCE install: rp500 xrpcomp fax500 FORCE
-$(MKDIR) -p $(ETCDIR) $(BINDIR) -$(MKDIR) -p $(ETCDIR) $(BINDIR)
$(INSTALL) $(INSTALLFLAGS) -m 755 rp500 $(ETCDIR) $(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 $(INSTALL) $(INSTALLFLAGS) -m 755 /tmp/xrpcomp.tmp $(BINDIR)/xrpcomp
$(RM) /tmp/xrpcomp.tmp $(RM) /tmp/xrpcomp.tmp
$(INSTALL) $(INSTALLFLAGS) -m 755 fax500 $(ETCDIR) $(INSTALL) $(INSTALLFLAGS) -m 755 fax500 $(ETCDIR)

View file

@ -1,4 +1,4 @@
: run this script through /bin/sh #! /bin/sh
RP500=ETCDIR/rp500 RP500=ETCDIR/rp500

View file

@ -226,8 +226,6 @@ FILE *where;
fatal(s) fatal(s)
char *s; char *s;
{ {
void exit();
if (errno != 0) if (errno != 0)
perror(s); perror(s);
#ifdef KERBEROS #ifdef KERBEROS

View file

@ -295,7 +295,7 @@ typedef struct ldapmsg {
BerElement *lm_ber; /* the ber encoded message contents */ BerElement *lm_ber; /* the ber encoded message contents */
struct ldapmsg *lm_chain; /* for search - next msg in the resp */ struct ldapmsg *lm_chain; /* for search - next msg in the resp */
struct ldapmsg *lm_next; /* next response */ struct ldapmsg *lm_next; /* next response */
unsigned long lm_time; /* used to maintain cache */ unsigned int lm_time; /* used to maintain cache */
} LDAPMessage; } LDAPMessage;
#define NULLMSG ((LDAPMessage *) NULL) #define NULLMSG ((LDAPMessage *) NULL)
@ -318,7 +318,7 @@ typedef struct ldap_server {
typedef struct ldap_conn { typedef struct ldap_conn {
Sockbuf *lconn_sb; Sockbuf *lconn_sb;
int lconn_refcnt; int lconn_refcnt;
unsigned long lconn_lastused; /* time */ unsigned int lconn_lastused; /* time */
int lconn_status; int lconn_status;
#define LDAP_CONNST_NEEDSOCKET 1 #define LDAP_CONNST_NEEDSOCKET 1
#define LDAP_CONNST_CONNECTING 2 #define LDAP_CONNST_CONNECTING 2
@ -569,6 +569,8 @@ extern char *strdup();
#else /* NEEDPROTOS */ #else /* NEEDPROTOS */
#if !defined(MACOS) && !defined(DOS) && !defined(_WIN32) && !defined(WINSOCK) #if !defined(MACOS) && !defined(DOS) && !defined(_WIN32) && !defined(WINSOCK)
#include <sys/types.h>
#include <time.h>
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#if defined(WINSOCK) #if defined(WINSOCK)

View file

@ -61,9 +61,9 @@
#endif #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 #define USE_WAITPID
#endif #endif

View file

@ -187,3 +187,26 @@ char **getdxbyname( char *domain );
char **getdxbyname(); char **getdxbyname();
#endif /* NEEDPROTOS */ #endif /* NEEDPROTOS */
#endif /* LDAP_DNS */ #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 */

View file

@ -24,28 +24,30 @@
# #
"finger and ud and go500 and go500gw subtree and web500gw subtree and rp500 and rcpt500 and ufn last" "finger and ud and go500 and go500gw subtree and web500gw subtree and rp500 and rcpt500 and ufn last"
"^$" "" "(objectclass=*)" "default filter"
"=" " " "%v" "arbitrary 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)" "email address"
"(mail=%v*)" "start of email address" "(mail=%v*)" "start of email address"
"^.[. _].*" ". _" "(cn=%v1* %v2-)" "first initial" "^.[\. _].*" ". _" "(cn=%v1* %v2-)" "first initial"
".*[. _].$" ". _" "(cn=%v1-*)" "last initial" ".*[. _].$" ". _" "(cn=%v1-*)" "last initial"
"[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact" "[. _]" ". _" "(|(sn=%v1-)(cn=%v1-))" "exact"
"(|(sn~=%v1-)(cn~=%v1-))" "approximate" "(|(sn~=%v1-)(cn~=%v1-))" "approximate"
".*" ". " "(|(cn=%v1)(sn=%v1)(uid=%v1))" "exact" ".*" ". " "(|(cn=%v1)(sn=%v1)(ou=%v1))" "exact"
"(|(cn~=%v1)(sn~=%v1))" "approximate" "(|(cn~=%v1)(sn~=%v1)(ou~=%v1))" "approximate"
"go500gw onelevel and web500gw onelevel and ufn first and ufn intermediate" "go500gw onelevel and web500gw onelevel and ufn first and ufn intermediate"
"^$" "" "(!(objectclass=dSA))" "default filter"
"=" " " "%v" "arbitrary filter" "=" " " "%v" "arbitrary filter"
"^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact" "^..$" " " "(|(o=%v)(c=%v)(l=%v)(co=%v))" "exact2"
"(|(o~=%v)(c~=%v)(l~=%v)(co~=%v))" "approximate" "(|(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))" "exact"
"(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))" "approximate" "(|(o~=%v)(l~=%v)(co~=%v)(ou~=%v))" "approximate"

View file

@ -148,6 +148,10 @@ ldap_init( char *defhost, int defport )
ld->ld_lberoptions = LBER_USE_DER; ld->ld_lberoptions = LBER_USE_DER;
ld->ld_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT; 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 ) #if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
ld->ld_lberoptions |= LBER_TRANSLATE_STRINGS; ld->ld_lberoptions |= LBER_TRANSLATE_STRINGS;
#if LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET #if LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET

View file

@ -31,6 +31,12 @@
#include "lber.h" #include "lber.h"
#include "ldap.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 ) #if !defined( PCNFS ) && !defined( WINSOCK ) && !defined( MACOS )
#define MOD_USE_BVALS #define MOD_USE_BVALS
#endif /* !PCNFS && !WINSOCK && !MACOS */ #endif /* !PCNFS && !WINSOCK && !MACOS */

View file

@ -34,7 +34,7 @@ LDFLAGS = -L$(LDIR) $(KRBLIBFLAG)
all: FORCE all: FORCE
-@echo "$(SLAPD_BACKENDS)" | grep LDAP_LDBM 2>&1 > /dev/null; \ -@echo "$(SLAPD_BACKENDS)" | grep LDAP_LDBM 2>&1 > /dev/null; \
if [ $$? = 0 ]; then \ if [ $$? = 0 ]; then \
$(MAKE) $(MFLAGS) CC=$(CC) libback-ldbm.a; \ $(MAKE) $(MFLAGS) CC="$(CC)" libback-ldbm.a; \
else \ else \
echo "Include -DLDAP_LDBM in SLAPD_BACKENDS in the"; \ echo "Include -DLDAP_LDBM in SLAPD_BACKENDS in the"; \
echo "Make-common file to build the ldbm backend"; \ echo "Make-common file to build the ldbm backend"; \

View file

@ -1,3 +1,10 @@
/* Revision history
*
* 5-Jun-96 hodges
* Added locking of new_conn_mutex when traversing the c[] array.
*/
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
@ -164,6 +171,8 @@ daemon(
Debug( LDAP_DEBUG_CONNS, Debug( LDAP_DEBUG_CONNS,
"listening for connections on %d, activity on:", "listening for connections on %d, activity on:",
tcps, 0, 0 ); tcps, 0, 0 );
pthread_mutex_lock( &new_conn_mutex );
for ( i = 0; i < dtblsize; i++ ) { for ( i = 0; i < dtblsize; i++ ) {
if ( c[i].c_sb.sb_sd != -1 ) { if ( c[i].c_sb.sb_sd != -1 ) {
FD_SET( c[i].c_sb.sb_sd, &readfds ); FD_SET( c[i].c_sb.sb_sd, &readfds );
@ -176,6 +185,7 @@ daemon(
} }
} }
Debug( LDAP_DEBUG_CONNS, "\n", 0, 0, 0 ); Debug( LDAP_DEBUG_CONNS, "\n", 0, 0, 0 );
pthread_mutex_unlock( &new_conn_mutex );
zero.tv_sec = 0; zero.tv_sec = 0;
zero.tv_usec = 0; zero.tv_usec = 0;

View file

@ -10,8 +10,16 @@
* is provided ``as is'' without express or implied warranty. * 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 <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include "slap.h" #include "slap.h"
@ -32,13 +40,11 @@ extern time_t currenttime;
extern time_t starttime; extern time_t starttime;
extern int num_conns; extern int num_conns;
extern pthread_mutex_t new_conn_mutex;
extern pthread_mutex_t currenttime_mutex;
extern char Versionstr[]; extern char Versionstr[];
/*
* no mutex protection in here - take our chances!
*/
void void
monitor_info( Connection *conn, Operation *op ) monitor_info( Connection *conn, Operation *op )
{ {
@ -73,6 +79,8 @@ monitor_info( Connection *conn, Operation *op )
nconns = 0; nconns = 0;
nwritewaiters = 0; nwritewaiters = 0;
nreadwaiters = 0; nreadwaiters = 0;
pthread_mutex_lock( &new_conn_mutex );
for ( i = 0; i < dtblsize; i++ ) { for ( i = 0; i < dtblsize; i++ ) {
if ( c[i].c_sb.sb_sd != -1 ) { if ( c[i].c_sb.sb_sd != -1 ) {
nconns++; nconns++;
@ -82,8 +90,11 @@ monitor_info( Connection *conn, Operation *op )
if ( c[i].c_gettingber ) { if ( c[i].c_gettingber ) {
nreadwaiters++; nreadwaiters++;
} }
pthread_mutex_lock( &currenttime_mutex );
ltm = localtime( &c[i].c_starttime ); ltm = localtime( &c[i].c_starttime );
strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm ); strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
pthread_mutex_unlock( &currenttime_mutex );
pthread_mutex_lock( &c[i].c_dnmutex ); pthread_mutex_lock( &c[i].c_dnmutex );
sprintf( buf, "%d : %s : %ld : %ld : %s : %s%s", i, sprintf( buf, "%d : %s : %ld : %ld : %s : %s%s", i,
buf2, c[i].c_opsinitiated, c[i].c_opscompleted, buf2, c[i].c_opsinitiated, c[i].c_opscompleted,
@ -96,6 +107,8 @@ monitor_info( Connection *conn, Operation *op )
attr_merge( e, "connection", vals ); attr_merge( e, "connection", vals );
} }
} }
pthread_mutex_unlock( &new_conn_mutex );
sprintf( buf, "%d", nconns ); sprintf( buf, "%d", nconns );
val.bv_val = buf; val.bv_val = buf;
val.bv_len = strlen( buf ); val.bv_len = strlen( buf );
@ -141,14 +154,18 @@ monitor_info( Connection *conn, Operation *op )
val.bv_len = strlen( buf ); val.bv_len = strlen( buf );
attr_merge( e, "bytessent", vals ); attr_merge( e, "bytessent", vals );
pthread_mutex_lock( &currenttime_mutex );
ltm = localtime( &currenttime ); ltm = localtime( &currenttime );
strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm ); strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
pthread_mutex_unlock( &currenttime_mutex );
val.bv_val = buf; val.bv_val = buf;
val.bv_len = strlen( buf ); val.bv_len = strlen( buf );
attr_merge( e, "currenttime", vals ); attr_merge( e, "currenttime", vals );
pthread_mutex_lock( &currenttime_mutex );
ltm = localtime( &starttime ); ltm = localtime( &starttime );
strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm ); strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
pthread_mutex_unlock( &currenttime_mutex );
val.bv_val = buf; val.bv_val = buf;
val.bv_len = strlen( buf ); val.bv_len = strlen( buf );
attr_merge( e, "starttime", vals ); attr_merge( e, "starttime", vals );