From 333fcba1deff1b097a2c9a3e7d1d3194997f0513 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 Oct 2009 15:36:36 -0700 Subject: [PATCH] Cope with old CIFSFS clients that use SMBunlink to remove symlinks instead of trans2:posix_unlink. Jeremy. --- source3/smbd/reply.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index abc316315ae..2365ed1da14 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2383,6 +2383,8 @@ static NTSTATUS do_unlink(connection_struct *conn, files_struct *fsp; uint32 dirtype_orig = dirtype; NTSTATUS status; + int ret; + bool posix_paths = lp_posix_pathnames(); DEBUG(10,("do_unlink: %s, dirtype = %d\n", smb_fname_str_dbg(smb_fname), @@ -2392,7 +2394,12 @@ static NTSTATUS do_unlink(connection_struct *conn, return NT_STATUS_MEDIA_WRITE_PROTECTED; } - if (SMB_VFS_LSTAT(conn, smb_fname) != 0) { + if (posix_paths) { + ret = SMB_VFS_LSTAT(conn, smb_fname); + } else { + ret = SMB_VFS_LSTAT(conn, smb_fname); + } + if (ret != 0) { return map_nt_error_from_unix(errno); } @@ -2479,7 +2486,9 @@ static NTSTATUS do_unlink(connection_struct *conn, FILE_SHARE_NONE, /* share_access */ FILE_OPEN, /* create_disposition*/ FILE_NON_DIRECTORY_FILE, /* create_options */ - FILE_ATTRIBUTE_NORMAL, /* file_attributes */ + /* file_attributes */ + posix_paths ? FILE_FLAG_POSIX_SEMANTICS|0777 : + FILE_ATTRIBUTE_NORMAL, 0, /* oplock_request */ 0, /* allocation_size */ NULL, /* sd */ -- 2.34.1