[Pkg-gnupg-commit] [gnupg2] 58/112: agent: Fix regression in recent ssh changes.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Aug 30 17:48:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit e630f904993725c54ec63be00369589b7b7234d2
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Aug 9 17:44:54 2016 +0200

    agent: Fix regression in recent ssh changes.
    
    * agent/command-ssh.c (sexp_key_construct): Lowercase the algo name.
    --
    
    We need to use a lowercase version of the algo in S-expression.
    Unfortunately Libgcrypt has no function for this, thus we need to
    malloc and first.
    
    Fixes-commit: ebf24e3
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 agent/command-ssh.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index b01cc06..2def342 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -1685,7 +1685,7 @@ sexp_key_construct (gcry_sexp_t *r_sexp,
   void *formatbuf = NULL;
   void **arg_list = NULL;
   estream_t format = NULL;
-
+  char *algo_name = NULL;
 
   if ((key_spec.flags & SPEC_FLAG_IS_EdDSA))
     {
@@ -1723,7 +1723,6 @@ sexp_key_construct (gcry_sexp_t *r_sexp,
       const char *elems;
       size_t elems_n;
       unsigned int i, j;
-      const char *algo_name;
 
       if (secret)
         elems = key_spec.elems_sexp_order;
@@ -1750,7 +1749,13 @@ sexp_key_construct (gcry_sexp_t *r_sexp,
 
       es_fputs ("(%s(%s", format);
       arg_list[arg_idx++] = &key_identifier[secret];
-      algo_name = gcry_pk_algo_name (key_spec.algo);
+      algo_name = xtrystrdup (gcry_pk_algo_name (key_spec.algo));
+      if (!algo_name)
+        {
+          err = gpg_error_from_syserror ();
+          goto out;
+        }
+      strlwr (algo_name);
       arg_list[arg_idx++] = &algo_name;
       if (curve_name)
         {
@@ -1798,6 +1803,7 @@ sexp_key_construct (gcry_sexp_t *r_sexp,
   es_fclose (format);
   xfree (arg_list);
   xfree (formatbuf);
+  xfree (algo_name);
 
   return err;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list