• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Authors: Dan Walsh
2  *          James Athey
3  */
4 
5 %module selinux
6 %{
7 	#include "../include/selinux/avc.h"
8 	#include "../include/selinux/context.h"
9 	#include "../include/selinux/get_context_list.h"
10 	#include "../include/selinux/get_default_type.h"
11 	#include "../include/selinux/label.h"
12 	#include "../include/selinux/selinux.h"
13 %}
14 %apply int *OUTPUT { int *enforce };
15 %apply int *OUTPUT { size_t * };
16 
17 %typedef unsigned mode_t;
18 %typedef unsigned pid_t;
19 
20 %typemap(in, numinputs=0) (char ***names, int *len) (char **temp1, int temp2) {
21 	$1 = &temp1;
22 	$2 = &temp2;
23 }
24 
25 %typemap(freearg) (char ***names, int *len) {
26 	int i;
27 	if (*$1) {
28 		for (i = 0; i < *$2; i++) {
29 			free((*$1)[i]);
30 		}
31 		free(*$1);
32 	}
33 }
34 
35 %typemap(in, numinputs=0) (char ***) (char **temp) {
36 	$1 = &temp;
37 }
38 
39 %typemap(freearg) (char ***) {
40 	if (*$1) freeconary(*$1);
41 }
42 
43 /* Ignore functions that don't make sense when wrapped */
44 %ignore freecon;
45 %ignore freeconary;
46 
47 /* Ignore functions that take a function pointer as an argument */
48 %ignore set_matchpathcon_printf;
49 %ignore set_matchpathcon_invalidcon;
50 %ignore set_matchpathcon_canoncon;
51 
52 %ignore avc_add_callback;
53 
54 /* Ignore netlink stuff for now */
55 %ignore avc_netlink_acquire_fd;
56 %ignore avc_netlink_release_fd;
57 %ignore avc_netlink_check_nb;
58 
59 %include "../include/selinux/avc.h"
60 %include "../include/selinux/av_permissions.h"
61 %include "../include/selinux/context.h"
62 %include "../include/selinux/flask.h"
63 %include "../include/selinux/get_context_list.h"
64 %include "../include/selinux/get_default_type.h"
65 %include "../include/selinux/label.h"
66 %include "../include/selinux/selinux.h"
67