summaryrefslogtreecommitdiffstats
path: root/src/logicalfile/LMI_FileIdentityProvider.c
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2013-11-11 14:59:31 +0100
committerJan Safranek <jsafrane@redhat.com>2013-11-13 14:35:39 +0100
commita4e4d396c85fa897010c49e400e2992d9866c62a (patch)
tree68a0b0984f8d6c0a228e0d2c13a0563da67482ca /src/logicalfile/LMI_FileIdentityProvider.c
parentdb95a46cedf3a5e6909f15b4bc4b33791139693f (diff)
downloadopenlmi-providers-a4e4d396c85fa897010c49e400e2992d9866c62a.tar.gz
openlmi-providers-a4e4d396c85fa897010c49e400e2992d9866c62a.tar.xz
openlmi-providers-a4e4d396c85fa897010c49e400e2992d9866c62a.zip
logicalfile: fixed key checking in associations.
Don't assume that the Associators() or References() get correct object 'cop' argument - the object might be totally unrelated to the association. E.g. SFCB calls Associators() on LMI_DirectoryContainsFile associations with CIM_ComputerSystem as 'cop' parameter, while the association is between a directory and a file in it and does not associate ComputerSystem in any way.
Diffstat (limited to 'src/logicalfile/LMI_FileIdentityProvider.c')
-rw-r--r--src/logicalfile/LMI_FileIdentityProvider.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c
index c143fdb..514f5c3 100644
--- a/src/logicalfile/LMI_FileIdentityProvider.c
+++ b/src/logicalfile/LMI_FileIdentityProvider.c
@@ -74,7 +74,7 @@ static CMPIStatus associators(
fill_logicalfile(CIM_LogicalFileRef, &cim_lfr, path, fsname, fileclass);
o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st);
CMSetClassName(o, fileclass);
- } else {
+ } else if (CMClassPathIsA(_cb, cop, CIM_LogicalFile_ClassName, &st)) {
/* got LogicalFile - SystemElement */
st = lmi_check_required(_cb, cc, cop);
check_status(st);
@@ -103,6 +103,9 @@ static CMPIStatus associators(
LMI_UnixFile_Set_FSName(&lmi_uf, fsname);
LMI_UnixFile_Set_LFCreationClassName(&lmi_uf, fileclass);
o = LMI_UnixFile_ToObjectPath(&lmi_uf, &st);
+ } else {
+ /* this association does not associate with given 'cop' class */
+ CMReturn(CMPI_RC_OK);
}
if (names) {
@@ -165,7 +168,7 @@ static CMPIStatus references(
o = CIM_LogicalFileRef_ToObjectPath(&lmi_lfr, &st);
CMSetClassName(o, fileclass);
LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, o);
- } else {
+ } else if (CMClassPathIsA(_cb, cop, CIM_LogicalFile_ClassName, &st)) {
/* got LogicalFile - SystemElement */
LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, cop);
@@ -193,6 +196,9 @@ static CMPIStatus references(
LMI_UnixFile_Set_LFCreationClassName(&lmi_uf, fileclass);
o = LMI_UnixFile_ToObjectPath(&lmi_uf, &st);
LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, o);
+ } else {
+ /* this association does not associate with given 'cop' class */
+ CMReturn(CMPI_RC_OK);
}
if (names) {