public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - config: remove translation table from confdb2ldif
@ 2009-09-08 14:17 Christine Caulfield
  0 siblings, 0 replies; only message in thread
From: Christine Caulfield @ 2009-09-08 14:17 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e13262aa941b2686236853810d3f5463de31d733
Commit:        e13262aa941b2686236853810d3f5463de31d733
Parent:        7a38bb2937f0559918009ef7dcc5ec10fd03c7a0
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Tue Sep 8 15:16:01 2009 +0100
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Tue Sep 8 15:16:01 2009 +0100

config: remove translation table from confdb2ldif

The translation table is performing an obvious algorithm now, so I
can add features, realiability and future-proofing by removing lots of code

I love patches like that  :-)

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 config/tools/ldap/confdb2ldif.c |   29 ++---------------------------
 1 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/config/tools/ldap/confdb2ldif.c b/config/tools/ldap/confdb2ldif.c
index 8115c12..f75a5b3 100644
--- a/config/tools/ldap/confdb2ldif.c
+++ b/config/tools/ldap/confdb2ldif.c
@@ -12,28 +12,7 @@
 confdb_callbacks_t callbacks = {
 };
 
-/* This structure maps object parent names to object classes */
-struct objectclasses
-{
-	const char *name;
-	const char *class;
-} objectclasses[] =
-{
-	{ "cluster", "rhcsCluster" },
-	{ "cman", "rhcsCman" },
-	{ "totem", "rhcsTotem" },
-	{ "clusternode", "rhcsClusternode" },
-	{ "device", "rhcsDevice" },
-	{ "fencedevice", "rhcsFencedevice" },
-	{ "method", "rhcsmethod" },
-	{ "logging", "rhcsLoggersubsys" },
-	{ "fence_daemon", "rhcsFencedaemon" },
-	{ "dlm", "rhcsDlm" },
-/* TODO: Add more here as the schema gets filled in */
-};
-
-
-static char *ldap_attr_name(char *attrname)
+static const char *ldap_attr_name(const char *attrname)
 {
 	static char newname[1024];
 	int i;
@@ -67,7 +46,6 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
 	size_t key_value_len;
 	char cumulative_dn[4096];
 	int res;
-	int i;
 	int keycount=0;
 
 	printf("\ndn: %s\n", fulldn);
@@ -97,10 +75,7 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
 		printf("objectclass: nsContainer\n");
 	}
 	else {
-		for (i = 0; i < sizeof(objectclasses)/sizeof(struct objectclasses); i++) {
-			if (strcmp(objectclasses[i].name, dn) == 0)
-				printf("objectclass: %s\n", objectclasses[i].class);
-		}
+		printf("objectclass: %s\n", ldap_attr_name(dn));
 	}
 
 	/* Show sub-objects */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-08 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-08 14:17 cluster: STABLE3 - config: remove translation table from confdb2ldif Christine Caulfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).