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

added sid_name_use array argument to lsa_lookup_names and lsa_lookup_sids.

This commit is contained in:
Luke Leighton 0001-01-01 00:00:00 +00:00
parent 2cce78aa00
commit 0b2095e092
8 changed files with 84 additions and 12 deletions

View File

@ -1549,12 +1549,14 @@ BOOL lsa_lookup_names(struct cli_state *cli, uint16 fnum,
int num_names,
const char **names,
DOM_SID **sids,
uint8 **types,
int *num_sids);
BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum,
POLICY_HND *hnd,
int num_sids,
DOM_SID **sids,
char ***names,
uint8 **types,
int *num_names);
BOOL lsa_query_info_pol(struct cli_state *cli, uint16 fnum,
POLICY_HND *hnd, uint16 info_class,
@ -2518,7 +2520,7 @@ void make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u,
char* bin_path_name, char* load_order_grp,
uint32 tag_id,
char* dependencies, char* service_start_name,
char* display_name);
char* disp_name);
void svc_io_query_svc_cfg(char *desc, QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth);
void make_svc_q_enum_svcs_status(SVC_Q_ENUM_SVCS_STATUS *q_c, POLICY_HND *hnd,
uint32 service_type, uint32 service_state,
@ -2530,6 +2532,12 @@ void make_svc_r_enum_svcs_status(SVC_R_ENUM_SVCS_STATUS *r_c,
uint32 dos_status);
void svc_io_r_enum_svcs_status(char *desc, SVC_R_ENUM_SVCS_STATUS *svc, prs_struct *ps, int depth);
void svc_io_svc_status(char *desc, SVC_STATUS *svc, prs_struct *ps, int depth);
void make_svc_q_query_svc_config(SVC_Q_QUERY_SVC_CONFIG *q_c, POLICY_HND *hnd,
uint32 buf_size);
void svc_io_q_query_svc_config(char *desc, SVC_Q_QUERY_SVC_CONFIG *q_u, prs_struct *ps, int depth);
void make_svc_r_query_svc_config(SVC_R_QUERY_SVC_CONFIG *r_c,
uint32 buf_size);
void svc_io_r_query_svc_config(char *desc, SVC_R_QUERY_SVC_CONFIG *r_u, prs_struct *ps, int depth);
void make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd);
void svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth);
void svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth);

View File

@ -926,10 +926,17 @@ BOOL lookupsmbpwuid(uid_t uid, DOM_NAME_MAP *gmep)
if (lp_server_role() == ROLE_DOMAIN_MEMBER)
{
#if 0
do_lsa_lookup_names(global_myworkgroup, gmep->nt_name, &gmep->sid...);
lsa_lookup_names(global_myworkgroup, gmep->nt_name, &gmep->sid...);
#endif
}
/*
* ok, it's one of ours. we therefore "create" an nt user named
* after the unix user. this is the point where "appliance mode"
* should get its teeth in, as unix users won't really exist,
* they will only be numbers...
*/
gmep->type = SID_NAME_USER;
fstrcpy(gmep->nt_name, uidtoname(uid));
fstrcpy(gmep->unix_name, gmep->nt_name);
@ -976,10 +983,17 @@ BOOL lookupsmbpwntnam(char *fullntname, DOM_NAME_MAP *gmep)
if (lp_server_role() == ROLE_DOMAIN_MEMBER)
{
#if 0
do_lsa_lookup_names(global_myworkgroup, gmep->nt_name, gmep->nt_domain, &gmep->sid...);
lsa_lookup_names(global_myworkgroup, gmep->nt_name, gmep->nt_domain, &gmep->sid...);
#endif
}
/*
* ok, it's one of ours. we therefore "create" an nt user named
* after the unix user. this is the point where "appliance mode"
* should get its teeth in, as unix users won't really exist,
* they will only be numbers...
*/
gmep->type = SID_NAME_USER;
fstrcpy(gmep->unix_name, gmep->nt_name);
if (!nametouid(gmep->unix_name, &uid))
@ -1028,10 +1042,17 @@ BOOL lookupsmbpwsid(DOM_SID *sid, DOM_NAME_MAP *gmep)
if (lp_server_role() == ROLE_DOMAIN_MEMBER)
{
#if 0
do_lsa_lookup_sids(global_myworkgroup, gmep->sid, gmep->nt_name, gmep->nt_domain...);
lsa_lookup_sids(global_myworkgroup, gmep->sid, gmep->nt_name, gmep->nt_domain...);
#endif
}
/*
* ok, it's one of ours. we therefore "create" an nt user named
* after the unix user. this is the point where "appliance mode"
* should get its teeth in, as unix users won't really exist,
* they will only be numbers...
*/
gmep->type = SID_NAME_USER;
sid_copy(&gmep->sid, sid);
if (!pwdb_sam_sid_to_unixid(&gmep->sid, gmep->type, &gmep->unix_id))
@ -1099,10 +1120,17 @@ BOOL lookupsmbgrpsid(DOM_SID *sid, DOM_NAME_MAP *gmep)
if (lp_server_role() == ROLE_DOMAIN_MEMBER)
{
#if 0
do_lsa_lookup_sids(global_myworkgroup, gmep->sid, gmep->nt_name, gmep->nt_domain...);
lsa_lookup_sids(global_myworkgroup, gmep->sid, gmep->nt_name, gmep->nt_domain...);
#endif
}
/*
* ok, it's one of ours. we therefore "create" an nt group or
* alias name named after the unix group. this is the point
* where "appliance mode" should get its teeth in, as unix
* groups won't really exist, they will only be numbers...
*/
/* name is not explicitly mapped
* with map files or the PDC
* so we are responsible for it...
@ -1165,13 +1193,20 @@ BOOL lookupsmbgrpgid(gid_t gid, DOM_NAME_MAP *gmep)
if (lp_server_role() == ROLE_DOMAIN_MEMBER)
{
#if 0
do_lsa_lookup_names(global_myworkgroup, gmep->nt_name, &gmep->sid...);
if (lsa_lookup_names(global_myworkgroup, gmep->nt_name, &gmep->sid...);
{
return True;
}
#endif
}
/*
* ok, it's one of ours. we therefore "create" an nt group or
* alias name named after the unix group. this is the point
* where "appliance mode" should get its teeth in, as unix
* groups won't really exist, they will only be numbers...
*/
/* name is not explicitly mapped
* with map files or the PDC
* so we are responsible for it...

View File

@ -224,7 +224,7 @@ static void make_lsa_rid2s(DOM_R_REF *ref,
{
sid_name_use = SID_NAME_DOMAIN;
dom_idx = make_dom_ref(ref, dom_name, &find_sid);
}
}
if (lookup_name(find_name, &sid, &sid_name_use) == 0x0 &&
sid_split_rid(&sid, &rid))

View File

@ -106,6 +106,7 @@ BOOL lsa_lookup_names(struct cli_state *cli, uint16 fnum,
int num_names,
const char **names,
DOM_SID **sids,
uint8 **types,
int *num_sids)
{
prs_struct rbuf;
@ -180,6 +181,11 @@ BOOL lsa_lookup_names(struct cli_state *cli, uint16 fnum,
}
}
if (types != NULL && valid_response && r_l.num_entries != 0)
{
(*types) = (uint8*)malloc((*num_sids) * sizeof(uint8));
}
if (sids != NULL && valid_response && r_l.num_entries != 0)
{
(*sids) = (DOM_SID*)malloc((*num_sids) * sizeof(DOM_SID));
@ -201,10 +207,18 @@ BOOL lsa_lookup_names(struct cli_state *cli, uint16 fnum,
{
sid_append_rid(sid, dom_rid);
}
if (types != NULL && (*types) != NULL)
{
(*types)[i] = t_rids[i].type;
}
}
else
{
ZERO_STRUCTP(sid);
if (types != NULL && (*types) != NULL)
{
(*types)[i] = SID_NAME_UNKNOWN;
}
}
}
}
@ -224,6 +238,7 @@ BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum,
int num_sids,
DOM_SID **sids,
char ***names,
uint8 **types,
int *num_names)
{
prs_struct rbuf;
@ -293,6 +308,11 @@ BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum,
}
}
if (types != NULL && valid_response && t_names.num_entries != 0)
{
(*types) = (uint8*)malloc((*num_names) * sizeof(uint8));
}
if (names != NULL && valid_response && t_names.num_entries != 0)
{
(*names) = (char**)malloc((*num_names) * sizeof(char*));
@ -320,10 +340,18 @@ BOOL lsa_lookup_sids(struct cli_state *cli, uint16 fnum,
dom_name, name);
(*names)[i] = strdup(full_name);
if (types != NULL && (*types) != NULL)
{
(*types)[i] = t_names.name[i].sid_name_use;
}
}
else
{
(*names)[i] = NULL;
if (types != NULL && (*types) != NULL)
{
(*types)[i] = SID_NAME_UNKNOWN;
}
}
}
}

View File

@ -224,7 +224,7 @@ static void make_lsa_rid2s(DOM_R_REF *ref,
{
sid_name_use = SID_NAME_DOMAIN;
dom_idx = make_dom_ref(ref, dom_name, &find_sid);
}
}
if (lookup_name(find_name, &sid, &sid_name_use) == 0x0 &&
sid_split_rid(&sid, &rid))

View File

@ -170,7 +170,7 @@ void cmd_lsa_lookup_names(struct client_info *info)
res = res ? lsa_lookup_names(smb_cli, nt_pipe_fnum,
&info->dom.lsa_info_pol,
num_names, names,
&sids, &num_sids) : False;
&sids, NULL, &num_sids) : False;
res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False;
@ -278,7 +278,7 @@ void cmd_lsa_lookup_sids(struct client_info *info)
res = res ? lsa_lookup_sids(smb_cli, nt_pipe_fnum,
&info->dom.lsa_info_pol,
num_sids, sids,
&names, &num_names) : False;
&names, NULL, &num_names) : False;
res = res ? lsa_close(smb_cli, nt_pipe_fnum, &info->dom.lsa_info_pol) : False;

View File

@ -432,7 +432,7 @@ void cmd_sam_add_aliasmem(struct client_info *info)
res4 = res3 ? lsa_lookup_names(smb_cli, fnum_lsa,
&info->dom.lsa_info_pol,
num_names, names,
&sids, &num_sids) : False;
&sids, NULL, &num_sids) : False;
res3 = res3 ? lsa_close(smb_cli, fnum_lsa, &info->dom.lsa_info_pol) : False;
@ -1565,7 +1565,7 @@ void cmd_sam_enum_aliases(struct client_info *info)
res4 = res3 ? lsa_lookup_sids(smb_cli, fnum_lsa,
&info->dom.lsa_info_pol,
num_aliases, sids,
&names, &num_names) : False;
&names, NULL, &num_names) : False;
res3 = res3 ? lsa_close(smb_cli, fnum_lsa, &info->dom.lsa_info_pol) : False;

View File

@ -160,6 +160,7 @@ static void cmd_quit(struct client_info *info)
smb_mem_write_status(dbf);
smb_mem_write_errors(dbf);
smb_mem_write_verbose(dbf);
dbgflush();
}
#endif
exit(0);