summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/nsswitch/winbindd_util.c')
-rw-r--r--source3/nsswitch/winbindd_util.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index 6a0a5389ef..1b63cd2810 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -118,6 +118,27 @@ BOOL get_domain_info(void)
return rv;
}
+/* Free global domain info */
+
+void free_domain_info(void)
+{
+ struct winbindd_domain *domain;
+
+ /* Free list of domains */
+
+ if (domain_list) {
+ struct winbindd_domain *next_domain;
+
+ domain = domain_list;
+
+ while(domain) {
+ next_domain = domain->next;
+ free(domain);
+ domain = next_domain;
+ }
+ }
+}
+
/* Connect to a domain controller using get_any_dc_name() to discover
the domain name and sid */
@@ -420,6 +441,9 @@ struct winbindd_domain *find_domain_from_name(char *domain_name)
{
struct winbindd_domain *tmp;
+ if (domain_list == NULL)
+ get_domain_info();
+
/* Search through list */
for (tmp = domain_list; tmp != NULL; tmp = tmp->next) {
@@ -438,6 +462,9 @@ struct winbindd_domain *find_domain_from_sid(DOM_SID *sid)
{
struct winbindd_domain *tmp;
+ if (domain_list == NULL)
+ get_domain_info();
+
/* Search through list */
for (tmp = domain_list; tmp != NULL; tmp = tmp->next) {