-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch is being added to add new constants for translation between file types and short strings, needed for new sepolicy tool chain. This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlJpNS4ACgkQrlYvE4MpobMBVACfQW+KcmCqF626I6+3BepZHhVh DkIAn0z38PaHmZy4pH8/AFLToYkD5z7b =fvmG -----END PGP SIGNATURE-----
>From 22d6bb19e3f8774ae6ee3d3c0ca2602b1592e83c Mon Sep 17 00:00:00 2001 From: Dan Walsh <dwalsh@xxxxxxxxxx> Date: Fri, 11 Oct 2013 08:47:33 -0400 Subject: [PATCH 47/74] Add new FILE_STRING constands Basically sepolicy is going to use single letters to indicate file types, need to setup a dictionary to go back and forth between full names and short names. --- policycoreutils/semanage/seobject.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/policycoreutils/semanage/seobject.py b/policycoreutils/semanage/seobject.py index fb06935..4e9588f 100644 --- a/policycoreutils/semanage/seobject.py +++ b/policycoreutils/semanage/seobject.py @@ -42,21 +42,37 @@ import syslog file_types = {} file_types[""] = SEMANAGE_FCONTEXT_ALL; file_types["all files"] = SEMANAGE_FCONTEXT_ALL; -file_types["--"] = SEMANAGE_FCONTEXT_REG; +file_types["a"] = SEMANAGE_FCONTEXT_ALL; file_types["regular file"] = SEMANAGE_FCONTEXT_REG; +file_types["--"] = SEMANAGE_FCONTEXT_REG; +file_types["f"] = SEMANAGE_FCONTEXT_REG; file_types["-d"] = SEMANAGE_FCONTEXT_DIR; file_types["directory"] = SEMANAGE_FCONTEXT_DIR; +file_types["d"] = SEMANAGE_FCONTEXT_DIR; file_types["-c"] = SEMANAGE_FCONTEXT_CHAR; file_types["character device"] = SEMANAGE_FCONTEXT_CHAR; +file_types["c"] = SEMANAGE_FCONTEXT_CHAR; file_types["-b"] = SEMANAGE_FCONTEXT_BLOCK; file_types["block device"] = SEMANAGE_FCONTEXT_BLOCK; +file_types["b"] = SEMANAGE_FCONTEXT_BLOCK; file_types["-s"] = SEMANAGE_FCONTEXT_SOCK; file_types["socket"] = SEMANAGE_FCONTEXT_SOCK; +file_types["s"] = SEMANAGE_FCONTEXT_SOCK; file_types["-l"] = SEMANAGE_FCONTEXT_LINK; +file_types["l"] = SEMANAGE_FCONTEXT_LINK; file_types["symbolic link"] = SEMANAGE_FCONTEXT_LINK; +file_types["p"] = SEMANAGE_FCONTEXT_PIPE; file_types["-p"] = SEMANAGE_FCONTEXT_PIPE; file_types["named pipe"] = SEMANAGE_FCONTEXT_PIPE; +file_type_str_to_option = { "all files": "a", + "regular file":"f", + "directory":"d", + "character device":"c", + "block device":"b", + "socket file":"s", + "symbolic link":"l", + "named pipe":"p" } try: import audit class logger: -- 1.8.3.1