[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri May 24 00:43:02 UTC 2019


The branch, master has been updated
       via  e7424897a12 ctdb: Make TDB_SEQNUM work synchronously with ctdb
       via  78a4639b2d0 vfs_fruit: change trigger points of AppleDouble conversion
       via  4777d1163a7 vfs_fruit: add a forward declaration for ad_get()
       via  8ed9b6b4579 selftest: run vfs.fruit test against a share that deletes empty resource forks
       via  bb5a457f287 s4:torture/vfs/fruit: ensure test_adouble_conversion_wo_xattr() uses a non-emtpy resourcefork
       via  c3d28d49be3 s4:torture/vfs/fruit: ensure test_adouble_conversion() uses a non-emtpy resourcefork
       via  cb6525e8681 libsmbconf:registry: Return correct case for get_share
       via  91350d562b6 net: Return share name in correct case from net rpc conf showshare
       via  f58127d0248 selftest: Add test for case-preserving in 'net [rpc] conf showshare'
      from  1f9b8964ca8 ctdb: Remove unused ctdb_ltdb_fetch_with_header()

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


- Log -----------------------------------------------------------------
commit e7424897a1272490b78c08f78ce7b260eb014f20
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 20 16:01:03 2019 +0200

    ctdb: Make TDB_SEQNUM work synchronously with ctdb
    
    Old war story completely from memory, I could not find the commit that
    introduced TDB_SEQNUM so far...:
    
    Back in the days when ctdb was initially developed, TDB_SEQNUM's only
    user was the notify.tdb that held one huge record for all notify
    records. With that use case in mind it made perfect sense to keep the
    SEQNUM stable locally, sacrificing precision. By now notify.tdb is
    long gone, an the only user of TDB_SEQNUM right now is brlock.tdb,
    which contains special case code for the imprecise ctdb implementation
    of TDB_SEQNUM.
    
    With this commit, that special code can go: The TDB_SEQNUM will also
    increment when just the DMASTER header field changes, indicating to
    smbd that someone else might have changed the record. This will of
    course increase the SEQNUM frequency, but it should not increase the
    load on ctdb: If you look at the brlock.c workaround, it just does not
    do the caching that is possible with precise TDB_SEQNUMs working.
    
    How did I get here? I want to move brl_num_read_oplocks() from
    brlock.tdb into locking.tdb, and for that I need precise TDB_SEQNUMs
    for locking.tdb.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri May 24 00:42:17 UTC 2019 on sn-devel-184

commit 78a4639b2d06cc69788861618d2e91945e142d2b
Author: Ralph Boehme <slow at samba.org>
Date:   Tue May 21 16:00:53 2019 +0200

    vfs_fruit: change trigger points of AppleDouble conversion
    
    This moves the trigger points where AppleDouble file conversion is run by
    ad_convert() from deep down the callchain in ad_read_rsrc_adouble() to high
    level VFS entry points.
    
    Currently ad_convert() will be triggered as part of open_file_ntcreate(...,
    "file:AFP_AfpResource", ...): after SMB_VFS_OPEN() has been called with O_CREAT,
    what created the file, we call SMB_VFS_FSTAT() on the just created
    filehandle. This ends up in ad_convert(), finds the resource fork empty and thus
    deletes the file.
    
    This commit moves calling of the conversion funtion to the high level VFS entry
    points where the converted metadata is needed:
    
    o for directory enumerations SMB_VFS_READDIR_ATTR() is called to fill in the
      repurposed fields in the directory entry metadata
    
    o obviously for SMB_VFS_CREATE_FILE() on an macOS stream
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4777d1163a7c18c89ce9be955903427a18134415
Author: Ralph Boehme <slow at samba.org>
Date:   Tue May 21 16:00:00 2019 +0200

    vfs_fruit: add a forward declaration for ad_get()
    
    Will be needed in the next commit.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8ed9b6b457923d2353d1d18838f4a278db48c6b9
Author: Ralph Boehme <slow at samba.org>
Date:   Tue May 21 14:05:04 2019 +0200

    selftest: run vfs.fruit test against a share that deletes empty resource forks
    
    This reveals a bug in the AppleDouble conversion code: the conversion code that
    unlinks an empty resource fork AppleDouble sidecar file ("._file") gets
    triggered as part of open_file_ntcreate(..., "file:AFP_AfpResource", ...):
    
    after SMB_VFS_OPEN() has been called with O_CREAT, what created the file, we
    call SMB_VFS_FSTAT() on the just created filehandle. This ends up in
    ad_convert(), finds the resource fork empty and thus deletes the file.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bb5a457f2872a383b58d62981dade322fca9b283
Author: Ralph Boehme <slow at samba.org>
Date:   Tue May 21 18:39:52 2019 +0200

    s4:torture/vfs/fruit: ensure test_adouble_conversion_wo_xattr() uses a non-emtpy resourcefork
    
    This ensures the resource fork is not deleted as part of the AppleDouble file
    conversion for the option fruit:wipe_intentionally_left_blank_rfork=yes.
    
    This is currently not a problem in selftest, as we don't enable the option, but
    a subsequent commit will run all vfs.fruit tests against a share with this
    option enabled.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c3d28d49be3c7536d1ccfe8d00553ce72843f369
Author: Ralph Boehme <slow at samba.org>
Date:   Tue May 21 18:39:52 2019 +0200

    s4:torture/vfs/fruit: ensure test_adouble_conversion() uses a non-emtpy resourcefork
    
    This ensures the resource fork is not deleted as part of the AppleDouble file
    conversion for the option fruit:wipe_intentionally_left_blank_rfork=yes.
    
    This is currently not a problem in selftest, as we don't enable the option, but
    a subsequent commit will run all vfs.fruit tests against a share with this
    option enabled.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13958
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cb6525e868106c0f4c725d73b7268d910b9b4029
Author: Christof Schmitt <cs at samba.org>
Date:   Wed May 15 16:05:26 2019 -0700

    libsmbconf:registry: Return correct case for get_share
    
    get_share (called from 'net conf showshare') does a lookup of the share
    name case-insensitively. As the registry stores the share name in the
    correct case and 'net conf list' prints the correct case, also lookup
    the correct case for get_share.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 91350d562b670a3789779e906850d76a141fa857
Author: Christof Schmitt <cs at samba.org>
Date:   Tue May 21 11:11:56 2019 -0700

    net: Return share name in correct case from net rpc conf showshare
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f58127d0248811c0ce246317af8f9e058a7aafed
Author: Christof Schmitt <cs at samba.org>
Date:   Wed May 15 15:55:00 2019 -0700

    selftest: Add test for case-preserving in 'net [rpc] conf showshare'
    
    Add a test to verify that 'net [rpc] conf showshare' returns the correct
    upper/lower case.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 ctdb/common/ctdb_ltdb.c               |  19 -
 ctdb/server/ctdb_ltdb_server.c        |  20 -
 source3/lib/smbconf/smbconf_reg.c     |  26 +-
 source3/modules/vfs_fruit.c           |  65 ++--
 source3/script/tests/test_net_conf.sh |  42 +++
 source3/selftest/tests.py             |   1 +
 source3/utils/net_rpc_conf.c          |  39 +-
 source4/torture/vfs/fruit.c           | 686 +++++++++++++++++++++++++++++++++-
 8 files changed, 822 insertions(+), 76 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c
index de4f44895e4..1fc9ce28c1b 100644
--- a/ctdb/common/ctdb_ltdb.c
+++ b/ctdb/common/ctdb_ltdb.c
@@ -231,7 +231,6 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
 	TDB_DATA rec[2];
 	uint32_t hsize = sizeof(struct ctdb_ltdb_header);
 	int ret;
-	bool seqnum_suppressed = false;
 
 	if (ctdb_db->ctdb_ltdb_store_fn) {
 		return ctdb_db->ctdb_ltdb_store_fn(ctdb_db, key, header, data);
@@ -260,28 +259,10 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
 	rec[1].dsize = data.dsize;
 	rec[1].dptr = data.dptr;
 
-	/* Databases with seqnum updates enabled only get their seqnum
-	   changes when/if we modify the data */
-	if (ctdb_db->seqnum_update != NULL) {
-		TDB_DATA old;
-		old = tdb_fetch(ctdb_db->ltdb->tdb, key);
-
-		if ((old.dsize == hsize + data.dsize) &&
-		    memcmp(old.dptr+hsize, data.dptr, data.dsize) == 0) {
-			tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_SEQNUM);
-			seqnum_suppressed = true;
-		}
-		if (old.dptr != NULL) {
-			free(old.dptr);
-		}
-	}
 	ret = tdb_storev(ctdb_db->ltdb->tdb, key, rec, 2, TDB_REPLACE);
 	if (ret != 0) {
 		DEBUG(DEBUG_ERR, (__location__ " Failed to store dynamic data\n"));
 	}
-	if (seqnum_suppressed) {
-		tdb_add_flags(ctdb_db->ltdb->tdb, TDB_SEQNUM);
-	}
 
 	return ret;
 }
diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c
index 91064d19b73..8cc6c4ba4cc 100644
--- a/ctdb/server/ctdb_ltdb_server.c
+++ b/ctdb/server/ctdb_ltdb_server.c
@@ -62,7 +62,6 @@ static int ctdb_ltdb_store_server(struct ctdb_db_context *ctdb_db,
 	TDB_DATA rec[2];
 	uint32_t hsize = sizeof(struct ctdb_ltdb_header);
 	int ret;
-	bool seqnum_suppressed = false;
 	bool keep = false;
 	bool schedule_for_deletion = false;
 	bool remove_from_delete_queue = false;
@@ -192,22 +191,6 @@ store:
 	rec[1].dsize = data.dsize;
 	rec[1].dptr = data.dptr;
 
-	/* Databases with seqnum updates enabled only get their seqnum
-	   changes when/if we modify the data */
-	if (ctdb_db->seqnum_update != NULL) {
-		TDB_DATA old;
-		old = tdb_fetch(ctdb_db->ltdb->tdb, key);
-
-		if ((old.dsize == hsize + data.dsize) &&
-		    memcmp(old.dptr + hsize, data.dptr, data.dsize) == 0) {
-			tdb_remove_flags(ctdb_db->ltdb->tdb, TDB_SEQNUM);
-			seqnum_suppressed = true;
-		}
-		if (old.dptr != NULL) {
-			free(old.dptr);
-		}
-	}
-
 	DEBUG(DEBUG_DEBUG, (__location__ " db[%s]: %s record: hash[0x%08x]\n",
 			    ctdb_db->db_name,
 			    keep?"storing":"deleting",
@@ -237,9 +220,6 @@ store:
 		schedule_for_deletion = false;
 		remove_from_delete_queue = false;
 	}
-	if (seqnum_suppressed) {
-		tdb_add_flags(ctdb_db->ltdb->tdb, TDB_SEQNUM);
-	}
 
 	if (schedule_for_deletion) {
 		int ret2;
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index 781f1943642..d4a8b8c2989 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -897,10 +897,28 @@ static sbcErr smbconf_reg_get_share(struct smbconf_ctx *ctx,
 	}
 
 	if (servicename != NULL) {
-		tmp_service->name = talloc_strdup(tmp_service, servicename);
-		if (tmp_service->name == NULL) {
-			err = SBC_ERR_NOMEM;
-			goto done;
+		WERROR werr;
+		uint32_t count = 0;
+		char *name = NULL;
+
+		/*
+		 * Determine correct upper/lowercase.
+		 */
+		for (count = 0;
+		     werr = reg_enumkey(tmp_ctx, rpd(ctx)->base_key, count,
+					&name, NULL),
+			     W_ERROR_IS_OK(werr);
+		     count++) {
+			if (!strequal(name, servicename)) {
+				continue;
+			}
+
+			tmp_service->name = talloc_strdup(tmp_service, name);
+			if (tmp_service->name == NULL) {
+				err = SBC_ERR_NOMEM;
+				goto done;
+			}
+			break;
 		}
 	}
 
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 0ccc3c6f069..9e22a1338ae 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -537,6 +537,10 @@ struct fio {
  */
 static struct adouble *ad_init(TALLOC_CTX *ctx, vfs_handle_struct *handle,
 			       adouble_type_t type);
+static struct adouble *ad_get(TALLOC_CTX *ctx,
+			      vfs_handle_struct *handle,
+			      const struct smb_filename *smb_fname,
+			      adouble_type_t type);
 static int ad_set(struct adouble *ad, const struct smb_filename *smb_fname);
 static int ad_fset(struct adouble *ad, files_struct *fsp);
 static int adouble_path(TALLOC_CTX *ctx,
@@ -1448,27 +1452,37 @@ static bool ad_convert_delete_adfile(struct adouble *ad,
  * @return -1 in case an error occurred, 0 if no conversion was done, 1
  * otherwise
  **/
-static int ad_convert(struct adouble *ad,
+static int ad_convert(struct vfs_handle_struct *handle,
 		      const struct smb_filename *smb_fname)
 {
+	struct adouble *ad = NULL;
 	bool ok;
 	bool converted_xattr = false;
 	bool blank;
+	int ret;
+
+	ad = ad_get(talloc_tos(), handle, smb_fname, ADOUBLE_RSRC);
+	if (ad == NULL) {
+		return 0;
+	}
 
 	ok = ad_convert_xattr(ad, smb_fname, &converted_xattr);
 	if (!ok) {
-		return -1;
+		ret = -1;
+		goto done;
 	}
 
 	ok = ad_convert_blank_rfork(ad, &blank);
 	if (!ok) {
-		return -1;
+		ret = -1;
+		goto done;
 	}
 
 	if (converted_xattr || blank) {
 		ok = ad_convert_truncate(ad, smb_fname);
 		if (!ok) {
-			return -1;
+			ret = -1;
+			goto done;
 		}
 	}
 
@@ -1476,15 +1490,20 @@ static int ad_convert(struct adouble *ad,
 	if (!ok) {
 		DBG_ERR("Failed to convert [%s]\n",
 			smb_fname_str_dbg(smb_fname));
-		return -1;
+		ret = -1;
+		goto done;
 	}
 
 	ok = ad_convert_delete_adfile(ad, smb_fname);
 	if (!ok) {
-		return -1;
+		ret = -1;
+		goto done;
 	}
 
-	return 0;
+	ret = 0;
+done:
+	TALLOC_FREE(ad);
+	return ret;
 }
 
 /**
@@ -1737,17 +1756,6 @@ static ssize_t ad_read_rsrc_adouble(struct adouble *ad,
 		return -1;
 	}
 
-	/*
-	 * Try to fixup AppleDouble files created by OS X with xattrs
-	 * appended to the ADEID_FINDERI entry.
-	 */
-
-	ret = ad_convert(ad, smb_fname);
-	if (ret != 0) {
-		DBG_WARNING("Failed to convert [%s]\n", smb_fname->base_name);
-		return len;
-	}
-
 	return len;
 }
 
@@ -2135,9 +2143,8 @@ static bool is_afpresource_stream(const struct smb_filename *smb_fname)
 }
 
 /**
- * Test whether stream is an Apple stream, not used atm
+ * Test whether stream is an Apple stream.
  **/
-#if 0
 static bool is_apple_stream(const struct smb_filename *smb_fname)
 {
 	if (is_afpinfo_stream(smb_fname)) {
@@ -2148,7 +2155,6 @@ static bool is_apple_stream(const struct smb_filename *smb_fname)
 	}
 	return false;
 }
-#endif
 
 /**
  * Initialize config struct from our smb.conf config parameters
@@ -6070,6 +6076,8 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle,
 	struct fruit_config_data *config = NULL;
 	files_struct *fsp = NULL;
 	struct fio *fio = NULL;
+	bool internal_open = (oplock_request & INTERNAL_OPEN_ONLY);
+	int ret;
 
 	status = check_aapl(handle, req, in_context_blobs, out_context_blobs);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -6079,6 +6087,14 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle,
 	SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
 				return NT_STATUS_UNSUCCESSFUL);
 
+	if (is_apple_stream(smb_fname) && !internal_open) {
+		ret = ad_convert(handle, smb_fname);
+		if (ret != 0) {
+			DBG_ERR("ad_convert() failed\n");
+			return NT_STATUS_UNSUCCESSFUL;
+		}
+	}
+
 	status = SMB_VFS_NEXT_CREATE_FILE(
 		handle, req, root_dir_fid, smb_fname,
 		access_mask, share_access,
@@ -6161,6 +6177,7 @@ static NTSTATUS fruit_readdir_attr(struct vfs_handle_struct *handle,
 	struct fruit_config_data *config = NULL;
 	struct readdir_attr_data *attr_data;
 	NTSTATUS status;
+	int ret;
 
 	SMB_VFS_HANDLE_GET_DATA(handle, config,
 				struct fruit_config_data,
@@ -6172,6 +6189,12 @@ static NTSTATUS fruit_readdir_attr(struct vfs_handle_struct *handle,
 
 	DEBUG(10, ("fruit_readdir_attr %s\n", fname->base_name));
 
+	ret = ad_convert(handle, fname);
+	if (ret != 0) {
+		DBG_ERR("ad_convert() failed\n");
+		return NT_STATUS_UNSUCCESSFUL;
+	}
+
 	*pattr_data = talloc_zero(mem_ctx, struct readdir_attr_data);
 	if (*pattr_data == NULL) {
 		return NT_STATUS_UNSUCCESSFUL;
diff --git a/source3/script/tests/test_net_conf.sh b/source3/script/tests/test_net_conf.sh
index a81b21e5332..1b9a4be019a 100755
--- a/source3/script/tests/test_net_conf.sh
+++ b/source3/script/tests/test_net_conf.sh
@@ -254,6 +254,44 @@ test_conf_delshare_usage()
     fi
 }
 
+test_conf_showshare_case()
+{
+	echo '\nChecking case in net conf shareshare' >>$LOG
+
+	echo '\nDropping existing configuration' >> $LOG
+	$NETCMD conf drop
+	log_print $NETCMD conf drop
+	test "x$?" = "x0" || {
+		echo 'ERROR: RC does not match, expected: 0' | tee -a $LOG
+		return 1
+	}
+
+	for share in UPPERCASE lowercase; do
+
+		log_print $NETCMD conf addshare $share /tmp
+		$NETCMD conf addshare $share /tmp \
+			>>$DIR/case_addshare_exp \
+			2>>$DIR/case_addshare_exp
+
+		# Lookup share in different case, check that output has
+		# share name in correct case.
+		switch_case=$(echo $share | tr 'A-Za-z' 'a-zA-Z')
+		log_print $NETCMD conf showshare $switch_case
+		$NETCMD conf showshare $switch_case > $DIR/showshare_out
+		test "x$?" = "x0" || {
+			echo 'ERROR: net conf showshare failed.' | tee -a $LOG
+			return 1
+		}
+
+		grep "\[$share\]" $DIR/showshare_out >/dev/null 2>>$LOG
+		if [ "$?" = "1" ]; then
+			echo "ERROR: share not found" | tee -a $LOG
+			return 1
+		fi
+	done
+
+}
+
 test_conf_drop()
 {
 
@@ -922,6 +960,10 @@ CONF_FILES=$SERVERCONFFILE
 	test_conf_delshare_usage \
 	|| failed=`expr $failed + 1`
 
+    testit "test_conf_showshare_case" \
+	   test_conf_showshare_case \
+	|| failed=`expr $failed + 1`
+
     testit "conf_setparm" \
 	test_conf_setparm \
 	|| failed=`expr $failed + 1`
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 4df2553a525..a48ea2054fe 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -601,6 +601,7 @@ for t in tests:
         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 -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')
+        plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_delete_empty_adfiles -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share --option=torture:share2=vfs_wo_fruit', 'fruit_delete_empty_adfiles')
     elif t == "vfs.fruit_netatalk":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/vfs_fruit_xattr -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/nt4_dc/share')
     elif t == "vfs.fruit_timemachine":
diff --git a/source3/utils/net_rpc_conf.c b/source3/utils/net_rpc_conf.c
index 4747da98325..a68d3f70607 100644
--- a/source3/utils/net_rpc_conf.c
+++ b/source3/utils/net_rpc_conf.c
@@ -418,8 +418,9 @@ static NTSTATUS rpc_conf_get_share(TALLOC_CTX *mem_ctx,
 	WERROR _werr;
 	struct policy_handle child_hnd;
 	int32_t includes_cnt, includes_idx = -1;
-	uint32_t num_vals, i, param_cnt = 0;
+	uint32_t num_vals, num_subkeys, i, param_cnt = 0;
 	const char **val_names;
+	const char **subkeys = NULL;
 	enum winreg_Type *types;
 	DATA_BLOB *data;
 	struct winreg_String key = { 0, };
@@ -429,7 +430,39 @@ static NTSTATUS rpc_conf_get_share(TALLOC_CTX *mem_ctx,
 
 	ZERO_STRUCT(tmp_share);
 
-	key.name = share_name;
+	/*
+	 * Determine correct upper/lowercase.
+	 */
+	status = dcerpc_winreg_enum_keys(frame,
+					 b,
+					 parent_hnd,
+					 &num_subkeys,
+					 &subkeys,
+					 &result);
+	if (!(NT_STATUS_IS_OK(status))) {
+		d_fprintf(stderr, _("Failed to enumerate shares: %s\n"),
+				nt_errstr(status));
+		goto error;
+	}
+	if (!(W_ERROR_IS_OK(result))) {
+		d_fprintf(stderr, _("Failed to enumerate shares: %s\n"),
+				win_errstr(result));
+		goto error;
+	}
+
+	for (i = 0; i < num_subkeys; i++) {
+		if (!strequal(share_name, subkeys[i])) {
+			continue;
+		}
+
+		key.name = subkeys[i];
+	}
+
+	if (key.name == NULL) {
+		d_fprintf(stderr, _("Could not find share.\n"));
+		goto error;
+	}
+
 	status = dcerpc_winreg_OpenKey(b, frame, parent_hnd, key, 0,
 			       REG_KEY_READ, &child_hnd, &result);
 
@@ -487,7 +520,7 @@ static NTSTATUS rpc_conf_get_share(TALLOC_CTX *mem_ctx,
 		     includes_cnt ++);
 	}
 	/* place the name of the share in the smbconf_service struct */
-	tmp_share.name = talloc_strdup(frame, share_name);
+	tmp_share.name = talloc_strdup(frame, key.name);
 	if (tmp_share.name == NULL) {
 		result = WERR_NOT_ENOUGH_MEMORY;
 		d_fprintf(stderr, _("Failed to create share: %s\n"),
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index 45c7aaac7a3..e3d8539595d 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -902,7 +902,7 @@ static char osx_adouble_w_xattr[] = {
  *
  * -RAW DUMP--:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F : (ASCII)
  * 00000000   : 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 1E : ................
- * 00000010   : 54 68 69 73 20 72 65 73 6F 75 72 63 65 20 66 6F : This resource fo
+ * 00000010   : F0 F1 F2 F3 F5 F5 F6 F7 F8 F9 FA FB FC FD FE FF : ................
  * 00000020   : 72 6B 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 6C 79 : rk intentionally
  * 00000030   : 20 6C 65 66 74 20 62 6C 61 6E 6B 20 20 20 00 00 :  left blank   ..
  * 00000040   : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................
@@ -991,9 +991,669 @@ static char osx_adouble_without_xattr[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
 	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x1e, 0x54, 0x68, 0x69, 0x73, 0x20, 0x72,
-	0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20,
-	0x66, 0x6f, 0x72, 0x6b, 0x20, 0x69, 0x6e, 0x74,
+	0x00, 0x1e, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5,
+	0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd,
+	0xfe, 0xff, 0x72, 0x6b, 0x20, 0x69, 0x6e, 0x74,
+	0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+	0x6c, 0x79, 0x20, 0x6c, 0x65, 0x66, 0x74, 0x20,
+	0x62, 0x6c, 0x61, 0x6e, 0x6b, 0x20, 0x20, 0x20,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x1c, 0x00, 0x1e, 0xff, 0xff
+};
+
+/*
+The buf below contains the following AppleDouble encoded data:
+
+-------------------------------------------------------------------------------
+MagicNumber: 00051607                                        : AppleDouble
+Version    : 00020000                                        : Version 2
+Filler     : 4D 61 63 20 4F 53 20 58 20 20 20 20 20 20 20 20 : Mac OS X
+Num. of ent: 0002                                            : 2
+
+-------------------------------------------------------------------------------
+Entry ID   : 00000009 : Finder Info
+Offset     : 00000032 : 50
+Length     : 00000EB0 : 3760
+
+-FInfo-----:
+Type       : 54455354 : TEST
+Creator    : 534C4F57 : SLOW
+isAlias    : 0
+Invisible  : 0
+hasBundle  : 0
+nameLocked : 0


-- 
Samba Shared Repository



More information about the samba-cvs mailing list