summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2013-11-18 13:42:52 +0100
committerJan Safranek <jsafrane@redhat.com>2013-11-18 17:01:36 +0100
commit45508add507afa96603cf122a1c59f7b463ba6e2 (patch)
tree6cc82f45afe9c0ec9f8dbdede135fb402da7b5a9
parent0169c7d2a2b26a86eb10542690c557c34fc0eb00 (diff)
downloadopenlmi-providers-45508add507afa96603cf122a1c59f7b463ba6e2.tar.gz
openlmi-providers-45508add507afa96603cf122a1c59f7b463ba6e2.tar.xz
openlmi-providers-45508add507afa96603cf122a1c59f7b463ba6e2.zip
logicalfile: fixed crashing of DirectoryContainsFile association.
'path' and 'ccname' variables must be read first from the 'cop' before accessing them.
-rw-r--r--src/logicalfile/LMI_DirectoryContainsFileProvider.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/logicalfile/LMI_DirectoryContainsFileProvider.c b/src/logicalfile/LMI_DirectoryContainsFileProvider.c
index 40fa567..3561b00 100644
--- a/src/logicalfile/LMI_DirectoryContainsFileProvider.c
+++ b/src/logicalfile/LMI_DirectoryContainsFileProvider.c
@@ -173,6 +173,9 @@ static CMPIStatus associators(
if (st.rc != CMPI_RC_OK) {
return st;
}
+ path = get_string_property_from_op(cop, "Name");
+ if (!path)
+ CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided LMI_UnixDirectory");
st = dir_file_objectpaths(cc, cr, resultClass, group, rgroup, properties, ns, path, refs, &count);
if (st.rc != CMPI_RC_OK) {
return st;
@@ -180,9 +183,6 @@ static CMPIStatus associators(
if (count > MAX_REFS) {
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Too many files in a single directory...");
}
- path = get_string_property_from_op(cop, "Name");
- if (!path)
- CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided LMI_UnixDirectory");
/* TODO: directories are walked in two passes
* rewrite using only one pass */
@@ -281,9 +281,8 @@ static CMPIStatus references(
CIM_LogicalFileRef_Init(&lmi_lfr, _cb, ns);
LMI_DirectoryContainsFile_Init(&lmi_dcf, _cb, ns);
- get_class_from_path(path, ccname);
- if (strcmp(ccname, LMI_UnixDirectory_ClassName) == 0) {
+ if (CMClassPathIsA(_cb, cop, LMI_UnixDirectory_ClassName, &st)) {
st = lmi_check_required(_cb, cc, cop);
check_status(st);
path = get_string_property_from_op(cop, "Name");
@@ -317,12 +316,13 @@ static CMPIStatus references(
CMReturnInstance(cr, ci);
}
}
- } else if (strcmp(ccname, CIM_LogicalFile_ClassName) == 0) {
+ } else if (CMClassPathIsA(_cb, cop, CIM_LogicalFile_ClassName, &st)) {
st = lmi_check_required(_cb, cc, cop);
check_status(st);
path = get_string_property_from_op(cop, "Name");
if (!path)
CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Cannot find Name property in provided CIM_LogicalFile");
+ get_class_from_path(path, ccname);
st = get_fsname_from_path(_cb, path, &fsname);
check_status(st);
/* got PartComponent - LogicalFileRef */