From 0536ceee2f22fcef71471cf6c87e2a2940d1d622 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 14 Oct 2001 08:30:30 +0000 Subject: Pass domain structure around in cache code rather than the domain name. (This used to be commit c6338d7eaeb31db2666603fcdd9179e61891a1c9) --- source3/nsswitch/winbindd_group.c | 12 ++++++------ source3/nsswitch/winbindd_proto.h | 37 +++++++++++++++++-------------------- source3/nsswitch/winbindd_user.c | 12 ++++++------ 3 files changed, 29 insertions(+), 32 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c index dd3e7a9578..893302716f 100644 --- a/source3/nsswitch/winbindd_group.c +++ b/source3/nsswitch/winbindd_group.c @@ -223,7 +223,7 @@ enum winbindd_result winbindd_getgrnam_from_group(struct winbindd_cli_state /* Check for cached group entry */ - if (winbindd_fetch_group_cache_entry(name_domain, name_group, + if (winbindd_fetch_group_cache_entry(domain, name_group, &state->response.data.gr, &state->response.extra_data, &extra_data_len)) { @@ -272,7 +272,7 @@ enum winbindd_result winbindd_getgrnam_from_group(struct winbindd_cli_state /* Update cached group info */ - winbindd_store_group_cache_entry(name_domain, name_group, + winbindd_store_group_cache_entry(domain, name_group, &state->response.data.gr, state->response.extra_data, gr_mem_len); @@ -313,7 +313,7 @@ enum winbindd_result winbindd_getgrnam_from_gid(struct winbindd_cli_state /* Try a cached entry */ - if (winbindd_fetch_gid_cache_entry(domain->name, + if (winbindd_fetch_gid_cache_entry(domain, state->request.data.gid, &state->response.data.gr, &state->response.extra_data, @@ -361,7 +361,7 @@ enum winbindd_result winbindd_getgrnam_from_gid(struct winbindd_cli_state /* Update cached group info */ - winbindd_store_gid_cache_entry(domain->name, state->request.data.gid, + winbindd_store_gid_cache_entry(domain, state->request.data.gid, &state->response.data.gr, state->response.extra_data, gr_mem_len); @@ -451,7 +451,7 @@ static BOOL get_sam_group_entries(struct getent_state *ent) return False; #if 0 - if (winbindd_fetch_group_cache(ent->domain->name, + if (winbindd_fetch_group_cache(ent->domain, &ent->sam_entries, &ent->num_sam_entries)) return True; @@ -515,7 +515,7 @@ static BOOL get_sam_group_entries(struct getent_state *ent) #if 0 /* Fill cache with received entries */ - winbindd_store_group_cache(ent->domain->name, ent->sam_entries, + winbindd_store_group_cache(ent->domain, ent->sam_entries, ent->num_sam_entries); #endif diff --git a/source3/nsswitch/winbindd_proto.h b/source3/nsswitch/winbindd_proto.h index b32ca11424..46751553ac 100644 --- a/source3/nsswitch/winbindd_proto.h +++ b/source3/nsswitch/winbindd_proto.h @@ -10,36 +10,36 @@ int main(int argc, char **argv); /* The following definitions come from nsswitch/winbindd_cache.c */ void winbindd_cache_init(void); -void winbindd_store_user_cache(char *domain, +void winbindd_store_user_cache(struct winbindd_domain *domain, struct getpwent_user *sam_entries, int num_sam_entries); -void winbindd_store_group_cache(char *domain, +void winbindd_store_group_cache(struct winbindd_domain *domain, struct acct_info *sam_entries, int num_sam_entries); -void winbindd_store_user_cache_entry(char *domain, char *user_name, - struct winbindd_pw *pw); -void winbindd_store_uid_cache_entry(char *domain, uid_t uid, +void winbindd_store_user_cache_entry(struct winbindd_domain *domain, + char *user_name, struct winbindd_pw *pw); +void winbindd_store_uid_cache_entry(struct winbindd_domain *domain, uid_t uid, struct winbindd_pw *pw); -void winbindd_store_group_cache_entry(char *domain, char *group_name, - struct winbindd_gr *gr, void *extra_data, - int extra_data_len); -void winbindd_store_gid_cache_entry(char *domain, gid_t gid, +void winbindd_store_group_cache_entry(struct winbindd_domain *domain, + char *group_name, struct winbindd_gr *gr, + void *extra_data, int extra_data_len); +void winbindd_store_gid_cache_entry(struct winbindd_domain *domain, gid_t gid, struct winbindd_gr *gr, void *extra_data, int extra_data_len); -BOOL winbindd_fetch_user_cache(char *domain_name, +BOOL winbindd_fetch_user_cache(struct winbindd_domain *domain, struct getpwent_user **sam_entries, int *num_entries); -BOOL winbindd_fetch_group_cache(char *domain_name, +BOOL winbindd_fetch_group_cache(struct winbindd_domain *domain, struct acct_info **sam_entries, int *num_entries); -BOOL winbindd_fetch_user_cache_entry(char *domain_name, char *user, - struct winbindd_pw *pw); -BOOL winbindd_fetch_uid_cache_entry(char *domain_name, uid_t uid, +BOOL winbindd_fetch_user_cache_entry(struct winbindd_domain *domain, + char *user, struct winbindd_pw *pw); +BOOL winbindd_fetch_uid_cache_entry(struct winbindd_domain *domain, uid_t uid, struct winbindd_pw *pw); -BOOL winbindd_fetch_group_cache_entry(char *domain_name, char *group, - struct winbindd_gr *gr, +BOOL winbindd_fetch_group_cache_entry(struct winbindd_domain *domain, + char *group, struct winbindd_gr *gr, void **extra_data, int *extra_data_len); -BOOL winbindd_fetch_gid_cache_entry(char *domain_name, gid_t gid, +BOOL winbindd_fetch_gid_cache_entry(struct winbindd_domain *domain, gid_t gid, struct winbindd_gr *gr, void **extra_data, int *extra_data_len); void winbindd_flush_cache(void); @@ -118,9 +118,6 @@ enum winbindd_result winbindd_list_users(struct winbindd_cli_state *state); /* The following definitions come from nsswitch/winbindd_util.c */ BOOL get_domain_info(void); -BOOL domain_handles_open(struct winbindd_domain *domain); -void winbindd_kill_all_connections(void); -void establish_connections(BOOL force_reestablish) ; BOOL lookup_domain_sid(char *domain_name, struct winbindd_domain *domain); BOOL winbindd_lookup_sid_by_name(char *name, DOM_SID *sid, enum SID_NAME_USE *type); diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c index fe134c4e66..845c787b2a 100644 --- a/source3/nsswitch/winbindd_user.c +++ b/source3/nsswitch/winbindd_user.c @@ -123,7 +123,7 @@ enum winbindd_result winbindd_getpwnam_from_user(struct winbindd_cli_state /* Check for cached user entry */ - if (winbindd_fetch_user_cache_entry(name_domain, name_user, + if (winbindd_fetch_user_cache_entry(domain, name_user, &state->response.data.pw)) { return WINBINDD_OK; } @@ -167,7 +167,7 @@ enum winbindd_result winbindd_getpwnam_from_user(struct winbindd_cli_state return WINBINDD_ERROR; } - winbindd_store_user_cache_entry(name_domain, name_user, + winbindd_store_user_cache_entry(domain, name_user, &state->response.data.pw); return WINBINDD_OK; @@ -207,7 +207,7 @@ enum winbindd_result winbindd_getpwnam_from_uid(struct winbindd_cli_state /* Check for cached uid entry */ - if (winbindd_fetch_uid_cache_entry(domain->name, + if (winbindd_fetch_uid_cache_entry(domain, state->request.data.uid, &state->response.data.pw)) { return WINBINDD_OK; @@ -257,7 +257,7 @@ enum winbindd_result winbindd_getpwnam_from_uid(struct winbindd_cli_state return WINBINDD_ERROR; } - winbindd_store_uid_cache_entry(domain->name, state->request.data.uid, + winbindd_store_uid_cache_entry(domain, state->request.data.uid, &state->response.data.pw); return WINBINDD_OK; @@ -355,7 +355,7 @@ static BOOL get_sam_user_entries(struct getent_state *ent) #if 0 /* Look in cache for entries, else get them direct */ - if (winbindd_fetch_user_cache(ent->domain->name, + if (winbindd_fetch_user_cache(ent->domain, (struct getpwent_user **) &ent->sam_entries, &ent->num_sam_entries)) { @@ -437,7 +437,7 @@ static BOOL get_sam_user_entries(struct getent_state *ent) #if 0 /* Fill cache with received entries */ - winbindd_store_user_cache(ent->domain->name, ent->sam_entries, + winbindd_store_user_cache(ent->domain, ent->sam_entries, ent->num_sam_entries); #endif -- cgit