add a test for a LSA lookupnames with a NULL string
[kai/samba.git] / source4 / torture / rpc / lsa.c
index 4fb459ea2564237ad266041a8ef7bf5f6c0e7fff..45f67afd699fd0583dd1e23e7131927aa440a9fc 100644 (file)
 #include "torture/torture.h"
 #include "librpc/gen_ndr/ndr_lsa_c.h"
 #include "librpc/gen_ndr/netlogon.h"
+#include "librpc/gen_ndr/ndr_drsblobs.h"
 #include "lib/events/events.h"
 #include "libcli/security/security.h"
 #include "libcli/auth/libcli_auth.h"
 #include "torture/rpc/rpc.h"
 #include "param/param.h"
-
+#include "../lib/crypto/crypto.h"
 #define TEST_MACHINENAME "lsatestmach"
 
 static void init_lsa_String(struct lsa_String *name, const char *s)
@@ -221,12 +222,13 @@ static bool test_LookupNames_bogus(struct dcerpc_pipe *p,
        NTSTATUS status;
        int i;
 
-       struct lsa_TranslatedName name;
+       struct lsa_TranslatedName name[2];
        struct lsa_TransNameArray tnames;
 
-       tnames.names = &name;
-       tnames.count = 1;
-       name.name.string = "NT AUTHORITY\\BOGUS";
+       tnames.names = name;
+       tnames.count = 2;
+       name[0].name.string = "NT AUTHORITY\\BOGUS";
+       name[1].name.string = NULL;
 
        printf("\nTesting LookupNames with bogus names\n");
 
@@ -614,7 +616,8 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
                if (!test_LookupNames(p, mem_ctx, handle, &names)) {
                        return false;
                }
-       } else {
+       } else if (p->conn->security_state.auth_info->auth_type == DCERPC_AUTH_TYPE_SCHANNEL &&
+                  p->conn->security_state.auth_info->auth_level >= DCERPC_AUTH_LEVEL_INTEGRITY) {
                struct lsa_LookupSids3 r;
                struct lsa_TransNameArray2 names;
 
@@ -779,6 +782,7 @@ static bool test_LookupPrivName(struct dcerpc_pipe *p,
 
 static bool test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p, 
                                             TALLOC_CTX *mem_ctx,                                 
+                                            struct policy_handle *handle,
                                             struct policy_handle *acct_handle,
                                             struct lsa_LUID *luid)
 {
@@ -801,7 +805,25 @@ static bool test_RemovePrivilegesFromAccount(struct dcerpc_pipe *p,
 
        status = dcerpc_lsa_RemovePrivilegesFromAccount(p, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
-               printf("RemovePrivilegesFromAccount failed - %s\n", nt_errstr(status));
+               
+               struct lsa_LookupPrivName r_name;
+               
+               r_name.in.handle = handle;
+               r_name.in.luid = luid;
+               
+               status = dcerpc_lsa_LookupPrivName(p, mem_ctx, &r_name);
+               if (!NT_STATUS_IS_OK(status)) {
+                       printf("\nLookupPrivName failed - %s\n", nt_errstr(status));
+                       return false;
+               }
+               /* Windows 2008 does not allow this to be removed */
+               if (strcmp("SeAuditPrivilege", r_name.out.name->string) == 0) {
+                       return ret;
+               }
+
+               printf("RemovePrivilegesFromAccount failed to remove %s - %s\n", 
+                      r_name.out.name->string, 
+                      nt_errstr(status));
                return false;
        }
 
@@ -864,7 +886,7 @@ static bool test_EnumPrivsAccount(struct dcerpc_pipe *p,
                                            &r.out.privs->set[i].luid);
                }
 
-               ret &= test_RemovePrivilegesFromAccount(p, mem_ctx, acct_handle, 
+               ret &= test_RemovePrivilegesFromAccount(p, mem_ctx, handle, acct_handle, 
                                                        &r.out.privs->set[0].luid);
                ret &= test_AddPrivilegesToAccount(p, mem_ctx, acct_handle, 
                                                   &r.out.privs->set[0].luid);
@@ -884,6 +906,26 @@ static bool test_Delete(struct dcerpc_pipe *p,
 
        r.in.handle = handle;
        status = dcerpc_lsa_Delete(p, mem_ctx, &r);
+       if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+               printf("Delete should have failed NT_STATUS_NOT_SUPPORTED - %s\n", nt_errstr(status));
+               return false;
+       }
+
+       return true;
+}
+
+static bool test_DeleteObject(struct dcerpc_pipe *p, 
+                             TALLOC_CTX *mem_ctx, 
+                             struct policy_handle *handle)
+{
+       NTSTATUS status;
+       struct lsa_DeleteObject r;
+
+       printf("testing DeleteObject\n");
+
+       r.in.handle = handle;
+       r.out.handle = handle;
+       status = dcerpc_lsa_DeleteObject(p, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Delete failed - %s\n", nt_errstr(status));
                return false;
@@ -912,7 +954,19 @@ static bool test_CreateAccount(struct dcerpc_pipe *p,
        r.out.acct_handle = &acct_handle;
 
        status = dcerpc_lsa_CreateAccount(p, mem_ctx, &r);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+               struct lsa_OpenAccount r_o;
+               r_o.in.handle = handle;
+               r_o.in.sid = newsid;
+               r_o.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+               r_o.out.acct_handle = &acct_handle;
+               
+               status = dcerpc_lsa_OpenAccount(p, mem_ctx, &r_o);
+               if (!NT_STATUS_IS_OK(status)) {
+                       printf("OpenAccount failed - %s\n", nt_errstr(status));
+                       return false;
+               }
+       } else if (!NT_STATUS_IS_OK(status)) {
                printf("CreateAccount failed - %s\n", nt_errstr(status));
                return false;
        }
@@ -921,6 +975,10 @@ static bool test_CreateAccount(struct dcerpc_pipe *p,
                return false;
        }
 
+       if (!test_DeleteObject(p, mem_ctx, &acct_handle)) {
+               return false;
+       }
+
        return true;
 }
 
@@ -948,6 +1006,10 @@ static bool test_DeleteTrustedDomain(struct dcerpc_pipe *p,
                return false;
        }
 
+       if (!test_DeleteObject(p, mem_ctx, &trustdom_handle)) {
+               return false;
+       }
+
        return true;
 }
 
@@ -986,7 +1048,7 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
        struct lsa_SetSecret r7;
        struct lsa_QuerySecret r8;
        struct policy_handle sec_handle, sec_handle2, sec_handle3;
-       struct lsa_Delete d;
+       struct lsa_DeleteObject d_o;
        struct lsa_DATA_BUF buf1;
        struct lsa_DATA_BUF_PTR bufp1;
        struct lsa_DATA_BUF_PTR bufp2;
@@ -1121,7 +1183,7 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
                                                              &blob1, &session_key);
                                
                                if (strcmp(secret1, secret2) != 0) {
-                                       printf("Returned secret '%s' doesn't match '%s'\n", 
+                                       printf("Returned secret (r4) '%s' doesn't match '%s'\n", 
                                               secret2, secret1);
                                        ret = false;
                                }
@@ -1136,7 +1198,9 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
                r5.in.new_val->data = enc_key.data;
                r5.in.new_val->length = enc_key.length;
                r5.in.new_val->size = enc_key.length;
-               
+
+
+               msleep(200);
                printf("Testing SetSecret (existing value should move to old)\n");
                
                status = dcerpc_lsa_SetSecret(p, mem_ctx, &r5);
@@ -1200,8 +1264,10 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
                                }
                                
                                if (*r6.out.new_mtime == *r6.out.old_mtime) {
-                                       printf("Returned secret %s had same mtime for both secrets: %s\n", 
+                                       printf("Returned secret (r6-%d) %s must not have same mtime for both secrets: %s != %s\n", 
+                                              i,
                                               secname[i],
+                                              nt_time_string(mem_ctx, *r6.out.old_mtime), 
                                               nt_time_string(mem_ctx, *r6.out.new_mtime));
                                        ret = false;
                                }
@@ -1245,35 +1311,16 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
                        if (!r8.out.new_val || !r8.out.old_val) {
                                printf("in/out pointers not returned, despite being set on in for QuerySecret\n");
                                ret = false;
-                       } else if (r8.out.new_val->buf == NULL) {
-                               if (i != LOCAL) { 
-                                       printf("NEW secret buffer not returned after GLOBAL OLD set\n");
-                                       ret = false;
-                               }
+                       } else if (r8.out.new_val->buf != NULL) {
+                               printf("NEW secret buffer must not be returned after OLD set\n");
+                               ret = false;
                        } else if (r8.out.old_val->buf == NULL) {
-                               printf("OLD secret buffer not returned after OLD set\n");
+                               printf("OLD secret buffer was not returned after OLD set\n");
                                ret = false;
                        } else if (r8.out.new_mtime == NULL || r8.out.old_mtime == NULL) {
                                printf("Both times not returned after OLD set\n");
                                ret = false;
                        } else {
-                               if (i == LOCAL) { 
-                                       printf("NEW secret buffer should not be returned after LOCAL OLD set\n");
-                                       ret = false;
-                               }
-                               blob1.data = r8.out.new_val->buf->data;
-                               blob1.length = r8.out.new_val->buf->length;
-                               
-                               blob2 = data_blob_talloc(mem_ctx, NULL, blob1.length);
-                               
-                               secret6 = sess_decrypt_string(mem_ctx,
-                                                             &blob1, &session_key);
-                               
-                               if (strcmp(secret3, secret4) != 0) {
-                                       printf("Returned NEW secret '%s' doesn't match '%s'\n", secret4, secret3);
-                                       ret = false;
-                               }
-
                                blob1.data = r8.out.old_val->buf->data;
                                blob1.length = r8.out.old_val->buf->size;
                                
@@ -1287,15 +1334,8 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
                                        ret = false;
                                }
                                
-                               if (*r8.out.new_mtime == *r8.out.old_mtime) {
-                                       if (i != GLOBAL) { 
-                                               printf("Returned secret %s had same mtime for both secrets: %s\n", 
-                                                      secname[i],
-                                                      nt_time_string(mem_ctx, *r8.out.new_mtime));
-                                               ret = false;
-                                       }
-                               } else {
-                                       printf("Returned secret %s should have had same mtime for both secrets: %s != %s\n", 
+                               if (*r8.out.new_mtime != *r8.out.old_mtime) {
+                                       printf("Returned secret (r8) %s did not had same mtime for both secrets: %s != %s\n", 
                                               secname[i],
                                               nt_time_string(mem_ctx, *r8.out.old_mtime),
                                               nt_time_string(mem_ctx, *r8.out.new_mtime));
@@ -1308,8 +1348,13 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
                        ret = false;
                }
                
-               d.in.handle = &sec_handle2;
-               status = dcerpc_lsa_Delete(p, mem_ctx, &d);
+               if (!test_DeleteObject(p, mem_ctx, &sec_handle)) {
+                       return false;
+               }
+
+               d_o.in.handle = &sec_handle2;
+               d_o.out.handle = &sec_handle2;
+               status = dcerpc_lsa_DeleteObject(p, mem_ctx, &d_o);
                if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
                        printf("Second delete expected INVALID_HANDLE - %s\n", nt_errstr(status));
                        ret = false;
@@ -1454,9 +1499,9 @@ static bool test_EnumAccounts(struct dcerpc_pipe *p,
                        return false;
                }
 
-               if (!test_LookupSids3(p, mem_ctx, &sids1)) {
-                       return false;
-               }
+               /* Can't test lookupSids3 here, as clearly we must not
+                * be on schannel, or we would not be able to do the
+                * rest */
 
                printf("testing all accounts\n");
                for (i=0;i<sids1.num_sids;i++) {
@@ -1667,8 +1712,8 @@ static bool test_query_each_TrustDom(struct dcerpc_pipe *p,
                struct policy_handle handle2;
                struct lsa_Close c;
                struct lsa_CloseTrustedDomainEx c_trust;
-               int levels [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
-               int ok[]      = {1, 0, 1, 0, 0, 1, 0, 1, 0,  0,  0,  1};
+               int levels [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
+               int ok[]      = {1, 0, 1, 0, 0, 1, 0, 1, 0,  0,  0,  1, 1};
 
                if (domains->domains[i].sid) {
                        trust.in.handle = handle;
@@ -1840,6 +1885,9 @@ static bool test_EnumTrustDom(struct dcerpc_pipe *p,
                return false;
        }
                
+       /* Start from the bottom again */
+       resume_handle = 0;
+
        do {
                r.in.handle = handle;
                r.in.resume_handle = &resume_handle;
@@ -1912,8 +1960,6 @@ static bool test_EnumTrustDom(struct dcerpc_pipe *p,
                                       r_ex.in.max_size,
                                       LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER, 
                                       r_ex.in.max_size / LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER);
-                               ret = false;
-                               exit(1);
                        }
                } else if (!NT_STATUS_IS_OK(enum_status)) {
                        printf("EnumTrustedDomainEx failed - %s\n", nt_errstr(enum_status));
@@ -1960,7 +2006,7 @@ static bool test_CreateTrustedDomain(struct dcerpc_pipe *p,
                trustinfo.sid = domsid[i];
                init_lsa_String((struct lsa_String *)&trustinfo.name, trust_name);
 
-               r.in.handle = handle;
+               r.in.policy_handle = handle;
                r.in.info = &trustinfo;
                r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
                r.out.trustdom_handle = &trustdom_handle[i];
@@ -1976,7 +2022,7 @@ static bool test_CreateTrustedDomain(struct dcerpc_pipe *p,
                } else {
                
                        q.in.trustdom_handle = &trustdom_handle[i];
-                       q.in.level = LSA_TRUSTED_DOMAIN_INFO_NAME;
+                       q.in.level = LSA_TRUSTED_DOMAIN_INFO_INFO_EX;
                        status = dcerpc_lsa_QueryTrustedDomainInfo(p, mem_ctx, &q);
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("QueryTrustedDomainInfo level 1 failed - %s\n", nt_errstr(status));
@@ -1984,9 +2030,156 @@ static bool test_CreateTrustedDomain(struct dcerpc_pipe *p,
                        } else if (!q.out.info) {
                                ret = false;
                        } else {
-                               if (strcmp(q.out.info->name.netbios_name.string, trustinfo.name.string) != 0) {
+                               if (strcmp(q.out.info->info_ex.netbios_name.string, trustinfo.name.string) != 0) {
                                        printf("QueryTrustedDomainInfo returned inconsistant short name: %s != %s\n",
-                                              q.out.info->name.netbios_name.string, trustinfo.name.string);
+                                              q.out.info->info_ex.netbios_name.string, trustinfo.name.string);
+                                       ret = false;
+                               }
+                               if (q.out.info->info_ex.trust_type != LSA_TRUST_TYPE_DOWNLEVEL) {
+                                       printf("QueryTrustedDomainInfo of %s returned incorrect trust type %d != %d\n", 
+                                              trust_name, q.out.info->info_ex.trust_type, LSA_TRUST_TYPE_DOWNLEVEL);
+                                       ret = false;
+                               }
+                               if (q.out.info->info_ex.trust_attributes != 0) {
+                                       printf("QueryTrustedDomainInfo of %s returned incorrect trust attributes %d != %d\n", 
+                                              trust_name, q.out.info->info_ex.trust_attributes, 0);
+                                       ret = false;
+                               }
+                               if (q.out.info->info_ex.trust_direction != LSA_TRUST_DIRECTION_OUTBOUND) {
+                                       printf("QueryTrustedDomainInfo of %s returned incorrect trust direction %d != %d\n", 
+                                              trust_name, q.out.info->info_ex.trust_direction, LSA_TRUST_DIRECTION_OUTBOUND);
+                                       ret = false;
+                               }
+                       }
+               }
+       }
+
+       /* now that we have some domains to look over, we can test the enum calls */
+       if (!test_EnumTrustDom(p, mem_ctx, handle)) {
+               ret = false;
+       }
+       
+       for (i=0; i<12; i++) {
+               if (!test_DeleteTrustedDomainBySid(p, mem_ctx, handle, domsid[i])) {
+                       ret = false;
+               }
+       }
+
+       return ret;
+}
+
+static bool test_CreateTrustedDomainEx2(struct dcerpc_pipe *p, 
+                                       struct torture_context *tctx, 
+                                       TALLOC_CTX *mem_ctx, 
+                                       struct policy_handle *handle)
+{
+       NTSTATUS status;
+       bool ret = true;
+       struct lsa_CreateTrustedDomainEx2 r;
+       struct lsa_TrustDomainInfoInfoEx trustinfo;
+       struct lsa_TrustDomainInfoAuthInfoInternal authinfo;
+       struct trustDomainPasswords auth_struct;
+       DATA_BLOB auth_blob;
+       struct dom_sid *domsid[12];
+       struct policy_handle trustdom_handle[12];
+       struct lsa_QueryTrustedDomainInfo q;
+       DATA_BLOB session_key;
+       enum ndr_err_code ndr_err;
+       int i;
+
+       printf("Testing CreateTrustedDomainEx2 for 12 domains\n");
+
+       status = dcerpc_fetch_session_key(p, &session_key);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("dcerpc_fetch_session_key failed - %s\n", nt_errstr(status));
+               return false;
+       }
+               
+       for (i=0; i< 12; i++) {
+               char *trust_name = talloc_asprintf(mem_ctx, "torturedom%02d", i);
+               char *trust_name_dns = talloc_asprintf(mem_ctx, "torturedom%02d.samba.example.com", i);
+               char *trust_sid = talloc_asprintf(mem_ctx, "S-1-5-21-97398-379795-100%02d", i);
+               
+               domsid[i] = dom_sid_parse_talloc(mem_ctx, trust_sid);
+
+               trustinfo.sid = domsid[i];
+               trustinfo.netbios_name.string = trust_name;
+               trustinfo.domain_name.string = trust_name_dns;
+
+               /* Create inbound, some outbound, and some
+                * bi-directional trusts in a repeating pattern based
+                * on i */
+
+               /* 1 == inbound, 2 == outbound, 3 == both */
+               trustinfo.trust_direction = (i % 3) + 1;
+
+               /* Try different trust types too */
+
+               /* 1 == downleven (NT4), 2 == uplevel (ADS), 3 == MIT (kerberos but not AD) */
+               trustinfo.trust_type = (((i / 3) + 1) % 3) + 1;
+
+               trustinfo.trust_attributes = LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION;
+
+               generate_random_buffer(auth_struct.confounder, sizeof(auth_struct.confounder));
+
+               auth_struct.outgoing.count = 0;
+               auth_struct.incoming.count = 0;
+
+               ndr_err = ndr_push_struct_blob(&auth_blob, mem_ctx, lp_iconv_convenience(tctx->lp_ctx), &auth_struct,
+                                              (ndr_push_flags_fn_t)ndr_push_trustDomainPasswords);
+               if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                       printf("ndr_push_struct_blob of trustDomainPasswords structure failed");
+                       ret = false;
+               }
+
+               arcfour_crypt_blob(auth_blob.data, auth_blob.length, &session_key);
+
+               authinfo.auth_blob.size = auth_blob.length;
+               authinfo.auth_blob.data = auth_blob.data;
+
+               r.in.policy_handle = handle;
+               r.in.info = &trustinfo;
+               r.in.auth_info = &authinfo;
+               r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+               r.out.trustdom_handle = &trustdom_handle[i];
+               
+               status = dcerpc_lsa_CreateTrustedDomainEx2(p, mem_ctx, &r);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+                       test_DeleteTrustedDomain(p, mem_ctx, handle, trustinfo.netbios_name);
+                       status = dcerpc_lsa_CreateTrustedDomainEx2(p, mem_ctx, &r);
+               }
+               if (!NT_STATUS_IS_OK(status)) {
+                       printf("CreateTrustedDomainEx failed2 - %s\n", nt_errstr(status));
+                       ret = false;
+               } else {
+               
+                       q.in.trustdom_handle = &trustdom_handle[i];
+                       q.in.level = LSA_TRUSTED_DOMAIN_INFO_INFO_EX;
+                       status = dcerpc_lsa_QueryTrustedDomainInfo(p, mem_ctx, &q);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               printf("QueryTrustedDomainInfo level 1 failed - %s\n", nt_errstr(status));
+                               ret = false;
+                       } else if (!q.out.info) {
+                               ret = false;
+                       } else {
+                               if (strcmp(q.out.info->info_ex.netbios_name.string, trustinfo.netbios_name.string) != 0) {
+                                       printf("QueryTrustedDomainInfo returned inconsistant short name: %s != %s\n",
+                                              q.out.info->info_ex.netbios_name.string, trustinfo.netbios_name.string);
+                                       ret = false;
+                               }
+                               if (q.out.info->info_ex.trust_type != trustinfo.trust_type) {
+                                       printf("QueryTrustedDomainInfo of %s returned incorrect trust type %d != %d\n", 
+                                              trust_name, q.out.info->info_ex.trust_type, trustinfo.trust_type);
+                                       ret = false;
+                               }
+                               if (q.out.info->info_ex.trust_attributes != LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION) {
+                                       printf("QueryTrustedDomainInfo of %s returned incorrect trust attributes %d != %d\n", 
+                                              trust_name, q.out.info->info_ex.trust_attributes, LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION);
+                                       ret = false;
+                               }
+                               if (q.out.info->info_ex.trust_direction != trustinfo.trust_direction) {
+                                       printf("QueryTrustedDomainInfo of %s returned incorrect trust direction %d != %d\n", 
+                                              trust_name, q.out.info->info_ex.trust_direction, trustinfo.trust_direction);
                                        ret = false;
                                }
                        }
@@ -2015,10 +2208,6 @@ static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p,
        NTSTATUS status;
        int i;
        bool ret = true;
-       if (torture_setting_bool(tctx, "samba4", false)) {
-               printf("skipping QueryDomainInformationPolicy test against Samba4\n");
-               return true;
-       }
 
        printf("\nTesting QueryDomainInformationPolicy\n");
 
@@ -2030,7 +2219,10 @@ static bool test_QueryDomainInfoPolicy(struct dcerpc_pipe *p,
 
                status = dcerpc_lsa_QueryDomainInformationPolicy(p, tctx, &r);
 
-               if (!NT_STATUS_IS_OK(status)) {
+               /* If the server does not support EFS, then this is the correct return */
+               if (i == LSA_DOMAIN_INFO_POLICY_EFS && NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+                       continue;
+               } else if (!NT_STATUS_IS_OK(status)) {
                        printf("QueryDomainInformationPolicy failed - %s\n", nt_errstr(status));
                        ret = false;
                        continue;
@@ -2294,7 +2486,11 @@ bool torture_rpc_lsa(struct torture_context *tctx)
                if (!test_CreateTrustedDomain(p, tctx, handle)) {
                        ret = false;
                }
-               
+
+               if (!test_CreateTrustedDomainEx2(p, tctx, tctx, handle)) {
+                       ret = false;
+               }
+
                if (!test_EnumAccounts(p, tctx, handle)) {
                        ret = false;
                }
@@ -2311,11 +2507,9 @@ bool torture_rpc_lsa(struct torture_context *tctx)
                        ret = false;
                }
                
-#if 0
                if (!test_Delete(p, tctx, handle)) {
                        ret = false;
                }
-#endif
                
                if (!test_many_LookupSids(p, tctx, handle)) {
                        ret = false;