~ubuntu-branches/ubuntu/trusty/apparmor/trusty-security

« back to all changes in this revision

Viewing changes to .pc/0050-parser-Add-support-for-DBus-rules.patch/parser/immunix.h

  • Committer: Package Import Robot
  • Author(s): Seth Arnold, Jamie Strandboge, Seth Arnold, Jamie Strandboge, Steve Beattie, John Johansen, Tyler Hicks
  • Date: 2014-03-19 20:29:27 UTC
  • mfrom: (1.1.26)
  • Revision ID: package-import@ubuntu.com-20140319202927-ul597pahqsvsl2ea
Tags: 2.8.95~2430-0ubuntu1
[ Jamie Strandboge ]

 * debian/debhelper/dh_apparmor: exit with error if aa-easyprof does not
   exist
 * debian/control: drop Depends on apparmor-easyprof to Suggests for
   dh-apparmor

[ Seth Arnold, Jamie Strandboge, Steve Beattie, John Johansen, Tyler Hicks ]

* New upstream snapshot (LP: #1278702, #1061693, #1285653) dropping very
  large Ubuntu delta and fixing the following bugs:
  - Adjust fonts abstraction for libthai (LP: #1278702)
  - Support translated XDG user directories (LP: #1061693)
  - Adjust abstractions/web-data to include /var/www/html (LP: #1285653)
    Refresh 0002-add-debian-integration-to-lighttpd.patch to include
    /etc/lighttpd/conf-available/*.conf
  - Adjust debian/libapparmor1.symbols to reflect new upstream versioning
    for the aa_query_label() function
  - Raise exceptions in Python bindings when something fails
* ship new Python replacements for previous Perl-based tools
  - debian/apparmor-utils.install: remove usr/share/perl5/Immunix/*.pm and
    add usr/sbin/aa-autodep, usr/sbin/aa-cleanprof and usr/sbin/aa-mergeprof
  - debian/control:
    + remove various Perl dependencies
    + add python-apparmor and python3-apparmor
    + python3-apparmor Breaks: apparmor-easyprof to move the file since it
      ships dist-packages/apparmor/__init__.py now
  - debian/apparmor-utils.manpages: ship new manpages for aa-cleanprof and
    aa-mergeprof
  - debian/rules: build and install Python tools
* debian/apparmor.install:
  - install apparmorfs, dovecot, kernelvars, securityfs, sys,
    and xdg-user-dirs tunables and xdg-user-dirs.d directory
* debian/apparmor.dirs:
  - install /etc/apparmor.d/tunables/xdg-user-dirs.d
* debian/rules: delete upstream-provided xdg-user-dirs.d/site.local
* debian/apparmor.postinst: create xdg-user-dirs.d/site.local
* debian/apparmor.postrm: remove xdg-user-dirs.d
* Remaining patches:
  - add-chromium-browser.patch
  - add-debian-integration-to-lighttpd.patch
  - ubuntu-manpage-updates.patch
  - libapparmor-layout-deb.patch
  - libapparmor-mention-dbus-method-in-getcon-man.patch
  - etc-writable.patch
  - aa-utils_are_bilingual.patch
* New patches:
  - convert-to-rules.patch
  - list-fns.patch
  - parse-mode.patch
  - add-decimal-interp.patch
  - policy_mediates.patch
  - fix-failpath.patch
  - feature_file.patch
  - fix-network.patch
  - aare-to-class.patch
  - add-mediation-unix.patch
  - parser_version.patch
  - caching.patch
  - label-class.patch
  - fix-lexer-debug.patch
  - use-diff-encode.patch
  - fix-serialize.patch
  - fix-ppc-endian-ftbfs.patch
  - opt_arg.patch
  - tests-cond-dbus.patch
* Move manpages from libapparmor1 to libapparmor-dev
  - debian/libapparmor-dev.manpages: install aa_change_hat.2,
    aa_change_profile.2, aa_find_mountpoint.2, aa_getcon.2
  - debian/control: libapparmor-dev Replaces: and Breaks: libapparmor1
* Move /usr/lib/python3/dist-packages/apparmor/__init__.py from
  apparmor-easyprof to python3-apparmor
  - debian/control: python3-apparmor Breaks: apparmor-easyprof
  - debian/apparmor-easyprof.install: remove
    usr/lib/python*.*/site-packages/apparmor*
* New profiles and abstractions:
  - debian/apparmor.install: tunables/dovecot, tunables/kernelvars,
    tunables/xdg-user-dirs, tunables/xdg-user-dirs.d

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *      Copyright (c) 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007
3
 
 *      NOVELL (All rights reserved)
4
 
 *
5
 
 *      Immunix AppArmor LSM
6
 
 *
7
 
 *      This program is free software; you can redistribute it and/or
8
 
 *      modify it under the terms of the GNU General Public License as
9
 
 *      published by the Free Software Foundation, version 2 of the
10
 
 *      License.
11
 
 *
12
 
 *      This program is distributed in the hope that it will be useful,
13
 
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 *      GNU General Public License for more details.
16
 
 *
17
 
 *      You should have received a copy of the GNU General Public License
18
 
 *      along with this program; if not, contact Novell, Inc.
19
 
 */
20
 
 
21
 
#ifndef _IMMUNIX_H
22
 
#define _IMMUNIX_H
23
 
 
24
 
/*
25
 
 * Modeled after MAY_READ, MAY_WRITE, MAY_EXEC in the kernel. The value of
26
 
 * AA_MAY_EXEC must be identical to MAY_EXEC, etc.
27
 
 */
28
 
#define AA_MAY_EXEC                     (1 << 0)
29
 
#define AA_MAY_WRITE                    (1 << 1)
30
 
#define AA_MAY_READ                     (1 << 2)
31
 
#define AA_MAY_APPEND                   (1 << 3)
32
 
#define AA_MAY_LINK                     (1 << 4)
33
 
#define AA_MAY_LOCK                     (1 << 5)
34
 
#define AA_EXEC_MMAP                    (1 << 6)
35
 
#define AA_EXEC_PUX                     (1 << 7)
36
 
#define AA_EXEC_UNSAFE                  (1 << 8)
37
 
#define AA_EXEC_INHERIT                 (1 << 9)
38
 
#define AA_EXEC_MOD_0                   (1 << 10)
39
 
#define AA_EXEC_MOD_1                   (1 << 11)
40
 
#define AA_EXEC_MOD_2                   (1 << 12)
41
 
#define AA_EXEC_MOD_3                   (1 << 13)
42
 
 
43
 
#define AA_BASE_PERMS                   (AA_MAY_EXEC | AA_MAY_WRITE | \
44
 
                                         AA_MAY_READ | AA_MAY_APPEND | \
45
 
                                         AA_MAY_LINK | AA_MAY_LOCK | \
46
 
                                         AA_EXEC_PUX | AA_EXEC_MMAP | \
47
 
                                         AA_EXEC_UNSAFE | AA_EXEC_INHERIT | \
48
 
                                         AA_EXEC_MOD_0 | AA_EXEC_MOD_1 | \
49
 
                                         AA_EXEC_MOD_2 | AA_EXEC_MOD_3)
50
 
 
51
 
#define AA_USER_SHIFT                   0
52
 
#define AA_OTHER_SHIFT                  14
53
 
 
54
 
#define AA_USER_PERMS                   (AA_BASE_PERMS << AA_USER_SHIFT)
55
 
#define AA_OTHER_PERMS                  (AA_BASE_PERMS << AA_OTHER_SHIFT)
56
 
 
57
 
#define AA_FILE_PERMS                   (AA_USER_PERMS | AA_OTHER_PERMS )
58
 
 
59
 
#define AA_USER_PTRACE                  (1 << 28)
60
 
#define AA_OTHER_PTRACE                 (1 << 29)
61
 
#define AA_PTRACE_PERMS                 (AA_USER_PTRACE | AA_OTHER_PTRACE)
62
 
 
63
 
#define AA_CHANGE_HAT                   (1 << 30)
64
 
#define AA_ONEXEC                       (1 << 30)
65
 
#define AA_CHANGE_PROFILE               (1 << 31)
66
 
#define AA_SHARED_PERMS                 (AA_CHANGE_HAT | AA_CHANGE_PROFILE)
67
 
 
68
 
#define AA_EXEC_MODIFIERS               (AA_EXEC_MOD_0 | AA_EXEC_MOD_1 | \
69
 
                                         AA_EXEC_MOD_2 | AA_EXEC_MOD_3)
70
 
#define AA_EXEC_COUNT                   16
71
 
 
72
 
#define AA_USER_EXEC_MODIFIERS          (AA_EXEC_MODIFIERS << AA_USER_SHIFT)
73
 
#define AA_OTHER_EXEC_MODIFIERS         (AA_EXEC_MODIFIERS << AA_OTHER_SHIFT)
74
 
#define AA_ALL_EXEC_MODIFIERS           (AA_USER_EXEC_MODIFIERS | \
75
 
                                         AA_OTHER_EXEC_MODIFIERS)
76
 
 
77
 
#define AA_EXEC_TYPE                    (AA_EXEC_UNSAFE | AA_EXEC_INHERIT | \
78
 
                                         AA_EXEC_PUX | AA_EXEC_MODIFIERS)
79
 
 
80
 
#define AA_EXEC_UNCONFINED              (AA_EXEC_MOD_0)
81
 
#define AA_EXEC_PROFILE                 (AA_EXEC_MOD_1)
82
 
#define AA_EXEC_LOCAL                   (AA_EXEC_MOD_0 | AA_EXEC_MOD_1)
83
 
 
84
 
#define AA_VALID_PERMS                  (AA_FILE_PERMS | AA_PTRACE_PERMS | \
85
 
                                         AA_OTHER_PERMS)
86
 
 
87
 
#define AA_USER_EXEC                    (AA_MAY_EXEC << AA_USER_SHIFT)
88
 
#define AA_OTHER_EXEC                   (AA_MAY_EXEC << AA_OTHER_SHIFT)
89
 
 
90
 
#define AA_EXEC_BITS                    (AA_USER_EXEC | AA_OTHER_EXEC)
91
 
 
92
 
#define ALL_AA_EXEC_UNSAFE              ((AA_EXEC_UNSAFE << AA_USER_SHIFT) | \
93
 
                                         (AA_EXEC_UNSAFE << AA_OTHER_SHIFT))
94
 
 
95
 
#define AA_USER_EXEC_TYPE               (AA_EXEC_TYPE << AA_USER_SHIFT)
96
 
#define AA_OTHER_EXEC_TYPE              (AA_EXEC_TYPE << AA_OTHER_SHIFT)
97
 
 
98
 
#define ALL_AA_EXEC_TYPE                (AA_USER_EXEC_TYPE | AA_OTHER_EXEC_TYPE)
99
 
 
100
 
#define ALL_USER_EXEC                   (AA_USER_EXEC | AA_USER_EXEC_TYPE)
101
 
#define ALL_OTHER_EXEC                  (AA_OTHER_EXEC | AA_OTHER_EXEC_TYPE)
102
 
 
103
 
#define AA_LINK_BITS                    ((AA_MAY_LINK << AA_USER_SHIFT) | \
104
 
                                         (AA_MAY_LINK << AA_OTHER_SHIFT))
105
 
 
106
 
#define SHIFT_MODE(MODE, SHIFT)         ((((MODE) & AA_BASE_PERMS) << (SHIFT))\
107
 
                                         | ((MODE) & ~AA_FILE_PERMS))
108
 
#define SHIFT_TO_BASE(MODE, SHIFT)      ((((MODE) & AA_FILE_PERMS) >> (SHIFT))\
109
 
                                         | ((MODE) & ~AA_FILE_PERMS))
110
 
 
111
 
 
112
 
#define AA_LINK_SUBSET_TEST             (AA_MAY_LINK << 1)
113
 
#define LINK_SUBSET_BITS        ((AA_LINK_SUBSET_TEST << AA_USER_SHIFT) | \
114
 
                                 (AA_LINK_SUBSET_TEST << AA_OTHER_SHIFT))
115
 
#define LINK_TO_LINK_SUBSET(X)          (((X) << 1) & AA_LINK_SUBSET_TEST)
116
 
 
117
 
 
118
 
/* Pack the audit, and quiet masks into a single 28 bit field in the
119
 
 * format oq:oa:uq:ua
120
 
 */
121
 
#define PACK_AUDIT_CTL(audit, quiet)    (((audit) & 0x1fc07f) | \
122
 
                                         (((quiet) & 0x1fc07f) << 7))
123
 
 
124
 
#define AA_HAT_SIZE     975     /* Maximum size of a subdomain
125
 
                                         * ident (hat) */
126
 
#define AA_IP_TCP                       0x0001
127
 
#define AA_IP_UDP                       0x0002
128
 
#define AA_IP_RDP                       0x0004
129
 
#define AA_IP_RAW                       0x0008
130
 
#define AA_IPV6_TCP                     0x0010
131
 
#define AA_IPV6_UDP                     0x0020
132
 
#define AA_NETLINK                      0x0040
133
 
 
134
 
enum pattern_t {
135
 
        ePatternBasic,
136
 
        ePatternTailGlob,
137
 
        ePatternRegex,
138
 
        ePatternInvalid,
139
 
};
140
 
 
141
 
#define HAS_MAY_READ(mode)              ((mode) & AA_MAY_READ)
142
 
#define HAS_MAY_WRITE(mode)             ((mode) & AA_MAY_WRITE)
143
 
#define HAS_MAY_APPEND(mode)            ((mode) & AA_MAY_APPEND)
144
 
#define HAS_MAY_EXEC(mode)              ((mode) & AA_MAY_EXEC)
145
 
#define HAS_MAY_LINK(mode)              ((mode) & AA_MAY_LINK)
146
 
#define HAS_MAY_LOCK(mode)              ((mode) & AA_MAY_LOCK)
147
 
#define HAS_EXEC_MMAP(mode)             ((mode) & AA_EXEC_MMAP)
148
 
 
149
 
#define HAS_EXEC_UNSAFE(mode)           ((mode) & AA_EXEC_UNSAFE)
150
 
#define HAS_CHANGE_PROFILE(mode)        ((mode) & AA_CHANGE_PROFILE)
151
 
 
152
 
#include <stdio.h>
153
 
static inline int is_merged_x_consistent(int a, int b)
154
 
{
155
 
        if ((a & AA_USER_EXEC) && (b & AA_USER_EXEC) &&
156
 
            ((a & AA_USER_EXEC_TYPE) != (b & AA_USER_EXEC_TYPE)))
157
 
          { //fprintf(stderr, "failed user merge 0x%x 0x%x\n", a, b);
158
 
                return 0;
159
 
}
160
 
        if ((a & AA_OTHER_EXEC) && (b & AA_OTHER_EXEC) &&
161
 
            ((a & AA_OTHER_EXEC_TYPE) != (b & AA_OTHER_EXEC_TYPE)))
162
 
          { //fprintf(stderr, "failed other merge 0x%x 0x%x\n", a, b);
163
 
                return 0;
164
 
}
165
 
        return 1;
166
 
}
167
 
 
168
 
#endif                          /* ! _IMMUNIX_H */