1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Remove unused marshalling for SAMR_LOOKUP_NAMES.

Guenther
This commit is contained in:
Günther Deschner 2008-02-08 14:52:10 +01:00
parent 38b6351534
commit 593768c3e9
3 changed files with 0 additions and 330 deletions

View File

@ -688,45 +688,6 @@ typedef struct r_samr_query_user_info
} SAMR_R_QUERY_USERINFO;
/****************************************************************************
SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types.
*****************************************************************************/
/* SAMR_Q_LOOKUP_NAMES */
typedef struct q_samr_lookup_names_info
{
POLICY_HND pol; /* policy handle */
uint32 num_names1; /* number of names being looked up */
uint32 flags; /* 0x0000 03e8 - unknown */
uint32 ptr; /* 0x0000 0000 - 32 bit unknown */
uint32 num_names2; /* number of names being looked up */
UNIHDR *hdr_name; /* unicode account name header */
UNISTR2 *uni_name; /* unicode account name string */
} SAMR_Q_LOOKUP_NAMES;
/* SAMR_R_LOOKUP_NAMES */
typedef struct r_samr_lookup_names_info
{
uint32 num_rids1; /* number of aliases being looked up */
uint32 ptr_rids; /* pointer to aliases */
uint32 num_rids2; /* number of aliases being looked up */
uint32 *rids; /* rids */
uint32 num_types1; /* number of users in aliases being looked up */
uint32 ptr_types; /* pointer to users in aliases */
uint32 num_types2; /* number of users in aliases being looked up */
uint32 *types; /* SID_ENUM type */
NTSTATUS status; /* return code */
} SAMR_R_LOOKUP_NAMES;
/****************************************************************************
SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something.

View File

@ -586,68 +586,6 @@ NTSTATUS rpccli_samr_lookup_rids(struct rpc_pipe_client *cli,
return result;
}
/* Lookup names */
NTSTATUS rpccli_samr_lookup_names(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *domain_pol, uint32 flags,
uint32 num_names, const char **names,
uint32 *num_rids, uint32 **rids,
uint32 **rid_types)
{
prs_struct qbuf, rbuf;
SAMR_Q_LOOKUP_NAMES q;
SAMR_R_LOOKUP_NAMES r;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
uint32 i;
DEBUG(10,("cli_samr_lookup_names\n"));
ZERO_STRUCT(q);
ZERO_STRUCT(r);
/* Marshall data and send request */
init_samr_q_lookup_names(mem_ctx, &q, domain_pol, flags,
num_names, names);
CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_LOOKUP_NAMES,
q, r,
qbuf, rbuf,
samr_io_q_lookup_names,
samr_io_r_lookup_names,
NT_STATUS_UNSUCCESSFUL);
/* Return output parameters */
if (!NT_STATUS_IS_OK(result = r.status)) {
goto done;
}
if (r.num_rids1 == 0) {
*num_rids = 0;
goto done;
}
*num_rids = r.num_rids1;
*rids = TALLOC_ARRAY(mem_ctx, uint32, r.num_rids1);
*rid_types = TALLOC_ARRAY(mem_ctx, uint32, r.num_rids1);
if ((*rids == NULL) || (*rid_types == NULL)) {
TALLOC_FREE(*rids);
TALLOC_FREE(*rid_types);
return NT_STATUS_NO_MEMORY;
}
for (i = 0; i < r.num_rids1; i++) {
(*rids)[i] = r.rids[i];
(*rid_types)[i] = r.types[i];
}
done:
return result;
}
/* Set userinfo */
NTSTATUS rpccli_samr_set_userinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,

View File

@ -1256,235 +1256,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u,
return True;
}
/*******************************************************************
inits a SAMR_Q_LOOKUP_NAMES structure.
********************************************************************/
NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u,
POLICY_HND *pol, uint32 flags,
uint32 num_names, const char **name)
{
uint32 i;
DEBUG(5, ("init_samr_q_lookup_names\n"));
q_u->pol = *pol;
q_u->num_names1 = num_names;
q_u->flags = flags;
q_u->ptr = 0;
q_u->num_names2 = num_names;
if (num_names) {
if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names)))
return NT_STATUS_NO_MEMORY;
if (!(q_u->uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_names)))
return NT_STATUS_NO_MEMORY;
} else {
q_u->hdr_name = NULL;
q_u->uni_name = NULL;
}
for (i = 0; i < num_names; i++) {
init_unistr2(&q_u->uni_name[i], name[i], UNI_FLAGS_NONE); /* unicode string for machine account */
init_uni_hdr(&q_u->hdr_name[i], &q_u->uni_name[i]); /* unicode header for user_name */
}
return NT_STATUS_OK;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
bool samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u,
prs_struct *ps, int depth)
{
uint32 i;
if (q_u == NULL)
return False;
prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
depth++;
if (UNMARSHALLING(ps))
ZERO_STRUCTP(q_u);
if(!prs_align(ps))
return False;
if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
return False;
if(!prs_uint32("num_names1", ps, depth, &q_u->num_names1))
return False;
if(!prs_uint32("flags ", ps, depth, &q_u->flags))
return False;
if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
return False;
if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2))
return False;
if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) {
q_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_u->num_names2);
q_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_u->num_names2);
if (!q_u->hdr_name || !q_u->uni_name)
return False;
}
for (i = 0; i < q_u->num_names2; i++) {
if(!smb_io_unihdr("", &q_u->hdr_name[i], ps, depth))
return False;
}
for (i = 0; i < q_u->num_names2; i++) {
if(!smb_io_unistr2("", &q_u->uni_name[i], q_u->hdr_name[i].buffer, ps, depth))
return False;
}
return True;
}
/*******************************************************************
inits a SAMR_R_LOOKUP_NAMES structure.
********************************************************************/
NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u,
uint32 num_rids,
uint32 *rid, enum lsa_SidType *type,
NTSTATUS status)
{
DEBUG(5, ("init_samr_r_lookup_names\n"));
if (NT_STATUS_IS_OK(status) && (num_rids != 0)) {
uint32 i;
r_u->num_types1 = num_rids;
r_u->ptr_types = 1;
r_u->num_types2 = num_rids;
r_u->num_rids1 = num_rids;
r_u->ptr_rids = 1;
r_u->num_rids2 = num_rids;
if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
return NT_STATUS_NO_MEMORY;
if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
return NT_STATUS_NO_MEMORY;
for (i = 0; i < num_rids; i++) {
r_u->rids[i] = rid[i];
r_u->types[i] = type[i];
}
} else {
r_u->num_types1 = 0;
r_u->ptr_types = 0;
r_u->num_types2 = 0;
r_u->num_rids1 = 0;
r_u->ptr_rids = 0;
r_u->num_rids2 = 0;
r_u->rids = NULL;
r_u->types = NULL;
}
r_u->status = status;
return NT_STATUS_OK;
}
/*******************************************************************
reads or writes a structure.
********************************************************************/
bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u,
prs_struct *ps, int depth)
{
uint32 i;
fstring tmp;
if (r_u == NULL)
return False;
prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
depth++;
if (UNMARSHALLING(ps))
ZERO_STRUCTP(r_u);
if(!prs_align(ps))
return False;
if(!prs_uint32("num_rids1", ps, depth, &r_u->num_rids1))
return False;
if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
return False;
if (r_u->ptr_rids != 0) {
if(!prs_uint32("num_rids2", ps, depth, &r_u->num_rids2))
return False;
if (r_u->num_rids2 != r_u->num_rids1) {
/* RPC fault */
return False;
}
if (UNMARSHALLING(ps) && r_u->num_rids2) {
r_u->rids = PRS_ALLOC_MEM(ps, uint32, r_u->num_rids2);
if (!r_u->rids) {
DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
return False;
}
}
for (i = 0; i < r_u->num_rids2; i++) {
slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
if(!prs_uint32(tmp, ps, depth, &r_u->rids[i]))
return False;
}
}
if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
return False;
if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
return False;
if (r_u->ptr_types != 0) {
if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
return False;
if (r_u->num_types2 != r_u->num_types1) {
/* RPC fault */
return False;
}
if (UNMARSHALLING(ps) && r_u->num_types2) {
r_u->types = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
if (!r_u->types) {
DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
return False;
}
}
for (i = 0; i < r_u->num_types2; i++) {
slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
if(!prs_uint32(tmp, ps, depth, &r_u->types[i]))
return False;
}
}
if(!prs_ntstatus("status", ps, depth, &r_u->status))
return False;
return True;
}
/*******************************************************************
inits a SAMR_Q_QUERY_USERINFO structure.
********************************************************************/