OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   14-Apr-2008 21:25:42
  Branch: HEAD                             Handle: 2008041420254200

  Modified files:
    openpkg-src/monotone    monotone.patch

  Log:
    upgrade to latest upstream fix for SSH-agent problem

  Summary:
    Revision    Changes     Path
    1.17        +88 -17     openpkg-src/monotone/monotone.patch
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/monotone/monotone.patch
  ============================================================================
  $ cvs diff -u -r1.16 -r1.17 monotone.patch
  --- openpkg-src/monotone/monotone.patch       14 Apr 2008 18:26:47 -0000      
1.16
  +++ openpkg-src/monotone/monotone.patch       14 Apr 2008 19:25:42 -0000      
1.17
  @@ -2,37 +2,108 @@
   
   Index: key_store.cc
   --- key_store.cc     55878f97b03349c66d95398799780f43ae63165b
  -+++ key_store.cc     1c879bc94af0a672b7077245d755f660890ec043
  -@@ -438,6 +438,32 @@ key_store::cache_decrypted_key(const rsa
  ++++ 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;
  -+
  -+  //grab the monotone public key as an RSA_PublicKey
   +  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);
  + }
  +Index: ssh_agent.cc
  +--- ssh_agent.cc     dcc8cefe23e376c74df2eb10011f874802a609d6
  ++++ ssh_agent.cc     a2a0e96fd30804230e181747f36dcae3be34fd26
  +@@ -20,6 +20,7 @@
  + #include "botan/bigint.h"
  + #include <boost/shared_ptr.hpp>
  + #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<Botan::byte> pub_block;
   +  pub_block.set(reinterpret_cast<Botan::byte const *>((key.pub)().data()),
   +                (key.pub)().size());
  -+  L(FL("make_signature: building %d-byte pub key") % pub_block.size());
  ++  L(FL("has_key: building %d-byte pub key") % pub_block.size());
   +  shared_ptr<X509_PublicKey> x509_key =
   +    shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
   +  shared_ptr<RSA_PublicKey> pub_key = 
shared_dynamic_cast<RSA_PublicKey>(x509_key);
   +
   +  if (!pub_key)
  -+    throw informative_failure("Failed to get monotone RSA public key");
  ++    throw informative_failure("has_key: Failed to get monotone RSA public 
key");
   +  
  -+  ssh_agent & agent = s->get_agent();
  -+  vector<RSA_PublicKey> ssh_keys = agent.get_keys();
  ++  vector<RSA_PublicKey> ssh_keys = get_keys();
   +  for (vector<RSA_PublicKey>::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("ssh-agent has key loaded, skipping internal cache"));
  -+      return;
  ++         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;
  ++}
   +
  -   if (s->lua.hook_persist_phrase_ok())
  -     s->decrypt_private_key(id);
  - }
  + void
  + ssh_agent::sign_data(RSA_PublicKey const & key,
  +                      string const & data,
  +Index: ssh_agent.hh
  +--- ssh_agent.hh     c0c03bdb37905e1e6bbf8350a00fc68b0d83611b
  ++++ ssh_agent.hh     c9b7efaf4b0f2c137336046b0ebe3ccff7ad5076
  +@@ -13,6 +13,8 @@
  + #include "vector.hh"
  + #include <boost/scoped_ptr.hpp>
  + 
  ++struct keypair;
  ++
  + namespace Botan
  + {
  +   class RSA_PublicKey;
  +@@ -26,6 +28,7 @@ struct ssh_agent
  +   ssh_agent();
  +   ~ssh_agent();
  +   std::vector<Botan::RSA_PublicKey> const get_keys();
  ++  bool has_key(const keypair & key);
  +   void sign_data(Botan::RSA_PublicKey const & key,
  +                  std::string const & data,
  +                  std::string & out);
  @@ .
______________________________________________________________________
OpenPKG                                             http://openpkg.org
CVS Repository Commit List                     [email protected]

Reply via email to