[SCM] Samba Shared Repository - branch v4-6-test updated

Karolin Seeger kseeger at samba.org
Tue Dec 5 13:30:04 UTC 2017


The branch, v4-6-test has been updated
       via  9cc7d3d s3: libsmb: Fix valgrind read-after-free error in cli_smb2_close_fnum_recv().
       via  8a37c85 testprogs: Fix a typo in the net ads test
       via  fb542aa testprogs: Test net ads keytab list
       via  19c9997 s3:libads: net ads keytab list fails with "Key table name malformed"
       via  3679be1 vfs_fruit: proper VFS-stackable conversion of FinderInfo
       via  0282d52 vfs_fruit: add AfpInfo prototypes
       via  b7f5e69 s4/torture: fruit: in test_adouble_conversion() also check stream list and AFPINFO_STREAM
       via  775ec5e s4/torture: fruit: remove use of localdir from test_adouble_conversion test
       via  dba33c9 selftest: add "fruit:veto_appledouble = no" to fruit shares
       via  de13adb s4/torture: let write_stream() deal with stream=NULL
       via  90ed82b selftest: run AppleDouble sidecar-file conversion test runs against all fruit shares
       via  79b3ea5 s4/torture: use torture_assert_goto in a vfs.fruit test
       via  51e21a3 s4/torture: rework stream names tests usage of local xattr call
       via  e266163 selftest: add localdir option to fruit subtests
       via  2354d2b selftest: reorder arguments for fruit tests
       via  1b9a0ca s3/loadparm: don't mark IPC$ as autoloaded
       via  e0a08bd s3/loadparm: ensure default service options are not changed
       via  37e816e s3/loadparm: allocate a fresh sDefault object per lp_ctx
       via  b728d17 Add vfs_zfsacl manpage to the list of manpages if we have this module enabled.
       via  d484d1b Fix typo in the "wide links" description for the getwd cache.
      from  3af01bd libnet_join: fix "net rpc oldjoin"

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-6-test


- Log -----------------------------------------------------------------
commit 9cc7d3df94cda7c738ed4d9f60ef5f42cc68c2fa
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Nov 29 09:21:30 2017 -0800

    s3: libsmb: Fix valgrind read-after-free error in cli_smb2_close_fnum_recv().
    
    cli_smb2_close_fnum_recv() uses tevent_req_simple_recv_ntstatus(req), which
    frees req, then uses the state pointer which was owned by req.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13171
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Nov 30 05:47:12 CET 2017 on sn-devel-144
    
    (cherry picked from commit 5c8032b6b8ce4439b3ef8f43a62a419f081eb787)
    
    Autobuild-User(v4-6-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-6-test): Tue Dec  5 14:29:20 CET 2017 on sn-devel-144

commit 8a37c85693d4fa76a94f07205197b77703587f2d
Author: Noel Power <noel.power at suse.com>
Date:   Wed Nov 29 13:52:32 2017 +0100

    testprogs: Fix a typo in the net ads test
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Thu Nov 30 01:47:24 CET 2017 on sn-devel-144
    
    (cherry picked from commit 9f9c5d33c434b192d38a9758067fb0513041c0f0)

commit fb542aa9f14966187459c7cb1d3048d8407da85f
Author: Noel Power <noel.power at suse.com>
Date:   Fri Nov 24 07:06:27 2017 +0000

    testprogs: Test net ads keytab list
    
    Test that correct keytab is picked up.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13166
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 4be05c835e9d8b8f13856d592aaf42b40ce397c2)

commit 19c99976dad0c4d005811cb7c17336f5a1645acd
Author: Noel Power <noel.power at suse.com>
Date:   Thu Nov 23 15:55:21 2017 +0000

    s3:libads: net ads keytab list fails with "Key table name malformed"
    
    When keytab_name is NULL don't call smb_krb5_kt_open use ads_keytab_open
    instead, this function will determine the correct keytab to use.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13166
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 3048ae318fc8b4d1b7663826972306372430a463)

commit 3679be1eae506f88cb845fe845fa069cd9258b25
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Nov 15 16:52:48 2017 +0100

    vfs_fruit: proper VFS-stackable conversion of FinderInfo
    
    This fixes the problem that conversion failed with
    fruit:metadata=stream. Before we were calling ad_set() which stores the
    metadata in the Netatalk compatible format.
    
    Rewrite to fully go through the VFS by calling SMB_VFS_CREATE_FILE() and
    SMB_VFS_PWRITE().
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Nov 29 08:38:06 CET 2017 on sn-devel-144
    
    (backported from commit 1da17204344a99a3bfa289355a996027a21814b8)

commit 0282d52e6905eb0e7e3a01bb5328bff89e84c227
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Nov 15 16:52:16 2017 +0100

    vfs_fruit: add AfpInfo prototypes
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (backported from commit 84976cb670847f199598995d48bd9c3f3dd0f035)

commit b7f5e69abc5b6c10b0f18e5cee6f94c3b33acb33
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Nov 17 12:57:14 2017 +0100

    s4/torture: fruit: in test_adouble_conversion() also check stream list and AFPINFO_STREAM
    
    This reveals that the conversion doesn't work properly with
    fruit:metadata=stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (backported from commit 7b00b558761b6564928289efcf835e9b9cc86a89)

commit 775ec5ecc85adf73837da0fba0b8f738a88646bd
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Nov 17 12:53:42 2017 +0100

    s4/torture: fruit: remove use of localdir from test_adouble_conversion test
    
    The previous use of localdir and torture_setup_local_file() was
    motivated by the fact that by default vfs_fruit rejects access to files
    with a "._" prefix.
    
    Since a previous commit allowed SMB access to ._ files, rewrite the
    test_adouble_conversion() test to create the ._ AppleDouble file over
    SMB.
    
    This also renders torture_setup_local_file() obsolete.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ebbffd80862d7d7b025eca219bc0c8f818585ac9)

commit dba33c9ec9ba83f716002cc562168ddde3bcb6b6
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Nov 17 13:52:25 2017 +0100

    selftest: add "fruit:veto_appledouble = no" to fruit shares
    
    This is needed for a subsequent commit that modifies an existing test to
    write a ._ file over SMB instead of using the ugly local creation hack.
    
    SMB acces of ._ files requires "fruit:veto_appledouble = no", so let's
    set it.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (backported from commit 3f9b45a410384904d64bdd0d68ff2a5bc25bd3e9)

commit de13adb40dae0db2ac802bf7cba7e1a002001c3d
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Nov 17 08:13:10 2017 +0100

    s4/torture: let write_stream() deal with stream=NULL
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ac880848a905a3840b69af2cb1d842d307401a07)

commit 90ed82ba1760b2b8f21df82e171e01d4cb225e64
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Nov 15 18:39:53 2017 +0100

    selftest: run AppleDouble sidecar-file conversion test runs against all fruit shares
    
    This needs for work in all possible fruit configs, so test it.
    
    This currently fails with stream_depot, as we don't propely copy over
    the resourcefork data from the ._ file to the stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (backported from commit e28dd6a0ce753a880b2512eb62661411b20f763b)

commit 79b3ea5797af45441d4f27aa68845c7be6b2576b
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Nov 17 12:41:49 2017 +0100

    s4/torture: use torture_assert_goto in a vfs.fruit test
    
    No change in behavior.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 9af9c5c073d88b126aebd4a2d7a1a1971527fbf4)

commit 51e21a3cd46c8a197c9a41e0032849d7bce0c52d
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Nov 16 07:58:34 2017 +0100

    s4/torture: rework stream names tests usage of local xattr call
    
    Previously this test, that tests for correct conversion of ':' in stream
    names, only worked with streams_xattr with "fruit:metadata" set to
    "netatalk".
    
    In order to have test coverage for fruit shares with other configs,
    split the test into two:
    
    one test creates the stream over SMB and run against all shares, the
    other one is the unmodified existing test and is only run against the
    share with streams_xattr and fruit:metadata=netatalk.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 75a3c0f3b1f843ba9a7838aa7a1c311fc262f8c7)

commit e2661635ae48a2903dbf993a6a852cd881e1b284
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Nov 15 18:38:41 2017 +0100

    selftest: add localdir option to fruit subtests
    
    A subsequent commits modifies an existing tests that needs $localdir to
    also run against "vfs_fruit_metadata_stream" and
    "vfs_fruit_stream_depot". This reveals test failures, those will be
    fixed in a subsequent commit.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (backported from commit 3c1bdafde6419c266941624f57cf768e57e2bd98)

commit 2354d2b81ba0ff9f35e59ffc7f66bd909dbfd921
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Nov 15 18:36:54 2017 +0100

    selftest: reorder arguments for fruit tests
    
    This just puts the auth option first matching the first test with the
    "vfs_fruit" share directly above the modified lines.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13155
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 06542b2c4c000e5397f0990713de7f7bb67cc0bd)

commit 1b9a0ca2b9412c1b3077c10c2be39f84cb75cad7
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Nov 21 14:34:28 2017 +0100

    s3/loadparm: don't mark IPC$ as autoloaded
    
    A related problem that affects configuration for the hidden IPC$
    share. This share is marked a "autoloaded" and such shares are not
    reloaded when requested. That resulted in the tcon to IPC$ still using
    encrpytion after running the following sequence of changes:
    
    1. stop Samba
    2. set [global] smb encrypt = required
    3. start Samba
    4. remove [global] smb encrypt = required
    5. smbcontrol smbd reload-config
    6a bin/smbclient -U slow%x //localhost/raw -c quit, or
    6b bin/smbclient -U slow%x -mNT1 //localhost/raw -c ls
    
    In 6a the client simply encrypted packets on the IPC$ tcon. In 6b the
    client got a tcon failure with NT_STATUS_ACCESS_DENIED, but silently
    ignore the error.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13051
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Nov 28 02:02:37 CET 2017 on sn-devel-144
    
    (cherry picked from commit deaaff6843159f02bb15aeaf457f8af305e40164)

commit e0a08bdf49d2c3d07f70685bf6bf4404f0e4e119
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Nov 21 14:28:48 2017 +0100

    s3/loadparm: ensure default service options are not changed
    
    Rename sDefault to _sDefault and make it const. sDefault is make a copy
    of _sDefault in in the initialisation function lp_load_ex().
    
    As we may end up in setup_lp_context() without going through
    lp_load_ex(), sDefault may still be uninitialized at that point, so I'm
    initializing lp_ctx->sDefault from _sDefault.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13051
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ea4e6f95ae5c97e8570b8090ee7e7a577b49a8c3)

commit 37e816e75fb08cdb3c9000d05757f2481bd8b478
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Nov 22 11:49:57 2017 +0100

    s3/loadparm: allocate a fresh sDefault object per lp_ctx
    
    This is in preperation of preventing direct access to sDefault in all
    places that currently modify it.
    
    As currently s3/loadparm is afaict not accessing lp_ctx->sDefault, but
    changes sDefault indirectly through lp_parm_ptr() this change is just a
    safety measure to prevent future breakage.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13051
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1fc103547023aa1c880713e5b65ec164acb58b54)

commit b728d17498a986d02715db46d2576f914d726a4b
Author: Timur I. Bakeyev <timur at iXsystems.com>
Date:   Wed Nov 29 06:35:37 2017 +0100

    Add vfs_zfsacl manpage to the list of manpages if we have this module enabled.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12934
    
    Signed-off-by: Timur I. Bakeyev <timur at iXsystems.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>
    (cherry picked from commit 8034b88d4e771663c4b7b581fb6b1992c33d5d96)

commit d484d1bee343ebf1d0a0b8e99cad43414f3fadb8
Author: Timur I. Bakeyev <timur at iXsystems.com>
Date:   Wed Nov 29 05:48:52 2017 +0100

    Fix typo in the "wide links" description for the getwd cache.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12934
    
    Signed-off-by: Timur I. Bakeyev <timur at iXsystems.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>
    (cherry picked from commit e9e4cd4d2b6ae376cba90fdb56b9c9684f2dc492)

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

Summary of changes:
 docs-xml/smbdotconf/tuning/getwdcache.xml |   2 +-
 docs-xml/wscript_build                    |   3 +
 selftest/knownfail                        |   1 +
 selftest/target/Samba3.pm                 |   3 +
 source3/libads/kerberos_keytab.c          |   6 +-
 source3/libsmb/cli_smb2_fnum.c            |   8 +-
 source3/modules/vfs_fruit.c               |  91 +++++++++++---
 source3/param/loadparm.c                  |  20 ++-
 source3/selftest/tests.py                 |   4 +-
 source4/torture/vfs/fruit.c               | 198 +++++++++++++++++-------------
 testprogs/blackbox/test_net_ads.sh        |  15 ++-
 11 files changed, 242 insertions(+), 109 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/tuning/getwdcache.xml b/docs-xml/smbdotconf/tuning/getwdcache.xml
index 93f7a90..ec4d9ed 100644
--- a/docs-xml/smbdotconf/tuning/getwdcache.xml
+++ b/docs-xml/smbdotconf/tuning/getwdcache.xml
@@ -6,7 +6,7 @@
     <para>This is a tuning option. When this is enabled a 
     caching algorithm will be used to reduce the time taken for getwd() 
     calls. This can have a significant impact on performance, especially 
-    when the <smbconfoption name="wide smbconfoptions"/> parameter is set to <constant>no</constant>.</para>
+    when the <smbconfoption name="wide links"/> parameter is set to <constant>no</constant>.</para>
 </description>
 
 <value type="default">yes</value>
diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
index 0b690a8..093a20d 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -142,3 +142,6 @@ if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']):
 
     if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
         bld.SAMBAMANPAGES(krb5_locator_manpages)
+
+    if bld.SAMBA3_IS_ENABLED_MODULE('vfs_zfsacl'):
+        bld.SAMBAMANPAGES('manpages/vfs_zfsacl.8')
diff --git a/selftest/knownfail b/selftest/knownfail
index 713e39b..6e1d058 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -307,3 +307,4 @@
 ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_add_duplicate_different_type.*
 ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_rank_none.*
 ^samba.tests.dcerpc.dnsserver.samba.tests.dcerpc.dnsserver.DnsserverTests.test_security_descriptor.*
+^samba3.vfs.fruit streams_depot.OS X AppleDouble file conversion\(nt4_dc\)
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 66ac1e1..dbfad1c 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1789,6 +1789,7 @@ sub provision($$$$$$$$)
 	fruit:metadata = netatalk
 	fruit:locking = netatalk
 	fruit:encoding = native
+	fruit:veto_appledouble = no
 
 [vfs_fruit_metadata_stream]
 	path = $shrdir
@@ -1796,6 +1797,7 @@ sub provision($$$$$$$$)
 	ea support = yes
 	fruit:resource = file
 	fruit:metadata = stream
+	fruit:veto_appledouble = no
 
 [vfs_fruit_stream_depot]
 	path = $shrdir
@@ -1803,6 +1805,7 @@ sub provision($$$$$$$$)
 	ea support = yes
 	fruit:resource = stream
 	fruit:metadata = stream
+	fruit:veto_appledouble = no
 
 [vfs_wo_fruit]
 	path = $shrdir
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
index ff12ec0..ffd100c 100644
--- a/source3/libads/kerberos_keytab.c
+++ b/source3/libads/kerberos_keytab.c
@@ -639,7 +639,11 @@ int ads_keytab_list(const char *keytab_name)
 		return ret;
 	}
 
-	ret = smb_krb5_kt_open(context, keytab_name, False, &keytab);
+	if (keytab_name == NULL) {
+		ret = ads_keytab_open(context, &keytab);
+	} else {
+		ret = smb_krb5_kt_open(context, keytab_name, False, &keytab);
+	}
 	if (ret) {
 		DEBUG(1, ("smb_krb5_kt_open failed (%s)\n",
 			  error_message(ret)));
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 247f443..bf80cd2 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -449,8 +449,12 @@ NTSTATUS cli_smb2_close_fnum_recv(struct tevent_req *req)
 {
 	struct cli_smb2_close_fnum_state *state = tevent_req_data(
 		req, struct cli_smb2_close_fnum_state);
-	NTSTATUS status = tevent_req_simple_recv_ntstatus(req);
-	state->cli->raw_status = status;
+	NTSTATUS status = NT_STATUS_OK;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		state->cli->raw_status = status;
+	}
+	tevent_req_received(req);
 	return status;
 }
 
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index bfb265b..f7e57d0 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -477,6 +477,9 @@ static struct adouble *ad_init(TALLOC_CTX *ctx, vfs_handle_struct *handle,
 static int ad_set(struct adouble *ad, const char *path);
 static int ad_fset(struct adouble *ad, files_struct *fsp);
 static int adouble_path(TALLOC_CTX *ctx, const char *path_in, char **path_out);
+static AfpInfo *afpinfo_new(TALLOC_CTX *ctx);
+static ssize_t afpinfo_pack(const AfpInfo *ai, char *buf);
+static AfpInfo *afpinfo_unpack(TALLOC_CTX *ctx, const void *data);
 
 /**
  * Return a pointer to an AppleDouble entry
@@ -1284,12 +1287,17 @@ static ssize_t ad_read_rsrc_xattr(struct adouble *ad,
 static ssize_t ad_read_rsrc_adouble(struct adouble *ad,
 				    const char *path)
 {
-	struct adouble *meta_ad = NULL;
 	SMB_STRUCT_STAT sbuf;
 	char *p_ad = NULL;
-	char *p_meta_ad = NULL;
+	AfpInfo *ai = NULL;
+	DATA_BLOB aiblob;
+	struct smb_filename *stream_name = NULL;
+	files_struct *fsp = NULL;
 	ssize_t len;
 	size_t size;
+	ssize_t nwritten;
+	NTSTATUS status;
+	int saved_errno = 0;
 	int ret;
 	bool ok;
 
@@ -1372,29 +1380,84 @@ static ssize_t ad_read_rsrc_adouble(struct adouble *ad,
 		return -1;
 	}
 
-	meta_ad = ad_init(talloc_tos(), ad->ad_handle, ADOUBLE_META);
-	if (meta_ad == NULL) {
+	p_ad = ad_get_entry(ad, ADEID_FINDERI);
+	if (p_ad == NULL) {
 		return -1;
 	}
 
-	p_ad = ad_get_entry(ad, ADEID_FINDERI);
-	if (p_ad == NULL) {
-		TALLOC_FREE(meta_ad);
+	ai = afpinfo_new(talloc_tos());
+	if (ai == NULL) {
 		return -1;
 	}
-	p_meta_ad = ad_get_entry(meta_ad, ADEID_FINDERI);
-	if (p_meta_ad == NULL) {
-		TALLOC_FREE(meta_ad);
+
+	memcpy(ai->afpi_FinderInfo, p_ad, ADEDLEN_FINDERI);
+
+	aiblob = data_blob_talloc(talloc_tos(), NULL, AFP_INFO_SIZE);
+	if (aiblob.data == NULL) {
+		TALLOC_FREE(ai);
 		return -1;
 	}
 
-	memcpy(p_meta_ad, p_ad, ADEDLEN_FINDERI);
+	size = afpinfo_pack(ai, (char *)aiblob.data);
+	TALLOC_FREE(ai);
+	if (size != AFP_INFO_SIZE) {
+		return -1;
+	}
 
-	ret = ad_set(meta_ad, path);
-	TALLOC_FREE(meta_ad);
-	if (ret != 0) {
+	stream_name = synthetic_smb_fname(talloc_tos(),
+					  path,
+					  AFPINFO_STREAM,
+					  NULL, 0);
+	if (stream_name == NULL) {
+		data_blob_free(&aiblob);
+		DBG_ERR("synthetic_smb_fname failed\n");
+		return -1;
+	}
+
+	DBG_DEBUG("stream_name: %s\n", smb_fname_str_dbg(stream_name));
+
+	status = SMB_VFS_CREATE_FILE(
+		ad->ad_handle->conn,		/* conn */
+		NULL,				/* req */
+		0,				/* root_dir_fid */
+		stream_name,			/* fname */
+		FILE_GENERIC_WRITE,		/* access_mask */
+		FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
+		FILE_OPEN_IF,			/* create_disposition */
+		0,				/* create_options */
+		0,				/* file_attributes */
+		INTERNAL_OPEN_ONLY,		/* oplock_request */
+		NULL,				/* lease */
+		0,				/* allocation_size */
+		0,				/* private_flags */
+		NULL,				/* sd */
+		NULL,				/* ea_list */
+		&fsp,				/* result */
+		NULL,				/* psbuf */
+		NULL, NULL);			/* create context */
+	TALLOC_FREE(stream_name);
+	if (!NT_STATUS_IS_OK(status)) {
+		DBG_ERR("SMB_VFS_CREATE_FILE failed\n");
+		return -1;
+	}
+
+	nwritten = SMB_VFS_PWRITE(fsp,
+				  aiblob.data,
+				  aiblob.length,
+				  0);
+	if (nwritten == -1) {
+		DBG_ERR("SMB_VFS_PWRITE failed\n");
+		saved_errno = errno;
+		close_file(NULL, fsp, ERROR_CLOSE);
+		errno = saved_errno;
+		return -1;
+	}
+
+	status = close_file(NULL, fsp, NORMAL_CLOSE);
+	if (!NT_STATUS_IS_OK(status)) {
 		return -1;
 	}
+	fsp = NULL;
 
 	return len;
 }
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index d8da749..d72226b 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -110,7 +110,7 @@ static bool defaults_saved = false;
 static struct loadparm_global Globals;
 
 /* This is a default service used to prime a services structure */
-static struct loadparm_service sDefault =
+static const struct loadparm_service _sDefault =
 {
 	.valid = true,
 	.autoloaded = false,
@@ -249,6 +249,12 @@ static struct loadparm_service sDefault =
 	.dummy = ""
 };
 
+/*
+ * This is a copy of the default service structure. Service options in the
+ * global section would otherwise overwrite the initial default values.
+ */
+static struct loadparm_service sDefault;
+
 /* local variables */
 static struct loadparm_service **ServicePtrs = NULL;
 static int iNumServices = 0;
@@ -949,7 +955,14 @@ static struct loadparm_context *setup_lp_context(TALLOC_CTX *mem_ctx)
 		return NULL;
 	}
 
-	lp_ctx->sDefault = &sDefault;
+	lp_ctx->sDefault = talloc_zero(lp_ctx, struct loadparm_service);
+	if (lp_ctx->sDefault == NULL) {
+		DBG_ERR("talloc_zero failed\n");
+		TALLOC_FREE(lp_ctx);
+		return NULL;
+	}
+
+	*lp_ctx->sDefault = _sDefault;
 	lp_ctx->services = NULL; /* We do not want to access this directly */
 	lp_ctx->bInGlobalSection = bInGlobalSection;
 	lp_ctx->flags = flags_list;
@@ -1581,7 +1594,7 @@ static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
 	ServicePtrs[i]->guest_ok = guest_ok;
 	ServicePtrs[i]->printable = false;
 	ServicePtrs[i]->browseable = sDefault.browseable;
-	ServicePtrs[i]->autoloaded = true;
+	ServicePtrs[i]->autoloaded = false;
 
 	DEBUG(3, ("adding IPC service\n"));
 
@@ -3819,6 +3832,7 @@ static bool lp_load_ex(const char *pszFname,
 	bInGlobalSection = true;
 	bGlobalOnly = global_only;
 	bAllowIncludeRegistry = allow_include_registry;
+	sDefault = _sDefault;
 
 	lp_ctx = setup_lp_context(talloc_tos());
 
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 9a0eac1..5dfdce7 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -435,8 +435,8 @@ for t in tests:
         plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
     elif t == "vfs.fruit":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share --option=torture:share2=vfs_wo_fruit', 'metadata_netatalk')
-        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_metadata_stream --option=torture:share2=vfs_wo_fruit -U$USERNAME%$PASSWORD', 'metadata_stream')
-        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_stream_depot --option=torture:share2=vfs_wo_fruit_stream_depot -U$USERNAME%$PASSWORD', 'streams_depot')
+        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_metadata_stream -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share --option=torture:share2=vfs_wo_fruit', 'metadata_stream')
+        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_stream_depot -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share --option=torture:share2=vfs_wo_fruit_stream_depot', 'streams_depot')
     elif t == "vfs.fruit_netatalk":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
     elif t == "vfs.fruit_file_id":
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index a018a54..76890ff 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -1140,7 +1140,7 @@ static bool write_stream(struct smb2_tree *tree,
 	NTSTATUS status;
 	const char *full_name;
 
-	full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname);
+	full_name = talloc_asprintf(mem_ctx, "%s%s", fname, sname ? sname : "");
 	if (full_name == NULL) {
 	    torture_comment(tctx, "talloc_asprintf error\n");
 	    return false;
@@ -1210,49 +1210,6 @@ static bool torture_setup_local_xattr(struct torture_context *tctx,
 	return ret;
 }
 
-static bool torture_setup_local_file(struct torture_context *tctx,
-				     const char *path_option,
-				     const char *name,
-				     const char *buf,
-				     size_t size)
-{
-	int fd;
-	const char *spath;
-	char *path;
-	ssize_t rsize;
-
-	spath = torture_setting_string(tctx, path_option, NULL);
-	if (spath == NULL) {
-		printf("No sharepath for option %s\n", path_option);
-		return false;
-	}
-
-	path = talloc_asprintf(tctx, "%s/%s", spath, name);
-	if (path == NULL) {
-		return false;
-	}
-
-	fd = creat(path, S_IRWXU);
-	TALLOC_FREE(path);
-	if (fd == -1) {
-		return false;
-	}
-
-	if ((buf == NULL) || (size == 0)) {
-		close(fd);
-		return true;
-	}
-
-	rsize = write(fd, buf, size);
-	if (rsize != size) {
-		return false;
-	}
-
-	close(fd);
-
-	return true;
-}
-
 /**
  * Create a file or directory
  **/
@@ -1996,50 +1953,63 @@ static bool test_adouble_conversion(struct torture_context *tctx,
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
 	const char *fname = BASEDIR "\\test_adouble_conversion";
-	const char *fname_local = BASEDIR "/test_adouble_conversion";
-	const char *adname_local = BASEDIR "/._test_adouble_conversion";
+	const char *adname = BASEDIR "/._test_adouble_conversion";
 	NTSTATUS status;
 	struct smb2_handle testdirh;
 	bool ret = true;
 	const char *data = "This resource fork intentionally left blank";
 	size_t datalen = strlen(data);
-	const char *localdir = NULL;
-
-	localdir = torture_setting_string(tctx, "localdir", NULL);
-	if (localdir == NULL) {
-		torture_skip(tctx, "Need localdir for test");
-	}
+	const char *streams[] = {
+		"::$DATA",
+		AFPINFO_STREAM,
+		AFPRESOURCE_STREAM,
+		":com.apple.metadata" "\xef\x80\xa2" "_kMDItemUserTags:$DATA",
+		":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
+	};
 
-	smb2_util_unlink(tree, fname);
+	smb2_deltree(tree, BASEDIR);
 
 	status = torture_smb2_testdir(tree, BASEDIR, &testdirh);
 	CHECK_STATUS(status, NT_STATUS_OK);
 	smb2_util_close(tree, testdirh);
 
-	ret = torture_setup_local_file(tctx, "localdir", fname_local,
-				       NULL, 0);
-	if (ret == false) {
-		goto done;
-	}
+	ret = torture_setup_file(tctx, tree, fname, false);
+	torture_assert_goto(tctx, ret == true, ret, done,
+			    "torture_setup_file failed\n");
 
-	ret = torture_setup_local_file(tctx, "localdir", adname_local,
-				       osx_adouble_w_xattr,
-				       sizeof(osx_adouble_w_xattr));
-	if (ret == false) {
-		goto done;
-	}
+	ret = torture_setup_file(tctx, tree, adname, false);
+	torture_assert_goto(tctx, ret == true, ret, done,
+			    "torture_setup_file failed\n");
+
+	ret = write_stream(tree, __location__, tctx, mem_ctx,
+			   adname, NULL,
+			   0, sizeof(osx_adouble_w_xattr), osx_adouble_w_xattr);
+	torture_assert_goto(tctx, ret == true, ret, done,
+			    "write_stream failed\n");
 
 	torture_comment(tctx, "(%s) test OS X AppleDouble conversion\n",
 	    __location__);
 
-	ret &= check_stream(tree, __location__, tctx, mem_ctx,
-			    fname, AFPRESOURCE_STREAM,
-			    16, datalen, 0, datalen, data);
+	ret = check_stream(tree, __location__, tctx, mem_ctx,
+			   fname, AFPRESOURCE_STREAM,
+			   16, datalen, 0, datalen, data);
+	torture_assert_goto(tctx, ret == true, ret, done,
+			    "check AFPRESOURCE_STREAM failed\n");
 
-	ret &= check_stream(tree, __location__, tctx, mem_ctx,
-			    fname,
-			    ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
-			    0, 3, 0, 3, "baz");
+	ret = check_stream(tree, __location__, tctx, mem_ctx,
+			   fname, AFPINFO_STREAM,
+			   0, 60, 16, 8, "TESTSLOW");
+	torture_assert_goto(tctx, ret == true, ret, done,
+			    "check AFPINFO_STREAM failed\n");
+
+	ret = check_stream(tree, __location__, tctx, mem_ctx, fname,
+			   ":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
+			   0, 3, 0, 3, "baz");
+	torture_assert_goto(tctx, ret == true, ret, done,
+			    "check foo:bar stream failed\n");
+
+	ret = check_stream_list(tree, tctx, fname, 5, streams, false);
+	torture_assert_goto(tctx, ret == true, ret, done, "check_stream_list");
 
 done:
 	smb2_deltree(tree, BASEDIR);
@@ -2861,15 +2831,8 @@ static bool test_stream_names(struct torture_context *tctx,
 	/* UTF8 private use are starts at 0xef 0x80 0x80 (0xf000) */
 	const char *streams[] = {
 		":foo" "\xef\x80\xa2" "bar:$DATA", /* "foo:bar:$DATA" */
-		":bar" "\xef\x80\xa2" "baz:$DATA", /* "bar:baz:$DATA" */
 		"::$DATA"
 	};
-	const char *localdir = NULL;
-
-	localdir = torture_setting_string(tctx, "localdir", NULL);
-	if (localdir == NULL) {
-		torture_skip(tctx, "Need localdir for test");
-	}
 
 	sname1 = talloc_asprintf(mem_ctx, "%s%s", fname, streams[0]);
 
@@ -2898,12 +2861,7 @@ static bool test_stream_names(struct torture_context *tctx,
 	CHECK_STATUS(status, NT_STATUS_OK);
 	smb2_util_close(tree, create.out.file.handle);
 
-	ret = torture_setup_local_xattr(tctx, "localdir", BASEDIR "/stream_names.txt",
-					"user.DosStream.bar:baz:$DATA",
-					"data", strlen("data"));
-	CHECK_VALUE(ret, true);
-
-	ret = check_stream_list(tree, tctx, fname, 3, streams, false);
+	ret = check_stream_list(tree, tctx, fname, 2, streams, false);
 	CHECK_VALUE(ret, true);
 
 done:
@@ -4018,6 +3976,9 @@ static bool test_readdir_attr_illegal_ntfs(struct torture_context *tctx,
 
 		if (!strcmp(found, ".") || !strcmp(found, ".."))
 			continue;
+		if (strncmp(found, "._", 2) == 0) {
+			continue;
+		}
 		break;
 	}
 
@@ -4191,10 +4152,77 @@ struct torture_suite *torture_vfs_fruit(void)
 	torture_suite_add_1smb2_test(suite, "readdir_attr with names with illegal ntfs characters", test_readdir_attr_illegal_ntfs);
 	torture_suite_add_2ns_smb2_test(suite, "invalid AFP_AfpInfo", test_invalid_afpinfo);
 	torture_suite_add_1smb2_test(suite, "creating rsrc with read-only access", test_rfork_create_ro);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list