Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Kerberos.NET/Client/Transport/ClientDomainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ public virtual async Task<IEnumerable<DnsRecord>> LocateKdc(string domain, strin
var results = await this.Query(domain, servicePrefix, DefaultKerberosPort);

results = ParseQuerySrvReply(results);

if (this.Configuration.Defaults.PrioritizeKdcByConfigurationOrder)
{
return results;
}
return await WeightResults(results);
}

Expand Down Expand Up @@ -266,15 +269,16 @@ private async Task QueryDns(string domain, string servicePrefix, List<DnsRecord>
}
}

private static DnsRecord ParseKdcEntryAsSrvRecord(string kdc, string realm, string servicePrefix, int defaultPort)
private DnsRecord ParseKdcEntryAsSrvRecord(string kdc, string realm, string servicePrefix, int defaultPort)
{
if (IsUri(kdc))
{
return new DnsRecord
{
Target = kdc,
Type = DnsRecordType.SRV,
Name = realm
Name = realm,
TimeToLive = this.Configuration.Defaults.ConfiguredKdcTimeToLive
};
}

Expand All @@ -284,7 +288,8 @@ private static DnsRecord ParseKdcEntryAsSrvRecord(string kdc, string realm, stri
{
Target = split[0],
Type = DnsRecordType.SRV,
Name = $"{servicePrefix}.{realm}"
Name = $"{servicePrefix}.{realm}",
TimeToLive = this.Configuration.Defaults.ConfiguredKdcTimeToLive
};

if (split.Length > 1)
Expand Down
14 changes: 14 additions & 0 deletions Kerberos.NET/Configuration/Krb5ConfigDefaults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,19 @@ public class Krb5ConfigDefaults : Krb5ConfigObject
[DefaultValue(true)]
[DisplayName("prioritize_by_response_time")]
public bool PrioritizeKdcByPing { get; set; }

/// <summary>
/// Indicates whether the client should try to utilze the order of KDCs as they are listed in the configuration when attempting to contact them, rather than trying to ping them first.
/// </summary>
[DefaultValue(false)]
[DisplayName("prioritize_by_configuration_order")]
public bool PrioritizeKdcByConfigurationOrder { get; set; }

/// <summary>
/// When attempting various KDCs this is how long a given KDC can be listed in the negative cache in seconds.
/// </summary>
[DefaultValue(0)]
[DisplayName("configured_kdc_time_to_live")]
public int ConfiguredKdcTimeToLive { get; set; }
}
}