summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-12-01 13:31:43 -0800
committerJeremy Allison <jra@samba.org>2008-12-01 13:31:43 -0800
commit8edd7752447e178d2e99b23997d475790efb5af2 (patch)
tree07679e1d4bf3eede6e4ed564e1b0aff735a3e427 /source3
parent936037c7dabab1654d4d5e398b2a6ef2d640fc17 (diff)
downloadsamba-8edd7752447e178d2e99b23997d475790efb5af2.tar.gz
samba-8edd7752447e178d2e99b23997d475790efb5af2.tar.bz2
samba-8edd7752447e178d2e99b23997d475790efb5af2.zip
s3:smbd: construct the correct newname for stream renames
The Windows Explorer creates temporary streams and renames them later via SFILEINFO_RENAME_INFO. The newname comes in as ":Stream:$DATA". metze
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/trans2.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 9719d5c386..8532c85d7b 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -5353,26 +5353,42 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
return NT_STATUS_NOT_SUPPORTED;
}
- /* Create the base directory. */
- base_name = talloc_strdup(ctx, fname);
- if (!base_name) {
- return NT_STATUS_NO_MEMORY;
- }
- p = strrchr_m(base_name, '/');
- if (p) {
- p[1] = '\0';
+ if (fsp && fsp->base_fsp) {
+ if (newname[0] != ':') {
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+ base_name = talloc_asprintf(ctx, "%s%s",
+ fsp->base_fsp->fsp_name,
+ newname);
+ if (!base_name) {
+ return NT_STATUS_NO_MEMORY;
+ }
} else {
- base_name = talloc_strdup(ctx, "./");
+ if (is_ntfs_stream_name(newname)) {
+ return NT_STATUS_NOT_SUPPORTED;
+ }
+
+ /* Create the base directory. */
+ base_name = talloc_strdup(ctx, fname);
+ if (!base_name) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ p = strrchr_m(base_name, '/');
+ if (p) {
+ p[1] = '\0';
+ } else {
+ base_name = talloc_strdup(ctx, "./");
+ if (!base_name) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
+ /* Append the new name. */
+ base_name = talloc_asprintf_append(base_name,
+ "%s",
+ newname);
if (!base_name) {
return NT_STATUS_NO_MEMORY;
}
- }
- /* Append the new name. */
- base_name = talloc_asprintf_append(base_name,
- "%s",
- newname);
- if (!base_name) {
- return NT_STATUS_NO_MEMORY;
}
if (fsp) {