2007-07-28 15:41:04 +00:00
|
|
|
%module LibAppArmor
|
|
|
|
|
|
|
|
%{
|
2014-01-06 14:08:55 -08:00
|
|
|
#include <aalogparse.h>
|
|
|
|
#include <sys/apparmor.h>
|
2015-06-16 15:49:24 -05:00
|
|
|
#include <sys/apparmor_private.h>
|
2007-07-28 15:41:04 +00:00
|
|
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
%include "typemaps.i"
|
2014-01-06 14:08:55 -08:00
|
|
|
%include <aalogparse.h>
|
2011-02-22 03:54:35 -08:00
|
|
|
|
2015-06-16 15:51:19 -05:00
|
|
|
/**
|
|
|
|
* swig doesn't like the macro magic we do in apparmor.h and apparmor_private.h
|
|
|
|
* so the function prototypes must be manually inserted.
|
|
|
|
*
|
|
|
|
* Functions that return a negative int and set errno upon error use a special
|
|
|
|
* %exception directive and must be listed after the %exception below. All
|
|
|
|
* other functions go here.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* apparmor.h */
|
|
|
|
|
|
|
|
extern char *aa_splitcon(char *con, char **mode);
|
|
|
|
|
|
|
|
/* apparmor_private.h */
|
|
|
|
|
|
|
|
extern int _aa_is_blacklisted(const char *name);
|
|
|
|
|
2014-03-07 11:54:12 -08:00
|
|
|
#ifdef SWIGPYTHON
|
|
|
|
%exception {
|
|
|
|
$action
|
|
|
|
if (result < 0) {
|
|
|
|
PyErr_SetFromErrno(PyExc_OSError);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-06-16 15:51:19 -05:00
|
|
|
/* Functions that return a negative int and set errno upon error go here. */
|
2011-02-22 03:54:35 -08:00
|
|
|
|
2015-06-16 15:49:24 -05:00
|
|
|
/* apparmor.h */
|
|
|
|
|
2011-08-09 06:48:56 -07:00
|
|
|
extern int aa_is_enabled(void);
|
2011-08-09 06:48:17 -07:00
|
|
|
extern int aa_find_mountpoint(char **mnt);
|
2007-08-16 04:26:19 +00:00
|
|
|
extern int aa_change_hat(const char *subprofile, unsigned long magic_token);
|
2011-02-22 03:54:35 -08:00
|
|
|
extern int aa_change_profile(const char *profile);
|
|
|
|
extern int aa_change_onexec(const char *profile);
|
2011-02-22 03:55:16 -08:00
|
|
|
extern int aa_change_hatv(const char *subprofiles[], unsigned long token);
|
|
|
|
extern int aa_change_hat_vargs(unsigned long token, int count, ...);
|
2016-03-18 17:28:50 -05:00
|
|
|
extern int aa_stack_profile(const char *profile);
|
|
|
|
extern int aa_stack_onexec(const char *profile);
|
2011-08-09 06:45:51 -07:00
|
|
|
extern int aa_getprocattr_raw(pid_t tid, const char *attr, char *buf, int len,
|
|
|
|
char **mode);
|
|
|
|
extern int aa_getprocattr(pid_t tid, const char *attr, char **buf, char **mode);
|
2015-02-09 18:46:46 -06:00
|
|
|
extern int aa_gettaskcon(pid_t target, char **label, char **mode);
|
|
|
|
extern int aa_getcon(char **label, char **mode);
|
2013-06-25 15:55:08 -07:00
|
|
|
extern int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode);
|
2015-02-09 18:46:46 -06:00
|
|
|
extern int aa_getpeercon(int fd, char **label, char **mode);
|
2013-07-31 09:22:40 -07:00
|
|
|
extern int aa_query_label(uint32_t mask, char *query, size_t size, int *allow,
|
|
|
|
int *audit);
|
2015-06-06 01:26:03 -07:00
|
|
|
extern int aa_query_file_path_len(uint32_t mask, const char *label,
|
|
|
|
size_t label_len, const char *path,
|
|
|
|
size_t path_len, int *allowed, int *audited);
|
|
|
|
extern int aa_query_file_path(uint32_t mask, const char *label,
|
|
|
|
const char *path, int *allowed, int *audited);
|
2015-06-06 01:27:49 -07:00
|
|
|
extern int aa_query_link_path_len(const char *label, size_t label_len,
|
|
|
|
const char *target, size_t target_len,
|
|
|
|
const char *link, size_t link_len,
|
|
|
|
int *allowed, int *audited);
|
|
|
|
extern int aa_query_link_path(const char *label, const char *target,
|
|
|
|
const char *link, int *allowed, int *audited);
|
2014-03-07 11:54:12 -08:00
|
|
|
|
|
|
|
%exception;
|