Revert "TODO source3/winbindd/wb_gettoken.c..."
authorStefan Metzmacher <metze@samba.org>
Thu, 19 Dec 2019 23:00:47 +0000 (00:00 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 6 Aug 2020 12:03:26 +0000 (14:03 +0200)
This reverts commit 63e8adf251df1f023f59d392306394b1fdf94e27.

source3/winbindd/wb_gettoken.c

index 28d76c4e027c4215c9d181b6e02335f177d9f3b6..a393b0f09e773739ee4e440886f952c7b9a6a68f 100644 (file)
@@ -37,32 +37,6 @@ static NTSTATUS wb_add_rids_to_sids(TALLOC_CTX *mem_ctx,
                                    const struct dom_sid *domain_sid,
                                    int num_rids, uint32_t *rids);
 
-static NTSTATUS wb_SamInfo_to_sids(TALLOC_CTX
-                                  uint32_t *pnum_sids,
-                                  struct dom_sid **psids,
-                                  struct netr_SamBaseInfo *base,
-                                  uint32_t sidcount,
-                                  const struct netr_SidAttr *sids);
-       int i, num_groups;
-       struct dom_sid *groups;
-       struct winbindd_domain *domain;
-       NTSTATUS status;
-
-       status = wb_lookupusergroups_recv(subreq, state, &num_groups, &groups);
-       TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_done(req);
-               return;
-       }
-
-       for (i=0; i<num_groups; i++) {
-               status = add_sid_to_array_unique(
-                       state, &groups[i], &state->sids, &state->num_sids);
-
-               if (tevent_req_nterror(req, status)) {
-                       return;
-               }
-       }
 static void wb_gettoken_gotuser(struct tevent_req *subreq);
 static void wb_gettoken_gotgroups(struct tevent_req *subreq);
 static void wb_gettoken_gotlocalgroups(struct tevent_req *subreq);
@@ -84,115 +58,6 @@ struct tevent_req *wb_gettoken_send(TALLOC_CTX *mem_ctx,
        state->ev = ev;
        state->expand_local_aliases = expand_local_aliases;
 
-       state->info3 = netsamlogon_cache_get(state, &info->user_sid);
-       if (state->info3 != NULL) {
-
-       subreq = wb_lookupsid_send(state, state->ev, &info->group_sid);
-       if (tevent_req_nomem(subreq, req)) {
-               return tevent_req_post(req, ev);
-       }
-       tevent_req_set_callback(subreq,
-                               wb_gettoken_gotname,
-                               req);
-       return req;
-}
-
-static void wb_gettoken_gotname(struct tevent_req *subreq)
-{
-       struct tevent_req *req = tevent_req_callback_data(
-               subreq, struct tevent_req);
-       struct wb_gettoken_state *state = tevent_req_data(
-               req, struct wb_gettoken_state);
-       struct winbindd_domain *domain = find_our_domain();
-       const char *domain_name = NULL;
-       const char *acct_name = NULL;
-       enum lsa_SidType type;
-       NTSTATUS status;
-
-       status = wb_lookupsid_recv(subreq,
-                                  state,
-                                  &type,
-                                  &domain_name,
-                                  &acct_name);
-       TALLOC_FREE(subreq);
-       if (tevent_req_nterror(req, status)) {
-               return;
-       }
-
-       switch (type) {
-       case SID_NAME_USER:
-       case SID_NAME_COMPUTER:
-               /*
-                * user case: we only need the account name from lookup_sids
-                */
-               break;
-       default:
-               tevent_req_nterror(req, NT_STATUS_NO_SUCH_USER);
-               return;
-       }
-
-       state->upn = talloc_asprintf(state, "%s@%s", acct_name, domain_name);
-       if (tevent_req_nomem(state->upn, req)) {
-               return;
-       }
-
-       info3 = netsamlogon_cache_get(state, &info->user_sid);
-       if (info3 != NULL) {
-
-               sid_compose(&info->group_sid, info3->base.domain_sid,
-                           info3->base.primary_gid);
-               info->acct_name = talloc_move(
-                       info, &info3->base.account_name.string);
-               info->full_name = talloc_move(
-                       info, &info3->base.full_name.string);
-
-               info->domain_name = talloc_move(
-                       state, &info3->base.logon_domain.string);
-
-               TALLOC_FREE(info3);
-       }
-
-       if (info->domain_name == NULL) {
-               subreq = wb_lookupsid_send(state, state->ev, &info->user_sid);
-               if (tevent_req_nomem(subreq, req)) {
-                       return;
-               }
-               tevent_req_set_callback(subreq, wb_queryuser_got_domain, req);
-               return;
-       }
-
-       child = idmap_child();
-
-       subreq = dcerpc_wbint_GetNssInfo_send(
-               state, state->ev, child->binding_handle, info);
-       if (tevent_req_nomem(subreq, req)) {
-               return;
-       }
-       tevent_req_set_callback(subreq, wb_queryuser_done, req);
-}
-
-
-       status = wb_queryuser_recv(subreq, state, &info);
-       TALLOC_FREE(subreq);
-       if (tevent_req_nterror(req, status)) {
-               return;
-       }
-
-       state->sids = talloc_array(state, struct dom_sid, 2);
-       if (tevent_req_nomem(state->sids, req)) {
-               return;
-       }
-       state->num_sids = 2;
-
-       sid_copy(&state->sids[0], &info->user_sid);
-       sid_copy(&state->sids[1], &info->group_sid);
-
-       subreq = wb_lookupusergroups_send(state, state->ev, &info->user_sid);
-       if (tevent_req_nomem(subreq, req)) {
-               return;
-       }
-       tevent_req_set_callback(subreq, wb_gettoken_gotgroups, req);
-}
        subreq = wb_queryuser_send(state, ev, &state->usersid);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
@@ -201,36 +66,6 @@ static void wb_gettoken_gotname(struct tevent_req *subreq)
        return req;
 }
 
-static void wb_gettoken_gotuser(struct tevent_req *subreq)
-{
-       struct tevent_req *req = tevent_req_callback_data(
-               subreq, struct tevent_req);
-       struct wb_gettoken_state *state = tevent_req_data(
-               req, struct wb_gettoken_state);
-       struct wbint_userinfo *info;
-       NTSTATUS status;
-
-       status = wb_queryuser_recv(subreq, state, &info);
-       TALLOC_FREE(subreq);
-       if (tevent_req_nterror(req, status)) {
-               return;
-       }
-
-       state->sids = talloc_array(state, struct dom_sid, 2);
-       if (tevent_req_nomem(state->sids, req)) {
-               return;
-       }
-       state->num_sids = 2;
-
-       sid_copy(&state->sids[0], &info->user_sid);
-       sid_copy(&state->sids[1], &info->group_sid);
-
-       subreq = wb_lookupusergroups_send(state, state->ev, &info->user_sid);
-       if (tevent_req_nomem(subreq, req)) {
-               return;
-       }
-       tevent_req_set_callback(subreq, wb_gettoken_gotgroups, req);
-}
 static void wb_gettoken_gotuser(struct tevent_req *subreq)
 {
        struct tevent_req *req = tevent_req_callback_data(