[SCM] Samba Shared Repository - branch master updated - 68aa9bd67f9556f608bfb321d593617bd346915f

Günther Deschner gd at samba.org
Mon Oct 27 13:29:45 GMT 2008


The branch, master has been updated
       via  68aa9bd67f9556f608bfb321d593617bd346915f (commit)
       via  5a4b421952e538a5f1cb347f3249150c4e271ecd (commit)
       via  eb3c826f7b0a46cbf38587f75b879c4364422fd5 (commit)
      from  151dfd9dd1315f1058dae04ed4e2f5b66de0881a (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 68aa9bd67f9556f608bfb321d593617bd346915f
Author: Günther Deschner <gd at samba.org>
Date:   Mon Oct 27 14:25:03 2008 +0100

    s3-rpcclient: add getdcsitecoverage call.
    
    Guenther

commit 5a4b421952e538a5f1cb347f3249150c4e271ecd
Author: Günther Deschner <gd at samba.org>
Date:   Mon Oct 27 14:24:46 2008 +0100

    s3-build: re-run make samba3-idl.
    
    Guenther

commit eb3c826f7b0a46cbf38587f75b879c4364422fd5
Author: Günther Deschner <gd at samba.org>
Date:   Mon Oct 27 14:24:08 2008 +0100

    s3-netlogon-idl: fix IDL for netr_DsrGetDcSiteCoverageW.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source3/librpc/gen_ndr/cli_netlogon.c |    2 +-
 source3/librpc/gen_ndr/cli_netlogon.h |    2 +-
 source3/librpc/gen_ndr/ndr_netlogon.c |   27 ++++++++++++++++++++--
 source3/librpc/gen_ndr/netlogon.h     |    2 +-
 source3/librpc/gen_ndr/srv_netlogon.c |    2 +-
 source3/librpc/idl/netlogon.idl       |    2 +-
 source3/rpcclient/cmd_netlogon.c      |   38 +++++++++++++++++++++++++++++++++
 7 files changed, 67 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c
index 941273b..53c5041 100644
--- a/source3/librpc/gen_ndr/cli_netlogon.c
+++ b/source3/librpc/gen_ndr/cli_netlogon.c
@@ -1888,7 +1888,7 @@ NTSTATUS rpccli_netr_DsRAddressToSitenamesExW(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_netr_DsrGetDcSiteCoverageW(struct rpc_pipe_client *cli,
 					   TALLOC_CTX *mem_ctx,
 					   const char *server_name /* [in] [unique,charset(UTF16)] */,
-					   struct DcSitesCtr *ctr /* [out] [ref] */,
+					   struct DcSitesCtr **ctr /* [out] [ref] */,
 					   WERROR *werror)
 {
 	struct netr_DsrGetDcSiteCoverageW r;
diff --git a/source3/librpc/gen_ndr/cli_netlogon.h b/source3/librpc/gen_ndr/cli_netlogon.h
index 0a0cfdf..72790e9 100644
--- a/source3/librpc/gen_ndr/cli_netlogon.h
+++ b/source3/librpc/gen_ndr/cli_netlogon.h
@@ -291,7 +291,7 @@ NTSTATUS rpccli_netr_DsRAddressToSitenamesExW(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_netr_DsrGetDcSiteCoverageW(struct rpc_pipe_client *cli,
 					   TALLOC_CTX *mem_ctx,
 					   const char *server_name /* [in] [unique,charset(UTF16)] */,
-					   struct DcSitesCtr *ctr /* [out] [ref] */,
+					   struct DcSitesCtr **ctr /* [out] [ref] */,
 					   WERROR *werror);
 NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli,
 				     TALLOC_CTX *mem_ctx,
diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c
index 169d35e..36808c0 100644
--- a/source3/librpc/gen_ndr/ndr_netlogon.c
+++ b/source3/librpc/gen_ndr/ndr_netlogon.c
@@ -13819,7 +13819,10 @@ static enum ndr_err_code ndr_push_netr_DsrGetDcSiteCoverageW(struct ndr_push *nd
 		if (r->out.ctr == NULL) {
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
-		NDR_CHECK(ndr_push_DcSitesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr));
+		NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.ctr));
+		if (*r->out.ctr) {
+			NDR_CHECK(ndr_push_DcSitesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr));
+		}
 		NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
 	}
 	return NDR_ERR_SUCCESS;
@@ -13828,8 +13831,10 @@ static enum ndr_err_code ndr_push_netr_DsrGetDcSiteCoverageW(struct ndr_push *nd
 static enum ndr_err_code ndr_pull_netr_DsrGetDcSiteCoverageW(struct ndr_pull *ndr, int flags, struct netr_DsrGetDcSiteCoverageW *r)
 {
 	uint32_t _ptr_server_name;
+	uint32_t _ptr_ctr;
 	TALLOC_CTX *_mem_save_server_name_0;
 	TALLOC_CTX *_mem_save_ctr_0;
+	TALLOC_CTX *_mem_save_ctr_1;
 	if (flags & NDR_IN) {
 		ZERO_STRUCT(r->out);
 
@@ -13860,7 +13865,18 @@ static enum ndr_err_code ndr_pull_netr_DsrGetDcSiteCoverageW(struct ndr_pull *nd
 		}
 		_mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr);
 		NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC);
-		NDR_CHECK(ndr_pull_DcSitesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr));
+		NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ctr));
+		if (_ptr_ctr) {
+			NDR_PULL_ALLOC(ndr, *r->out.ctr);
+		} else {
+			*r->out.ctr = NULL;
+		}
+		if (*r->out.ctr) {
+			_mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr);
+			NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, 0);
+			NDR_CHECK(ndr_pull_DcSitesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr));
+			NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, 0);
+		}
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
 	}
@@ -13890,7 +13906,12 @@ _PUBLIC_ void ndr_print_netr_DsrGetDcSiteCoverageW(struct ndr_print *ndr, const
 		ndr->depth++;
 		ndr_print_ptr(ndr, "ctr", r->out.ctr);
 		ndr->depth++;
-		ndr_print_DcSitesCtr(ndr, "ctr", r->out.ctr);
+		ndr_print_ptr(ndr, "ctr", *r->out.ctr);
+		ndr->depth++;
+		if (*r->out.ctr) {
+			ndr_print_DcSitesCtr(ndr, "ctr", *r->out.ctr);
+		}
+		ndr->depth--;
 		ndr->depth--;
 		ndr_print_WERROR(ndr, "result", r->out.result);
 		ndr->depth--;
diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h
index cf3959b..1504e20 100644
--- a/source3/librpc/gen_ndr/netlogon.h
+++ b/source3/librpc/gen_ndr/netlogon.h
@@ -1547,7 +1547,7 @@ struct netr_DsrGetDcSiteCoverageW {
 	} in;
 
 	struct {
-		struct DcSitesCtr *ctr;/* [ref] */
+		struct DcSitesCtr **ctr;/* [ref] */
 		WERROR result;
 	} out;
 
diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c
index c14f682..d99aeb7 100644
--- a/source3/librpc/gen_ndr/srv_netlogon.c
+++ b/source3/librpc/gen_ndr/srv_netlogon.c
@@ -3101,7 +3101,7 @@ static bool api_netr_DsrGetDcSiteCoverageW(pipes_struct *p)
 	}
 
 	ZERO_STRUCT(r->out);
-	r->out.ctr = talloc_zero(r, struct DcSitesCtr);
+	r->out.ctr = talloc_zero(r, struct DcSitesCtr *);
 	if (r->out.ctr == NULL) {
 		talloc_free(r);
 		return false;
diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl
index b4e34a0..06e0c32 100644
--- a/source3/librpc/idl/netlogon.idl
+++ b/source3/librpc/idl/netlogon.idl
@@ -1376,7 +1376,7 @@ interface netlogon
 
 	WERROR netr_DsrGetDcSiteCoverageW(
 		[in,unique] [string,charset(UTF16)] uint16 *server_name,
-		[out,ref] DcSitesCtr *ctr
+		[out,ref] DcSitesCtr **ctr
 		);
 
 	/****************/
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index cdcc0ec..6efa316 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -1003,6 +1003,43 @@ static WERROR cmd_netlogon_enumtrusteddomainsex(struct rpc_pipe_client *cli,
 	return werr;
 }
 
+static WERROR cmd_netlogon_getdcsitecoverage(struct rpc_pipe_client *cli,
+					     TALLOC_CTX *mem_ctx, int argc,
+					     const char **argv)
+{
+	NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+	WERROR werr = WERR_GENERAL_FAILURE;
+	const char *server_name = cli->desthost;
+	struct DcSitesCtr *ctr = NULL;
+
+	if (argc < 1 || argc > 3) {
+		fprintf(stderr, "Usage: %s <server_name>\n", argv[0]);
+		return WERR_OK;
+	}
+
+	if (argc >= 2) {
+		server_name = argv[1];
+	}
+
+	status = rpccli_netr_DsrGetDcSiteCoverageW(cli, mem_ctx,
+						   server_name,
+						   &ctr,
+						   &werr);
+	if (!NT_STATUS_IS_OK(status)) {
+		goto done;
+	}
+
+	if (W_ERROR_IS_OK(werr) && ctr->num_sites) {
+		int i;
+		printf("sites covered by this DC: %d\n", ctr->num_sites);
+		for (i=0; i<ctr->num_sites; i++) {
+			printf("%s\n", ctr->sites[i].string);
+		}
+	}
+ done:
+	return werr;
+}
+
 
 /* List of commands exported by this module */
 
@@ -1029,6 +1066,7 @@ struct cmd_set netlogon_commands[] = {
 	{ "deregisterdnsrecords", RPC_RTYPE_WERROR, NULL, cmd_netlogon_deregisterdnsrecords, &ndr_table_netlogon.syntax_id, NULL, "Deregister DNS records",     "" },
 	{ "netrenumtrusteddomains", RPC_RTYPE_WERROR, NULL, cmd_netlogon_enumtrusteddomains, &ndr_table_netlogon.syntax_id, NULL, "Enumerate trusted domains",     "" },
 	{ "netrenumtrusteddomainsex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_enumtrusteddomainsex, &ndr_table_netlogon.syntax_id, NULL, "Enumerate trusted domains",     "" },
+	{ "getdcsitecoverage", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcsitecoverage, &ndr_table_netlogon.syntax_id, NULL, "Get the Site-Coverage from a DC",     "" },
 
 	{ NULL }
 };


-- 
Samba Shared Repository


More information about the samba-cvs mailing list