diff options
-rw-r--r-- | service/OneService.cpp | 25 | ||||
-rw-r--r-- | windows/ZeroTierOne/ZeroTierOne.vcxproj | 4 | ||||
-rw-r--r-- | windows/ZeroTierOne/ZeroTierOne.vcxproj.filters | 12 |
3 files changed, 28 insertions, 13 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index 804e3d36..0825705f 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -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); - - 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()); + Dictionary<4096> nfo(body.c_str()); + char tmp[2048]; + + 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 ca910372..ed022134 100644 --- a/windows/ZeroTierOne/ZeroTierOne.vcxproj +++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj @@ -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" /> diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters index ed1e941e..eeeb8d2f 100644 --- a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters +++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters @@ -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"> |