[Freeswitch-svn] [commit] r7777 - in freeswitch/branches/anthonyl/spidermonkey-stuff: libs/xmlrpc-c src src/mod/directories/mod_ldap

Freeswitch SVN anthonyl at freeswitch.org
Mon Mar 3 18:08:25 EST 2008


Author: anthonyl
Date: Mon Mar  3 18:08:23 2008
New Revision: 7777

Modified:
   freeswitch/branches/anthonyl/spidermonkey-stuff/libs/xmlrpc-c/xmlrpc_amconfig.h.in
   freeswitch/branches/anthonyl/spidermonkey-stuff/src/mod/directories/mod_ldap/mod_ldap.c
   freeswitch/branches/anthonyl/spidermonkey-stuff/src/switch_core_directory.c

Log:
god knows what i'm updating here , really it's best to ignore this commit


Modified: freeswitch/branches/anthonyl/spidermonkey-stuff/libs/xmlrpc-c/xmlrpc_amconfig.h.in
==============================================================================
--- freeswitch/branches/anthonyl/spidermonkey-stuff/libs/xmlrpc-c/xmlrpc_amconfig.h.in	(original)
+++ freeswitch/branches/anthonyl/spidermonkey-stuff/libs/xmlrpc-c/xmlrpc_amconfig.h.in	Mon Mar  3 18:08:23 2008
@@ -81,5 +81,5 @@
 /* Version number of package */
 #undef VERSION
 
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t

Modified: freeswitch/branches/anthonyl/spidermonkey-stuff/src/mod/directories/mod_ldap/mod_ldap.c
==============================================================================
--- freeswitch/branches/anthonyl/spidermonkey-stuff/src/mod/directories/mod_ldap/mod_ldap.c	(original)
+++ freeswitch/branches/anthonyl/spidermonkey-stuff/src/mod/directories/mod_ldap/mod_ldap.c	Mon Mar  3 18:08:23 2008
@@ -202,7 +202,53 @@
 	return SWITCH_STATUS_FALSE;
 }
 
+static switch_status_t mod_ldap_append(switch_directory_handle_t *dh, char *dn, char *attr)
+{
+	int ret;
+	LDAPMod *attrsp[1];
+	struct ldap_context *context;
+	
+	context = dh->private_info;
+	switch_assert(context != NULL);
+	
+	if (!context->entry) {
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	attrs[0] = mod_ldap_convert(attr, strlen(attr));
+
+	if (!attrs[0])
+		return SWITCH_STATUS_FALSE;
+
+	attrs[1] = NULL;
+	
+	ret = ldap_add_ext_s(context->ld, dn, attrs[0], NULL, NULL);
+	return SWITCH_STATUS_FALSE;
+}
+/*
+  
+Note: This is FUGLY right now !!!!!!  do not think about using 
+for now just working on one attribute at a time inefficant and lame
 
+the main problem with this is the whole mod_type deal and now this will all be passed as a string
+objectClass = asj who knows
+
+*/
+static char *topObjectClasses[] = { "top", NULL };
+static LDAPMod *
+mod_ldap_convert(int modop, char *attr,  int vlen )
+{
+	LDAPMod             *pmods;
+	int                 i, j;
+	struct berval       *bvp;
+
+	pmods = malloc(sizeof(LDAPMod));
+	if (!pmods)
+		return NULL;
+	pmods->mod_op     = LDAP_MOD_ADD;
+	pmods->mod_type   = "objectClass";
+	pmods->mod_values = topObjectClasses;
+}
 SWITCH_MODULE_LOAD_FUNCTION(mod_ldap_load)
 {
 	switch_directory_interface_t *dir_interface;
@@ -216,7 +262,7 @@
 	dir_interface->directory_query = mod_ldap_query;
 	dir_interface->directory_next = mod_ldap_next;
 	dir_interface->directory_next_pair = mod_ldap_next_pair;
-
+	dir_interface->directory_append = mod_ldap_append;
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/anthonyl/spidermonkey-stuff/src/switch_core_directory.c
==============================================================================
--- freeswitch/branches/anthonyl/spidermonkey-stuff/src/switch_core_directory.c	(original)
+++ freeswitch/branches/anthonyl/spidermonkey-stuff/src/switch_core_directory.c	Mon Mar  3 18:08:23 2008
@@ -84,14 +84,10 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_directory_append(switch_directory_handle_t *dh)
+SWITCH_DECLARE(switch_status_t) switch_core_directory_append(switch_directory_handle_t *dh, char *dn, char *attr)
 {
 	switch_status_t status;
 
-	status = dh->directory_interface->directory_append(dh);
-	
-	if (switch_test_flag(dh, SWITCH_DIRECTORY_FLAG_FREE_POOL)) {
-		switch_core_destory_memory_poll(&dh->memory_poll);
-	}
+	status = dh->directory_interface->directory_append(dh, dn, attr);
 	return status;
 }



More information about the Freeswitch-svn mailing list