summaryrefslogtreecommitdiffstats
path: root/src/logicalfile/LMI_FileIdentityProvider.c
diff options
context:
space:
mode:
authorJan Synacek <jsynacek@redhat.com>2013-08-23 09:49:50 +0200
committerJan Synacek <jsynacek@redhat.com>2013-08-26 16:00:33 +0200
commit8c6265eb50dfce55684659a5087c7739717f371a (patch)
tree22607e7befbdf8718e213651d7fbd31a505e362e /src/logicalfile/LMI_FileIdentityProvider.c
parent48b32898c5a8a46cef619cec52d3d15ee7105c97 (diff)
downloadopenlmi-providers-8c6265eb50dfce55684659a5087c7739717f371a.tar.gz
openlmi-providers-8c6265eb50dfce55684659a5087c7739717f371a.tar.xz
openlmi-providers-8c6265eb50dfce55684659a5087c7739717f371a.zip
logicalfile: correctly apply filters in LMI_FileIdentity
Diffstat (limited to 'src/logicalfile/LMI_FileIdentityProvider.c')
-rw-r--r--src/logicalfile/LMI_FileIdentityProvider.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/logicalfile/LMI_FileIdentityProvider.c b/src/logicalfile/LMI_FileIdentityProvider.c
index d31c305..27507ad 100644
--- a/src/logicalfile/LMI_FileIdentityProvider.c
+++ b/src/logicalfile/LMI_FileIdentityProvider.c
@@ -68,14 +68,14 @@ static CMPIStatus associators(
char fileclass[BUFLEN];
char *fsname;
+ check_assoc_class(_cb, ns, assocClass, LMI_FileIdentity_ClassName);
/* allow only LMI_UnixFile and classes derived from CIM_LogicalFile */
if (!check_valid_classes(cop)) {
CMReturn(CMPI_RC_OK);
}
if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) {
- /* got UnixFile */
-
+ /* got UnixFile - SameElement */
st = lmi_check_required(_cb, cop, UNIXFILE);
if (st.rc != CMPI_RC_OK) {
return st;
@@ -83,6 +83,15 @@ static CMPIStatus associators(
const char *path = get_string_property_from_op(cop, "LFName");
const char *ccname = get_string_property_from_op(cop, "LFCreationClassName");
+
+ check_assoc_class(_cb, ns, resultClass, ccname);
+ if (role && strcmp(role, SAME_ELEMENT)) {
+ CMReturn(CMPI_RC_OK);
+ }
+ if (resultRole && strcmp(resultRole, SYSTEM_ELEMENT)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
get_class_from_path(path, fileclass);
if (get_fsname_from_path(path, &fsname) < 0) {
CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name");
@@ -100,14 +109,22 @@ static CMPIStatus associators(
o = CIM_LogicalFileRef_ToObjectPath(&cim_lfr, &st);
CMSetClassName(o, fileclass);
} else {
- /* got LogicalFile */
-
+ /* got LogicalFile - SystemElement */
st = lmi_check_required(_cb, cop, LOGICALFILE);
if (st.rc != CMPI_RC_OK) {
return st;
}
const char *path = get_string_property_from_op(cop, "Name");
+
+ check_assoc_class(_cb, ns, resultClass, LMI_UnixFile_ClassName);
+ if (role && strcmp(role, SYSTEM_ELEMENT)) {
+ CMReturn(CMPI_RC_OK);
+ }
+ if (resultRole && strcmp(resultRole, SAME_ELEMENT)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
get_class_from_path(path, fileclass);
if (get_fsname_from_path(path, &fsname) < 0) {
CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name");
@@ -152,6 +169,7 @@ static CMPIStatus references(
char fileclass[BUFLEN];
char *fsname;
+ check_assoc_class(_cb, ns, assocClass, LMI_FileIdentity_ClassName);
/*
* allow only LMI_UnixFile and classes derived from CIM_LogicalFile
*
@@ -165,7 +183,7 @@ static CMPIStatus references(
LMI_FileIdentity_Init(&lmi_fi, _cb, ns);
if (CMClassPathIsA(_cb, cop, LMI_UnixFile_ClassName, &st)) {
- /* got UnixFile */
+ /* got UnixFile - SameElement */
LMI_FileIdentity_SetObjectPath_SameElement(&lmi_fi, cop);
st = lmi_check_required(_cb, cop, UNIXFILE);
@@ -175,6 +193,11 @@ static CMPIStatus references(
const char *path = get_string_property_from_op(cop, "LFName");
const char *ccname = get_string_property_from_op(cop, "LFCreationClassName");
+
+ if (role && strcmp(role, SAME_ELEMENT)) {
+ CMReturn(CMPI_RC_OK);
+ }
+
get_class_from_path(path, fileclass);
if (get_fsname_from_path(path, &fsname) < 0) {
CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name");
@@ -194,7 +217,7 @@ static CMPIStatus references(
CMSetClassName(o, fileclass);
LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, o);
} else {
- /* got LogicalFile */
+ /* got LogicalFile - SystemElement */
LMI_FileIdentity_SetObjectPath_SystemElement(&lmi_fi, cop);
st = lmi_check_required(_cb, cop, LOGICALFILE);
@@ -204,6 +227,10 @@ static CMPIStatus references(
const char *path = get_string_property_from_op(cop, "Name");
const char *ccname = get_string_property_from_op(cop, "CreationClassName");
+
+ if (role && strcmp(role, SYSTEM_ELEMENT)) {
+ CMReturn(CMPI_RC_OK);
+ }
if (get_fsname_from_path(path, &fsname) < 0) {
CMReturnWithChars(_cb, CMPI_RC_ERR_FAILED, "Can't get filesystem name");
}
@@ -393,3 +420,6 @@ KONKRET_REGISTRATION(
"LMI_FileIdentity",
"instance association")
/* vi: set et: */
+/* Local Variables: */
+/* indent-tabs-mode: nil */
+/* End: */