]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
selftest: Add a user with a different userPrincipalName
authorAndreas Schneider <asn@samba.org>
Fri, 20 Apr 2018 07:38:24 +0000 (09:38 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 24 May 2018 10:50:13 +0000 (12:50 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13369

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 5319cae00096dcecc29aa9fa675a983352ad64d8)

selftest/target/Samba4.pm

index 6a1856ef642129a6e85a43e171d6fe05a22fed0b..7da68c4477645c7ada8129d45ff59e8f7310a1c4 100755 (executable)
@@ -840,7 +840,7 @@ userPrincipalName: testdenied_upn\@$ctx->{realm}.upn
        }
 
        # Create to users alice and bob!
-       my $user_account_array = ["alice", "bob"];
+       my $user_account_array = ["alice", "bob", "jane"];
 
        foreach my $user_account (@{$user_account_array}) {
                my $samba_tool_cmd = "";
@@ -855,6 +855,23 @@ userPrincipalName: testdenied_upn\@$ctx->{realm}.upn
                }
        }
 
+       my $ldbmodify = "";
+       $ldbmodify .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" ";
+       $ldbmodify .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" ";
+       $ldbmodify .= Samba::bindir_path($self, "ldbmodify");
+
+       my $base_dn = "DC=".join(",DC=", split(/\./, $ctx->{realm}));
+       my $user_dn = "cn=jane,cn=users,$base_dn";
+
+       open(LDIF, "|$ldbmodify -H $ctx->{privatedir}/sam.ldb");
+       print LDIF "dn: $user_dn
+changetype: modify
+replace: userPrincipalName
+userPrincipalName: jane.doe\@$ctx->{realm}
+-
+";
+       close(LDIF);
+
        return $ret;
 }