summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2016-03-09 16:00:47 -0800
committerJeremy Allison <jra@samba.org>2016-03-10 20:55:09 +0100
commitb4246f863ce15865a772b0be7a949a46688bcc34 (patch)
tree89cd738a32f96e655cb0b301c5777b07b830f1bc /source3
parent153af65e445e8491fb436e7112b579ed4603ca01 (diff)
downloadsamba-b4246f863ce15865a772b0be7a949a46688bcc34.tar.gz
s3:lib: Move internal lp_posix_pathnames() call out of utility function synthetic_smb_fname_split().
Make it a passed in parameter instead. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/lib/filename_util.c5
-rw-r--r--source3/smbd/filename.c3
-rw-r--r--source3/smbd/pysmbd.c8
-rw-r--r--source3/smbd/reply.c4
-rw-r--r--source3/torture/cmd_vfs.c28
6 files changed, 37 insertions, 14 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 224db9ad132..dc8fee91963 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1141,7 +1141,8 @@ struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
const char *stream_name,
const SMB_STRUCT_STAT *psbuf);
struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX *ctx,
- const char *fname);
+ const char *fname,
+ bool posix_path);
const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
const char *fsp_str_dbg(const struct files_struct *fsp);
const char *fsp_fnum_dbg(const struct files_struct *fsp);
diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c
index 025a943ecf3..6ee91eca247 100644
--- a/source3/lib/filename_util.c
+++ b/source3/lib/filename_util.c
@@ -73,14 +73,15 @@ struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
* There are a few legitimate users of this.
*/
struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX *ctx,
- const char *fname)
+ const char *fname,
+ bool posix_path)
{
char *stream_name = NULL;
char *base_name = NULL;
struct smb_filename *ret;
bool ok;
- if (lp_posix_pathnames()) {
+ if (posix_path) {
/* No stream name looked for. */
return synthetic_smb_fname(ctx, fname, NULL, NULL);
}
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index fc56b245fbf..dffa71d7b67 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -1423,7 +1423,8 @@ static NTSTATUS filename_convert_internal(TALLOC_CTX *ctx,
ZERO_STRUCT(st);
st.st_ex_nlink = 1;
*pp_smb_fname = synthetic_smb_fname_split(ctx,
- name_in);
+ name_in,
+ (ucf_flags & UCF_POSIX_PATHNAMES));
if (*pp_smb_fname == NULL) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c
index 41f0e3f0aa0..4d95bcff01b 100644
--- a/source3/smbd/pysmbd.c
+++ b/source3/smbd/pysmbd.c
@@ -124,7 +124,9 @@ static NTSTATUS set_nt_acl_conn(const char *fname,
so set our umask to 0 */
saved_umask = umask(0);
- smb_fname = synthetic_smb_fname_split(fsp, fname);
+ smb_fname = synthetic_smb_fname_split(fsp,
+ fname,
+ lp_posix_pathnames());
if (smb_fname == NULL) {
TALLOC_FREE(frame);
umask(saved_umask);
@@ -446,7 +448,9 @@ static PyObject *py_smbd_unlink(PyObject *self, PyObject *args, PyObject *kwargs
return NULL;
}
- smb_fname = synthetic_smb_fname_split(frame, fname);
+ smb_fname = synthetic_smb_fname_split(frame,
+ fname,
+ lp_posix_pathnames());
if (smb_fname == NULL) {
TALLOC_FREE(frame);
return PyErr_NoMemory();
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 673b735568e..3fb07fb0454 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -6645,7 +6645,9 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
* component of the destination.
*/
smb_fname_orig_lcomp = synthetic_smb_fname_split(
- ctx, smb_fname_dst->original_lcomp);
+ ctx,
+ smb_fname_dst->original_lcomp,
+ lp_posix_pathnames());
if (smb_fname_orig_lcomp == NULL) {
status = NT_STATUS_NO_MEMORY;
TALLOC_FREE(fname_dst_lcomp_base_mod);
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c
index a06947c1dc4..7c49ce78db8 100644
--- a/source3/torture/cmd_vfs.c
+++ b/source3/torture/cmd_vfs.c
@@ -354,7 +354,9 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
}
fsp->conn = vfs->conn;
- smb_fname = synthetic_smb_fname_split(NULL, argv[1]);
+ smb_fname = synthetic_smb_fname_split(NULL,
+ argv[1],
+ lp_posix_pathnames());
if (smb_fname == NULL) {
TALLOC_FREE(fsp);
return NT_STATUS_NO_MEMORY;
@@ -584,12 +586,16 @@ static NTSTATUS cmd_rename(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- smb_fname_src = synthetic_smb_fname_split(mem_ctx, argv[1]);
+ smb_fname_src = synthetic_smb_fname_split(mem_ctx,
+ argv[1],
+ lp_posix_pathnames());
if (smb_fname_src == NULL) {
return NT_STATUS_NO_MEMORY;
}
- smb_fname_dst = synthetic_smb_fname_split(mem_ctx, argv[2]);
+ smb_fname_dst = synthetic_smb_fname_split(mem_ctx,
+ argv[2],
+ lp_posix_pathnames());
if (smb_fname_dst == NULL) {
TALLOC_FREE(smb_fname_src);
return NT_STATUS_NO_MEMORY;
@@ -644,7 +650,9 @@ static NTSTATUS cmd_stat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
return NT_STATUS_OK;
}
- smb_fname = synthetic_smb_fname_split(mem_ctx, argv[1]);
+ smb_fname = synthetic_smb_fname_split(mem_ctx,
+ argv[1],
+ lp_posix_pathnames());
if (smb_fname == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -783,7 +791,9 @@ static NTSTATUS cmd_lstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- smb_fname = synthetic_smb_fname_split(mem_ctx, argv[1]);
+ smb_fname = synthetic_smb_fname_split(mem_ctx,
+ argv[1],
+ lp_posix_pathnames());
if (smb_fname == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -1043,7 +1053,9 @@ static NTSTATUS cmd_utime(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
ft.atime = convert_time_t_to_timespec(atoi(argv[2]));
ft.mtime = convert_time_t_to_timespec(atoi(argv[3]));
- smb_fname = synthetic_smb_fname_split(mem_ctx, argv[1]);
+ smb_fname = synthetic_smb_fname_split(mem_ctx,
+ argv[1],
+ lp_posix_pathnames());
if (smb_fname == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -1530,7 +1542,9 @@ static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
}
fsp->conn = vfs->conn;
- smb_fname = synthetic_smb_fname_split(NULL, argv[1]);
+ smb_fname = synthetic_smb_fname_split(NULL,
+ argv[1],
+ lp_posix_pathnames());
if (smb_fname == NULL) {
TALLOC_FREE(fsp);
return NT_STATUS_NO_MEMORY;