mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-18 20:47:53 +00:00
clean up some debug logging
This commit is contained in:
parent
137d05e799
commit
30b18d925f
@ -9,8 +9,6 @@ namespace ZeroTier {
|
|||||||
class MacDNSHelper
|
class MacDNSHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void doTheThing();
|
|
||||||
|
|
||||||
static void setDNS(uint64_t nwid, const char *domain, const std::vector<InetAddress> &servers);
|
static void setDNS(uint64_t nwid, const char *domain, const std::vector<InetAddress> &servers);
|
||||||
static void removeDNS(uint64_t nwid);
|
static void removeDNS(uint64_t nwid);
|
||||||
};
|
};
|
||||||
|
@ -6,11 +6,6 @@
|
|||||||
|
|
||||||
namespace ZeroTier {
|
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)
|
void MacDNSHelper::setDNS(uint64_t nwid, const char *domain, const std::vector<InetAddress> &servers)
|
||||||
{
|
{
|
||||||
SCDynamicStoreRef ds = SCDynamicStoreCreate(NULL, CFSTR("zerotier"), NULL, NULL);
|
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);
|
CFIndex i = 0, j = CFArrayGetCount(list);
|
||||||
bool ret = TRUE;
|
bool ret = TRUE;
|
||||||
if (j <= 0) {
|
if (j <= 0) {
|
||||||
fprintf(stderr, "Key '%s' does not exist. Creating.\n", buf);
|
|
||||||
ret &= SCDynamicStoreAddValue(ds, key, dict);
|
ret &= SCDynamicStoreAddValue(ds, key, dict);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Key '%s' already exists. Updating DNS config.\n", buf);
|
|
||||||
ret &= SCDynamicStoreSetValue(ds, (CFStringRef)CFArrayGetValueAtIndex(list, i), dict);
|
ret &= SCDynamicStoreSetValue(ds, (CFStringRef)CFArrayGetValueAtIndex(list, i), dict);
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (!ret) {
|
||||||
fprintf(stderr, "DNS written successfully\n");
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Error writing DNS configuration\n");
|
fprintf(stderr, "Error writing DNS configuration\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +458,6 @@ void MacEthernetTap::threadMain()
|
|||||||
|
|
||||||
void MacEthernetTap::setDns(const char *domain, const std::vector<InetAddress> &servers)
|
void MacEthernetTap::setDns(const char *domain, const std::vector<InetAddress> &servers)
|
||||||
{
|
{
|
||||||
MacDNSHelper::doTheThing();
|
|
||||||
MacDNSHelper::setDNS(this->_nwid, domain, servers);
|
MacDNSHelper::setDNS(this->_nwid, domain, servers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,11 +36,9 @@ BOOL RegDelnodeRecurse(HKEY hKeyRoot, LPTSTR lpSubKey)
|
|||||||
if (lResult != ERROR_SUCCESS)
|
if (lResult != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (lResult == ERROR_FILE_NOT_FOUND) {
|
if (lResult == ERROR_FILE_NOT_FOUND) {
|
||||||
printf("Key not found.\n");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("Error opening key.\n");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,7 +158,6 @@ std::vector<std::string> getSubKeys(const char* key)
|
|||||||
&cbSecurityDescriptor, // security descriptor
|
&cbSecurityDescriptor, // security descriptor
|
||||||
&ftLastWriteTime); // last write time
|
&ftLastWriteTime); // last write time
|
||||||
|
|
||||||
fprintf(stderr, "num subkeys: %d\n", cSubKeys);
|
|
||||||
for (i = 0; i < cSubKeys; ++i) {
|
for (i = 0; i < cSubKeys; ++i) {
|
||||||
cbName = MAX_KEY_LENGTH;
|
cbName = MAX_KEY_LENGTH;
|
||||||
retCode = RegEnumKeyEx(
|
retCode = RegEnumKeyEx(
|
||||||
@ -222,7 +219,6 @@ std::vector<std::string> getValueList(const char* key) {
|
|||||||
&cbSecurityDescriptor, // security descriptor
|
&cbSecurityDescriptor, // security descriptor
|
||||||
&ftLastWriteTime); // last write time
|
&ftLastWriteTime); // last write time
|
||||||
|
|
||||||
fprintf(stderr, "Num values: %d\n", cValues);
|
|
||||||
for (i = 0, retCode = ERROR_SUCCESS; i < cValues; ++i) {
|
for (i = 0, retCode = ERROR_SUCCESS; i < cValues; ++i) {
|
||||||
cchValue = MAX_VALUE_NAME;
|
cchValue = MAX_VALUE_NAME;
|
||||||
achValue[0] = '\0';
|
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) {
|
for (auto it = subkeys.begin(); it != subkeys.end(); ++it) {
|
||||||
char sub[MAX_KEY_LENGTH] = { 0 };
|
char sub[MAX_KEY_LENGTH] = { 0 };
|
||||||
sprintf(sub, "%s\\%s", baseKey, it->c_str());
|
sprintf(sub, "%s\\%s", baseKey, it->c_str());
|
||||||
fprintf(stderr, "Checking key: %s\n", sub);
|
|
||||||
auto dnsRecords = getValueList(sub);
|
auto dnsRecords = getValueList(sub);
|
||||||
for (auto it2 = dnsRecords.begin(); it2 != dnsRecords.end(); ++it2) {
|
for (auto it2 = dnsRecords.begin(); it2 != dnsRecords.end(); ++it2) {
|
||||||
fprintf(stderr, "\t%s\n", it2->c_str());
|
|
||||||
if ((*it2) == "Comment") {
|
if ((*it2) == "Comment") {
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
|
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
|
||||||
|
Loading…
Reference in New Issue
Block a user