[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-test-2211-g8c476ad
Günther Deschner
gd at samba.org
Thu Feb 14 00:37:55 GMT 2008
The branch, v3-2-test has been updated
via 8c476ad51622f76bf8f03f6255369b8e19f24a72 (commit)
via bdbcfa4419a54b98ea577b0052894ddaa06890ce (commit)
from 07e5138ad960bce8569ea593ca9a1b4fbf2b1048 (commit)
http://gitweb.samba.org/?samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 8c476ad51622f76bf8f03f6255369b8e19f24a72
Author: Günther Deschner <gd at samba.org>
Date: Thu Feb 14 01:34:34 2008 +0100
Remove unused marshalling for LSA_ENUM_ACCOUNTS.
Guenther
commit bdbcfa4419a54b98ea577b0052894ddaa06890ce
Author: Günther Deschner <gd at samba.org>
Date: Thu Feb 14 01:32:56 2008 +0100
Use rpccli_lsa_EnumAccounts() in net and rpcclient.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/include/rpc_lsa.h | 16 --------
source/rpc_client/cli_lsarpc.c | 56 --------------------------
source/rpc_parse/parse_lsa.c | 84 ----------------------------------------
source/rpcclient/cmd_lsarpc.c | 16 ++++---
source/utils/net_rpc_rights.c | 55 ++++++++++++++------------
5 files changed, 39 insertions(+), 188 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/include/rpc_lsa.h b/source/include/rpc_lsa.h
index 724a980..46a01d5 100644
--- a/source/include/rpc_lsa.h
+++ b/source/include/rpc_lsa.h
@@ -495,22 +495,6 @@ typedef struct
} LSA_R_REMOVE_ACCT_RIGHTS;
-/* LSA_Q_ENUM_ACCOUNTS */
-typedef struct lsa_q_enum_accounts
-{
- POLICY_HND pol; /* policy handle */
- uint32 enum_context;
- uint32 pref_max_length;
-} LSA_Q_ENUM_ACCOUNTS;
-
-/* LSA_R_ENUM_ACCOUNTS */
-typedef struct lsa_r_enum_accounts
-{
- uint32 enum_context;
- LSA_SID_ENUM sids;
- NTSTATUS status;
-} LSA_R_ENUM_ACCOUNTS;
-
typedef struct lsa_q_enumprivsaccount
{
POLICY_HND pol; /* policy handle */
diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c
index c42938d..20a0fe2 100644
--- a/source/rpc_client/cli_lsarpc.c
+++ b/source/rpc_client/cli_lsarpc.c
@@ -452,62 +452,6 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
return result;
}
-/** Enumerate list of SIDs */
-
-NTSTATUS rpccli_lsa_enum_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol, uint32 *enum_ctx, uint32 pref_max_length,
- uint32 *num_sids, DOM_SID **sids)
-{
- prs_struct qbuf, rbuf;
- LSA_Q_ENUM_ACCOUNTS q;
- LSA_R_ENUM_ACCOUNTS r;
- NTSTATUS result;
- int i;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- init_lsa_q_enum_accounts(&q, pol, *enum_ctx, pref_max_length);
-
- CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_ENUM_ACCOUNTS,
- q, r,
- qbuf, rbuf,
- lsa_io_q_enum_accounts,
- lsa_io_r_enum_accounts,
- NT_STATUS_UNSUCCESSFUL);
-
- result = r.status;
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
-
- if (r.sids.num_entries==0)
- goto done;
-
- /* Return output parameters */
-
- *sids = TALLOC_ARRAY(mem_ctx, DOM_SID, r.sids.num_entries);
- if (!*sids) {
- DEBUG(0, ("(cli_lsa_enum_sids): out of memory\n"));
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
-
- /* Copy across names and sids */
-
- for (i = 0; i < r.sids.num_entries; i++) {
- sid_copy(&(*sids)[i], &r.sids.sid[i].sid);
- }
-
- *num_sids= r.sids.num_entries;
- *enum_ctx = r.enum_context;
-
- done:
-
- 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 b8a0b03..6a80bb2 100644
--- a/source/rpc_parse/parse_lsa.c
+++ b/source/rpc_parse/parse_lsa.c
@@ -1207,90 +1207,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru
return True;
}
-/*
- initialise a LSA_Q_ENUM_ACCOUNTS structure
-*/
-void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS *trn, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length)
-{
- memcpy(&trn->pol, hnd, sizeof(trn->pol));
-
- trn->enum_context = enum_context;
- trn->pref_max_length = pref_max_length;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *in, prs_struct *ps, int depth)
-{
- if (in == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_q_enum_accounts");
- depth++;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if(!prs_uint32("enum_context ", ps, depth, &in->enum_context))
- return False;
- if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Inits an LSA_R_ENUM_PRIVS structure.
-********************************************************************/
-
-void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *out, uint32 enum_context)
-{
- DEBUG(5, ("init_lsa_r_enum_accounts\n"));
-
- out->enum_context=enum_context;
- if (out->enum_context!=0) {
- out->sids.num_entries=enum_context;
- out->sids.ptr_sid_enum=1;
- out->sids.num_entries2=enum_context;
- } else {
- out->sids.num_entries=0;
- out->sids.ptr_sid_enum=0;
- out->sids.num_entries2=0;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *out, prs_struct *ps, int depth)
-{
- if (out == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_r_enum_accounts");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if(!prs_uint32("enum_context", ps, depth, &out->enum_context))
- return False;
-
- if (!lsa_io_sid_enum("sids", &out->sids, ps, depth))
- return False;
-
- if (!prs_align(ps))
- 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/rpcclient/cmd_lsarpc.c b/source/rpcclient/cmd_lsarpc.c
index c014dba..6e12a90 100644
--- a/source/rpcclient/cmd_lsarpc.c
+++ b/source/rpcclient/cmd_lsarpc.c
@@ -550,8 +550,7 @@ static NTSTATUS cmd_lsa_enum_sids(struct rpc_pipe_client *cli,
uint32 enum_context=0;
uint32 pref_max_length=0x1000;
- DOM_SID *sids;
- uint32 count=0;
+ struct lsa_SidArray sid_array;
int i;
if (argc > 3) {
@@ -572,19 +571,22 @@ static NTSTATUS cmd_lsa_enum_sids(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(result))
goto done;
- result = rpccli_lsa_enum_sids(cli, mem_ctx, &pol, &enum_context, pref_max_length,
- &count, &sids);
+ result = rpccli_lsa_EnumAccounts(cli, mem_ctx,
+ &pol,
+ &enum_context,
+ &sid_array,
+ pref_max_length);
if (!NT_STATUS_IS_OK(result))
goto done;
/* Print results */
- printf("found %d SIDs\n\n", count);
+ printf("found %d SIDs\n\n", sid_array.num_sids);
- for (i = 0; i < count; i++) {
+ for (i = 0; i < sid_array.num_sids; i++) {
fstring sid_str;
- sid_to_fstring(sid_str, &sids[i]);
+ sid_to_fstring(sid_str, sid_array.sids[i].sid);
printf("%s\n", sid_str);
}
diff --git a/source/utils/net_rpc_rights.c b/source/utils/net_rpc_rights.c
index de6e14e..d8c7462 100644
--- a/source/utils/net_rpc_rights.c
+++ b/source/utils/net_rpc_rights.c
@@ -214,24 +214,27 @@ static NTSTATUS enum_accounts_for_privilege(struct rpc_pipe_client *pipe_hnd,
NTSTATUS result;
uint32 enum_context=0;
uint32 pref_max_length=0x1000;
- DOM_SID *sids = NULL;
- uint32 count=0;
+ struct lsa_SidArray sid_array;
int i;
fstring name;
- result = rpccli_lsa_enum_sids(pipe_hnd, ctx, pol, &enum_context,
- pref_max_length, &count, &sids);
+ result = rpccli_lsa_EnumAccounts(pipe_hnd, ctx,
+ pol,
+ &enum_context,
+ &sid_array,
+ pref_max_length);
if (!NT_STATUS_IS_OK(result))
return result;
d_printf("%s:\n", privilege);
- for ( i=0; i<count; i++ ) {
-
-
- result = check_privilege_for_user( pipe_hnd, ctx, pol, &sids[i], privilege);
-
+ for ( i=0; i<sid_array.num_sids; i++ ) {
+
+ result = check_privilege_for_user(pipe_hnd, ctx, pol,
+ sid_array.sids[i].sid,
+ privilege);
+
if ( ! NT_STATUS_IS_OK(result)) {
if ( ! NT_STATUS_EQUAL(result, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
return result;
@@ -241,9 +244,9 @@ static NTSTATUS enum_accounts_for_privilege(struct rpc_pipe_client *pipe_hnd,
/* try to convert the SID to a name. Fall back to
printing the raw SID if necessary */
- result = sid_to_name( pipe_hnd, ctx, &sids[i], name );
+ result = sid_to_name( pipe_hnd, ctx, sid_array.sids[i].sid, name );
if ( !NT_STATUS_IS_OK (result) )
- sid_to_fstring(name, &sids[i]);
+ sid_to_fstring(name, sid_array.sids[i].sid);
d_printf(" %s\n", name);
}
@@ -261,30 +264,32 @@ static NTSTATUS enum_privileges_for_accounts(struct rpc_pipe_client *pipe_hnd,
NTSTATUS result;
uint32 enum_context=0;
uint32 pref_max_length=0x1000;
- DOM_SID *sids;
- uint32 count=0;
+ struct lsa_SidArray sid_array;
int i;
fstring name;
- result = rpccli_lsa_enum_sids(pipe_hnd, ctx, pol, &enum_context,
- pref_max_length, &count, &sids);
+ result = rpccli_lsa_EnumAccounts(pipe_hnd, ctx,
+ pol,
+ &enum_context,
+ &sid_array,
+ pref_max_length);
if (!NT_STATUS_IS_OK(result))
return result;
-
- for ( i=0; i<count; i++ ) {
-
+
+ for ( i=0; i<sid_array.num_sids; i++ ) {
+
/* try to convert the SID to a name. Fall back to
printing the raw SID if necessary */
-
- result = sid_to_name(pipe_hnd, ctx, &sids[i], name );
+
+ result = sid_to_name(pipe_hnd, ctx, sid_array.sids[i].sid, name);
if ( !NT_STATUS_IS_OK (result) )
- sid_to_fstring(name, &sids[i]);
-
+ sid_to_fstring(name, sid_array.sids[i].sid);
+
d_printf("%s\n", name);
-
- result = enum_privileges_for_user(pipe_hnd, ctx, pol, &sids[i] );
-
+
+ result = enum_privileges_for_user(pipe_hnd, ctx, pol,
+ sid_array.sids[i].sid);
if ( !NT_STATUS_IS_OK(result) )
return result;
--
Samba Shared Repository
More information about the samba-cvs
mailing list