The branch, master has been updated
       via  ddc4c67 librpc: prevent invalid NULL pointer derref in 
dcerpc_binding_get_auth_info().
       via  20075e6 s3:vfs: copy_chunk buffer size
       via  4e28dd1 selftest: Plan samba3.blackbox.preserve_case testcase
       via  f72be14 tests: Add test_preserve_case.sh
       via  451dc38 selftest: Add setup_fileserver()
       via  2b644e3 s3:libsmb: fix resolve_ads return if there were no answers
      from  86cff1d tevent: add and use debug class for tevent

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


- Log -----------------------------------------------------------------
commit ddc4c6767a98bb087bb435ed3a4591e75637b1e8
Author: Günther Deschner <g...@samba.org>
Date:   Wed Jul 1 17:14:10 2015 +0200

    librpc: prevent invalid NULL pointer derref in 
dcerpc_binding_get_auth_info().
    
    Guenther
    
    Signed-off-by: Günther Deschner <g...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Thu Jul  2 02:05:38 CEST 2015 on sn-devel-104

commit 20075e6b3082939fbd5d7ca4f327d29d62c33c87
Author: Ralph Boehme <s...@samba.org>
Date:   Wed Jul 1 17:57:36 2015 +0200

    s3:vfs: copy_chunk buffer size
    
    Use a dynamically allocated copy_chunk buffer size with an upper bound
    of 8 MB for now.
    
    The previous size of 64 KB has proven to really hurt performance,
    especially with "strict locking = yes".
    
    The SMB2 protocol level maximum allowed copy_chunk size is 1 MB, that's
    what will be used as buffer size in the typical case.
    
    With the AAPL copyfile extension the requested copy_chunk size is the
    size whole file, which would then make use of a larger buffer up to the
    limit of 8 MB.
    
    Signed-off-by: Ralph Boehme <s...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 4e28dd16c528e3bf3cfa0a4ecfdee9188f02ec49
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Jul 1 14:09:32 2015 +0200

    selftest: Plan samba3.blackbox.preserve_case testcase
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit f72be14315b9e2574980127b7c0f9fdcbea10d37
Author: Andreas Schneider <a...@samba.org>
Date:   Fri May 15 10:05:26 2015 +0200

    tests: Add test_preserve_case.sh
    
    Test for: https://bugzilla.samba.org/show_bug.cgi?id=10650
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 451dc3889ef530174f80177d5e8b84c6a8b8e777
Author: Robin Hack <rh...@redhat.com>
Date:   Fri May 15 09:43:29 2015 +0200

    selftest: Add setup_fileserver()
    
    Pair-Programmed-With: Andreas Schneider <a...@samba.org>
    Signed-off-by: Robin Hack <rh...@redhat.com>
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 2b644e3d5dcbc286468764cd48b6b7044463d5df
Author: Michael Adam <ob...@samba.org>
Date:   Tue Jun 30 16:51:43 2015 +0200

    s3:libsmb: fix resolve_ads return if there were no answers
    
    Signed-off-by: Michael Adam <ob...@samba.org>
    Reviewed-by: "Stefan (metze) Metzmacher" <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

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

Summary of changes:
 librpc/rpc/binding.c                       |  4 +-
 selftest/target/Samba.pm                   |  1 +
 selftest/target/Samba3.pm                  | 96 +++++++++++++++++++++++++++++-
 source3/libsmb/namequery.c                 |  7 +++
 source3/modules/vfs_default.c              | 10 +++-
 source3/script/tests/test_preserve_case.sh | 78 ++++++++++++++++++++++++
 source3/selftest/tests.py                  |  2 +
 7 files changed, 193 insertions(+), 5 deletions(-)
 create mode 100755 source3/script/tests/test_preserve_case.sh


Changeset truncated at 500 lines:

diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index 37e0c4f..f131d00 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -596,11 +596,11 @@ _PUBLIC_ void dcerpc_binding_get_auth_info(const struct 
dcerpc_binding *b,
                auth_level = DCERPC_AUTH_LEVEL_NONE;
        }
 
-       if (_auth_type == NULL) {
+       if (_auth_type != NULL) {
                *_auth_type = auth_type;
        }
 
-       if (_auth_level == NULL) {
+       if (_auth_level != NULL) {
                *_auth_level = auth_level;
        }
 }
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm
index 4949086..e128fd3 100644
--- a/selftest/target/Samba.pm
+++ b/selftest/target/Samba.pm
@@ -177,6 +177,7 @@ sub get_interface($)
     $interfaces{"chgdcpass"} = 32;
     $interfaces{"promotedvdc"} = 33;
     $interfaces{"rfc2307member"} = 34;
+    $interfaces{"fileserver"} = 35;
 
     # update lib/socket_wrapper/socket_wrapper.c
     #  #define MAX_WRAPPED_INTERFACES 32
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index a380e7a..03c78f2 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -178,6 +178,8 @@ sub setup_env($$$)
                return $self->setup_nt4_dc_schannel("$path/nt4_dc_schannel");
        } elsif ($envname eq "simpleserver") {
                return $self->setup_simpleserver("$path/simpleserver");
+       } elsif ($envname eq "fileserver") {
+               return $self->setup_fileserver("$path/fileserver");
        } elsif ($envname eq "maptoguest") {
                return $self->setup_maptoguest("$path/maptoguest");
        } elsif ($envname eq "ktest") {
@@ -526,7 +528,7 @@ sub setup_simpleserver($$)
 {
        my ($self, $path) = @_;
 
-       print "PROVISIONING server with security=share...";
+       print "PROVISIONING simple server...";
 
        my $prefix_abs = abs_path($path);
 
@@ -557,6 +559,98 @@ sub setup_simpleserver($$)
        return $vars;
 }
 
+sub setup_fileserver($$)
+{
+       my ($self, $path) = @_;
+       my $prefix_abs = abs_path($path);
+
+       print "PROVISIONING file server ...\n";
+
+       my @dirs = ();
+
+       mkdir($prefix_abs, 0777);
+
+       my $share_dir="$prefix_abs/share";
+
+       # Create share directory structure
+       my $lower_case_share_dir="$share_dir/lower-case";
+       push(@dirs, $lower_case_share_dir);
+
+       my $lower_case_share_dir_30000="$share_dir/lower-case-30000";
+       push(@dirs, $lower_case_share_dir_30000);
+
+       my $fileserver_options = "
+[lowercase]
+       path = $lower_case_share_dir
+       comment = smb username is [%U]
+       case sensitive = True
+       default case = lower
+       preserve case = no
+       short preserve case = no
+[lowercase-30000]
+       path = $lower_case_share_dir_30000
+       comment = smb username is [%U]
+       case sensitive = True
+       default case = lower
+       preserve case = no
+       short preserve case = no
+       ";
+
+       my $vars = $self->provision($path,
+                                   "FILESERVER",
+                                   "fileserver_secret",
+                                   $fileserver_options,
+                                   undef,
+                                   undef,
+                                   1);
+
+       $vars or return undef;
+
+       if (not $self->check_or_start($vars, "yes", "no", "yes")) {
+              return undef;
+       }
+
+       $self->{vars}->{fileserver} = $vars;
+
+       mkdir($_, 0777) foreach(@dirs);
+
+       ## Create case sensitive lower case share dir
+       foreach my $file ('a'..'z') {
+               my $full_path = $lower_case_share_dir . '/' . $file;
+               open my $fh, '>', $full_path;
+               # Add some content to file
+               print $fh $full_path;
+               close $fh;
+       }
+
+       for (my $file = 1; $file < 51; ++$file) {
+               my $full_path = $lower_case_share_dir . '/' . $file;
+               open my $fh, '>', $full_path;
+               # Add some content to file
+               print $fh $full_path;
+               close $fh;
+       }
+
+       # Create content for 30000 share
+       foreach my $file ('a'..'z') {
+               my $full_path = $lower_case_share_dir_30000 . '/' . $file;
+               open my $fh, '>', $full_path;
+               # Add some content to file
+               print $fh $full_path;
+               close $fh;
+       }
+
+       for (my $file = 1; $file < 30001; ++$file) {
+               my $full_path = $lower_case_share_dir_30000 . '/' . $file;
+               open my $fh, '>', $full_path;
+               # Add some content to file
+               print $fh $full_path;
+               close $fh;
+       }
+
+       return $vars;
+}
+
 sub setup_ktest($$$)
 {
        my ($self, $prefix) = @_;
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 5e48474..7eb5dff 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -2478,6 +2478,13 @@ static NTSTATUS resolve_ads(const char *name,
                return status;
        }
 
+       if (numdcs == 0) {
+               *return_iplist = NULL;
+               *return_count = 0;
+               talloc_destroy(ctx);
+               return NT_STATUS_OK;
+       }
+
        for (i=0;i<numdcs;i++) {
                if (!dcs[i].ss_s) {
                        numaddrs += 1;
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 9b434a0..6982634 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1395,7 +1395,7 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct 
*handle,
 
 struct vfs_cc_state {
        off_t copied;
-       uint8_t buf[65536];
+       uint8_t *buf;
 };
 
 static struct tevent_req *vfswrap_copy_chunk_send(struct vfs_handle_struct 
*handle,
@@ -1419,6 +1419,12 @@ static struct tevent_req *vfswrap_copy_chunk_send(struct 
vfs_handle_struct *hand
                return NULL;
        }
 
+       vfs_cc_state->buf = talloc_array(vfs_cc_state, uint8_t,
+                                        MIN(num, 8*1024*1024));
+       if (tevent_req_nomem(vfs_cc_state->buf, req)) {
+               return tevent_req_post(req, ev);
+       }
+
        status = vfs_stat_fsp(src_fsp);
        if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);
@@ -1444,7 +1450,7 @@ static struct tevent_req *vfswrap_copy_chunk_send(struct 
vfs_handle_struct *hand
                struct lock_struct lck;
                int saved_errno;
 
-               off_t this_num = MIN(sizeof(vfs_cc_state->buf),
+               off_t this_num = MIN(talloc_array_length(vfs_cc_state->buf),
                                     num - vfs_cc_state->copied);
 
                if (src_fsp->op == NULL) {
diff --git a/source3/script/tests/test_preserve_case.sh 
b/source3/script/tests/test_preserve_case.sh
new file mode 100755
index 0000000..2e49b0c
--- /dev/null
+++ b/source3/script/tests/test_preserve_case.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# Blackbox test for share with preserve case options
+#
+# https://bugzilla.samba.org/show_bug.cgi?id=10650
+
+if [ $# -lt 6 ]; then
+cat <<EOF
+Usage: test_preserve_case.sh SERVER DOMAIN USERNAME PASSWORD PREFIX SMBCLIENT
+EOF
+exit 1;
+fi
+
+SERVER=$1
+DOMAIN=$2
+USERNAME=$3
+PASSWORD=$4
+PREFIX=$5
+smbclient=$6
+shift 6
+failed=0
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+test_smbclient() {
+       name="$1"
+       share="$2"
+       cmd="$3"
+       shift
+       shift
+       subunit_start_test "$name"
+       output=$($VALGRIND $smbclient //$SERVER/$share -c "$cmd" $@ 2>&1)
+       status=$?
+       if [ x$status = x0 ]; then
+               subunit_pass_test "$name"
+       else
+               echo "$output" | subunit_fail_test "$name"
+       fi
+       return $status
+}
+
+PROTOCOL_LIST="NT1 SMB2 SMB3"
+SHARE="lowercase"
+
+for PROTOCOL in $PROTOCOL_LIST; do
+       test_smbclient "Test lowercase ls 1 ($PROTOCOL)" $SHARE "ls 1" 
-U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       test_smbclient "Test lowercase get 1 ($PROTOCOL)" $SHARE "get 1 
LOCAL_1" -U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       rm -f LOCAL_1
+
+       test_smbclient "Test lowercase ls A ($PROTOCOL)"  $SHARE "ls A" 
-U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       test_smbclient "Test lowercase get A ($PROTOCOL)" $SHARE "get A 
LOCAL_A" -U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       rm -f LOCAL_A
+
+       test_smbclient "Test lowercase ls z ($PROTOCOL)"  $SHARE "ls z" 
-U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       test_smbclient "Test lowercase get z ($PROTOCOL)" $SHARE "get z 
LOCAL_Z" -U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       rm -f LOCAL_Z
+done
+
+SHARE="lowercase-30000"
+
+for PROTOCOL in $PROTOCOL_LIST; do
+       test_smbclient "Test lowercase ls 25839 ($PROTOCOL)" $SHARE "ls 25839" 
-U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+
+       test_smbclient "Test lowercase ls 1 ($PROTOCOL)" $SHARE "ls 1" 
-U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       test_smbclient "Test lowercase get 1 ($PROTOCOL)" $SHARE "get 1 
LOCAL_1" -U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       rm -f LOCAL_1
+
+       test_smbclient "Test lowercase ls A ($PROTOCOL)"  $SHARE "ls A" 
-U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       test_smbclient "Test lowercase get A ($PROTOCOL)" $SHARE "get A 
LOCAL_A" -U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       rm -f LOCAL_A
+
+       test_smbclient "Test lowercase ls z ($PROTOCOL)"  $SHARE "ls z" 
-U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       test_smbclient "Test lowercase get z ($PROTOCOL)" $SHARE "get z 
LOCAL_Z" -U$USERNAME%$PASSWORD -m$PROTOCOL || failed=`expr $failed + 1`
+       rm -f LOCAL_Z
+done
+
+exit $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 1e5bc71..1f6174c 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -174,6 +174,8 @@ for env in ["nt4_dc"]:
     # encrypted
     plantestsuite("samba3.blackbox.smbclient_s3.crypt (%s)" % env, env, 
[os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', 
'$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', 
'$PREFIX', smbclient3, wbinfo, net, configuration, "-e"])
 
+for env in ["fileserver"]:
+    plantestsuite("samba3.blackbox.preserve_case (%s)" % env, env, 
[os.path.join(samba3srcdir, "script/tests/test_preserve_case.sh"), '$SERVER', 
'$DOMAIN', '$USERNAME', '$PASSWORD', '$PREFIX', smbclient3])
 
     #
     # tar command tests


-- 
Samba Shared Repository

Reply via email to