The branch, v4-0-test has been updated
       via  7ff37ef selftest: teardown the environments also on getting SIGPIPE
       via  fac9504 libwbclient: allow only one initial_blob/challenge_blob in 
wbcCredentialCache()
       via  f484138 s3: libwbclient: Don't break out of loop too soon - find 
all parameters.
       via  375c351 s3:smb2_read: let smb2_sendfile_send_data() behave like 
send_file_readX()
      from  cfbd1da torture4: Make raw.lock.multilock fail after 20 seconds

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 7ff37efe2d268b6b1d438f80d0f5b73f437348ac
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Jul 10 14:28:56 2014 +0200

    selftest: teardown the environments also on getting SIGPIPE
    
    make test uses
    
    selftest.pl | subuntu-filter.py ...
    
    FAIL_IMMEDIATELY=1 lets subuntu-filter.py exit,
    which generates SIGPIPE in selftest.pl.
    
    We should handle this just like any other signal
    and teardown all environments.
    
    This should make the teardown process more reliable/verbose.
    
    Pair-Programmed-With: Michael Adam <ob...@samba.org>
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Signed-off-by: Michael Adam <ob...@samba.org>
    (cherry picked from commit b2803950fc439017680069813fc49255a3f0cbbf)
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10696
    backport autobuild/selftest fixes from master
    
    Autobuild-User(v4-0-test): Karolin Seeger <ksee...@samba.org>
    Autobuild-Date(v4-0-test): Tue Jul 15 14:34:31 CEST 2014 on sn-devel-104

commit fac95046b5eeebf740284dbf1c673ad3188df8d9
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Jul 10 05:28:36 2014 +0200

    libwbclient: allow only one initial_blob/challenge_blob in 
wbcCredentialCache()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10692
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit f484138ba90924e4e0ef24d201f903abaee709d1
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Jul 8 16:36:30 2014 -0700

    s3: libwbclient: Don't break out of loop too soon - find all parameters.
    
    Fix bug #10692: wbcCredentialCache fails if challenge_blob is not first
    
    https://bugzilla.samba.org/show_bug.cgi?id=10692
    
    Signed-off-by: Jeremy Allison <j...@samba.org>

commit 375c351dbe1a89f804c55d003cc17d67afd62ba9
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Jul 10 21:08:06 2014 +0200

    s3:smb2_read: let smb2_sendfile_send_data() behave like send_file_readX()
    
    We now pass the header to SMB_VFS_SENDFILE(), so we have to handle that also
    in the fallback code.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=10706
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Fri Jul 11 22:57:17 CEST 2014 on sn-devel-104
    
    (cherry picked from commit 7c5ea400ad1f280f5c338c31a0a893154340fdb3)

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

Summary of changes:
 nsswitch/libwbclient/wbc_pam.c |   30 +++++++++++------
 selftest/selftest.pl           |   25 +++++++++------
 source3/smbd/smb2_read.c       |   69 ++++++++++++++++++++++++++++++---------
 3 files changed, 87 insertions(+), 37 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/libwbclient/wbc_pam.c b/nsswitch/libwbclient/wbc_pam.c
index f183cc6..ae70d67 100644
--- a/nsswitch/libwbclient/wbc_pam.c
+++ b/nsswitch/libwbclient/wbc_pam.c
@@ -1208,6 +1208,25 @@ wbcErr wbcCredentialCache(struct 
wbcCredentialCacheParams *params,
                goto fail;
        }
 
+       for (i=0; i<params->num_blobs; i++) {
+               if (strcasecmp(params->blobs[i].name, "initial_blob") == 0) {
+                       if (initial_blob != NULL) {
+                               status = WBC_ERR_INVALID_PARAM;
+                               goto fail;
+                       }
+                       initial_blob = &params->blobs[i];
+                       continue;
+               }
+               if (strcasecmp(params->blobs[i].name, "challenge_blob") == 0) {
+                       if (challenge_blob != NULL) {
+                               status = WBC_ERR_INVALID_PARAM;
+                               goto fail;
+                       }
+                       challenge_blob = &params->blobs[i];
+                       continue;
+               }
+       }
+
        if (params->domain_name != NULL) {
                status = wbcRequestResponse(WINBINDD_INFO, NULL, &response);
                if (!WBC_ERROR_IS_OK(status)) {
@@ -1225,17 +1244,6 @@ wbcErr wbcCredentialCache(struct 
wbcCredentialCacheParams *params,
        }
        request.data.ccache_ntlm_auth.uid = getuid();
 
-       for (i=0; i<params->num_blobs; i++) {
-               if (strcasecmp(params->blobs[i].name, "initial_blob") == 0) {
-                       initial_blob = &params->blobs[i];
-                       break;
-               }
-               if (strcasecmp(params->blobs[i].name, "challenge_blob") == 0) {
-                       challenge_blob = &params->blobs[i];
-                       break;
-               }
-       }
-
        request.data.ccache_ntlm_auth.initial_blob_len = 0;
        request.data.ccache_ntlm_auth.challenge_blob_len = 0;
        request.extra_len = 0;
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index b516eef..a823652 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -61,14 +61,6 @@ my $prefix = "./st";
 my @includes = ();
 my @excludes = ();
 
-sub pipe_handler {
-       my $sig = shift @_;
-       print STDERR "Exiting early because of SIGPIPE.\n";
-       exit(1);
-}
-
-$SIG{PIPE} = \&pipe_handler;
-
 sub find_in_list($$)
 {
        my ($list, $fullname) = @_;
@@ -721,12 +713,24 @@ my @exported_envvars = (
         "GID_RFC2307TEST"
 );
 
-$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub { 
+sub sighandler($)
+{
        my $signame = shift;
+
+       $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = 'DEFAULT';
+       $SIG{PIPE} = 'IGNORE';
+
+       open(STDOUT, ">&STDERR") or die "can't dup STDOUT to STDERR: $!";
+
+       print "$0: PID[$$]: Got SIG${signame} teardown environments.\n";
        teardown_env($_) foreach(keys %running_envs);
-       die("Received signal $signame");
+       system("pstree -p $$");
+       print "$0: PID[$$]: Exiting...\n";
+       exit(1);
 };
 
+$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = $SIG{PIPE} = \&sighandler;
+
 sub setup_env($$)
 {
        my ($name, $prefix) = @_;
@@ -822,6 +826,7 @@ sub teardown_env($)
 {
        my ($envname) = @_;
        return if ($envname eq "none");
+       print STDERR "teardown_env($envname)\n";
        my $env = get_running_env($envname);
        $env->{target}->teardown_env($env);
        delete $running_envs{$envname};
diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c
index 6478326..7b273f8 100644
--- a/source3/smbd/smb2_read.c
+++ b/source3/smbd/smb2_read.c
@@ -178,11 +178,13 @@ static int smb2_sendfile_send_data(struct 
smbd_smb2_read_state *state)
        uint32_t in_length = state->in_length;
        uint64_t in_offset = state->in_offset;
        files_struct *fsp = state->fsp;
+       const DATA_BLOB *hdr = state->smb2req->queue_entry.sendfile_header;
        ssize_t nread;
+       ssize_t ret;
 
        nread = SMB_VFS_SENDFILE(fsp->conn->sconn->sock,
                                 fsp,
-                                state->smb2req->queue_entry.sendfile_header,
+                                hdr,
                                 in_offset,
                                 in_length);
        DEBUG(10,("smb2_sendfile_send_data: SMB_VFS_SENDFILE returned %d on 
file %s\n",
@@ -190,11 +192,19 @@ static int smb2_sendfile_send_data(struct 
smbd_smb2_read_state *state)
                fsp_str_dbg(fsp) ));
 
        if (nread == -1) {
-               if (errno == ENOSYS || errno == EINTR) {
+               /*
+                * Returning ENOSYS means no data at all was sent.
+                  Do this as a normal read. */
+               if (errno == ENOSYS) {
+                       goto normal_read;
+               }
+
+               if (errno == EINTR) {
                        /*
-                        * Special hack for broken systems with no working
-                        * sendfile. Fake this up by doing read/write calls.
-                       */
+                        * Special hack for broken Linux with no working 
sendfile. If we
+                        * return EINTR we sent the header but not the rest of 
the data.
+                        * Fake this up by doing read/write calls.
+                        */
                        set_use_sendfile(SNUM(fsp->conn), false);
                        nread = fake_sendfile(fsp, in_offset, in_length);
                        if (nread == -1) {
@@ -225,23 +235,50 @@ static int smb2_sendfile_send_data(struct 
smbd_smb2_read_state *state)
                DEBUG(3, ("send_file_readX: sendfile sent zero bytes "
                        "falling back to the normal read: %s\n",
                        fsp_str_dbg(fsp)));
+               goto normal_read;
+       }
 
-               nread = fake_sendfile(fsp, in_offset, in_length);
-               if (nread == -1) {
-                       DEBUG(0,("smb2_sendfile_send_data: "
-                               "fake_sendfile failed for file "
-                               "%s (%s). Terminating\n",
-                               fsp_str_dbg(fsp),
-                               strerror(errno)));
-                       exit_server_cleanly("smb2_sendfile_send_data: "
-                               "fake_sendfile failed");
-               }
+       /*
+        * We got a short read
+        */
+       goto out;
+
+normal_read:
+       /* Send out the header. */
+       ret = write_data(fsp->conn->sconn->sock,
+                        (const char *)hdr->data, hdr->length);
+       if (ret != hdr->length) {
+               char addr[INET6_ADDRSTRLEN];
+               /*
+                * Try and give an error message saying what
+                * client failed.
+                */
+               DEBUG(0, ("smb2_sendfile_send_data: write_data failed "
+                         "for client %s. Error %s\n",
+                         get_peer_addr(fsp->conn->sconn->sock, addr,
+                                       sizeof(addr)),
+                         strerror(errno)));
+
+               DEBUG(0,("smb2_sendfile_send_data: write_data failed for file "
+                        "%s (%s). Terminating\n", fsp_str_dbg(fsp),
+                        strerror(errno)));
+               exit_server_cleanly("smb2_sendfile_send_data: write_data 
failed");
+       }
+       nread = fake_sendfile(fsp, in_offset, in_length);
+       if (nread == -1) {
+               DEBUG(0,("smb2_sendfile_send_data: "
+                       "fake_sendfile failed for file "
+                       "%s (%s). Terminating\n",
+                       fsp_str_dbg(fsp),
+                       strerror(errno)));
+               exit_server_cleanly("smb2_sendfile_send_data: "
+                       "fake_sendfile failed");
        }
 
   out:
 
        if (nread < in_length) {
-               sendfile_short_send(fsp, nread, 0, in_length);
+               sendfile_short_send(fsp, nread, hdr->length, in_length);
        }
 
        init_strict_lock_struct(fsp,


-- 
Samba Shared Repository

Reply via email to