Author: gd
Date: 2007-08-31 12:18:21 +0000 (Fri, 31 Aug 2007)
New Revision: 24832

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24832

Log:
In the winbind-locator recursion case, try to pick up the kdc from the
environment.

Guenther

Modified:
   branches/SAMBA_3_2/source/libads/smb_krb5_locator.c
   branches/SAMBA_3_2_0/source/libads/smb_krb5_locator.c


Changeset:
Modified: branches/SAMBA_3_2/source/libads/smb_krb5_locator.c
===================================================================
--- branches/SAMBA_3_2/source/libads/smb_krb5_locator.c 2007-08-31 11:19:09 UTC 
(rev 24831)
+++ branches/SAMBA_3_2/source/libads/smb_krb5_locator.c 2007-08-31 12:18:21 UTC 
(rev 24832)
@@ -335,9 +335,28 @@
                        goto failed;
                }
        } else {
-               /* FIXME: here comes code for locator being called from within
-                * winbind */
-                goto failed;
+               const char *env = NULL;
+               char *var = NULL;
+               if (asprintf(&var, "%s_%s",
+                            WINBINDD_LOCATOR_KDC_ADDRESS, realm) == -1) {
+                       goto failed;
+               }
+               env = getenv(var);
+               if (!env) {
+#ifdef DEBUG_KRB5
+                       fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: "
+                               "failed to get kdc from env %s\n",
+                               (unsigned int)getpid(), var);
+#endif
+                       free(var);
+                       goto failed;
+               }
+               free(var);
+
+               kdc_name = strdup(env);
+               if (!kdc_name) {
+                       goto failed;
+               }
        }
 #ifdef DEBUG_KRB5
        fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: "

Modified: branches/SAMBA_3_2_0/source/libads/smb_krb5_locator.c
===================================================================
--- branches/SAMBA_3_2_0/source/libads/smb_krb5_locator.c       2007-08-31 
11:19:09 UTC (rev 24831)
+++ branches/SAMBA_3_2_0/source/libads/smb_krb5_locator.c       2007-08-31 
12:18:21 UTC (rev 24832)
@@ -335,9 +335,28 @@
                        goto failed;
                }
        } else {
-               /* FIXME: here comes code for locator being called from within
-                * winbind */
-                goto failed;
+               const char *env = NULL;
+               char *var = NULL;
+               if (asprintf(&var, "%s_%s",
+                            WINBINDD_LOCATOR_KDC_ADDRESS, realm) == -1) {
+                       goto failed;
+               }
+               env = getenv(var);
+               if (!env) {
+#ifdef DEBUG_KRB5
+                       fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: "
+                               "failed to get kdc from env %s\n",
+                               (unsigned int)getpid(), var);
+#endif
+                       free(var);
+                       goto failed;
+               }
+               free(var);
+
+               kdc_name = strdup(env);
+               if (!kdc_name) {
+                       goto failed;
+               }
        }
 #ifdef DEBUG_KRB5
        fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: "

Reply via email to