Patch to fix some of the swig objects. Now using them in chcat.
Signature · 1 line
--
src/selinux.py +0 -2
@@ -87,8 +87,6 @@ security_setenforce = _selinux.security_setenforce -security_disable = _selinux.security_disable - security_policyvers = _selinux.security_policyvers security_get_boolean_names = _selinux.security_get_boolean_names
src/selinuxswig.i +18 -4
@@ -22,6 +22,15 @@ %{ #include "selinux/selinux.h" %} +%apply int *OUTPUT { int * }; +%apply int *OUTPUT { size_t * }; + +%typemap(in, numinputs=0) security_context_t *(security_context_t temp) { + $1 = &temp; +} +%typemap(argout) security_context_t * { + $result = t_output_helper($result, PyString_FromString(*$1)); +} extern int is_selinux_enabled(void); extern int is_selinux_mls_enabled(void);
@@ -51,7 +60,6 @@ security_context_t *canoncon); extern int security_getenforce(void); extern int security_setenforce(int value); -extern int security_disable(void); extern int security_policyvers(void); extern int security_get_boolean_names(char ***names, int *len); extern int security_get_boolean_pending(const char *name);
@@ -96,10 +104,16 @@ extern int is_context_customizable (security_context_t scontext); -extern int selinux_trans_to_raw_context(security_context_t trans, +extern int selinux_trans_to_raw_context(char *trans, security_context_t *rawp); -extern int selinux_raw_to_trans_context(security_context_t raw, +extern int selinux_raw_to_trans_context(char *raw, security_context_t *transp); +%typemap(in, numinputs=0) char **(char *temp) { + $1 = &temp; +} + +%typemap(argout) char ** { + $result = t_output_helper($result, PyString_FromString(*$1)); +} extern int getseuserbyname(const char *linuxuser, char **seuser, char **level); -
src/selinuxswig_wrap.c +171 -113
591 lines not on this page · raw message
utils/getseuser.c +27 -0
@@ -0,0 +1,27 @@ +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <selinux/selinux.h> + +int main (int argc,char **argv) +{ +char *seuser, *range; +int rc, i; + +if (argc <2 ) { +fprintf (stderr,"usage: %s path...\n" , argv[0 ]); +exit (1 ); + } + +for (i =1 ; i < argc; i++) { + rc =getseuserbyname (argv[i], &seuser, &range); +if (rc <0 ) { +fprintf (stderr,"%s: getseuserbyname(%s) failed\n" , argv[0 ], argv[i]); +exit (2 ); + } +printf ("%s\t%s\t%s\n" , argv[i], seuser, range); +freecon (seuser); +freecon (range); + } +exit (0 ); +}
utils/setrans.c +26 -0
@@ -0,0 +1,26 @@ +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <selinux/selinux.h> + +int main (int argc,char **argv) +{ +char *buf; +int rc, i; + +if (argc <2 ) { +fprintf (stderr,"usage: %s context...\n" , argv[0 ]); +exit (1 ); + } + +for (i =1 ; i < argc; i++) { + rc =selinux_raw_to_trans_context (argv[i], &buf); +if (rc <0 ) { +fprintf (stderr,"%s: selinux_raw_to_trans_context(%s) failed\n" , argv[0 ], argv[i]); +exit (2 ); + } +printf ("%s\t%s\t%s\n" , argv[i], buf); +freecon (buf); + } +exit (0 ); +}
utils/seuntrans.c +26 -0
@@ -0,0 +1,26 @@ +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <selinux/selinux.h> + +int main (int argc,char **argv) +{ +char *buf; +int rc, i; + +if (argc <2 ) { +fprintf (stderr,"usage: %s path...\n" , argv[0 ]); +exit (1 ); + } + +for (i =1 ; i < argc; i++) { + rc =selinux_trans_to_raw_context (argv[i], &buf); +if (rc <0 ) { +fprintf (stderr,"%s: selinux_trans_to_raw_context(%s) failed\n" , argv[0 ], argv[i]); +exit (2 ); + } +printf ("%s\t%s\t%s\n" , argv[i], buf); +freecon (buf); + } +exit (0 ); +}
Thanks, merged as of libselinux 1.29.1.
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.