[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2028-gbb8e77e

Günther Deschner gd at samba.org
Fri Feb 8 21:49:33 GMT 2008


The branch, v3-2-test has been updated
       via  bb8e77eb74c9d178a6c77f2f9c69eb1778fb5e10 (commit)
       via  04d7977905d57dc2a45c221eee7f9edf659dbdf4 (commit)
       via  e1968880a88ad2a56c5fef7d416646dcb96965ef (commit)
       via  eaead9ea470c296ff0ace353104a0ef31f11311c (commit)
       via  ad392fcf7847df151c2ba56668bfdd0bf1f93971 (commit)
      from  c9a8baf5077a4e93cca241a5ec73f6ade97af607 (commit)

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


- Log -----------------------------------------------------------------
commit bb8e77eb74c9d178a6c77f2f9c69eb1778fb5e10
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 6 19:34:40 2008 +0100

    Remove unused marshalling for LSA_OPENACCOUNT.
    
    Guenther

commit 04d7977905d57dc2a45c221eee7f9edf659dbdf4
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 6 19:31:00 2008 +0100

    Use rpccli_lsa_OpenAccount() in rpcclient.
    
    Guenther

commit e1968880a88ad2a56c5fef7d416646dcb96965ef
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 6 19:19:29 2008 +0100

    Use pidl for _lsa_OpenAccount().
    
    Guenther

commit eaead9ea470c296ff0ace353104a0ef31f11311c
Author: Günther Deschner <gd at samba.org>
Date:   Fri Feb 8 22:44:04 2008 +0100

    Re-run make idl.
    
    Guenther

commit ad392fcf7847df151c2ba56668bfdd0bf1f93971
Author: Günther Deschner <gd at samba.org>
Date:   Fri Feb 8 17:33:19 2008 +0100

    Fix IDL for lsa_OpenAccount.
    
    Guenther

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

Summary of changes:
 source/include/rpc_lsa.h        |   13 ---------
 source/librpc/gen_ndr/cli_lsa.c |    2 +-
 source/librpc/gen_ndr/cli_lsa.h |    2 +-
 source/librpc/gen_ndr/lsa.h     |    2 +-
 source/librpc/gen_ndr/ndr_lsa.c |   27 +++++++++++++++++--
 source/librpc/gen_ndr/srv_lsa.c |    2 +-
 source/librpc/idl/lsa.idl       |    4 +-
 source/rpc_client/cli_lsarpc.c  |   38 ---------------------------
 source/rpc_parse/parse_lsa.c    |   54 ---------------------------------------
 source/rpc_server/srv_lsa.c     |   24 +----------------
 source/rpc_server/srv_lsa_nt.c  |   19 +++++--------
 source/rpcclient/cmd_lsarpc.c   |   10 +++++--
 12 files changed, 45 insertions(+), 152 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/rpc_lsa.h b/source/include/rpc_lsa.h
index 902d1e2..ba1e5a3 100644
--- a/source/include/rpc_lsa.h
+++ b/source/include/rpc_lsa.h
@@ -689,19 +689,6 @@ typedef struct lsa_r_unk_get_connuser
 } LSA_R_UNK_GET_CONNUSER;
 
 
-typedef struct lsa_q_openaccount
-{
-	POLICY_HND pol; /* policy handle */
-	DOM_SID2 sid;
-	uint32 access; /* desired access */
-} LSA_Q_OPENACCOUNT;
-
-typedef struct lsa_r_openaccount
-{
-	POLICY_HND pol; /* policy handle */
-	NTSTATUS status;
-} LSA_R_OPENACCOUNT;
-
 typedef struct lsa_q_enumprivsaccount
 {
 	POLICY_HND pol; /* policy handle */
diff --git a/source/librpc/gen_ndr/cli_lsa.c b/source/librpc/gen_ndr/cli_lsa.c
index 227ae80..edc7549 100644
--- a/source/librpc/gen_ndr/cli_lsa.c
+++ b/source/librpc/gen_ndr/cli_lsa.c
@@ -762,7 +762,7 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
 				struct policy_handle *handle,
 				struct dom_sid2 *sid,
 				uint32_t access_mask,
-				struct policy_handle *acct_handle)
+				struct policy_handle **acct_handle)
 {
 	struct lsa_OpenAccount r;
 	NTSTATUS status;
diff --git a/source/librpc/gen_ndr/cli_lsa.h b/source/librpc/gen_ndr/cli_lsa.h
index ec9abaf..2331545 100644
--- a/source/librpc/gen_ndr/cli_lsa.h
+++ b/source/librpc/gen_ndr/cli_lsa.h
@@ -95,7 +95,7 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
 				struct policy_handle *handle,
 				struct dom_sid2 *sid,
 				uint32_t access_mask,
-				struct policy_handle *acct_handle);
+				struct policy_handle **acct_handle);
 NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli,
 				     TALLOC_CTX *mem_ctx,
 				     struct policy_handle *handle,
diff --git a/source/librpc/gen_ndr/lsa.h b/source/librpc/gen_ndr/lsa.h
index 810ce94..03ffdd0 100644
--- a/source/librpc/gen_ndr/lsa.h
+++ b/source/librpc/gen_ndr/lsa.h
@@ -829,7 +829,7 @@ struct lsa_OpenAccount {
 	} in;
 
 	struct {
-		struct policy_handle *acct_handle;/* [ref] */
+		struct policy_handle **acct_handle;/* [ref] */
 		NTSTATUS result;
 	} out;
 
diff --git a/source/librpc/gen_ndr/ndr_lsa.c b/source/librpc/gen_ndr/ndr_lsa.c
index 8c86308..4e23040 100644
--- a/source/librpc/gen_ndr/ndr_lsa.c
+++ b/source/librpc/gen_ndr/ndr_lsa.c
@@ -6208,7 +6208,10 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag
 		if (r->out.acct_handle == NULL) {
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
-		NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
+		NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.acct_handle));
+		if (*r->out.acct_handle) {
+			NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
+		}
 		NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
 	}
 	return NDR_ERR_SUCCESS;
@@ -6216,9 +6219,11 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag
 
 static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flags, struct lsa_OpenAccount *r)
 {
+	uint32_t _ptr_acct_handle;
 	TALLOC_CTX *_mem_save_handle_0;
 	TALLOC_CTX *_mem_save_sid_0;
 	TALLOC_CTX *_mem_save_acct_handle_0;
+	TALLOC_CTX *_mem_save_acct_handle_1;
 	if (flags & NDR_IN) {
 		ZERO_STRUCT(r->out);
 
@@ -6246,7 +6251,18 @@ static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flag
 		}
 		_mem_save_acct_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
 		NDR_PULL_SET_MEM_CTX(ndr, r->out.acct_handle, LIBNDR_FLAG_REF_ALLOC);
-		NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
+		NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_acct_handle));
+		if (_ptr_acct_handle) {
+			NDR_PULL_ALLOC(ndr, *r->out.acct_handle);
+		} else {
+			*r->out.acct_handle = NULL;
+		}
+		if (*r->out.acct_handle) {
+			_mem_save_acct_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
+			NDR_PULL_SET_MEM_CTX(ndr, *r->out.acct_handle, 0);
+			NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
+			NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_1, 0);
+		}
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_0, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
 	}
@@ -6279,7 +6295,12 @@ _PUBLIC_ void ndr_print_lsa_OpenAccount(struct ndr_print *ndr, const char *name,
 		ndr->depth++;
 		ndr_print_ptr(ndr, "acct_handle", r->out.acct_handle);
 		ndr->depth++;
-		ndr_print_policy_handle(ndr, "acct_handle", r->out.acct_handle);
+		ndr_print_ptr(ndr, "acct_handle", *r->out.acct_handle);
+		ndr->depth++;
+		if (*r->out.acct_handle) {
+			ndr_print_policy_handle(ndr, "acct_handle", *r->out.acct_handle);
+		}
+		ndr->depth--;
 		ndr->depth--;
 		ndr_print_NTSTATUS(ndr, "result", r->out.result);
 		ndr->depth--;
diff --git a/source/librpc/gen_ndr/srv_lsa.c b/source/librpc/gen_ndr/srv_lsa.c
index 9d41be3..f8ef1ad 100644
--- a/source/librpc/gen_ndr/srv_lsa.c
+++ b/source/librpc/gen_ndr/srv_lsa.c
@@ -1372,7 +1372,7 @@ static bool api_lsa_OpenAccount(pipes_struct *p)
 	}
 
 	ZERO_STRUCT(r->out);
-	r->out.acct_handle = talloc_zero(r, struct policy_handle);
+	r->out.acct_handle = talloc_zero(r, struct policy_handle *);
 	if (r->out.acct_handle == NULL) {
 		talloc_free(r);
 		return false;
diff --git a/source/librpc/idl/lsa.idl b/source/librpc/idl/lsa.idl
index fc36689..dc1d1a1 100644
--- a/source/librpc/idl/lsa.idl
+++ b/source/librpc/idl/lsa.idl
@@ -431,9 +431,9 @@ import "security.idl";
 	/* Function:     0x11                    */
 	NTSTATUS lsa_OpenAccount (
 		[in]         policy_handle *handle,
-		[in]         dom_sid2 *sid,
+		[in,ref]     dom_sid2 *sid,
 		[in]         uint32 access_mask,
-		[out]        policy_handle *acct_handle
+		[out]        policy_handle **acct_handle
 		);
 
 
diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c
index 514b8f5..150d55d 100644
--- a/source/rpc_client/cli_lsarpc.c
+++ b/source/rpc_client/cli_lsarpc.c
@@ -721,44 +721,6 @@ NTSTATUS rpccli_lsa_enum_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
 	return result;
 }
 
-/** Open a LSA user handle
- *
- * @param cli Handle on an initialised SMB connection */
-
-NTSTATUS rpccli_lsa_open_account(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                             POLICY_HND *dom_pol, DOM_SID *sid, uint32 des_access,
-			     POLICY_HND *user_pol)
-{
-	prs_struct qbuf, rbuf;
-	LSA_Q_OPENACCOUNT q;
-	LSA_R_OPENACCOUNT r;
-	NTSTATUS result;
-
-	ZERO_STRUCT(q);
-	ZERO_STRUCT(r);
-
-	/* Initialise input parameters */
-
-	init_lsa_q_open_account(&q, dom_pol, sid, des_access);
-
-	CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_OPENACCOUNT,
-		q, r,
-		qbuf, rbuf,
-		lsa_io_q_open_account,
-		lsa_io_r_open_account,
-		NT_STATUS_UNSUCCESSFUL);
-
-	/* Return output parameters */
-
-	result = r.status;
-
-	if (NT_STATUS_IS_OK(result)) {
-		*user_pol = r.pol;
-	}
-
-	return result;
-}
-
 /** Enumerate user privileges
  *
  * @param cli Handle on an initialised SMB connection */
diff --git a/source/rpc_parse/parse_lsa.c b/source/rpc_parse/parse_lsa.c
index ef54b4a..4c13c58 100644
--- a/source/rpc_parse/parse_lsa.c
+++ b/source/rpc_parse/parse_lsa.c
@@ -1985,60 +1985,6 @@ bool lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *out, pr
 	return True;
 }
 
-void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
-{
-	memcpy(&trn->pol, hnd, sizeof(trn->pol));
-
-	init_dom_sid2(&trn->sid, sid);
-	trn->access = desired_access;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_OPENACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *out, prs_struct *ps, int depth)
-{
-	prs_debug(ps, depth, desc, "lsa_io_q_open_account");
-	depth++;
-
-	if(!prs_align(ps))
-		return False;
- 
-	if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
-		return False;
-
-	if(!smb_io_dom_sid2("sid", &out->sid, ps, depth)) /* domain SID */
-		return False;
-
- 	if(!prs_uint32("access", ps, depth, &out->access))
-		return False;
-  
-	return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPENACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_r_open_account(const char *desc, LSA_R_OPENACCOUNT  *out, prs_struct *ps, int depth)
-{
-	prs_debug(ps, depth, desc, "lsa_io_r_open_account");
-	depth++;
-
-	if(!prs_align(ps))
-		return False;
- 
-	if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
-		return False;
-
-	if(!prs_ntstatus("status", ps, depth, &out->status))
-		return False;
-
-	return True;
-}
-
-
 void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd)
 {
 	memcpy(&trn->pol, hnd, sizeof(trn->pol));
diff --git a/source/rpc_server/srv_lsa.c b/source/rpc_server/srv_lsa.c
index 5811d85..7395088 100644
--- a/source/rpc_server/srv_lsa.c
+++ b/source/rpc_server/srv_lsa.c
@@ -316,29 +316,7 @@ static bool api_lsa_create_account(pipes_struct *p)
 
 static bool api_lsa_open_account(pipes_struct *p)
 {
-	LSA_Q_OPENACCOUNT q_u;
-	LSA_R_OPENACCOUNT r_u;
-	
-	prs_struct *data = &p->in_data.data;
-	prs_struct *rdata = &p->out_data.rdata;
-
-	ZERO_STRUCT(q_u);
-	ZERO_STRUCT(r_u);
-
-	if(!lsa_io_q_open_account("", &q_u, data, 0)) {
-		DEBUG(0,("api_lsa_open_account: failed to unmarshall LSA_Q_OPENACCOUNT.\n"));
-		return False;
-	}
-
-	r_u.status = _lsa_open_account(p, &q_u, &r_u);
-
-	/* store the response in the SMB stream */
-	if(!lsa_io_r_open_account("", &r_u, rdata, 0)) {
-		DEBUG(0,("api_lsa_open_account: Failed to marshall LSA_R_OPENACCOUNT.\n"));
-		return False;
-	}
-
-	return True;
+	return proxy_lsa_call(p, NDR_LSA_OPENACCOUNT);
 }
 
 /***************************************************************************
diff --git a/source/rpc_server/srv_lsa_nt.c b/source/rpc_server/srv_lsa_nt.c
index c197f20..7b4de95 100644
--- a/source/rpc_server/srv_lsa_nt.c
+++ b/source/rpc_server/srv_lsa_nt.c
@@ -1655,16 +1655,17 @@ NTSTATUS _lsa_CreateAccount(pipes_struct *p,
 
 
 /***************************************************************************
- Lsa Open Account
+ _lsa_OpenAccount
  ***************************************************************************/
 
-NTSTATUS _lsa_open_account(pipes_struct *p, LSA_Q_OPENACCOUNT *q_u, LSA_R_OPENACCOUNT *r_u)
+NTSTATUS _lsa_OpenAccount(pipes_struct *p,
+			  struct lsa_OpenAccount *r)
 {
 	struct lsa_info *handle;
 	struct lsa_info *info;
 
 	/* find the connection policy handle. */
-	if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
+	if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
 		return NT_STATUS_INVALID_HANDLE;
 
 	/* check if the user have enough rights */
@@ -1686,11 +1687,11 @@ NTSTATUS _lsa_open_account(pipes_struct *p, LSA_Q_OPENACCOUNT *q_u, LSA_R_OPENAC
 		return NT_STATUS_NO_MEMORY;
 
 	ZERO_STRUCTP(info);
-	info->sid = q_u->sid.sid;
-	info->access = q_u->access;
+	info->sid = *r->in.sid;
+	info->access = r->in.access_mask;
 
 	/* get a (unique) handle.  open a policy on it. */
-	if (!create_policy_hnd(p, &r_u->pol, free_lsa_info, (void *)info))
+	if (!create_policy_hnd(p, *r->out.acct_handle, free_lsa_info, (void *)info))
 		return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
 	return NT_STATUS_OK;
@@ -2240,12 +2241,6 @@ NTSTATUS _lsa_LookupSids(pipes_struct *p, struct lsa_LookupSids *r)
 	return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS _lsa_OpenAccount(pipes_struct *p, struct lsa_OpenAccount *r)
-{
-	p->rng_fault_state = True;
-	return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p, struct lsa_EnumPrivsAccount *r)
 {
 	p->rng_fault_state = True;
diff --git a/source/rpcclient/cmd_lsarpc.c b/source/rpcclient/cmd_lsarpc.c
index fb8ca76..f71a6d6 100644
--- a/source/rpcclient/cmd_lsarpc.c
+++ b/source/rpcclient/cmd_lsarpc.c
@@ -632,7 +632,7 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli,
                                            const char **argv) 
 {
 	POLICY_HND dom_pol;
-	POLICY_HND user_pol;
+	POLICY_HND *user_pol = NULL;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 	uint32 access_desired = 0x000f000f;
 	
@@ -657,12 +657,16 @@ static NTSTATUS cmd_lsa_enum_privsaccounts(struct rpc_pipe_client *cli,
 	if (!NT_STATUS_IS_OK(result))
 		goto done;
 
-	result = rpccli_lsa_open_account(cli, mem_ctx, &dom_pol, &sid, access_desired, &user_pol);
+	result = rpccli_lsa_OpenAccount(cli, mem_ctx,
+					&dom_pol,
+					&sid,
+					access_desired,
+					&user_pol);
 
 	if (!NT_STATUS_IS_OK(result))
 		goto done;
 
-	result = rpccli_lsa_enum_privsaccount(cli, mem_ctx, &user_pol, &count, &set);
+	result = rpccli_lsa_enum_privsaccount(cli, mem_ctx, user_pol, &count, &set);
 
 	if (!NT_STATUS_IS_OK(result))
 		goto done;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list