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

Karolin Seeger kseeger at samba.org
Tue Dec 5 13:49:03 UTC 2017


The branch, v4-7-test has been updated
       via  8a313c8 winbindd: let normalize_name_map() call find_domain_from_name_noinit()
       via  ac32a77 s3: libsmb: Fix valgrind read-after-free error in cli_smb2_close_fnum_recv().
       via  0fcdf5d testprogs: Test net ads keytab list
       via  aba1e91 s3:libads: net ads keytab list fails with "Key table name malformed"
       via  73d3e64 vfs_fruit: proper VFS-stackable conversion of FinderInfo
       via  3f94680 vfs_fruit: add AfpInfo prototypes
       via  2d3e21f s4/torture: fruit: in test_adouble_conversion() also check stream list and AFPINFO_STREAM
       via  3d90751 s4/torture: fruit: remove use of localdir from test_adouble_conversion test
       via  8946fc8 selftest: add "fruit:veto_appledouble = no" to fruit shares
       via  1143b2f s4/torture: let write_stream() deal with stream=NULL
       via  0b7e170 selftest: run AppleDouble sidecar-file conversion test runs against all fruit shares
       via  b9f7dd4 s4/torture: use torture_assert_goto in a vfs.fruit test
       via  e24e345 s4/torture: rework stream names tests usage of local xattr call
       via  1a2f564 selftest: add localdir option to fruit subtests
       via  590a4cf selftest: reorder arguments for fruit tests
       via  9990e6e s3/loadparm: don't mark IPC$ as autoloaded
       via  cecbc43 s3/loadparm: ensure default service options are not changed
       via  7dc2782 s3/loadparm: allocate a fresh sDefault object per lp_ctx
       via  e36b1ce Add vfs_zfsacl manpage to the list of manpages if we have this module enabled.
       via  b21d9f0 Fix typo in the "wide links" description for the getwd cache.
      from  39922b5 s4:samba: Allow samba daemon to run in foreground

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


- Log -----------------------------------------------------------------
commit 8a313c8d6974f691b33a276fa4c7e2488733ba0d
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Nov 27 12:42:44 2017 +0100

    winbindd: let normalize_name_map() call find_domain_from_name_noinit()
    
    Let normalize_name_map fetch the domain itself with
    find_domain_from_name_noinit().
    
    This removes two calls to find_domain_from_name_noinit() in the default
    configuration of "winbind normalize names = no". The domain is only need
    in normalize_name_map if "winbind normalize names" is enabled.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13173
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 1ce165a73350e802500c32435dbefe3639340435)
    
    Autobuild-User(v4-7-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-7-test): Tue Dec  5 14:48:41 CET 2017 on sn-devel-144

commit ac32a770fc1fad988629654039119278e0c1afa4
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)

commit 0fcdf5db90a05ee95c30ddfa32f3868702b77628
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 aba1e9199ddb18c229bf0def46a7caf333d2d618
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 73d3e642f8c71177bc8f42afb6724a7f93ef5472
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
    
    (cherry picked from commit 1da17204344a99a3bfa289355a996027a21814b8)

commit 3f946806a42c105732693dc2a4305ed77288ff5e
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>
    (cherry picked from commit 84976cb670847f199598995d48bd9c3f3dd0f035)

commit 2d3e21f5ab7fb31be18362cad8115772e95f1236
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>
    (cherry picked from commit 7b00b558761b6564928289efcf835e9b9cc86a89)

commit 3d9075193ea0682cd36efac7862f88111527a45f
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 8946fc80a6d6665181f27a8241c8a5828ef8e1f2
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>
    (cherry picked from commit 3f9b45a410384904d64bdd0d68ff2a5bc25bd3e9)

commit 1143b2fdf72fede84a5f22b8b9740a942c53940a
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 0b7e1705b36f920be964c62edb96b63bac64856e
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>
    (cherry picked from commit e28dd6a0ce753a880b2512eb62661411b20f763b)

commit b9f7dd4a7f1a6ea7eaa65c8806a86489b3cc66f2
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 e24e345dba06be83261f5954864bf8a0e0fad549
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 1a2f5648fc73a0baa760e56d50a3817a9e339b91
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>
    (cherry picked from commit 3c1bdafde6419c266941624f57cf768e57e2bd98)

commit 590a4cff281269b02092591549f8790e86ea3891
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 9990e6e4bff94dde226752b615c24dd4671bd370
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 cecbc43a5a3c03d184f2f4e8d80e066b740c4fe9
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 7dc2782ab51feb0ed55ab3ee8fe2b6748c404f3f
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 e36b1cedc19c92f8d7c65beb8ece8acb2e1ce632
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 b21d9f0289bc982a89786f3cbe4299805d273e74
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.d/samba3.vfs.fruit     |   1 +
 selftest/target/Samba3.pm                 |   3 +
 source3/libads/kerberos_keytab.c          |   6 +-
 source3/libsmb/cli_smb2_fnum.c            |   8 +-
 source3/modules/vfs_fruit.c               |  93 +++++++++++---
 source3/param/loadparm.c                  |  20 ++-
 source3/selftest/tests.py                 |   4 +-
 source3/winbindd/wb_getpwsid.c            |   8 +-
 source3/winbindd/winbindd_group.c         |  11 +-
 source3/winbindd/winbindd_msrpc.c         |   4 +-
 source3/winbindd/winbindd_proto.h         |   2 +-
 source3/winbindd/winbindd_rpc.c           |   4 +-
 source3/winbindd/winbindd_util.c          |   9 +-
 source4/torture/vfs/fruit.c               | 198 +++++++++++++++++-------------
 testprogs/blackbox/test_net_ads.sh        |  13 ++
 17 files changed, 258 insertions(+), 131 deletions(-)
 create mode 100644 selftest/knownfail.d/samba3.vfs.fruit


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 eb25aa0..3ff1ade 100644
--- a/docs-xml/wscript_build
+++ b/docs-xml/wscript_build
@@ -158,3 +158,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.d/samba3.vfs.fruit b/selftest/knownfail.d/samba3.vfs.fruit
new file mode 100644
index 0000000..8df25bc
--- /dev/null
+++ b/selftest/knownfail.d/samba3.vfs.fruit
@@ -0,0 +1 @@
+^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 2a4069a..78dc105 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1809,18 +1809,21 @@ sub provision($$$$$$$$$)
 	fruit:metadata = netatalk
 	fruit:locking = netatalk
 	fruit:encoding = native
+	fruit:veto_appledouble = no
 
 [vfs_fruit_metadata_stream]
 	path = $shrdir
 	vfs objects = fruit streams_xattr acl_xattr
 	fruit:resource = file
 	fruit:metadata = stream
+	fruit:veto_appledouble = no
 
 [vfs_fruit_stream_depot]
 	path = $shrdir
 	vfs objects = fruit streams_depot acl_xattr
 	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 5d46d54..237e6bb 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 0f320dc..8c3870b 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -481,6 +481,10 @@ static int ad_fset(struct adouble *ad, files_struct *fsp);
 static int adouble_path(TALLOC_CTX *ctx,
 			const struct smb_filename *smb_fname__in,
 			struct smb_filename **ppsmb_fname_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
@@ -1295,12 +1299,17 @@ static ssize_t ad_read_rsrc_xattr(struct adouble *ad)
 static ssize_t ad_read_rsrc_adouble(struct adouble *ad,
 				const struct smb_filename *smb_fname)
 {
-	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;
 
@@ -1385,29 +1394,85 @@ 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;
+	}
+
+	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;
+	}
+
+	size = afpinfo_pack(ai, (char *)aiblob.data);
+	TALLOC_FREE(ai);
+	if (size != AFP_INFO_SIZE) {
 		return -1;
 	}
-	p_meta_ad = ad_get_entry(meta_ad, ADEID_FINDERI);
-	if (p_meta_ad == NULL) {
-		TALLOC_FREE(meta_ad);
+
+	stream_name = synthetic_smb_fname(talloc_tos(),
+					  smb_fname->base_name,
+					  AFPINFO_STREAM,
+					  NULL,
+					  smb_fname->flags);
+	if (stream_name == NULL) {
+		data_blob_free(&aiblob);
+		DBG_ERR("synthetic_smb_fname failed\n");
 		return -1;
 	}
 
-	memcpy(p_meta_ad, p_ad, ADEDLEN_FINDERI);
+	DBG_DEBUG("stream_name: %s\n", smb_fname_str_dbg(stream_name));
 
-	ret = ad_set(meta_ad, smb_fname);
-	TALLOC_FREE(meta_ad);
-	if (ret != 0) {
+	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 d5b1c56..ba19d46 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -111,7 +111,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,
@@ -250,6 +250,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;
@@ -959,7 +965,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;
@@ -1591,7 +1604,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"));
 
@@ -3849,6 +3862,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 4c1ec46..ead8902 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -475,8 +475,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/source3/winbindd/wb_getpwsid.c b/source3/winbindd/wb_getpwsid.c
index e9ffc33..0e58355 100644
--- a/source3/winbindd/wb_getpwsid.c
+++ b/source3/winbindd/wb_getpwsid.c
@@ -63,7 +63,6 @@ static void wb_getpwsid_queryuser_done(struct tevent_req *subreq)
 		req, struct wb_getpwsid_state);
 	struct winbindd_pw *pw = state->pw;
 	struct wbint_userinfo *info;
-	struct winbindd_domain *domain = NULL;
 	fstring acct_name, output_username;
 	char *mapped_name = NULL;
 	char *tmp;
@@ -85,11 +84,6 @@ static void wb_getpwsid_queryuser_done(struct tevent_req *subreq)
 		return;
 	}
 
-	domain = find_domain_from_name_noinit(info->domain_name);
-	if (tevent_req_nomem(domain, req)) {
-		return;
-	}
-
 	/*
 	 * TODO:
 	 * This function should be called in 'idmap winbind child'. It shouldn't
@@ -97,7 +91,7 @@ static void wb_getpwsid_queryuser_done(struct tevent_req *subreq)
 	 * winbind.idl. This is a fix which can be backported for now.
 	 */
 	status = normalize_name_map(state,
-				    domain,
+				    info->domain_name,
 				    acct_name,
 				    &mapped_name);
 	if (NT_STATUS_IS_OK(status)) {
diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c
index ae461bf..ec95bf4 100644
--- a/source3/winbindd/winbindd_group.c
+++ b/source3/winbindd/winbindd_group.c
@@ -35,18 +35,9 @@ bool fill_grent(TALLOC_CTX *mem_ctx, struct winbindd_gr *gr,
 {
 	fstring full_group_name;
 	char *mapped_name = NULL;
-	struct winbindd_domain *domain;
 	NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
 
-	domain = find_domain_from_name_noinit(dom_name);
-	if (domain == NULL) {
-		DEBUG(0, ("Failed to find domain '%s'. "
-			  "Check connection to trusted domains!\n",
-			  dom_name));
-		return false;
-	}
-
-	nt_status = normalize_name_map(mem_ctx, domain, gr_name,
+	nt_status = normalize_name_map(mem_ctx, dom_name, gr_name,
 				       &mapped_name);
 
 	/* Basic whitespace replacement */
diff --git a/source3/winbindd/winbindd_msrpc.c b/source3/winbindd/winbindd_msrpc.c
index c565376..9bf4354 100644
--- a/source3/winbindd/winbindd_msrpc.c
+++ b/source3/winbindd/winbindd_msrpc.c
@@ -313,7 +313,7 @@ static NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain,
 
 	DEBUG(5,("Mapped sid to [%s]\\[%s]\n", domains[0], *name));
 
-	name_map_status = normalize_name_map(mem_ctx, domain, *name,
+	name_map_status = normalize_name_map(mem_ctx, domain->name, *name,
 					     &mapped_name);
 	if (NT_STATUS_IS_OK(name_map_status) ||
 	    NT_STATUS_EQUAL(name_map_status, NT_STATUS_FILE_RENAMED))
@@ -377,7 +377,7 @@ static NTSTATUS msrpc_rids_to_names(struct winbindd_domain *domain,
 
 		if ((*types)[i] != SID_NAME_UNKNOWN) {
 			name_map_status = normalize_name_map(mem_ctx,
-							     domain,
+							     domain->name,
 							     ret_names[i],
 							     &mapped_name);
 			if (NT_STATUS_IS_OK(name_map_status) ||
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index 2610114..e45d9b5 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -495,7 +495,7 @@ NTSTATUS lookup_usergroups_cached(TALLOC_CTX *mem_ctx,
 				  uint32_t *p_num_groups, struct dom_sid **user_sids);
 
 NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
-			     struct winbindd_domain *domain,
+			     const char *domain_name,
 			     const char *name,
 			     char **normalized);
 NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c
index 2c76e1a..f50fb8f 100644
--- a/source3/winbindd/winbindd_rpc.c
+++ b/source3/winbindd/winbindd_rpc.c
@@ -332,7 +332,7 @@ NTSTATUS rpc_sid_to_name(TALLOC_CTX *mem_ctx,
 	*ptype = (enum lsa_SidType) types[0];
 
 	map_status = normalize_name_map(mem_ctx,
-					domain,
+					domain->name,
 					names[0],
 					&mapped_name);
 	if (NT_STATUS_IS_OK(map_status) ||
@@ -410,7 +410,7 @@ NTSTATUS rpc_rids_to_names(TALLOC_CTX *mem_ctx,
 
 		if (types[i] != SID_NAME_UNKNOWN) {
 			map_status = normalize_name_map(mem_ctx,
-							domain,
+							domain->name,
 							names[i],
 							&mapped_name);
 			if (NT_STATUS_IS_OK(map_status) ||
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 2615192..370b70c 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -1339,10 +1339,11 @@ NTSTATUS lookup_usergroups_cached(TALLOC_CTX *mem_ctx,
 ********************************************************************/
 
 NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
-			     struct winbindd_domain *domain,
+			     const char *domain_name,
 			     const char *name,
 			     char **normalized)
 {
+	struct winbindd_domain *domain = NULL;
 	NTSTATUS nt_status;
 
 	if (!name || !normalized) {
@@ -1353,6 +1354,12 @@ NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
 		return NT_STATUS_PROCEDURE_NOT_FOUND;
 	}
 
+	domain = find_domain_from_name_noinit(domain_name);
+	if (domain == NULL) {
+		DBG_ERR("Failed to find domain '%s'\n",	domain_name);
+		return NT_STATUS_NO_SUCH_DOMAIN;
+	}
+
 	/* Alias support and whitespace replacement are mutually
 	   exclusive */
 
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index ace561d..04f04e2 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);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list