diff options
Diffstat (limited to 'source3/winbindd/winbindd_sid.c')
-rw-r--r-- | source3/winbindd/winbindd_sid.c | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/source3/winbindd/winbindd_sid.c b/source3/winbindd/winbindd_sid.c index ae3d369846..718345b5e3 100644 --- a/source3/winbindd/winbindd_sid.c +++ b/source3/winbindd/winbindd_sid.c @@ -55,119 +55,6 @@ void winbindd_lookuprids(struct winbindd_cli_state *state) sendto_domain(state, domain); } -/* Convert a sid to a gid. We assume we only have one rid attached to the - sid.*/ - -static void sid2gid_recv(void *private_data, bool success, gid_t gid) -{ - struct winbindd_cli_state *state = - talloc_get_type_abort(private_data, struct winbindd_cli_state); - struct dom_sid sid; - - string_to_sid(&sid, state->request->data.sid); - - if (!success) { - DEBUG(5, ("Could not convert sid %s\n", - state->request->data.sid)); - request_error(state); - return; - } - - state->response->data.gid = gid; - request_ok(state); -} - -static void sid2gid_lookupsid_recv( void *private_data, bool success, - const char *domain_name, - const char *name, - enum lsa_SidType type) -{ - struct winbindd_cli_state *state = - talloc_get_type_abort(private_data, struct winbindd_cli_state); - DOM_SID sid; - - if (!string_to_sid(&sid, state->request->data.sid)) { - DEBUG(1, ("sid2gid_lookupsid_recv: Could not get convert sid " - "%s from string\n", state->request->data.sid)); - request_error(state); - return; - } - - if (!success) { - DEBUG(5, ("sid2gid_lookupsid_recv: Could not get sid type for %s\n", - state->request->data.sid)); - goto fail; - } - - if ( (type!=SID_NAME_DOM_GRP) && - (type!=SID_NAME_ALIAS) && - (type!=SID_NAME_WKN_GRP) ) - { - DEBUG(5,("sid2gid_lookupsid_recv: Sid %s is not a group.\n", - state->request->data.sid)); - goto fail; - } - - /* always use the async interface (may block) */ - winbindd_sid2gid_async(state->mem_ctx, &sid, sid2gid_recv, state); - return; - - fail: - /* - * We have to set the cache ourselves here, the child which is - * normally responsible was not queried yet. - */ - idmap_cache_set_sid2gid(&sid, -1); - request_error(state); - return; -} - -void winbindd_sid_to_gid(struct winbindd_cli_state *state) -{ - DOM_SID sid; - gid_t gid; - bool expired; - - /* Ensure null termination */ - state->request->data.sid[sizeof(state->request->data.sid)-1]='\0'; - - DEBUG(3, ("[%5lu]: sid to gid %s\n", (unsigned long)state->pid, - state->request->data.sid)); - - if (!string_to_sid(&sid, state->request->data.sid)) { - DEBUG(1, ("Could not get convert sid %s from string\n", - state->request->data.sid)); - request_error(state); - return; - } - - if (idmap_cache_find_sid2gid(&sid, &gid, &expired)) { - DEBUG(10, ("idmap_cache_find_sid2gid found %d%s\n", - (int)gid, expired ? " (expired)": "")); - if (expired && IS_DOMAIN_ONLINE(find_our_domain())) { - DEBUG(10, ("revalidating expired entry\n")); - goto backend; - } - if (gid == -1) { - DEBUG(10, ("Returning negative cache entry\n")); - request_error(state); - return; - } - DEBUG(10, ("Returning positive cache entry\n")); - state->response->data.gid = gid; - request_ok(state); - return; - } - - /* Validate the SID as a group. Hopefully this will hit cache. - Needed to prevent DoS by exhausting the uid allocation - range from random SIDs. */ - - backend: - winbindd_lookupsid_async( state->mem_ctx, &sid, sid2gid_lookupsid_recv, - state ); -} - static void set_mapping_recv(void *private_data, bool success) { struct winbindd_cli_state *state = |