From: <ssm...@us...> - 2007-09-27 13:38:33
|
Revision: 2598 http://selinux.svn.sourceforge.net/selinux/?rev=2598&view=rev Author: ssmalley Date: 2007-09-27 06:37:46 -0700 (Thu, 27 Sep 2007) Log Message: ----------- applied refactored libselinux swig bindings from trunk Modified Paths: -------------- branches/stable/1_0/libselinux/src/Makefile branches/stable/1_0/libselinux/src/fsetfilecon.c branches/stable/1_0/libselinux/src/selinux.py branches/stable/1_0/libselinux/src/selinuxswig.i branches/stable/1_0/libselinux/src/selinuxswig_wrap.c branches/stable/1_0/libsemanage/src/semanage.py branches/stable/1_0/libsemanage/src/semanageswig_wrap.c Added Paths: ----------- branches/stable/1_0/libselinux/src/selinuxswig_python.i Modified: branches/stable/1_0/libselinux/src/Makefile =================================================================== --- branches/stable/1_0/libselinux/src/Makefile 2007-09-27 13:22:54 UTC (rev 2597) +++ branches/stable/1_0/libselinux/src/Makefile 2007-09-27 13:37:46 UTC (rev 2598) @@ -12,7 +12,7 @@ LIBA=libselinux.a TARGET=libselinux.so -SWIGIF= selinuxswig.i +SWIGIF= selinuxswig_python.i SWIGCOUT= selinuxswig_wrap.c SWIGLOBJ:= $(patsubst %.c,%.lo,$(SWIGCOUT)) SWIGSO=_selinux.so Modified: branches/stable/1_0/libselinux/src/fsetfilecon.c =================================================================== --- branches/stable/1_0/libselinux/src/fsetfilecon.c 2007-09-27 13:22:54 UTC (rev 2597) +++ branches/stable/1_0/libselinux/src/fsetfilecon.c 2007-09-27 13:37:46 UTC (rev 2598) @@ -13,7 +13,7 @@ 0); } -hidden_def(setfilecon_raw) +hidden_def(fsetfilecon_raw) int fsetfilecon(int fd, security_context_t context) { Modified: branches/stable/1_0/libselinux/src/selinux.py =================================================================== --- branches/stable/1_0/libselinux/src/selinux.py 2007-09-27 13:22:54 UTC (rev 2597) +++ branches/stable/1_0/libselinux/src/selinux.py 2007-09-27 13:37:46 UTC (rev 2598) @@ -51,45 +51,141 @@ is_selinux_enabled = _selinux.is_selinux_enabled is_selinux_mls_enabled = _selinux.is_selinux_mls_enabled getcon = _selinux.getcon +getcon_raw = _selinux.getcon_raw setcon = _selinux.setcon +setcon_raw = _selinux.setcon_raw getpidcon = _selinux.getpidcon +getpidcon_raw = _selinux.getpidcon_raw getprevcon = _selinux.getprevcon +getprevcon_raw = _selinux.getprevcon_raw getexeccon = _selinux.getexeccon +getexeccon_raw = _selinux.getexeccon_raw setexeccon = _selinux.setexeccon +setexeccon_raw = _selinux.setexeccon_raw getfscreatecon = _selinux.getfscreatecon +getfscreatecon_raw = _selinux.getfscreatecon_raw setfscreatecon = _selinux.setfscreatecon +setfscreatecon_raw = _selinux.setfscreatecon_raw getkeycreatecon = _selinux.getkeycreatecon +getkeycreatecon_raw = _selinux.getkeycreatecon_raw setkeycreatecon = _selinux.setkeycreatecon +setkeycreatecon_raw = _selinux.setkeycreatecon_raw getsockcreatecon = _selinux.getsockcreatecon +getsockcreatecon_raw = _selinux.getsockcreatecon_raw setsockcreatecon = _selinux.setsockcreatecon +setsockcreatecon_raw = _selinux.setsockcreatecon_raw getfilecon = _selinux.getfilecon +getfilecon_raw = _selinux.getfilecon_raw lgetfilecon = _selinux.lgetfilecon +lgetfilecon_raw = _selinux.lgetfilecon_raw fgetfilecon = _selinux.fgetfilecon +fgetfilecon_raw = _selinux.fgetfilecon_raw setfilecon = _selinux.setfilecon +setfilecon_raw = _selinux.setfilecon_raw lsetfilecon = _selinux.lsetfilecon +lsetfilecon_raw = _selinux.lsetfilecon_raw fsetfilecon = _selinux.fsetfilecon +fsetfilecon_raw = _selinux.fsetfilecon_raw getpeercon = _selinux.getpeercon +getpeercon_raw = _selinux.getpeercon_raw +class av_decision(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, av_decision, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, av_decision, name) + __repr__ = _swig_repr + __swig_setmethods__["allowed"] = _selinux.av_decision_allowed_set + __swig_getmethods__["allowed"] = _selinux.av_decision_allowed_get + if _newclass:allowed = _swig_property(_selinux.av_decision_allowed_get, _selinux.av_decision_allowed_set) + __swig_setmethods__["decided"] = _selinux.av_decision_decided_set + __swig_getmethods__["decided"] = _selinux.av_decision_decided_get + if _newclass:decided = _swig_property(_selinux.av_decision_decided_get, _selinux.av_decision_decided_set) + __swig_setmethods__["auditallow"] = _selinux.av_decision_auditallow_set + __swig_getmethods__["auditallow"] = _selinux.av_decision_auditallow_get + if _newclass:auditallow = _swig_property(_selinux.av_decision_auditallow_get, _selinux.av_decision_auditallow_set) + __swig_setmethods__["auditdeny"] = _selinux.av_decision_auditdeny_set + __swig_getmethods__["auditdeny"] = _selinux.av_decision_auditdeny_get + if _newclass:auditdeny = _swig_property(_selinux.av_decision_auditdeny_get, _selinux.av_decision_auditdeny_set) + __swig_setmethods__["seqno"] = _selinux.av_decision_seqno_set + __swig_getmethods__["seqno"] = _selinux.av_decision_seqno_get + if _newclass:seqno = _swig_property(_selinux.av_decision_seqno_get, _selinux.av_decision_seqno_set) + def __init__(self, *args): + this = _selinux.new_av_decision(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _selinux.delete_av_decision + __del__ = lambda self : None; +av_decision_swigregister = _selinux.av_decision_swigregister +av_decision_swigregister(av_decision) + +security_compute_av = _selinux.security_compute_av +security_compute_av_raw = _selinux.security_compute_av_raw +security_compute_create = _selinux.security_compute_create +security_compute_create_raw = _selinux.security_compute_create_raw +security_compute_relabel = _selinux.security_compute_relabel +security_compute_relabel_raw = _selinux.security_compute_relabel_raw +security_compute_member = _selinux.security_compute_member +security_compute_member_raw = _selinux.security_compute_member_raw +security_compute_user = _selinux.security_compute_user +security_compute_user_raw = _selinux.security_compute_user_raw +security_load_policy = _selinux.security_load_policy selinux_mkload_policy = _selinux.selinux_mkload_policy selinux_init_load_policy = _selinux.selinux_init_load_policy +class SELboolean(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, SELboolean, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, SELboolean, name) + __repr__ = _swig_repr + __swig_setmethods__["name"] = _selinux.SELboolean_name_set + __swig_getmethods__["name"] = _selinux.SELboolean_name_get + if _newclass:name = _swig_property(_selinux.SELboolean_name_get, _selinux.SELboolean_name_set) + __swig_setmethods__["value"] = _selinux.SELboolean_value_set + __swig_getmethods__["value"] = _selinux.SELboolean_value_get + if _newclass:value = _swig_property(_selinux.SELboolean_value_get, _selinux.SELboolean_value_set) + def __init__(self, *args): + this = _selinux.new_SELboolean(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _selinux.delete_SELboolean + __del__ = lambda self : None; +SELboolean_swigregister = _selinux.SELboolean_swigregister +SELboolean_swigregister(SELboolean) + security_set_boolean_list = _selinux.security_set_boolean_list security_load_booleans = _selinux.security_load_booleans security_check_context = _selinux.security_check_context +security_check_context_raw = _selinux.security_check_context_raw security_canonicalize_context = _selinux.security_canonicalize_context +security_canonicalize_context_raw = _selinux.security_canonicalize_context_raw security_getenforce = _selinux.security_getenforce security_setenforce = _selinux.security_setenforce +security_disable = _selinux.security_disable security_policyvers = _selinux.security_policyvers security_get_boolean_names = _selinux.security_get_boolean_names security_get_boolean_pending = _selinux.security_get_boolean_pending security_get_boolean_active = _selinux.security_get_boolean_active security_set_boolean = _selinux.security_set_boolean security_commit_booleans = _selinux.security_commit_booleans +string_to_security_class = _selinux.string_to_security_class +string_to_av_perm = _selinux.string_to_av_perm +print_access_vector = _selinux.print_access_vector MATCHPATHCON_BASEONLY = _selinux.MATCHPATHCON_BASEONLY MATCHPATHCON_NOTRANS = _selinux.MATCHPATHCON_NOTRANS +MATCHPATHCON_VALIDATE = _selinux.MATCHPATHCON_VALIDATE set_matchpathcon_flags = _selinux.set_matchpathcon_flags matchpathcon_init = _selinux.matchpathcon_init +matchpathcon_init_prefix = _selinux.matchpathcon_init_prefix +matchpathcon_fini = _selinux.matchpathcon_fini matchpathcon = _selinux.matchpathcon +matchpathcon_index = _selinux.matchpathcon_index +matchpathcon_filespec_add = _selinux.matchpathcon_filespec_add +matchpathcon_filespec_destroy = _selinux.matchpathcon_filespec_destroy +matchpathcon_filespec_eval = _selinux.matchpathcon_filespec_eval +matchpathcon_checkmatches = _selinux.matchpathcon_checkmatches matchmediacon = _selinux.matchmediacon selinux_getenforcemode = _selinux.selinux_getenforcemode +selinux_getpolicytype = _selinux.selinux_getpolicytype selinux_policy_root = _selinux.selinux_policy_root selinux_binary_policy_path = _selinux.selinux_binary_policy_path selinux_failsafe_context_path = _selinux.selinux_failsafe_context_path @@ -102,6 +198,7 @@ selinux_homedir_context_path = _selinux.selinux_homedir_context_path selinux_media_context_path = _selinux.selinux_media_context_path selinux_contexts_path = _selinux.selinux_contexts_path +selinux_securetty_types_path = _selinux.selinux_securetty_types_path selinux_booleans_path = _selinux.selinux_booleans_path selinux_customizable_types_path = _selinux.selinux_customizable_types_path selinux_users_path = _selinux.selinux_users_path @@ -111,11 +208,26 @@ selinux_path = _selinux.selinux_path selinux_check_passwd_access = _selinux.selinux_check_passwd_access checkPasswdAccess = _selinux.checkPasswdAccess +selinux_check_securetty_context = _selinux.selinux_check_securetty_context +set_selinuxmnt = _selinux.set_selinuxmnt rpm_execcon = _selinux.rpm_execcon is_context_customizable = _selinux.is_context_customizable selinux_trans_to_raw_context = _selinux.selinux_trans_to_raw_context selinux_raw_to_trans_context = _selinux.selinux_raw_to_trans_context -selinux_getpolicytype = _selinux.selinux_getpolicytype getseuserbyname = _selinux.getseuserbyname +selinux_file_context_cmp = _selinux.selinux_file_context_cmp +selinux_file_context_verify = _selinux.selinux_file_context_verify +selinux_lsetfilecon_default = _selinux.selinux_lsetfilecon_default +selinux_default_type_path = _selinux.selinux_default_type_path +get_default_type = _selinux.get_default_type +SELINUX_DEFAULTUSER = _selinux.SELINUX_DEFAULTUSER +get_ordered_context_list = _selinux.get_ordered_context_list +get_ordered_context_list_with_level = _selinux.get_ordered_context_list_with_level +get_default_context = _selinux.get_default_context +get_default_context_with_level = _selinux.get_default_context_with_level +get_default_context_with_role = _selinux.get_default_context_with_role +get_default_context_with_rolelevel = _selinux.get_default_context_with_rolelevel +query_user_context = _selinux.query_user_context +manual_user_enter_context = _selinux.manual_user_enter_context Modified: branches/stable/1_0/libselinux/src/selinuxswig.i =================================================================== --- branches/stable/1_0/libselinux/src/selinuxswig.i 2007-09-27 13:22:54 UTC (rev 2597) +++ branches/stable/1_0/libselinux/src/selinuxswig.i 2007-09-27 13:37:46 UTC (rev 2598) @@ -1,7 +1,9 @@ -/* Author: Dan Walsh +/* Authors: Dan Walsh + * James Athey * * Copyright (C) 2004-2005 Red Hat - * + * Copyright (C) 2007 Tresys Technology, LLC + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -17,150 +19,47 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - %module selinux %{ #include "selinux/selinux.h" %} -%apply int *OUTPUT { int * }; +%apply int *OUTPUT { int *enforce }; %apply int *OUTPUT { size_t * }; -%typemap(in, numinputs=0) security_context_t *(security_context_t temp=NULL) { - $1 = &temp; -} -%typemap(argout) security_context_t * (char *temp=NULL) { - if (*$1) - temp = *$1; - else - temp = ""; - $result = SWIG_Python_AppendOutput($result, PyString_FromString(temp)); -} +%typedef unsigned mode_t; -%typemap(in) security_context_t { - $1 = (security_context_t)PyString_AsString($input); +%typemap(in, numinputs=0) (char ***names, int *len) (char **temp1, int temp2) { + $1 = &temp1; + $2 = &temp2; } -%typedef unsigned mode_t; - -extern int is_selinux_enabled(void); -extern int is_selinux_mls_enabled(void); -extern int getcon(security_context_t *con); -extern int setcon(security_context_t con); -extern int getpidcon(int pid, security_context_t *con); -extern int getprevcon(security_context_t *con); -extern int getexeccon(security_context_t *con); -extern int setexeccon(security_context_t con); -extern int getfscreatecon(security_context_t *con); -extern int setfscreatecon(security_context_t context); -extern int getkeycreatecon(security_context_t *con); -extern int setkeycreatecon(security_context_t context); -extern int getsockcreatecon(security_context_t *con); -extern int setsockcreatecon(security_context_t context); -extern int getfilecon(const char *path, security_context_t *con); -extern int lgetfilecon(const char *path, security_context_t *con); -extern int fgetfilecon(int fd, security_context_t *con); -extern int setfilecon(const char *path, security_context_t con); -extern int lsetfilecon(const char *path, security_context_t con); -extern int fsetfilecon(int fd, security_context_t con); -extern int getpeercon(int fd, security_context_t *con); -extern int selinux_mkload_policy(int preservebools); -extern int selinux_init_load_policy(int *enforce); -extern int security_set_boolean_list(size_t boolcnt, - SELboolean *boollist, - int permanent); -extern int security_load_booleans(char *path); -extern int security_check_context(security_context_t con); -extern int security_canonicalize_context(security_context_t con, - security_context_t *canoncon); -extern int security_getenforce(void); -extern int security_setenforce(int value); -extern int security_policyvers(void); -extern int security_get_boolean_names(char ***names, int *len); -extern int security_get_boolean_pending(const char *name); -extern int security_get_boolean_active(const char *name); -extern int security_set_boolean(const char *name, int value); -extern int security_commit_booleans(void); - -/* Set flags controlling operation of matchpathcon_init or matchpathcon. */ -#define MATCHPATHCON_BASEONLY 1 /* Only process the base file_contexts file. */ -#define MATCHPATHCON_NOTRANS 2 /* Do not perform any context translation. */ -extern void set_matchpathcon_flags(unsigned int flags); -extern int matchpathcon_init(const char *path); -extern int matchpathcon(const char *path, - mode_t mode, - security_context_t *con); - -extern int matchmediacon(const char *media, - security_context_t *con); - -extern int selinux_getenforcemode(int *enforce); -extern const char *selinux_policy_root(void); -extern const char *selinux_binary_policy_path(void); -extern const char *selinux_failsafe_context_path(void); -extern const char *selinux_removable_context_path(void); -extern const char *selinux_default_context_path(void); -extern const char *selinux_user_contexts_path(void); -extern const char *selinux_file_context_path(void); -extern const char *selinux_file_context_homedir_path(void); -extern const char *selinux_file_context_local_path(void); -extern const char *selinux_homedir_context_path(void); -extern const char *selinux_media_context_path(void); -extern const char *selinux_contexts_path(void); -extern const char *selinux_booleans_path(void); -extern const char *selinux_customizable_types_path(void); -extern const char *selinux_users_path(void); -extern const char *selinux_usersconf_path(void); -extern const char *selinux_translations_path(void); -extern const char *selinux_netfilter_context_path(void); -extern const char *selinux_path(void); -extern int selinux_check_passwd_access(access_vector_t requested); -extern int checkPasswdAccess(access_vector_t requested); - -// This tells SWIG to treat char ** as a special case -%typemap(python,in) char ** { - /* Check if is a list */ - if (PyList_Check($input)) { - int size = PyList_Size($input); - int i = 0; - $1 = (char **) malloc((size+1)*sizeof(char *)); - if ($1 == NULL) { - PyErr_SetString(PyExc_MemoryError,"Out of memory"); - return NULL; - } - for (i = 0; i < size; i++) { - PyObject *o = PyList_GetItem($input,i); - if (PyString_Check(o)) - $1[i] = PyString_AsString(PyList_GetItem($input,i)); - else { - PyErr_SetString(PyExc_TypeError,"list must contain strings"); - free($1); - return NULL; - } - } - $1[i] = 0; - } else { - PyErr_SetString(PyExc_TypeError,"not a list"); - return NULL; - } +%typemap(freearg) (char ***names, int *len) { + int i; + if (*$1) { + for (i = 0; i < *$2; i++) { + free((*$1)[i]); + } + free(*$1); + } } -extern int rpm_execcon(unsigned int verified, - const char *filename, - char **, char **); - -extern int is_context_customizable (security_context_t scontext); - -extern int selinux_trans_to_raw_context(char *trans, - security_context_t *rawp); -extern int selinux_raw_to_trans_context(char *raw, - security_context_t *transp); - -%typemap(in, numinputs=0) char **(char *temp=NULL) { +%typemap(in, numinputs=0) (security_context_t **) (security_context_t *temp) { $1 = &temp; } -%typemap(argout) char ** { - $result = SWIG_Python_AppendOutput($result, PyString_FromString(*$1)); +%typemap(freearg) (security_context_t **) { + if (*$1) freeconary(*$1); } -extern int selinux_getpolicytype(char **enforce); -extern int getseuserbyname(const char *linuxuser, char **seuser, char **level); + +/* Ignore functions that don't make sense when wrapped */ +%ignore freecon; +%ignore freeconary; + +/* Ignore functions that take a function pointer as an argument */ +%ignore set_matchpathcon_printf; +%ignore set_matchpathcon_invalidcon; +%ignore set_matchpathcon_canoncon; + +%include "../include/selinux/selinux.h" +%include "../include/selinux/get_default_type.h" +%include "../include/selinux/get_context_list.h" Copied: branches/stable/1_0/libselinux/src/selinuxswig_python.i (from rev 2489, trunk/libselinux/src/selinuxswig_python.i) =================================================================== --- branches/stable/1_0/libselinux/src/selinuxswig_python.i (rev 0) +++ branches/stable/1_0/libselinux/src/selinuxswig_python.i 2007-09-27 13:37:46 UTC (rev 2598) @@ -0,0 +1,138 @@ +/* Author: James Athey + * + * Copyright (C) 2007 Tresys Technology, LLC + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +%module selinux +%{ + #include "selinux/selinux.h" +%} + +/* security_get_boolean_names() typemap */ +%typemap(argout) (char ***names, int *len) { + PyObject* list = PyList_New(*$2); + int i; + for (i = 0; i < *$2; i++) { + PyList_SetItem(list, i, PyString_FromString((*$1)[i])); + } + $result = SWIG_Python_AppendOutput($result, list); +} + +/* Makes security_compute_user() return a Python list of contexts */ +%typemap(argout) (security_context_t **con) { + PyObject* plist; + int i, len = 0; + + if (*$1) { + while((*$1)[len]) + len++; + plist = PyList_New(len); + for (i = 0; i < len; i++) { + PyList_SetItem(plist, i, PyString_FromString((*$1)[i])); + } + } else { + plist = PyList_New(0); + } + + $result = SWIG_Python_AppendOutput($result, plist); +} + +/* Makes functions in get_context_list.h return a Python list of contexts */ +%typemap(argout) (security_context_t **list) { + PyObject* plist; + int i; + + if (*$1) { + plist = PyList_New(result); + for (i = 0; i < result; i++) { + PyList_SetItem(plist, i, PyString_FromString((*$1)[i])); + } + } else { + plist = PyList_New(0); + } + /* Only return the Python list, don't need to return the length anymore */ + $result = plist; +} + +%typemap(in,noblock=1,numinputs=0) security_context_t * (security_context_t temp = 0) { + $1 = &temp; +} +%typemap(freearg,match="in") security_context_t * ""; +%typemap(argout,noblock=1) security_context_t * { + if (*$1) { + %append_output(SWIG_FromCharPtr(*$1)); + freecon(*$1); + } + else { + Py_INCREF(Py_None); + %append_output(Py_None); + } +} + +%typemap(in,noblock=1,numinputs=0) char ** (char * temp = 0) { + $1 = &temp; +} +%typemap(freearg,match="in") char ** ""; +%typemap(argout,noblock=1) char ** { + if (*$1) { + %append_output(SWIG_FromCharPtr(*$1)); + free(*$1); + } + else { + Py_INCREF(Py_None); + %append_output(Py_None); + } +} + +%typemap(in) char * const [] { + int i, size; + PyObject * s; + + if (!PySequence_Check($input)) { + PyErr_SetString(PyExc_ValueError, "Expected a sequence"); + return NULL; + } + + size = PySequence_Size($input); + + $1 = (char**) malloc(size + 1); + + for(i = 0; i < size; i++) { + if (!PyString_Check(PySequence_GetItem($input, i))) { + PyErr_SetString(PyExc_ValueError, "Sequence must contain only strings"); + return NULL; + } + } + + for(i = 0; i < size; i++) { + s = PySequence_GetItem($input, i); + $1[i] = (char*) malloc(PyString_Size(s) + 1); + strcpy($1[i], PyString_AsString(s)); + } + $1[size] = NULL; +} + +%typemap(freearg,match="in") char * const [] { + int i = 0; + while($1[i]) { + free($1[i]); + i++; + } + free($1); +} + +%include "selinuxswig.i" Modified: branches/stable/1_0/libselinux/src/selinuxswig_wrap.c =================================================================== --- branches/stable/1_0/libselinux/src/selinuxswig_wrap.c 2007-09-27 13:22:54 UTC (rev 2597) +++ branches/stable/1_0/libselinux/src/selinuxswig_wrap.c 2007-09-27 13:37:46 UTC (rev 2598) @@ -2449,15 +2449,17 @@ /* -------- TYPES TABLE (BEGIN) -------- */ #define SWIGTYPE_p_SELboolean swig_types[0] -#define SWIGTYPE_p_access_vector_t swig_types[1] +#define SWIGTYPE_p_av_decision swig_types[1] #define SWIGTYPE_p_char swig_types[2] -#define SWIGTYPE_p_int swig_types[3] -#define SWIGTYPE_p_p_char swig_types[4] -#define SWIGTYPE_p_p_p_char swig_types[5] -#define SWIGTYPE_p_security_context_t swig_types[6] -#define SWIGTYPE_p_unsigned_int swig_types[7] -static swig_type_info *swig_types[9]; -static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0}; +#define SWIGTYPE_p_ino_t swig_types[3] +#define SWIGTYPE_p_int swig_types[4] +#define SWIGTYPE_p_p_char swig_types[5] +#define SWIGTYPE_p_p_p_char swig_types[6] +#define SWIGTYPE_p_pid_t swig_types[7] +#define SWIGTYPE_p_unsigned_int swig_types[8] +#define SWIGTYPE_p_unsigned_short swig_types[9] +static swig_type_info *swig_types[11]; +static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -2487,6 +2489,9 @@ #include "selinux/selinux.h" + #include "selinux/selinux.h" + + #define SWIG_From_long PyInt_FromLong @@ -2497,6 +2502,74 @@ } +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +{ + if (PyString_Check(obj)) { + char *cstr; Py_ssize_t len; + PyString_AsStringAndSize(obj, &cstr, &len); + if (cptr) { + if (alloc) { + /* + In python the user should not be able to modify the inner + string representation. To warranty that, if you define + SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string + buffer is always returned. + + The default behavior is just to return the pointer value, + so, be careful. + */ +#if defined(SWIG_PYTHON_SAFE_CSTRINGS) + if (*alloc != SWIG_OLDOBJ) +#else + if (*alloc == SWIG_NEWOBJ) +#endif + { + *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); + *alloc = SWIG_NEWOBJ; + } + else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } else { + *cptr = PyString_AsString(obj); + } + } + if (psize) *psize = len + 1; + return SWIG_OK; + } else { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + + + + #include <limits.h> #ifndef LLONG_MIN # define LLONG_MIN LONG_LONG_MIN @@ -2644,75 +2717,7 @@ } -SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) -{ - static int init = 0; - static swig_type_info* info = 0; - if (!init) { - info = SWIG_TypeQuery("_p_char"); - init = 1; - } - return info; -} - - SWIGINTERN int -SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) -{ - if (PyString_Check(obj)) { - char *cstr; Py_ssize_t len; - PyString_AsStringAndSize(obj, &cstr, &len); - if (cptr) { - if (alloc) { - /* - In python the user should not be able to modify the inner - string representation. To warranty that, if you define - SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string - buffer is always returned. - - The default behavior is just to return the pointer value, - so, be careful. - */ -#if defined(SWIG_PYTHON_SAFE_CSTRINGS) - if (*alloc != SWIG_OLDOBJ) -#else - if (*alloc == SWIG_NEWOBJ) -#endif - { - *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); - *alloc = SWIG_NEWOBJ; - } - else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } - } else { - *cptr = PyString_AsString(obj); - } - } - if (psize) *psize = len + 1; - return SWIG_OK; - } else { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor) { - void* vptr = 0; - if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { - if (cptr) *cptr = (char *) vptr; - if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; - } - } - } - return SWIG_TypeError; -} - - - - - -SWIGINTERN int SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) { if (PyInt_Check(obj)) { @@ -2756,32 +2761,63 @@ } -SWIGINTERNINLINE int -SWIG_AsVal_size_t (PyObject * obj, size_t *val) +SWIGINTERN int +SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) { unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = (size_t)(v); + int res = SWIG_AsVal_unsigned_SS_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v > UINT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = (unsigned int)(v); + } + } return res; } +SWIGINTERNINLINE PyObject* +SWIG_From_unsigned_SS_long (unsigned long value) +{ + return (value > LONG_MAX) ? + PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value)); +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_unsigned_SS_int (unsigned int value) +{ + return SWIG_From_unsigned_SS_long (value); +} + + SWIGINTERN int -SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) +SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val) { unsigned long v; int res = SWIG_AsVal_unsigned_SS_long (obj, &v); if (SWIG_IsOK(res)) { - if ((v > UINT_MAX)) { + if ((v > USHRT_MAX)) { return SWIG_OverflowError; } else { - if (val) *val = (unsigned int)(v); + if (val) *val = (unsigned short)(v); } } return res; } +SWIGINTERNINLINE int +SWIG_AsVal_size_t (PyObject * obj, size_t *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = (size_t)(v); + return res; +} + + SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char* carray, size_t size) { @@ -2805,6 +2841,13 @@ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); } + +SWIGINTERNINLINE PyObject * +SWIG_From_unsigned_SS_short (unsigned short value) +{ + return SWIG_From_unsigned_SS_long (value); +} + #ifdef __cplusplus extern "C" { #endif @@ -2838,75 +2881,172 @@ PyObject *resultobj = 0; security_context_t *arg1 = (security_context_t *) 0 ; int result; - security_context_t temp1 = NULL ; - char *temp10 = NULL ; + security_context_t temp1 = 0 ; - { - arg1 = &temp1; - } + arg1 = &temp1; if (!PyArg_ParseTuple(args,(char *)":getcon")) SWIG_fail; result = (int)getcon(arg1); resultobj = SWIG_From_int((int)(result)); - { - if (*arg1) - temp10 = *arg1; - else - temp10 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp10)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } return resultobj; fail: return NULL; } +SWIGINTERN PyObject *_wrap_getcon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t *arg1 = (security_context_t *) 0 ; + int result; + security_context_t temp1 = 0 ; + + arg1 = &temp1; + if (!PyArg_ParseTuple(args,(char *)":getcon_raw")) SWIG_fail; + result = (int)getcon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_setcon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - security_context_t arg1 ; + security_context_t arg1 = (security_context_t) 0 ; int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:setcon",&obj0)) SWIG_fail; - { - arg1 = (security_context_t)PyString_AsString(obj0); + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setcon" "', argument " "1"" of type '" "security_context_t""'"); } + arg1 = (security_context_t)(buf1); result = (int)setcon(arg1); resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return NULL; } +SWIGINTERN PyObject *_wrap_setcon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t arg1 = (security_context_t) 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:setcon_raw",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setcon_raw" "', argument " "1"" of type '" "security_context_t""'"); + } + arg1 = (security_context_t)(buf1); + result = (int)setcon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_getpidcon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - int arg1 ; + pid_t arg1 ; security_context_t *arg2 = (security_context_t *) 0 ; int result; - int val1 ; - int ecode1 = 0 ; - security_context_t temp2 = NULL ; - char *temp20 = NULL ; + void *argp1 ; + int res1 = 0 ; + security_context_t temp2 = 0 ; PyObject * obj0 = 0 ; + arg2 = &temp2; + if (!PyArg_ParseTuple(args,(char *)"O:getpidcon",&obj0)) SWIG_fail; { - arg2 = &temp2; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_pid_t, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getpidcon" "', argument " "1"" of type '" "pid_t""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "getpidcon" "', argument " "1"" of type '" "pid_t""'"); + } else { + arg1 = *((pid_t *)(argp1)); + } } - if (!PyArg_ParseTuple(args,(char *)"O:getpidcon",&obj0)) SWIG_fail; - ecode1 = SWIG_AsVal_int(obj0, &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "getpidcon" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); result = (int)getpidcon(arg1,arg2); resultobj = SWIG_From_int((int)(result)); + if (*arg2) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg2)); + freecon(*arg2); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_getpidcon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + pid_t arg1 ; + security_context_t *arg2 = (security_context_t *) 0 ; + int result; + void *argp1 ; + int res1 = 0 ; + security_context_t temp2 = 0 ; + PyObject * obj0 = 0 ; + + arg2 = &temp2; + if (!PyArg_ParseTuple(args,(char *)"O:getpidcon_raw",&obj0)) SWIG_fail; { - if (*arg2) - temp20 = *arg2; - else - temp20 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp20)); + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_pid_t, 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getpidcon_raw" "', argument " "1"" of type '" "pid_t""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "getpidcon_raw" "', argument " "1"" of type '" "pid_t""'"); + } else { + arg1 = *((pid_t *)(argp1)); + } } + result = (int)getpidcon_raw(arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + if (*arg2) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg2)); + freecon(*arg2); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } return resultobj; fail: return NULL; @@ -2917,204 +3057,442 @@ PyObject *resultobj = 0; security_context_t *arg1 = (security_context_t *) 0 ; int result; - security_context_t temp1 = NULL ; - char *temp10 = NULL ; + security_context_t temp1 = 0 ; - { - arg1 = &temp1; - } + arg1 = &temp1; if (!PyArg_ParseTuple(args,(char *)":getprevcon")) SWIG_fail; result = (int)getprevcon(arg1); resultobj = SWIG_From_int((int)(result)); - { - if (*arg1) - temp10 = *arg1; - else - temp10 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp10)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } return resultobj; fail: return NULL; } +SWIGINTERN PyObject *_wrap_getprevcon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t *arg1 = (security_context_t *) 0 ; + int result; + security_context_t temp1 = 0 ; + + arg1 = &temp1; + if (!PyArg_ParseTuple(args,(char *)":getprevcon_raw")) SWIG_fail; + result = (int)getprevcon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_getexeccon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; security_context_t *arg1 = (security_context_t *) 0 ; int result; - security_context_t temp1 = NULL ; - char *temp10 = NULL ; + security_context_t temp1 = 0 ; - { - arg1 = &temp1; - } + arg1 = &temp1; if (!PyArg_ParseTuple(args,(char *)":getexeccon")) SWIG_fail; result = (int)getexeccon(arg1); resultobj = SWIG_From_int((int)(result)); - { - if (*arg1) - temp10 = *arg1; - else - temp10 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp10)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } return resultobj; fail: return NULL; } +SWIGINTERN PyObject *_wrap_getexeccon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t *arg1 = (security_context_t *) 0 ; + int result; + security_context_t temp1 = 0 ; + + arg1 = &temp1; + if (!PyArg_ParseTuple(args,(char *)":getexeccon_raw")) SWIG_fail; + result = (int)getexeccon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_setexeccon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - security_context_t arg1 ; + security_context_t arg1 = (security_context_t) 0 ; int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:setexeccon",&obj0)) SWIG_fail; - { - arg1 = (security_context_t)PyString_AsString(obj0); + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setexeccon" "', argument " "1"" of type '" "security_context_t""'"); } + arg1 = (security_context_t)(buf1); result = (int)setexeccon(arg1); resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return NULL; } +SWIGINTERN PyObject *_wrap_setexeccon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t arg1 = (security_context_t) 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:setexeccon_raw",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setexeccon_raw" "', argument " "1"" of type '" "security_context_t""'"); + } + arg1 = (security_context_t)(buf1); + result = (int)setexeccon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_getfscreatecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; security_context_t *arg1 = (security_context_t *) 0 ; int result; - security_context_t temp1 = NULL ; - char *temp10 = NULL ; + security_context_t temp1 = 0 ; - { - arg1 = &temp1; - } + arg1 = &temp1; if (!PyArg_ParseTuple(args,(char *)":getfscreatecon")) SWIG_fail; result = (int)getfscreatecon(arg1); resultobj = SWIG_From_int((int)(result)); - { - if (*arg1) - temp10 = *arg1; - else - temp10 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp10)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } return resultobj; fail: return NULL; } +SWIGINTERN PyObject *_wrap_getfscreatecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t *arg1 = (security_context_t *) 0 ; + int result; + security_context_t temp1 = 0 ; + + arg1 = &temp1; + if (!PyArg_ParseTuple(args,(char *)":getfscreatecon_raw")) SWIG_fail; + result = (int)getfscreatecon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_setfscreatecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - security_context_t arg1 ; + security_context_t arg1 = (security_context_t) 0 ; int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:setfscreatecon",&obj0)) SWIG_fail; - { - arg1 = (security_context_t)PyString_AsString(obj0); + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setfscreatecon" "', argument " "1"" of type '" "security_context_t""'"); } + arg1 = (security_context_t)(buf1); result = (int)setfscreatecon(arg1); resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return NULL; } +SWIGINTERN PyObject *_wrap_setfscreatecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t arg1 = (security_context_t) 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:setfscreatecon_raw",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setfscreatecon_raw" "', argument " "1"" of type '" "security_context_t""'"); + } + arg1 = (security_context_t)(buf1); + result = (int)setfscreatecon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_getkeycreatecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; security_context_t *arg1 = (security_context_t *) 0 ; int result; - security_context_t temp1 = NULL ; - char *temp10 = NULL ; + security_context_t temp1 = 0 ; - { - arg1 = &temp1; - } + arg1 = &temp1; if (!PyArg_ParseTuple(args,(char *)":getkeycreatecon")) SWIG_fail; result = (int)getkeycreatecon(arg1); resultobj = SWIG_From_int((int)(result)); - { - if (*arg1) - temp10 = *arg1; - else - temp10 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp10)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } return resultobj; fail: return NULL; } +SWIGINTERN PyObject *_wrap_getkeycreatecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t *arg1 = (security_context_t *) 0 ; + int result; + security_context_t temp1 = 0 ; + + arg1 = &temp1; + if (!PyArg_ParseTuple(args,(char *)":getkeycreatecon_raw")) SWIG_fail; + result = (int)getkeycreatecon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_setkeycreatecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - security_context_t arg1 ; + security_context_t arg1 = (security_context_t) 0 ; int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:setkeycreatecon",&obj0)) SWIG_fail; - { - arg1 = (security_context_t)PyString_AsString(obj0); + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setkeycreatecon" "', argument " "1"" of type '" "security_context_t""'"); } + arg1 = (security_context_t)(buf1); result = (int)setkeycreatecon(arg1); resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return NULL; } +SWIGINTERN PyObject *_wrap_setkeycreatecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t arg1 = (security_context_t) 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:setkeycreatecon_raw",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setkeycreatecon_raw" "', argument " "1"" of type '" "security_context_t""'"); + } + arg1 = (security_context_t)(buf1); + result = (int)setkeycreatecon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_getsockcreatecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; security_context_t *arg1 = (security_context_t *) 0 ; int result; - security_context_t temp1 = NULL ; - char *temp10 = NULL ; + security_context_t temp1 = 0 ; - { - arg1 = &temp1; - } + arg1 = &temp1; if (!PyArg_ParseTuple(args,(char *)":getsockcreatecon")) SWIG_fail; result = (int)getsockcreatecon(arg1); resultobj = SWIG_From_int((int)(result)); - { - if (*arg1) - temp10 = *arg1; - else - temp10 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp10)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } return resultobj; fail: return NULL; } +SWIGINTERN PyObject *_wrap_getsockcreatecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t *arg1 = (security_context_t *) 0 ; + int result; + security_context_t temp1 = 0 ; + + arg1 = &temp1; + if (!PyArg_ParseTuple(args,(char *)":getsockcreatecon_raw")) SWIG_fail; + result = (int)getsockcreatecon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (*arg1) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg1)); + freecon(*arg1); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_setsockcreatecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; - security_context_t arg1 ; + security_context_t arg1 = (security_context_t) 0 ; int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; PyObject * obj0 = 0 ; if (!PyArg_ParseTuple(args,(char *)"O:setsockcreatecon",&obj0)) SWIG_fail; - { - arg1 = (security_context_t)PyString_AsString(obj0); + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setsockcreatecon" "', argument " "1"" of type '" "security_context_t""'"); } + arg1 = (security_context_t)(buf1); result = (int)setsockcreatecon(arg1); resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return NULL; } +SWIGINTERN PyObject *_wrap_setsockcreatecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + security_context_t arg1 = (security_context_t) 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:setsockcreatecon_raw",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setsockcreatecon_raw" "', argument " "1"" of type '" "security_context_t""'"); + } + arg1 = (security_context_t)(buf1); + result = (int)setsockcreatecon_raw(arg1); + resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_getfilecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; @@ -3123,13 +3501,10 @@ int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; - security_context_t temp2 = NULL ; - char *temp20 = NULL ; + security_context_t temp2 = 0 ; PyObject * obj0 = 0 ; - { - arg2 = &temp2; - } + arg2 = &temp2; if (!PyArg_ParseTuple(args,(char *)"O:getfilecon",&obj0)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { @@ -3138,13 +3513,14 @@ arg1 = (char *)(buf1); result = (int)getfilecon((char const *)arg1,arg2); resultobj = SWIG_From_int((int)(result)); - { - if (*arg2) - temp20 = *arg2; - else - temp20 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp20)); + if (*arg2) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg2)); + freecon(*arg2); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: @@ -3153,6 +3529,42 @@ } +SWIGINTERN PyObject *_wrap_getfilecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + security_context_t *arg2 = (security_context_t *) 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + security_context_t temp2 = 0 ; + PyObject * obj0 = 0 ; + + arg2 = &temp2; + if (!PyArg_ParseTuple(args,(char *)"O:getfilecon_raw",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getfilecon_raw" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = (char *)(buf1); + result = (int)getfilecon_raw((char const *)arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + if (*arg2) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg2)); + freecon(*arg2); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_lgetfilecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; @@ -3161,13 +3573,10 @@ int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; - security_context_t temp2 = NULL ; - char *temp20 = NULL ; + security_context_t temp2 = 0 ; PyObject * obj0 = 0 ; - { - arg2 = &temp2; - } + arg2 = &temp2; if (!PyArg_ParseTuple(args,(char *)"O:lgetfilecon",&obj0)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { @@ -3176,13 +3585,14 @@ arg1 = (char *)(buf1); result = (int)lgetfilecon((char const *)arg1,arg2); resultobj = SWIG_From_int((int)(result)); - { - if (*arg2) - temp20 = *arg2; - else - temp20 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp20)); + if (*arg2) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg2)); + freecon(*arg2); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: @@ -3191,6 +3601,42 @@ } +SWIGINTERN PyObject *_wrap_lgetfilecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + security_context_t *arg2 = (security_context_t *) 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + security_context_t temp2 = 0 ; + PyObject * obj0 = 0 ; + + arg2 = &temp2; + if (!PyArg_ParseTuple(args,(char *)"O:lgetfilecon_raw",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lgetfilecon_raw" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = (char *)(buf1); + result = (int)lgetfilecon_raw((char const *)arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + if (*arg2) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg2)); + freecon(*arg2); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + return NULL; +} + + SWIGINTERN PyObject *_wrap_fgetfilecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -3198,13 +3644,10 @@ int result; int val1 ; int ecode1 = 0 ; - security_context_t temp2 = NULL ; - char *temp20 = NULL ; + security_context_t temp2 = 0 ; PyObject * obj0 = 0 ; - { - arg2 = &temp2; - } + arg2 = &temp2; if (!PyArg_ParseTuple(args,(char *)"O:fgetfilecon",&obj0)) SWIG_fail; ecode1 = SWIG_AsVal_int(obj0, &val1); if (!SWIG_IsOK(ecode1)) { @@ -3213,27 +3656,64 @@ arg1 = (int)(val1); result = (int)fgetfilecon(arg1,arg2); resultobj = SWIG_From_int((int)(result)); - { - if (*arg2) - temp20 = *arg2; - else - temp20 = ""; - resultobj = SWIG_Python_AppendOutput(resultobj, PyString_FromString(temp20)); + if (*arg2) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg2)); + freecon(*arg2); } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } return resultobj; fail: return NULL; } +SWIGINTERN PyObject *_wrap_fgetfilecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + security_context_t *arg2 = (security_context_t *) 0 ; + int result; + int val1 ; + int ecode1 = 0 ; + security_context_t temp2 = 0 ; + PyObject * obj0 = 0 ; + + arg2 = &temp2; + if (!PyArg_ParseTuple(args,(char *)"O:fgetfilecon_raw",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "fgetfilecon_raw" "', argument " "1"" of type '" "int""'"); + } + arg1 = (int)(val1); + result = (int)fgetfilecon_raw(arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + if (*arg2) { + resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(*arg2)); + freecon(*arg2); + } + else { + Py_INCREF(Py_None); + resultobj = SWIG_Python_AppendOutput(resultobj, Py_None); + } + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_setfilecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; - security_context_t arg2 ; + security_context_t arg2 = (security_context_t) 0 ; int result; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -3243,27 +3723,71 @@ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setfilecon" "', argument " "1"" of type '" "char const *""'"); } arg1 = (char *)(buf1); - { - arg2 = (security_context_t)PyString_AsString(obj1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "setfilecon" "', argument " "2"" of type '" "security_context_t""'"); } + arg2 = (security_context_t)(buf2); result = (int)setfilecon((char const *)arg1,arg2); resultobj = SWIG_From_int((int)(result)); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return NULL; } +SWIGINTERN PyObject *_wrap_setfilecon_raw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + security_context_t arg2 = (security_context_t) 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:setfilecon_raw",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setfilecon_raw" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = (char *)(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "setfilecon_raw" "', argument " "2"" of type '" "security_context_t""'"); + } + arg2 = (security_context_t)(buf2); + result = (int)setfilecon_raw((char const *)arg1,arg2); + resultobj = SWIG_From_int((int)(result)); + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); + if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + return NULL; +} + + SWIGINTERN PyObject *_wrap_lsetfilecon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObjec... [truncated message content] |