Commit 860038cf authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

LDAPworld P1: DEC and other portability issues

parent f6c2f2e6
......@@ -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)
......
: run this script through /bin/sh
#! /bin/sh
RP500=ETCDIR/rp500
......
......@@ -226,8 +226,6 @@ FILE *where;
fatal(s)
char *s;
{
void exit();
if (errno != 0)
perror(s);
#ifdef KERBEROS
......
......@@ -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 <sys/types.h>
#include <time.h>
#include <sys/time.h>
#endif
#if defined(WINSOCK)
......
......@@ -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
......
......@@ -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 */
......@@ -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"
......
......@@ -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
......
......@@ -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 */
......
......@@ -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"; \
......
/* Revision history
*
* 5-Jun-96 hodges
* Added locking of new_conn_mutex when traversing the c[] array.
*/
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
......@@ -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;
......
......@@ -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 <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
#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( &currenttime_mutex );
ltm = localtime( &c[i].c_starttime );
strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
pthread_mutex_unlock( &currenttime_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( &currenttime_mutex );
ltm = localtime( &currenttime );
strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
pthread_mutex_unlock( &currenttime_mutex );
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, "currenttime", vals );
pthread_mutex_lock( &currenttime_mutex );
ltm = localtime( &starttime );
strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
pthread_mutex_unlock( &currenttime_mutex );
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, "starttime", vals );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment