libsemanage: Fallback_user_level can be NULL if you are not using MLS
If you build a distribution without MLS turned on, libsemanage will crash if given a user without a level. This patch allows users without levels to be passed in. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
b39e8cab3c
commit
5e46bb8647
|
@ -717,9 +717,12 @@ static int set_fallback_user(genhomedircon_settings_t *s, const char *user,
|
|||
{
|
||||
char *fallback_user = strdup(user);
|
||||
char *fallback_user_prefix = strdup(prefix);
|
||||
char *fallback_user_level = strdup(level);
|
||||
char *fallback_user_level = NULL;
|
||||
if (level)
|
||||
fallback_user_level = strdup(level);
|
||||
|
||||
if (fallback_user == NULL || fallback_user_prefix == NULL || fallback_user_level == NULL) {
|
||||
if (fallback_user == NULL || fallback_user_prefix == NULL ||
|
||||
(fallback_user_level == NULL && level != NULL)) {
|
||||
free(fallback_user);
|
||||
free(fallback_user_prefix);
|
||||
free(fallback_user_level);
|
||||
|
|
Loading…
Reference in New Issue