Commit ca9fb894 authored by Joel Rennich's avatar Joel Rennich

cliTask "solution" for finding the interface used for the domain

parent 43e0e9fb
......@@ -509,6 +509,20 @@ class LDAPServers : NSObject, DNSResolverDelegate {
}
private func getInterfaceMatchingDomain(domain: String) -> String? {
// TODO: Replace cliTask
// not the best looking code, but it works
let interfaceRaw = cliTask("/sbin/route get " + domain )
if interfaceRaw.containsString("interface") {
for line in interfaceRaw.componentsSeparatedByString("\n") {
if line.containsString("interface") {
myLogger.logit(3, message: line)
return line.stringByReplacingOccurrencesOfString(" interface: ", withString: "").stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
}
}
}
var interfaceName: String? = nil
myLogger.logit(2, message: "Trying to get interface with search domain of \(domain)")
let searchDomainKeys = SCDynamicStoreCopyKeyList(store, "State:/Network/Service/.*/DNS")! as Array
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment