diff options
-rw-r--r-- | make-linux.mk | 5 | ||||
-rw-r--r-- | make-mac.mk | 7 | ||||
-rw-r--r-- | service/OneService.cpp | 8 |
3 files changed, 19 insertions, 1 deletions
diff --git a/make-linux.mk b/make-linux.mk index 064a4608..8fa70e2f 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -88,6 +88,11 @@ ifeq ($(ZT_USE_TEST_TAP),1) override DEFS+=-DZT_USE_TEST_TAP endif +ifeq ($(ZT_VAULT_SUPPORT),1) + override DEFS+=-DZT_VAULT_SUPPORT=1 + override LDLIBS+=-lcurl +endif + # Uncomment for gprof profile build #CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS) #CXXFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS) diff --git a/make-mac.mk b/make-mac.mk index 60aa465a..1178437a 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -63,6 +63,11 @@ ifeq ($(ZT_TRACE),1) DEFS+=-DZT_TRACE endif +ifeq ($(ZT_VAULT_SUPPORT),1) + DEFS+=-DZT_VAULT_SUPPORT=1 + LIBS+=-lcurl +endif + CXXFLAGS=$(CFLAGS) -std=c++11 -stdlib=libc++ all: one macui @@ -70,7 +75,7 @@ all: one macui ext/x64-salsa2012-asm/salsa2012.o: $(CC) $(CFLAGS) -c ext/x64-salsa2012-asm/salsa2012.s -o ext/x64-salsa2012-asm/salsa2012.o -one: $(CORE_OBJS) $(ONE_OBJS) one.o +one: $(CORE_OBJS) $(ONE_OBJS) one.o $(CXX) $(CXXFLAGS) -o zerotier-one $(CORE_OBJS) $(ONE_OBJS) one.o $(LIBS) $(STRIP) zerotier-one ln -sf zerotier-one zerotier-idtool diff --git a/service/OneService.cpp b/service/OneService.cpp index 7013d9dc..7340c954 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -531,10 +531,12 @@ public: #ifdef ZT_USE_MINIUPNPC ,_portMapper((PortMapper *)0) #endif +#ifdef ZT_VAULT_SUPPORT ,_vaultEnabled(false) ,_vaultURL() ,_vaultToken() ,_vaultPath("cubbyhole/zerotier") +#endif ,_run(true) { _ports[0] = 0; @@ -551,6 +553,10 @@ public: _binder.closeAll(_phy); _phy.close(_localControlSocket4); _phy.close(_localControlSocket6); +#if ZT_VAULT_SUPPORT + curl_global_cleanup(); +#endif + #ifdef ZT_USE_MINIUPNPC delete _portMapper; #endif @@ -1541,6 +1547,7 @@ public: } } +#if ZT_VAULT_SUPPORT json &vault = settings["vault"]; if (vault.is_object()) { const std::string url(OSUtils::jsonString(vault["vaultURL"], "").c_str()); @@ -1579,6 +1586,7 @@ public: if (!_vaultURL.empty() && !_vaultToken.empty()) { _vaultEnabled = true; } +#endif } // Checks if a managed IP or route target is allowed |