summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-14 12:03:11 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-14 12:03:11 +0100
commit02af3663a457ebc6aa30e79614e44fb16be8cadd (patch)
treec4497d370126fbf328df34e7a1257eac2c58f386 /source4/ntvfs
parent21c0f266616e093cccbaf9378b3a915e56ba6079 (diff)
parentb640f475be9b0f83e7812a5c7756344c5891cba3 (diff)
downloadsamba-02af3663a457ebc6aa30e79614e44fb16be8cadd.tar.gz
samba-02af3663a457ebc6aa30e79614e44fb16be8cadd.tar.bz2
samba-02af3663a457ebc6aa30e79614e44fb16be8cadd.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-trivial
(This used to be commit 50697762fd28e2fc77142c5fea528b12d4cc0ebc)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/posix/pvfs_setfileinfo.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c b/source4/ntvfs/posix/pvfs_setfileinfo.c
index 340913cd4d..9c78699edb 100644
--- a/source4/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_setfileinfo.c
@@ -63,6 +63,11 @@ static uint32_t pvfs_setfileinfo_access(union smb_setfileinfo *info)
}
break;
+ case RAW_SFILEINFO_RENAME_INFORMATION:
+ case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
+ needed = SEC_STD_DELETE;
+ break;
+
default:
needed = SEC_FILE_WRITE_ATTRIBUTE;
break;
@@ -84,7 +89,8 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs,
char *new_name, *p;
/* renames are only allowed within a directory */
- if (strchr_m(info->rename_information.in.new_name, '\\')) {
+ if (strchr_m(info->rename_information.in.new_name, '\\') &&
+ (req->ctx->protocol != PROTOCOL_SMB2)) {
return NT_STATUS_NOT_SUPPORTED;
}
@@ -98,24 +104,32 @@ static NTSTATUS pvfs_setfileinfo_rename(struct pvfs_state *pvfs,
return NT_STATUS_INVALID_PARAMETER;
}
- /* w2k3 does not appear to allow relative rename */
- if (info->rename_information.in.root_fid != 0) {
+ /* w2k3 does not appear to allow relative rename. On SMB2, vista sends it sometimes,
+ but I suspect it is just uninitialised memory */
+ if (info->rename_information.in.root_fid != 0 &&
+ (req->ctx->protocol != PROTOCOL_SMB2)) {
return NT_STATUS_INVALID_PARAMETER;
}
/* construct the fully qualified windows name for the new file name */
- new_name = talloc_strdup(req, name->original_name);
- if (new_name == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- p = strrchr_m(new_name, '\\');
- if (p == NULL) {
- return NT_STATUS_OBJECT_NAME_INVALID;
- }
- *p = 0;
+ if (req->ctx->protocol == PROTOCOL_SMB2) {
+ /* SMB2 sends the full path of the new name */
+ new_name = talloc_asprintf(req, "\\%s", info->rename_information.in.new_name);
+ } else {
+ new_name = talloc_strdup(req, name->original_name);
+ if (new_name == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ p = strrchr_m(new_name, '\\');
+ if (p == NULL) {
+ return NT_STATUS_OBJECT_NAME_INVALID;
+ } else {
+ *p = 0;
+ }
- new_name = talloc_asprintf(req, "%s\\%s", new_name,
- info->rename_information.in.new_name);
+ new_name = talloc_asprintf(req, "%s\\%s", new_name,
+ info->rename_information.in.new_name);
+ }
if (new_name == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -369,6 +383,7 @@ NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
break;
case RAW_SFILEINFO_RENAME_INFORMATION:
+ case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
return pvfs_setfileinfo_rename(pvfs, req, h->name,
info);
@@ -566,6 +581,7 @@ NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
return NT_STATUS_OK;
case RAW_SFILEINFO_RENAME_INFORMATION:
+ case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
return pvfs_setfileinfo_rename(pvfs, req, name,
info);