Author: abartlet Date: 2005-09-20 07:03:47 +0000 (Tue, 20 Sep 2005) New Revision: 10337
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10337 Log: This grubby little hack is the implementation of a concept discussed on the kerberos mailing lists a couple of weeks ago: Don't use DNS at all for expanding short names into long names. Using the 'override krb5_init_context' code already in the tree, this removes the DNS lag on a kerberos session setup/connection. Andrew Bartlett Modified: branches/SAMBA_4_0/source/auth/kerberos/krb5_init_context.c branches/SAMBA_4_0/source/heimdal/lib/krb5/context.c branches/SAMBA_4_0/source/heimdal/lib/krb5/expand_hostname.c branches/SAMBA_4_0/source/heimdal/lib/krb5/krb5.h Changeset: Modified: branches/SAMBA_4_0/source/auth/kerberos/krb5_init_context.c =================================================================== --- branches/SAMBA_4_0/source/auth/kerberos/krb5_init_context.c 2005-09-20 00:39:19 UTC (rev 10336) +++ branches/SAMBA_4_0/source/auth/kerberos/krb5_init_context.c 2005-09-20 07:03:47 UTC (rev 10337) @@ -117,6 +117,11 @@ talloc_steal(parent_ctx, *smb_krb5_context); talloc_free(tmp_ctx); + + /* Set options in kerberos */ + + (*smb_krb5_context)->krb5_context->fdns = FALSE; + return 0; } Modified: branches/SAMBA_4_0/source/heimdal/lib/krb5/context.c =================================================================== --- branches/SAMBA_4_0/source/heimdal/lib/krb5/context.c 2005-09-20 00:39:19 UTC (rev 10336) +++ branches/SAMBA_4_0/source/heimdal/lib/krb5/context.c 2005-09-20 07:03:47 UTC (rev 10337) @@ -182,6 +182,7 @@ INIT_FIELD(context, bool, srv_lookup, context->srv_lookup, "dns_lookup_kdc"); INIT_FIELD(context, int, large_msg_size, 6000, "large_message_size"); context->default_cc_name = NULL; + INIT_FIELD(context, bool, fdns, TRUE, "fdns"); return 0; } Modified: branches/SAMBA_4_0/source/heimdal/lib/krb5/expand_hostname.c =================================================================== --- branches/SAMBA_4_0/source/heimdal/lib/krb5/expand_hostname.c 2005-09-20 00:39:19 UTC (rev 10336) +++ branches/SAMBA_4_0/source/heimdal/lib/krb5/expand_hostname.c 2005-09-20 07:03:47 UTC (rev 10337) @@ -65,6 +65,10 @@ memset (&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; + if (!context->fdns) { + return copy_hostname (context, orig_hostname, new_hostname); + } + error = getaddrinfo (orig_hostname, NULL, &hints, &ai); if (error) return copy_hostname (context, orig_hostname, new_hostname); @@ -124,6 +128,11 @@ int error; krb5_error_code ret = 0; + if (!context->fdns) { + return vanilla_hostname (context, orig_hostname, new_hostname, + realms); + } + memset (&hints, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; Modified: branches/SAMBA_4_0/source/heimdal/lib/krb5/krb5.h =================================================================== --- branches/SAMBA_4_0/source/heimdal/lib/krb5/krb5.h 2005-09-20 00:39:19 UTC (rev 10336) +++ branches/SAMBA_4_0/source/heimdal/lib/krb5/krb5.h 2005-09-20 07:03:47 UTC (rev 10337) @@ -443,6 +443,7 @@ int pkinit_flags; void *mutex; /* protects error_string/error_buf */ int large_msg_size; + krb5_boolean fdns; /* Lookup hostnames to find full name, or send as-is */ } krb5_context_data; enum {