From: Jeremy Allison Date: Wed, 20 Jul 2016 18:25:20 +0000 (-0700) Subject: s3: smbd: Change lp_set_posix_pathnames() to take a newval parameter and return the... X-Git-Tag: samba-4.3.12~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e2f99c7245b910bf213829a6df97acefa224945;p=thirdparty%2Fsamba.git s3: smbd: Change lp_set_posix_pathnames() to take a newval parameter and return the old one. Currently only used in one place, but we'll need to use it to temporarily change pathname processing to fix bug 12021. This (hack) is only needed for 4.4.x and below, it is fixed correctly in 4.5.x. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12021 Signed-off-by: Jeremy Allison --- diff --git a/source3/include/proto.h b/source3/include/proto.h index 88be15aeb53..afa43d262ea 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1054,7 +1054,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 4d6f0665f3f..62186e59f1b 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4344,13 +4344,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/trans2.c b/source3/smbd/trans2.c index 6d50dd3f4ae..87aab59ff72 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -4093,7 +4093,7 @@ static void call_trans2setfsinfo(connection_struct *conn, /* Here is where we must switch to posix pathname processing... */ if (xconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) { - lp_set_posix_pathnames(); + (void)lp_set_posix_pathnames(true); mangle_change_to_posix(); }