liyujie
2025-08-28 786ff4f4ca2374bdd9177f2e24b503d43e7a3b93
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
/* Author: Dan Walsh
   Based on selinuxswig_python.i by James Athey
 */
 
/* Never build rpm_execcon interface */
#ifndef DISABLE_RPM
#define DISABLE_RPM
#endif
 
%module selinux
%{
   #include "selinux/selinux.h"
%}
 
/* return a sid along with the result */
%typemap(argout) (security_id_t * sid) {
   if (*$1) {
                %append_output(SWIG_NewPointerObj(*$1, $descriptor(security_id_t), 0));
   } 
}
 
%typemap(in,numinputs=0) security_id_t *(security_id_t temp) {
  $1 = &temp;
}
 
%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));
       freecon(*$1);
   }
}
 
%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);
   }
}
 
%include "selinuxswig.i"