[Fedora-directory-commits] ldapserver/ldap/servers/slapd saslbind.c, 1.23, 1.24

Nathan Kinder (nkinder) fedora-directory-commits at redhat.com
Fri Jun 8 23:19:21 UTC 2007


Author: nkinder

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv31128/ldap/servers/slapd

Modified Files:
	saslbind.c 
Log Message:
Resolves: 240583
Summary: Added SASL support to ldclt as well as some thread-safety fixes for ns-slapd when using SASL.



Index: saslbind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/saslbind.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- saslbind.c	27 Feb 2007 02:57:30 -0000	1.23
+++ saslbind.c	8 Jun 2007 23:19:18 -0000	1.24
@@ -54,38 +54,33 @@
 /*
  * utility functions needed by the sasl library
  */
-
-int sasl_os_gethost(char *buf, int len)
-{
-    int rc;
-
-    rc = gethostname(buf, len);
-    LDAPDebug(LDAP_DEBUG_TRACE, "sasl_os_gethost %s\n", buf, 0, 0);
-    return ( rc == 0 ? SASL_OK : SASL_FAIL );
-}
-
-void *sasl_mutex_alloc(void)
+void *nssasl_mutex_alloc(void)
 {
     return PR_NewLock();
 }
 
-int sasl_mutex_lock(void *mutex)
+int nssasl_mutex_lock(void *mutex)
 {
     PR_Lock(mutex);
     return SASL_OK;
 }
 
-int sasl_mutex_unlock(void *mutex)
+int nssasl_mutex_unlock(void *mutex)
 {
     if (PR_Unlock(mutex) == PR_SUCCESS) return SASL_OK;
     return SASL_FAIL;
 }
 
-void sasl_mutex_free(void *mutex)
+void nssasl_mutex_free(void *mutex)
 {
     PR_DestroyLock(mutex);
 }
 
+void nssasl_free(void *ptr)
+{
+    slapi_ch_free(&ptr);
+}
+
 /* 
  * sasl library callbacks
  */
@@ -603,6 +598,20 @@
     LDAPDebug(LDAP_DEBUG_TRACE, "sasl service fqdn is: %s\n", 
                   serverfqdn, 0, 0);
 
+    /* Set SASL memory allocation callbacks */
+    sasl_set_alloc(
+        (sasl_malloc_t *)slapi_ch_malloc,
+        (sasl_calloc_t *)slapi_ch_calloc,
+        (sasl_realloc_t *)slapi_ch_realloc,
+        (sasl_free_t *)nssasl_free );
+
+    /* Set SASL mutex callbacks */
+    sasl_set_mutex(
+        (sasl_mutex_alloc_t *)nssasl_mutex_alloc,
+        (sasl_mutex_lock_t *)nssasl_mutex_lock,
+        (sasl_mutex_unlock_t *)nssasl_mutex_unlock,
+        (sasl_mutex_free_t *)nssasl_mutex_free);
+
     result = sasl_server_init(ids_sasl_callbacks, "iDS");
 
     if (result != SASL_OK) {




More information about the Fedora-directory-commits mailing list