diff options
author | Günther Deschner <gd@samba.org> | 2007-09-04 14:06:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:30:30 -0500 |
commit | be3fdd8b6237a6dcaf4ff974dc4dad35b7009169 (patch) | |
tree | d1b8f8bd399ef9b0888ca0318574acede8eef7d5 /source3/nsswitch/winbindd_util.c | |
parent | 6de1b0b65b9e6364914bac52219e155ae45bbfbf (diff) | |
download | samba-be3fdd8b6237a6dcaf4ff974dc4dad35b7009169.tar.gz samba-be3fdd8b6237a6dcaf4ff974dc4dad35b7009169.tar.bz2 samba-be3fdd8b6237a6dcaf4ff974dc4dad35b7009169.zip |
r24952: Set the kdc locator env vars. This makes the krb5 locator plugin fully
operational (from within winbindd and outside).
Guenther
(This used to be commit 800645d5388d7df1f8cf31b4218bfc7dd5b4d12a)
Diffstat (limited to 'source3/nsswitch/winbindd_util.c')
-rw-r--r-- | source3/nsswitch/winbindd_util.c | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index 225c6b5be1..a29ea38145 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -1366,24 +1366,40 @@ BOOL winbindd_internal_child(struct winbindd_child *child) return False; } +void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain); +void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain); + +#ifdef HAVE_KRB5_LOCATE_PLUGIN_H + /********************************************************************* ********************************************************************/ -void winbindd_set_locator_kdc_env(const struct winbindd_domain *domain) +static void winbindd_set_locator_kdc_env(const struct winbindd_domain *domain) { char *var = NULL; const char *kdc = NULL; + int lvl = 11; + + if (!domain || !domain->alt_name || !*domain->alt_name) { + return; + } - if (!domain) { + if (domain->initialized && !domain->active_directory) { + DEBUG(lvl,("winbindd_set_locator_kdc_env: %s not AD\n", + domain->alt_name)); return; } kdc = inet_ntoa(domain->dcaddr.sin_addr); if (!kdc) { + DEBUG(lvl,("winbindd_set_locator_kdc_env: %s no DC IP\n", + domain->alt_name)); kdc = domain->dcname; } if (!kdc || !*kdc) { + DEBUG(lvl,("winbindd_set_locator_kdc_env: %s no DC at all\n", + domain->alt_name)); return; } @@ -1392,9 +1408,45 @@ void winbindd_set_locator_kdc_env(const struct winbindd_domain *domain) return; } - DEBUG(10,("winbindd_set_locator_kdc_env: setting var: %s to: %s\n", + DEBUG(lvl,("winbindd_set_locator_kdc_env: setting var: %s to: %s\n", var, kdc)); setenv(var, kdc, 1); free(var); } + +/********************************************************************* + ********************************************************************/ + +void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain) +{ + struct winbindd_domain *our_dom = find_our_domain(); + + winbindd_set_locator_kdc_env(domain); + + if (domain != our_dom) { + winbindd_set_locator_kdc_env(our_dom); + } +} + +/********************************************************************* + ********************************************************************/ + +void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain) +{ + char *var = NULL; + + if (!domain || !domain->alt_name || !*domain->alt_name) { + return; + } + + if (asprintf(&var, "%s_%s", WINBINDD_LOCATOR_KDC_ADDRESS, + strupper_static(domain->alt_name)) == -1) { + return; + } + + unsetenv(var); + free(var); +} + +#endif /* HAVE_KRB5_LOCATE_PLUGIN_H */ |