[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 20/25] libsemanage: Fallback_user_level can be NULL if you



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7vrJEACgkQrlYvE4MpobP4ewCfUTl1JHSaXTpPtNUn1yJWDo1j
TMgAn0HPi8GRUqi8WdOugTGJReqXBKUV
=MQcr
-----END PGP SIGNATURE-----
>From d940420a13d8387fea566dfbf71bcee42ef27246 Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Mon, 12 Dec 2011 15:03:21 -0500
Subject: [PATCH 20/25] 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@xxxxxxxxxx>
Acked-by: Dan Walsh <dwalsh@xxxxxxxxxx>
---
 libsemanage/src/genhomedircon.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
index ff8403d..d2646ae 100644
--- a/libsemanage/src/genhomedircon.c
+++ b/libsemanage/src/genhomedircon.c
@@ -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);
-- 
1.7.8


[Fedora Users]     [Fedora Legacy]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite News]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

Powered by Linux