|
|
6729ff |
From 22b7400498af7cecbdf608adb7f622b803b50471 Mon Sep 17 00:00:00 2001
|
|
|
6729ff |
From: Volker Lendecke <vl@samba.org>
|
|
|
6729ff |
Date: Tue, 3 Dec 2013 13:20:17 +0100
|
|
|
6729ff |
Subject: [PATCH 1/3] smbd: Fix regression for the dropbox case.
|
|
|
6729ff |
|
|
|
6729ff |
We need to allow to save a file to a directory with perm -wx.
|
|
|
6729ff |
|
|
|
6729ff |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297
|
|
|
6729ff |
|
|
|
6729ff |
Signed-off-by: Volker Lendecke <vl@samba.org>
|
|
|
6729ff |
Reviewed-by: Jeremy Allison <jra@samba.org>
|
|
|
6729ff |
Reviewed-by: Andreas Schneider <asn@samba.org>
|
|
|
6729ff |
(cherry picked from commit 5b49fe24c906cbae12beff7a1b45de6809258cab)
|
|
|
6729ff |
---
|
|
|
6729ff |
source3/smbd/filename.c | 10 +++++-----
|
|
|
6729ff |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
6729ff |
|
|
|
6729ff |
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
|
|
|
6729ff |
index fc96550..16d0df1 100644
|
|
|
6729ff |
--- a/source3/smbd/filename.c
|
|
|
6729ff |
+++ b/source3/smbd/filename.c
|
|
|
6729ff |
@@ -722,7 +722,10 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
|
|
|
6729ff |
*/
|
|
|
6729ff |
|
|
|
6729ff |
if (errno == EACCES) {
|
|
|
6729ff |
- if (ucf_flags & UCF_CREATING_FILE) {
|
|
|
6729ff |
+ if ((ucf_flags & UCF_CREATING_FILE) == 0) {
|
|
|
6729ff |
+ status = NT_STATUS_ACCESS_DENIED;
|
|
|
6729ff |
+ goto fail;
|
|
|
6729ff |
+ } else {
|
|
|
6729ff |
/*
|
|
|
6729ff |
* This is the dropbox
|
|
|
6729ff |
* behaviour. A dropbox is a
|
|
|
6729ff |
@@ -734,11 +737,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
|
|
|
6729ff |
* nevertheless want to allow
|
|
|
6729ff |
* users creating a file.
|
|
|
6729ff |
*/
|
|
|
6729ff |
- status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
|
|
|
6729ff |
- } else {
|
|
|
6729ff |
- status = NT_STATUS_ACCESS_DENIED;
|
|
|
6729ff |
+ errno = 0;
|
|
|
6729ff |
}
|
|
|
6729ff |
- goto fail;
|
|
|
6729ff |
}
|
|
|
6729ff |
|
|
|
6729ff |
if ((errno != 0) && (errno != ENOENT)) {
|
|
|
6729ff |
--
|
|
|
6729ff |
1.8.5.1
|
|
|
6729ff |
|
|
|
6729ff |
|
|
|
6729ff |
From e02e1bca121fa8dec84afa01132d450b6b2355b6 Mon Sep 17 00:00:00 2001
|
|
|
6729ff |
From: Jeremy Allison <jra@samba.org>
|
|
|
6729ff |
Date: Tue, 3 Dec 2013 10:19:09 -0800
|
|
|
6729ff |
Subject: [PATCH 2/3] smbd: change flag name from UCF_CREATING_FILE to
|
|
|
6729ff |
UCF_PREP_CREATEFILE
|
|
|
6729ff |
|
|
|
6729ff |
In preparation to using it for all open calls.
|
|
|
6729ff |
|
|
|
6729ff |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297
|
|
|
6729ff |
|
|
|
6729ff |
Signed-off-by: Jeremy Allison <jra@samba.org>
|
|
|
6729ff |
Reviewed-by: Volker Lendecke <vl@samba.org>
|
|
|
6729ff |
(cherry picked from commit 874318a97868e08837a1febb1be8e8a167b5ae0f)
|
|
|
6729ff |
---
|
|
|
6729ff |
source3/smbd/filename.c | 2 +-
|
|
|
6729ff |
source3/smbd/nttrans.c | 4 ++--
|
|
|
6729ff |
source3/smbd/reply.c | 10 +++++-----
|
|
|
6729ff |
source3/smbd/smb2_create.c | 2 +-
|
|
|
6729ff |
source3/smbd/smbd.h | 2 +-
|
|
|
6729ff |
5 files changed, 10 insertions(+), 10 deletions(-)
|
|
|
6729ff |
|
|
|
6729ff |
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
|
|
|
6729ff |
index 16d0df1..ba41986 100644
|
|
|
6729ff |
--- a/source3/smbd/filename.c
|
|
|
6729ff |
+++ b/source3/smbd/filename.c
|
|
|
6729ff |
@@ -722,7 +722,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
|
|
|
6729ff |
*/
|
|
|
6729ff |
|
|
|
6729ff |
if (errno == EACCES) {
|
|
|
6729ff |
- if ((ucf_flags & UCF_CREATING_FILE) == 0) {
|
|
|
6729ff |
+ if ((ucf_flags & UCF_PREP_CREATEFILE) == 0) {
|
|
|
6729ff |
status = NT_STATUS_ACCESS_DENIED;
|
|
|
6729ff |
goto fail;
|
|
|
6729ff |
} else {
|
|
|
6729ff |
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
|
|
|
6729ff |
index b7dfa8c..15fa4b6 100644
|
|
|
6729ff |
--- a/source3/smbd/nttrans.c
|
|
|
6729ff |
+++ b/source3/smbd/nttrans.c
|
|
|
6729ff |
@@ -539,7 +539,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
(create_disposition == FILE_CREATE)
|
|
|
6729ff |
- ? UCF_CREATING_FILE : 0,
|
|
|
6729ff |
+ ? UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
|
|
|
6729ff |
@@ -1119,7 +1119,7 @@ static void call_nt_transact_create(connection_struct *conn,
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
(create_disposition == FILE_CREATE)
|
|
|
6729ff |
- ? UCF_CREATING_FILE : 0,
|
|
|
6729ff |
+ ? UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
|
|
|
6729ff |
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
|
|
|
6729ff |
index 2d729ec..2c9749e 100644
|
|
|
6729ff |
--- a/source3/smbd/reply.c
|
|
|
6729ff |
+++ b/source3/smbd/reply.c
|
|
|
6729ff |
@@ -1918,7 +1918,7 @@ void reply_open(struct smb_request *req)
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
(create_disposition == FILE_CREATE)
|
|
|
6729ff |
- ? UCF_CREATING_FILE : 0,
|
|
|
6729ff |
+ ? UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
@@ -2096,7 +2096,7 @@ void reply_open_and_X(struct smb_request *req)
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
(create_disposition == FILE_CREATE)
|
|
|
6729ff |
- ? UCF_CREATING_FILE : 0,
|
|
|
6729ff |
+ ? UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
@@ -2329,7 +2329,7 @@ void reply_mknew(struct smb_request *req)
|
|
|
6729ff |
conn,
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
- UCF_CREATING_FILE,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
@@ -2470,7 +2470,7 @@ void reply_ctemp(struct smb_request *req)
|
|
|
6729ff |
status = filename_convert(ctx, conn,
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
- UCF_CREATING_FILE,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
@@ -5829,7 +5829,7 @@ void reply_mkdir(struct smb_request *req)
|
|
|
6729ff |
status = filename_convert(ctx, conn,
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
directory,
|
|
|
6729ff |
- UCF_CREATING_FILE,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_dname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
|
|
|
6729ff |
index c4d4991..f637dac 100644
|
|
|
6729ff |
--- a/source3/smbd/smb2_create.c
|
|
|
6729ff |
+++ b/source3/smbd/smb2_create.c
|
|
|
6729ff |
@@ -872,7 +872,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
|
|
|
6729ff |
smb1req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
(in_create_disposition == FILE_CREATE) ?
|
|
|
6729ff |
- UCF_CREATING_FILE : 0,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
NULL, /* ppath_contains_wcards */
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
diff --git a/source3/smbd/smbd.h b/source3/smbd/smbd.h
|
|
|
6729ff |
index e769157..5cf88bf 100644
|
|
|
6729ff |
--- a/source3/smbd/smbd.h
|
|
|
6729ff |
+++ b/source3/smbd/smbd.h
|
|
|
6729ff |
@@ -73,6 +73,6 @@ struct trans_state {
|
|
|
6729ff |
#define UCF_COND_ALLOW_WCARD_LCOMP 0x00000004
|
|
|
6729ff |
#define UCF_POSIX_PATHNAMES 0x00000008
|
|
|
6729ff |
#define UCF_UNIX_NAME_LOOKUP 0x00000010
|
|
|
6729ff |
-#define UCF_CREATING_FILE 0x00000020
|
|
|
6729ff |
+#define UCF_PREP_CREATEFILE 0x00000020
|
|
|
6729ff |
|
|
|
6729ff |
#endif /* _SMBD_SMBD_H */
|
|
|
6729ff |
--
|
|
|
6729ff |
1.8.5.1
|
|
|
6729ff |
|
|
|
6729ff |
|
|
|
6729ff |
From e7abcfae4fbbf4d6fe56e5a1a4d76ffe4e9677d9 Mon Sep 17 00:00:00 2001
|
|
|
6729ff |
From: Jeremy Allison <jra@samba.org>
|
|
|
6729ff |
Date: Tue, 3 Dec 2013 10:21:16 -0800
|
|
|
6729ff |
Subject: [PATCH 3/3] smbd: Always use UCF_PREP_CREATEFILE for filename_convert
|
|
|
6729ff |
calls to resolve a path for open.
|
|
|
6729ff |
|
|
|
6729ff |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10297
|
|
|
6729ff |
|
|
|
6729ff |
Signed-off-by: Jeremy Allison <jra@samba.org>
|
|
|
6729ff |
Reviewed-by: Volker Lendecke <vl@samba.org>
|
|
|
6729ff |
|
|
|
6729ff |
Autobuild-User(master): Jeremy Allison <jra@samba.org>
|
|
|
6729ff |
Autobuild-Date(master): Mon Dec 9 21:02:21 CET 2013 on sn-devel-104
|
|
|
6729ff |
|
|
|
6729ff |
(cherry picked from commit f98d10af2a05f0261611f4cabdfe274cd9fe91c0)
|
|
|
6729ff |
---
|
|
|
6729ff |
source3/smbd/nttrans.c | 6 ++----
|
|
|
6729ff |
source3/smbd/reply.c | 6 ++----
|
|
|
6729ff |
source3/smbd/smb2_create.c | 3 +--
|
|
|
6729ff |
3 files changed, 5 insertions(+), 10 deletions(-)
|
|
|
6729ff |
|
|
|
6729ff |
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
|
|
|
6729ff |
index 15fa4b6..0d3cd07 100644
|
|
|
6729ff |
--- a/source3/smbd/nttrans.c
|
|
|
6729ff |
+++ b/source3/smbd/nttrans.c
|
|
|
6729ff |
@@ -538,8 +538,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
|
|
|
6729ff |
conn,
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
- (create_disposition == FILE_CREATE)
|
|
|
6729ff |
- ? UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
|
|
|
6729ff |
@@ -1118,8 +1117,7 @@ static void call_nt_transact_create(connection_struct *conn,
|
|
|
6729ff |
conn,
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
- (create_disposition == FILE_CREATE)
|
|
|
6729ff |
- ? UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
|
|
|
6729ff |
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
|
|
|
6729ff |
index 2c9749e..f293b69 100644
|
|
|
6729ff |
--- a/source3/smbd/reply.c
|
|
|
6729ff |
+++ b/source3/smbd/reply.c
|
|
|
6729ff |
@@ -1917,8 +1917,7 @@ void reply_open(struct smb_request *req)
|
|
|
6729ff |
conn,
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
- (create_disposition == FILE_CREATE)
|
|
|
6729ff |
- ? UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
@@ -2095,8 +2094,7 @@ void reply_open_and_X(struct smb_request *req)
|
|
|
6729ff |
conn,
|
|
|
6729ff |
req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
- (create_disposition == FILE_CREATE)
|
|
|
6729ff |
- ? UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE,
|
|
|
6729ff |
NULL,
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
|
|
|
6729ff |
index f637dac..6730ad6 100644
|
|
|
6729ff |
--- a/source3/smbd/smb2_create.c
|
|
|
6729ff |
+++ b/source3/smbd/smb2_create.c
|
|
|
6729ff |
@@ -871,8 +871,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
|
|
|
6729ff |
smb1req->conn,
|
|
|
6729ff |
smb1req->flags2 & FLAGS2_DFS_PATHNAMES,
|
|
|
6729ff |
fname,
|
|
|
6729ff |
- (in_create_disposition == FILE_CREATE) ?
|
|
|
6729ff |
- UCF_PREP_CREATEFILE : 0,
|
|
|
6729ff |
+ UCF_PREP_CREATEFILE,
|
|
|
6729ff |
NULL, /* ppath_contains_wcards */
|
|
|
6729ff |
&smb_fname);
|
|
|
6729ff |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
6729ff |
--
|
|
|
6729ff |
1.8.5.1
|