clean up some debug logging

This commit is contained in:
Grant Limberg 2020-08-12 09:16:18 -07:00
parent 137d05e799
commit 30b18d925f
No known key found for this signature in database
GPG Key ID: 2BA62CCABBB4095A
4 changed files with 1 additions and 19 deletions

View File

@ -9,8 +9,6 @@ namespace ZeroTier {
class MacDNSHelper
{
public:
static void doTheThing();
static void setDNS(uint64_t nwid, const char *domain, const std::vector<InetAddress> &servers);
static void removeDNS(uint64_t nwid);
};

View File

@ -6,11 +6,6 @@
namespace ZeroTier {
void MacDNSHelper::doTheThing()
{
fprintf(stderr, "\n\nDOING THE THING!!\n\n");
}
void MacDNSHelper::setDNS(uint64_t nwid, const char *domain, const std::vector<InetAddress> &servers)
{
SCDynamicStoreRef ds = SCDynamicStoreCreate(NULL, CFSTR("zerotier"), NULL, NULL);
@ -49,15 +44,11 @@ void MacDNSHelper::setDNS(uint64_t nwid, const char *domain, const std::vector<I
CFIndex i = 0, j = CFArrayGetCount(list);
bool ret = TRUE;
if (j <= 0) {
fprintf(stderr, "Key '%s' does not exist. Creating.\n", buf);
ret &= SCDynamicStoreAddValue(ds, key, dict);
} else {
fprintf(stderr, "Key '%s' already exists. Updating DNS config.\n", buf);
ret &= SCDynamicStoreSetValue(ds, (CFStringRef)CFArrayGetValueAtIndex(list, i), dict);
}
if (ret) {
fprintf(stderr, "DNS written successfully\n");
} else {
if (!ret) {
fprintf(stderr, "Error writing DNS configuration\n");
}

View File

@ -458,7 +458,6 @@ void MacEthernetTap::threadMain()
void MacEthernetTap::setDns(const char *domain, const std::vector<InetAddress> &servers)
{
MacDNSHelper::doTheThing();
MacDNSHelper::setDNS(this->_nwid, domain, servers);
}

View File

@ -36,11 +36,9 @@ BOOL RegDelnodeRecurse(HKEY hKeyRoot, LPTSTR lpSubKey)
if (lResult != ERROR_SUCCESS)
{
if (lResult == ERROR_FILE_NOT_FOUND) {
printf("Key not found.\n");
return TRUE;
}
else {
printf("Error opening key.\n");
return FALSE;
}
}
@ -160,7 +158,6 @@ std::vector<std::string> getSubKeys(const char* key)
&cbSecurityDescriptor, // security descriptor
&ftLastWriteTime); // last write time
fprintf(stderr, "num subkeys: %d\n", cSubKeys);
for (i = 0; i < cSubKeys; ++i) {
cbName = MAX_KEY_LENGTH;
retCode = RegEnumKeyEx(
@ -222,7 +219,6 @@ std::vector<std::string> getValueList(const char* key) {
&cbSecurityDescriptor, // security descriptor
&ftLastWriteTime); // last write time
fprintf(stderr, "Num values: %d\n", cValues);
for (i = 0, retCode = ERROR_SUCCESS; i < cValues; ++i) {
cchValue = MAX_VALUE_NAME;
achValue[0] = '\0';
@ -254,10 +250,8 @@ std::pair<bool, std::string> WinDNSHelper::hasDNSConfig(uint64_t nwid)
for (auto it = subkeys.begin(); it != subkeys.end(); ++it) {
char sub[MAX_KEY_LENGTH] = { 0 };
sprintf(sub, "%s\\%s", baseKey, it->c_str());
fprintf(stderr, "Checking key: %s\n", sub);
auto dnsRecords = getValueList(sub);
for (auto it2 = dnsRecords.begin(); it2 != dnsRecords.end(); ++it2) {
fprintf(stderr, "\t%s\n", it2->c_str());
if ((*it2) == "Comment") {
HKEY hKey;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,