mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
Compile fixes.
This commit is contained in:
parent
33c8d3c50b
commit
91ca238163
@ -41,9 +41,10 @@
|
|||||||
#include "../node/Utils.hpp"
|
#include "../node/Utils.hpp"
|
||||||
#include "../node/CertificateOfMembership.hpp"
|
#include "../node/CertificateOfMembership.hpp"
|
||||||
#include "../node/NetworkConfig.hpp"
|
#include "../node/NetworkConfig.hpp"
|
||||||
|
#include "../osdep/OSUtils.hpp"
|
||||||
|
|
||||||
// Include ZT_NETCONF_SCHEMA_SQL constant to init database
|
// Include ZT_NETCONF_SCHEMA_SQL constant to init database
|
||||||
#include "netconf-schema.sql.c"
|
#include "schema.sql.c"
|
||||||
|
|
||||||
// Stored in database as schemaVersion key in Config.
|
// Stored in database as schemaVersion key in Config.
|
||||||
// If not present, database is assumed to be empty and at the current schema version
|
// If not present, database is assumed to be empty and at the current schema version
|
||||||
@ -181,7 +182,7 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
|
|||||||
Identity alreadyKnownIdentity((const char *)sqlite3_column_text(_sGetNodeIdentity,0));
|
Identity alreadyKnownIdentity((const char *)sqlite3_column_text(_sGetNodeIdentity,0));
|
||||||
if (alreadyKnownIdentity == identity) {
|
if (alreadyKnownIdentity == identity) {
|
||||||
char lastSeen[64];
|
char lastSeen[64];
|
||||||
Utils::snprintf(lastSeen,sizeof(lastSeen),"%llu",(unsigned long long)Utils::now());
|
Utils::snprintf(lastSeen,sizeof(lastSeen),"%llu",(unsigned long long)OSUtils::now());
|
||||||
if (fromAddr) {
|
if (fromAddr) {
|
||||||
std::string lastAt(fromAddr.toString());
|
std::string lastAt(fromAddr.toString());
|
||||||
sqlite3_reset(_sUpdateNode);
|
sqlite3_reset(_sUpdateNode);
|
||||||
@ -207,7 +208,7 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
|
|||||||
if (fromAddr)
|
if (fromAddr)
|
||||||
lastAt = fromAddr.toString();
|
lastAt = fromAddr.toString();
|
||||||
char lastSeen[64];
|
char lastSeen[64];
|
||||||
Utils::snprintf(lastSeen,sizeof(lastSeen),"%llu",(unsigned long long)Utils::now());
|
Utils::snprintf(lastSeen,sizeof(lastSeen),"%llu",(unsigned long long)OSUtils::now());
|
||||||
sqlite3_reset(_sCreateNode);
|
sqlite3_reset(_sCreateNode);
|
||||||
sqlite3_bind_text(_sCreateNode,1,member.nodeId,10,SQLITE_STATIC);
|
sqlite3_bind_text(_sCreateNode,1,member.nodeId,10,SQLITE_STATIC);
|
||||||
sqlite3_bind_text(_sCreateNode,2,idstr.c_str(),-1,SQLITE_STATIC);
|
sqlite3_bind_text(_sCreateNode,2,idstr.c_str(),-1,SQLITE_STATIC);
|
||||||
@ -304,7 +305,7 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
|
|||||||
// Create and sign a new netconf, and save in database to re-use in the future
|
// Create and sign a new netconf, and save in database to re-use in the future
|
||||||
|
|
||||||
char tss[24],rs[24];
|
char tss[24],rs[24];
|
||||||
Utils::snprintf(tss,sizeof(tss),"%.16llx",(unsigned long long)Utils::now());
|
Utils::snprintf(tss,sizeof(tss),"%.16llx",(unsigned long long)OSUtils::now());
|
||||||
Utils::snprintf(rs,sizeof(rs),"%.16llx",(unsigned long long)network.revision);
|
Utils::snprintf(rs,sizeof(rs),"%.16llx",(unsigned long long)network.revision);
|
||||||
netconf[ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP] = tss;
|
netconf[ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP] = tss;
|
||||||
netconf[ZT_NETWORKCONFIG_DICT_KEY_REVISION] = rs;
|
netconf[ZT_NETWORKCONFIG_DICT_KEY_REVISION] = rs;
|
||||||
@ -458,7 +459,7 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!netconf.sign(signingId)) {
|
if (!netconf.sign(signingId,OSUtils::now())) {
|
||||||
netconf["error"] = "unable to sign netconf dictionary";
|
netconf["error"] = "unable to sign netconf dictionary";
|
||||||
return NETCONF_QUERY_INTERNAL_SERVER_ERROR;
|
return NETCONF_QUERY_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
4
one.cpp
4
one.cpp
@ -715,10 +715,10 @@ int main(int argc,char **argv)
|
|||||||
try {
|
try {
|
||||||
controller = new SqliteNetworkController((homeDir + ZT_PATH_SEPARATOR_S + ZT1_CONTROLLER_DB_PATH).c_str());
|
controller = new SqliteNetworkController((homeDir + ZT_PATH_SEPARATOR_S + ZT1_CONTROLLER_DB_PATH).c_str());
|
||||||
} catch (std::exception &exc) {
|
} catch (std::exception &exc) {
|
||||||
fprintf(stderr,"%s: failure initializing SqliteNetworkController: %s"ZT_EOL_S,exc.what());
|
fprintf(stderr,"%s: failure initializing SqliteNetworkController: %s"ZT_EOL_S,argv[0],exc.what());
|
||||||
return 1;
|
return 1;
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
fprintf(stderr,"%s: failure initializing SqliteNetworkController: unknown exception"ZT_EOL_S);
|
fprintf(stderr,"%s: failure initializing SqliteNetworkController: unknown exception"ZT_EOL_S,argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif // ZT_ENABLE_NETWORK_CONTROLLER
|
#endif // ZT_ENABLE_NETWORK_CONTROLLER
|
||||||
|
Loading…
Reference in New Issue
Block a user