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.
6 We need to allow to save a file to a directory with perm -wx.
8 BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297
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)
15 source3/smbd/filename.c | 10 +++++-----
16 1 file changed, 5 insertions(+), 5 deletions(-)
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,
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;
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.
38 - status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
40 - status = NT_STATUS_ACCESS_DENIED;
46 if ((errno != 0) && (errno != ENOENT)) {
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
57 In preparation to using it for all open calls.
59 BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297
61 Signed-off-by: Jeremy Allison <jra@samba.org>
62 Reviewed-by: Volker Lendecke <vl@samba.org>
63 (cherry picked from commit 874318a97868e08837a1febb1be8e8a167b5ae0f)
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(-)
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
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,
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;
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,
105 (create_disposition == FILE_CREATE)
106 - ? UCF_CREATING_FILE : 0,
107 + ? UCF_PREP_CREATEFILE : 0,
111 @@ -1167,7 +1167,7 @@ static void call_nt_transact_create(connection_struct *conn,
112 req->flags2 & FLAGS2_DFS_PATHNAMES,
114 (create_disposition == FILE_CREATE)
115 - ? UCF_CREATING_FILE : 0,
116 + ? UCF_PREP_CREATEFILE : 0,
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,
127 (create_disposition == FILE_CREATE)
128 - ? UCF_CREATING_FILE : 0,
129 + ? UCF_PREP_CREATEFILE : 0,
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,
136 (create_disposition == FILE_CREATE)
137 - ? UCF_CREATING_FILE : 0,
138 + ? UCF_PREP_CREATEFILE : 0,
141 if (!NT_STATUS_IS_OK(status)) {
142 @@ -2147,7 +2147,7 @@ void reply_mknew(struct smb_request *req)
144 req->flags2 & FLAGS2_DFS_PATHNAMES,
147 + UCF_PREP_CREATEFILE,
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,
156 + UCF_PREP_CREATEFILE,
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,
165 + UCF_PREP_CREATEFILE,
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,
176 (in_create_disposition == FILE_CREATE) ?
177 - UCF_CREATING_FILE : 0,
178 + UCF_PREP_CREATEFILE : 0,
181 if (!NT_STATUS_IS_OK(status)) {
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.
192 BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297
194 Signed-off-by: Jeremy Allison <jra@samba.org>
195 Reviewed-by: Volker Lendecke <vl@samba.org>
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
200 (cherry picked from commit f98d10af2a05f0261611f4cabdfe274cd9fe91c0)
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(-)
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)
213 req->flags2 & FLAGS2_DFS_PATHNAMES,
215 - (create_disposition == FILE_CREATE)
216 - ? UCF_PREP_CREATEFILE : 0,
217 + UCF_PREP_CREATEFILE,
221 @@ -1166,8 +1165,7 @@ static void call_nt_transact_create(connection_struct *conn,
223 req->flags2 & FLAGS2_DFS_PATHNAMES,
225 - (create_disposition == FILE_CREATE)
226 - ? UCF_PREP_CREATEFILE : 0,
227 + UCF_PREP_CREATEFILE,
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)
237 req->flags2 & FLAGS2_DFS_PATHNAMES,
239 - (create_disposition == FILE_CREATE)
240 - ? UCF_PREP_CREATEFILE : 0,
241 + UCF_PREP_CREATEFILE,
244 if (!NT_STATUS_IS_OK(status)) {
245 @@ -1938,8 +1937,7 @@ void reply_open_and_X(struct smb_request *req)
247 req->flags2 & FLAGS2_DFS_PATHNAMES,
249 - (create_disposition == FILE_CREATE)
250 - ? UCF_PREP_CREATEFILE : 0,
251 + UCF_PREP_CREATEFILE,
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,
261 smb1req->flags2 & FLAGS2_DFS_PATHNAMES,
263 - (in_create_disposition == FILE_CREATE) ?
264 - UCF_PREP_CREATEFILE : 0,
265 + UCF_PREP_CREATEFILE,
268 if (!NT_STATUS_IS_OK(status)) {