]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
selftest: Make 'Samba Users' the primary group of joe
authorAndreas Schneider <asn@samba.org>
Wed, 15 Jan 2020 13:41:37 +0000 (14:41 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 24 Jan 2020 15:46:42 +0000 (15:46 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
selftest/target/Samba4.pm

index 01ab6e8b4ddabf33ecea119794e2140fdb68632c..da9f0a00e912511585d7b51916bc05e2855f7384 100755 (executable)
@@ -1011,6 +1011,34 @@ servicePrincipalName: http/testupnspn.$ctx->{dnsname}
                }
        }
 
+       # Add user joe to group "Samba Users"
+       my $samba_tool_cmd = "";
+       my $group = "Samba Users";
+       my $user_account = "joe";
+
+       $samba_tool_cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
+       $samba_tool_cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
+       $samba_tool_cmd .= Samba::bindir_path($self, "samba-tool")
+           . " group addmembers --configfile=$ctx->{smb_conf} \"$group\" $user_account";
+       unless (system($samba_tool_cmd) == 0) {
+               warn("Unable to add " . $user_account . "to group group : $group\n$samba_tool_cmd\n");
+               return undef;
+       }
+
+       my $samba_tool_cmd = "";
+       my $group = "Samba Users";
+       my $user_account = "joe";
+
+       $samba_tool_cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
+       $samba_tool_cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
+       $samba_tool_cmd .= Samba::bindir_path($self, "samba-tool")
+           . " user setprimarygroup --configfile=$ctx->{smb_conf} $user_account \"$group\"";
+       unless (system($samba_tool_cmd) == 0) {
+               warn("Unable to set primary group of user: $user_account\n$samba_tool_cmd\n");
+               return undef;
+       }
+
+       # Change the userPrincipalName for jane
        my $ldbmodify = "";
        $ldbmodify .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
        $ldbmodify .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";