From ac138e3800869c4a406b0ac136503a68d4626399 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 29 Apr 2008 20:26:47 +0000 Subject: you commit to cvs expecting it to work like monotone. wizd hits you. (redo previous while actually committing the patch as well) --- devel/monotone/Makefile | 5 +- devel/monotone/patches/patch-aa | 121 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 devel/monotone/patches/patch-aa (limited to 'devel/monotone') diff --git a/devel/monotone/Makefile b/devel/monotone/Makefile index 5f671d640f9..4a8225aae02 100644 --- a/devel/monotone/Makefile +++ b/devel/monotone/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.52 2008/04/28 15:43:52 dan Exp $ +# $NetBSD: Makefile,v 1.53 2008/04/29 20:26:47 dan Exp $ # DISTNAME= monotone-0.40 +PKGREVISION= 1 CATEGORIES= devel scm MASTER_SITES= http://monotone.ca/downloads/0.40/ @@ -9,8 +10,6 @@ MAINTAINER= jmmv@NetBSD.org HOMEPAGE= http://monotone.ca/ COMMENT= Free distributed version control system -PKG_REVISION= 1 - PKG_DESTDIR_SUPPORT= user-destdir GCC_REQD+= 3.0 diff --git a/devel/monotone/patches/patch-aa b/devel/monotone/patches/patch-aa new file mode 100644 index 00000000000..d5879b98a47 --- /dev/null +++ b/devel/monotone/patches/patch-aa @@ -0,0 +1,121 @@ +# +# +# patch "key_store.cc" +# from [55878f97b03349c66d95398799780f43ae63165b] +# to [510eb02eab491fd9e79c49fcfcf5e6efa145872f] +# +# patch "ssh_agent.cc" +# from [dcc8cefe23e376c74df2eb10011f874802a609d6] +# to [a2a0e96fd30804230e181747f36dcae3be34fd26] +# +# patch "ssh_agent.hh" +# from [c0c03bdb37905e1e6bbf8350a00fc68b0d83611b] +# to [c9b7efaf4b0f2c137336046b0ebe3ccff7ad5076] +# +============================================================ +--- key_store.cc 55878f97b03349c66d95398799780f43ae63165b ++++ key_store.cc 510eb02eab491fd9e79c49fcfcf5e6efa145872f +@@ -438,6 +438,14 @@ key_store::cache_decrypted_key(const rsa + key_store::cache_decrypted_key(const rsa_keypair_id & id) + { + signing_key = id; ++ keypair key; ++ get_key_pair(id, key); ++ if (s->get_agent().has_key(key)) ++ { ++ L(FL("ssh-agent has key '%s' loaded, skipping internal cache") % id); ++ return; ++ } ++ + if (s->lua.hook_persist_phrase_ok()) + s->decrypt_private_key(id); + } +============================================================ +--- ssh_agent.cc dcc8cefe23e376c74df2eb10011f874802a609d6 ++++ ssh_agent.cc a2a0e96fd30804230e181747f36dcae3be34fd26 +@@ -20,6 +20,7 @@ + #include "botan/bigint.h" + #include + #include "platform.hh" ++#include "key_store.hh" + + #ifdef WIN32 + #include "win32/ssh_agent_platform.hh" +@@ -27,14 +28,18 @@ + #include "unix/ssh_agent_platform.hh" + #endif + ++using std::string; ++using std::vector; ++ ++using boost::shared_ptr; ++using boost::shared_dynamic_cast; ++ + using Botan::RSA_PublicKey; + using Botan::RSA_PrivateKey; + using Botan::BigInt; + using Botan::SecureVector; ++using Botan::X509_PublicKey; + using Netxx::Stream; +-using boost::shared_ptr; +-using std::string; +-using std::vector; + + struct ssh_agent_state : ssh_agent_platform + { +@@ -375,6 +380,35 @@ ssh_agent::get_keys() + return s->keys; + } + ++bool ++ssh_agent::has_key(const keypair & key) ++{ ++ //grab the monotone public key as an RSA_PublicKey ++ SecureVector pub_block; ++ pub_block.set(reinterpret_cast((key.pub)().data()), ++ (key.pub)().size()); ++ L(FL("has_key: building %d-byte pub key") % pub_block.size()); ++ shared_ptr x509_key = ++ shared_ptr(Botan::X509::load_key(pub_block)); ++ shared_ptr pub_key = shared_dynamic_cast(x509_key); ++ ++ if (!pub_key) ++ throw informative_failure("has_key: Failed to get monotone RSA public key"); ++ ++ vector ssh_keys = get_keys(); ++ for (vector::const_iterator ++ si = ssh_keys.begin(); si != ssh_keys.end(); ++si) ++ { ++ if ((*pub_key).get_e() == (*si).get_e() ++ && (*pub_key).get_n() == (*si).get_n()) ++ { ++ L(FL("has_key: key found")); ++ return true; ++ } ++ } ++ return false; ++} ++ + void + ssh_agent::sign_data(RSA_PublicKey const & key, + string const & data, +============================================================ +--- ssh_agent.hh c0c03bdb37905e1e6bbf8350a00fc68b0d83611b ++++ ssh_agent.hh c9b7efaf4b0f2c137336046b0ebe3ccff7ad5076 +@@ -13,6 +13,8 @@ + #include "vector.hh" + #include + ++struct keypair; ++ + namespace Botan + { + class RSA_PublicKey; +@@ -26,6 +28,7 @@ struct ssh_agent + ssh_agent(); + ~ssh_agent(); + std::vector const get_keys(); ++ bool has_key(const keypair & key); + void sign_data(Botan::RSA_PublicKey const & key, + std::string const & data, + std::string & out); -- cgit v1.2.3