~ubuntu-branches/ubuntu/oneiric/apparmor/oneiric-updates

« back to all changes in this revision

Viewing changes to debian/patches/0200-kfreebsd-compat.patch

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-08-10 18:12:34 UTC
  • mfrom: (1.1.19 upstream) (8.1.5 oneiric)
  • Revision ID: james.westby@ubuntu.com-20110810181234-0ph4qatrdx2xskzg
Tags: 2.7.0~beta1+bzr1774-1
* New upstream devel snapshot:
  - drop 0002-lp750381.patch, taken upstream.
  - drop 0004-lp754889.patch, taken upstream.
  - drop 0005-lp761217.patch, taken upstream.
  - drop 0100-manpage-typo.patch, taken upstream.
  - drop 0101-declarations.patch, solved differently upstream.
  - drop 0102-manpage-release-name.patch, taken upstream.
  - drop 0103-kfreebsd-compile.patch, taken upstream.
  - drop define-path-max.patch, taken upstream.
  - drop indep-build.patch, taken upstream.
  - debian/libapparmor1.manpages: add new function man pages.
* Merge with Ubuntu:
  - drop 0104-python-aa-status.patch, taken upstream.
  - drop 0105-lightdm.patch, taken upstream.
  - drop 0106-lp810270.patch, taken upstream.
  - drop 0107-lp767308.patch, taken upstream.
  - drop 0108-gnome-mimeinfo.patch, taken upstream.
  - drop 0109-add-profile-repo-info.patch, taken upstream.
* Add af_names-generation.patch to allow arbitrary socket.h file location.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: let library compile even when missing SYS_gettid, SOCK_PACKET,
2
 
 and various RLIMITs that are Linux-specific, for build-time compatibility
3
 
 with non-Linux environments.
4
 
Author: Kees Cook <kees@debian.org>
5
 
 
6
 
Index: apparmor-debian/libraries/libapparmor/src/kernel_interface.c
7
 
===================================================================
8
 
--- apparmor-debian.orig/libraries/libapparmor/src/kernel_interface.c   2011-04-29 19:21:52.837411699 -0700
9
 
+++ apparmor-debian/libraries/libapparmor/src/kernel_interface.c        2011-04-29 19:22:06.347591088 -0700
10
 
@@ -37,7 +37,11 @@
11
 
        int rc = -1;
12
 
        int fd, ret, ctlerr = 0;
13
 
        char *ctl = NULL;
14
 
+#ifdef SYS_gettid
15
 
        pid_t tid = syscall(SYS_gettid);
16
 
+#else
17
 
+       pid_t tid = getpid();
18
 
+#endif
19
 
 
20
 
        if (!buf) {
21
 
                errno = EINVAL;
22
 
Index: apparmor-debian/parser/parser_yacc.y
23
 
===================================================================
24
 
--- apparmor-debian.orig/parser/parser_yacc.y   2011-04-29 19:21:52.917412762 -0700
25
 
+++ apparmor-debian/parser/parser_yacc.y        2011-04-29 19:22:06.377591485 -0700
26
 
@@ -36,8 +36,16 @@
27
 
 #include <unistd.h>
28
 
 #include <netinet/in.h>
29
 
 #include <arpa/inet.h>
30
 
+#include <sys/time.h>
31
 
+#include <sys/resource.h>
32
 
 
33
 
-#include <linux/capability.h>
34
 
+#ifdef __linux__
35
 
+# include <linux/capability.h>
36
 
+#else
37
 
+# ifndef SOCK_PACKET
38
 
+#  define SOCK_PACKET 10
39
 
+# endif
40
 
+#endif
41
 
 
42
 
 #ifndef CAP_AUDIT_WRITE
43
 
 #define CAP_AUDIT_WRITE 29
44
 
@@ -718,8 +726,12 @@
45
 
                                break;
46
 
                        case RLIMIT_NOFILE:
47
 
                        case RLIMIT_NPROC:
48
 
+#ifdef RLIMIT_LOCKS
49
 
                        case RLIMIT_LOCKS:
50
 
+#endif
51
 
+#ifdef RLIMIT_SIGPENDING
52
 
                        case RLIMIT_SIGPENDING:
53
 
+#endif
54
 
 #ifdef RLIMIT_RTPRIO
55
 
                        case RLIMIT_RTPRIO:
56
 
                                if ($6 == end || *end != '\0' || tmp < 0)
57
 
@@ -743,7 +755,9 @@
58
 
                        case RLIMIT_RSS:
59
 
                        case RLIMIT_AS:
60
 
                        case RLIMIT_MEMLOCK:
61
 
+#ifdef RLIMIT_MSGQUEUE
62
 
                        case RLIMIT_MSGQUEUE:
63
 
+#endif
64
 
                                if ($6 == end || tmp < 0)
65
 
                                        yyerror("RLIMIT '%s' invalid value %s\n", $4, $6);
66
 
                                if (strcmp(end, "K") == 0) {
67
 
Index: apparmor-debian/parser/parser_interface.c
68
 
===================================================================
69
 
--- apparmor-debian.orig/parser/parser_interface.c      2011-04-29 19:21:52.857411965 -0700
70
 
+++ apparmor-debian/parser/parser_interface.c   2011-04-29 19:22:06.377591485 -0700
71
 
@@ -28,7 +28,9 @@
72
 
 #include "libapparmor_re/apparmor_re.h"
73
 
 
74
 
 #include <unistd.h>
75
 
-#include <linux/unistd.h>
76
 
+#ifdef __linux__
77
 
+# include <linux/unistd.h>
78
 
+#endif
79
 
 
80
 
 /* only for x86 at the moment */
81
 
 #include <endian.h>
82
 
Index: apparmor-debian/parser/parser_merge.c
83
 
===================================================================
84
 
--- apparmor-debian.orig/parser/parser_merge.c  2011-04-29 19:21:52.877412231 -0700
85
 
+++ apparmor-debian/parser/parser_merge.c       2011-04-29 19:22:06.377591485 -0700
86
 
@@ -15,7 +15,9 @@
87
 
  *   along with this program; if not, contact Novell, Inc.
88
 
  */
89
 
 
90
 
-#include <linux/unistd.h>
91
 
+#ifdef __linux__
92
 
+# include <linux/unistd.h>
93
 
+#endif
94
 
 
95
 
 #include <stdio.h>
96
 
 #include <string.h>
97
 
Index: apparmor-debian/parser/parser_regex.c
98
 
===================================================================
99
 
--- apparmor-debian.orig/parser/parser_regex.c  2011-04-29 19:21:52.887412364 -0700
100
 
+++ apparmor-debian/parser/parser_regex.c       2011-04-29 19:22:06.377591485 -0700
101
 
@@ -19,8 +19,8 @@
102
 
 #include <stdlib.h>
103
 
 #include <stdarg.h>
104
 
 #include <string.h>
105
 
+#include <limits.h>
106
 
 #include <libintl.h>
107
 
-#include <linux/limits.h>
108
 
 #define _(s) gettext(s)
109
 
 
110
 
 /* #define DEBUG */
111
 
Index: apparmor-debian/parser/parser_symtab.c
112
 
===================================================================
113
 
--- apparmor-debian.orig/parser/parser_symtab.c 2011-04-29 19:21:52.867412098 -0700
114
 
+++ apparmor-debian/parser/parser_symtab.c      2011-04-29 19:22:06.377591485 -0700
115
 
@@ -20,8 +20,8 @@
116
 
 #include <stdarg.h>
117
 
 #include <string.h>
118
 
 #include <errno.h>
119
 
+#include <limits.h>
120
 
 #include <libintl.h>
121
 
-#include <linux/limits.h>
122
 
 #define _(s) gettext(s)
123
 
 
124
 
 #include "immunix.h"
125
 
Index: apparmor-debian/parser/parser_variable.c
126
 
===================================================================
127
 
--- apparmor-debian.orig/parser/parser_variable.c       2011-04-29 19:21:52.907412630 -0700
128
 
+++ apparmor-debian/parser/parser_variable.c    2011-04-29 19:22:06.377591485 -0700
129
 
@@ -20,9 +20,8 @@
130
 
 #include <stdio.h>
131
 
 #include <stdarg.h>
132
 
 #include <string.h>
133
 
+#include <limits.h>
134
 
 #include <libintl.h>
135
 
-#include <linux/limits.h>
136
 
-
137
 
 #define _(s) gettext(s)
138
 
 
139
 
 /* #define DEBUG */
140
 
Index: apparmor-debian/parser/Makefile
141
 
===================================================================
142
 
--- apparmor-debian.orig/parser/Makefile        2011-05-01 15:32:36.304227232 -0700
143
 
+++ apparmor-debian/parser/Makefile     2011-05-01 15:44:16.433596779 -0700
144
 
@@ -205,8 +205,8 @@
145
 
        LC_ALL=C sed -n -e "s/^\#define[ \\t]\\+PF_MAX[ \\t]\\+\\([0-9]\\+\\)[ \\t]\\+.*/#define AA_AF_MAX \\1\n/p" $< >> $@
146
 
        # cat $@
147
 
 
148
 
-cap_names.h: /usr/include/linux/capability.h
149
 
-       LC_ALL=C sed -n -e "/CAP_EMPTY_SET/d" -e "s/^\#define[ \\t]\\+CAP_\\([A-Z0-9_]\\+\\)[ \\t]\\+\\([0-9xa-f]\\+\\)\\(.*\\)\$$/\{\"\\L\\1\", \\UCAP_\\1\},/p" $< > $@
150
 
+cap_names.h: capabilities.h
151
 
+       LC_ALL=C $(CPP) -dM $< | sed -n -e "/CAP_EMPTY_SET/d" -e "s/^\#define[ \\t]\\+CAP_\\([A-Z0-9_]\\+\\)[ \\t]\\+\\([0-9xa-f]\\+\\)\\(.*\\)\$$/\{\"\\L\\1\", \\UCAP_\\1\},/p" > $@
152
 
 
153
 
 tst_symtab: parser_symtab.c parser.h parser_variable.o
154
 
        $(Q)$(CC) -DUNIT_TEST $(EXTRA_CFLAGS) $(TEST_FLAGS) -o $@ $< parser_variable.o $(BUILD_OUTPUT)
155
 
@@ -227,7 +227,9 @@
156
 
 .SILENT: tests
157
 
 tests: ${TESTS}
158
 
        sh -e -c 'for test in ${TESTS} ; do echo "*** running $${test}" && ./$${test} $(BUILD_OUTPUT) ; done'
159
 
+ifeq ($(SKIP_TST_DIR),1)
160
 
        $(Q)make -s -C tst tests
161
 
+endif
162
 
 
163
 
 .SILENT: check
164
 
 check: tests
165
 
Index: apparmor-debian/parser/capabilities.h
166
 
===================================================================
167
 
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
168
 
+++ apparmor-debian/parser/capabilities.h       2011-05-01 15:44:16.463597181 -0700
169
 
@@ -0,0 +1,3 @@
170
 
+#ifdef __linux__
171
 
+# include <linux/capability.h>
172
 
+#endif
173
 
Index: apparmor-debian/parser/parser_misc.c
174
 
===================================================================
175
 
--- apparmor-debian.orig/parser/parser_misc.c   2011-05-01 15:44:13.523557738 -0700
176
 
+++ apparmor-debian/parser/parser_misc.c        2011-05-01 15:44:16.463597181 -0700
177
 
@@ -25,10 +25,12 @@
178
 
 #include <libintl.h>
179
 
 #define _(s) gettext(s)
180
 
 #include <netinet/in.h>
181
 
-#include <linux/socket.h>
182
 
-#include <linux/limits.h>
183
 
+#include <sys/socket.h>
184
 
+#include <limits.h>
185
 
 #include <arpa/inet.h>
186
 
-#include <linux/capability.h>
187
 
+#ifdef __linux__
188
 
+# include <linux/capability.h>
189
 
+#endif
190
 
 #include <sys/types.h>
191
 
 #include <sys/stat.h>
192
 
 #include <fcntl.h>
193
 
@@ -91,13 +93,21 @@
194
 
        {"core",                RLIMIT_CORE},
195
 
        {"rss",                 RLIMIT_RSS},
196
 
        {"nofile",              RLIMIT_NOFILE},
197
 
+#ifdef RLIMIT_OFILE
198
 
        {"ofile",               RLIMIT_OFILE},
199
 
+#endif
200
 
        {"as",                  RLIMIT_AS},
201
 
        {"nproc",               RLIMIT_NPROC},
202
 
        {"memlock",             RLIMIT_MEMLOCK},
203
 
+#ifdef RLIMIT_LOCKS
204
 
        {"locks",               RLIMIT_LOCKS},
205
 
+#endif
206
 
+#ifdef RLIMIT_SIGPENDING
207
 
        {"sigpending",          RLIMIT_SIGPENDING},
208
 
+#endif
209
 
+#ifdef RLIMIT_MSGQUEUE
210
 
        {"msgqueue",            RLIMIT_MSGQUEUE},
211
 
+#endif
212
 
 #ifdef RLIMIT_NICE
213
 
        {"nice",                RLIMIT_NICE},
214
 
 #endif
215
 
@@ -173,6 +183,10 @@
216
 
 #define RAW_ICMP 1
217
 
 #define RAW_ICMPv6 58
218
 
 
219
 
+#ifndef SOCK_PACKET
220
 
+# define SOCK_PACKET 10
221
 
+#endif
222
 
+
223
 
 /* used by af_name.h to auto generate table entries for "name", AF_NAME
224
 
  * pair */
225
 
 #define AA_GEN_NET_ENT(name, AF) {name, AF, "stream", SOCK_STREAM, "", 0xffffff}, {name, AF, "dgram", SOCK_DGRAM, "", 0xffffff}, {name, AF, "seqpacket", SOCK_SEQPACKET, "", 0xffffff}, {name, AF, "rdm", SOCK_RDM, "", 0xffffff}, {name, AF, "raw", SOCK_RAW, "", 0xffffff}, {name, AF, "packet", SOCK_PACKET, "", 0xffffff},