The branch, master has been updated
       via  f03665bb7e8 s3:rpc_server: Fix include directive substitution when 
enumerating shares
       via  c213ead8c4c s3:tests: Add substitution test for listing shares
       via  ce3d27a9f5a s3:tests: Add substitution test for include directive
      from  26adf334433 s3: smbd: Cause SMB2_OP_FLUSH to go synchronous in a 
compound anywhere but the last operation in the list.

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


- Log -----------------------------------------------------------------
commit f03665bb7e8ea97699062630f2aa1bac4c5dfc7f
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Nov 16 11:24:12 2022 +0100

    s3:rpc_server: Fix include directive substitution when enumerating shares
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15243
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    
    Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org>
    Autobuild-Date(master): Fri Nov 18 19:17:31 UTC 2022 on sn-devel-184

commit c213ead8c4c1b5287294a67e65f271fbb0b922b2
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Nov 16 11:23:44 2022 +0100

    s3:tests: Add substitution test for listing shares
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15243
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>

commit ce3d27a9f5a98b4680af5fb5a595b0e7e94f8c30
Author: Andreas Schneider <a...@samba.org>
Date:   Tue Nov 15 16:35:15 2022 +0100

    s3:tests: Add substitution test for include directive
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15243
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>

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

Summary of changes:
 selftest/target/Samba3.pm                  | 17 +++++++++++++++++
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c  |  8 ++++++++
 source3/script/tests/test_substitutions.sh | 27 +++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 4db74e4d86e..7a7fd666054 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2680,6 +2680,8 @@ sub provision($$)
        my $errorinjectconf="$libdir/error_inject.conf";
        my $delayinjectconf="$libdir/delay_inject.conf";
        my $globalinjectconf="$libdir/global_inject.conf";
+       my $aliceconfdir="$libdir";
+       my $aliceconffile="$libdir/alice.conf";
 
        my $nss_wrapper_pl = "$ENV{PERL} 
$self->{srcdir}/third_party/nss_wrapper/nss_wrapper.pl";
        my $nss_wrapper_passwd = "$privatedir/passwd";
@@ -3461,6 +3463,8 @@ sub provision($$)
 [only_ipv6]
        copy = tmpguest
        server addresses = $server_ipv6
+
+include = $aliceconfdir/%U.conf
        ";
 
        close(CONF);
@@ -3501,6 +3505,19 @@ sub provision($$)
        }
        close(DELAYCONF);
 
+       unless (open(ALICECONF, ">$aliceconffile")) {
+               warn("Unable to open $aliceconffile");
+               return undef;
+       }
+
+       print ALICECONF "
+[alice_share]
+       path = $shrdir
+       comment = smb username is [%U]
+       ";
+
+       close(ALICECONF);
+
        ##
        ## create a test account
        ##
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c 
b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 4fcb7681d84..ed262a8cd0d 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -650,6 +650,14 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct 
*p,
                added_home = register_homes_share(unix_name);
        }
 
+       /*
+        * We need to make sure to reload the services for the connecting user.
+        * It is possible that the we have includes with substitutions.
+        *
+        *  include = /etc/samba/%U.conf
+        */
+       reload_services(NULL, NULL, false);
+
        num_services = lp_numservices();
 
         allowed = talloc_zero_array(ctx, bool, num_services);
diff --git a/source3/script/tests/test_substitutions.sh 
b/source3/script/tests/test_substitutions.sh
index 157381e6cb2..aa0b38d1b64 100755
--- a/source3/script/tests/test_substitutions.sh
+++ b/source3/script/tests/test_substitutions.sh
@@ -20,6 +20,7 @@ failed=0
 samba_bindir="$BINDIR"
 samba_srcdir="$SRCDIR"
 smbclient="$samba_bindir/smbclient"
+rpcclient="$samba_bindir/rpcclient"
 
 . $samba_srcdir/testprogs/blackbox/subunit.sh
 . $samba_srcdir/testprogs/blackbox/common_test_fns.inc
@@ -49,4 +50,30 @@ SMB_UNC="//$SERVER/sub_valid_users_group"
 test_smbclient "Test login to share with substitution for valid user's UNIX 
group" \
        "ls" "$SMB_UNC" "-U$USERNAME%$PASSWORD" || failed=$(expr $failed + 1)
 
+test_smbclient \
+       "Test for login to share with include substitution [${USERNAME}]" \
+       "ls" "//${SERVER}/${USERNAME}_share" "-U$USERNAME%$PASSWORD" ||
+       failed=$((failed + 1))
+
+test_smbclient_expect_failure \
+       "Netative test for login to share with include substitution 
[${DC_USERNAME}]" \
+       "ls" "//${SERVER}/${USERNAME}_share" "-U$DC_USERNAME%$DC_PASSWORD" ||
+       failed=$((failed + 1))
+
+testit_grep_count \
+       "Test for share enum with include substitution" \
+       "netname: ${USERNAME}_share" \
+       1 \
+       ${rpcclient} "ncacn_np:${SERVER}" "-U$USERNAME%$PASSWORD" \
+       -c netshareenum ||
+       failed=$((failed + 1))
+
+testit_grep_count \
+       "Negative test for share enum with include substitution" \
+       "netname: ${USERNAME}_share" \
+       0 \
+       ${rpcclient} "ncacn_np:${SERVER}" "-U$DC_USERNAME%$DC_PASSWORD" \
+       -c netshareenum ||
+       failed=$((failed + 1))
+
 exit $failed


-- 
Samba Shared Repository

Reply via email to