The branch, master has been updated
       via  0afb299 Fix bug #7791 - gvfsd-smb (Gnome vfs) fails to copy files 
from a SMB share using SMB signing.
       via  ac0ffba Add test that detects problems in the SMB signing code when 
run through cli_write() (which doesn't use the new async methods).
      from  c4c230b autobuild: perfer to use git mail address in autobuild 
comment

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0afb2995a2177afa2eb7b8f99887a39cdaf23a15
Author: Jeremy Allison <j...@samba.org>
Date:   Wed Nov 10 17:59:05 2010 -0800

    Fix bug #7791 - gvfsd-smb (Gnome vfs) fails to copy files from a SMB share 
using SMB signing.
    
    The underlying problem is that the old code invoked by cli_write() 
increments
    cli->mid directly when issuing outstanding writes. This should now be done 
only
    in libsmb/clientgen.c to make metze's new signing engine works correctly. 
Just
    deleting this code fixes the problem.
    
    Jeremy.
    
    Autobuild-User: Jeremy Allison <j...@samba.org>
    Autobuild-Date: Thu Nov 11 02:50:08 UTC 2010 on sn-devel-104

commit ac0ffba004160693ea5829775d732146ef261c47
Author: Jeremy Allison <j...@samba.org>
Date:   Wed Nov 10 17:54:57 2010 -0800

    Add test that detects problems in the SMB signing code when run through 
cli_write() (which doesn't use the new async methods).
    
    Unfortunately, and I think due to the socket wrapper code, this doesn't
    detect the failure on the build farm, but running the RW-SIGNING test
    separately against a Samba or Windows server using signing does.
    
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 selftest/target/Samba3.pm                  |    2 +
 source3/libsmb/clireadwrite.c              |    7 +---
 source3/script/tests/test_smbtorture_s3.sh |    2 +-
 source3/torture/torture.c                  |   46 +++++++++++++++++++++-------
 4 files changed, 40 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index f1387d9..1326949 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -525,6 +525,8 @@ sub provision($$$$$$)
 
        max protocol = SMB2
        read only = no
+       server signing = auto
+
        smbd:sharedelay = 100000
 #      smbd:writetimeupdatedelay = 500000
        map hidden = no
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index 370c068..cd95b17 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -703,8 +703,7 @@ static bool cli_issue_write(struct cli_state *cli,
                                off_t offset,
                                uint16 mode,
                                const char *buf,
-                               size_t size,
-                               int i)
+                               size_t size)
 {
        char *p;
        bool large_writex = false;
@@ -778,8 +777,6 @@ static bool cli_issue_write(struct cli_state *cli,
                cli_setup_bcc(cli, p+size);
        }
 
-       SSVAL(cli->outbuf,smb_mid,cli->mid + i);
-
        show_msg(cli->outbuf);
        if (direct_writes) {
                /* For direct writes we now need to write the data
@@ -828,7 +825,7 @@ ssize_t cli_write(struct cli_state *cli,
                        if (!cli_issue_write(cli, fnum, offset + bsent,
                                        write_mode,
                                        buf + bsent,
-                                       size1, issued))
+                                       size1))
                                return -1;
                        issued++;
                }
diff --git a/source3/script/tests/test_smbtorture_s3.sh 
b/source3/script/tests/test_smbtorture_s3.sh
index 1abf7b6..4680f64 100755
--- a/source3/script/tests/test_smbtorture_s3.sh
+++ b/source3/script/tests/test_smbtorture_s3.sh
@@ -28,7 +28,7 @@ tests="FDPASS LOCK1 LOCK2 LOCK3 LOCK4 LOCK5 LOCK6 LOCK7 LOCK9"
 #tests="$tests UNLINK BROWSE ATTR TRANS2 MAXFID TORTURE "
 tests="$tests UNLINK BROWSE ATTR TRANS2 TORTURE "
 tests="$tests OPLOCK1 OPLOCK2 OPLOCK3 STREAMERROR"
-tests="$tests DIR DIR1 DIR-CREATETIME TCON TCONDEV RW1 RW2 RW3"
+tests="$tests DIR DIR1 DIR-CREATETIME TCON TCONDEV RW1 RW2 RW3 RW-SIGNING"
 tests="$tests OPEN XCOPY RENAME DELETE PROPERTIES W2K"
 tests="$tests TCON2 IOCTL CHKPATH FDSESS LOCAL-SUBSTITUTE CHAIN1"
 tests="$tests GETADDRINFO POSIX UID-REGRESSION-TEST SHORTNAME-TEST"
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 161c6f9..f69d734 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -52,6 +52,7 @@ static fstring multishare_conn_fname;
 static bool use_multishare_conn = False;
 static bool do_encrypt;
 static const char *local_path = NULL;
+static int signing_state = Undefined;
 
 bool torture_showall = False;
 
@@ -178,7 +179,7 @@ static struct cli_state *open_nbt_connection(void)
 
         zero_sockaddr(&ss);
 
-       if (!(c = cli_initialise())) {
+       if (!(c = cli_initialise_ex(signing_state))) {
                printf("Failed initialize cli_struct to connect with %s\n", 
host);
                return NULL;
        }
@@ -311,7 +312,7 @@ static struct cli_state *open_bad_nbt_connection(void)
 
         zero_sockaddr(&ss);
 
-       if (!(c = cli_initialise())) {
+       if (!(c = cli_initialise_ex(signing_state))) {
                printf("Failed initialize cli_struct to connect with %s\n", 
host);
                return NULL;
        }
@@ -412,7 +413,7 @@ static bool torture_open_connection_share(struct cli_state 
**c,
                                     hostname, NULL, port_to_use, 
                                     sharename, "?????", 
                                     username, workgroup, 
-                                    password, flags, Undefined, &retry);
+                                    password, flags, signing_state, &retry);
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to open share connection: //%s/%s port:%d - 
%s\n",
                        hostname, sharename, port_to_use, nt_errstr(status));
@@ -887,7 +888,7 @@ static bool run_readwritemulti(int dummy)
        return test;
 }
 
-static bool run_readwritelarge(int dummy)
+static bool run_readwritelarge_internal(int max_xmit_k)
 {
        static struct cli_state *cli1;
        uint16_t fnum1;
@@ -902,9 +903,17 @@ static bool run_readwritelarge(int dummy)
        cli_sockopt(cli1, sockops);
        memset(buf,'\0',sizeof(buf));
 
-       cli1->max_xmit = 128*1024;
+       cli1->max_xmit = max_xmit_k*1024;
+
+       if (signing_state == Required) {
+               /* Horrible cheat to force
+                  multiple signed outstanding
+                  packets against a Samba server.
+               */
+               cli1->is_samba = false;
+       }
 
-       printf("starting readwritelarge\n");
+       printf("starting readwritelarge_internal\n");
 
        cli_unlink(cli1, lockfname, aSYSTEM | aHIDDEN);
 
@@ -923,10 +932,10 @@ static bool run_readwritelarge(int dummy)
        }
 
        if (fsize == sizeof(buf))
-               printf("readwritelarge test 1 succeeded (size = %lx)\n", 
+               printf("readwritelarge_internal test 1 succeeded (size = 
%lx)\n",
                       (unsigned long)fsize);
        else {
-               printf("readwritelarge test 1 failed (size = %lx)\n", 
+               printf("readwritelarge_internal test 1 failed (size = %lx)\n",
                       (unsigned long)fsize);
                correct = False;
        }
@@ -958,10 +967,10 @@ static bool run_readwritelarge(int dummy)
        }
 
        if (fsize == sizeof(buf))
-               printf("readwritelarge test 2 succeeded (size = %lx)\n", 
+               printf("readwritelarge_internal test 2 succeeded (size = 
%lx)\n",
                       (unsigned long)fsize);
        else {
-               printf("readwritelarge test 2 failed (size = %lx)\n", 
+               printf("readwritelarge_internal test 2 failed (size = %lx)\n",
                       (unsigned long)fsize);
                correct = False;
        }
@@ -992,6 +1001,20 @@ static bool run_readwritelarge(int dummy)
        return correct;
 }
 
+static bool run_readwritelarge(int dummy)
+{
+       return run_readwritelarge_internal(128);
+}
+
+static bool run_readwritelarge_signtest(int dummy)
+{
+       bool ret;
+       signing_state = Required;
+       ret = run_readwritelarge_internal(2);
+       signing_state = Undefined;
+       return ret;
+}
+
 int line_count = 0;
 int nbio_id;
 
@@ -1440,7 +1463,7 @@ static bool run_tcon_devtype_test(int dummy)
                                     host, NULL, port_to_use,
                                     NULL, NULL,
                                     username, workgroup,
-                                    password, flags, Undefined, &retry);
+                                    password, flags, signing_state, &retry);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("could not open connection\n");
@@ -7782,6 +7805,7 @@ static struct {
        {"RW1",  run_readwritetest, 0},
        {"RW2",  run_readwritemulti, FLAG_MULTIPROC},
        {"RW3",  run_readwritelarge, 0},
+       {"RW-SIGNING",  run_readwritelarge_signtest, 0},
        {"OPEN", run_opentest, 0},
        {"POSIX", run_simple_posix_open_test, 0},
        {"POSIX-APPEND", run_posix_append, 0},


-- 
Samba Shared Repository

Reply via email to