From: Jeremy Allison Date: Fri, 21 Jul 2017 16:56:45 +0000 (-0700) Subject: s3: libsmbclient: Fix cli_setpathinfo_basic() to treat mode == -1 as no change. X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=812006fa8f26004609901b0ddef1c3ed05eff35e;p=metze%2Fsamba%2Fwip.git s3: libsmbclient: Fix cli_setpathinfo_basic() to treat mode == -1 as no change. This is only called from SMBC_setatr(), so bring it into line with the specification for that function. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12913 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index dd2c30e2258b..f897df630532 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -732,8 +732,17 @@ NTSTATUS cli_setpathinfo_basic(struct cli_state *cli, const char *fname, put_long_date(p, change_time); p += 8; - /* Add attributes */ - SIVAL(p, 0, mode); + if (mode == (uint16_t)-1 || mode == FILE_ATTRIBUTE_NORMAL) { + /* No change. */ + mode = 0; + } else if (mode == 0) { + /* Clear all existing attributes. */ + mode = FILE_ATTRIBUTE_NORMAL; + } + + /* Add attributes */ + SIVAL(p, 0, mode); + p += 4; /* Add padding */