diff options
author | Jan Safranek <jsafrane@redhat.com> | 2013-11-11 14:59:31 +0100 |
---|---|---|
committer | Jan Safranek <jsafrane@redhat.com> | 2013-11-13 14:35:39 +0100 |
commit | a4e4d396c85fa897010c49e400e2992d9866c62a (patch) | |
tree | 68a0b0984f8d6c0a228e0d2c13a0563da67482ca /src/logicalfile/LMI_DirectoryContainsFileProvider.c | |
parent | db95a46cedf3a5e6909f15b4bc4b33791139693f (diff) | |
download | openlmi-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_DirectoryContainsFileProvider.c')
-rw-r--r-- | src/logicalfile/LMI_DirectoryContainsFileProvider.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c index 4cf37dc..e1fd8c9 100644 --- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c +++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c @@ -140,10 +140,6 @@ static CMPIStatus associators( int group = -1; int rgroup = -1; - st = lmi_check_required(_cb, cc, cop); - if (st.rc != CMPI_RC_OK) { - return st; - } st = check_assoc_class(_cb, ns, assocClass, LMI_DirectoryContainsFile_ClassName); check_class_check_status(st); /* role && resultRole checks */ @@ -175,6 +171,10 @@ static CMPIStatus associators( if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) { /* got UnixDirectory - GroupComponent */ + st = lmi_check_required(_cb, cc, cop); + if (st.rc != CMPI_RC_OK) { + return st; + } st = dir_file_objectpaths(cc, cr, resultClass, group, rgroup, properties, ns, path, refs, &count); if (st.rc != CMPI_RC_OK) { return st; @@ -193,8 +193,12 @@ static CMPIStatus associators( CMReturnInstance(cr, ci); } } - } else { + } else if (CMClassPathIsA(_cb, cop, CIM_LogicalFile_ClassName, &st)) { /* got LogicalFile - PartComponent */ + st = lmi_check_required(_cb, cc, cop); + if (st.rc != CMPI_RC_OK) { + return st; + } if (group == 1 || rgroup == 0) { CMReturn(CMPI_RC_OK); } @@ -225,6 +229,9 @@ static CMPIStatus associators( } free(aux); free(fsname); + } else { + /* this association does not associate with given 'cop' class */ + CMReturn(CMPI_RC_OK); } CMReturn(CMPI_RC_OK); } @@ -265,8 +272,6 @@ static CMPIStatus references( group = 0; } } - st = lmi_check_required(_cb, cc, cop); - check_status(st); CIM_DirectoryRef_Init(&lmi_dr, _cb, ns); CIM_LogicalFileRef_Init(&lmi_lfr, _cb, ns); @@ -278,6 +283,8 @@ static CMPIStatus references( check_status(st); if (strcmp(ccname, LMI_UnixDirectory_ClassName) == 0) { + st = lmi_check_required(_cb, cc, cop); + check_status(st); /* got GroupComponent - DirectoryRef */ fill_logicalfile(CIM_DirectoryRef, &lmi_dr, path, fsname, LMI_UnixDirectory_ClassName); o = CIM_DirectoryRef_ToObjectPath(&lmi_dr, &st); @@ -304,7 +311,9 @@ static CMPIStatus references( CMReturnInstance(cr, ci); } } - } else { + } else if (strcmp(ccname, CIM_LogicalFile_ClassName) == 0) { + st = lmi_check_required(_cb, cc, cop); + check_status(st); /* got PartComponent - LogicalFileRef */ if (group == 1) { CMReturn(CMPI_RC_OK); @@ -337,8 +346,12 @@ static CMPIStatus references( CMReturnInstance(cr, ci); } free(aux); + } else { + /* this association does not associate with given 'cop' class */ free(fsname); + CMReturn(CMPI_RC_OK); } + free(fsname); CMReturn(CMPI_RC_OK); } |