master - config: fix ldap load bug caused by new objdb ordering in corosync

Christine Caulfield chrissie@fedoraproject.org
Wed Sep 3 12:34:00 GMT 2008


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e5918ff498807891c2074fa5ddfebfc5f649cae5
Commit:        e5918ff498807891c2074fa5ddfebfc5f649cae5
Parent:        3941e5e4ce38ac3ac49d7dcf4e838dd30b063c62
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Wed Sep 3 13:29:54 2008 +0100
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Wed Sep 3 13:29:54 2008 +0100

config: fix ldap load bug caused by new objdb ordering in corosync

The LDAP loader assumed the old obdb behaviour that objects entered into
the appeared in reverse order. This is no longer true - they are in
the same order they were created. So this fixes LDAP to match this
assumption.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 cman/daemon/cman-preconfig.c     |    3 ---
 config/plugins/ldap/configldap.c |    7 ++++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index 4926591..9d3f8f8 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -553,9 +553,6 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 			write_cman_pipe("This node has no nodeid in cluster.conf");
 			return -1;
 		}
-		sprintf(error_reason, "Failed to find node name in cluster.conf");
-		write_cman_pipe("Failed to find node name in cluster.conf");
-		return -1;
 	}
 
 	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
diff --git a/config/plugins/ldap/configldap.c b/config/plugins/ldap/configldap.c
index 0f49cc0..7c2fbab 100644
--- a/config/plugins/ldap/configldap.c
+++ b/config/plugins/ldap/configldap.c
@@ -139,7 +139,7 @@ static unsigned int find_parent(struct objdb_iface_ver0 *objdb, LDAPDN dn, int s
 		objdb->object_find_create(parent_handle,
 					     dn[i][0][0].la_value.bv_val, dn[i][0][0].la_value.bv_len,
 					     &find_handle);
-		if (!objdb->object_find_next(find_handle, &object_handle)) {
+		while (!objdb->object_find_next(find_handle, &object_handle)) {
 			parent_handle = object_handle;
 		}
 		objdb->object_find_destroy(find_handle);
@@ -203,7 +203,6 @@ static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, unsigned in
 				/* Create a new object with the same name as the current one */
 				objdb->object_create(parent_handle, &object_handle, parsed_dn[1][0][0].la_value.bv_val,
 						     parsed_dn[1][0][0].la_value.bv_len);
-
 			}
 
 			/* Finished with the text representation */
@@ -236,10 +235,12 @@ static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, unsigned in
 					 * as they don't provide anything we can use
 					 */
 					if (strcmp("objectClass", attr) &&
-					    strcmp("cn", attr))
+					    strcmp("cn", attr)) {
 						objdb->object_key_create(object_handle, attr, strlen(attr),
 									 val_ber[i]->bv_val,
 									 val_ber[i]->bv_len+1);
+						fprintf(stderr, "Created key %s=%s\n",attr, val_ber[i]->bv_val);
+					}
 					i++;
 				}
 				ldap_memfree(attr);



More information about the Cluster-cvs mailing list