s4-netlogon: merge netr_GetAnyDCName from s3 idl (untested).
authorGünther Deschner <gd@samba.org>
Tue, 28 Oct 2008 00:23:04 +0000 (01:23 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 28 Oct 2008 22:40:53 +0000 (23:40 +0100)
Guenther

source4/librpc/idl/netlogon.idl
source4/torture/rpc/netlogon.c
source4/winbind/wb_cmd_getdcname.c
source4/winbind/wb_dom_info_trusted.c

index 23be2e5667065443f20300ca37046d2c5f11365b..34da844ce7afa61ba86d5ac4373a11e1764a750b 100644 (file)
@@ -867,7 +867,7 @@ interface netlogon
        WERROR netr_GetAnyDCName(
                [in,unique] [string,charset(UTF16)] uint16 *logon_server,
                [in,unique] [string,charset(UTF16)] uint16 *domainname,
-               [out,unique] [string,charset(UTF16)] uint16 *dcname
+               [out,ref] [string,charset(UTF16)] uint16 **dcname
                );
 
 
index 378f9a21d55850d4985787e0bc2f202d277de447..41abfbc24347c58cf3062210f8f5319049139765 100644 (file)
@@ -916,15 +916,17 @@ static bool test_GetAnyDCName(struct torture_context *tctx,
 {
        NTSTATUS status;
        struct netr_GetAnyDCName r;
+       const char *dcname = NULL;
 
        r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
        r.in.domainname = lp_workgroup(tctx->lp_ctx);
+       r.out.dcname = &dcname;
 
        status = dcerpc_netr_GetAnyDCName(p, tctx, &r);
        torture_assert_ntstatus_ok(tctx, status, "GetAnyDCName");
 
-       if (r.out.dcname) {
-           torture_comment(tctx, "\tDC is at '%s'\n", r.out.dcname);
+       if (dcname) {
+           torture_comment(tctx, "\tDC is at '%s'\n", dcname);
        }
 
        return true;
@@ -1569,6 +1571,7 @@ static bool test_ManyGetDCName(struct torture_context *tctx,
        struct lsa_EnumTrustDom t;
        uint32_t resume_handle = 0;
        struct netr_GetAnyDCName d;
+       const char *dcname = NULL;
 
        int i;
 
@@ -1620,6 +1623,7 @@ static bool test_ManyGetDCName(struct torture_context *tctx,
 
        d.in.logon_server = talloc_asprintf(tctx, "\\\\%s",
                                            dcerpc_server_name(p));
+       d.out.dcname = &dcname;
 
        for (i=0; i<domains.count * 4; i++) {
                struct lsa_DomainInfo *info =
@@ -1631,7 +1635,7 @@ static bool test_ManyGetDCName(struct torture_context *tctx,
                torture_assert_ntstatus_ok(tctx, status, "GetAnyDCName");
 
                torture_comment(tctx, "\tDC for domain %s is %s\n", info->name.string,
-                      d.out.dcname ? d.out.dcname : "unknown");
+                      dcname ? dcname : "unknown");
        }
 
        return true;
index 46d7f0d82f7f1101395836b82bf64cf0d9e06171..22892439052c3b2f03d009b2bb61d767c1ece8f6 100644 (file)
@@ -81,6 +81,7 @@ static void getdcname_recv_domain(struct composite_context *ctx)
                state, "\\\\%s",
                dcerpc_server_name(domain->netlogon_pipe));
        state->g.in.domainname = state->domain_name;
+       state->g.out.dcname = talloc(state, const char **);
 
        req = dcerpc_netr_GetAnyDCName_send(domain->netlogon_pipe, state,
                                            &state->g);
@@ -111,7 +112,7 @@ NTSTATUS wb_cmd_getdcname_recv(struct composite_context *c,
                talloc_get_type(c->private_data, struct cmd_getdcname_state);
        NTSTATUS status = composite_wait(c);
        if (NT_STATUS_IS_OK(status)) {
-               const char *p = state->g.out.dcname;
+               const char *p = *(state->g.out.dcname);
                if (*p == '\\') p += 1;
                if (*p == '\\') p += 1;
                *dcname = talloc_strdup(mem_ctx, p);
index 46d3bf37f65d8c37ccc31cfd9f8ef10f4315c618..c3be5adb1fc5f7795f357c0323ccf416d017444b 100644 (file)
@@ -161,6 +161,7 @@ static void trusted_dom_info_recv_dsr(struct rpc_request *req)
                state, "\\\\%s",
                dcerpc_server_name(state->my_domain->netlogon_pipe));
        state->g.in.domainname = state->info->name;
+       state->g.out.dcname = talloc(state, const char *);
 
        req = dcerpc_netr_GetAnyDCName_send(state->my_domain->netlogon_pipe,
                                            state, &state->g);
@@ -187,7 +188,7 @@ static void trusted_dom_info_recv_dcname(struct rpc_request *req)
        state->info->num_dcs = 1;
        state->info->dcs = talloc(state->info, struct nbt_dc_name);
        state->info->dcs[0].name = talloc_steal(state->info,
-                                           state->g.out.dcname);
+                                           *(state->g.out.dcname));
        if (*state->info->dcs[0].name == '\\') state->info->dcs[0].name++;
        if (*state->info->dcs[0].name == '\\') state->info->dcs[0].name++;