From 3ed8290e5331011609de462bda67857837998583 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 8 Sep 2017 16:55:27 +0200 Subject: [PATCH] LegacySSHStore: Include signatures etc. --- src/libstore/legacy-ssh-store.cc | 7 +++++++ src/libstore/serve-protocol.hh | 2 +- src/nix-store/nix-store.cc | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc index 855a7c99a..dfefdb9bc 100644 --- a/src/libstore/legacy-ssh-store.cc +++ b/src/libstore/legacy-ssh-store.cc @@ -105,6 +105,13 @@ struct LegacySSHStore : public Store readLongLong(conn->from); // download size info->narSize = readLongLong(conn->from); + if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4) { + auto s = readString(conn->from); + info->narHash = s.empty() ? Hash() : Hash(s); + conn->from >> info->ca; + info->sigs = readStrings(conn->from); + } + auto s = readString(conn->from); assert(s == ""); diff --git a/src/libstore/serve-protocol.hh b/src/libstore/serve-protocol.hh index f8cc9a4b6..f67d1e258 100644 --- a/src/libstore/serve-protocol.hh +++ b/src/libstore/serve-protocol.hh @@ -5,7 +5,7 @@ namespace nix { #define SERVE_MAGIC_1 0x390c9deb #define SERVE_MAGIC_2 0x5452eecb -#define SERVE_PROTOCOL_VERSION 0x203 +#define SERVE_PROTOCOL_VERSION 0x204 #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00) #define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff) diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 1668fdb2d..85bcbc22e 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -858,6 +858,8 @@ static void opServe(Strings opFlags, Strings opArgs) // !!! Maybe we want compression? out << info->narSize // downloadSize << info->narSize; + if (GET_PROTOCOL_MINOR(clientVersion) >= 4) + out << (info->narHash ? info->narHash.to_string() : "") << info->ca << info->sigs; } catch (InvalidPath &) { } }