summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-12-28 00:24:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:45 -0500
commit48c3f76b2e6bc197c6977d22480a31e7f4b10b69 (patch)
tree16c6503b69f518848d99163b585fe722e3befc66
parent3430c1ddb825a458f294e48c351be010698bad69 (diff)
downloadsamba-48c3f76b2e6bc197c6977d22480a31e7f4b10b69.tar.gz
samba-48c3f76b2e6bc197c6977d22480a31e7f4b10b69.tar.bz2
samba-48c3f76b2e6bc197c6977d22480a31e7f4b10b69.zip
r20372: Make NTrename the same as SMBmv w.r.t. wildcards.
Jeremy. (This used to be commit b8d5faac69f3a0c2620a34f9026b4018ebd48bb8)
-rw-r--r--source3/smbd/nttrans.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 68c5b46189..6359f931c0 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1724,14 +1724,15 @@ int reply_ntrename(connection_struct *conn,
pstring newname;
char *p;
NTSTATUS status;
- BOOL path_contains_wcard = False;
+ BOOL path1_contains_wcard = False;
+ BOOL path2_contains_wcard = False;
uint32 attrs = SVAL(inbuf,smb_vwv0);
uint16 rename_type = SVAL(inbuf,smb_vwv1);
START_PROFILE(SMBntrename);
p = smb_buf(inbuf) + 1;
- p += srvstr_get_path_wcard(inbuf, oldname, p, sizeof(oldname), 0, STR_TERMINATE, &status, &path_contains_wcard);
+ p += srvstr_get_path_wcard(inbuf, oldname, p, sizeof(oldname), 0, STR_TERMINATE, &status, &path1_contains_wcard);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBntrename);
return ERROR_NT(status);
@@ -1749,7 +1750,7 @@ int reply_ntrename(connection_struct *conn,
}
p++;
- p += srvstr_get_path(inbuf, newname, p, sizeof(newname), 0, STR_TERMINATE, &status);
+ p += srvstr_get_path_wcard(inbuf, newname, p, sizeof(newname), 0, STR_TERMINATE, &status, &path2_contains_wcard);
if (!NT_STATUS_IS_OK(status)) {
END_PROFILE(SMBntrename);
return ERROR_NT(status);
@@ -1762,13 +1763,18 @@ int reply_ntrename(connection_struct *conn,
switch(rename_type) {
case RENAME_FLAG_RENAME:
- status = rename_internals(conn, oldname, newname, attrs, False, path_contains_wcard);
+ status = rename_internals(conn, oldname, newname, attrs, False, path1_contains_wcard);
break;
case RENAME_FLAG_HARD_LINK:
- status = hardlink_internals(conn, oldname, newname);
+ if (path1_contains_wcard || path2_contains_wcard) {
+ /* No wildcards. */
+ status = NT_STATUS_OBJECT_PATH_SYNTAX_BAD;
+ } else {
+ status = hardlink_internals(conn, oldname, newname);
+ }
break;
case RENAME_FLAG_COPY:
- if (path_contains_wcard) {
+ if (path1_contains_wcard || path2_contains_wcard) {
/* No wildcards. */
status = NT_STATUS_OBJECT_PATH_SYNTAX_BAD;
} else {