Use the cldap reply to avoid segfaulting in RPC-DSSYNC
authorAndrew Bartlett <abartlet@samba.org>
Thu, 31 Jul 2008 00:51:59 +0000 (10:51 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 31 Jul 2008 00:51:59 +0000 (10:51 +1000)
Also don't fail the test if the server does not implement the NT4
changelog.

Andrew Bartlett
(This used to be commit 514d88580bee3bb17f1032262f5518e3ab2a349a)

source4/torture/rpc/dssync.c

index 2930a9b1f9dc4240ed1e2f75bb606165b880abdc..e8c67b46c107c1d60807874a5d46eb6b4fed3040 100644 (file)
@@ -34,6 +34,7 @@
 #include "libcli/auth/libcli_auth.h"
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
+#include "dsdb/samdb/samdb.h"
 
 struct DsSyncBindInfo {
        struct dcerpc_pipe *pipe;
@@ -314,6 +315,14 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
                printf("cldap_netlogon() returned Server Site-Name: %s.\n",search.out.netlogon.nt5_ex.server_site);
        }
 
+       if (!ctx->domain_dn) {
+               struct ldb_context *ldb = ldb_init(ctx, tctx->ev);
+               struct ldb_dn *dn = samdb_dns_domain_to_dn(ldb, ctx, search.out.netlogon.nt5_ex.dns_domain);
+               ctx->domain_dn = ldb_dn_alloc_linearized(ctx, dn);
+               talloc_free(dn);
+               talloc_free(ldb);
+       }
+
        return ret;
 }
 
@@ -800,7 +809,10 @@ static bool test_FetchNT4Data(struct torture_context *tctx,
                r.in.req.req1.data      = cookie.data;
 
                status = dcerpc_drsuapi_DsGetNT4ChangeLog(ctx->new_dc.drsuapi.pipe, ctx, &r);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
+                       printf("DsGetNT4ChangeLog not supported by target server\n");
+                       break;
+               } else if (!NT_STATUS_IS_OK(status)) {
                        const char *errstr = nt_errstr(status);
                        if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
                                errstr = dcerpc_errstr(ctx, ctx->new_dc.drsuapi.pipe->last_fault_code);