added sid_name_use array argument to lsa_lookup_names and lsa_lookup_sids.
authorLuke Leighton <lkcl@samba.org>
Mon, 14 Dec 1998 20:23:20 +0000 (20:23 +0000)
committerLuke Leighton <lkcl@samba.org>
Mon, 14 Dec 1998 20:23:20 +0000 (20:23 +0000)
(This used to be commit 0b2095e092d747f741e78a3349f0b81a72811629)

source3/include/proto.h
source3/lib/domain_namemap.c
source3/lsarpcd/srv_lsa.c
source3/rpc_client/cli_lsarpc.c
source3/rpc_server/srv_lsa.c
source3/rpcclient/cmd_lsarpc.c
source3/rpcclient/cmd_samr.c
source3/rpcclient/rpcclient.c

index 95307f433451d1eb04579493122b4d50b75377d4..8d966c61771b466702f7a70ff36abf169ffb3ca0 100644 (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);
index 407de944a785022b4d611aaa002fab7f32eaaba4..9ea3dd6ada19c252918de10e315bb4cccfe3c2d5 100644 (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...
index 947de768b540a04208d7e7e368579a7ae72d2901..5f4f9fb929d68a3ddcc41ad7324cd3270899114a 100644 (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))
index 0e28174b8b32b7c3d7fc715b43c5e9ce8d817e59..6f78f308dda644dbe93426c1e2411cb9aa285e80 100644 (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;
+                                       }
                                }
                        }
                }
index 947de768b540a04208d7e7e368579a7ae72d2901..5f4f9fb929d68a3ddcc41ad7324cd3270899114a 100644 (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))
index 96f952a789ae1f920598667c55f6f31a8c812a9f..de41f286f73bb6c43b0994a69153173aa9dedc3e 100644 (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;
 
index a24e474af5e4a74fc1e84c3e1a46d8e63af97f36..8a43a69cb7dae3dda4cb6d5f2133beccfbff52c4 100644 (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;
 
index fd677f73bbf53faaf2194252bf2e24c194224882..ceaefb98bc43b3e65539225bd0915b57bb4b2b2e 100644 (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);