]> git.sur5r.net Git - openldap/commitdiff
LDAPworld P1: DEC and other portability issues
authorKurt Zeilenga <kurt@openldap.org>
Sun, 9 Aug 1998 02:28:45 +0000 (02:28 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 9 Aug 1998 02:28:45 +0000 (02:28 +0000)
12 files changed:
clients/fax500/Make-template
clients/fax500/xrpcomp
clients/ud/util.c
include/ldap.h
include/portable.h
libraries/libldap/ldap-int.h
libraries/libldap/ldapfilter.conf
libraries/libldap/open.c
libraries/libldap/test.c
servers/slapd/back-ldbm/Make-template
servers/slapd/daemon.c
servers/slapd/monitor.c

index e3b224d77260d447008d1afbcd9138468b9d007f..7d20fb13661cfa205fbe73c307cafc470fe3a0f6 100644 (file)
@@ -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)
index 3a914eac784da2dad513cfd0e80a65e114783b4f..39c59e38aa6b73e4724294d63ce17d1e59b4a8f4 100644 (file)
@@ -1,4 +1,4 @@
-: run this script through /bin/sh
+#! /bin/sh
 
 RP500=ETCDIR/rp500
 
index 2edb5aa265903c9be92d107413b5e0ee183610fd..389b8a0d625d87a04034258ee4e2fa32b326cfe5 100644 (file)
@@ -226,8 +226,6 @@ FILE *where;
 fatal(s)
 char *s;
 {
-       void exit();
-
        if (errno != 0)
                perror(s);
 #ifdef KERBEROS
index 1eab5bda62322dce07c67affdfe65f8db84eaa2c..ee956742e7f4c9ecd222755ca4b3ba83811807a4 100644 (file)
@@ -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)
index a91b27a5d554e0e53fb682a021d43b76ca74e849..b64be6c79c26ad8a931560ed008e35ffedd7db16 100644 (file)
@@ -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
 
index 10adbe91ff7fdd143e69252e46e479f2790dee39..c44c5910e8d386536f3dc665c6352f867db2fcaf 100644 (file)
@@ -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 */
index c602f7d2e716dc5331a8598e1f92d27a249a44a6..8abae88636665d3791c6ad406d63c039e221f19d 100644 (file)
 #
 
 "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"
index 22cd98e3775462fecad9e39ef2657fe2e8ddca23..3ca73f336dc503fdc1bdc4c446ea5629dab2a33d 100644 (file)
@@ -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
index 84f478da80032c7f52f748f6358cfe7c66f6c0ed..e9cc1266d21cb700d062844b77d5348c56ff00ea 100644 (file)
 #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 */
index 51ef7a8171294c91122cb78f26ffe34787504850..a4b909ded094c08c790bebe93ad76ca5372a449c 100644 (file)
@@ -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"; \
index 161fb79cf0e2bf6ce67b05be0ff4d7efba0a67ab..0558d1e1622497dd3c56cf1db720bf0e62b606c3 100644 (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 <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;
index 7dbabc93772c071c9c180645aa8cbef8b251227f..07ead7445d85224b1d2a07029601958aa3ca3703 100644 (file)
  * 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 );