File 11000-2980524-bnc591396-Collate-namespaces-in-providerRegister-correctly.patch of Package sblim-sfcb-sle11-sp1
From 53a155359f07c8f42e626d9b703f7cae8c203817 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Thu, 1 Apr 2010 14:37:50 +0200
Subject: [PATCH] Collate namespaces in providerRegister correctly (bnc#591396)
The fix of sf.net ID 2934540 assumes that ProviderInfo->ns[] lists all
namespace a classname/providername combination is known.
But providerRegister only fulfills this assumption if
/var/lib/sfcb/registration/providerRegister lists all namespaces
within the same [classname] record.
Attached patch fixes this by checking namespaces in
providerRegister.c:addProviderToHT()
Reference: sf.net ID 2934540, bugzilla.novell.com ID 591396
Upstream: sf.net ID 2980524
---
providerRegister.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/providerRegister.c b/providerRegister.c
index cabc1fe..3e7b7db 100644
--- a/providerRegister.c
+++ b/providerRegister.c
@@ -99,10 +99,21 @@ static void addProviderToHT(ProviderInfo *info, UtilHashTable *ht)
/* Another provider is in the register, but the newly found
* wants to serve the same class - so we do not add it to the
* register but append it to the one already found or to its master*/
- if(strcmp(checkDummy->providerName, info->providerName) == 0) {
- /* double registration - discard */
- freeInfoPtr(info);
- return;
+ if (strcmp(checkDummy->providerName, info->providerName) == 0) {
+ /* classname and provider name match, now check for namespace */
+ int idx = 0;
+ while (checkDummy->ns[idx]) {
+ if (strcmp(checkDummy->ns[idx], info->ns[0]) == 0) {
+ /* double registration - discard */
+ freeInfoPtr(info);
+ return;
+ }
+ ++idx;
+ }
+ /* additional namespace for existing classname and provider name */
+ checkDummy->ns=(char**)realloc(checkDummy->ns,sizeof(char*)*(idx+2));
+ checkDummy->ns[idx] = strdup(info->ns[0]);
+ checkDummy->ns[++idx] = NULL;
} else {
checkDummy->nextInRegister = info;
}
--
1.6.4.2