mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 00:14:44 +01:00

In some cases, ldd might obtain information by executing the given binary (see ldd(1)) - which is not something we should do on potentially unknown binaries, especially because aa-genprof and aa-autodep (and therefore also ldd) are often started as root. Additionally, the ldd result typically listed libraries already covered by abstractions/base, which makes the ldd call superfluous. While on it, - remove all references to ldd - remove code only used for calling ldd and handling its results - remove tests checking ldd results, and the fake_ldd script - adjust a test where fake_ldd had added some libraries - remove ldd path from logprof.conf [settings]
50 lines
2.1 KiB
Python
Executable file
50 lines
2.1 KiB
Python
Executable file
# ----------------------------------------------------------------------
|
|
# Copyright (C) 2013 Kshitij Gupta <kgupta8592@gmail.com>
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
# License as published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# ----------------------------------------------------------------------
|
|
import unittest
|
|
|
|
import apparmor.config as config
|
|
|
|
|
|
class Test(unittest.TestCase):
|
|
|
|
def test_IniConfig(self):
|
|
ini_config = config.Config('ini')
|
|
ini_config.CONF_DIR = '.'
|
|
conf = ini_config.read_config('logprof.conf')
|
|
logprof_sections = ['settings', 'qualifiers', 'required_hats', 'defaulthat', 'globs']
|
|
logprof_sections_options = [
|
|
'profiledir', 'inactive_profiledir', 'logfiles', 'parser',
|
|
'logger', 'default_owner_prompt', 'custom_includes']
|
|
logprof_settings_parser = '../../parser/apparmor_parser ../parser/apparmor_parser'
|
|
|
|
self.assertEqual(conf.sections(), logprof_sections)
|
|
self.assertEqual(conf.options('settings'), logprof_sections_options)
|
|
self.assertEqual(conf['settings']['parser'], logprof_settings_parser)
|
|
|
|
def test_ShellConfig(self):
|
|
shell_config = config.Config('shell')
|
|
shell_config.CONF_DIR = '.'
|
|
conf = shell_config.read_config('easyprof.conf')
|
|
easyprof_sections = ['POLICYGROUPS_DIR', 'TEMPLATES_DIR']
|
|
easyprof_policygroup = './policygroups'
|
|
easyprof_templates = './templates'
|
|
|
|
self.assertEqual(sorted(conf[''].keys()), easyprof_sections)
|
|
self.assertEqual(conf['']['POLICYGROUPS_DIR'], easyprof_policygroup)
|
|
self.assertEqual(conf['']['TEMPLATES_DIR'], easyprof_templates)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# import sys;sys.argv = ['', 'Test.testConfig']
|
|
unittest.main()
|