From ccb8abb0e727941cb0b22cc55b2190644df81396 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 28 Dec 2022 16:18:40 +0100 Subject: [PATCH] selftest: add samba3.blackbox.registry_share This demonstrates the regression introduced by f03665bb7e8ea97699062630f2aa1bac4c5dfc7f, where registry shares are no longer listed. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15243 BUG: https://bugzilla.samba.org/show_bug.cgi?id=15266 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Walker (cherry picked from commit a00c7395fbc7974a61a70ae54ea6ae6349933de2) --- selftest/knownfail.d/registry_share | 1 + selftest/target/Samba3.pm | 30 ++++++++++++++++ source3/script/tests/test_registry_share.sh | 39 +++++++++++++++++++++ source3/selftest/tests.py | 5 +++ 4 files changed, 75 insertions(+) create mode 100644 selftest/knownfail.d/registry_share create mode 100755 source3/script/tests/test_registry_share.sh diff --git a/selftest/knownfail.d/registry_share b/selftest/knownfail.d/registry_share new file mode 100644 index 00000000000..4adbf0915b8 --- /dev/null +++ b/selftest/knownfail.d/registry_share @@ -0,0 +1 @@ +^samba3.blackbox.registry_share.Test.for.share.enum.with.registry.share.clusteredmember diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 0b720a68927..cb17408e398 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -529,6 +529,36 @@ sub setup_clusteredmember return undef; } + my $registry_share_template = "$node_ret->{SERVERCONFFILE}.registry_share_template"; + unless (open(REGISTRYCONF, ">$registry_share_template")) { + warn("Unable to open $registry_share_template"); + teardown_env($self, $node_ret); + teardown_env($self, $ctdb_data); + return undef; + } + + print REGISTRYCONF " +[registry_share] + copy = tmp + comment = smb username is [%U] +"; + + close(REGISTRYCONF); + + my $net = Samba::bindir_path($self, "net"); + my $cmd = ""; + + $cmd .= "UID_WRAPPER_ROOT=1 "; + $cmd .= "$net conf import $node_ret->{CONFIGURATION} ${registry_share_template}"; + + my $net_ret = system($cmd); + if ($net_ret != 0) { + warn("net conf import failed: $net_ret\n$cmd"); + teardown_env($self, $node_ret); + teardown_env($self, $ctdb_data); + return undef; + } + my $nmblookup = Samba::bindir_path($self, "nmblookup"); do { print "Waiting for the LOGON SERVER registration ...\n"; diff --git a/source3/script/tests/test_registry_share.sh b/source3/script/tests/test_registry_share.sh new file mode 100755 index 00000000000..22e9f732a58 --- /dev/null +++ b/source3/script/tests/test_registry_share.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Blackbox tests for registry shares +# + +if [ $# -lt 3 ]; then + cat <