return ((char *)salt.salt);
}
+#ifdef SLAPD_CLEARTEXT
char *
hash_none (const char *pw_in, Salt * salt)
{
return (STRDUP (pw_in));
}
+#endif
+#ifdef SLAPD_CRYPT
char *
hash_crypt (const char *pw_in, Salt * salt)
{
}
return (STRDUP (crypted_pw));
}
+#endif
char *
hash_md5 (const char *pw_in, Salt * salt)
static Hash hashes[] =
{
+#ifdef SLAPD_CLEARTEXT
{"none", 4, hash_none, 0, HASHTYPE_NONE, HASHTYPE_NONE, 0},
+#endif
+#ifdef SLAPD_CRYPT
{"crypt", 5, hash_crypt, 1, HASHTYPE_CRYPT, HASHTYPE_CRYPT, 2},
+#endif
{"md5", 3, hash_md5, 0, HASHTYPE_MD5, HASHTYPE_SMD5, 0},
{"smd5", 4, hash_md5, 1, HASHTYPE_SMD5, HASHTYPE_SMD5, 4},
{"sha", 3, hash_sha1, 0, HASHTYPE_SHA1, HASHTYPE_SSHA1, 0},
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 */
}
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
extern int krbv4_ldap_auth();
#endif
-pthread_mutex_t crypt_mutex;
-
static int
crypted_value_find(
struct berval **vals,
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;
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) );
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,
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
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
}
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;
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;
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 )
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;
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;
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
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 );