[Fedora-directory-commits] ldapserver/ldap/servers/slapd saslbind.c, 1.9.2.5, 1.9.2.6

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Tue Jan 15 21:19:22 UTC 2008


Author: nhosoi

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

Modified Files:
      Tag: Directory71RtmBranch
	saslbind.c 
Log Message:
Resolves: #240583
Summary: add SASL support for LDCLT and Rsearch tools
Description: applied the patch to Directory71RtmBranch
- SASL Mutex Support
- switched cyrus sasl version to v2.1.22



Index: saslbind.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/saslbind.c,v
retrieving revision 1.9.2.5
retrieving revision 1.9.2.6
diff -u -r1.9.2.5 -r1.9.2.6
--- saslbind.c	10 Jan 2008 01:12:18 -0000	1.9.2.5
+++ saslbind.c	15 Jan 2008 21:19:20 -0000	1.9.2.6
@@ -60,37 +60,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
  */
@@ -542,6 +538,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