[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2023-gc9a8baf

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


The branch, v3-2-test has been updated
       via  c9a8baf5077a4e93cca241a5ec73f6ade97af607 (commit)
       via  43ab24c11e0268a8f57780b7abce1c744e8690b4 (commit)
       via  d71f56a293d67971c45ee44219752a55fb21f8be (commit)
       via  ea64f45818b206e4027fea1c7dafdef779b7261c (commit)
       via  f129feecdb927c70c949bc547d2ae6cdfc5e88d4 (commit)
      from  90fb59cb440d4e2d68c550f554a0a4a3cb386762 (commit)

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


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

    Remove unused marshalling for LSA_CREATEACCOUNT.
    
    Guenther

commit 43ab24c11e0268a8f57780b7abce1c744e8690b4
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 6 19:07:31 2008 +0100

    Use rpccli_lsa_CreateAccount() in rpcclient.
    
    Guenther

commit d71f56a293d67971c45ee44219752a55fb21f8be
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 6 18:58:11 2008 +0100

    Use pidl for _lsa_CreateAccount().
    
    Guenther

commit ea64f45818b206e4027fea1c7dafdef779b7261c
Author: Günther Deschner <gd at samba.org>
Date:   Fri Feb 8 22:38:18 2008 +0100

    Re-run make idl.
    
    Guenther

commit f129feecdb927c70c949bc547d2ae6cdfc5e88d4
Author: Günther Deschner <gd at samba.org>
Date:   Fri Feb 8 18:18:26 2008 +0100

    Fix IDL for lsa_CreateAccount.
    
    Guenther

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

Summary of changes:
 source/include/rpc_lsa.h        |   14 ----------
 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  |   43 ------------------------------
 source/rpc_parse/parse_lsa.c    |   55 ---------------------------------------
 source/rpc_server/srv_lsa.c     |   25 +----------------
 source/rpc_server/srv_lsa_nt.c  |   21 +++++---------
 source/rpcclient/cmd_lsarpc.c   |    8 ++++-
 12 files changed, 46 insertions(+), 159 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/rpc_lsa.h b/source/include/rpc_lsa.h
index 45470e7..902d1e2 100644
--- a/source/include/rpc_lsa.h
+++ b/source/include/rpc_lsa.h
@@ -689,20 +689,6 @@ typedef struct lsa_r_unk_get_connuser
 } LSA_R_UNK_GET_CONNUSER;
 
 
-typedef struct lsa_q_createaccount
-{
-	POLICY_HND pol; /* policy handle */
-	DOM_SID2 sid;
-	uint32 access; /* access */
-} LSA_Q_CREATEACCOUNT;
-
-typedef struct lsa_r_createaccount
-{
-	POLICY_HND pol; /* policy handle */
-	NTSTATUS status;
-} LSA_R_CREATEACCOUNT;
-
-
 typedef struct lsa_q_openaccount
 {
 	POLICY_HND pol; /* policy handle */
diff --git a/source/librpc/gen_ndr/cli_lsa.c b/source/librpc/gen_ndr/cli_lsa.c
index 5fc1592..227ae80 100644
--- a/source/librpc/gen_ndr/cli_lsa.c
+++ b/source/librpc/gen_ndr/cli_lsa.c
@@ -427,7 +427,7 @@ NTSTATUS rpccli_lsa_CreateAccount(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_CreateAccount r;
 	NTSTATUS status;
diff --git a/source/librpc/gen_ndr/cli_lsa.h b/source/librpc/gen_ndr/cli_lsa.h
index cce629c..ec9abaf 100644
--- a/source/librpc/gen_ndr/cli_lsa.h
+++ b/source/librpc/gen_ndr/cli_lsa.h
@@ -48,7 +48,7 @@ NTSTATUS rpccli_lsa_CreateAccount(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_EnumAccounts(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 86d4339..810ce94 100644
--- a/source/librpc/gen_ndr/lsa.h
+++ b/source/librpc/gen_ndr/lsa.h
@@ -713,7 +713,7 @@ struct lsa_CreateAccount {
 	} 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 0b246a9..8c86308 100644
--- a/source/librpc/gen_ndr/ndr_lsa.c
+++ b/source/librpc/gen_ndr/ndr_lsa.c
@@ -5321,7 +5321,10 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int
 		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;
@@ -5329,9 +5332,11 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int
 
 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *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);
 
@@ -5359,7 +5364,18 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int
 		}
 		_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));
 	}
@@ -5392,7 +5408,12 @@ _PUBLIC_ void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *nam
 		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 b46e892..9d41be3 100644
--- a/source/librpc/gen_ndr/srv_lsa.c
+++ b/source/librpc/gen_ndr/srv_lsa.c
@@ -806,7 +806,7 @@ static bool api_lsa_CreateAccount(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 9879d14..fc36689 100644
--- a/source/librpc/idl/lsa.idl
+++ b/source/librpc/idl/lsa.idl
@@ -276,9 +276,9 @@ import "security.idl";
 	/* Function: 0x0a */
 	[public] NTSTATUS lsa_CreateAccount (
 		[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 250bf3e..514b8f5 100644
--- a/source/rpc_client/cli_lsarpc.c
+++ b/source/rpc_client/cli_lsarpc.c
@@ -721,49 +721,6 @@ NTSTATUS rpccli_lsa_enum_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
 	return result;
 }
 
-/** Create a LSA user handle
- *
- * @param cli Handle on an initialised SMB connection
- *
- * FIXME: The code is actually identical to open account
- * TODO: Check and code what the function should exactly do
- *
- * */
-
-NTSTATUS rpccli_lsa_create_account(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                             POLICY_HND *dom_pol, DOM_SID *sid, uint32 desired_access,
-			     POLICY_HND *user_pol)
-{
-	prs_struct qbuf, rbuf;
-	LSA_Q_CREATEACCOUNT q;
-	LSA_R_CREATEACCOUNT r;
-	NTSTATUS result;
-
-	ZERO_STRUCT(q);
-	ZERO_STRUCT(r);
-
-	/* Initialise input parameters */
-
-	init_lsa_q_create_account(&q, dom_pol, sid, desired_access);
-
-	CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_CREATEACCOUNT,
-		q, r,
-		qbuf, rbuf,
-		lsa_io_q_create_account,
-		lsa_io_r_create_account,
-		NT_STATUS_UNSUCCESSFUL);
-
-	/* Return output parameters */
-
-	result = r.status;
-
-	if (NT_STATUS_IS_OK(result)) {
-		*user_pol = r.pol;
-	}
-
-	return result;
-}
-
 /** Open a LSA user handle
  *
  * @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 1574df5..ef54b4a 100644
--- a/source/rpc_parse/parse_lsa.c
+++ b/source/rpc_parse/parse_lsa.c
@@ -1985,61 +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_create_account(LSA_Q_CREATEACCOUNT *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_CREATEACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_q_create_account(const char *desc, LSA_Q_CREATEACCOUNT *out, prs_struct *ps, int depth)
-{
-	prs_debug(ps, depth, desc, "lsa_io_q_create_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_CREATEACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_r_create_account(const char *desc, LSA_R_CREATEACCOUNT  *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_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
 {
 	memcpy(&trn->pol, hnd, sizeof(trn->pol));
diff --git a/source/rpc_server/srv_lsa.c b/source/rpc_server/srv_lsa.c
index fd5d815..5811d85 100644
--- a/source/rpc_server/srv_lsa.c
+++ b/source/rpc_server/srv_lsa.c
@@ -307,29 +307,7 @@ static bool api_lsa_unk_get_connuser(pipes_struct *p)
 
 static bool api_lsa_create_account(pipes_struct *p)
 {
-	LSA_Q_CREATEACCOUNT q_u;
-	LSA_R_CREATEACCOUNT 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_create_account("", &q_u, data, 0)) {
-		DEBUG(0,("api_lsa_create_account: failed to unmarshall LSA_Q_CREATEACCOUNT.\n"));
-		return False;
-	}
-
-	r_u.status = _lsa_create_account(p, &q_u, &r_u);
-
-	/* store the response in the SMB stream */
-	if(!lsa_io_r_create_account("", &r_u, rdata, 0)) {
-		DEBUG(0,("api_lsa_create_account: Failed to marshall LSA_R_CREATEACCOUNT.\n"));
-		return False;
-	}
-
-	return True;
+	return proxy_lsa_call(p, NDR_LSA_CREATEACCOUNT);
 }
 
 /***************************************************************************
@@ -943,6 +921,7 @@ static int count_fns(void)
 
 	return funcs;
 }
+
 void lsa_get_pipe_fns( struct api_struct **fns, int *n_fns )
 {
 	*fns = api_lsa_cmds;
diff --git a/source/rpc_server/srv_lsa_nt.c b/source/rpc_server/srv_lsa_nt.c
index 61b9d19..c197f20 100644
--- a/source/rpc_server/srv_lsa_nt.c
+++ b/source/rpc_server/srv_lsa_nt.c
@@ -1606,16 +1606,17 @@ NTSTATUS _lsa_unk_get_connuser(pipes_struct *p, LSA_Q_UNK_GET_CONNUSER *q_u, LSA
 }
 
 /***************************************************************************
- Lsa Create Account 
+ _lsa_CreateAccount
  ***************************************************************************/
 
-NTSTATUS _lsa_create_account(pipes_struct *p, LSA_Q_CREATEACCOUNT *q_u, LSA_R_CREATEACCOUNT *r_u)
+NTSTATUS _lsa_CreateAccount(pipes_struct *p,
+			    struct lsa_CreateAccount *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 */
@@ -1633,7 +1634,7 @@ NTSTATUS _lsa_create_account(pipes_struct *p, LSA_Q_CREATEACCOUNT *q_u, LSA_R_CR
 	if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
 		return NT_STATUS_ACCESS_DENIED;
 		
-	if ( is_privileged_sid( &q_u->sid.sid ) )
+	if ( is_privileged_sid( r->in.sid ) )
 		return NT_STATUS_OBJECT_NAME_COLLISION;
 
 	/* associate the user/group SID with the (unique) handle. */
@@ -1642,11 +1643,11 @@ NTSTATUS _lsa_create_account(pipes_struct *p, LSA_Q_CREATEACCOUNT *q_u, LSA_R_CR
 		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 privilege_create_account( &info->sid );
@@ -2215,12 +2216,6 @@ NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r)
 	return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS _lsa_CreateAccount(pipes_struct *p, struct lsa_CreateAccount *r)
-{
-	p->rng_fault_state = True;
-	return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 NTSTATUS _lsa_EnumAccounts(pipes_struct *p, struct lsa_EnumAccounts *r)
 {
 	p->rng_fault_state = True;
diff --git a/source/rpcclient/cmd_lsarpc.c b/source/rpcclient/cmd_lsarpc.c
index 9bd4a5e..fb8ca76 100644
--- a/source/rpcclient/cmd_lsarpc.c
+++ b/source/rpcclient/cmd_lsarpc.c
@@ -585,7 +585,7 @@ static NTSTATUS cmd_lsa_create_account(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 des_access = 0x000f000f;
 	
@@ -607,7 +607,11 @@ static NTSTATUS cmd_lsa_create_account(struct rpc_pipe_client *cli,
 	if (!NT_STATUS_IS_OK(result))
 		goto done;
 
-	result = rpccli_lsa_create_account(cli, mem_ctx, &dom_pol, &sid, des_access, &user_pol);
+	result = rpccli_lsa_CreateAccount(cli, mem_ctx,
+					  &dom_pol,
+					  &sid,
+					  des_access,
+					  &user_pol);
 
 	if (!NT_STATUS_IS_OK(result))
 		goto done;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list