summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-01-20 16:27:56 -0800
committerJeremy Allison <jra@samba.org>2011-01-20 16:27:56 -0800
commitbb54f72b94dca9206bf377b0d6a4b669e389e339 (patch)
tree9f7ade27a231d49d6b7e03dab7da5f4e84976c30 /source3/smbd/reply.c
parent330b922bd6a80ccbdc6122012ce1ed273fd3f2e0 (diff)
downloadsamba-bb54f72b94dca9206bf377b0d6a4b669e389e339.tar.gz
samba-bb54f72b94dca9206bf377b0d6a4b669e389e339.tar.bz2
samba-bb54f72b94dca9206bf377b0d6a4b669e389e339.zip
Make processing of incoming stream rename paths common between reply_mv and ntrename. Ensure we don't depend on "./" in the streams module.
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index e5067cca7e..ac103a33a0 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -6532,6 +6532,7 @@ 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;
+ bool stream_rename = false;
START_PROFILE(SMBmv);
@@ -6557,6 +6558,18 @@ void reply_mv(struct smb_request *req)
goto out;
}
+ if (!lp_posix_pathnames()) {
+ /* The newname must begin with a ':' if the
+ name contains a ':'. */
+ if (strchr_m(name, ':')) {
+ if (newname[0] != ':') {
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ goto out;
+ }
+ stream_rename = true;
+ }
+ }
+
status = filename_convert(ctx,
conn,
req->flags2 & FLAGS2_DFS_PATHNAMES,
@@ -6593,6 +6606,18 @@ void reply_mv(struct smb_request *req)
goto out;
}
+ if (stream_rename) {
+ /* smb_fname_dst->base_name must be the same as
+ smb_fname_src->base_name. */
+ TALLOC_FREE(smb_fname_dst->base_name);
+ smb_fname_dst->base_name = talloc_strdup(smb_fname_dst,
+ smb_fname_src->base_name);
+ if (!smb_fname_dst->base_name) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ goto out;
+ }
+ }
+
DEBUG(3,("reply_mv : %s -> %s\n", smb_fname_str_dbg(smb_fname_src),
smb_fname_str_dbg(smb_fname_dst)));