summaryrefslogtreecommitdiff
path: root/debian/patches/dyson-acl.patch
blob: 2f7a961d2f75d2328d0d28d50588837ffc1f461b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
Description: support for illumos (solaris) ACLs
 This patch makes GNU coreutils shut up and stops GNU sed
 making files with 0000 permissions.
Bug-Dyson: http://osdyson.org/issues/167
Author: Igor Pashev <pashev.igor@gmail.com>

Index: fakeroot.git/libfakeroot.c
===================================================================
--- fakeroot.git.orig/libfakeroot.c
+++ fakeroot.git/libfakeroot.c
@@ -1922,6 +1922,9 @@ int fakeroot_isdisabled(void)
 }

 #ifdef HAVE_ACL_T
+
+/* linux: */
+#ifdef HAVE_ACL_GET_FD
 acl_t acl_get_fd(int fd) {
   errno = ENOTSUP;
   return (acl_t)NULL;
@@ -1934,12 +1937,51 @@ int acl_set_fd(int fd, acl_t acl) {
   errno = ENOTSUP;
   return -1;
 }
-
 int acl_set_file(const char *path_p, acl_type_t type, acl_t acl) {
   errno = ENOTSUP;
   return -1;
 }
-#endif /* HAVE_SYS_ACL_H */
+#endif /* HAVE_ACL_GET_FD */
+
+/* illumos: */
+#ifdef HAVE_ACL_TRIVIAL
+int acl_get(const char *path, int flags, acl_t **aclp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int facl_get(int fd, int flags, acl_t **aclp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int acl_set(const char *path, acl_t *aclp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int facl_set(int fd, acl_t *aclp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int acl_trivial(const char *path)
+{
+    return 0;
+}
+int acl(const char *path, int cmd, int cnt, void *buf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int facl(int fd, int cmd, int cnt, void *buf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+#endif /* HAVE_ACL_TRIVIAL */
+
+#endif /* HAVE_ACL_T */

 #ifdef HAVE_FTS_READ
 FTSENT *fts_read(FTS *ftsp) {
Index: fakeroot.git/configure.ac
===================================================================
--- fakeroot.git.orig/configure.ac
+++ fakeroot.git/configure.ac
@@ -288,6 +288,16 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[

 AC_CHECK_FUNCS(fchmodat fchownat fstatat mkdirat mknodat openat renameat unlinkat lchmod fgetattrlist)

+save_LIBS="$LIBS"
+# Linux
+AC_SEARCH_LIBS(acl_get_fd, acl)
+AC_CHECK_FUNCS(acl_get_fd)
+
+# Illumos
+AC_SEARCH_LIBS(acl_trivial, sec)
+AC_CHECK_FUNCS(acl_trivial)
+LIBS="$save_LIBS"
+
 AC_CHECK_FUNCS(capset listxattr llistxattr flistxattr getxattr lgetxattr fgetxattr setxattr lsetxattr fsetxattr removexattr lremovexattr fremovexattr)

 dnl find out how stat() etc are called. On linux systems, we really
Index: fakeroot.git/wrapfunc.inp
===================================================================
--- fakeroot.git.orig/wrapfunc.inp
+++ fakeroot.git/wrapfunc.inp
@@ -208,10 +208,24 @@ unlinkat;int;(int dir_fd, const char *pa
 #endif /* HAVE_FSTATAT */

 #ifdef HAVE_ACL_T
+
+#ifdef HAVE_ACL_GET_FD
 acl_get_fd;acl_t;(int fd);(fd)
 acl_get_file;acl_t;(const char *path_p, acl_type_t type);(path_p, type)
 acl_set_fd;int;(int fd, acl_t acl);(fd, acl)
 acl_set_file;int;(const char *path_p, acl_type_t type, acl_t acl);(path_p, type, acl)
+#endif
+
+#ifdef HAVE_ACL_TRIVIAL
+acl_get;int;(const char *path, int flags, acl_t **aclp);(path, flags, aclp)
+facl_get;int;(int fd, int flags, acl_t **aclp);(fd, flags, aclp)
+acl_set;int;(const char *path, acl_t *aclp);(path, aclp)
+facl_set;int;(int fd, acl_t *aclp);(fd, aclp)
+acl_trivial;int;(const char *path);(path)
+acl;int;(const char *path, int cmd, int cnt, void *buf);(path, cmd, cnt, buf)
+facl;int;(int fd, int cmd, int cnt, void *buf);(fd, cmd, cnt, buf)
+#endif
+
 #endif /* HAVE_ACL_T */

 #ifdef HAVE_FTS_READ
Index: fakeroot.git/wrapstruct.h
===================================================================
--- fakeroot.git.orig/wrapstruct.h
+++ fakeroot.git/wrapstruct.h
@@ -185,10 +185,24 @@ struct next_wrap_st next_wrap[]= {
 #endif /* HAVE_FSTATAT */

 #ifdef HAVE_ACL_T
+
+#ifdef HAVE_ACL_GET_FD
   {(void(*))&next_acl_get_fd, "acl_get_fd"},
   {(void(*))&next_acl_get_file, "acl_get_file"},
   {(void(*))&next_acl_set_fd, "acl_set_fd"},
   {(void(*))&next_acl_set_file, "acl_set_file"},
+#endif
+
+#ifdef HAVE_ACL_TRIVIAL
+  {(void(*))&next_acl_get, "acl_get"},
+  {(void(*))&next_facl_get, "facl_get"},
+  {(void(*))&next_acl_set, "acl_set"},
+  {(void(*))&next_facl_set, "facl_set"},
+  {(void(*))&next_acl_trivial, "acl_trivial"},
+  {(void(*))&next_acl, "acl"},
+  {(void(*))&next_facl, "facl"},
+#endif
+
 #endif /* HAVE_ACL_T */

 #ifdef HAVE_FTS_READ
Index: fakeroot.git/wrapdef.h
===================================================================
--- fakeroot-1.24.orig/wrapdef.h
+++ fakeroot-1.24/wrapdef.h
@@ -184,10 +184,24 @@ int (*next_unlinkat)(int dir_fd, const c
 #endif /* HAVE_FSTATAT */

 #ifdef HAVE_ACL_T
+
+#ifdef HAVE_ACL_GET_FD
 acl_t (*next_acl_get_fd)(int fd)=tmp_acl_get_fd;
 acl_t (*next_acl_get_file)(const char *path_p, acl_type_t type)=tmp_acl_get_file;
 int (*next_acl_set_fd)(int fd, acl_t acl)=tmp_acl_set_fd;
 int (*next_acl_set_file)(const char *path_p, acl_type_t type, acl_t acl)=tmp_acl_set_file;
+#endif
+
+#ifdef HAVE_ACL_TRIVIAL
+int (*next_acl_get)(const char *path, int flags, acl_t **aclp)=tmp_acl_get;
+int (*next_facl_get)(int fd, int flags, acl_t **aclp)=tmp_facl_get;
+int (*next_acl_set)(const char *path, acl_t *aclp)=tmp_acl_set;
+int (*next_facl_set)(int fd, acl_t *aclp)=tmp_facl_set;
+int (*next_acl_trivial)(const char *path)=tmp_acl_trivial;
+int (*next_acl)(const char *path, int cmd, int cnt, void *buf)=tmp_acl;
+int (*next_facl)(int fd, int cmd, int cnt, void *buf)=tmp_facl;
+#endif
+
 #endif /* HAVE_ACL_T */

 #ifdef HAVE_FTS_READ