>> diff -ur orig/aa.py p1a/aa.py
>> --- orig/aa.py 2014-10-16 22:03:42.000000000 +0200
>> +++ p1a/aa.py 2014-11-24 22:55:56.522927379 +0100
>> @@ -147,29 +147,27 @@
>> sys.exit(1)
>>
>> def check_for_apparmor():
>> - """Finds and returns the mointpoint for apparmor None otherwise"""
>> + """Finds and returns the mountpoint for apparmor None otherwise"""
>> filesystem = '/proc/filesystems'
>> mounts = '/proc/mounts'
>> support_securityfs = False
>> aa_mountpoint = None
>> - regex_securityfs = re.compile('^\S+\s+(\S+)\s+securityfs\s')
>> if valid_path(filesystem):
>> with open_file_read(filesystem) as f_in:
>> for line in f_in:
>> if 'securityfs' in line:
>> support_securityfs = True
>> *- if valid_path(mounts):*
>> - with open_file_read(mounts) as f_in:
>> - for line in f_in:
>> - if support_securityfs:
>> - match = regex_securityfs.search(line)
>> - if match:
>> - mountpoint = match.groups()[0] + '/apparmor'
>> - if valid_path(mountpoint):
>> + break
>> + if support_securityfs:
>> + with open_file_read(mounts) as f_in:
>> + for line in f_in:
>> + split = line.split()
>> + if len(split) > 2 and split[2] == 'securityfs':
>> + mountpoint = split[1] + '/apparmor'
>> + # Check if apparmor is actually mounted there
>> + if valid_path(mountpoint) and valid_path(mountpoint
>> + '/profiles'):
>> aa_mountpoint = mountpoint
>> - # Check if apparmor is actually mounted there
>> - if not valid_path(aa_mountpoint + '/profiles'):
>> - aa_mountpoint = None
>> + break
>> return aa_mountpoint
>>
>> def which(file):
>
Oh and actually I don't know why "if valid_path(mounts):" was removed. I
think that was supposed to be kept since we open it as a file. Here is a
new patch (attached)
+ if valid_path(mounts) and support_securityfs:
diff -ur orig/aa.py p1a/aa.py
--- orig/aa.py 2014-10-16 22:03:42.000000000 +0200
+++ p1a/aa.py 2014-11-27 09:22:50.529958297 +0100
@@ -147,29 +147,27 @@
sys.exit(1)
def check_for_apparmor():
- """Finds and returns the mointpoint for apparmor None otherwise"""
+ """Finds and returns the mountpoint for apparmor None otherwise"""
filesystem = '/proc/filesystems'
mounts = '/proc/mounts'
support_securityfs = False
aa_mountpoint = None
- regex_securityfs = re.compile('^\S+\s+(\S+)\s+securityfs\s')
if valid_path(filesystem):
with open_file_read(filesystem) as f_in:
for line in f_in:
if 'securityfs' in line:
support_securityfs = True
- if valid_path(mounts):
+ break
+ if valid_path(mounts) and support_securityfs:
with open_file_read(mounts) as f_in:
for line in f_in:
- if support_securityfs:
- match = regex_securityfs.search(line)
- if match:
- mountpoint = match.groups()[0] + '/apparmor'
- if valid_path(mountpoint):
- aa_mountpoint = mountpoint
- # Check if apparmor is actually mounted there
- if not valid_path(aa_mountpoint + '/profiles'):
- aa_mountpoint = None
+ split = line.split()
+ if len(split) > 2 and split[2] == 'securityfs':
+ mountpoint = split[1] + '/apparmor'
+ # Check if apparmor is actually mounted there
+ if valid_path(mountpoint) and valid_path(mountpoint + '/profiles'):
+ aa_mountpoint = mountpoint
+ break
return aa_mountpoint
def which(file):
--
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/apparmor