The Samba-Bugzilla – Attachment 13398 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 4.7.0
47.patch (text/plain), 4.40 KB, created by
Jeremy Allison
on 2017-07-18 18:49:59 UTC
(
hide
)
Description:
git-am fix for 4.7.0
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2017-07-18 18:49:59 UTC
Size:
4.40 KB
patch
obsolete
>From 8d87c90cc36275f11d488c6bc9d4cdf3c01b817a Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Mon, 17 Jul 2017 10:37:15 -0700 >Subject: [PATCH 1/2] s3: libsmb: Reverse sense of 'clear all attributes', > ignore attribute change in SMB2 to match SMB1. > >SMB1 uses attr == 0 to clear all attributes >on a file (end up with FILE_ATTRIBUTE_NORMAL), >and attr == FILE_ATTRIBUTE_NORMAL to mean ignore >request attribute change. > >SMB2 uses exactly the reverse. Unfortunately as the >cli_setatr() ABI is exposed inside libsmbclient, >we must make the SMB2 cli_smb2_setatr() call >export the same ABI as the SMB1 cli_setatr() >which calls it. This means reversing the sense >of the requested attr argument if it's zero >or FILE_ATTRIBUTE_NORMAL. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12899 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com> >(cherry picked from commit f1cc79a46d56bda99c392d491d88479cd6427a32) >--- > source3/libsmb/cli_smb2_fnum.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > >diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c >index 954f3fe3a7f..6967555797a 100644 >--- a/source3/libsmb/cli_smb2_fnum.c >+++ b/source3/libsmb/cli_smb2_fnum.c >@@ -1698,6 +1698,29 @@ NTSTATUS cli_smb2_setatr(struct cli_state *cli, > inbuf.length = sizeof(inbuf_store); > data_blob_clear(&inbuf); > >+ /* >+ * SMB1 uses attr == 0 to clear all attributes >+ * on a file (end up with FILE_ATTRIBUTE_NORMAL), >+ * and attr == FILE_ATTRIBUTE_NORMAL to mean ignore >+ * request attribute change. >+ * >+ * SMB2 uses exactly the reverse. Unfortunately as the >+ * cli_setatr() ABI is exposed inside libsmbclient, >+ * we must make the SMB2 cli_smb2_setatr() call >+ * export the same ABI as the SMB1 cli_setatr() >+ * which calls it. This means reversing the sense >+ * of the requested attr argument if it's zero >+ * or FILE_ATTRIBUTE_NORMAL. >+ * >+ * See BUG: https://bugzilla.samba.org/show_bug.cgi?id=12899 >+ */ >+ >+ if (attr == 0) { >+ attr = FILE_ATTRIBUTE_NORMAL; >+ } else if (attr == FILE_ATTRIBUTE_NORMAL) { >+ attr = 0; >+ } >+ > SSVAL(inbuf.data, 32, attr); > if (mtime != 0) { > put_long_date((char *)inbuf.data + 16,mtime); >-- >2.13.2.932.g7449e964c-goog > > >From 1a8424af855cf6952edbe1827a3571c2c8b8bfa4 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Tue, 18 Jul 2017 11:15:28 -0700 >Subject: [PATCH 2/2] s3: smbclient: Add a test for the setmode command. > >Tested over SMB1 and SMB2. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12899 > >Back ported from 5facd045efe88783ba078c14793d05439bcc5a4b in master. > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/script/tests/test_smbclient_s3.sh | 51 +++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > >diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh >index 4cfd054b018..ae8ae675b81 100755 >--- a/source3/script/tests/test_smbclient_s3.sh >+++ b/source3/script/tests/test_smbclient_s3.sh >@@ -1189,6 +1189,53 @@ EOF > fi > } > >+# Test smbclient setmode command >+test_setmode() >+{ >+ tmpfile=$PREFIX/smbclient_interactive_prompt_commands >+ >+ cat > $tmpfile <<EOF >+del test_setmode >+put ${SMBCLIENT} test_setmode >+setmode test_setmode +r +s +h +a >+allinfo test_setmode >+setmode test_setmode -rsha >+allinfo test_setmode >+del test_setmode >+quit >+EOF >+ cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' >+ eval echo "$cmd" >+ out=`eval $cmd` >+ ret=$? >+ >+ if [ $ret != 0 ] ; then >+ echo "$out" >+ echo "failed setmode test with output $ret" >+ false >+ return >+ fi >+ >+ echo "$out" | grep 'attributes: RHSA' >+ ret=$? >+ if [ $ret -ne 0 ] ; then >+ echo "$out" >+ echo "failed - should get attributes: RHSA" >+ false >+ return >+ fi >+ >+ echo "$out" | grep 'attributes: (80)' >+ ret=$? >+ if [ $ret -ne 0 ] ; then >+ echo "$out" >+ echo "failed - should also get attributes: (80)" >+ false >+ return >+ fi >+} >+ >+ > test_server_os_message() > { > tmpfile=$PREFIX/smbclient_interactive_prompt_commands >@@ -1330,6 +1377,10 @@ testit "server os message" \ > test_server_os_message || \ > failed=`expr $failed + 1` > >+testit "setmode test" \ >+ test_setmode || \ >+ failed=`expr $failed + 1` >+ > testit "rm -rf $LOGDIR" \ > rm -rf $LOGDIR || \ > failed=`expr $failed + 1` >-- >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
Flags:
jra
:
review?
(
rsharpe
)
slow
:
review+
Actions:
View
Attachments on
bug 12899
:
13376
|
13377
|
13387
| 13398 |
13433