Skip to contentSkip to conversation

libselinux - return EINVAL if invalid role selected

PATCH Applied Richard Haines 2 participants 2 messages Nov 27, 2011 – Dec 1, 2011 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux - return EINVAL if invalid role selected

For get_default_context_with_role(3) and get_default_context_with_rolelevel(3), return errno = EINVAL if invalid role.

---
 libselinux/src/get_context_list.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
libselinux/src/get_context_list.c +3 -1
index 37d80f2..e02157c 100644
@@ -38,8 +38,10 @@ int get_default_context_with_role(const char *user,
 	}
 
 	rc = -1;
-	if (!(*ptr))
+	if (!(*ptr)) {
+		errno = EINVAL;
 		goto out;
+	}
 	*newcon = strdup(*ptr);
 	if (!(*newcon))
 		goto out;
Signature · 10 lines
1.7.7.1





--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Applied
#1 lore raw

Applied to my devel branch

Quoted 30 lines · Richard Haines

For get_default_context_with_role(3) and get_default_context_with_rolelevel(3), return errno = EINVAL if invalid role.

---
 libselinux/src/get_context_list.c |    4 +++-

 1 files changed, 3 insertions(+), 1 deletions(-)
libselinux/src/get_context_list.c +3 -2
index 37d80f2..e02157c 100644
@@ -38,8 +38,10 @@ int get_default_context_with_role(const char *user,
        }
 
        rc = -1;
-       if (!(*ptr))
+       if (!(*ptr)) {
+               errno = EINVAL;
                goto out;
+       }
        *newcon = strdup(*ptr);
        if (!(*newcon))
                goto out;
--

1.7.7.1

Quoted 4 lines

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.