From 5b2d2efb45a856968c7298b00b6cbe08feb66054 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 21 Jun 2016 12:55:43 -0700 Subject: [PATCH] Windows builds again. And there was much rejoicing. --- service/OneService.cpp | 23 ++++++++++++------- windows/ZeroTierOne/ZeroTierOne.vcxproj | 4 +++- .../ZeroTierOne/ZeroTierOne.vcxproj.filters | 12 +++++++--- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/service/OneService.cpp b/service/OneService.cpp index 804e3d36a..0825705f0 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -201,27 +201,33 @@ public: * * file= * signedBy= - * ed25519= + * ed25519= * vMajor= * vMinor= * vRevision= */ - Dictionary nfo(body); + Dictionary<4096> nfo(body.c_str()); + char tmp[2048]; - unsigned int vMajor = Utils::strToUInt(nfo.get("vMajor","0").c_str()); - unsigned int vMinor = Utils::strToUInt(nfo.get("vMinor","0").c_str()); - unsigned int vRevision = Utils::strToUInt(nfo.get("vRevision","0").c_str()); + if (nfo.get("vMajor",tmp,sizeof(tmp)) <= 0) return; + const unsigned int vMajor = Utils::strToUInt(tmp); + if (nfo.get("vMinor",tmp,sizeof(tmp)) <= 0) return; + const unsigned int vMinor = Utils::strToUInt(tmp); + if (nfo.get("vRevision",tmp,sizeof(tmp)) <= 0) return; + const unsigned int vRevision = Utils::strToUInt(tmp); if (Utils::compareVersion(vMajor,vMinor,vRevision,ZEROTIER_ONE_VERSION_MAJOR,ZEROTIER_ONE_VERSION_MINOR,ZEROTIER_ONE_VERSION_REVISION) <= 0) { //fprintf(stderr,"UPDATE %u.%u.%u is not newer than our version\n",vMajor,vMinor,vRevision); return; } + if (nfo.get("signedBy",tmp,sizeof(tmp)) <= 0) return; Identity signedBy; - if ((!signedBy.fromString(nfo.get("signedBy","")))||(!isValidSigningIdentity(signedBy))) { + if ((!signedBy.fromString(tmp))||(!isValidSigningIdentity(signedBy))) { //fprintf(stderr,"UPDATE invalid signedBy or not authorized signing identity.\n"); return; } - std::string filePath(nfo.get("file","")); + if (nfo.get("file",tmp,sizeof(tmp)) <= 0) return; + std::string filePath(tmp); if ((!filePath.length())||(filePath.find("..") != std::string::npos)) return; filePath = httpPath + filePath; @@ -232,7 +238,8 @@ public: return; } - std::string ed25519(Utils::unhex(nfo.get("ed25519",""))); + if (nfo.get("ed25519",tmp,sizeof(tmp)) <= 0) return; + std::string ed25519(Utils::unhex(tmp)); if ((ed25519.length() == 0)||(!signedBy.verify(fileData.data(),(unsigned int)fileData.length(),ed25519.data(),(unsigned int)ed25519.length()))) { //fprintf(stderr,"UPDATE %s failed signature check!\n",filePath.c_str()); return; diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj b/windows/ZeroTierOne/ZeroTierOne.vcxproj index ca9103727..ed022134c 100644 --- a/windows/ZeroTierOne/ZeroTierOne.vcxproj +++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj @@ -42,7 +42,6 @@ - @@ -66,6 +65,7 @@ + @@ -156,7 +156,9 @@ + + diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters index ed1e941e7..eeeb8d2f6 100644 --- a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters +++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters @@ -114,9 +114,6 @@ Source Files\node - - Source Files\node - Source Files\node @@ -252,6 +249,9 @@ Source Files\ext\libnatpmp + + Source Files\osdep + @@ -536,6 +536,12 @@ Header Files\ext\libnatpmp + + Header Files\osdep + + + Header Files\osdep +