summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-08-30 16:24:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:23 -0500
commit020e0aba0a9d4b9ff1a8bcf3bd73d77b8958066c (patch)
tree8c282c87ea763ece91aeb8bd529ed7fdb579aea0 /source3/nsswitch
parentb2a1a4a0fe759d837d811c64b84917d51e48e35d (diff)
downloadsamba-020e0aba0a9d4b9ff1a8bcf3bd73d77b8958066c.tar.gz
samba-020e0aba0a9d4b9ff1a8bcf3bd73d77b8958066c.tar.bz2
samba-020e0aba0a9d4b9ff1a8bcf3bd73d77b8958066c.zip
r24807: Add WINBINDD_LOCATOR_KDC_ADDRESS env which will be used for the case when the
locator gets called from within winbindd. Guenther (This used to be commit 46dbd6034ec2c6475f428cd2d5cce56268bc34a7)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_nss.h1
-rw-r--r--source3/nsswitch/winbindd_util.c33
2 files changed, 34 insertions, 0 deletions
diff --git a/source3/nsswitch/winbindd_nss.h b/source3/nsswitch/winbindd_nss.h
index 46f78ffbe6..eadbb0e8ba 100644
--- a/source3/nsswitch/winbindd_nss.h
+++ b/source3/nsswitch/winbindd_nss.h
@@ -39,6 +39,7 @@
#define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged" /* name of subdirectory of lp_lockdir() to hold the 'privileged' pipe */
#define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
#define WINBINDD_DONT_ENV "_NO_WINBINDD"
+#define WINBINDD_LOCATOR_KDC_ADDRESS "WINBINDD_LOCATOR_KDC_ADDRESS"
/* Update this when you change the interface. */
diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c
index d12dff0932..225c6b5be1 100644
--- a/source3/nsswitch/winbindd_util.c
+++ b/source3/nsswitch/winbindd_util.c
@@ -1365,3 +1365,36 @@ BOOL winbindd_internal_child(struct winbindd_child *child)
return False;
}
+
+/*********************************************************************
+ ********************************************************************/
+
+void winbindd_set_locator_kdc_env(const struct winbindd_domain *domain)
+{
+ char *var = NULL;
+ const char *kdc = NULL;
+
+ if (!domain) {
+ return;
+ }
+
+ kdc = inet_ntoa(domain->dcaddr.sin_addr);
+ if (!kdc) {
+ kdc = domain->dcname;
+ }
+
+ if (!kdc || !*kdc) {
+ return;
+ }
+
+ if (asprintf(&var, "%s_%s", WINBINDD_LOCATOR_KDC_ADDRESS,
+ strupper_static(domain->alt_name)) == -1) {
+ return;
+ }
+
+ DEBUG(10,("winbindd_set_locator_kdc_env: setting var: %s to: %s\n",
+ var, kdc));
+
+ setenv(var, kdc, 1);
+ free(var);
+}