[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2244-g80e3933

Günther Deschner gd at samba.org
Thu Feb 14 14:32:39 GMT 2008


The branch, v3-2-test has been updated
       via  80e39330bf15cc57f2780a5b900d8a2b14d92fa9 (commit)
       via  78200d88924bbef3df7185fc3a0e1753160a592f (commit)
       via  39f8508f5d978a936779fdfd51b90fec4faa4301 (commit)
       via  3436a54662fad1c69cfd1211f1afaa5a9d3d6d36 (commit)
       via  d65b2504de6e433e1ca3ea8aa839b4209dd1b99a (commit)
      from  34c0e64026b7f5f223c7d7f1d7e162b5659f3bd3 (commit)

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


- Log -----------------------------------------------------------------
commit 80e39330bf15cc57f2780a5b900d8a2b14d92fa9
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 14 15:29:51 2008 +0100

    Remove unused marshalling for LSA_REMOVE_ACCT_RIGHTS.
    
    Guenther

commit 78200d88924bbef3df7185fc3a0e1753160a592f
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 14 15:28:26 2008 +0100

    Use rpccli_lsa_RemoveAccountRights() in net and rpcclient.
    
    Guenther

commit 39f8508f5d978a936779fdfd51b90fec4faa4301
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 14 15:20:18 2008 +0100

    Use pidl for _lsa_RemoveAccountRights.
    
    Guenther

commit 3436a54662fad1c69cfd1211f1afaa5a9d3d6d36
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 14 15:21:54 2008 +0100

    Re-run make idl.
    
    Guenther

commit d65b2504de6e433e1ca3ea8aa839b4209dd1b99a
Author: Günther Deschner <gd at samba.org>
Date:   Thu Feb 14 15:20:47 2008 +0100

    Fix IDL for lsa_RemoveAccountRights.
    
    Guenther

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

Summary of changes:
 source/include/rpc_lsa.h        |   16 ---------
 source/librpc/gen_ndr/cli_lsa.c |    4 +-
 source/librpc/gen_ndr/cli_lsa.h |    2 +-
 source/librpc/gen_ndr/lsa.h     |    4 +-
 source/librpc/gen_ndr/ndr_lsa.c |    6 ++--
 source/librpc/idl/lsa.idl       |    6 ++--
 source/rpc_client/cli_lsarpc.c  |   35 --------------------
 source/rpc_parse/parse_lsa.c    |   69 ---------------------------------------
 source/rpc_server/srv_lsa.c     |   24 +-------------
 source/rpc_server/srv_lsa_nt.c  |   37 +++++++--------------
 source/rpcclient/cmd_lsarpc.c   |   21 ++++++++++--
 source/utils/net_rpc_rights.c   |   21 ++++++++++--
 12 files changed, 60 insertions(+), 185 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/rpc_lsa.h b/source/include/rpc_lsa.h
index 0cfee2d..dde014a 100644
--- a/source/include/rpc_lsa.h
+++ b/source/include/rpc_lsa.h
@@ -446,20 +446,4 @@ typedef struct lsa_r_lookup_names4
 	NTSTATUS status; /* return code */
 } LSA_R_LOOKUP_NAMES4;
 
-/* LSA_Q_REMOVE_ACCT_RIGHTS - LSA remove account rights */
-typedef struct
-{
-	POLICY_HND pol; /* policy handle */
-	DOM_SID2 sid;
-	uint32 removeall;
-	uint32 count;
-	UNISTR4_ARRAY *rights;
-} LSA_Q_REMOVE_ACCT_RIGHTS;
-
-/* LSA_R_REMOVE_ACCT_RIGHTS - LSA remove account rights */
-typedef struct
-{
-	NTSTATUS status;
-} LSA_R_REMOVE_ACCT_RIGHTS;
-
 #endif /* _RPC_LSA_H */
diff --git a/source/librpc/gen_ndr/cli_lsa.c b/source/librpc/gen_ndr/cli_lsa.c
index 205faa6..7484edc 100644
--- a/source/librpc/gen_ndr/cli_lsa.c
+++ b/source/librpc/gen_ndr/cli_lsa.c
@@ -1667,7 +1667,7 @@ NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli,
 					TALLOC_CTX *mem_ctx,
 					struct policy_handle *handle,
 					struct dom_sid2 *sid,
-					uint32_t unknown,
+					uint8_t remove_all,
 					struct lsa_RightSet *rights)
 {
 	struct lsa_RemoveAccountRights r;
@@ -1676,7 +1676,7 @@ NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli,
 	/* In parameters */
 	r.in.handle = handle;
 	r.in.sid = sid;
-	r.in.unknown = unknown;
+	r.in.remove_all = remove_all;
 	r.in.rights = rights;
 
 	if (DEBUGLEVEL >= 10) {
diff --git a/source/librpc/gen_ndr/cli_lsa.h b/source/librpc/gen_ndr/cli_lsa.h
index 67aafe3..e4bf43a 100644
--- a/source/librpc/gen_ndr/cli_lsa.h
+++ b/source/librpc/gen_ndr/cli_lsa.h
@@ -192,7 +192,7 @@ NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli,
 					TALLOC_CTX *mem_ctx,
 					struct policy_handle *handle,
 					struct dom_sid2 *sid,
-					uint32_t unknown,
+					uint8_t remove_all,
 					struct lsa_RightSet *rights);
 NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli,
 						TALLOC_CTX *mem_ctx,
diff --git a/source/librpc/gen_ndr/lsa.h b/source/librpc/gen_ndr/lsa.h
index a948f6d..4a1ebdb 100644
--- a/source/librpc/gen_ndr/lsa.h
+++ b/source/librpc/gen_ndr/lsa.h
@@ -448,7 +448,7 @@ struct lsa_RightAttribute {
 };
 
 struct lsa_RightSet {
-	uint32_t count;
+	uint32_t count;/* [range(0,256)] */
 	struct lsa_StringLarge *names;/* [unique,size_is(count)] */
 };
 
@@ -1104,7 +1104,7 @@ struct lsa_RemoveAccountRights {
 	struct {
 		struct policy_handle *handle;/* [ref] */
 		struct dom_sid2 *sid;/* [ref] */
-		uint32_t unknown;
+		uint8_t remove_all;
 		struct lsa_RightSet *rights;/* [ref] */
 	} in;
 
diff --git a/source/librpc/gen_ndr/ndr_lsa.c b/source/librpc/gen_ndr/ndr_lsa.c
index a95665f..74d8a31 100644
--- a/source/librpc/gen_ndr/ndr_lsa.c
+++ b/source/librpc/gen_ndr/ndr_lsa.c
@@ -8049,7 +8049,7 @@ static enum ndr_err_code ndr_push_lsa_RemoveAccountRights(struct ndr_push *ndr,
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
 		NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
-		NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown));
+		NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.remove_all));
 		if (r->in.rights == NULL) {
 			return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
 		}
@@ -8081,7 +8081,7 @@ static enum ndr_err_code ndr_pull_lsa_RemoveAccountRights(struct ndr_pull *ndr,
 		NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC);
 		NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid));
 		NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
-		NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown));
+		NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.remove_all));
 		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
 			NDR_PULL_ALLOC(ndr, r->in.rights);
 		}
@@ -8114,7 +8114,7 @@ _PUBLIC_ void ndr_print_lsa_RemoveAccountRights(struct ndr_print *ndr, const cha
 		ndr->depth++;
 		ndr_print_dom_sid2(ndr, "sid", r->in.sid);
 		ndr->depth--;
-		ndr_print_uint32(ndr, "unknown", r->in.unknown);
+		ndr_print_uint8(ndr, "remove_all", r->in.remove_all);
 		ndr_print_ptr(ndr, "rights", r->in.rights);
 		ndr->depth++;
 		ndr_print_lsa_RightSet(ndr, "rights", r->in.rights);
diff --git a/source/librpc/idl/lsa.idl b/source/librpc/idl/lsa.idl
index aad9c3b..47fa9f4 100644
--- a/source/librpc/idl/lsa.idl
+++ b/source/librpc/idl/lsa.idl
@@ -705,9 +705,9 @@ import "security.idl";
 	/* Function:       0x26 */
 	NTSTATUS lsa_RemoveAccountRights (
 		[in]     policy_handle *handle,
-		[in]     dom_sid2 *sid,
-		[in]         uint32 unknown,
-		[in]     lsa_RightSet *rights
+		[in,ref] dom_sid2 *sid,
+		[in]     uint8 remove_all,
+		[in,ref] lsa_RightSet *rights
 		);
 
 	/* Function:   0x27 */
diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c
index 1de9592..a4c5331 100644
--- a/source/rpc_client/cli_lsarpc.c
+++ b/source/rpc_client/cli_lsarpc.c
@@ -452,41 +452,6 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
 	return result;
 }
 
-/* remove account rights for an account. */
-
-NTSTATUS rpccli_lsa_remove_account_rights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-				       POLICY_HND *pol, DOM_SID sid, bool removeall,
-				       uint32 count, const char **privs_name)
-{
-	prs_struct qbuf, rbuf;
-	LSA_Q_REMOVE_ACCT_RIGHTS q;
-	LSA_R_REMOVE_ACCT_RIGHTS r;
-	NTSTATUS result;
-
-	ZERO_STRUCT(q);
-	ZERO_STRUCT(r);
-
-	/* Marshall data and send request */
-	init_q_remove_acct_rights(&q, pol, &sid, removeall?1:0, count, privs_name);
-
-	CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_REMOVEACCTRIGHTS,
-		q, r,
-		qbuf, rbuf,
-		lsa_io_q_remove_acct_rights,
-		lsa_io_r_remove_acct_rights,
-		NT_STATUS_UNSUCCESSFUL);
-
-	result = r.status;
-
-	if (!NT_STATUS_IS_OK(result)) {
-		goto done;
-	}
-done:
-
-	return result;
-}
-
-
 #if 0
 
 /** An example of how to use the routines in this file.  Fetch a DOMAIN
diff --git a/source/rpc_parse/parse_lsa.c b/source/rpc_parse/parse_lsa.c
index 1a5c5e8..80e90a8 100644
--- a/source/rpc_parse/parse_lsa.c
+++ b/source/rpc_parse/parse_lsa.c
@@ -1218,72 +1218,3 @@ bool policy_handle_is_valid(const POLICY_HND *hnd)
 	ZERO_STRUCT(zero_pol);
 	return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : True );
 }
-
-/*******************************************************************
- Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure.
-********************************************************************/
-
-void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *in, 
-			       POLICY_HND *hnd, 
-			       DOM_SID *sid,
-			       uint32 removeall,
-			       uint32 count, 
-			       const char **rights)
-{
-	DEBUG(5, ("init_q_remove_acct_rights\n"));
-
-	in->pol = *hnd;
-
-	init_dom_sid2(&in->sid, sid);
-
-	in->removeall = removeall;
-	in->count = count;
-
-	in->rights = TALLOC_P( talloc_tos(), UNISTR4_ARRAY );
-	if (!in->rights) {
-		smb_panic("init_q_remove_acct_rights: talloc fail\n");
-		return;
-	}
-	init_unistr4_array( in->rights, count, rights );
-}
-
-/*******************************************************************
-reads or writes a LSA_Q_REMOVE_ACCT_RIGHTS structure.
-********************************************************************/
-
-bool lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *in, prs_struct *ps, int depth)
-{
-	prs_debug(ps, depth, desc, "lsa_io_q_remove_acct_rights");
-	depth++;
-
-	if (!smb_io_pol_hnd("", &in->pol, ps, depth))
-		return False;
-
-	if(!smb_io_dom_sid2("sid", &in->sid, ps, depth))
-		return False;
-
-	if(!prs_uint32("removeall", ps, depth, &in->removeall))
-		return False;
-
-	if(!prs_uint32("count", ps, depth, &in->count))
-		return False;
-
-	if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
-		return False;
-
-	return True;
-}
-
-/*******************************************************************
-reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure.
-********************************************************************/
-bool lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out, prs_struct *ps, int depth)
-{
-	prs_debug(ps, depth, desc, "lsa_io_r_remove_acct_rights");
-	depth++;
-
-	if(!prs_ntstatus("status", ps, depth, &out->status))
-		return False;
-
-	return True;
-}
diff --git a/source/rpc_server/srv_lsa.c b/source/rpc_server/srv_lsa.c
index 14cf0b3..dfb3323 100644
--- a/source/rpc_server/srv_lsa.c
+++ b/source/rpc_server/srv_lsa.c
@@ -285,29 +285,7 @@ static bool api_lsa_add_acct_rights(pipes_struct *p)
 
 static bool api_lsa_remove_acct_rights(pipes_struct *p)
 {
-	LSA_Q_REMOVE_ACCT_RIGHTS q_u;
-	LSA_R_REMOVE_ACCT_RIGHTS 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_remove_acct_rights("", &q_u, data, 0)) {
-		DEBUG(0,("api_lsa_remove_acct_rights: failed to unmarshall LSA_Q_REMOVE_ACCT_RIGHTS.\n"));
-		return False;
-	}
-
-	r_u.status = _lsa_remove_acct_rights(p, &q_u, &r_u);
-
-	/* store the response in the SMB stream */
-	if(!lsa_io_r_remove_acct_rights("", &r_u, rdata, 0)) {
-		DEBUG(0,("api_lsa_remove_acct_rights: Failed to marshall LSA_R_REMOVE_ACCT_RIGHTS.\n"));
-		return False;
-	}
-
-	return True;
+	return proxy_lsa_call(p, NDR_LSA_REMOVEACCOUNTRIGHTS);
 }
 
 /***************************************************************************
diff --git a/source/rpc_server/srv_lsa_nt.c b/source/rpc_server/srv_lsa_nt.c
index a709877..027277e 100644
--- a/source/rpc_server/srv_lsa_nt.c
+++ b/source/rpc_server/srv_lsa_nt.c
@@ -2090,19 +2090,19 @@ NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
 }
 
 /***************************************************************************
+ _lsa_RemoveAccountRights
  ***************************************************************************/
 
-NTSTATUS _lsa_remove_acct_rights(pipes_struct *p, LSA_Q_REMOVE_ACCT_RIGHTS *q_u, LSA_R_REMOVE_ACCT_RIGHTS *r_u)
+NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p,
+				  struct lsa_RemoveAccountRights *r)
 {
 	struct lsa_info *info = NULL;
 	int i = 0;
 	DOM_SID sid;
-	fstring privname;
-	UNISTR4_ARRAY *uni_privnames = q_u->rights;
-
+	const char *privname = NULL;
 
 	/* find the connection policy handle. */
-	if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
+	if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
 		return NT_STATUS_INVALID_HANDLE;
 
 	/* check to see if the pipe_user is a Domain Admin since
@@ -2114,34 +2114,27 @@ NTSTATUS _lsa_remove_acct_rights(pipes_struct *p, LSA_Q_REMOVE_ACCT_RIGHTS *q_u,
 		return NT_STATUS_ACCESS_DENIED;
 	}
 
-	sid_copy( &sid, &q_u->sid.sid );
+	sid_copy( &sid, r->in.sid );
 
-	if ( q_u->removeall ) {
+	if ( r->in.remove_all ) {
 		if ( !revoke_all_privileges( &sid ) )
 			return NT_STATUS_ACCESS_DENIED;
 
 		return NT_STATUS_OK;
 	}
 
-	/* just a little sanity check */
-
-	if ( q_u->count != uni_privnames->count ) {
-		DEBUG(0,("_lsa_add_acct_rights: count != number of UNISTR2 elements!\n"));
-		return NT_STATUS_INVALID_HANDLE;
-	}
+	for ( i=0; i < r->in.rights->count; i++ ) {
 
-	for ( i=0; i<q_u->count; i++ ) {
-		UNISTR4 *uni4_str = &uni_privnames->strings[i];
+		privname = r->in.rights->names[i].string;
 
 		/* only try to add non-null strings */
 
-		if ( !uni4_str->string )
+		if ( !privname )
 			continue;
 
-		rpcstr_pull( privname, uni4_str->string->buffer, sizeof(privname), -1, STR_TERMINATE );
-
 		if ( !revoke_privilege_by_name( &sid, privname ) ) {
-			DEBUG(2,("_lsa_remove_acct_rights: Failed to revoke privilege [%s]\n", privname ));
+			DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
+				privname ));
 			return NT_STATUS_NO_SUCH_PRIVILEGE;
 		}
 	}
@@ -2355,12 +2348,6 @@ NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccounts
 	return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p, struct lsa_RemoveAccountRights *r)
-{
-	p->rng_fault_state = True;
-	return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
 {
 	p->rng_fault_state = True;
diff --git a/source/rpcclient/cmd_lsarpc.c b/source/rpcclient/cmd_lsarpc.c
index d7f5e55..3fe8bc8 100644
--- a/source/rpcclient/cmd_lsarpc.c
+++ b/source/rpcclient/cmd_lsarpc.c
@@ -816,8 +816,9 @@ static NTSTATUS cmd_lsa_remove_acct_rights(struct rpc_pipe_client *cli,
 {
 	POLICY_HND dom_pol;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
+	struct lsa_RightSet rights;
 	DOM_SID sid;
+	int i;
 
 	if (argc < 3 ) {
 		printf("Usage: %s SID [rights...]\n", argv[0]);
@@ -835,8 +836,22 @@ static NTSTATUS cmd_lsa_remove_acct_rights(struct rpc_pipe_client *cli,
 	if (!NT_STATUS_IS_OK(result))
 		goto done;
 
-	result = rpccli_lsa_remove_account_rights(cli, mem_ctx, &dom_pol, sid, 
-					       False, argc-2, argv+2);
+	rights.count = argc-2;
+	rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge,
+				    rights.count);
+	if (!rights.names) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	for (i=0; i<argc-2; i++) {
+		init_lsa_StringLarge(&rights.names[i], argv[i+2]);
+	}
+
+	result = rpccli_lsa_RemoveAccountRights(cli, mem_ctx,
+						&dom_pol,
+						&sid,
+						false,
+						&rights);
 
 	if (!NT_STATUS_IS_OK(result))
 		goto done;
diff --git a/source/utils/net_rpc_rights.c b/source/utils/net_rpc_rights.c
index a0df5d8..16d75e5 100644
--- a/source/utils/net_rpc_rights.c
+++ b/source/utils/net_rpc_rights.c
@@ -502,8 +502,9 @@ static NTSTATUS rpc_rights_revoke_internal(const DOM_SID *domain_sid,
 {
 	POLICY_HND dom_pol;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-
+	struct lsa_RightSet rights;
 	DOM_SID sid;
+	int i;
 
 	if (argc < 2 ) {
 		d_printf("Usage: net rpc rights revoke <name|SID> <rights...>\n");
@@ -521,8 +522,22 @@ static NTSTATUS rpc_rights_revoke_internal(const DOM_SID *domain_sid,
 	if (!NT_STATUS_IS_OK(result))
 		return result;	
 
-	result = rpccli_lsa_remove_account_rights(pipe_hnd, mem_ctx, &dom_pol, sid, 
-					       False, argc-1, argv+1);
+	rights.count = argc-1;
+	rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge,
+				    rights.count);
+	if (!rights.names) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	for (i=0; i<argc-1; i++) {
+		init_lsa_StringLarge(&rights.names[i], argv[i+1]);
+	}
+
+	result = rpccli_lsa_RemoveAccountRights(pipe_hnd, mem_ctx,
+						&dom_pol,
+						&sid,
+						false,
+						&rights);
 
 	if (!NT_STATUS_IS_OK(result))
 		goto done;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list