mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
Remove unused marshalling for SAMR_ENUM_DOM_USERS.
Guenther
(This used to be commit 4521f31a72
)
This commit is contained in:
parent
b88982a5c8
commit
c3f68ad29f
@ -457,40 +457,6 @@ typedef struct samr_entry_info
|
||||
|
||||
} SAM_ENTRY;
|
||||
|
||||
/* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
|
||||
typedef struct q_samr_enum_dom_users_info
|
||||
{
|
||||
POLICY_HND pol; /* policy handle */
|
||||
|
||||
uint32 start_idx; /* number of values (0 indicates unlimited?) */
|
||||
uint32 acb_mask; /* 0x0000 indicates all */
|
||||
|
||||
uint32 max_size; /* 0x0000 ffff */
|
||||
|
||||
} SAMR_Q_ENUM_DOM_USERS;
|
||||
|
||||
|
||||
/* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
|
||||
typedef struct r_samr_enum_dom_users_info
|
||||
{
|
||||
uint32 next_idx; /* next starting index required for enum */
|
||||
uint32 ptr_entries1;
|
||||
|
||||
uint32 num_entries2;
|
||||
uint32 ptr_entries2;
|
||||
|
||||
uint32 num_entries3;
|
||||
|
||||
SAM_ENTRY *sam;
|
||||
UNISTR2 *uni_acct_name;
|
||||
|
||||
uint32 num_entries4;
|
||||
|
||||
NTSTATUS status;
|
||||
|
||||
} SAMR_R_ENUM_DOM_USERS;
|
||||
|
||||
|
||||
/* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */
|
||||
typedef struct q_samr_enum_dom_groups_info
|
||||
{
|
||||
|
@ -64,92 +64,6 @@ NTSTATUS rpccli_samr_query_userinfo(struct rpc_pipe_client *cli,
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate domain users
|
||||
*
|
||||
* @param cli client state structure
|
||||
* @param mem_ctx talloc context
|
||||
* @param pol opened domain policy handle
|
||||
* @param start_idx starting index of enumeration, returns context for
|
||||
next enumeration
|
||||
* @param acb_mask account control bit mask (to enumerate some particular
|
||||
* kind of accounts)
|
||||
* @param size max acceptable size of response
|
||||
* @param dom_users returned array of domain user names
|
||||
* @param rids returned array of domain user RIDs
|
||||
* @param num_dom_users numer returned entries
|
||||
*
|
||||
* @return NTSTATUS returned in rpc response
|
||||
**/
|
||||
|
||||
NTSTATUS rpccli_samr_enum_dom_users(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
POLICY_HND *pol, uint32 *start_idx, uint32 acb_mask,
|
||||
uint32 size, char ***dom_users, uint32 **rids,
|
||||
uint32 *num_dom_users)
|
||||
{
|
||||
prs_struct qbuf;
|
||||
prs_struct rbuf;
|
||||
SAMR_Q_ENUM_DOM_USERS q;
|
||||
SAMR_R_ENUM_DOM_USERS r;
|
||||
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
||||
int i;
|
||||
|
||||
DEBUG(10,("cli_samr_enum_dom_users starting at index %u\n", (unsigned int)*start_idx));
|
||||
|
||||
ZERO_STRUCT(q);
|
||||
ZERO_STRUCT(r);
|
||||
|
||||
/* always init this */
|
||||
*num_dom_users = 0;
|
||||
|
||||
/* Fill query structure with parameters */
|
||||
|
||||
init_samr_q_enum_dom_users(&q, pol, *start_idx, acb_mask, size);
|
||||
|
||||
CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_ENUM_DOM_USERS,
|
||||
q, r,
|
||||
qbuf, rbuf,
|
||||
samr_io_q_enum_dom_users,
|
||||
samr_io_r_enum_dom_users,
|
||||
NT_STATUS_UNSUCCESSFUL);
|
||||
|
||||
result = r.status;
|
||||
|
||||
if (!NT_STATUS_IS_OK(result) &&
|
||||
NT_STATUS_V(result) != NT_STATUS_V(STATUS_MORE_ENTRIES))
|
||||
goto done;
|
||||
|
||||
*start_idx = r.next_idx;
|
||||
*num_dom_users = r.num_entries2;
|
||||
|
||||
if (r.num_entries2) {
|
||||
/* allocate memory needed to return received data */
|
||||
*rids = TALLOC_ARRAY(mem_ctx, uint32, r.num_entries2);
|
||||
if (!*rids) {
|
||||
DEBUG(0, ("Error in cli_samr_enum_dom_users(): out of memory\n"));
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
*dom_users = TALLOC_ARRAY(mem_ctx, char*, r.num_entries2);
|
||||
if (!*dom_users) {
|
||||
DEBUG(0, ("Error in cli_samr_enum_dom_users(): out of memory\n"));
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* fill output buffers with rpc response */
|
||||
for (i = 0; i < r.num_entries2; i++) {
|
||||
fstring conv_buf;
|
||||
|
||||
(*rids)[i] = r.sam[i].rid;
|
||||
unistr2_to_ascii(conv_buf, &(r.uni_acct_name[i]), sizeof(conv_buf));
|
||||
(*dom_users)[i] = talloc_strdup(mem_ctx, conv_buf);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Enumerate domain groups */
|
||||
|
||||
NTSTATUS rpccli_samr_enum_dom_groups(struct rpc_pipe_client *cli,
|
||||
|
@ -215,145 +215,6 @@ static bool sam_io_sam_entry(const char *desc, SAM_ENTRY * sam,
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
inits a SAMR_Q_ENUM_DOM_USERS structure.
|
||||
********************************************************************/
|
||||
|
||||
void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol,
|
||||
uint32 start_idx,
|
||||
uint32 acb_mask, uint32 size)
|
||||
{
|
||||
DEBUG(5, ("init_samr_q_enum_dom_users\n"));
|
||||
|
||||
q_e->pol = *pol;
|
||||
|
||||
q_e->start_idx = start_idx; /* zero indicates lots */
|
||||
q_e->acb_mask = acb_mask;
|
||||
q_e->max_size = size;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
|
||||
bool samr_io_q_enum_dom_users(const char *desc, SAMR_Q_ENUM_DOM_USERS * q_e,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_e == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!smb_io_pol_hnd("domain_pol", &q_e->pol, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
|
||||
return False;
|
||||
if(!prs_uint32("acb_mask ", ps, depth, &q_e->acb_mask))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
inits a SAMR_R_ENUM_DOM_USERS structure.
|
||||
********************************************************************/
|
||||
|
||||
void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u,
|
||||
uint32 next_idx, uint32 num_sam_entries)
|
||||
{
|
||||
DEBUG(5, ("init_samr_r_enum_dom_users\n"));
|
||||
|
||||
r_u->next_idx = next_idx;
|
||||
|
||||
if (num_sam_entries != 0) {
|
||||
r_u->ptr_entries1 = 1;
|
||||
r_u->ptr_entries2 = 1;
|
||||
r_u->num_entries2 = num_sam_entries;
|
||||
r_u->num_entries3 = num_sam_entries;
|
||||
|
||||
r_u->num_entries4 = num_sam_entries;
|
||||
} else {
|
||||
r_u->ptr_entries1 = 0;
|
||||
r_u->num_entries2 = num_sam_entries;
|
||||
r_u->ptr_entries2 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
|
||||
bool samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
uint32 i;
|
||||
|
||||
if (r_u == NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
|
||||
return False;
|
||||
if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
|
||||
return False;
|
||||
|
||||
if (r_u->ptr_entries1 != 0) {
|
||||
if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
|
||||
return False;
|
||||
if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
|
||||
return False;
|
||||
if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
|
||||
return False;
|
||||
|
||||
if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0)) {
|
||||
r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY, r_u->num_entries2);
|
||||
r_u->uni_acct_name = PRS_ALLOC_MEM(ps,UNISTR2, r_u->num_entries2);
|
||||
}
|
||||
|
||||
if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) {
|
||||
DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
|
||||
r_u->num_entries4 = 0;
|
||||
r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
|
||||
return False;
|
||||
}
|
||||
|
||||
for (i = 0; i < r_u->num_entries2; i++) {
|
||||
if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
|
||||
return False;
|
||||
}
|
||||
|
||||
for (i = 0; i < r_u->num_entries2; i++) {
|
||||
if(!smb_io_unistr2("", &r_u->uni_acct_name[i],r_u->sam[i].hdr_name.buffer, ps,depth))
|
||||
return False;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
|
||||
return False;
|
||||
if(!prs_ntstatus("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
inits a samr_DispInfoGeneral structure.
|
||||
********************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user