]> git.pld-linux.org Git - packages/apparmor-parser.git/blob - apparmor-parser-pld.patch
- new
[packages/apparmor-parser.git] / apparmor-parser-pld.patch
1 diff -urN apparmor-parser-2.0.org/rc.apparmor.functions apparmor-parser-2.0/rc.apparmor.functions
2 --- apparmor-parser-2.0.org/rc.apparmor.functions       2006-10-12 18:56:46.000000000 +0200
3 +++ apparmor-parser-2.0/rc.apparmor.functions   2006-12-12 17:38:38.000000000 +0100
4 @@ -53,7 +53,7 @@
5  
6  if [ -f "${APPARMOR_CONF}" ] ; then
7         #parse the conf file to see what we should do
8 -       source "${APPARMOR_CONF}"
9 +       . "${APPARMOR_CONF}"
10  fi
11  
12  if [ -f /sbin/apparmor_parser ] ; then
13 @@ -102,7 +102,7 @@
14  # keep exit status from parser during profile load.  0 is good, 1 is bad
15  STATUS=0
16  
17 -function parse_profiles() {    
18 +parse_profiles() {     
19         # get parser arg
20         case "$1" in
21                 load)
22 @@ -160,7 +160,7 @@
23         fi
24  }
25  
26 -function profiles_names_list() {       
27 +profiles_names_list() {        
28         # run the parser on all of the apparmor profiles
29         TMPFILE=$1
30         if [ ! -f "$PARSER" ]; then
31 @@ -188,7 +188,7 @@
32         done
33  }
34  
35 -function is_subdomainfs_mounted() {
36 +is_subdomainfs_mounted() {
37         if grep -q subdomainfs /proc/filesystems ; then
38                 if grep -q subdomainfs /proc/mounts && \
39                    [ -f "${SUBDOMAINFS_MOUNTPOINT}/profiles" ]; then
40 @@ -211,7 +211,7 @@
41         return 1
42  }
43  
44 -function mount_subdomainfs() {
45 +mount_subdomainfs() {
46         # for backwords compatibility
47         if grep -q subdomainfs /proc/filesystems ; then
48                 if [ "X" != "X${SUBDOMAINFS_MOUNTPOINT}" ]; then
49 @@ -239,14 +239,14 @@
50         return 0
51  }
52  
53 -function unmount_subdomainfs() {
54 +unmount_subdomainfs() {
55         SUBDOMAINFS=$(grep subdomainfs /proc/mounts  | cut -d" " -f2 2> /dev/null)
56         if [ "X" != "X${SUBDOMAINFS}" ]; then
57                 sd_action "Unmounting subdomainfs" umount ${SUBDOMAINFS}
58         fi
59  }
60  
61 -function rebuild_subdomain() {
62 +rebuild_subdomain() {
63         if [ -d "$SUBDOMAIN_SRC" ] ; then
64                 # only try to rebuild for the running kernel
65                 cd "$SUBDOMAIN_SRC"
66 @@ -280,7 +280,7 @@
67         fi
68  }
69  
70 -function failstop_system() {
71 +failstop_system() {
72         level=$(runlevel | cut -d" " -f2)
73         if [ $level -ne "1" ] ; then
74                 sd_log_failure_msg "- could not start AppArmor.  Changing to runlevel 1"
75 @@ -291,7 +291,7 @@
76         return -1
77  }
78  
79 -function module_panic() {
80 +module_panic() {
81         # the module failed to load, determine what action should be taken
82  
83         case "$SUBDOMAIN_MODULE_PANIC" in
84 @@ -315,7 +315,7 @@
85         esac
86  }
87  
88 -function load_module() {
89 +load_module() {
90         if modinfo -F filename apparmor > /dev/null 2>&1 ; then
91                 MODULE=apparmor
92         elif modinfo -F filename subdomain > /dev/null 2>&1 ; then
93 @@ -335,7 +335,7 @@
94         fi
95  }      
96  
97 -function start_sd_event() {
98 +start_sd_event() {
99         if [ -x "$AA_EV_BIN" -a "${APPARMOR_ENABLE_AAEVENTD}" = "yes" ] ; then
100                 sd_action "Starting AppArmor Event daemon" startproc -f -p $AA_EV_PIDFILE $AA_EV_BIN -p $AA_EV_PIDFILE
101         elif [ -x "$SD_EV_BIN" -a "${APPARMOR_ENABLE_AAEVENTD}" = "yes" ] ; then
102 @@ -343,7 +343,7 @@
103         fi
104  }
105  
106 -function stop_sd_event() {
107 +stop_sd_event() {
108         if [ -x "$AA_EV_BIN" -a -f "$AA_EV_PIDFILE" ] ; then
109                 sd_action "Shutting down AppArmor Event daemon" /sbin/killproc -G -p $AA_EV_PIDFILE -INT $AA_EV_BIN
110         fi
111 @@ -352,7 +352,7 @@
112         fi
113  }
114  
115 -function subdomain_start() {
116 +subdomain_start() {
117         if ! grep -qE "^(subdomain|apparmor)[[:space:]]" /proc/modules ; then
118                 load_module
119                 rc=$?
120 @@ -383,7 +383,8 @@
121         fi
122  }
123  
124 -function remove_profiles() {
125 +remove_profiles() {
126 +       set -x
127         # removing profiles as we directly read from subdomainfs
128         # doesn't work, since we are removing entries which screws up
129         # our position.  Lets hope there are never enough profiles to
130 @@ -404,7 +405,8 @@
131         fi
132  
133         retval=0
134 -       IFS=$'\n' && for profile in $(sed -e "s/ (\(enforce\|complain\))$//" "$SFS_MOUNTPOINT/profiles") ; do
135 +       cat "$SFS_MOUNTPOINT/profiles" | while read line; do
136 +               profile=$(echo "$line" | sed -e "s/ (\(enforce\|complain\))$//")
137                 echo "\"$profile\" { }" | $PARSER -R >/dev/null
138                 rc=$?
139                 if [ ${rc} -ne 0 ] ; then 
140 @@ -418,13 +420,13 @@
141         fi      
142  }
143  
144 -function subdomain_stop() {
145 +subdomain_stop() {
146         stop_sd_event
147         echo -n "Unloading AppArmor profiles "
148         remove_profiles
149  }
150  
151 -function subdomain_kill() {
152 +subdomain_kill() {
153         stop_sd_event
154         unmount_subdomainfs
155         if grep -qE "^apparmor[[:space:]]" /proc/modules ; then
156 @@ -437,7 +439,7 @@
157         sd_action "Unloading AppArmor modules" /sbin/modprobe -r $MODULE
158  }
159  
160 -function __subdomain_restart() {
161 +__subdomain_restart() {
162         if [ ! -w "$SFS_MOUNTPOINT/.load" ] ; then
163                 sd_log_failure_msg "Loading AppArmor profiles - failed, Do you have the correct privileges?"
164                 return 4
165 @@ -459,7 +461,7 @@
166         return 0
167  }
168  
169 -function subdomain_restart() {
170 +subdomain_restart() {
171         if ! grep -qE "^(subdomain|apparmor)[[:space:]]" /proc/modules ; then
172                 subdomain_start
173                 rc=$?
174 @@ -479,7 +481,7 @@
175         return $rc
176  }
177  
178 -function subdomain_try_restart() {
179 +subdomain_try_restart() {
180         if ! grep -qE "^(subdomain|apparmor)[[:space:]]" /proc/modules ; then
181                 return 1
182         fi
183 @@ -493,7 +495,7 @@
184         return $rc
185  }
186  
187 -function subdomain_debug() {
188 +subdomain_debug() {
189         subdomain_kill
190         load_module "subdomain_debug=1"
191         mount_subdomainfs
192 @@ -501,7 +503,7 @@
193         parse_profiles load
194  }
195  
196 -function configure_owlsm () {
197 +configure_owlsm () {
198         if [ "${SUBDOMAIN_ENABLE_OWLSM}" = "yes" -a -f ${SFS_MOUNTPOINT}/control/owlsm ] ; then
199                 # Sigh, the "sh -c" is necessary for the SuSE sd_action
200                 # and it can't be abstracted out as a seperate function, as
201 @@ -513,7 +515,7 @@
202         fi
203  }
204  
205 -function subdomain_status () {
206 +subdomain_status () {
207         if test -x ${AA_STATUS} ; then
208                 ${AA_STATUS} --verbose
209                 return $?
This page took 0.050585 seconds and 4 git commands to generate.