From 254470cb566fc06f5818830d105361d853648d6e Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 14 Dec 1998 20:23:20 +0000 Subject: added sid_name_use array argument to lsa_lookup_names and lsa_lookup_sids. (This used to be commit 0b2095e092d747f741e78a3349f0b81a72811629) --- source3/include/proto.h | 10 ++++++++- source3/lib/domain_namemap.c | 45 ++++++++++++++++++++++++++++++++++++----- source3/lsarpcd/srv_lsa.c | 2 +- source3/rpc_client/cli_lsarpc.c | 28 +++++++++++++++++++++++++ source3/rpc_server/srv_lsa.c | 2 +- source3/rpcclient/cmd_lsarpc.c | 4 ++-- source3/rpcclient/cmd_samr.c | 4 ++-- source3/rpcclient/rpcclient.c | 1 + 8 files changed, 84 insertions(+), 12 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index 95307f4334..8d966c6177 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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); diff --git a/source3/lib/domain_namemap.c b/source3/lib/domain_namemap.c index 407de944a7..9ea3dd6ada 100644 --- a/source3/lib/domain_namemap.c +++ b/source3/lib/domain_namemap.c @@ -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... diff --git a/source3/lsarpcd/srv_lsa.c b/source3/lsarpcd/srv_lsa.c index 947de768b5..5f4f9fb929 100644 --- a/source3/lsarpcd/srv_lsa.c +++ b/source3/lsarpcd/srv_lsa.c @@ -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)) diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 0e28174b8b..6f78f308dd 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -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; + } } } } diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index 947de768b5..5f4f9fb929 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -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)) diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 96f952a789..de41f286f7 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -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; diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index a24e474af5..8a43a69cb7 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -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; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index fd677f73bb..ceaefb98bc 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -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); -- cgit