From 1f48b3640f971705d53e2f59aab311927b7c54a5 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 10 Oct 2001 23:08:13 +0000 Subject: Got the rest of the group functions working. Did some reformatting (man what was I thinking with those 4 character tabs?) We now pass our winbindd test suite again! Still to do: - talloc_ctx on a per winbindd request basis not per connection - clean up old crap we don't use any more - test against multiple BDCs (I know this isn't going to work - group/user handles have to be made against the same DC the domain and basic handles are. - implement network and dc failure recovery (This used to be commit dc4ca0e0bd779b9157ea3b2a8f17eb455abf0f26) --- source3/nsswitch/winbindd_group.c | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) (limited to 'source3/nsswitch/winbindd_group.c') diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c index f13f44b8cf..dd3e7a9578 100644 --- a/source3/nsswitch/winbindd_group.c +++ b/source3/nsswitch/winbindd_group.c @@ -183,8 +183,6 @@ static BOOL fill_grent_mem(struct winbindd_domain *domain, return result; } -#if 0 - /* Return a group structure from a group name */ enum winbindd_result winbindd_getgrnam_from_group(struct winbindd_cli_state @@ -212,9 +210,8 @@ enum winbindd_result winbindd_getgrnam_from_group(struct winbindd_cli_state /* Reject names that don't have a domain - i.e name_domain contains the entire name. */ - if (strequal(name_group, "")) { + if (strequal(name_group, "")) return WINBINDD_ERROR; - } /* Get info for the domain */ @@ -224,10 +221,6 @@ enum winbindd_result winbindd_getgrnam_from_group(struct winbindd_cli_state return WINBINDD_ERROR; } - if (!domain_handles_open(domain)) { - return WINBINDD_ERROR; - } - /* Check for cached group entry */ if (winbindd_fetch_group_cache_entry(name_domain, name_group, @@ -267,9 +260,8 @@ enum winbindd_result winbindd_getgrnam_from_group(struct winbindd_cli_state state->request.data.groupname, gid) || !fill_grent_mem(domain, group_rid, name_type, &state->response.data.gr.num_gr_mem, - &gr_mem, &gr_mem_len)) { + &gr_mem, &gr_mem_len)) return WINBINDD_ERROR; - } /* Group membership lives at start of extra data */ @@ -301,15 +293,14 @@ enum winbindd_result winbindd_getgrnam_from_gid(struct winbindd_cli_state int extra_data_len, gr_mem_len; char *gr_mem; + DEBUG(3, ("[%5d]: getgrgid %d\n", state->pid, + state->request.data.gid)); + /* Bug out if the gid isn't in the winbind range */ if ((state->request.data.gid < server_state.gid_low) || - (state->request.data.gid > server_state.gid_high)) { + (state->request.data.gid > server_state.gid_high)) return WINBINDD_ERROR; - } - - DEBUG(3, ("[%5d]: getgrgid %d\n", state->pid, - state->request.data.gid)); /* Get rid from gid */ @@ -320,10 +311,6 @@ enum winbindd_result winbindd_getgrnam_from_gid(struct winbindd_cli_state return WINBINDD_ERROR; } - if (!domain_handles_open(domain)) { - return WINBINDD_ERROR; - } - /* Try a cached entry */ if (winbindd_fetch_gid_cache_entry(domain->name, @@ -345,10 +332,9 @@ enum winbindd_result winbindd_getgrnam_from_gid(struct winbindd_cli_state return WINBINDD_ERROR; } - if (strcmp(lp_winbind_separator(),"\\")) { + if (strcmp(lp_winbind_separator(),"\\")) string_sub(group_name, "\\", lp_winbind_separator(), sizeof(fstring)); - } if (!((name_type == SID_NAME_ALIAS) || (name_type == SID_NAME_DOM_GRP))) { @@ -363,10 +349,8 @@ enum winbindd_result winbindd_getgrnam_from_gid(struct winbindd_cli_state state->request.data.gid) || !fill_grent_mem(domain, group_rid, name_type, &state->response.data.gr.num_gr_mem, - &gr_mem, &gr_mem_len)) { + &gr_mem, &gr_mem_len)) return WINBINDD_ERROR; - } - /* Group membership lives at start of extra data */ @@ -385,8 +369,6 @@ enum winbindd_result winbindd_getgrnam_from_gid(struct winbindd_cli_state return WINBINDD_OK; } -#endif - /* * set/get/endgrent functions */ @@ -446,8 +428,6 @@ enum winbindd_result winbindd_endgrent(struct winbindd_cli_state *state) { DEBUG(3, ("[%5d]: endgrent\n", state->pid)); - if (state == NULL) return WINBINDD_ERROR; - free_getent_state(state->getgrent_state); state->getgrent_state = NULL; -- cgit