diff options
-rw-r--r-- | source3/nsswitch/winbindd.c | 9 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_group.c | 36 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_util.c | 60 |
3 files changed, 37 insertions, 68 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 4a01b06ea9..ffac199b6a 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -238,16 +238,12 @@ static struct dispatch_table dispatch_table[] = { /* Group functions */ -#if 0 { WINBINDD_GETGRNAM_FROM_GROUP, winbindd_getgrnam_from_group }, { WINBINDD_GETGRNAM_FROM_GID, winbindd_getgrnam_from_gid }, -#endif { WINBINDD_SETGRENT, winbindd_setgrent }, { WINBINDD_ENDGRENT, winbindd_endgrent }, { WINBINDD_GETGRENT, winbindd_getgrent }, -#if 0 - /* PAM auth functions */ { WINBINDD_PAM_AUTH, winbindd_pam_auth }, @@ -256,13 +252,10 @@ static struct dispatch_table dispatch_table[] = { /* Enumeration functions */ -#endif - { WINBINDD_LIST_USERS, winbindd_list_users }, { WINBINDD_LIST_GROUPS, winbindd_list_groups }, { WINBINDD_LIST_TRUSTDOM, winbindd_list_trusted_domains }, -#if 0 /* SID related functions */ { WINBINDD_LOOKUPSID, winbindd_lookupsid }, @@ -279,8 +272,6 @@ static struct dispatch_table dispatch_table[] = { { WINBINDD_CHECK_MACHACC, winbindd_check_machine_acct }, -#endif - /* End of list */ { WINBINDD_NUM_CMDS, NULL } 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; diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index a5e558f658..23f46f239a 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -29,34 +29,35 @@ static struct winbindd_domain *add_trusted_domain(char *domain_name, DOM_SID *domain_sid) { - struct winbindd_domain *domain, *tmp; - - for (tmp = domain_list; tmp != NULL; tmp = tmp->next) { - if (strcmp(domain_name, tmp->name) == 0) { - DEBUG(3, ("domain %s already in domain list\n", - domain_name)); - return tmp; - } - } - - DEBUG(1, ("adding domain %s\n", domain_name)); - - /* Create new domain entry */ - - if ((domain = (struct winbindd_domain *)malloc(sizeof(*domain))) == NULL) - return NULL; - - /* Fill in fields */ - - ZERO_STRUCTP(domain); - fstrcpy(domain->name, domain_name); - sid_copy(&domain->sid, domain_sid); - - /* Link to domain list */ - - DLIST_ADD(domain_list, domain); + struct winbindd_domain *domain, *tmp; + + for (tmp = domain_list; tmp != NULL; tmp = tmp->next) { + if (strcmp(domain_name, tmp->name) == 0) { + DEBUG(3, ("domain %s already in domain list\n", + domain_name)); + return tmp; + } + } + + DEBUG(1, ("adding domain %s\n", domain_name)); + + /* Create new domain entry */ + + if ((domain = (struct winbindd_domain *) + malloc(sizeof(*domain))) == NULL) + return NULL; - return domain; + /* Fill in fields */ + + ZERO_STRUCTP(domain); + fstrcpy(domain->name, domain_name); + sid_copy(&domain->sid, domain_sid); + + /* Link to domain list */ + + DLIST_ADD(domain_list, domain); + + return domain; } /* Look up global info for the winbind daemon */ @@ -674,11 +675,8 @@ struct winbindd_domain *find_domain_from_sid(DOM_SID *sid) /* Search through list */ for (tmp = domain_list; tmp != NULL; tmp = tmp->next) { - if (sid_equal(sid, &tmp->sid)) { - if (!tmp->got_domain_info) - return NULL; + if (sid_equal(sid, &tmp->sid)) return tmp; - } } /* Not found */ |