From 812006fa8f26004609901b0ddef1c3ed05eff35e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Jul 2017 09:56:45 -0700 Subject: [PATCH] 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 --- source3/libsmb/clirap.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index dd2c30e2258..f897df63053 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 */ -- 2.11.4.GIT