Skip to contentSkip to conversation

wrap char*** for user_get_roles()

PATCH In review Joshua Brindle 3 participants 4 messages Nov 28, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wrap char*** for user_get_roles()

This adds wrappers for char*** so that semanage_user_get_roles will work. I added the test to the user test (-u), please let me know if there are any issues with this.

--
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.

#1 lore raw
Quoted 5 lines · Joshua Brindle

This adds wrappers for char*** so that semanage_user_get_roles will work. I added the test to the user test (-u), please let me know if there are any issues with this.

No patch attached.

Signature · 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.
#2 lore raw
Quoted 8 lines · Daniel J Walsh
Quoted 5 lines · Joshua Brindle

This adds wrappers for char*** so that semanage_user_get_roles will work. I added the test to the user test (-u), please let me know if there are any issues with this.

No patch attached.

oops.

swigifymore/libsemanage/src/pywrap-test.py renamed from libsemanage/src/pywrap-test.py +5 -0
diff -purN -x .svn trunk/libsemanage/src/pywrap-test.py branch/swigifymore/libsemanage/src/pywrap-test.py
@@ -98,6 +98,7 @@ class Tests:
 		print "User list size: ", list_size
 		if self.verbose: print "List reference: ",  list
 
+
 		if (list_size == 0):
 			print "No users found!"
 			print "This is not necessarily a test failure."
@@ -110,6 +111,10 @@ class Tests:
 			print "   User mls range: ", semanage.semanage_user_get_mlsrange(user)
 			print "   User number of roles: ", semanage.semanage_user_get_num_roles(user)
 			print "   User default role: ", semanage.semanage_user_get_defrole(user)
+			print "   User roles: "
+			(status, rlist, rlist_size) = semanage.semanage_user_get_roles(sh, user)
+			for ridx in range (rlist_size):
+				print "      ", semanage.char_by_idx(rlist, ridx) 
 
 	def test_writeuser(self,sh):
                 print "Testing user write..."
swigifymore/libsemanage/src/semanage.py renamed from libsemanage/src/semanage.py +2 -0
diff -purN -x .svn trunk/libsemanage/src/semanage.py branch/swigifymore/libsemanage/src/semanage.py
@@ -43,6 +43,8 @@ semanage_seuser_by_idx = _semanage.seman
 
 semanage_port_by_idx = _semanage.semanage_port_by_idx
 
+char_by_idx = _semanage.char_by_idx
+
 semanage_bool_key_create = _semanage.semanage_bool_key_create
 
 semanage_bool_key_extract = _semanage.semanage_bool_key_extract

Binary files trunk/libsemanage/src/semanage.pyc and branch/swigifymore/libsemanage/src/semanage.pyc differ

swigifymore/libsemanage/src/semanageswig.i renamed from libsemanage/src/semanageswig.i +14 -5
diff -purN -x .svn trunk/libsemanage/src/semanageswig.i branch/swigifymore/libsemanage/src/semanageswig.i
@@ -44,18 +44,19 @@
 	#include "semanage/ports_policy.h"
 %}
 
-%include <carrays.i>
-
 %inline {
-	semanage_user_t *semanage_user_by_idx(semanage_user_t **list, int n){
+	semanage_user_t *semanage_user_by_idx(semanage_user_t **list, int n) {
 		return list[n];
 	}	
-	semanage_seuser_t *semanage_seuser_by_idx(semanage_seuser_t **list, int n){
+	semanage_seuser_t *semanage_seuser_by_idx(semanage_seuser_t **list, int n) {
 		return list[n];
 	}	
-	semanage_port_t *semanage_port_by_idx(semanage_port_t **list, int n){
+	semanage_port_t *semanage_port_by_idx(semanage_port_t **list, int n) {
 		return list[n];
 	}	
+	char *char_by_idx(char **list, int n) {
+		return list[n];
+	}
 }
 
 
@@ -68,6 +69,14 @@
 %apply int *OUTPUT { int * };
 %apply int *OUTPUT { size_t * };
 
+%typemap(in, numinputs=0) char ***(char **temp) {
+	$1 = &temp;
+}
+
+%typemap(argout) char*** {
+	$result = t_output_helper($result, SWIG_NewPointerObj(*$1, SWIGTYPE_p_p_char, 0));
+}
+
 /** module typemaps**/
 
 /* the wrapper will setup this parameter for passing... the resulting python functions
swigifymore/libsemanage/src/semanageswig_wrap.c renamed from libsemanage/src/semanageswig_wrap.c +69 -37

205 lines not on this page · raw message

#3 lore raw
Quoted 11 lines · Joshua Brindle
Quoted 8 lines · Daniel J Walsh
Quoted 5 lines · Joshua Brindle

This adds wrappers for char*** so that semanage_user_get_roles will work. I added the test to the user test (-u), please let me know if there are any issues with this.

No patch attached.

oops.

Thanks, merged.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
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.