1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

Fix bug #5986 - Editing a stream is broken (rename problems).

Jeremy.
This commit is contained in:
Jeremy Allison 2008-12-19 13:59:12 -08:00
parent ae1d6020f0
commit 6eda98dd13
2 changed files with 14 additions and 11 deletions

View File

@ -5515,7 +5515,9 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
}
if(replace_if_exists && dst_exists) {
if (is_ntfs_stream_name(newname)) {
/* Ensure both or neither are stream names. */
if (is_ntfs_stream_name(fsp->fsp_name) !=
is_ntfs_stream_name(newname)) {
return NT_STATUS_INVALID_PARAMETER;
}
}

View File

@ -5372,6 +5372,8 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
char *newname = NULL;
char *base_name = NULL;
bool dest_has_wcard = False;
SMB_STRUCT_STAT sbuf;
char *newname_last_component = NULL;
NTSTATUS status = NT_STATUS_OK;
char *p;
TALLOC_CTX *ctx = talloc_tos();
@ -5380,6 +5382,8 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
ZERO_STRUCT(sbuf);
overwrite = (CVAL(pdata,0) ? True : False);
root_fid = IVAL(pdata,4);
len = IVAL(pdata,8);
@ -5413,6 +5417,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
}
if (fsp && fsp->base_fsp) {
/* newname must be a stream name. */
if (newname[0] != ':') {
return NT_STATUS_NOT_SUPPORTED;
}
@ -5423,6 +5428,7 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
return NT_STATUS_NO_MEMORY;
}
} else {
/* newname must *not* be a stream name. */
if (is_ntfs_stream_name(newname)) {
return NT_STATUS_NOT_SUPPORTED;
}
@ -5448,13 +5454,6 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
if (!base_name) {
return NT_STATUS_NO_MEMORY;
}
}
if (fsp) {
SMB_STRUCT_STAT sbuf;
char *newname_last_component = NULL;
ZERO_STRUCT(sbuf);
status = unix_convert(ctx, conn, newname, False,
&newname,
@ -5469,7 +5468,9 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
status)) {
return status;
}
}
if (fsp) {
DEBUG(10,("smb_file_rename_information: SMB_FILE_RENAME_INFORMATION (fnum %d) %s -> %s\n",
fsp->fnum, fsp->fsp_name, base_name ));
status = rename_internals_fsp(conn, fsp, base_name,