Prechádzať zdrojové kódy

apply an upstream vendor patch to fix the SSH-agent use on commit operations

Ralf S. Engelschall 17 rokov pred
rodič
commit
f8682fe92f
2 zmenil súbory, kde vykonal 41 pridanie a 1 odobranie
  1. 38 0
      monotone/monotone.patch
  2. 3 1
      monotone/monotone.spec

+ 38 - 0
monotone/monotone.patch

@@ -0,0 +1,38 @@
+Upstream fix for committing via SSH-agent.
+
+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::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);
++  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());
++  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");
++  
++  ssh_agent & agent = s->get_agent();
++  vector<RSA_PublicKey> ssh_keys = agent.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;
++    }
++  }
++
+   if (s->lua.hook_persist_phrase_ok())
+     s->decrypt_private_key(id);
+ }

+ 3 - 1
monotone/monotone.spec

@@ -32,7 +32,7 @@ Class:        EVAL
 Group:        SCM
 License:      GPL
 Version:      0.40
-Release:      20080411
+Release:      20080414
 
 #   package options
 %option       with_rse  yes
@@ -44,6 +44,7 @@ Source3:      monotone-setup.sh
 Source4:      monotone-colorize.pl
 Source5:      monotone-colorize.bashrc
 Source6:      monotone.bashrc
+Patch0:       monotone.patch
 Patch1:       monotone.patch.rse
 
 #   build information
@@ -76,6 +77,7 @@ AutoReqProv:  no
 
 %prep
     %setup -q
+    %patch -p0 -P 0
 %if "%{with_rse}" == "yes"
     %patch -p0 -P 1
 %endif