diff options
author | Jan Synacek <jsynacek@redhat.com> | 2013-07-15 10:40:03 +0200 |
---|---|---|
committer | Jan Synacek <jsynacek@redhat.com> | 2013-07-15 10:40:03 +0200 |
commit | 36198a26a94081f9ea7231fa728282216f7170c9 (patch) | |
tree | f34722fff184ba0d6ca407b4dad336cea5a05050 /src | |
parent | f82e32b4756c101e7bf78f1a52a19c6347e1fbfa (diff) | |
download | openlmi-providers-36198a26a94081f9ea7231fa728282216f7170c9.tar.gz openlmi-providers-36198a26a94081f9ea7231fa728282216f7170c9.tar.xz openlmi-providers-36198a26a94081f9ea7231fa728282216f7170c9.zip |
LogicalFile: make selinux lookups non-fatal
If, for some reason, no selinux context can be found, use a default
<<none>> that is used by the selinux utilities (e.g. matchpathcon).
Diffstat (limited to 'src')
-rw-r--r-- | src/logicalfile/LMI_UnixFileProvider.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/logicalfile/LMI_UnixFileProvider.c b/src/logicalfile/LMI_UnixFileProvider.c index d822565..ff9423b 100644 --- a/src/logicalfile/LMI_UnixFileProvider.c +++ b/src/logicalfile/LMI_UnixFileProvider.c @@ -137,7 +137,8 @@ static CMPIStatus LMI_UnixFileGetInstance( security_context_t context; struct selabel_handle *hnd; if (lgetfilecon(path, &context) < 0) { - CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Can't get selinux file context"); + lmi_warn("Can't get selinux file context: %s", path); + context = strdup("<<none>>"); } LMI_UnixFile_Set_SELinuxCurrentContext(&lmi_file, context); freecon(context); @@ -146,7 +147,8 @@ static CMPIStatus LMI_UnixFileGetInstance( CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Can't get selabel handle"); } if (selabel_lookup(hnd, &context, path, 0) < 0) { - CMReturnWithChars(_cb, CMPI_RC_ERR_NOT_FOUND, "Can't look up selinux file context"); + lmi_warn("Can't look up expected selinux file context: %s", path); + context = strdup("<<none>>"); } LMI_UnixFile_Set_SELinuxExpectedContext(&lmi_file, context); freecon(context); |