[PATCH] more lp_posix_pathnames() cleanup.
Jeremy Allison
jra at samba.org
Tue Dec 22 19:43:46 UTC 2015
This patch should make no change in smbd (it's
cleanup preparatory work for SMB2 unix extensions).
It's merely moving the use of lp_posix_pathnames()
out into the SMB1/SMB2 request parsing code, so
that it can be removed from source3/smbd/filename.c
in the final patch of this set.
Please review and push if happy.
Cheers,
Jeremy.
-------------- next part --------------
From 41f0aa9d83e0bc980e7e12a084484a76dce32637 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 10:49:08 -0800
Subject: [PATCH 01/15] s3: smbd: Use ucf_flags variable instead of passing as
parameter.
This will allow us to move lp_posix_pathnames() out of unix_convert()
later.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/nttrans.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 098d88b..a9ab0dc 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -461,6 +461,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
int oplock_request;
uint8_t oplock_granted = NO_OPLOCK_RETURN;
struct case_semantics_state *case_state = NULL;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBntcreateX);
@@ -538,7 +539,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- UCF_PREP_CREATEFILE,
+ ucf_flags,
NULL,
&smb_fname);
@@ -1000,6 +1001,7 @@ static void call_nt_transact_create(connection_struct *conn,
int oplock_request;
uint8_t oplock_granted;
struct case_semantics_state *case_state = NULL;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
TALLOC_CTX *ctx = talloc_tos();
DEBUG(5,("call_nt_transact_create\n"));
@@ -1068,7 +1070,7 @@ static void call_nt_transact_create(connection_struct *conn,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- UCF_PREP_CREATEFILE,
+ ucf_flags,
NULL,
&smb_fname);
--
2.6.0.rc2.230.g3dd15c0
From d8c33a5b10743e401a9a8c2d8b7f35d06b516a22 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 10:51:35 -0800
Subject: [PATCH 02/15] s3: smbd: In open.c Use ucf_flags variable instead of
passing as parameter.
This will allow us to move lp_posix_pathnames() out of unix_convert()
later.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/open.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 4053089..a732a47 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -4828,6 +4828,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
files_struct *dir_fsp;
char *parent_fname = NULL;
char *new_base_name = NULL;
+ uint32_t ucf_flags = 0;
NTSTATUS status;
if (root_dir_fid == 0 || !smb_fname) {
@@ -4922,7 +4923,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
new_base_name,
- 0,
+ ucf_flags,
NULL,
smb_fname_out);
if (!NT_STATUS_IS_OK(status)) {
--
2.6.0.rc2.230.g3dd15c0
From ccb89e0a57b8091a361f6150309f7784a4e81087 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 10:58:44 -0800
Subject: [PATCH 03/15] s3: smbd: In reply.c Use ucf_flags variable instead of
passing as parameter.
This will allow us to move lp_posix_pathnames() out of unix_convert()
later.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 39 ++++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 9234978..269c889 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1165,6 +1165,7 @@ void reply_checkpath(struct smb_request *req)
struct smb_filename *smb_fname = NULL;
char *name = NULL;
NTSTATUS status;
+ uint32_t ucf_flags = 0;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcheckpath);
@@ -1185,7 +1186,7 @@ void reply_checkpath(struct smb_request *req)
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
name,
- 0,
+ ucf_flags,
NULL,
&smb_fname);
@@ -1279,11 +1280,12 @@ void reply_getatr(struct smb_request *req)
size = 0;
mtime = 0;
} else {
+ uint32_t ucf_flags = 0;
status = filename_convert(ctx,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- 0,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
@@ -1364,6 +1366,7 @@ void reply_setatr(struct smb_request *req)
time_t mtime;
const char *p;
NTSTATUS status;
+ uint32_t ucf_flags = 0;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBsetatr);
@@ -1386,7 +1389,7 @@ void reply_setatr(struct smb_request *req)
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- 0,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
@@ -1668,10 +1671,11 @@ void reply_search(struct smb_request *req)
/* dirtype &= ~FILE_ATTRIBUTE_DIRECTORY; */
if (status_len == 0) {
+ uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP;
nt_status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
path,
- UCF_ALWAYS_ALLOW_WCARD_LCOMP,
+ ucf_flags,
&mask_contains_wcard,
&smb_fname);
if (!NT_STATUS_IS_OK(nt_status)) {
@@ -1969,6 +1973,7 @@ void reply_open(struct smb_request *req)
uint32_t create_options = 0;
uint32_t private_flags = 0;
NTSTATUS status;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBopen);
@@ -2001,7 +2006,7 @@ void reply_open(struct smb_request *req)
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- UCF_PREP_CREATEFILE,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
@@ -2121,6 +2126,7 @@ void reply_open_and_X(struct smb_request *req)
uint32_t create_disposition;
uint32_t create_options = 0;
uint32_t private_flags = 0;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBopenX);
@@ -2171,7 +2177,7 @@ void reply_open_and_X(struct smb_request *req)
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- UCF_PREP_CREATEFILE,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
@@ -2379,6 +2385,7 @@ void reply_mknew(struct smb_request *req)
uint32_t share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE;
uint32_t create_disposition;
uint32_t create_options = 0;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcreate);
@@ -2406,7 +2413,7 @@ void reply_mknew(struct smb_request *req)
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- UCF_PREP_CREATEFILE,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
@@ -2510,6 +2517,7 @@ void reply_ctemp(struct smb_request *req)
char *s;
NTSTATUS status;
int i;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBctemp);
@@ -2549,7 +2557,7 @@ void reply_ctemp(struct smb_request *req)
status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- UCF_PREP_CREATEFILE,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
@@ -3053,6 +3061,7 @@ void reply_unlink(struct smb_request *req)
uint32_t dirtype;
NTSTATUS status;
bool path_contains_wcard = False;
+ uint32_t ucf_flags = UCF_COND_ALLOW_WCARD_LCOMP;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBunlink);
@@ -3075,7 +3084,7 @@ void reply_unlink(struct smb_request *req)
status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
name,
- UCF_COND_ALLOW_WCARD_LCOMP,
+ ucf_flags,
&path_contains_wcard,
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
@@ -5961,6 +5970,7 @@ void reply_mkdir(struct smb_request *req)
struct smb_filename *smb_dname = NULL;
char *directory = NULL;
NTSTATUS status;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBmkdir);
@@ -5975,7 +5985,7 @@ void reply_mkdir(struct smb_request *req)
status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
directory,
- UCF_PREP_CREATEFILE,
+ ucf_flags,
NULL,
&smb_dname);
if (!NT_STATUS_IS_OK(status)) {
@@ -6031,6 +6041,7 @@ void reply_rmdir(struct smb_request *req)
TALLOC_CTX *ctx = talloc_tos();
files_struct *fsp = NULL;
int info = 0;
+ uint32_t ucf_flags = 0;
struct smbd_server_connection *sconn = req->sconn;
START_PROFILE(SMBrmdir);
@@ -6045,7 +6056,7 @@ void reply_rmdir(struct smb_request *req)
status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
directory,
- 0,
+ ucf_flags,
NULL,
&smb_dname);
if (!NT_STATUS_IS_OK(status)) {
@@ -7379,6 +7390,8 @@ void reply_copy(struct smb_request *req)
bool source_has_wild = False;
bool dest_has_wild = False;
NTSTATUS status;
+ uint32_t ucf_flags_src = UCF_COND_ALLOW_WCARD_LCOMP;
+ uint32_t ucf_flags_dst = UCF_COND_ALLOW_WCARD_LCOMP;
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcopy);
@@ -7418,7 +7431,7 @@ void reply_copy(struct smb_request *req)
status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname_src,
- UCF_COND_ALLOW_WCARD_LCOMP,
+ ucf_flags_src,
&source_has_wild,
&smb_fname_src);
if (!NT_STATUS_IS_OK(status)) {
@@ -7434,7 +7447,7 @@ void reply_copy(struct smb_request *req)
status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname_dst,
- UCF_COND_ALLOW_WCARD_LCOMP,
+ ucf_flags_dst,
&dest_has_wild,
&smb_fname_dst);
if (!NT_STATUS_IS_OK(status)) {
--
2.6.0.rc2.230.g3dd15c0
From 3277f7b2c2bf774701356c291bd8c37e2df56a8f Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:05:46 -0800
Subject: [PATCH 04/15] s3: smbd: In trans2.c Use ucf_flags variable instead of
passing as parameter.
This will allow us to move lp_posix_pathnames() out of unix_convert()
later.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/trans2.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 11c97e8..5bfed98 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1097,6 +1097,7 @@ static void call_trans2open(connection_struct *conn,
uint32_t create_disposition;
uint32_t create_options = 0;
uint32_t private_flags = 0;
+ uint32_t ucf_flags = 0;
TALLOC_CTX *ctx = talloc_tos();
/*
@@ -1146,7 +1147,7 @@ static void call_trans2open(connection_struct *conn,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- 0,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
@@ -6372,6 +6373,7 @@ static NTSTATUS smb_set_file_unix_hlink(connection_struct *conn,
{
char *oldname = NULL;
struct smb_filename *smb_fname_old = NULL;
+ uint32_t ucf_flags = 0;
TALLOC_CTX *ctx = talloc_tos();
NTSTATUS status = NT_STATUS_OK;
@@ -6393,7 +6395,7 @@ static NTSTATUS smb_set_file_unix_hlink(connection_struct *conn,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
oldname,
- 0,
+ ucf_flags,
NULL,
&smb_fname_old);
if (!NT_STATUS_IS_OK(status)) {
@@ -6419,6 +6421,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
uint32_t len;
char *newname = NULL;
struct smb_filename *smb_fname_dst = NULL;
+ uint32_t ucf_flags = UCF_SAVE_LCOMP;
NTSTATUS status = NT_STATUS_OK;
TALLOC_CTX *ctx = talloc_tos();
@@ -6451,7 +6454,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
newname,
- UCF_SAVE_LCOMP,
+ ucf_flags,
NULL,
&smb_fname_dst);
if (!NT_STATUS_IS_OK(status)) {
@@ -6511,6 +6514,7 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
char *newname = NULL;
struct smb_filename *smb_fname_dst = NULL;
NTSTATUS status = NT_STATUS_OK;
+ uint32_t ucf_flags = UCF_SAVE_LCOMP;
TALLOC_CTX *ctx = talloc_tos();
if (!fsp) {
@@ -6542,7 +6546,7 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
newname,
- UCF_SAVE_LCOMP,
+ ucf_flags,
NULL,
&smb_fname_dst);
if (!NT_STATUS_IS_OK(status)) {
@@ -8556,6 +8560,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
char *directory = NULL;
NTSTATUS status = NT_STATUS_OK;
struct ea_list *ea_list = NULL;
+ uint32_t ucf_flags = 0;
TALLOC_CTX *ctx = talloc_tos();
if (!CAN_WRITE(conn)) {
@@ -8582,7 +8587,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
directory,
- 0,
+ ucf_flags,
NULL,
&smb_dname);
--
2.6.0.rc2.230.g3dd15c0
From 288d9abd90ee4ee65ef6cebb8980532e4264b541 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:07:16 -0800
Subject: [PATCH 05/15] s3: smbd: In srv_srvsvc_nt.c Use ucf_flags variable
instead of passing as parameter.
This will allow us to move lp_posix_pathnames() out of unix_convert()
later.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 96c022b..b1e9d13 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -2311,6 +2311,7 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p,
files_struct *fsp = NULL;
int snum;
char *oldcwd = NULL;
+ uint32_t ucf_flags = 0;
ZERO_STRUCT(st);
@@ -2346,7 +2347,7 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p,
conn,
false,
r->in.file,
- 0,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(nt_status)) {
@@ -2458,6 +2459,7 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p,
char *oldcwd = NULL;
struct security_descriptor *psd = NULL;
uint32_t security_info_sent = 0;
+ uint32_t ucf_flags = 0;
ZERO_STRUCT(st);
@@ -2495,7 +2497,7 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p,
conn,
false,
r->in.file,
- 0,
+ ucf_flags,
NULL,
&smb_fname);
if (!NT_STATUS_IS_OK(nt_status)) {
--
2.6.0.rc2.230.g3dd15c0
From 50b91f916b074e7b1ebb8a99b48775359b46e62b Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:08:38 -0800
Subject: [PATCH 06/15] s3: smbd: In smb2_create.c Use ucf_flags variable
instead of passing as parameter.
This will allow us to move lp_posix_pathnames() out of unix_convert()
later.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/smb2_create.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 1b12962..54a598d 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -379,6 +379,7 @@ static NTSTATUS smbd_smb2_create_durable_lease_check(
const struct smb2_lease *lease_ptr)
{
struct smb_filename *smb_fname = NULL;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
NTSTATUS status;
if (lease_ptr == NULL) {
@@ -404,7 +405,7 @@ static NTSTATUS smbd_smb2_create_durable_lease_check(
}
status = filename_convert(talloc_tos(), fsp->conn, false,
- requested_filename, UCF_PREP_CREATEFILE,
+ requested_filename, ucf_flags,
NULL, &smb_fname);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("filename_convert returned %s\n",
@@ -1004,6 +1005,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
info = FILE_WAS_OPENED;
} else {
struct smb_filename *smb_fname = NULL;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
if (requested_oplock_level == SMB2_OPLOCK_LEVEL_LEASE) {
if (lease_ptr == NULL) {
@@ -1031,7 +1033,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
smb1req->conn,
smb1req->flags2 & FLAGS2_DFS_PATHNAMES,
fname,
- UCF_PREP_CREATEFILE,
+ ucf_flags,
NULL, /* ppath_contains_wcards */
&smb_fname);
if (!NT_STATUS_IS_OK(status)) {
--
2.6.0.rc2.230.g3dd15c0
From 872586cd4ba4e215bd960b77f8e6ccf894f4c31e Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:12:34 -0800
Subject: [PATCH 07/15] s3: smbd: In smb2_query_directory.c Use ucf_flags
variable instead of passing as parameter.
This will allow us to move lp_posix_pathnames() out of unix_convert()
later.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/smb2_query_directory.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c
index 56dab69..31205fe 100644
--- a/source3/smbd/smb2_query_directory.c
+++ b/source3/smbd/smb2_query_directory.c
@@ -335,6 +335,8 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
const char *fullpath;
char tmpbuf[PATH_MAX];
char *to_free = NULL;
+ uint32_t ucf_flags = UCF_SAVE_LCOMP |
+ UCF_ALWAYS_ALLOW_WCARD_LCOMP;
if (ISDOT(fsp->fsp_name->base_name)) {
fullpath = in_file_name;
@@ -355,7 +357,7 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
conn,
false, /* Not a DFS path. */
fullpath,
- UCF_SAVE_LCOMP | UCF_ALWAYS_ALLOW_WCARD_LCOMP,
+ ucf_flags,
&wcard_has_wild,
&smb_fname);
--
2.6.0.rc2.230.g3dd15c0
From 21fc38b2997fbec7fc0116c0bc4688819cf5ac30 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:16:27 -0800
Subject: [PATCH 08/15] s3: smbd: In nttrans2.c, add in UCF_POSIX_PATHNAMES to
the ucf_flags if lp_posix_pathnames() requested.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/nttrans.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index a9ab0dc..6ef4c5a 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -461,7 +461,8 @@ void reply_ntcreate_and_X(struct smb_request *req)
int oplock_request;
uint8_t oplock_granted = NO_OPLOCK_RETURN;
struct case_semantics_state *case_state = NULL;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBntcreateX);
@@ -1001,7 +1002,8 @@ static void call_nt_transact_create(connection_struct *conn,
int oplock_request;
uint8_t oplock_granted;
struct case_semantics_state *case_state = NULL;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
DEBUG(5,("call_nt_transact_create\n"));
@@ -1526,8 +1528,8 @@ void reply_ntrename(struct smb_request *req)
bool src_has_wcard = False;
bool dest_has_wcard = False;
uint32_t attrs;
- uint32_t ucf_flags_src = 0;
- uint32_t ucf_flags_dst = 0;
+ uint32_t ucf_flags_src = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags_dst = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
uint16_t rename_type;
TALLOC_CTX *ctx = talloc_tos();
bool stream_rename = false;
--
2.6.0.rc2.230.g3dd15c0
From bd64a9f82c698b45960e4dd20af374414041bdaf Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:18:19 -0800
Subject: [PATCH 09/15] s3: smbd: In srv_srvsvc_nt.c, add in
UCF_POSIX_PATHNAMES to the ucf_flags if lp_posix_pathnames() requested.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index b1e9d13..fd71650 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -2311,7 +2311,7 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p,
files_struct *fsp = NULL;
int snum;
char *oldcwd = NULL;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
ZERO_STRUCT(st);
@@ -2459,7 +2459,7 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p,
char *oldcwd = NULL;
struct security_descriptor *psd = NULL;
uint32_t security_info_sent = 0;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
ZERO_STRUCT(st);
--
2.6.0.rc2.230.g3dd15c0
From a85c534c59a86eb357b0853602396b9ff40ef086 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:19:23 -0800
Subject: [PATCH 10/15] s3: smbd: In open.c, add in UCF_POSIX_PATHNAMES to the
ucf_flags if lp_posix_pathnames() requested.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/open.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index a732a47..d728782 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -4828,7 +4828,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
files_struct *dir_fsp;
char *parent_fname = NULL;
char *new_base_name = NULL;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
NTSTATUS status;
if (root_dir_fid == 0 || !smb_fname) {
--
2.6.0.rc2.230.g3dd15c0
From d3689a58a2c981f67bc824314be4c66b2fa87995 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:25:16 -0800
Subject: [PATCH 11/15] s3: smbd: In reply.c, add in UCF_POSIX_PATHNAMES to the
ucf_flags if lp_posix_pathnames() requested.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 44 +++++++++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 15 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 269c889..b1ca7a5 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1165,7 +1165,7 @@ void reply_checkpath(struct smb_request *req)
struct smb_filename *smb_fname = NULL;
char *name = NULL;
NTSTATUS status;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcheckpath);
@@ -1280,7 +1280,8 @@ void reply_getatr(struct smb_request *req)
size = 0;
mtime = 0;
} else {
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ?
+ UCF_POSIX_PATHNAMES : 0);
status = filename_convert(ctx,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
@@ -1366,7 +1367,7 @@ void reply_setatr(struct smb_request *req)
time_t mtime;
const char *p;
NTSTATUS status;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBsetatr);
@@ -1671,7 +1672,8 @@ void reply_search(struct smb_request *req)
/* dirtype &= ~FILE_ATTRIBUTE_DIRECTORY; */
if (status_len == 0) {
- uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP;
+ uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
nt_status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
path,
@@ -1973,7 +1975,8 @@ void reply_open(struct smb_request *req)
uint32_t create_options = 0;
uint32_t private_flags = 0;
NTSTATUS status;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBopen);
@@ -2126,7 +2129,8 @@ void reply_open_and_X(struct smb_request *req)
uint32_t create_disposition;
uint32_t create_options = 0;
uint32_t private_flags = 0;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBopenX);
@@ -2385,7 +2389,8 @@ void reply_mknew(struct smb_request *req)
uint32_t share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE;
uint32_t create_disposition;
uint32_t create_options = 0;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcreate);
@@ -2517,7 +2522,8 @@ void reply_ctemp(struct smb_request *req)
char *s;
NTSTATUS status;
int i;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBctemp);
@@ -3061,7 +3067,8 @@ void reply_unlink(struct smb_request *req)
uint32_t dirtype;
NTSTATUS status;
bool path_contains_wcard = False;
- uint32_t ucf_flags = UCF_COND_ALLOW_WCARD_LCOMP;
+ uint32_t ucf_flags = UCF_COND_ALLOW_WCARD_LCOMP |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBunlink);
@@ -5970,7 +5977,8 @@ void reply_mkdir(struct smb_request *req)
struct smb_filename *smb_dname = NULL;
char *directory = NULL;
NTSTATUS status;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBmkdir);
@@ -6041,7 +6049,7 @@ void reply_rmdir(struct smb_request *req)
TALLOC_CTX *ctx = talloc_tos();
files_struct *fsp = NULL;
int info = 0;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
struct smbd_server_connection *sconn = req->sconn;
START_PROFILE(SMBrmdir);
@@ -7078,8 +7086,12 @@ void reply_mv(struct smb_request *req)
TALLOC_CTX *ctx = talloc_tos();
struct smb_filename *smb_fname_src = NULL;
struct smb_filename *smb_fname_dst = NULL;
- uint32_t src_ucf_flags = lp_posix_pathnames() ? UCF_UNIX_NAME_LOOKUP : UCF_COND_ALLOW_WCARD_LCOMP;
- uint32_t dst_ucf_flags = UCF_SAVE_LCOMP | (lp_posix_pathnames() ? 0 : UCF_COND_ALLOW_WCARD_LCOMP);
+ uint32_t src_ucf_flags = (lp_posix_pathnames() ?
+ (UCF_UNIX_NAME_LOOKUP|UCF_POSIX_PATHNAMES) :
+ UCF_COND_ALLOW_WCARD_LCOMP);
+ uint32_t dst_ucf_flags = UCF_SAVE_LCOMP |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES :
+ UCF_COND_ALLOW_WCARD_LCOMP);
bool stream_rename = false;
START_PROFILE(SMBmv);
@@ -7390,8 +7402,10 @@ void reply_copy(struct smb_request *req)
bool source_has_wild = False;
bool dest_has_wild = False;
NTSTATUS status;
- uint32_t ucf_flags_src = UCF_COND_ALLOW_WCARD_LCOMP;
- uint32_t ucf_flags_dst = UCF_COND_ALLOW_WCARD_LCOMP;
+ uint32_t ucf_flags_src = UCF_COND_ALLOW_WCARD_LCOMP |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags_dst = UCF_COND_ALLOW_WCARD_LCOMP |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcopy);
--
2.6.0.rc2.230.g3dd15c0
From 549c6a10bfff44d8f2cdeac404afc6cf60591c04 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:26:18 -0800
Subject: [PATCH 12/15] s3: smbd: In smb2_create.c, add in UCF_POSIX_PATHNAMES
to the ucf_flags if lp_posix_pathnames() requested.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/smb2_create.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 54a598d..db706f0 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -379,7 +379,8 @@ static NTSTATUS smbd_smb2_create_durable_lease_check(
const struct smb2_lease *lease_ptr)
{
struct smb_filename *smb_fname = NULL;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
NTSTATUS status;
if (lease_ptr == NULL) {
@@ -1005,7 +1006,8 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
info = FILE_WAS_OPENED;
} else {
struct smb_filename *smb_fname = NULL;
- uint32_t ucf_flags = UCF_PREP_CREATEFILE;
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
if (requested_oplock_level == SMB2_OPLOCK_LEVEL_LEASE) {
if (lease_ptr == NULL) {
--
2.6.0.rc2.230.g3dd15c0
From afeb1ee1bb11981410717bd6792f68ecc806adc8 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:27:39 -0800
Subject: [PATCH 13/15] s3: smbd: In smb2_query_directory.c.c, add in
UCF_POSIX_PATHNAMES to the ucf_flags if lp_posix_pathnames() requested.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/smb2_query_directory.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c
index 31205fe..57c1393 100644
--- a/source3/smbd/smb2_query_directory.c
+++ b/source3/smbd/smb2_query_directory.c
@@ -336,7 +336,9 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
char tmpbuf[PATH_MAX];
char *to_free = NULL;
uint32_t ucf_flags = UCF_SAVE_LCOMP |
- UCF_ALWAYS_ALLOW_WCARD_LCOMP;
+ UCF_ALWAYS_ALLOW_WCARD_LCOMP |
+ (lp_posix_pathnames() ?
+ UCF_POSIX_PATHNAMES : 0);
if (ISDOT(fsp->fsp_name->base_name)) {
fullpath = in_file_name;
--
2.6.0.rc2.230.g3dd15c0
From 204680d52518eec77f5fe0141d52fa712a904959 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:31:20 -0800
Subject: [PATCH 14/15] s3: smbd: In trans2.c, add in UCF_POSIX_PATHNAMES to
the ucf_flags if lp_posix_pathnames() requested.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/trans2.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 5bfed98..2702545 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1097,7 +1097,7 @@ static void call_trans2open(connection_struct *conn,
uint32_t create_disposition;
uint32_t create_options = 0;
uint32_t private_flags = 0;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
/*
@@ -2478,7 +2478,8 @@ static void call_trans2findfirst(connection_struct *conn,
TALLOC_CTX *ctx = talloc_tos();
struct dptr_struct *dirptr = NULL;
struct smbd_server_connection *sconn = req->sconn;
- uint32_t ucf_flags = (UCF_SAVE_LCOMP | UCF_ALWAYS_ALLOW_WCARD_LCOMP);
+ uint32_t ucf_flags = UCF_SAVE_LCOMP | UCF_ALWAYS_ALLOW_WCARD_LCOMP |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
bool backup_priv = false;
bool as_root = false;
@@ -5543,7 +5544,8 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
} else {
uint32_t name_hash;
char *fname = NULL;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ?
+ UCF_POSIX_PATHNAMES : 0);
/* qpathinfo */
if (total_params < 7) {
@@ -6373,7 +6375,7 @@ static NTSTATUS smb_set_file_unix_hlink(connection_struct *conn,
{
char *oldname = NULL;
struct smb_filename *smb_fname_old = NULL;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
NTSTATUS status = NT_STATUS_OK;
@@ -6421,7 +6423,8 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
uint32_t len;
char *newname = NULL;
struct smb_filename *smb_fname_dst = NULL;
- uint32_t ucf_flags = UCF_SAVE_LCOMP;
+ uint32_t ucf_flags = UCF_SAVE_LCOMP |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
NTSTATUS status = NT_STATUS_OK;
TALLOC_CTX *ctx = talloc_tos();
@@ -6514,7 +6517,8 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
char *newname = NULL;
struct smb_filename *smb_fname_dst = NULL;
NTSTATUS status = NT_STATUS_OK;
- uint32_t ucf_flags = UCF_SAVE_LCOMP;
+ uint32_t ucf_flags = UCF_SAVE_LCOMP |
+ (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
if (!fsp) {
@@ -8426,7 +8430,8 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
}
} else {
char *fname = NULL;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ?
+ UCF_POSIX_PATHNAMES : 0);
/* set path info */
if (total_params < 7) {
@@ -8560,7 +8565,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
char *directory = NULL;
NTSTATUS status = NT_STATUS_OK;
struct ea_list *ea_list = NULL;
- uint32_t ucf_flags = 0;
+ uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
if (!CAN_WRITE(conn)) {
--
2.6.0.rc2.230.g3dd15c0
From 34e2defa3ac7fbe6ff5280bf26a7b9a693d92a04 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 11:32:20 -0800
Subject: [PATCH 15/15] s3: smbd: Remove lp_posix_pathnames() from filename.c
Now correctly passed in everywhere as the UCF_POSIX_PATHNAMES flag.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/filename.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 1174b59..c2ed1fc 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -240,8 +240,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
char *stream = NULL;
bool component_was_mangled = False;
bool name_has_wildcard = False;
- bool posix_pathnames = (lp_posix_pathnames() ||
- (ucf_flags & UCF_POSIX_PATHNAMES));
+ bool posix_pathnames = (ucf_flags & UCF_POSIX_PATHNAMES);
bool allow_wcard_last_component =
(ucf_flags & UCF_ALWAYS_ALLOW_WCARD_LCOMP);
bool save_last_component = ucf_flags & UCF_SAVE_LCOMP;
--
2.6.0.rc2.230.g3dd15c0
More information about the samba-technical
mailing list