The Samba-Bugzilla – Attachment 13377 Details for
Bug 12899
smbclient "setmode" no longer works to clear attribute bits due to dialect upgrade
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for master.
0001-s3-smbclient-Allow-last-dos-attribute-to-be-cleared.patch (text/plain), 2.67 KB, created by
Jeremy Allison
on 2017-07-13 20:04:42 UTC
(
hide
)
Description:
git-am fix for master.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2017-07-13 20:04:42 UTC
Size:
2.67 KB
patch
obsolete
>From acdb8809436bb924d23ad03790cac2069caca5f3 Mon Sep 17 00:00:00 2001 >From: Steve French <smfrench@gmail.com> >Date: Thu, 13 Jul 2017 13:57:53 -0500 >Subject: [PATCH] s3:smbclient: Allow last dos attribute to be cleared > >With the upgrade to SMB3.1.1 from cifs for smbclient, >setmode no longer works when removing attributes, >if the resultant attribute is 0 it is skipped >(unlike for the old cifs setpathinfo). > >When clearing the final attribute, pass in ATTRIBUTE_NORMAL >instead of zero. > >This also removes a redundant cli_setatr call >when clearing attributes (cli_setatr was being called >twice). > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12899 > >Signed-off-by: Steve French <sfrench@samba.org> >Reviewed-by: Anne Marie Merritt <annemarie.merritt@primarydata.com> >Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com> >Reviewed-by: Jeremy Allison <jra@samba.org> >--- > source3/client/client.c | 24 +++++++++++++++++++++--- > 1 file changed, 21 insertions(+), 3 deletions(-) > >diff --git a/source3/client/client.c b/source3/client/client.c >index d8c96e68190..aa8d949bd0c 100644 >--- a/source3/client/client.c >+++ b/source3/client/client.c >@@ -4961,11 +4961,21 @@ int set_remote_attr(const char *filename, uint16_t new_attr, int mode) > } > > if (mode == ATTR_SET) { >+ if (new_attr == old_attr) { >+ d_printf("attributes unchanged, cli_setatr skipped\n"); >+ return 0; >+ } > new_attr |= old_attr; > } else { > new_attr = old_attr & ~new_attr; > } >- >+ /* >+ * if we are clearing attributes - can't pass 0 in >+ * since that means "skip this field. See MS-FSCC section 2.6 >+ */ >+ if (new_attr == 0) { >+ new_attr = FILE_ATTRIBUTE_NORMAL; >+ } > status = cli_setatr(cli, filename, new_attr, 0); > if (!NT_STATUS_IS_OK(status)) { > d_printf("cli_setatr failed: %s\n", nt_errstr(status)); >@@ -4990,6 +5000,8 @@ int cmd_setmode(void) > int mode = ATTR_SET; > int err = 0; > bool ok; >+ bool set = false; >+ bool unset = false; > TALLOC_CTX *ctx = talloc_new(NULL); > if (ctx == NULL) { > return 1; >@@ -5017,9 +5029,11 @@ int cmd_setmode(void) > while (*s) { > switch (*s++) { > case '+': >+ set = true; > mode = ATTR_SET; > break; > case '-': >+ unset = true; > mode = ATTR_UNSET; > break; > case 'r': >@@ -5051,8 +5065,12 @@ int cmd_setmode(void) > DEBUG(2, ("perm set %d %d\n", attr[ATTR_SET], attr[ATTR_UNSET])); > > /* ignore return value: server might not store DOS attributes */ >- set_remote_attr(fname, attr[ATTR_SET], ATTR_SET); >- set_remote_attr(fname, attr[ATTR_UNSET], ATTR_UNSET); >+ if (set) { >+ set_remote_attr(fname, attr[ATTR_SET], ATTR_SET); >+ } >+ if (unset) { >+ set_remote_attr(fname, attr[ATTR_UNSET], ATTR_UNSET); >+ } > out: > talloc_free(ctx); > return err; >-- >2.13.2.932.g7449e964c-goog >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 12899
:
13376
|
13377
|
13387
|
13398
|
13433