File 11001-2980524-bnc591396-Check-for-conflicting-provider-registrations.patch of Package sblim-sfcb-sle11-sp1
From 6c3767da0e6f99962555d07e0e766bf9cf285cfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Fri, 2 Apr 2010 13:18:53 +0200
Subject: [PATCH] Check for conflicting provider registrations
As we collate namespaces for identical classname/providername
combinations, we have to check that other properties also match.
This initial patch checks for identical provider types.
Upstream reference: 2980524
---
providerRegister.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/providerRegister.c b/providerRegister.c
index 3e7b7db..d75d0e3 100644
--- a/providerRegister.c
+++ b/providerRegister.c
@@ -88,7 +88,7 @@ static ProviderRegister *pClone(ProviderRegister * br)
return NULL;
}
-static void addProviderToHT(ProviderInfo *info, UtilHashTable *ht)
+static int addProviderToHT(ProviderInfo *info, UtilHashTable *ht)
{
ProviderInfo *checkDummy;
/* first we add the provider to the providerRegister with the classname
@@ -100,13 +100,18 @@ static void addProviderToHT(ProviderInfo *info, UtilHashTable *ht)
* 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) {
+ if (checkDummy->type != info->type) {
+ mlogf(M_ERROR,M_SHOW,"--- Conflicting registration types for class %s, provider %s\n", info->className, info->providerName);
+ return 1;
+ }
+ /* FIXME: check location, user, group, parms, unload */
/* 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;
+ return 0;
}
++idx;
}
@@ -120,6 +125,7 @@ static void addProviderToHT(ProviderInfo *info, UtilHashTable *ht)
} else {
ht->ft->put(ht, info->className, info);
}
+ return 0;
}
ProviderRegister *newProviderRegister()
@@ -208,7 +214,9 @@ ProviderRegister *newProviderRegister()
else if (qualiProvInfoPtr==NULL) {
if (strcmp(info->className,"$QualifierProvider$")==0) qualiProvInfoPtr=info;
}
- addProviderToHT(info, ((ProviderBase *) br->hdl)->ht);
+ err = addProviderToHT(info, ((ProviderBase *) br->hdl)->ht);
+ if (err)
+ break;
}
info = (ProviderInfo *) calloc(1, sizeof(ProviderInfo));
info->className = strdup(rv.id);
@@ -301,10 +309,12 @@ ProviderRegister *newProviderRegister()
case 3:
break;
}
+ if (err)
+ break;
}
- if (info) {
- addProviderToHT(info, ((ProviderBase *) br->hdl)->ht);
+ if (info && err == 0) {
+ err = addProviderToHT(info, ((ProviderBase *) br->hdl)->ht);
}
}
if (in) {
--
1.6.4.2