[PATCH] Follow-up to last lp_posix_pathnames() fix.
Jeremy Allison
jra at samba.org
Wed Dec 23 06:40:33 UTC 2015
This patch layers on top of the one I just
pushed with Ralph's review.
It cuts the number of direct calls to
lp_posix_pathnames() to 30.
It moves lp_posix_pathnames() to a bool,
posix_pathnames inside of struct smb_request
(and notes VFS API update).
Now checking for posix_pathnames is a check
if (req->posix_pathnames)
instead of:
if (lp_posix_pathnames())
so the attribute can be associated with
a request for SMB1 (and later a handle for smb2).
The remaining 30 calls I'm planning to
go through carefully and send patches
in to eliminate them. I think I see a way to
get rid of most of them, some of the
uses inside the VFS may be a little
tricky, but we'll get there !
Passes make test.
Please review and push if happy.
Jeremy.
-------------- next part --------------
>From eae501dda00b26c4facbea4ebb0e6b14a2248989 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 12:52:58 -0800
Subject: [PATCH 01/19] s3: smbd: Move lp_posix_pathnames() out of
srvstr_get_path_wcard_internal().
Pass as parameter. Part of moving this switch out to the external request
parsing code.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index b1ca7a5..a80cb93 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -253,15 +253,17 @@ NTSTATUS check_path_syntax_posix(char *path)
/****************************************************************************
Pull a string and check the path allowing a wilcard - provide for error return.
+ Passes in posix flag.
****************************************************************************/
-size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
+static size_t srvstr_get_path_wcard_internal(TALLOC_CTX *ctx,
const char *base_ptr,
uint16_t smb_flags2,
char **pp_dest,
const char *src,
size_t src_len,
int flags,
+ bool posix_pathnames,
NTSTATUS *err,
bool *contains_wcard)
{
@@ -288,7 +290,7 @@ size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
return ret;
}
- if (lp_posix_pathnames()) {
+ if (posix_pathnames) {
*err = check_path_syntax_posix(*pp_dest);
} else {
*err = check_path_syntax_wcard(*pp_dest, contains_wcard);
@@ -298,6 +300,32 @@ size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
}
/****************************************************************************
+ Pull a string and check the path allowing a wilcard - provide for error return.
+****************************************************************************/
+
+size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
+ const char *base_ptr,
+ uint16_t smb_flags2,
+ char **pp_dest,
+ const char *src,
+ size_t src_len,
+ int flags,
+ NTSTATUS *err,
+ bool *contains_wcard)
+{
+ return srvstr_get_path_wcard_internal(ctx,
+ base_ptr,
+ smb_flags2,
+ pp_dest,
+ src,
+ src_len,
+ flags,
+ lp_posix_pathnames(),
+ err,
+ contains_wcard);
+}
+
+/****************************************************************************
Pull a string and check the path - provide for error return.
****************************************************************************/
--
2.5.0
>From af88b68b91f929d79604559cceb564e43036a250 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:01:08 -0800
Subject: [PATCH 02/19] s3: smbd: Move lp_posix_pathnames() out into
srvstr_get_path().
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index a80cb93..d987412 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -339,8 +339,29 @@ size_t srvstr_get_path(TALLOC_CTX *ctx,
NTSTATUS *err)
{
bool ignore;
- return srvstr_get_path_wcard(ctx, base_ptr, smb_flags2, pp_dest, src,
- src_len, flags, err, &ignore);
+ if (lp_posix_pathnames()) {
+ return srvstr_get_path_wcard_internal(ctx,
+ base_ptr,
+ smb_flags2,
+ pp_dest,
+ src,
+ src_len,
+ flags,
+ true,
+ err,
+ &ignore);
+ } else {
+ return srvstr_get_path_wcard_internal(ctx,
+ base_ptr,
+ smb_flags2,
+ pp_dest,
+ src,
+ src_len,
+ flags,
+ false,
+ err,
+ &ignore);
+ }
}
size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
--
2.5.0
>From be2e669d45387f37ed9b9ac3670aae7d19c61696 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:04:11 -0800
Subject: [PATCH 03/19] s3: smbd: Move lp_posix_pathnames() out into
srvstr_get_path_req_wcard().
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index d987412..c4438c8 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -375,9 +375,29 @@ size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
return 0;
}
- return srvstr_get_path_wcard(mem_ctx, (const char *)req->inbuf,
- req->flags2, pp_dest, src, bufrem, flags,
- err, contains_wcard);
+ if (lp_posix_pathnames()) {
+ return srvstr_get_path_wcard_internal(mem_ctx,
+ (const char *)req->inbuf,
+ req->flags2,
+ pp_dest,
+ src,
+ bufrem,
+ flags,
+ true,
+ err,
+ contains_wcard);
+ } else {
+ return srvstr_get_path_wcard_internal(mem_ctx,
+ (const char *)req->inbuf,
+ req->flags2,
+ pp_dest,
+ src,
+ bufrem,
+ flags,
+ false,
+ err,
+ contains_wcard);
+ }
}
size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
--
2.5.0
>From a6af2762800ac265ab265a38dc932ab675bdf992 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:07:49 -0800
Subject: [PATCH 04/19] s3: smbd: Add srvstr_get_path_wcard_posix().
Allows us to call this directly and eventually remove the lp_posix_pathnames() call
from inside of srvstr_get_path_wcard().
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/proto.h | 9 +++++++++
source3/smbd/reply.c | 27 +++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 55e8286..af41d66 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -847,6 +847,15 @@ size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
int flags,
NTSTATUS *err,
bool *contains_wcard);
+size_t srvstr_get_path_wcard_posix(TALLOC_CTX *ctx,
+ const char *inbuf,
+ uint16_t smb_flags2,
+ char **pp_dest,
+ const char *src,
+ size_t src_len,
+ int flags,
+ NTSTATUS *err,
+ bool *contains_wcard);
size_t srvstr_get_path(TALLOC_CTX *ctx,
const char *inbuf,
uint16_t smb_flags2,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index c4438c8..cb1fc55 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -326,6 +326,33 @@ size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
}
/****************************************************************************
+ Pull a string and check the path allowing a wilcard - provide for error return.
+ posix_pathnames version.
+****************************************************************************/
+
+size_t srvstr_get_path_wcard_posix(TALLOC_CTX *ctx,
+ const char *base_ptr,
+ uint16_t smb_flags2,
+ char **pp_dest,
+ const char *src,
+ size_t src_len,
+ int flags,
+ NTSTATUS *err,
+ bool *contains_wcard)
+{
+ return srvstr_get_path_wcard_internal(ctx,
+ base_ptr,
+ smb_flags2,
+ pp_dest,
+ src,
+ src_len,
+ flags,
+ true,
+ err,
+ contains_wcard);
+}
+
+/****************************************************************************
Pull a string and check the path - provide for error return.
****************************************************************************/
--
2.5.0
>From 0e298d51dbe39be1db70d97d225b65c8f604f5d9 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:13:44 -0800
Subject: [PATCH 05/19] s3: smbd: Split all calls to srvstr_get_path_wcard()
into srvstr_get_path_wcard_posix() or srvstr_get_path_wcard() depending on
lp_posix_pathnames().
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/nttrans.c | 25 ++++++++++++++---
source3/smbd/trans2.c | 73 +++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 85 insertions(+), 13 deletions(-)
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 6ef4c5a..8decb83 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1835,9 +1835,28 @@ static void call_nt_transact_rename(connection_struct *conn,
if (!check_fsp(conn, req, fsp)) {
return;
}
- srvstr_get_path_wcard(ctx, params, req->flags2, &new_name, params+4,
- parameter_count - 4,
- STR_TERMINATE, &status, &dest_has_wcard);
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_wcard_posix(ctx,
+ params,
+ req->flags2,
+ &new_name,
+ params+4,
+ parameter_count - 4,
+ STR_TERMINATE,
+ &status,
+ &dest_has_wcard);
+ } else {
+ srvstr_get_path_wcard(ctx,
+ params,
+ req->flags2,
+ &new_name,
+ params+4,
+ parameter_count - 4,
+ STR_TERMINATE,
+ &status,
+ &dest_has_wcard);
+ }
+
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
return;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 2702545..33e34de 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2537,9 +2537,27 @@ close_if_end = %d requires_resume_key = %d backup_priv = %d level = 0x%x, max_da
goto out;
}
- srvstr_get_path_wcard(ctx, params, req->flags2, &directory,
- params+12, total_params - 12,
- STR_TERMINATE, &ntstatus, &mask_contains_wcard);
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_wcard_posix(ctx,
+ params,
+ req->flags2,
+ &directory,
+ params+12,
+ total_params - 12,
+ STR_TERMINATE,
+ &ntstatus,
+ &mask_contains_wcard);
+ } else {
+ srvstr_get_path_wcard(ctx,
+ params,
+ req->flags2,
+ &directory,
+ params+12,
+ total_params - 12,
+ STR_TERMINATE,
+ &ntstatus,
+ &mask_contains_wcard);
+ }
if (!NT_STATUS_IS_OK(ntstatus)) {
reply_nterror(req, ntstatus);
goto out;
@@ -2895,10 +2913,27 @@ static void call_trans2findnext(connection_struct *conn,
if (!continue_bit) {
/* We only need resume_name if continue_bit is zero. */
- srvstr_get_path_wcard(ctx, params, req->flags2, &resume_name,
- params+12,
- total_params - 12, STR_TERMINATE, &ntstatus,
- &mask_contains_wcard);
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_wcard_posix(ctx,
+ params,
+ req->flags2,
+ &resume_name,
+ params+12,
+ total_params - 12,
+ STR_TERMINATE,
+ &ntstatus,
+ &mask_contains_wcard);
+ } else {
+ srvstr_get_path_wcard(ctx,
+ params,
+ req->flags2,
+ &resume_name,
+ params+12,
+ total_params - 12,
+ STR_TERMINATE,
+ &ntstatus,
+ &mask_contains_wcard);
+ }
if (!NT_STATUS_IS_OK(ntstatus)) {
/* Win9x or OS/2 can send a resume name of ".." or ".". This will cause the parser to
complain (it thinks we're asking for the directory above the shared
@@ -6610,9 +6645,27 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- srvstr_get_path_wcard(ctx, pdata, req->flags2, &newname, &pdata[12],
- len, 0, &status,
- &dest_has_wcard);
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_wcard_posix(ctx,
+ pdata,
+ req->flags2,
+ &newname,
+ &pdata[12],
+ len,
+ 0,
+ &status,
+ &dest_has_wcard);
+ } else {
+ srvstr_get_path_wcard(ctx,
+ pdata,
+ req->flags2,
+ &newname,
+ &pdata[12],
+ len,
+ 0,
+ &status,
+ &dest_has_wcard);
+ }
if (!NT_STATUS_IS_OK(status)) {
return status;
}
--
2.5.0
>From 93bd44ec00dc6ce9e94fb717f31f239ed5747aab Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:14:41 -0800
Subject: [PATCH 06/19] s3: smbd: We now know that srvstr_get_path_wcard() is
only called when lp_posix_pathnames() is false.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index cb1fc55..9173130 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -320,7 +320,7 @@ size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
src,
src_len,
flags,
- lp_posix_pathnames(),
+ false,
err,
contains_wcard);
}
--
2.5.0
>From a2e4256a57c5c1a054dd0be8eb289470ef80149d Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:18:03 -0800
Subject: [PATCH 07/19] s3: smbd: Add srvstr_get_path_posix().
Not yet used, will be plumbed into existing callers of srvstr_get_path()
when lp_posix_pathnames() is true.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/proto.h | 8 ++++++++
source3/smbd/reply.c | 28 ++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index af41d66..847a191 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -864,6 +864,14 @@ size_t srvstr_get_path(TALLOC_CTX *ctx,
size_t src_len,
int flags,
NTSTATUS *err);
+size_t srvstr_get_path_posix(TALLOC_CTX *ctx,
+ const char *inbuf,
+ uint16_t smb_flags2,
+ char **pp_dest,
+ const char *src,
+ size_t src_len,
+ int flags,
+ NTSTATUS *err);
size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
char **pp_dest, const char *src, int flags,
NTSTATUS *err, bool *contains_wcard);
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 9173130..104151c 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -391,6 +391,34 @@ size_t srvstr_get_path(TALLOC_CTX *ctx,
}
}
+/****************************************************************************
+ Pull a string and check the path - provide for error return.
+ posix_pathnames version.
+****************************************************************************/
+
+size_t srvstr_get_path_posix(TALLOC_CTX *ctx,
+ const char *base_ptr,
+ uint16_t smb_flags2,
+ char **pp_dest,
+ const char *src,
+ size_t src_len,
+ int flags,
+ NTSTATUS *err)
+{
+ bool ignore;
+ return srvstr_get_path_wcard_internal(ctx,
+ base_ptr,
+ smb_flags2,
+ pp_dest,
+ src,
+ src_len,
+ flags,
+ true,
+ err,
+ &ignore);
+}
+
+
size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
char **pp_dest, const char *src, int flags,
NTSTATUS *err, bool *contains_wcard)
--
2.5.0
>From d29afbc5676145358e74501792b8274ad15d58bd Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:26:49 -0800
Subject: [PATCH 08/19] s3: smbd: Split all calls to srvstr_get_path() to calls
to srvstr_get_path_posix() or srvstr_get_path() depending on
lp_posix_pathnames().
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/nttrans.c | 42 +++++++++++++--
source3/smbd/trans2.c | 141 ++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 164 insertions(+), 19 deletions(-)
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 8decb83..6d9db1f 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -762,9 +762,25 @@ static void do_nt_transact_create_pipe(connection_struct *conn,
flags = IVAL(params,0);
- srvstr_get_path(ctx, params, req->flags2, &fname, params+53,
- parameter_count-53, STR_TERMINATE,
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(ctx,
+ params,
+ req->flags2,
+ &fname,
+ params+53,
+ parameter_count-53,
+ STR_TERMINATE,
+ &status);
+ } else {
+ srvstr_get_path(ctx,
+ params,
+ req->flags2,
+ &fname,
+ params+53,
+ parameter_count-53,
+ STR_TERMINATE,
&status);
+ }
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
return;
@@ -1052,9 +1068,25 @@ static void call_nt_transact_create(connection_struct *conn,
*/
create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK;
- srvstr_get_path(ctx, params, req->flags2, &fname,
- params+53, parameter_count-53,
- STR_TERMINATE, &status);
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(ctx,
+ params,
+ req->flags2,
+ &fname,
+ params+53,
+ parameter_count-53,
+ STR_TERMINATE,
+ &status);
+ } else {
+ srvstr_get_path(ctx,
+ params,
+ req->flags2,
+ &fname,
+ params+53,
+ parameter_count-53,
+ STR_TERMINATE,
+ &status);
+ }
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
goto out;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 33e34de..e8909a7 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1131,9 +1131,25 @@ static void call_trans2open(connection_struct *conn,
goto out;
}
- srvstr_get_path(ctx, params, req->flags2, &fname, pname,
- total_params - 28, STR_TERMINATE,
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(ctx,
+ params,
+ req->flags2,
+ &fname,
+ pname,
+ total_params - 28,
+ STR_TERMINATE,
+ &status);
+ } else {
+ srvstr_get_path(ctx,
+ params,
+ req->flags2,
+ &fname,
+ pname,
+ total_params - 28,
+ STR_TERMINATE,
&status);
+ }
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
goto out;
@@ -5604,9 +5620,25 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
}
}
- srvstr_get_path(req, params, req->flags2, &fname, ¶ms[6],
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(req,
+ params,
+ req->flags2,
+ &fname,
+ ¶ms[6],
total_params - 6,
- STR_TERMINATE, &status);
+ STR_TERMINATE,
+ &status);
+ } else {
+ srvstr_get_path(req,
+ params,
+ req->flags2,
+ &fname,
+ ¶ms[6],
+ total_params - 6,
+ STR_TERMINATE,
+ &status);
+ }
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
return;
@@ -6419,8 +6451,25 @@ static NTSTATUS smb_set_file_unix_hlink(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- srvstr_get_path(ctx, pdata, req->flags2, &oldname, pdata,
- total_data, STR_TERMINATE, &status);
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(ctx,
+ pdata,
+ req->flags2,
+ &oldname,
+ pdata,
+ total_data,
+ STR_TERMINATE,
+ &status);
+ } else {
+ srvstr_get_path(ctx,
+ pdata,
+ req->flags2,
+ &oldname,
+ pdata,
+ total_data,
+ STR_TERMINATE,
+ &status);
+ }
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -6478,9 +6527,25 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- srvstr_get_path(ctx, pdata, req->flags2, &newname,
- &pdata[20], len, STR_TERMINATE,
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(ctx,
+ pdata,
+ req->flags2,
+ &newname,
+ &pdata[20],
+ len,
+ STR_TERMINATE,
&status);
+ } else {
+ srvstr_get_path(ctx,
+ pdata,
+ req->flags2,
+ &newname,
+ &pdata[20],
+ len,
+ STR_TERMINATE,
+ &status);
+ }
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -6571,9 +6636,25 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- srvstr_get_path(ctx, pdata, req->flags2, &newname,
- &pdata[20], len, STR_TERMINATE,
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(ctx,
+ pdata,
+ req->flags2,
+ &newname,
+ &pdata[20],
+ len,
+ STR_TERMINATE,
&status);
+ } else {
+ srvstr_get_path(ctx,
+ pdata,
+ req->flags2,
+ &newname,
+ &pdata[20],
+ len,
+ STR_TERMINATE,
+ &status);
+ }
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -8493,9 +8574,25 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
}
info_level = SVAL(params,0);
- srvstr_get_path(req, params, req->flags2, &fname, ¶ms[6],
- total_params - 6, STR_TERMINATE,
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(req,
+ params,
+ req->flags2,
+ &fname,
+ ¶ms[6],
+ total_params - 6,
+ STR_TERMINATE,
&status);
+ } else {
+ srvstr_get_path(req,
+ params,
+ req->flags2,
+ &fname,
+ ¶ms[6],
+ total_params - 6,
+ STR_TERMINATE,
+ &status);
+ }
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
return;
@@ -8631,9 +8728,25 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
return;
}
- srvstr_get_path(ctx, params, req->flags2, &directory, ¶ms[4],
- total_params - 4, STR_TERMINATE,
+ if (lp_posix_pathnames()) {
+ srvstr_get_path_posix(ctx,
+ params,
+ req->flags2,
+ &directory,
+ ¶ms[4],
+ total_params - 4,
+ STR_TERMINATE,
&status);
+ } else {
+ srvstr_get_path(ctx,
+ params,
+ req->flags2,
+ &directory,
+ ¶ms[4],
+ total_params - 4,
+ STR_TERMINATE,
+ &status);
+ }
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
return;
--
2.5.0
>From 068b1b06d3edc2f90f87f9dda07bbc06e93cb10b Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:27:55 -0800
Subject: [PATCH 09/19] s3: smbd: srvstr_get_path() is now only called when
lp_posix_pathnames() is false.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 33 ++++++++++-----------------------
1 file changed, 10 insertions(+), 23 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 104151c..e412016 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -366,29 +366,16 @@ size_t srvstr_get_path(TALLOC_CTX *ctx,
NTSTATUS *err)
{
bool ignore;
- if (lp_posix_pathnames()) {
- return srvstr_get_path_wcard_internal(ctx,
- base_ptr,
- smb_flags2,
- pp_dest,
- src,
- src_len,
- flags,
- true,
- err,
- &ignore);
- } else {
- return srvstr_get_path_wcard_internal(ctx,
- base_ptr,
- smb_flags2,
- pp_dest,
- src,
- src_len,
- flags,
- false,
- err,
- &ignore);
- }
+ return srvstr_get_path_wcard_internal(ctx,
+ base_ptr,
+ smb_flags2,
+ pp_dest,
+ src,
+ src_len,
+ flags,
+ false,
+ err,
+ &ignore);
}
/****************************************************************************
--
2.5.0
>From c2366154d60592b27127168c7da90b557981b99a Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:35:10 -0800
Subject: [PATCH 10/19] s3: smbd: VFS change. Add new field bool
posix_pathnames into struct smb_request.
Initialize from lp_posix_pathnames() global.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/include/vfs.h | 3 +++
source3/smbd/process.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 17bd8fa..cb41387 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -169,6 +169,7 @@
/* Version 33 - Remove notify_watch_fn */
/* Bump to version 34 - Samba 4.4 will ship with that */
/* Version 34 - Remove bool posix_open, add uint64_t posix_flags */
+/* Version 34 - Added bool posix_pathnames to struct smb_request */
#define SMB_VFS_INTERFACE_VERSION 34
@@ -462,6 +463,8 @@ struct smb_request {
struct smb_request **chain;
struct timeval request_time;
+
+ bool posix_pathnames;
};
/*
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index c99c75e..79ca91f 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -629,6 +629,7 @@ static bool init_smb_request(struct smb_request *req,
req->smb2req = NULL;
req->priv_paths = NULL;
req->chain = NULL;
+ req->posix_pathnames = lp_posix_pathnames();
smb_init_perfcount_data(&req->pcd);
/* Ensure we have at least wct words and 2 bytes of bcc. */
--
2.5.0
>From 5290b94b63675e3f3647714baba0559fd01d6596 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:36:57 -0800
Subject: [PATCH 11/19] s3: smbd: Now struct smb_request has a bool
posix_pathnames, remove the lp_posix_pathnames() call inside
srvstr_get_path_req_wcard().
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index e412016..f7edc3b 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -417,7 +417,7 @@ size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
return 0;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
return srvstr_get_path_wcard_internal(mem_ctx,
(const char *)req->inbuf,
req->flags2,
--
2.5.0
>From 33d334c02ba9af34b65baf338fdb533530d8feac Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:41:45 -0800
Subject: [PATCH 12/19] s3: smbd: Replace most uses of lp_posix_pathnames()
with req->posix_pathnames in reply.c
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/reply.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index f7edc3b..47b773c 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1276,7 +1276,7 @@ void reply_checkpath(struct smb_request *req)
struct smb_filename *smb_fname = NULL;
char *name = NULL;
NTSTATUS status;
- uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcheckpath);
@@ -1391,7 +1391,7 @@ void reply_getatr(struct smb_request *req)
size = 0;
mtime = 0;
} else {
- uint32_t ucf_flags = (lp_posix_pathnames() ?
+ uint32_t ucf_flags = (req->posix_pathnames ?
UCF_POSIX_PATHNAMES : 0);
status = filename_convert(ctx,
conn,
@@ -1478,7 +1478,7 @@ void reply_setatr(struct smb_request *req)
time_t mtime;
const char *p;
NTSTATUS status;
- uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBsetatr);
@@ -1755,7 +1755,7 @@ void reply_search(struct smb_request *req)
goto out;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
reply_unknown_new(req, req->cmd);
goto out;
}
@@ -1784,7 +1784,7 @@ void reply_search(struct smb_request *req)
if (status_len == 0) {
uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
nt_status = filename_convert(ctx, conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
path,
@@ -1866,7 +1866,7 @@ void reply_search(struct smb_request *req)
* For a 'continue' search we have no string. So
* check from the initial saved string.
*/
- if (!lp_posix_pathnames()) {
+ if (!req->posix_pathnames) {
mask_contains_wcard = ms_has_wild(mask);
}
dirtype = dptr_attr(sconn, dptr_num);
@@ -2023,7 +2023,7 @@ void reply_fclose(struct smb_request *req)
START_PROFILE(SMBfclose);
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
reply_unknown_new(req, req->cmd);
END_PROFILE(SMBfclose);
return;
@@ -2087,7 +2087,7 @@ void reply_open(struct smb_request *req)
uint32_t private_flags = 0;
NTSTATUS status;
uint32_t ucf_flags = UCF_PREP_CREATEFILE |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBopen);
@@ -2241,7 +2241,7 @@ void reply_open_and_X(struct smb_request *req)
uint32_t create_options = 0;
uint32_t private_flags = 0;
uint32_t ucf_flags = UCF_PREP_CREATEFILE |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBopenX);
@@ -2501,7 +2501,7 @@ void reply_mknew(struct smb_request *req)
uint32_t create_disposition;
uint32_t create_options = 0;
uint32_t ucf_flags = UCF_PREP_CREATEFILE |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcreate);
@@ -2634,7 +2634,7 @@ void reply_ctemp(struct smb_request *req)
NTSTATUS status;
int i;
uint32_t ucf_flags = UCF_PREP_CREATEFILE |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBctemp);
@@ -2840,7 +2840,7 @@ static NTSTATUS do_unlink(connection_struct *conn,
uint32_t dirtype_orig = dirtype;
NTSTATUS status;
int ret;
- bool posix_paths = lp_posix_pathnames();
+ bool posix_paths = req->posix_pathnames;
DEBUG(10,("do_unlink: %s, dirtype = %d\n",
smb_fname_str_dbg(smb_fname),
@@ -3179,7 +3179,7 @@ void reply_unlink(struct smb_request *req)
NTSTATUS status;
bool path_contains_wcard = False;
uint32_t ucf_flags = UCF_COND_ALLOW_WCARD_LCOMP |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBunlink);
@@ -6089,7 +6089,7 @@ void reply_mkdir(struct smb_request *req)
char *directory = NULL;
NTSTATUS status;
uint32_t ucf_flags = UCF_PREP_CREATEFILE |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBmkdir);
@@ -6160,7 +6160,7 @@ void reply_rmdir(struct smb_request *req)
TALLOC_CTX *ctx = talloc_tos();
files_struct *fsp = NULL;
int info = 0;
- uint32_t ucf_flags = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
struct smbd_server_connection *sconn = req->sconn;
START_PROFILE(SMBrmdir);
@@ -6855,7 +6855,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
char *talloced = NULL;
long offset = 0;
int create_options = 0;
- bool posix_pathnames = lp_posix_pathnames();
+ bool posix_pathnames = req->posix_pathnames;
int rc;
/*
@@ -7197,11 +7197,11 @@ 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() ?
+ uint32_t src_ucf_flags = (req->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 :
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES :
UCF_COND_ALLOW_WCARD_LCOMP);
bool stream_rename = false;
@@ -7229,7 +7229,7 @@ void reply_mv(struct smb_request *req)
goto out;
}
- if (!lp_posix_pathnames()) {
+ if (!req->posix_pathnames) {
/* The newname must begin with a ':' if the
name contains a ':'. */
if (strchr_m(name, ':')) {
@@ -7514,9 +7514,9 @@ void reply_copy(struct smb_request *req)
bool dest_has_wild = False;
NTSTATUS status;
uint32_t ucf_flags_src = UCF_COND_ALLOW_WCARD_LCOMP |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
uint32_t ucf_flags_dst = UCF_COND_ALLOW_WCARD_LCOMP |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBcopy);
--
2.5.0
>From b55fa09d05563cbd579f310e27bb2ba6667e86c5 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:44:10 -0800
Subject: [PATCH 13/19] s3: smbd: Replace most uses of lp_posix_pathnames()
with req->posix_pathnames in nttrans.c
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/nttrans.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 6d9db1f..b5fbbfd 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -462,7 +462,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
uint8_t oplock_granted = NO_OPLOCK_RETURN;
struct case_semantics_state *case_state = NULL;
uint32_t ucf_flags = UCF_PREP_CREATEFILE |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
START_PROFILE(SMBntcreateX);
@@ -762,7 +762,7 @@ static void do_nt_transact_create_pipe(connection_struct *conn,
flags = IVAL(params,0);
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(ctx,
params,
req->flags2,
@@ -1019,7 +1019,7 @@ static void call_nt_transact_create(connection_struct *conn,
uint8_t oplock_granted;
struct case_semantics_state *case_state = NULL;
uint32_t ucf_flags = UCF_PREP_CREATEFILE |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
DEBUG(5,("call_nt_transact_create\n"));
@@ -1068,7 +1068,7 @@ static void call_nt_transact_create(connection_struct *conn,
*/
create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK;
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(ctx,
params,
req->flags2,
@@ -1560,8 +1560,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 = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
- uint32_t ucf_flags_dst = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags_src = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags_dst = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
uint16_t rename_type;
TALLOC_CTX *ctx = talloc_tos();
bool stream_rename = false;
@@ -1584,7 +1584,7 @@ void reply_ntrename(struct smb_request *req)
goto out;
}
- if (!lp_posix_pathnames() && ms_has_wild(oldname)) {
+ if (!req->posix_pathnames && ms_has_wild(oldname)) {
reply_nterror(req, NT_STATUS_OBJECT_PATH_SYNTAX_BAD);
goto out;
}
@@ -1597,7 +1597,7 @@ void reply_ntrename(struct smb_request *req)
goto out;
}
- if (!lp_posix_pathnames()) {
+ if (!req->posix_pathnames) {
/* The newname must begin with a ':' if the
oldname contains a ':'. */
if (strchr_m(oldname, ':')) {
@@ -1867,7 +1867,7 @@ static void call_nt_transact_rename(connection_struct *conn,
if (!check_fsp(conn, req, fsp)) {
return;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_wcard_posix(ctx,
params,
req->flags2,
--
2.5.0
>From 6d224ca9f2091d8d866e048ebe248184516d4256 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:45:30 -0800
Subject: [PATCH 14/19] s3: smbd: Remove *all* uses of lp_posix_pathnames()
from open.c
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/open.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index d728782..ace197c 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2529,7 +2529,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
}
/* this is for OS/2 long file names - say we don't support them */
- if (!lp_posix_pathnames() && strstr(smb_fname->base_name,".+,;=[].")) {
+ if (req != NULL && !req->posix_pathnames &&
+ strstr(smb_fname->base_name,".+,;=[].")) {
/* OS/2 Workplace shell fix may be main code stream in a later
* release. */
DEBUG(5,("open_file_ntcreate: OS/2 long filenames are not "
@@ -4828,7 +4829,8 @@ 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 = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = ((req != NULL && req->posix_pathnames) ?
+ UCF_POSIX_PATHNAMES : 0);
NTSTATUS status;
if (root_dir_fid == 0 || !smb_fname) {
@@ -5040,7 +5042,7 @@ NTSTATUS create_file_default(connection_struct *conn,
status = NT_STATUS_NOT_A_DIRECTORY;
goto fail;
}
- if (lp_posix_pathnames()) {
+ if (req != NULL && req->posix_pathnames) {
ret = SMB_VFS_LSTAT(conn, smb_fname);
} else {
ret = SMB_VFS_STAT(conn, smb_fname);
--
2.5.0
>From 27cf9e0cff3d29721e728e215e3b0f37f9e1f0e7 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:49:55 -0800
Subject: [PATCH 15/19] s3: smbd: Convert all but one use of
lp_posix_pathnames() into req->posix_pathnames in trans2.c
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/trans2.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index e8909a7..75be763 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 = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
/*
@@ -1131,7 +1131,7 @@ static void call_trans2open(connection_struct *conn,
goto out;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(ctx,
params,
req->flags2,
@@ -2495,7 +2495,7 @@ static void call_trans2findfirst(connection_struct *conn,
struct dptr_struct *dirptr = NULL;
struct smbd_server_connection *sconn = req->sconn;
uint32_t ucf_flags = UCF_SAVE_LCOMP | UCF_ALWAYS_ALLOW_WCARD_LCOMP |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
bool backup_priv = false;
bool as_root = false;
@@ -2553,7 +2553,7 @@ close_if_end = %d requires_resume_key = %d backup_priv = %d level = 0x%x, max_da
goto out;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_wcard_posix(ctx,
params,
req->flags2,
@@ -2929,7 +2929,7 @@ static void call_trans2findnext(connection_struct *conn,
if (!continue_bit) {
/* We only need resume_name if continue_bit is zero. */
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_wcard_posix(ctx,
params,
req->flags2,
@@ -5595,7 +5595,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
} else {
uint32_t name_hash;
char *fname = NULL;
- uint32_t ucf_flags = (lp_posix_pathnames() ?
+ uint32_t ucf_flags = (req->posix_pathnames ?
UCF_POSIX_PATHNAMES : 0);
/* qpathinfo */
@@ -5620,7 +5620,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
}
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(req,
params,
req->flags2,
@@ -6442,7 +6442,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 = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
NTSTATUS status = NT_STATUS_OK;
@@ -6451,7 +6451,7 @@ static NTSTATUS smb_set_file_unix_hlink(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(ctx,
pdata,
req->flags2,
@@ -6508,7 +6508,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
char *newname = NULL;
struct smb_filename *smb_fname_dst = NULL;
uint32_t ucf_flags = UCF_SAVE_LCOMP |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
NTSTATUS status = NT_STATUS_OK;
TALLOC_CTX *ctx = talloc_tos();
@@ -6527,7 +6527,7 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(ctx,
pdata,
req->flags2,
@@ -6618,7 +6618,7 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
struct smb_filename *smb_fname_dst = NULL;
NTSTATUS status = NT_STATUS_OK;
uint32_t ucf_flags = UCF_SAVE_LCOMP |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
if (!fsp) {
@@ -6636,7 +6636,7 @@ static NTSTATUS smb_file_link_information(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(ctx,
pdata,
req->flags2,
@@ -6726,7 +6726,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_wcard_posix(ctx,
pdata,
req->flags2,
@@ -8564,7 +8564,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
}
} else {
char *fname = NULL;
- uint32_t ucf_flags = (lp_posix_pathnames() ?
+ uint32_t ucf_flags = (req->posix_pathnames ?
UCF_POSIX_PATHNAMES : 0);
/* set path info */
@@ -8574,7 +8574,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
}
info_level = SVAL(params,0);
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(req,
params,
req->flags2,
@@ -8715,7 +8715,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 = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0);
TALLOC_CTX *ctx = talloc_tos();
if (!CAN_WRITE(conn)) {
@@ -8728,7 +8728,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
return;
}
- if (lp_posix_pathnames()) {
+ if (req->posix_pathnames) {
srvstr_get_path_posix(ctx,
params,
req->flags2,
--
2.5.0
>From 179a2e747b281ac6c00d5da921be4a7a909ce537 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:52:10 -0800
Subject: [PATCH 16/19] s3: smbd: smb2_create.c - remove all uses of
lp_posix_pathnames().
Currently SMB2/3 doesn't do POSIX pathname processing.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/smb2_create.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index db706f0..54a598d 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -379,8 +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 |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
NTSTATUS status;
if (lease_ptr == NULL) {
@@ -1006,8 +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 |
- (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = UCF_PREP_CREATEFILE;
if (requested_oplock_level == SMB2_OPLOCK_LEVEL_LEASE) {
if (lease_ptr == NULL) {
--
2.5.0
>From 71cfd5b4e89c4c8a15abb109dada545ee0d69a30 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 13:55:21 -0800
Subject: [PATCH 17/19] s3: smbd: Replace lp_posix_pathnames() with
smbreq->posix_pathnames in smb2_query_directory.c.
Currently SMB2/3 doesn't do posix pathname processing, leave this
as a placeholder for when SMB2 unix extensions are added.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/smb2_query_directory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c
index 57c1393..4b6ca1b 100644
--- a/source3/smbd/smb2_query_directory.c
+++ b/source3/smbd/smb2_query_directory.c
@@ -325,7 +325,7 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
dptr_CloseDir(fsp);
}
- if (!lp_posix_pathnames()) {
+ if (!smbreq->posix_pathnames) {
wcard_has_wild = ms_has_wild(in_file_name);
}
@@ -337,7 +337,7 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
char *to_free = NULL;
uint32_t ucf_flags = UCF_SAVE_LCOMP |
UCF_ALWAYS_ALLOW_WCARD_LCOMP |
- (lp_posix_pathnames() ?
+ (smbreq->posix_pathnames ?
UCF_POSIX_PATHNAMES : 0);
if (ISDOT(fsp->fsp_name->base_name)) {
--
2.5.0
>From df8888dad9058132eaa79f497d30396781c99067 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 14:09:52 -0800
Subject: [PATCH 18/19] s3: smbd: Remove lp_posix_pathnames() checks on paths
sent in via old Win9X RPC calls.
No unix client makes these.
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 fd71650..b1e9d13 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 = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = 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 = (lp_posix_pathnames() ? UCF_POSIX_PATHNAMES : 0);
+ uint32_t ucf_flags = 0;
ZERO_STRUCT(st);
--
2.5.0
>From 18f2354f9b0a6faf594b7e20ba2137438c12eb46 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Tue, 22 Dec 2015 14:46:36 -0800
Subject: [PATCH 19/19] s3: smbd: Replace lp_posix_pathnames() with
req->posix_pathnames in dir.c. Only one remaining.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/smbd/dir.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index ad57294..a322bb5 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -485,7 +485,7 @@ NTSTATUS dptr_create(connection_struct *conn,
if (smb_dname == NULL) {
return NT_STATUS_NO_MEMORY;
}
- if (lp_posix_pathnames()) {
+ if (req != NULL && req->posix_pathnames) {
ret = SMB_VFS_LSTAT(conn, smb_dname);
} else {
ret = SMB_VFS_STAT(conn, smb_dname);
@@ -545,7 +545,8 @@ NTSTATUS dptr_create(connection_struct *conn,
TALLOC_FREE(dir_hnd);
return NT_STATUS_NO_MEMORY;
}
- if (lp_posix_pathnames() || (wcard[0] == '.' && wcard[1] == 0)) {
+ if ((req != NULL && req->posix_pathnames) ||
+ (wcard[0] == '.' && wcard[1] == 0)) {
dptr->has_wild = True;
} else {
dptr->has_wild = wcard_has_wild;
--
2.5.0
More information about the samba-technical
mailing list