LegacySSHStore: Include signatures etc.

This commit is contained in:
Eelco Dolstra 2017-09-08 16:55:27 +02:00
parent e02edb1483
commit 3ed8290e53
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 10 additions and 1 deletions

View file

@ -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<StringSet>(conn->from);
}
auto s = readString(conn->from);
assert(s == "");

View file

@ -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)

View file

@ -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 &) {
}
}