<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>OK fixing this then to just avoid checking anything.</p>
<p>@@ -190,10 +190,10 @@ char *<br>
secontext_full_file(const char *filename, bool mismatch)<br>
{<br>
char *context = raw_secontext_full_file(filename);<br>
- if (mismatch) {<br>
+ if (context && mismatch) {<br>
char *expected =
raw_expected_secontext_full_file(filename);<br>
- if (expected && (!context ||
strcmp(context, expected))) {<br>
- char *context_mismatch =
xasprintf("%s!!%s", context ? context : "", expected);<br>
+ if (expected && strcmp(context, expected))
{<br>
+ char *context_mismatch =
xasprintf("%s!!%s", context, expected);<br>
<br>
</p>
<div class="moz-cite-prefix">On 1/3/22 16:19, Dmitry V. Levin wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20220103151952.GA1051@altlinux.org">
<pre class="moz-quote-pre" wrap="">I've seen context == NULL in a system where selinux is not enabled.
</pre>
<blockquote type="cite" style="color: #007cff;">
<pre class="moz-quote-pre" wrap="">what just means the context of the file couldn't be retrieved (e.g.
issue with extended attribute), but still
raw_expected_secontext_full_file(), which reads from the database, can
contain a context, so I think it should be considered as different.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">When context == NULL, raw_expected_secontext_full_file() is likely to exit
with perror_msg_and_skip("selabel_open"), I've seen this behaviour in a
system where selinux is not enabled. However, when context == NULL but
raw_expected_secontext_full_file() != NULL, the test will fail.
</pre>
</blockquote>
</body>
</html>