mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-18 17:00:17 +00:00
Fix ZT_SSO_SUPPORTED flag behavior. Allow disabling for embedded targets.
This commit is contained in:
parent
eca645fc52
commit
1294767b44
@ -1,12 +1,12 @@
|
|||||||
# Automagically pick CLANG or RH/CentOS newer GCC if present
|
# Automagically pick CLANG or RH/CentOS newer GCC if present
|
||||||
# This is only done if we have not overridden these with an environment or CLI variable
|
# This is only done if we have not overridden these with an environment or CLI variable
|
||||||
ifeq ($(origin CC),default)
|
ifeq ($(origin CC),default)
|
||||||
CC:=$(shell if [ -e /usr/bin/clang ]; then echo clang; else echo gcc; fi)
|
CC:=$(shell if [ -e /usr/bin/clang ]; then echo clang; else echo gcc; fi)
|
||||||
CC:=$(shell if [ -e /opt/rh/devtoolset-8/root/usr/bin/gcc ]; then echo /opt/rh/devtoolset-8/root/usr/bin/gcc; else echo $(CC); fi)
|
CC:=$(shell if [ -e /opt/rh/devtoolset-8/root/usr/bin/gcc ]; then echo /opt/rh/devtoolset-8/root/usr/bin/gcc; else echo $(CC); fi)
|
||||||
endif
|
endif
|
||||||
ifeq ($(origin CXX),default)
|
ifeq ($(origin CXX),default)
|
||||||
CXX:=$(shell if [ -e /usr/bin/clang++ ]; then echo clang++; else echo g++; fi)
|
CXX:=$(shell if [ -e /usr/bin/clang++ ]; then echo clang++; else echo g++; fi)
|
||||||
CXX:=$(shell if [ -e /opt/rh/devtoolset-8/root/usr/bin/g++ ]; then echo /opt/rh/devtoolset-8/root/usr/bin/g++; else echo $(CXX); fi)
|
CXX:=$(shell if [ -e /opt/rh/devtoolset-8/root/usr/bin/g++ ]; then echo /opt/rh/devtoolset-8/root/usr/bin/g++; else echo $(CXX); fi)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INCLUDES?=-Izeroidc/target
|
INCLUDES?=-Izeroidc/target
|
||||||
@ -75,16 +75,19 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ZT_QNAP), 1)
|
ifeq ($(ZT_QNAP), 1)
|
||||||
override DEFS+=-D__QNAP__
|
override DEFS+=-D__QNAP__
|
||||||
|
ZT_EMBEDDED=1
|
||||||
endif
|
endif
|
||||||
ifeq ($(ZT_UBIQUITI), 1)
|
ifeq ($(ZT_UBIQUITI), 1)
|
||||||
override DEFS+=-D__UBIQUITI__
|
override DEFS+=-D__UBIQUITI__
|
||||||
|
ZT_EMBEDDED=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ZT_SYNOLOGY), 1)
|
ifeq ($(ZT_SYNOLOGY), 1)
|
||||||
override CFLAGS+=-fPIC
|
override CFLAGS+=-fPIC
|
||||||
override CXXFLAGS+=-fPIC
|
override CXXFLAGS+=-fPIC
|
||||||
override DEFS+=-D__SYNOLOGY__
|
override DEFS+=-D__SYNOLOGY__
|
||||||
|
ZT_EMBEDDED=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ZT_DISABLE_COMPRESSION), 1)
|
ifeq ($(ZT_DISABLE_COMPRESSION), 1)
|
||||||
@ -213,9 +216,9 @@ ifeq ($(CC_MACH),armv7hl)
|
|||||||
ZT_USE_ARM32_NEON_ASM_CRYPTO=1
|
ZT_USE_ARM32_NEON_ASM_CRYPTO=1
|
||||||
endif
|
endif
|
||||||
ifeq ($(CC_MACH),armv7ve)
|
ifeq ($(CC_MACH),armv7ve)
|
||||||
ZT_ARCHITECTURE=3
|
ZT_ARCHITECTURE=3
|
||||||
override DEFS+=-DZT_NO_TYPE_PUNNING
|
override DEFS+=-DZT_NO_TYPE_PUNNING
|
||||||
ZT_USE_ARM32_NEON_ASM_CRYPTO=1
|
ZT_USE_ARM32_NEON_ASM_CRYPTO=1
|
||||||
endif
|
endif
|
||||||
ifeq ($(CC_MACH),arm64)
|
ifeq ($(CC_MACH),arm64)
|
||||||
ZT_ARCHITECTURE=4
|
ZT_ARCHITECTURE=4
|
||||||
@ -268,10 +271,13 @@ ifeq ($(ZT_IA32),1)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ZT_SSO_SUPPORTED), 1)
|
ifeq ($(ZT_SSO_SUPPORTED), 1)
|
||||||
ifeq ($(ZT_DEBUG),1)
|
ifeq ($(ZT_EMBEDDED),)
|
||||||
LDLIBS+=zeroidc/target/debug/libzeroidc.a -ldl -lssl -lcrypto
|
override DEFS+=-DZT_SSO_SUPPORTED=1
|
||||||
else
|
ifeq ($(ZT_DEBUG),1)
|
||||||
LDLIBS+=zeroidc/target/release/libzeroidc.a -ldl -lssl -lcrypto
|
LDLIBS+=zeroidc/target/debug/libzeroidc.a -ldl -lssl -lcrypto
|
||||||
|
else
|
||||||
|
LDLIBS+=zeroidc/target/release/libzeroidc.a -ldl -lssl -lcrypto
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -384,9 +390,11 @@ debug: FORCE
|
|||||||
make ZT_DEBUG=1 selftest
|
make ZT_DEBUG=1 selftest
|
||||||
|
|
||||||
ifeq ($(ZT_SSO_SUPPORTED), 1)
|
ifeq ($(ZT_SSO_SUPPORTED), 1)
|
||||||
|
ifeq ($(ZT_EMBEDDED),)
|
||||||
zeroidc: FORCE
|
zeroidc: FORCE
|
||||||
# export PATH=/root/.cargo/bin:$$PATH; cd zeroidc && cargo build -j1 $(RUSTFLAGS)
|
# export PATH=/root/.cargo/bin:$$PATH; cd zeroidc && cargo build -j1 $(RUSTFLAGS)
|
||||||
export PATH=/root/.cargo/bin:$$PATH; cd zeroidc && cargo build $(RUSTFLAGS)
|
export PATH=/root/.cargo/bin:$$PATH; cd zeroidc && cargo build $(RUSTFLAGS)
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
zeroidc:
|
zeroidc:
|
||||||
endif
|
endif
|
||||||
|
@ -50,16 +50,17 @@
|
|||||||
#define __UNIX_LIKE__
|
#define __UNIX_LIKE__
|
||||||
#endif
|
#endif
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
|
|
||||||
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64) || defined(__aarch64__))
|
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64) || defined(__aarch64__))
|
||||||
#define OIDC_SUPPORTED 1
|
#ifdef ZT_SSO_SUPPORTED
|
||||||
#else
|
#define ZT_SSO_ENABLED 1
|
||||||
#define OIDC_SUPPORTED 0
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define OIDC_SUPPORTED 1
|
#ifdef ZT_SSO_SUPPORTED
|
||||||
|
#define ZT_SSO_ENABLED 1
|
||||||
|
#endif
|
||||||
#define likely(x) __builtin_expect((x),1)
|
#define likely(x) __builtin_expect((x),1)
|
||||||
#define unlikely(x) __builtin_expect((x),0)
|
#define unlikely(x) __builtin_expect((x),0)
|
||||||
#include <TargetConditionals.h>
|
#include <TargetConditionals.h>
|
||||||
@ -73,7 +74,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
#define OIDC_SUPPORTED 0
|
#ifdef ZT_SSO_SUPPORTED
|
||||||
|
#define ZT_SSO_ENABLED 0
|
||||||
|
#endif
|
||||||
#ifndef __UNIX_LIKE__
|
#ifndef __UNIX_LIKE__
|
||||||
#define __UNIX_LIKE__
|
#define __UNIX_LIKE__
|
||||||
#endif
|
#endif
|
||||||
@ -89,7 +92,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
#define OIDC_SUPPORTED 1
|
#ifdef ZT_SSO_SUPPORTED
|
||||||
|
#define ZT_SSO_ENABLED 1
|
||||||
|
#endif
|
||||||
#ifndef __WINDOWS__
|
#ifndef __WINDOWS__
|
||||||
#define __WINDOWS__
|
#define __WINDOWS__
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#include "OneService.hpp"
|
#include "OneService.hpp"
|
||||||
#include "SoftwareUpdater.hpp"
|
#include "SoftwareUpdater.hpp"
|
||||||
|
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
#include <zeroidc.h>
|
#include <zeroidc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ public:
|
|||||||
NetworkState()
|
NetworkState()
|
||||||
: _webPort(9993)
|
: _webPort(9993)
|
||||||
, _tap((EthernetTap *)0)
|
, _tap((EthernetTap *)0)
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
, _idc(nullptr)
|
, _idc(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -212,7 +212,7 @@ public:
|
|||||||
this->_managedRoutes.clear();
|
this->_managedRoutes.clear();
|
||||||
this->_tap.reset();
|
this->_tap.reset();
|
||||||
|
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
if (_idc) {
|
if (_idc) {
|
||||||
zeroidc::zeroidc_stop(_idc);
|
zeroidc::zeroidc_stop(_idc);
|
||||||
zeroidc::zeroidc_delete(_idc);
|
zeroidc::zeroidc_delete(_idc);
|
||||||
@ -296,7 +296,7 @@ public:
|
|||||||
|
|
||||||
if (_config.ssoEnabled && _config.ssoVersion == 1) {
|
if (_config.ssoEnabled && _config.ssoVersion == 1) {
|
||||||
// fprintf(stderr, "ssoEnabled for %s\n", nwid);
|
// fprintf(stderr, "ssoEnabled for %s\n", nwid);
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
if (_idc == nullptr)
|
if (_idc == nullptr)
|
||||||
{
|
{
|
||||||
assert(_config.issuerURL != nullptr);
|
assert(_config.issuerURL != nullptr);
|
||||||
@ -353,7 +353,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* getAuthURL() {
|
const char* getAuthURL() {
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
if (_idc != nullptr) {
|
if (_idc != nullptr) {
|
||||||
return zeroidc::zeroidc_get_auth_url(_idc);
|
return zeroidc::zeroidc_get_auth_url(_idc);
|
||||||
}
|
}
|
||||||
@ -363,7 +363,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* doTokenExchange(const char *code) {
|
const char* doTokenExchange(const char *code) {
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
if (_idc == nullptr) {
|
if (_idc == nullptr) {
|
||||||
fprintf(stderr, "ainfo or idc null\n");
|
fprintf(stderr, "ainfo or idc null\n");
|
||||||
return "";
|
return "";
|
||||||
@ -386,7 +386,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getExpiryTime() {
|
uint64_t getExpiryTime() {
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
if (_idc == nullptr) {
|
if (_idc == nullptr) {
|
||||||
fprintf(stderr, "idc is null\n");
|
fprintf(stderr, "idc is null\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -404,7 +404,7 @@ private:
|
|||||||
std::vector<InetAddress> _managedIps;
|
std::vector<InetAddress> _managedIps;
|
||||||
std::map< InetAddress, SharedPtr<ManagedRoute> > _managedRoutes;
|
std::map< InetAddress, SharedPtr<ManagedRoute> > _managedRoutes;
|
||||||
OneService::NetworkSettings _settings;
|
OneService::NetworkSettings _settings;
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
zeroidc::ZeroIDC *_idc;
|
zeroidc::ZeroIDC *_idc;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -1707,7 +1707,7 @@ public:
|
|||||||
scode = _controller->handleControlPlaneHttpGET(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType);
|
scode = _controller->handleControlPlaneHttpGET(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType);
|
||||||
} else scode = 404;
|
} else scode = 404;
|
||||||
}
|
}
|
||||||
#if OIDC_SUPPORTED
|
#if ZT_SSO_ENABLED
|
||||||
} else if (ps[0] == "sso") {
|
} else if (ps[0] == "sso") {
|
||||||
char resBuf[4096] = {0};
|
char resBuf[4096] = {0};
|
||||||
const char *error = zeroidc::zeroidc_get_url_param_value("error", path.c_str());
|
const char *error = zeroidc::zeroidc_get_url_param_value("error", path.c_str());
|
||||||
@ -2310,11 +2310,11 @@ public:
|
|||||||
fprintf(stderr,"ERROR: unable to add ip address %s" ZT_EOL_S, ip->toString(ipbuf));
|
fprintf(stderr,"ERROR: unable to add ip address %s" ZT_EOL_S, ip->toString(ipbuf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (!MacDNSHelper::addIps(n.config().nwid, n.config().mac, n.tap()->deviceName().c_str(), newManagedIps))
|
if (!MacDNSHelper::addIps(n.config().nwid, n.config().mac, n.tap()->deviceName().c_str(), newManagedIps))
|
||||||
fprintf(stderr, "ERROR: unable to add v6 addresses to system configuration" ZT_EOL_S);
|
fprintf(stderr, "ERROR: unable to add v6 addresses to system configuration" ZT_EOL_S);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
n.setManagedIps(newManagedIps);
|
n.setManagedIps(newManagedIps);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user