[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Dec 23 20:28:03 UTC 2015
The branch, master has been updated
via 2efa2e0 s3: smbd: Replace lp_posix_pathnames() with req->posix_pathnames in dir.c. Only one remaining.
via 52bae79 s3: smbd: Remove lp_posix_pathnames() checks on paths sent in via old Win9X RPC calls.
via 398ee27 s3: smbd: Replace lp_posix_pathnames() with smbreq->posix_pathnames in smb2_query_directory.c.
via 944e940 s3: smbd: smb2_create.c - remove all uses of lp_posix_pathnames().
via a2f025e s3: smbd: Convert all but one use of lp_posix_pathnames() into req->posix_pathnames in trans2.c
via 3cd1b18 s3: smbd: Remove *all* uses of lp_posix_pathnames() from open.c
via 865bd48 s3: smbd: Replace most uses of lp_posix_pathnames() with req->posix_pathnames in nttrans.c
via 6db6bc2 s3: smbd: Replace most uses of lp_posix_pathnames() with req->posix_pathnames in reply.c
via 40df6f2 s3: smbd: Now struct smb_request has a bool posix_pathnames, remove the lp_posix_pathnames() call inside srvstr_get_path_req_wcard().
via 4587d83 s3: smbd: VFS change. Add new field bool posix_pathnames into struct smb_request.
via cc729ae s3: smbd: srvstr_get_path() is now only called when lp_posix_pathnames() is false.
via 88bb480 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().
via c78d739 s3: smbd: Add srvstr_get_path_posix().
via 5740761 s3: smbd: We now know that srvstr_get_path_wcard() is only called when lp_posix_pathnames() is false.
via 41d62df 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().
via eb7198f s3: smbd: Add srvstr_get_path_wcard_posix().
via db36ee4 s3: smbd: Move lp_posix_pathnames() out into srvstr_get_path_req_wcard().
via 5a34069 s3: smbd: Move lp_posix_pathnames() out into srvstr_get_path().
via 4a6d7e1 s3: smbd: Move lp_posix_pathnames() out of srvstr_get_path_wcard_internal().
from f33224d net: Fix Coverity ID 241039 Unchecked return value
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 2efa2e08a440579827e18bbe14225e4f2513c232
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 14:46:36 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Dec 23 21:27:46 CET 2015 on sn-devel-144
commit 52bae7927cecbf43d98f29c57da45d49873a15dd
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 14:09:52 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 398ee270de106e3cb8d5ca01282aa7692ac1d815
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:55:21 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 944e94013c1367d65766cab83eccbacc79326445
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:52:10 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit a2f025e26bb10e6574ea9b8d877eff75697e469e
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:49:55 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 3cd1b185bd49da6c61b2df24d097c99bc8fee032
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:45:30 2015 -0800
s3: smbd: Remove *all* uses of lp_posix_pathnames() from open.c
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 865bd48f3ac5072f9f69521d56338f1c74b861f7
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:44:10 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 6db6bc204fc911106d36d5690de765dc4d61e34b
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:41:45 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 40df6f23f33348761a6fbd39c73de1b6e2ed190c
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:36:57 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 4587d83f075a82665a48b52087b2704d2105882e
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:35:10 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit cc729ae47d87a4659590af86e5389f37d17a523f
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:27:55 2015 -0800
s3: smbd: srvstr_get_path() is now only called when lp_posix_pathnames() is false.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 88bb4801c0c7632caf6b1b059aa07d56cf215c60
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:26:49 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit c78d73986d69f52699d576c3d0cad157feef13a8
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:18:03 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 5740761e78711b59b1b7734bbbc76ddb55c3abc8
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:14:41 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 41d62dfcb6179ff760a35e38d73009ae3761c533
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:13:44 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit eb7198f9991c5baba241dd2897107ba80dd6a817
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:07:49 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit db36ee422bc45147169997c0217ea43b104efcec
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:04:11 2015 -0800
s3: smbd: Move lp_posix_pathnames() out into srvstr_get_path_req_wcard().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 5a340698755fa591f0d2b7a63d50f41c051e487b
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 13:01:08 2015 -0800
s3: smbd: Move lp_posix_pathnames() out into srvstr_get_path().
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
commit 4a6d7e1e1599634d4bcfa7cf00eb6f5f4a4aa177
Author: Jeremy Allison <jra at samba.org>
Date: Tue Dec 22 12:52:58 2015 -0800
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>
Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
-----------------------------------------------------------------------
Summary of changes:
source3/include/vfs.h | 3 +
source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 4 +-
source3/smbd/dir.c | 5 +-
source3/smbd/nttrans.c | 79 ++++++++--
source3/smbd/open.c | 8 +-
source3/smbd/process.c | 1 +
source3/smbd/proto.h | 17 +++
source3/smbd/reply.c | 167 ++++++++++++++++++----
source3/smbd/smb2_create.c | 6 +-
source3/smbd/smb2_query_directory.c | 4 +-
source3/smbd/trans2.c | 230 +++++++++++++++++++++++++-----
11 files changed, 437 insertions(+), 87 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 71e1af9..66e4fc6 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
@@ -464,6 +465,8 @@ struct smb_request {
struct smb_request **chain;
struct timeval request_time;
+
+ bool posix_pathnames;
};
/*
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);
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;
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 6ef4c5a..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,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 (req->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;
@@ -1003,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"));
@@ -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 (req->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;
@@ -1528,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;
@@ -1552,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;
}
@@ -1565,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, ':')) {
@@ -1835,9 +1867,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 (req->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/open.c b/source3/smbd/open.c
index d4f257c..3c0a7a3 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);
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. */
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 55e8286..847a191 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,
@@ -855,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 b1ca7a5..77d5b6e 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,59 @@ 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,
+ false,
+ err,
+ contains_wcard);
+}
+
+/****************************************************************************
+ 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.
****************************************************************************/
@@ -311,10 +366,46 @@ 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);
+ return srvstr_get_path_wcard_internal(ctx,
+ base_ptr,
+ smb_flags2,
+ pp_dest,
+ src,
+ src_len,
+ flags,
+ false,
+ err,
+ &ignore);
+}
+
+/****************************************************************************
+ 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)
@@ -326,9 +417,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 (req->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,
@@ -1165,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);
@@ -1280,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,
@@ -1367,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);
@@ -1644,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;
}
@@ -1673,7 +1784,7 @@ void reply_search(struct smb_request *req)
if (status_len == 0) {
uint32_t ucf_flags = UCF_ALWAYS_ALLOW_WCARD_LCOMP |
--
Samba Shared Repository
More information about the samba-cvs
mailing list