Windows builds again. And there was much rejoicing.

This commit is contained in:
Adam Ierymenko 2016-06-21 12:55:43 -07:00
parent 82473c85e0
commit 5b2d2efb45
3 changed files with 27 additions and 12 deletions

View File

@ -201,27 +201,33 @@ public:
*
* file=<filename>
* signedBy=<signing identity>
* ed25519=<ed25519 ECC signature of archive>
* ed25519=<ed25519 ECC signature of archive in hex>
* vMajor=<major version>
* vMinor=<minor version>
* vRevision=<revision> */
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;

View File

@ -42,7 +42,6 @@
<ClCompile Include="..\..\node\CertificateOfMembership.cpp" />
<ClCompile Include="..\..\node\Cluster.cpp" />
<ClCompile Include="..\..\node\DeferredPackets.cpp" />
<ClCompile Include="..\..\node\Dictionary.cpp" />
<ClCompile Include="..\..\node\Identity.cpp" />
<ClCompile Include="..\..\node\IncomingPacket.cpp" />
<ClCompile Include="..\..\node\InetAddress.cpp" />
@ -66,6 +65,7 @@
</ClCompile>
<ClCompile Include="..\..\osdep\BackgroundResolver.cpp" />
<ClCompile Include="..\..\osdep\Http.cpp" />
<ClCompile Include="..\..\osdep\ManagedRoute.cpp" />
<ClCompile Include="..\..\osdep\OSUtils.cpp" />
<ClCompile Include="..\..\osdep\PortMapper.cpp" />
<ClCompile Include="..\..\osdep\WindowsEthernetTap.cpp" />
@ -156,7 +156,9 @@
<ClInclude Include="..\..\node\Utils.hpp" />
<ClInclude Include="..\..\node\World.hpp" />
<ClInclude Include="..\..\osdep\BackgroundResolver.hpp" />
<ClInclude Include="..\..\osdep\Binder.hpp" />
<ClInclude Include="..\..\osdep\Http.hpp" />
<ClInclude Include="..\..\osdep\ManagedRoute.hpp" />
<ClInclude Include="..\..\osdep\OSUtils.hpp" />
<ClInclude Include="..\..\osdep\Phy.hpp" />
<ClInclude Include="..\..\osdep\PortMapper.hpp" />

View File

@ -114,9 +114,6 @@
<ClCompile Include="..\..\node\CertificateOfMembership.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Dictionary.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
<ClCompile Include="..\..\node\Identity.cpp">
<Filter>Source Files\node</Filter>
</ClCompile>
@ -252,6 +249,9 @@
<ClCompile Include="..\..\ext\libnatpmp\wingettimeofday.c">
<Filter>Source Files\ext\libnatpmp</Filter>
</ClCompile>
<ClCompile Include="..\..\osdep\ManagedRoute.cpp">
<Filter>Source Files\osdep</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
@ -536,6 +536,12 @@
<ClInclude Include="..\..\ext\libnatpmp\wingettimeofday.h">
<Filter>Header Files\ext\libnatpmp</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\Binder.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
<ClInclude Include="..\..\osdep\ManagedRoute.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZeroTierOne.rc">