From 5c520c04c2abbaa2c36a2f917c3eecbf86c869ba Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Fri, 29 Apr 2011 15:45:23 -0400 Subject: [PATCH] s3: don't error out on opens only with SMB_O_TRUNC set When samba gets an open call with only SMB_O_TRUNC|O_WRONLY (or O_RDWR), it currently returns an NT_STATUS_INVALID_PARAMETER error. SMB_O_TRUNC on its own like this should be fine however. Signed-off-by: Jeff Layton --- source3/smbd/trans2.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index abab387..cdec4b0 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -7294,6 +7294,8 @@ static NTSTATUS smb_posix_open(connection_struct *conn, create_disp = FILE_OPEN_IF; } else if ((wire_open_mode & (SMB_O_CREAT | SMB_O_EXCL | SMB_O_TRUNC)) == 0) { create_disp = FILE_OPEN; + } else if (wire_open_mode & SMB_O_TRUNC) { + create_disp = FILE_OVERWRITE; } else { DEBUG(5,("smb_posix_open: invalid create mode 0x%x\n", (unsigned int)wire_open_mode )); -- 1.7.4.4