# # # patch "automate.cc" # from [fd30caf826d618d5dccb8b75402c8d48db1a7cca] # to [84e58a92e4188b5b4159348a49c51f1f94fe6d6f] # # patch "cert.cc" # from [e5d00c3656f580f430998be2145fd69797658971] # to [7b6d6fe8c2cf22a420422e7699b812c2ee6ef3d6] # # patch "cert.hh" # from [c638e8032668d0374d8953ad761fb636d78a0dbd] # to [1d875af6765958035c4c44bc51ac57f0fdb458a1] # # patch "cmd_packet.cc" # from [369399d79d4a6e14d9c229e8da94de50b79daac2] # to [3afccc60c3efa1335909f87f598ce4e843071b11] # # patch "key_store.cc" # from [894ba4461706e3df33cb48f9ca1b8262908cd5ea] # to [2b5d0efd235ec776bb19943c7c5fc78da396871c] # # patch "packet.cc" # from [94436e3bdf7352ffbb40e4d086b8ed08e207bfa2] # to [7764b9b5ba69d5cc2166ba8e3a06f5a6d28bfece] # # patch "packet.hh" # from [36079522273c7e5e6b04bc2bebfd22cc07b5bf4c] # to [883e5e7c88e8dfeb148a279d970c6c4020d086bc] # ============================================================ --- automate.cc fd30caf826d618d5dccb8b75402c8d48db1a7cca +++ automate.cc 84e58a92e4188b5b4159348a49c51f1f94fe6d6f @@ -1509,7 +1509,7 @@ CMD_AUTOMATE(packets_for_certs, N_("REVI for (vector< revision >::const_iterator i = certs.begin(); i != certs.end(); i++) - pw.consume_revision_cert(*i); + pw.consume_revision_cert(i->inner()); } // Name: packet_for_fdata ============================================================ --- cert.cc e5d00c3656f580f430998be2145fd69797658971 +++ cert.cc 7b6d6fe8c2cf22a420422e7699b812c2ee6ef3d6 @@ -224,35 +224,17 @@ erase_bogus_certs(database & db, // cert-managing routines - -cert::cert() -{} - cert::cert(std::string const & s) { read_cert(s, *this); } + cert::cert(std::string const & s, origin::type m) : origin_aware(m) { read_cert(s, *this); } -cert::cert(revision_id const & ident, - cert_name const & name, - cert_value const & value, - rsa_keypair_id const & key) - : ident(ident), name(name), value(value), key(key) -{} - -cert::cert(revision_id const & ident, - cert_name const & name, - cert_value const & value, - rsa_keypair_id const & key, - rsa_sha1_signature const & sig) - : ident(ident), name(name), value(value), key(key), sig(sig) -{} - bool cert::operator<(cert const & other) const { ============================================================ --- cert.hh c638e8032668d0374d8953ad761fb636d78a0dbd +++ cert.hh 1d875af6765958035c4c44bc51ac57f0fdb458a1 @@ -30,21 +30,28 @@ struct cert : public origin_aware struct cert : public origin_aware { - cert(); + cert() {} - // This is to make revision and manifest work. - explicit cert(std::string const & s); - cert(std::string const & s, origin::type m); - cert(revision_id const & ident, cert_name const & name, cert_value const & value, - rsa_keypair_id const & key); + rsa_keypair_id const & key) + : ident(ident), name(name), value(value), key(key) + {} + cert(revision_id const & ident, cert_name const & name, cert_value const & value, rsa_keypair_id const & key, - rsa_sha1_signature const & sig); + rsa_sha1_signature const & sig) + : ident(ident), name(name), value(value), key(key), sig(sig) + {} + + // These understand the netsync serialization. + // They also make revision and manifest work. + explicit cert(std::string const & s); + cert(std::string const & s, origin::type m); + revision_id ident; cert_name name; cert_value value; ============================================================ --- cmd_packet.cc 369399d79d4a6e14d9c229e8da94de50b79daac2 +++ cmd_packet.cc 3afccc60c3efa1335909f87f598ce4e843071b11 @@ -117,10 +117,10 @@ namespace guard.commit(); } - virtual void consume_revision_cert(revision const & t) + virtual void consume_revision_cert(cert const & t) { transaction_guard guard(db); - db.put_revision_cert(t); + db.put_revision_cert(revision(t)); guard.commit(); } ============================================================ --- key_store.cc 894ba4461706e3df33cb48f9ca1b8262908cd5ea +++ key_store.cc 2b5d0efd235ec776bb19943c7c5fc78da396871c @@ -120,7 +120,7 @@ namespace virtual void consume_revision_data(revision_id const & ident, revision_data const & dat) {E(false, origin::system, F("Extraneous data in key store."));} - virtual void consume_revision_cert(revision const & t) + virtual void consume_revision_cert(cert const & t) {E(false, origin::system, F("Extraneous data in key store."));} ============================================================ --- packet.cc 94436e3bdf7352ffbb40e4d086b8ed08e207bfa2 +++ packet.cc 7764b9b5ba69d5cc2166ba8e3a06f5a6d28bfece @@ -71,14 +71,14 @@ void } void -packet_writer::consume_revision_cert(revision const & t) +packet_writer::consume_revision_cert(cert const & t) { - ost << "[rcert " << encode_hexenc(t.inner().ident.inner()(), - t.inner().ident.inner().made_from) << '\n' - << " " << t.inner().name() << '\n' - << " " << t.inner().key() << '\n' - << " " << trim(encode_base64(t.inner().value)()) << "]\n" - << trim(encode_base64(t.inner().sig)()) << '\n' + ost << "[rcert " << encode_hexenc(t.ident.inner()(), + t.ident.inner().made_from) << '\n' + << " " << t.name() << '\n' + << " " << t.key() << '\n' + << " " << trim(encode_base64(t.value)()) << "]\n" + << trim(encode_base64(t.sig)()) << '\n' << "[end]\n"; } @@ -230,7 +230,7 @@ namespace decode_base64_as(val, made_from), rsa_keypair_id(keyid, made_from), decode_base64_as(body, made_from)); - cons.consume_revision_cert(revision(t)); + cons.consume_revision_cert(t); } void pubkey_packet(string const & args, string const & body) const @@ -517,7 +517,7 @@ UNIT_TEST(packet, roundabout) // file_id to create a cert to test the packet writer with. cert c(typecast_vocab(fid.inner()), cert_name("smell"), val, rsa_keypair_id("address@hidden"), sig); - pw.consume_revision_cert(revision(c)); + pw.consume_revision_cert(c); keypair kp; // a public key packet ============================================================ --- packet.hh 36079522273c7e5e6b04bc2bebfd22cc07b5bf4c +++ packet.hh 883e5e7c88e8dfeb148a279d970c6c4020d086bc @@ -46,7 +46,7 @@ public: virtual void consume_revision_data(revision_id const & ident, revision_data const & dat) = 0; - virtual void consume_revision_cert(revision const & t) = 0; + virtual void consume_revision_cert(cert const & t) = 0; virtual void consume_public_key(rsa_keypair_id const & ident, @@ -72,7 +72,7 @@ struct packet_writer : public packet_con virtual void consume_revision_data(revision_id const & ident, revision_data const & dat); - virtual void consume_revision_cert(revision const & t); + virtual void consume_revision_cert(cert const & t); virtual void consume_public_key(rsa_keypair_id const & ident, rsa_pub_key const & k);