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