mirror of
https://github.com/samba-team/samba.git
synced 2025-10-23 11:33:16 +03:00
Use pidl for _samr_LookupRids().
Guenther
(This used to be commit fe3a02d44c
)
This commit is contained in:
@@ -258,29 +258,7 @@ static bool api_samr_chgpasswd_user(pipes_struct *p)
|
|||||||
|
|
||||||
static bool api_samr_lookup_rids(pipes_struct *p)
|
static bool api_samr_lookup_rids(pipes_struct *p)
|
||||||
{
|
{
|
||||||
SAMR_Q_LOOKUP_RIDS q_u;
|
return proxy_samr_call(p, NDR_SAMR_LOOKUPRIDS);
|
||||||
SAMR_R_LOOKUP_RIDS r_u;
|
|
||||||
prs_struct *data = &p->in_data.data;
|
|
||||||
prs_struct *rdata = &p->out_data.rdata;
|
|
||||||
|
|
||||||
ZERO_STRUCT(q_u);
|
|
||||||
ZERO_STRUCT(r_u);
|
|
||||||
|
|
||||||
/* grab the samr lookup names */
|
|
||||||
if(!samr_io_q_lookup_rids("", &q_u, data, 0)) {
|
|
||||||
DEBUG(0,("api_samr_lookup_rids: unable to unmarshall SAMR_Q_LOOKUP_RIDS.\n"));
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
r_u.status = _samr_lookup_rids(p, &q_u, &r_u);
|
|
||||||
|
|
||||||
/* store the response in the SMB stream */
|
|
||||||
if(!samr_io_r_lookup_rids("", &r_u, rdata, 0)) {
|
|
||||||
DEBUG(0,("api_samr_lookup_rids: unable to marshall SAMR_R_LOOKUP_RIDS.\n"));
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
return True;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
|
@@ -103,6 +103,15 @@ static const struct generic_mapping ali_generic_mapping = {
|
|||||||
GENERIC_RIGHTS_ALIAS_EXECUTE,
|
GENERIC_RIGHTS_ALIAS_EXECUTE,
|
||||||
GENERIC_RIGHTS_ALIAS_ALL_ACCESS};
|
GENERIC_RIGHTS_ALIAS_ALL_ACCESS};
|
||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
inits a structure.
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
static void init_lsa_String(struct lsa_String *name, const char *s)
|
||||||
|
{
|
||||||
|
name->string = s;
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
|
|
||||||
@@ -1684,60 +1693,54 @@ makes a SAMR_R_LOOKUP_RIDS structure.
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
static bool make_samr_lookup_rids(TALLOC_CTX *ctx, uint32 num_names,
|
static bool make_samr_lookup_rids(TALLOC_CTX *ctx, uint32 num_names,
|
||||||
const char **names, UNIHDR **pp_hdr_name,
|
const char **names,
|
||||||
UNISTR2 **pp_uni_name)
|
struct lsa_String **lsa_name_array_p)
|
||||||
{
|
{
|
||||||
uint32 i;
|
struct lsa_String *lsa_name_array = NULL;
|
||||||
UNIHDR *hdr_name=NULL;
|
uint32_t i;
|
||||||
UNISTR2 *uni_name=NULL;
|
|
||||||
|
|
||||||
*pp_uni_name = NULL;
|
*lsa_name_array_p = NULL;
|
||||||
*pp_hdr_name = NULL;
|
|
||||||
|
|
||||||
if (num_names != 0) {
|
if (num_names != 0) {
|
||||||
hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names);
|
lsa_name_array = TALLOC_ZERO_ARRAY(ctx, struct lsa_String, num_names);
|
||||||
if (hdr_name == NULL)
|
if (!lsa_name_array) {
|
||||||
return False;
|
return false;
|
||||||
|
}
|
||||||
uni_name = TALLOC_ZERO_ARRAY(ctx,UNISTR2, num_names);
|
|
||||||
if (uni_name == NULL)
|
|
||||||
return False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < num_names; i++) {
|
for (i = 0; i < num_names; i++) {
|
||||||
DEBUG(10, ("names[%d]:%s\n", i, names[i] && *names[i] ? names[i] : ""));
|
DEBUG(10, ("names[%d]:%s\n", i, names[i] && *names[i] ? names[i] : ""));
|
||||||
init_unistr2(&uni_name[i], names[i], UNI_FLAGS_NONE);
|
init_lsa_String(&lsa_name_array[i], names[i]);
|
||||||
init_uni_hdr(&hdr_name[i], &uni_name[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*pp_uni_name = uni_name;
|
*lsa_name_array_p = lsa_name_array;
|
||||||
*pp_hdr_name = hdr_name;
|
|
||||||
|
|
||||||
return True;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
_samr_lookup_rids
|
_samr_LookupRids
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOKUP_RIDS *r_u)
|
NTSTATUS _samr_LookupRids(pipes_struct *p,
|
||||||
|
struct samr_LookupRids *r)
|
||||||
{
|
{
|
||||||
|
NTSTATUS status;
|
||||||
const char **names;
|
const char **names;
|
||||||
enum lsa_SidType *attrs = NULL;
|
enum lsa_SidType *attrs = NULL;
|
||||||
uint32 *wire_attrs = NULL;
|
uint32 *wire_attrs = NULL;
|
||||||
UNIHDR *hdr_name = NULL;
|
|
||||||
UNISTR2 *uni_name = NULL;
|
|
||||||
DOM_SID pol_sid;
|
DOM_SID pol_sid;
|
||||||
int num_rids = (int)q_u->num_rids1;
|
int num_rids = (int)r->in.num_rids;
|
||||||
uint32 acc_granted;
|
uint32 acc_granted;
|
||||||
int i;
|
int i;
|
||||||
|
struct lsa_Strings names_array;
|
||||||
|
struct samr_Ids types_array;
|
||||||
|
struct lsa_String *lsa_names = NULL;
|
||||||
|
|
||||||
r_u->status = NT_STATUS_OK;
|
DEBUG(5,("_samr_LookupRids: %d\n", __LINE__));
|
||||||
|
|
||||||
DEBUG(5,("_samr_lookup_rids: %d\n", __LINE__));
|
|
||||||
|
|
||||||
/* find the policy handle. open a policy on it. */
|
/* find the policy handle. open a policy on it. */
|
||||||
if (!get_lsa_policy_samr_sid(p, &q_u->pol, &pol_sid, &acc_granted, NULL))
|
if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &pol_sid, &acc_granted, NULL))
|
||||||
return NT_STATUS_INVALID_HANDLE;
|
return NT_STATUS_INVALID_HANDLE;
|
||||||
|
|
||||||
if (num_rids > 1000) {
|
if (num_rids > 1000) {
|
||||||
@@ -1760,28 +1763,36 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK
|
|||||||
}
|
}
|
||||||
|
|
||||||
become_root(); /* lookup_sid can require root privs */
|
become_root(); /* lookup_sid can require root privs */
|
||||||
r_u->status = pdb_lookup_rids(&pol_sid, num_rids, q_u->rid,
|
status = pdb_lookup_rids(&pol_sid, num_rids, r->in.rids,
|
||||||
names, attrs);
|
names, attrs);
|
||||||
unbecome_root();
|
unbecome_root();
|
||||||
|
|
||||||
if ( NT_STATUS_EQUAL(r_u->status, NT_STATUS_NONE_MAPPED) && (num_rids == 0) ) {
|
if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED) && (num_rids == 0)) {
|
||||||
r_u->status = NT_STATUS_OK;
|
status = NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!make_samr_lookup_rids(p->mem_ctx, num_rids, names,
|
if (!make_samr_lookup_rids(p->mem_ctx, num_rids, names,
|
||||||
&hdr_name, &uni_name))
|
&lsa_names)) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert from enum lsa_SidType to uint32 for wire format. */
|
/* Convert from enum lsa_SidType to uint32 for wire format. */
|
||||||
for (i = 0; i < num_rids; i++) {
|
for (i = 0; i < num_rids; i++) {
|
||||||
wire_attrs[i] = (uint32)attrs[i];
|
wire_attrs[i] = (uint32)attrs[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
init_samr_r_lookup_rids(r_u, num_rids, hdr_name, uni_name, wire_attrs);
|
names_array.count = num_rids;
|
||||||
|
names_array.names = lsa_names;
|
||||||
|
|
||||||
DEBUG(5,("_samr_lookup_rids: %d\n", __LINE__));
|
types_array.count = num_rids;
|
||||||
|
types_array.ids = wire_attrs;
|
||||||
|
|
||||||
return r_u->status;
|
*r->out.names = names_array;
|
||||||
|
*r->out.types = types_array;
|
||||||
|
|
||||||
|
DEBUG(5,("_samr_LookupRids: %d\n", __LINE__));
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
@@ -5224,16 +5235,6 @@ NTSTATUS _samr_LookupNames(pipes_struct *p,
|
|||||||
/****************************************************************
|
/****************************************************************
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
NTSTATUS _samr_LookupRids(pipes_struct *p,
|
|
||||||
struct samr_LookupRids *r)
|
|
||||||
{
|
|
||||||
p->rng_fault_state = true;
|
|
||||||
return NT_STATUS_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p,
|
NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p,
|
||||||
struct samr_SetMemberAttributesOfGroup *r)
|
struct samr_SetMemberAttributesOfGroup *r)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user