lin
2025-07-30 fcd736bf35fd93b563e9bbf594f2aa7b62028cc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Authors: Dan Walsh
 *          James Athey
 */
 
%module selinux
%{
   #include "../include/selinux/avc.h"
   #include "../include/selinux/context.h"
   #include "../include/selinux/get_context_list.h"
   #include "../include/selinux/get_default_type.h"
   #include "../include/selinux/label.h"
   #include "../include/selinux/restorecon.h"
   #include "../include/selinux/selinux.h"
%}
%apply int *OUTPUT { int *enforce };
%apply int *OUTPUT { size_t * };
 
%typedef unsigned mode_t;
%typedef unsigned pid_t;
 
%typemap(in, numinputs=0) (char ***names, int *len) (char **temp1=NULL, int temp2) {
   $1 = &temp1;
   $2 = &temp2;
}
 
%typemap(freearg) (char ***names, int *len) {
   int i;
   if (*$1) {
       for (i = 0; i < *$2; i++) {
           free((*$1)[i]);
       }
       free(*$1);
   }
}
 
%typemap(in, numinputs=0) (char ***) (char **temp=NULL) {
   $1 = &temp;
}
 
%typemap(freearg) (char ***) {
   if (*$1) freeconary(*$1);
}
 
/* 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;
 
%ignore avc_add_callback;
 
/* Ignore netlink stuff for now */
%ignore avc_netlink_acquire_fd;
%ignore avc_netlink_release_fd;
%ignore avc_netlink_check_nb;
 
%include "../include/selinux/avc.h"
%include "../include/selinux/context.h"
%include "../include/selinux/get_context_list.h"
%include "../include/selinux/get_default_type.h"
%include "../include/selinux/label.h"
%include "../include/selinux/restorecon.h"
%include "../include/selinux/selinux.h"