]>
Commit | Line | Data |
---|---|---|
1d13e637 AF |
1 | From 8f286450a223d002358f6dfe81b770fee86c3c85 Mon Sep 17 00:00:00 2001 |
2 | From: Volker Lendecke <vl@samba.org> | |
3 | Date: Tue, 3 Dec 2013 13:20:17 +0100 | |
4 | Subject: [PATCH 1/3] PATCHSET15: smbd: Fix regression for the dropbox case. | |
5 | ||
6 | We need to allow to save a file to a directory with perm -wx. | |
7 | ||
8 | BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297 | |
9 | ||
10 | Signed-off-by: Volker Lendecke <vl@samba.org> | |
11 | Reviewed-by: Jeremy Allison <jra@samba.org> | |
12 | Reviewed-by: Andreas Schneider <asn@samba.org> | |
13 | (cherry picked from commit 5b49fe24c906cbae12beff7a1b45de6809258cab) | |
14 | --- | |
15 | source3/smbd/filename.c | 10 +++++----- | |
16 | 1 file changed, 5 insertions(+), 5 deletions(-) | |
17 | ||
18 | diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c | |
19 | index 8ef0c0a..ca19369 100644 | |
20 | --- a/source3/smbd/filename.c | |
21 | +++ b/source3/smbd/filename.c | |
22 | @@ -716,7 +716,10 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, | |
23 | * here. | |
24 | */ | |
25 | if (errno == EACCES) { | |
26 | - if (ucf_flags & UCF_CREATING_FILE) { | |
27 | + if ((ucf_flags & UCF_CREATING_FILE) == 0) { | |
28 | + status = NT_STATUS_ACCESS_DENIED; | |
29 | + goto fail; | |
30 | + } else { | |
31 | /* | |
32 | * This is the dropbox | |
33 | * behaviour. A dropbox is a | |
34 | @@ -728,11 +731,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, | |
35 | * nevertheless want to allow | |
36 | * users creating a file. | |
37 | */ | |
38 | - status = NT_STATUS_OBJECT_PATH_NOT_FOUND; | |
39 | - } else { | |
40 | - status = NT_STATUS_ACCESS_DENIED; | |
41 | + errno = 0; | |
42 | } | |
43 | - goto fail; | |
44 | } | |
45 | ||
46 | if ((errno != 0) && (errno != ENOENT)) { | |
47 | -- | |
48 | 1.9.3 | |
49 | ||
50 | ||
51 | From 38674e8f208a7e8f2ead72266292f30b7ea33c87 Mon Sep 17 00:00:00 2001 | |
52 | From: Jeremy Allison <jra@samba.org> | |
53 | Date: Tue, 3 Dec 2013 10:19:09 -0800 | |
54 | Subject: [PATCH 2/3] PATCHSET15: smbd: change flag name from UCF_CREATING_FILE | |
55 | to UCF_PREP_CREATEFILE | |
56 | ||
57 | In preparation to using it for all open calls. | |
58 | ||
59 | BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297 | |
60 | ||
61 | Signed-off-by: Jeremy Allison <jra@samba.org> | |
62 | Reviewed-by: Volker Lendecke <vl@samba.org> | |
63 | (cherry picked from commit 874318a97868e08837a1febb1be8e8a167b5ae0f) | |
64 | --- | |
65 | source3/include/smb.h | 2 +- | |
66 | source3/smbd/filename.c | 2 +- | |
67 | source3/smbd/nttrans.c | 4 ++-- | |
68 | source3/smbd/reply.c | 10 +++++----- | |
69 | source3/smbd/smb2_create.c | 2 +- | |
70 | 5 files changed, 10 insertions(+), 10 deletions(-) | |
71 | ||
72 | diff --git a/source3/include/smb.h b/source3/include/smb.h | |
73 | index 2d04373..559e061 100644 | |
74 | --- a/source3/include/smb.h | |
75 | +++ b/source3/include/smb.h | |
76 | @@ -1716,7 +1716,7 @@ struct smb_file_time { | |
77 | #define UCF_COND_ALLOW_WCARD_LCOMP 0x00000004 | |
78 | #define UCF_POSIX_PATHNAMES 0x00000008 | |
79 | #define UCF_UNIX_NAME_LOOKUP 0x00000010 | |
80 | -#define UCF_CREATING_FILE 0x00000020 | |
81 | +#define UCF_PREP_CREATEFILE 0x00000020 | |
82 | ||
83 | /* | |
84 | * smb_filename | |
85 | diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c | |
86 | index ca19369..2e68e52 100644 | |
87 | --- a/source3/smbd/filename.c | |
88 | +++ b/source3/smbd/filename.c | |
89 | @@ -716,7 +716,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, | |
90 | * here. | |
91 | */ | |
92 | if (errno == EACCES) { | |
93 | - if ((ucf_flags & UCF_CREATING_FILE) == 0) { | |
94 | + if ((ucf_flags & UCF_PREP_CREATEFILE) == 0) { | |
95 | status = NT_STATUS_ACCESS_DENIED; | |
96 | goto fail; | |
97 | } else { | |
98 | diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c | |
99 | index 4c145e0..f5da720 100644 | |
100 | --- a/source3/smbd/nttrans.c | |
101 | +++ b/source3/smbd/nttrans.c | |
102 | @@ -537,7 +537,7 @@ void reply_ntcreate_and_X(struct smb_request *req) | |
103 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
104 | fname, | |
105 | (create_disposition == FILE_CREATE) | |
106 | - ? UCF_CREATING_FILE : 0, | |
107 | + ? UCF_PREP_CREATEFILE : 0, | |
108 | NULL, | |
109 | &smb_fname); | |
110 | ||
111 | @@ -1167,7 +1167,7 @@ static void call_nt_transact_create(connection_struct *conn, | |
112 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
113 | fname, | |
114 | (create_disposition == FILE_CREATE) | |
115 | - ? UCF_CREATING_FILE : 0, | |
116 | + ? UCF_PREP_CREATEFILE : 0, | |
117 | NULL, | |
118 | &smb_fname); | |
119 | ||
120 | diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c | |
121 | index 0585a6e..8478031 100644 | |
122 | --- a/source3/smbd/reply.c | |
123 | +++ b/source3/smbd/reply.c | |
124 | @@ -1761,7 +1761,7 @@ void reply_open(struct smb_request *req) | |
125 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
126 | fname, | |
127 | (create_disposition == FILE_CREATE) | |
128 | - ? UCF_CREATING_FILE : 0, | |
129 | + ? UCF_PREP_CREATEFILE : 0, | |
130 | NULL, | |
131 | &smb_fname); | |
132 | if (!NT_STATUS_IS_OK(status)) { | |
133 | @@ -1939,7 +1939,7 @@ void reply_open_and_X(struct smb_request *req) | |
134 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
135 | fname, | |
136 | (create_disposition == FILE_CREATE) | |
137 | - ? UCF_CREATING_FILE : 0, | |
138 | + ? UCF_PREP_CREATEFILE : 0, | |
139 | NULL, | |
140 | &smb_fname); | |
141 | if (!NT_STATUS_IS_OK(status)) { | |
142 | @@ -2147,7 +2147,7 @@ void reply_mknew(struct smb_request *req) | |
143 | conn, | |
144 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
145 | fname, | |
146 | - UCF_CREATING_FILE, | |
147 | + UCF_PREP_CREATEFILE, | |
148 | NULL, | |
149 | &smb_fname); | |
150 | if (!NT_STATUS_IS_OK(status)) { | |
151 | @@ -2288,7 +2288,7 @@ void reply_ctemp(struct smb_request *req) | |
152 | status = filename_convert(ctx, conn, | |
153 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
154 | fname, | |
155 | - UCF_CREATING_FILE, | |
156 | + UCF_PREP_CREATEFILE, | |
157 | NULL, | |
158 | &smb_fname); | |
159 | if (!NT_STATUS_IS_OK(status)) { | |
160 | @@ -5541,7 +5541,7 @@ void reply_mkdir(struct smb_request *req) | |
161 | status = filename_convert(ctx, conn, | |
162 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
163 | directory, | |
164 | - UCF_CREATING_FILE, | |
165 | + UCF_PREP_CREATEFILE, | |
166 | NULL, | |
167 | &smb_dname); | |
168 | if (!NT_STATUS_IS_OK(status)) { | |
169 | diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c | |
170 | index 0862990..cd15852 100644 | |
171 | --- a/source3/smbd/smb2_create.c | |
172 | +++ b/source3/smbd/smb2_create.c | |
173 | @@ -695,7 +695,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, | |
174 | smb1req->flags2 & FLAGS2_DFS_PATHNAMES, | |
175 | fname, | |
176 | (in_create_disposition == FILE_CREATE) ? | |
177 | - UCF_CREATING_FILE : 0, | |
178 | + UCF_PREP_CREATEFILE : 0, | |
179 | NULL, | |
180 | &smb_fname); | |
181 | if (!NT_STATUS_IS_OK(status)) { | |
182 | -- | |
183 | 1.9.3 | |
184 | ||
185 | ||
186 | From d3fb56a7239ef4173ff13f2fec2beb44402dee6b Mon Sep 17 00:00:00 2001 | |
187 | From: Jeremy Allison <jra@samba.org> | |
188 | Date: Tue, 3 Dec 2013 10:21:16 -0800 | |
189 | Subject: [PATCH 3/3] PATCHSET15: smbd: Always use UCF_PREP_CREATEFILE for | |
190 | filename_convert calls to resolve a path for open. | |
191 | ||
192 | BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297 | |
193 | ||
194 | Signed-off-by: Jeremy Allison <jra@samba.org> | |
195 | Reviewed-by: Volker Lendecke <vl@samba.org> | |
196 | ||
197 | Autobuild-User(master): Jeremy Allison <jra@samba.org> | |
198 | Autobuild-Date(master): Mon Dec 9 21:02:21 CET 2013 on sn-devel-104 | |
199 | ||
200 | (cherry picked from commit f98d10af2a05f0261611f4cabdfe274cd9fe91c0) | |
201 | --- | |
202 | source3/smbd/nttrans.c | 6 ++---- | |
203 | source3/smbd/reply.c | 6 ++---- | |
204 | source3/smbd/smb2_create.c | 3 +-- | |
205 | 3 files changed, 5 insertions(+), 10 deletions(-) | |
206 | ||
207 | diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c | |
208 | index f5da720..f7d9b9d 100644 | |
209 | --- a/source3/smbd/nttrans.c | |
210 | +++ b/source3/smbd/nttrans.c | |
211 | @@ -536,8 +536,7 @@ void reply_ntcreate_and_X(struct smb_request *req) | |
212 | conn, | |
213 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
214 | fname, | |
215 | - (create_disposition == FILE_CREATE) | |
216 | - ? UCF_PREP_CREATEFILE : 0, | |
217 | + UCF_PREP_CREATEFILE, | |
218 | NULL, | |
219 | &smb_fname); | |
220 | ||
221 | @@ -1166,8 +1165,7 @@ static void call_nt_transact_create(connection_struct *conn, | |
222 | conn, | |
223 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
224 | fname, | |
225 | - (create_disposition == FILE_CREATE) | |
226 | - ? UCF_PREP_CREATEFILE : 0, | |
227 | + UCF_PREP_CREATEFILE, | |
228 | NULL, | |
229 | &smb_fname); | |
230 | ||
231 | diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c | |
232 | index 8478031..1583c23 100644 | |
233 | --- a/source3/smbd/reply.c | |
234 | +++ b/source3/smbd/reply.c | |
235 | @@ -1760,8 +1760,7 @@ void reply_open(struct smb_request *req) | |
236 | conn, | |
237 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
238 | fname, | |
239 | - (create_disposition == FILE_CREATE) | |
240 | - ? UCF_PREP_CREATEFILE : 0, | |
241 | + UCF_PREP_CREATEFILE, | |
242 | NULL, | |
243 | &smb_fname); | |
244 | if (!NT_STATUS_IS_OK(status)) { | |
245 | @@ -1938,8 +1937,7 @@ void reply_open_and_X(struct smb_request *req) | |
246 | conn, | |
247 | req->flags2 & FLAGS2_DFS_PATHNAMES, | |
248 | fname, | |
249 | - (create_disposition == FILE_CREATE) | |
250 | - ? UCF_PREP_CREATEFILE : 0, | |
251 | + UCF_PREP_CREATEFILE, | |
252 | NULL, | |
253 | &smb_fname); | |
254 | if (!NT_STATUS_IS_OK(status)) { | |
255 | diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c | |
256 | index cd15852..d0cda33 100644 | |
257 | --- a/source3/smbd/smb2_create.c | |
258 | +++ b/source3/smbd/smb2_create.c | |
259 | @@ -694,8 +694,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, | |
260 | smb1req->conn, | |
261 | smb1req->flags2 & FLAGS2_DFS_PATHNAMES, | |
262 | fname, | |
263 | - (in_create_disposition == FILE_CREATE) ? | |
264 | - UCF_PREP_CREATEFILE : 0, | |
265 | + UCF_PREP_CREATEFILE, | |
266 | NULL, | |
267 | &smb_fname); | |
268 | if (!NT_STATUS_IS_OK(status)) { | |
269 | -- | |
270 | 1.9.3 | |
271 |