diff options
-rw-r--r-- | src/logicalfile/LMI_FileIdentityProvider.c | 42 | ||||
-rw-r--r-- | src/logicalfile/file.h | 2 |
2 files changed, 38 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: */ diff --git a/src/logicalfile/file.h b/src/logicalfile/file.h index 3db8386..b7ecb53 100644 --- a/src/logicalfile/file.h +++ b/src/logicalfile/file.h @@ -42,6 +42,8 @@ #define FSCREATIONCLASSNAME "LMI_LocalFileSystem" #define GROUP_COMPONENT "GroupComponent" #define PART_COMPONENT "PartComponent" +#define SAME_ELEMENT "SameElement" +#define SYSTEM_ELEMENT "SystemElement" #define sb_permmask(sb) ((sb).st_mode & (S_IRWXU | S_IRWXG | S_IRWXO)) #define sb_isreadable(sb) ( \ |