~ubuntu-branches/ubuntu/saucy/apparmor/saucy-proposed

« back to all changes in this revision

Viewing changes to .pc/0067-libapparmor-mode-strings-are-not-to-be-freed.patch/libraries/libapparmor/src/apparmor.h

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge, Tyler Hicks, Jamie Strandboge
  • Date: 2013-09-10 12:06:06 UTC
  • Revision ID: package-import@ubuntu.com-20130910120606-cli33sg3o4tgayou
Tags: 2.8.0-0ubuntu28
[ Tyler Hicks ]
* Move the aa-exec man page out of apparmor-utils into apparmor, since
  aa-exec is now in apparmor
  - debian/control: adjust Breaks/Replaces to use apparmor-utils
    (<< 2.8.0-0ubuntu28)
  - debian/apparmor.manpages: install the aa-exec man page
  - debian/apparmor-utils.manpages: don't install the aa-exec man page
* debian/patches/0065-lp1220861.patch: Always NUL-terminate confinement
  context strings returned from libapparmor (LP: #1220861)
* debian/patches/0066-lp1196880.patch: Don't assign mode pointer in
  aa_getprocattr() if caller passed in NULL (LP: #1196880)
* debian/patches/0067-libapparmor-mode-strings-are-not-to-be-freed.patch:
  Update man page and code comments to make it clear that freeing the *con
  string returned from libapparmor's getcon functions also frees the *mode
  string
* debian/patches/0068-libapparmor-mention-dbus-method-in-getcon-man.patch:
  Document the D-Bus method, in the aa_getcon man page, that returns the
  AppArmor task confinement string of a D-Bus connection

[ Jamie Strandboge ]
* debian/patches/0069-p11kit-abstraction.patch: p11-kit needs access to
  /usr/share/p11-kit/modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2003-2008 Novell, Inc. (All rights reserved)
 
3
 * Copyright 2009-2010 Canonical Ltd.
 
4
 *
 
5
 * The libapparmor library is licensed under the terms of the GNU
 
6
 * Lesser General Public License, version 2.1. Please see the file
 
7
 * COPYING.LGPL.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public License
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 */
 
17
 
 
18
#ifndef _SYS_APPARMOR_H_
 
19
#define _SYS_APPARMOR_H 1
 
20
 
 
21
#include <stdint.h>
 
22
#include <sys/types.h>
 
23
 
 
24
__BEGIN_DECLS
 
25
 
 
26
/*
 
27
 * Class of mediation types in the AppArmor policy db
 
28
 */
 
29
#define AA_CLASS_COND           0
 
30
#define AA_CLASS_UNKNOWN        1
 
31
#define AA_CLASS_FILE           2
 
32
#define AA_CLASS_CAP            3
 
33
#define AA_CLASS_NET            4
 
34
#define AA_CLASS_RLIMITS        5
 
35
#define AA_CLASS_DOMAIN         6
 
36
#define AA_CLASS_MOUNT          7
 
37
#define AA_CLASS_NS_DOMAIN      8
 
38
#define AA_CLASS_PTRACE         9
 
39
 
 
40
#define AA_CLASS_ENV            16
 
41
 
 
42
#define AA_CLASS_DBUS           32
 
43
#define AA_CLASS_X              33
 
44
 
 
45
 
 
46
/* Permission Flags for Mediation classes */
 
47
#define AA_MAY_WRITE            (1 << 1)
 
48
#define AA_MAY_READ             (1 << 2)
 
49
#define AA_MAY_BIND             (1 << 6)
 
50
 
 
51
#define AA_DBUS_SEND            AA_MAY_WRITE
 
52
#define AA_DBUS_RECEIVE         AA_MAY_READ
 
53
#define AA_DBUS_BIND            AA_MAY_BIND
 
54
 
 
55
 
 
56
/* Prototypes for apparmor state queries */
 
57
extern int aa_is_enabled(void);
 
58
extern int aa_find_mountpoint(char **mnt);
 
59
 
 
60
/* Prototypes for self directed domain transitions
 
61
 * see <http://apparmor.net>
 
62
 * Please see the change_hat(2) manpage for information.
 
63
 */
 
64
 
 
65
#define change_hat(X, Y) aa_change_hat((X), (Y))
 
66
extern int (change_hat)(const char *subprofile, unsigned int magic_token);
 
67
extern int aa_change_hat(const char *subprofile, unsigned long magic_token);
 
68
extern int aa_change_profile(const char *profile);
 
69
extern int aa_change_onexec(const char *profile);
 
70
 
 
71
extern int aa_change_hatv(const char *subprofiles[], unsigned long token);
 
72
extern int (aa_change_hat_vargs)(unsigned long token, int count, ...);
 
73
 
 
74
/* Protypes for introspecting task confinement
 
75
 * Please see the aa_getcon(2) manpage for information
 
76
 */
 
77
extern int aa_getprocattr_raw(pid_t tid, const char *attr, char *buf, int len,
 
78
                              char **mode);
 
79
extern int aa_getprocattr(pid_t tid, const char *attr, char **buf, char **mode);
 
80
extern int aa_gettaskcon(pid_t target, char **con, char **mode);
 
81
extern int aa_getcon(char **con, char **mode);
 
82
extern int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode);
 
83
extern int aa_getpeercon(int fd, char **con, char **mode);
 
84
 
 
85
/* A NUL character is used to separate the query command prefix string from the
 
86
 * rest of the query string. The query command sizes intentionally include the
 
87
 * NUL-terminator in their values.
 
88
 */
 
89
#define AA_QUERY_CMD_LABEL              "label"
 
90
#define AA_QUERY_CMD_LABEL_SIZE         sizeof(AA_QUERY_CMD_LABEL)
 
91
 
 
92
extern int aa_query_label(uint32_t mask, char *query, size_t size, int *allow,
 
93
                          int *audit);
 
94
 
 
95
#define __macroarg_counter(Y...) __macroarg_count1 ( , ##Y)
 
96
#define __macroarg_count1(Y...) __macroarg_count2 (Y, 16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
 
97
#define __macroarg_count2(_,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,n,Y...) n
 
98
 
 
99
/**
 
100
 * change_hat_vargs - a wrapper macro for change_hat_vargs
 
101
 * @T: the magic token
 
102
 * @X...: the parameter list of hats being passed
 
103
 *
 
104
 * The change_hat_vargs macro makes it so the caller doesn't have to
 
105
 * specify the number of hats passed as parameters to the change_hat_vargs
 
106
 * fn.
 
107
 *
 
108
 * eg.
 
109
 * change_hat_vargs(10, hat1, hat2, hat3, hat4);
 
110
 * expandes to
 
111
 * (change_hat_vargs)(10, 4, hat1, hat2, hat3, hat4);
 
112
 *
 
113
 * to call change_hat_vargs direction do
 
114
 * (change_hat_vargs)(token, nhats, hat1, hat2...)
 
115
 */
 
116
#define aa_change_hat_vargs(T, X...) \
 
117
        (aa_change_hat_vargs)(T, __macroarg_counter(X), X)
 
118
 
 
119
__END_DECLS
 
120
 
 
121
#endif  /* sys/apparmor.h */