]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Apply --disable-crypt & -disable-cleartext fixes from devel.
authorKurt Zeilenga <kurt@openldap.org>
Tue, 29 Dec 1998 23:02:18 +0000 (23:02 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 29 Dec 1998 23:02:18 +0000 (23:02 +0000)
12 files changed:
libraries/liblutil/passwd.c
servers/slapd/back-ldbm/bind.c
servers/slapd/back-ldbm/init.c
servers/slapd/backend.c
servers/slapd/init.c
servers/slapd/main.c
servers/slapd/proto-slap.h
servers/slapd/tools/ldbmtest.c
servers/slapd/tools/ldif2id2children.c
servers/slapd/tools/ldif2id2entry.c
servers/slapd/tools/ldif2index.c
servers/slapd/tools/ldif2ldbm.c

index 7a74aa998972df4ff78d583646bcdccfa4075867..ff698f944a3762376d1e5e0eeb588d1780d6e49a 100644 (file)
@@ -31,12 +31,7 @@ lutil_passwd(
                return -1;
        }
 
-       if (strncasecmp(passwd, "{CRYPT}", sizeof("{CRYPT}") - 1) == 0 ) {
-               const char *p = passwd + (sizeof("{CRYPT}") - 1);
-
-               return( strcmp(p, crypt(cred, p)) );
-
-       } else if (strncasecmp(passwd, "{MD5}", sizeof("{MD5}") - 1) == 0 ) {
+       if (strncasecmp(passwd, "{MD5}", sizeof("{MD5}") - 1) == 0 ) {
                lutil_MD5_CTX MD5context;
                unsigned char MD5digest[16];
                char base64digest[25];  /* ceiling(sizeof(input)/3) * 4 + 1 */
@@ -74,6 +69,14 @@ lutil_passwd(
                }
 
                return( strcmp(p, base64digest) );
+
+#ifdef SLAPD_CRYPT
+       } else if (strncasecmp(passwd, "{CRYPT}", sizeof("{CRYPT}") - 1) == 0 ) {
+               const char *p = passwd + (sizeof("{CRYPT}") - 1);
+
+               return( strcmp(p, crypt(cred, p)) );
+
+#endif
        }
 
 #ifdef SLAPD_CLEARTEXT
index 144650686b944c6c77894dcbb3467c609b148c4f..23bb40491ab97658c6fb056cfe614102083c2e67 100644 (file)
@@ -19,8 +19,6 @@
 extern int     krbv4_ldap_auth();
 #endif
 
-pthread_mutex_t crypt_mutex;
-
 static int
 crypted_value_find(
        struct berval       **vals,
@@ -35,13 +33,17 @@ crypted_value_find(
                if ( syntax != SYNTAX_BIN ) {
                        int result;
 
+#ifdef SLAPD_CRYPT
                        pthread_mutex_lock( &crypt_mutex );
+#endif
 
                        result = lutil_passwd(
                                (char*) cred->bv_val,
                                (char*) vals[i]->bv_val);
 
+#ifdef SLAPD_CRYPT
                        pthread_mutex_unlock( &crypt_mutex );
+#endif
 
                        return result;
 
index 6580fa53319d8d2700ea3e14e74c80236f04a7d6..36ebbc963c6cdfcc5d3e9b41523c5c36ba221f9b 100644 (file)
@@ -19,10 +19,6 @@ ldbm_back_init(
        char            *argv[ 4 ];
        int             i;
 
-#ifdef SLAPD_CRYPT
-       extern pthread_mutex_t crypt_mutex;
-#endif /* SLAPD_CRYPT */
-
        /* allocate backend-specific stuff */
        li = (struct ldbminfo *) ch_calloc( 1, sizeof(struct ldbminfo) );
 
@@ -70,9 +66,6 @@ ldbm_back_init(
        pthread_mutex_init( &li->li_cache.c_mutex, pthread_mutexattr_default );
        pthread_mutex_init( &li->li_nextid_mutex, pthread_mutexattr_default );
        pthread_mutex_init( &li->li_dbcache_mutex, pthread_mutexattr_default );
-#ifdef SLAPD_CRYPT
-       pthread_mutex_init( &crypt_mutex, pthread_mutexattr_default );
-#endif /* SLAPD_CRYPT */
        pthread_cond_init( &li->li_dbcache_cv, pthread_condattr_default );
        for ( i = 0; i < MAXDBCACHE; i++ ) {
                pthread_mutex_init( &li->li_dbcache[i].dbc_mutex,
index 9bc09c94b21c3bc109a16b9fff6a3da510327a0b..35f8b22a6473b0ff144019ccc68364d8610aec7a 100644 (file)
@@ -209,11 +209,23 @@ be_isroot( Backend *be, char *dn )
 int
 be_isroot_pw( Backend *be, char *dn, struct berval *cred )
 {
+       int result;
+
        if ( ! be_isroot( be, dn ) ) {
                return( 0 );
        }
 
-       return( lutil_passwd( cred->bv_val, be->be_rootpw ) == 0 );
+#ifdef SLAPD_CRYPT
+       pthread_mutex_lock( &crypt_mutex );
+#endif
+
+       result = lutil_passwd( cred->bv_val, be->be_rootpw );
+
+#ifdef SLAPD_CRYPT
+       pthread_mutex_unlock( &crypt_mutex );
+#endif
+
+       return result == 0;
 }
 
 void
index 05c965f0787647d56ea16871e47a936c0de8da41..e93479432cbb9e3e26eb9c62c5f4379f73772d85 100644 (file)
@@ -21,4 +21,7 @@ init( void )
        pthread_mutex_init( &replog_mutex, pthread_mutexattr_default );
        pthread_mutex_init( &ops_mutex, pthread_mutexattr_default );
        pthread_mutex_init( &num_sent_mutex, pthread_mutexattr_default );
+#ifdef SLAPD_CRYPT
+       pthread_mutex_init( &crypt_mutex, pthread_mutexattr_default );
+#endif
 }
index 543676bda9259b70aee504321b80a8da757d2999..76f8cd9acd2531fc56283f0c5291e53dc6dc8faf 100644 (file)
@@ -39,6 +39,9 @@ pthread_mutex_t       currenttime_mutex;
 int            active_threads;
 pthread_mutex_t        active_threads_mutex;
 pthread_mutex_t        new_conn_mutex;
+#ifdef SLAPD_CRYPT
+pthread_mutex_t crypt_mutex;
+#endif
 long           ops_initiated;
 long           ops_completed;
 int            num_conns;
index 87a570fb6dffe5aaa55b5bb9ff61dfe65a894641..8d47589abc79dbc84ae5af0c3c7fc5f534f917b9 100644 (file)
@@ -246,6 +246,9 @@ extern pthread_mutex_t      new_conn_mutex;
 extern pthread_mutex_t num_sent_mutex;
 extern pthread_mutex_t ops_mutex;
 extern pthread_mutex_t replog_mutex;
+#ifdef SLAPD_CRYPT
+extern pthread_mutex_t crypt_mutex;
+#endif
 extern pthread_t       listener_tid;
 extern struct acl      *global_acl;
 extern struct objclass *global_oc;
index c3bc60153e74935f5a6a7bcb17fc089a828084f8..5978e91e1a20e6ad4a29e168658acd17e1fe2715 100644 (file)
@@ -52,6 +52,9 @@ pthread_mutex_t       currenttime_mutex;
 pthread_mutex_t        replog_mutex;
 pthread_mutex_t        ops_mutex;
 pthread_mutex_t        regex_mutex;
+#ifdef SLAPD_CRYPT
+pthread_mutex_t        crypt_mutex;
+#endif
 
 int
 main( int argc, char **argv )
index 806cb4a089ee7c6a3b8fc0071138882caf907c17..7877f659277229f599f27d2fabc6282ca355c61e 100644 (file)
@@ -34,6 +34,9 @@ pthread_mutex_t       currenttime_mutex;
 pthread_mutex_t        replog_mutex;
 pthread_mutex_t        ops_mutex;
 pthread_mutex_t        regex_mutex;
+#ifdef SLAPD_CRYPT
+pthread_mutex_t        crypt_mutex;
+#endif
 
 static char    *tailorfile;
 static char    *inputfile;
index 70653f0edb23faef79c460bc7693cc82155efb7c..a34eb0a553aa426346a3309f251199cb40978f07 100644 (file)
@@ -31,6 +31,9 @@ pthread_mutex_t       currenttime_mutex;
 pthread_mutex_t        replog_mutex;
 pthread_mutex_t        ops_mutex;
 pthread_mutex_t        regex_mutex;
+#ifdef SLAPD_CRYPT
+pthread_mutex_t        crypt_mutex;
+#endif
 
 static char    *tailorfile;
 static char    *inputfile;
index 8fb0511a75d83675224d2cb51b8dca38fa677ad5..ab05644cbc1e683f34f3e4bc243a059c367a901b 100644 (file)
@@ -33,6 +33,9 @@ pthread_mutex_t       currenttime_mutex;
 pthread_mutex_t        replog_mutex;
 pthread_mutex_t        ops_mutex;
 pthread_mutex_t        regex_mutex;
+#ifdef SLAPD_CRYPT
+pthread_mutex_t        crypt_mutex;
+#endif
 
 
 static void
index 33b34bd8a2cf088fa73d20243819c1c31e404a1a..41b93676b0167f4fa4dab41071e2282a22fdef50 100644 (file)
@@ -37,6 +37,9 @@ pthread_mutex_t       currenttime_mutex;
 pthread_mutex_t        replog_mutex;
 pthread_mutex_t        ops_mutex;
 pthread_mutex_t        regex_mutex;
+#ifdef SLAPD_CRYPT
+pthread_mutex_t        crypt_mutex;
+#endif
 
 static void fork_child( char *prog, char *args[] );
 static void    wait4kids( int nkidval );