>From 2285104af27a4d102c4d682188b5279c51cc89d0 Mon Sep 17 00:00:00 2001 From: Josh Paetzel Date: Wed, 20 Jul 2016 16:13:04 -0500 Subject: [PATCH 2/3] The real samba fix. Again, trusting jra. https://attachments.samba.org/attachment.cgi?id=12282 Ticket: #15808 (cherry picked from commit f2fb04fbae9886623c2d4464a2386531d39ad566) --- source3/include/proto.h | 2 +- source3/param/loadparm.c | 9 +++++---- source3/smbd/close.c | 10 ++++++++++ source3/smbd/open.c | 10 ++++++++++ source3/smbd/trans2.c | 2 +- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 4b86db0..2a4231b 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1096,7 +1096,7 @@ bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state); void set_use_sendfile(int snum, bool val); void lp_set_mangling_method(const char *new_method); bool lp_posix_pathnames(void); -void lp_set_posix_pathnames(void); +bool lp_set_posix_pathnames(bool newval); enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp); void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val); int lp_min_receive_file_size(void); diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index cda6129..45965c7 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4320,13 +4320,14 @@ bool lp_posix_pathnames(void) } /******************************************************************* - Change everything needed to ensure POSIX pathname processing (currently - not much). + Set posix pathnames to new value. Returns old value. ********************************************************************/ -void lp_set_posix_pathnames(void) +bool lp_set_posix_pathnames(bool newval) { - posix_pathnames = true; + bool oldval = posix_pathnames; + posix_pathnames = newval; + return oldval; } /******************************************************************* diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 1cb5460..66840ae 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -168,6 +168,7 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname) unsigned int num_streams = 0; TALLOC_CTX *frame = talloc_stackframe(); NTSTATUS status; + bool saved_posix_pathnames; status = vfs_streaminfo(conn, NULL, fname, talloc_tos(), &num_streams, &stream_info); @@ -192,6 +193,13 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname) return NT_STATUS_OK; } + /* + * Any stream names *must* be treated as Windows + * pathnames, even if we're using UNIX extensions. + */ + + saved_posix_pathnames = lp_set_posix_pathnames(false); + for (i=0; ismb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) { - lp_set_posix_pathnames(); + (void)lp_set_posix_pathnames(true); mangle_change_to_posix(); } -- 2.9.2