[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2203-gf0c6668

Günther Deschner gd at samba.org
Wed Feb 13 22:03:01 GMT 2008


The branch, v3-2-test has been updated
       via  f0c66688588a4e62c4a250b0d21a0fe14bbc5099 (commit)
       via  c58be24cd43092e5ebf7aa84f167a5cc8344edfc (commit)
       via  8d3e7e8bb067b9e0aab79bc460647e8a6176102e (commit)
       via  a111167062f0bee9477b5988a3ce796af81407fc (commit)
       via  da951e278c5253b0d23145790c817b2f01ac47ef (commit)
      from  4321d5aba7ec808aee473c1123027f14bfa19f19 (commit)

http://gitweb.samba.org/?samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit f0c66688588a4e62c4a250b0d21a0fe14bbc5099
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 13 22:55:44 2008 +0100

    Add some netr_NETLOGON_INFO init functions.
    
    Guenther

commit c58be24cd43092e5ebf7aa84f167a5cc8344edfc
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 13 22:54:43 2008 +0100

    Fix logonctrl2 command in rpcclient.
    
    Guenther

commit 8d3e7e8bb067b9e0aab79bc460647e8a6176102e
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 13 17:57:57 2008 +0100

    Move some lsa init routines around.
    
    Guenther

commit a111167062f0bee9477b5988a3ce796af81407fc
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 13 23:00:36 2008 +0100

    Re-run make idl.
    
    Guenther

commit da951e278c5253b0d23145790c817b2f01ac47ef
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 13 16:46:23 2008 +0100

    Fix IDL for netr_ServerPasswordSet.
    
    Guenther

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

Summary of changes:
 source/librpc/gen_ndr/cli_netlogon.c |    6 +-
 source/librpc/gen_ndr/cli_netlogon.h |    6 +-
 source/librpc/gen_ndr/ndr_netlogon.c |   38 +++++++++++++++---
 source/librpc/gen_ndr/netlogon.h     |    4 +-
 source/librpc/idl/netlogon.idl       |    6 +-
 source/rpc_client/init_lsa.c         |   40 +++++++++++++++++++
 source/rpc_parse/parse_lsa.c         |   40 -------------------
 source/rpc_server/srv_netlog_nt.c    |   46 +++++++++++++++++++++-
 source/rpcclient/cmd_netlogon.c      |   70 ++++++++++++++++++++++++++-------
 9 files changed, 181 insertions(+), 75 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/librpc/gen_ndr/cli_netlogon.c b/source/librpc/gen_ndr/cli_netlogon.c
index f355856..7efcae2 100644
--- a/source/librpc/gen_ndr/cli_netlogon.c
+++ b/source/librpc/gen_ndr/cli_netlogon.c
@@ -314,9 +314,9 @@ NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli,
 				       const char *account_name,
 				       enum netr_SchannelType secure_channel_type,
 				       const char *computer_name,
-				       struct netr_Authenticator credential,
-				       struct samr_Password new_password,
-				       struct netr_Authenticator *return_authenticator)
+				       struct netr_Authenticator *credential,
+				       struct netr_Authenticator *return_authenticator,
+				       struct samr_Password *new_password)
 {
 	struct netr_ServerPasswordSet r;
 	NTSTATUS status;
diff --git a/source/librpc/gen_ndr/cli_netlogon.h b/source/librpc/gen_ndr/cli_netlogon.h
index 0b6ed86..f07c429 100644
--- a/source/librpc/gen_ndr/cli_netlogon.h
+++ b/source/librpc/gen_ndr/cli_netlogon.h
@@ -52,9 +52,9 @@ NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli,
 				       const char *account_name,
 				       enum netr_SchannelType secure_channel_type,
 				       const char *computer_name,
-				       struct netr_Authenticator credential,
-				       struct samr_Password new_password,
-				       struct netr_Authenticator *return_authenticator);
+				       struct netr_Authenticator *credential,
+				       struct netr_Authenticator *return_authenticator,
+				       struct samr_Password *new_password);
 NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli,
 				    TALLOC_CTX *mem_ctx,
 				    const char *logon_server,
diff --git a/source/librpc/gen_ndr/ndr_netlogon.c b/source/librpc/gen_ndr/ndr_netlogon.c
index 624c9ac..d31e19a 100644
--- a/source/librpc/gen_ndr/ndr_netlogon.c
+++ b/source/librpc/gen_ndr/ndr_netlogon.c
@@ -8864,8 +8864,14 @@ static enum ndr_err_code ndr_push_netr_ServerPasswordSet(struct ndr_push *ndr, i
 		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
 		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16)));
 		NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.computer_name, ndr_charset_length(r->in.computer_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
-		NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, &r->in.credential));
-		NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.new_password));
+		if (r->in.credential == NULL) {
+			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+		}
+		NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential));
+		if (r->in.new_password == NULL) {
+			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+		}
+		NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.new_password));
 	}
 	if (flags & NDR_OUT) {
 		if (r->out.return_authenticator == NULL) {
@@ -8881,7 +8887,9 @@ static enum ndr_err_code ndr_pull_netr_ServerPasswordSet(struct ndr_pull *ndr, i
 {
 	uint32_t _ptr_server_name;
 	TALLOC_CTX *_mem_save_server_name_0;
+	TALLOC_CTX *_mem_save_credential_0;
 	TALLOC_CTX *_mem_save_return_authenticator_0;
+	TALLOC_CTX *_mem_save_new_password_0;
 	if (flags & NDR_IN) {
 		ZERO_STRUCT(r->out);
 
@@ -8918,8 +8926,20 @@ static enum ndr_err_code ndr_pull_netr_ServerPasswordSet(struct ndr_pull *ndr, i
 		}
 		NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t)));
 		NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.computer_name, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t), CH_UTF16));
-		NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, &r->in.credential));
-		NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.new_password));
+		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+			NDR_PULL_ALLOC(ndr, r->in.credential);
+		}
+		_mem_save_credential_0 = NDR_PULL_GET_MEM_CTX(ndr);
+		NDR_PULL_SET_MEM_CTX(ndr, r->in.credential, LIBNDR_FLAG_REF_ALLOC);
+		NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential));
+		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_credential_0, LIBNDR_FLAG_REF_ALLOC);
+		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+			NDR_PULL_ALLOC(ndr, r->in.new_password);
+		}
+		_mem_save_new_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+		NDR_PULL_SET_MEM_CTX(ndr, r->in.new_password, LIBNDR_FLAG_REF_ALLOC);
+		NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.new_password));
+		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_password_0, LIBNDR_FLAG_REF_ALLOC);
 		NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
 		ZERO_STRUCTP(r->out.return_authenticator);
 	}
@@ -8955,8 +8975,14 @@ _PUBLIC_ void ndr_print_netr_ServerPasswordSet(struct ndr_print *ndr, const char
 		ndr_print_string(ndr, "account_name", r->in.account_name);
 		ndr_print_netr_SchannelType(ndr, "secure_channel_type", r->in.secure_channel_type);
 		ndr_print_string(ndr, "computer_name", r->in.computer_name);
-		ndr_print_netr_Authenticator(ndr, "credential", &r->in.credential);
-		ndr_print_samr_Password(ndr, "new_password", &r->in.new_password);
+		ndr_print_ptr(ndr, "credential", r->in.credential);
+		ndr->depth++;
+		ndr_print_netr_Authenticator(ndr, "credential", r->in.credential);
+		ndr->depth--;
+		ndr_print_ptr(ndr, "new_password", r->in.new_password);
+		ndr->depth++;
+		ndr_print_samr_Password(ndr, "new_password", r->in.new_password);
+		ndr->depth--;
 		ndr->depth--;
 	}
 	if (flags & NDR_OUT) {
diff --git a/source/librpc/gen_ndr/netlogon.h b/source/librpc/gen_ndr/netlogon.h
index 36380f1..97089d4 100644
--- a/source/librpc/gen_ndr/netlogon.h
+++ b/source/librpc/gen_ndr/netlogon.h
@@ -920,8 +920,8 @@ struct netr_ServerPasswordSet {
 		const char *account_name;/* [charset(UTF16)] */
 		enum netr_SchannelType secure_channel_type;
 		const char *computer_name;/* [charset(UTF16)] */
-		struct netr_Authenticator credential;
-		struct samr_Password new_password;
+		struct netr_Authenticator *credential;/* [ref] */
+		struct samr_Password *new_password;/* [ref] */
 	} in;
 
 	struct {
diff --git a/source/librpc/idl/netlogon.idl b/source/librpc/idl/netlogon.idl
index 25118bc..7f977a4 100644
--- a/source/librpc/idl/netlogon.idl
+++ b/source/librpc/idl/netlogon.idl
@@ -298,9 +298,9 @@ interface netlogon
 		[in]  [string,charset(UTF16)] uint16 account_name[],
 		[in]  netr_SchannelType secure_channel_type,
 		[in]  [string,charset(UTF16)] uint16 computer_name[],
-		[in]  netr_Authenticator credential,
-		[in]  samr_Password new_password,
-		[out,ref] netr_Authenticator *return_authenticator
+		[in,ref]  netr_Authenticator *credential,
+		[out,ref] netr_Authenticator *return_authenticator,
+		[in,ref] samr_Password *new_password
 		);
 
 
diff --git a/source/rpc_client/init_lsa.c b/source/rpc_client/init_lsa.c
index 0af85c0..114e435 100644
--- a/source/rpc_client/init_lsa.c
+++ b/source/rpc_client/init_lsa.c
@@ -46,3 +46,43 @@ void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s)
 	name->string = s;
 }
 
+/*******************************************************************
+ Inits an lsa_QosInfo structure.
+********************************************************************/
+
+void init_lsa_sec_qos(struct lsa_QosInfo *r,
+		      uint32_t len,
+		      uint16_t impersonation_level,
+		      uint8_t context_mode,
+		      uint8_t effective_only)
+{
+	DEBUG(5, ("init_lsa_sec_qos\n"));
+
+	r->len = len;
+	r->impersonation_level = impersonation_level;
+	r->context_mode = context_mode;
+	r->effective_only = effective_only;
+}
+
+/*******************************************************************
+ Inits an lsa_ObjectAttribute structure.
+********************************************************************/
+
+void init_lsa_obj_attr(struct lsa_ObjectAttribute *r,
+		       uint32_t len,
+		       uint8_t *root_dir,
+		       const char *object_name,
+		       uint32_t attributes,
+		       struct security_descriptor *sec_desc,
+		       struct lsa_QosInfo *sec_qos)
+{
+	DEBUG(5,("init_lsa_obj_attr\n"));
+
+	r->len = len;
+	r->root_dir = root_dir;
+	r->object_name = object_name;
+	r->attributes = attributes;
+	r->sec_desc = sec_desc;
+	r->sec_qos = sec_qos;
+}
+
diff --git a/source/rpc_parse/parse_lsa.c b/source/rpc_parse/parse_lsa.c
index c4a7c05..b8a0b03 100644
--- a/source/rpc_parse/parse_lsa.c
+++ b/source/rpc_parse/parse_lsa.c
@@ -176,46 +176,6 @@ static bool lsa_io_dom_r_ref(const char *desc, DOM_R_REF *dom, prs_struct *ps, i
 }
 
 /*******************************************************************
- Inits an lsa_QosInfo structure.
-********************************************************************/
-
-void init_lsa_sec_qos(struct lsa_QosInfo *r,
-		      uint32_t len,
-		      uint16_t impersonation_level,
-		      uint8_t context_mode,
-		      uint8_t effective_only)
-{
-	DEBUG(5, ("init_lsa_sec_qos\n"));
-
-	r->len = len;
-	r->impersonation_level = impersonation_level;
-	r->context_mode = context_mode;
-	r->effective_only = effective_only;
-}
-
-/*******************************************************************
- Inits an lsa_ObjectAttribute structure.
-********************************************************************/
-
-void init_lsa_obj_attr(struct lsa_ObjectAttribute *r,
-			      uint32_t len,
-			      uint8_t *root_dir,
-			      const char *object_name,
-			      uint32_t attributes,
-			      struct security_descriptor *sec_desc,
-			      struct lsa_QosInfo *sec_qos)
-{
-	DEBUG(5,("init_lsa_obj_attr\n"));
-
-	r->len = len;
-	r->root_dir = root_dir;
-	r->object_name = object_name;
-	r->attributes = attributes;
-	r->sec_desc = sec_desc;
-	r->sec_qos = sec_qos;
-}
-
-/*******************************************************************
  Inits a LSA_SID_ENUM structure.
 ********************************************************************/
 
diff --git a/source/rpc_server/srv_netlog_nt.c b/source/rpc_server/srv_netlog_nt.c
index acf694b..2c52ba8 100644
--- a/source/rpc_server/srv_netlog_nt.c
+++ b/source/rpc_server/srv_netlog_nt.c
@@ -42,6 +42,46 @@ static void init_net_r_req_chal(struct netr_Credential *r,
 	memcpy(r->data, srv_chal->data, sizeof(r->data));
 }
 
+/*******************************************************************
+ Inits a netr_NETLOGON_INFO_1 structure.
+********************************************************************/
+
+static void init_netlogon_info1(struct netr_NETLOGON_INFO_1 *r,
+				uint32_t flags,
+				uint32_t pdc_connection_status)
+{
+	r->flags = flags;
+	r->pdc_connection_status = pdc_connection_status;
+}
+
+/*******************************************************************
+ Inits a netr_NETLOGON_INFO_2 structure.
+********************************************************************/
+
+static void init_netlogon_info2(struct netr_NETLOGON_INFO_2 *r,
+				uint32_t flags,
+				uint32_t pdc_connection_status,
+				const char *trusted_dc_name,
+				uint32_t tc_connection_status)
+{
+	r->flags = flags;
+	r->pdc_connection_status = pdc_connection_status;
+	r->trusted_dc_name = trusted_dc_name;
+	r->tc_connection_status = tc_connection_status;
+}
+
+/*******************************************************************
+ Inits a netr_NETLOGON_INFO_3 structure.
+********************************************************************/
+
+static void init_netlogon_info3(struct netr_NETLOGON_INFO_3 *r,
+				uint32_t flags,
+				uint32_t logon_attempts)
+{
+	r->flags = flags;
+	r->logon_attempts = logon_attempts;
+}
+
 /*************************************************************************
  _netr_LogonControl
  *************************************************************************/
@@ -61,9 +101,9 @@ WERROR _netr_LogonControl(pipes_struct *p,
 			if (!info1) {
 				return WERR_NOMEM;
 			}
-			info1->flags = flags;
-			info1->pdc_connection_status = pdc_connection_status;
-
+			init_netlogon_info1(info1,
+					    flags,
+					    pdc_connection_status);
 			r->out.info->info1 = info1;
 			break;
 		default:
diff --git a/source/rpcclient/cmd_netlogon.c b/source/rpcclient/cmd_netlogon.c
index b175357..0efee84 100644
--- a/source/rpcclient/cmd_netlogon.c
+++ b/source/rpcclient/cmd_netlogon.c
@@ -21,27 +21,68 @@
 #include "includes.h"
 #include "rpcclient.h"
 
-static NTSTATUS cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, 
-                                         TALLOC_CTX *mem_ctx, int argc, 
-                                         const char **argv)
+static WERROR cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli,
+				       TALLOC_CTX *mem_ctx, int argc,
+				       const char **argv)
 {
-	uint32 query_level = 1;
-	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+	NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+	WERROR werr;
+	const char *logon_server = cli->cli->desthost;
+	enum netr_LogonControlCode function_code = NETLOGON_CONTROL_REDISCOVER;
+	uint32_t level = 1;
+	union netr_CONTROL_DATA_INFORMATION data;
+	union netr_CONTROL_QUERY_INFORMATION query;
+	const char *domain = "BER";
 
-	if (argc > 1) {
-		fprintf(stderr, "Usage: %s\n", argv[0]);
-		return NT_STATUS_OK;
+	if (argc > 5) {
+		fprintf(stderr, "Usage: %s <logon_server> <function_code> "
+			"<level> <domain>\n", argv[0]);
+		return WERR_OK;
+	}
+
+	if (argc >= 2) {
+		logon_server = argv[1];
 	}
 
-	result = rpccli_netlogon_logon_ctrl2(cli, mem_ctx, query_level);
+	if (argc >= 3) {
+		function_code = atoi(argv[2]);
+	}
 
-	if (!NT_STATUS_IS_OK(result))
-		goto done;
+	if (argc >= 4) {
+		level = atoi(argv[3]);
+	}
+
+	if (argc >= 5) {
+		domain = argv[4];
+	}
+
+	switch (function_code) {
+		case NETLOGON_CONTROL_REDISCOVER:
+		case NETLOGON_CONTROL_TC_QUERY:
+			data.domain = domain;
+			break;
+		default:
+			break;
+	}
+
+	status = rpccli_netr_LogonControl2(cli, mem_ctx,
+					  logon_server,
+					  function_code,
+					  level,
+					  &data,
+					  &query,
+					  &werr);
+	if (!NT_STATUS_IS_OK(status)) {
+		return ntstatus_to_werror(status);
+	}
+
+	if (!W_ERROR_IS_OK(werr)) {
+		return werr;
+	}
 
 	/* Display results */
 
- done:
-	return result;
+	return werr;
 }
 
 static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli, 
@@ -859,14 +900,13 @@ static WERROR cmd_netlogon_enumtrusteddomainsex(struct rpc_pipe_client *cli,
 }
 
 
-
 /* List of commands exported by this module */
 
 struct cmd_set netlogon_commands[] = {
 
 	{ "NETLOGON" },
 
-	{ "logonctrl2", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl2, NULL, PI_NETLOGON, NULL, "Logon Control 2",     "" },
+	{ "logonctrl2", RPC_RTYPE_WERROR, NULL, cmd_netlogon_logon_ctrl2, PI_NETLOGON, NULL, "Logon Control 2",     "" },
 	{ "getanydcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getanydcname, PI_NETLOGON, NULL, "Get trusted DC name",     "" },
 	{ "getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcname, PI_NETLOGON, NULL, "Get trusted PDC name",     "" },
 	{ "dsr_getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcname, PI_NETLOGON, NULL, "Get trusted DC name",     "" },


-- 
Samba Shared Repository


More information about the samba-cvs mailing list