From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1237 invoked by alias); 8 Sep 2009 14:17:57 -0000 Received: (qmail 1215 invoked by alias); 8 Sep 2009 14:17:57 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE3 - config: remove translation table from confdb2ldif To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: 7a38bb2937f0559918009ef7dcc5ec10fd03c7a0 X-Git-Newrev: e13262aa941b2686236853810d3f5463de31d733 From: Christine Caulfield Message-Id: <20090908141728.171B71201F5@lists.fedorahosted.org> Date: Tue, 08 Sep 2009 14:17:00 -0000 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00317.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e13262aa941b2686236853810d3f5463de31d733 Commit: e13262aa941b2686236853810d3f5463de31d733 Parent: 7a38bb2937f0559918009ef7dcc5ec10fd03c7a0 Author: Christine Caulfield AuthorDate: Tue Sep 8 15:16:01 2009 +0100 Committer: Christine Caulfield 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 --- 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 */