mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
query_aliasmem code. it works (hurrah).
This commit is contained in:
parent
bfb75e58ce
commit
f7f2516df4
@ -2086,7 +2086,7 @@ void samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES *q_u, prs
|
||||
void make_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES *r_u,
|
||||
uint32 num_rids, uint32 *rid, uint32 status);
|
||||
void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs_struct *ps, int depth);
|
||||
void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u,
|
||||
void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol,
|
||||
uint32 unknown_0, uint32 rid);
|
||||
void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, int depth);
|
||||
void samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS *r_u, prs_struct *ps, int depth);
|
||||
@ -2116,7 +2116,7 @@ void samr_io_r_add_aliasmem(char *desc, SAMR_R_ADD_ALIASMEM *r_u, prs_struct *p
|
||||
void make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_c, POLICY_HND *hnd);
|
||||
void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struct *ps, int depth);
|
||||
void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u,
|
||||
uint32 num_sids, DOM_SID *sid, uint32 status);
|
||||
uint32 num_sids, DOM_SID2 *sid, uint32 status);
|
||||
void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struct *ps, int depth);
|
||||
void samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES *q_u, prs_struct *ps, int depth);
|
||||
void make_samr_r_lookup_names(SAMR_R_LOOKUP_NAMES *r_u,
|
||||
|
@ -1160,7 +1160,7 @@ typedef struct r_samr_query_aliasmem_info
|
||||
uint32 ptr;
|
||||
uint32 num_sids1;
|
||||
|
||||
DOM_SID *sid;
|
||||
DOM_SID2 *sid;
|
||||
|
||||
uint32 status;
|
||||
|
||||
@ -1207,6 +1207,8 @@ typedef struct r_samr_add_alias_mem_info
|
||||
/* SAMR_Q_OPEN_ALIAS - probably an open */
|
||||
typedef struct q_samr_open_alias_info
|
||||
{
|
||||
POLICY_HND dom_pol;
|
||||
|
||||
uint32 unknown_0; /* 0x0000 0008 */
|
||||
uint32 rid_alias; /* rid */
|
||||
|
||||
|
@ -26,8 +26,6 @@
|
||||
|
||||
extern int DEBUGLEVEL;
|
||||
|
||||
static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth);
|
||||
|
||||
/*******************************************************************
|
||||
creates a LSA_TRANS_NAME structure.
|
||||
********************************************************************/
|
||||
@ -562,6 +560,48 @@ static void lsa_io_sid_enum(char *desc, LSA_SID_ENUM *sen,
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (trn == NULL) return;
|
||||
|
||||
prs_debug(ps, depth, desc, "lsa_io_trans_names");
|
||||
depth++;
|
||||
|
||||
prs_align(ps);
|
||||
|
||||
prs_uint32("num_entries ", ps, depth, &(trn->num_entries));
|
||||
prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names));
|
||||
|
||||
if (trn->ptr_trans_names != 0)
|
||||
{
|
||||
prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2));
|
||||
SMB_ASSERT_ARRAY(trn->name, trn->num_entries);
|
||||
|
||||
for (i = 0; i < trn->num_entries2; i++)
|
||||
{
|
||||
fstring t;
|
||||
slprintf(t, sizeof(t) - 1, "name[%d] ", i);
|
||||
|
||||
lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */
|
||||
|
||||
}
|
||||
for (i = 0; i < trn->num_entries2; i++)
|
||||
{
|
||||
fstring t;
|
||||
slprintf(t, sizeof(t) - 1, "name[%d] ", i);
|
||||
|
||||
smb_io_unistr2(t, &(trn->uni_name[i]), trn->name[i].hdr_name.buffer, ps, depth);
|
||||
prs_align(ps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
makes a structure.
|
||||
********************************************************************/
|
||||
@ -576,9 +616,8 @@ void make_q_lookup_sids(LSA_Q_LOOKUP_SIDS *q_l, POLICY_HND *hnd,
|
||||
memcpy(&(q_l->pol), hnd, sizeof(q_l->pol));
|
||||
make_lsa_sid_enum(&(q_l->sids), num_sids, sids);
|
||||
|
||||
q_l->names.num_entries = 0;
|
||||
q_l->names.ptr_trans_names = 0;
|
||||
q_l->names.num_entries2 = 0;
|
||||
q_l->names.num_entries = 0;
|
||||
|
||||
q_l->level.value = level;
|
||||
}
|
||||
@ -603,48 +642,6 @@ void lsa_io_q_lookup_sids(char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, in
|
||||
prs_uint32("mapped_count", ps, depth, &(q_s->mapped_count));
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
static void lsa_io_trans_names(char *desc, LSA_TRANS_NAME_ENUM *trn,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
int i;
|
||||
int i2;
|
||||
|
||||
if (trn == NULL) return;
|
||||
|
||||
prs_debug(ps, depth, desc, "lsa_io_trans_names");
|
||||
depth++;
|
||||
|
||||
prs_align(ps);
|
||||
|
||||
prs_uint32("num_entries ", ps, depth, &(trn->num_entries));
|
||||
prs_uint32("ptr_trans_names", ps, depth, &(trn->ptr_trans_names));
|
||||
|
||||
if (trn->ptr_trans_names != 0)
|
||||
{
|
||||
prs_uint32("num_entries2 ", ps, depth, &(trn->num_entries2));
|
||||
|
||||
SMB_ASSERT_ARRAY(trn->name, trn->num_entries);
|
||||
|
||||
for (i = 0, i2 = 0; i < trn->num_entries2; i++)
|
||||
{
|
||||
fstring t;
|
||||
slprintf(t, sizeof(t) - 1, "name[%d] ", i);
|
||||
|
||||
lsa_io_trans_name(t, &(trn->name[i]), ps, depth); /* translated name */
|
||||
|
||||
if (trn->name[i].hdr_name.buffer != 0)
|
||||
{
|
||||
smb_io_unistr2(t, &(trn->uni_name[i2]), 1, ps, depth);
|
||||
prs_align(ps);
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
reads or writes a structure.
|
||||
********************************************************************/
|
||||
|
@ -2081,13 +2081,15 @@ void samr_io_r_query_useraliases(char *desc, SAMR_R_QUERY_USERALIASES *r_u, prs
|
||||
/*******************************************************************
|
||||
makes a SAMR_Q_OPEN_ALIAS structure.
|
||||
********************************************************************/
|
||||
void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u,
|
||||
void make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS *q_u, POLICY_HND *pol,
|
||||
uint32 unknown_0, uint32 rid)
|
||||
{
|
||||
if (q_u == NULL) return;
|
||||
|
||||
DEBUG(5,("make_samr_q_open_alias\n"));
|
||||
|
||||
memcpy(&(q_u->dom_pol), pol, sizeof(q_u->dom_pol));
|
||||
|
||||
/* example values: 0x0000 0008 */
|
||||
q_u->unknown_0 = unknown_0;
|
||||
|
||||
@ -2106,6 +2108,8 @@ void samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS *q_u, prs_struct *ps, i
|
||||
|
||||
prs_align(ps);
|
||||
|
||||
smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth);
|
||||
|
||||
prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0));
|
||||
prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias));
|
||||
}
|
||||
@ -2523,7 +2527,7 @@ void samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM *q_u, prs_struc
|
||||
makes a SAMR_R_QUERY_ALIASMEM structure.
|
||||
********************************************************************/
|
||||
void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u,
|
||||
uint32 num_sids, DOM_SID *sid, uint32 status)
|
||||
uint32 num_sids, DOM_SID2 *sid, uint32 status)
|
||||
{
|
||||
if (r_u == NULL) return;
|
||||
|
||||
@ -2531,9 +2535,9 @@ void make_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM *r_u,
|
||||
|
||||
if (status == 0x0)
|
||||
{
|
||||
r_u->num_sids = num_sids;
|
||||
r_u->ptr = (num_sids != 0) ? 1 : 0;
|
||||
r_u->num_sids = num_sids;
|
||||
r_u->num_sids = num_sids;
|
||||
r_u->ptr = (num_sids != 0) ? 1 : 0;
|
||||
r_u->num_sids1 = num_sids;
|
||||
|
||||
r_u->sid = sid;
|
||||
}
|
||||
@ -2561,12 +2565,11 @@ void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struc
|
||||
|
||||
prs_align(ps);
|
||||
|
||||
prs_uint32("num_sids ", ps, depth, &(r_u->num_sids));
|
||||
prs_uint32("ptr", ps, depth, &(r_u->ptr));
|
||||
|
||||
if (r_u->ptr != 0)
|
||||
{
|
||||
prs_uint32("num_sids ", ps, depth, &(r_u->num_sids));
|
||||
|
||||
SMB_ASSERT_ARRAY(ptr_sid, r_u->num_sids);
|
||||
|
||||
if (r_u->num_sids != 0)
|
||||
@ -2584,7 +2587,7 @@ void samr_io_r_query_aliasmem(char *desc, SAMR_R_QUERY_ALIASMEM *r_u, prs_struc
|
||||
prs_grow(ps);
|
||||
if (ptr_sid[i] != 0)
|
||||
{
|
||||
smb_io_dom_sid("", &(r_u->sid[i]), ps, depth);
|
||||
smb_io_dom_sid2("", &(r_u->sid[i]), ps, depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -862,7 +862,7 @@ static void samr_reply_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_u,
|
||||
uint32 status = 0;
|
||||
|
||||
LOCAL_GRP_MEMBER *mem_grp = NULL;
|
||||
DOM_SID *sid = NULL;
|
||||
DOM_SID2 *sid = NULL;
|
||||
int num_sids = 0;
|
||||
DOM_SID alias_sid;
|
||||
uint32 alias_rid;
|
||||
@ -892,7 +892,7 @@ static void samr_reply_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_u,
|
||||
DEBUG(10,("lookup on S-1-5-20\n"));
|
||||
|
||||
become_root(True);
|
||||
status = getbuiltinrid(alias_rid, &mem_grp, &num_sids) ? 0xC0000000 | NT_STATUS_NO_SUCH_GROUP : 0x0;
|
||||
status = getbuiltinrid(alias_rid, &mem_grp, &num_sids) != NULL ? 0x0 : 0xC0000000 | NT_STATUS_NO_SUCH_GROUP;
|
||||
unbecome_root(True);
|
||||
}
|
||||
else if (sid_equal(&alias_sid, &global_sam_sid))
|
||||
@ -900,7 +900,7 @@ static void samr_reply_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_u,
|
||||
DEBUG(10,("lookup on Domain SID\n"));
|
||||
|
||||
become_root(True);
|
||||
status = getaliasrid(alias_rid, &mem_grp, &num_sids) ? 0xC0000000 | NT_STATUS_NO_SUCH_GROUP : 0x0;
|
||||
status = getaliasrid(alias_rid, &mem_grp, &num_sids) != NULL ? 0x0 : 0xC0000000 | NT_STATUS_NO_SUCH_GROUP;
|
||||
unbecome_root(True);
|
||||
}
|
||||
else
|
||||
@ -917,7 +917,7 @@ static void samr_reply_query_aliasmem(SAMR_Q_QUERY_ALIASMEM *q_u,
|
||||
int i;
|
||||
for (i = 0; i < num_sids; i++)
|
||||
{
|
||||
sid[i] = mem_grp[i].sid;
|
||||
make_dom_sid2(&sid[i], &mem_grp[i].sid);
|
||||
}
|
||||
free(mem_grp);
|
||||
}
|
||||
@ -1773,6 +1773,11 @@ static void samr_reply_open_alias(SAMR_Q_OPEN_ALIAS *q_u,
|
||||
/* set up the SAMR open_alias response */
|
||||
|
||||
r_u.status = 0x0;
|
||||
if (r_u.status == 0x0 && !get_lsa_policy_samr_sid(&q_u->dom_pol, &sid))
|
||||
{
|
||||
r_u.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
/* get a (unique) handle. open a policy on it. */
|
||||
if (r_u.status == 0x0 && !(pol_open = open_lsa_policy_hnd(&(r_u.pol))))
|
||||
{
|
||||
@ -1786,7 +1791,6 @@ static void samr_reply_open_alias(SAMR_Q_OPEN_ALIAS *q_u,
|
||||
r_u.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
sid_copy(&sid, &global_sid_S_1_5_20);
|
||||
sid_append_rid(&sid, q_u->rid_alias);
|
||||
|
||||
/* associate an alias SID with the (unique) handle. */
|
||||
|
Loading…
Reference in New Issue
Block a user