Fixed PASSWD --preset.
authorBen Kibbey <bjk@luxsci.net>
Wed, 13 Apr 2011 00:02:05 +0000 (20:02 -0400)
committerWerner Koch <wk@gnupg.org>
Wed, 13 Apr 2011 12:15:21 +0000 (14:15 +0200)
The previous patch required that the keygrip be cached before adding the
new passphrase to the cache. No more.

agent/ChangeLog
agent/command.c

index 21cd0c4..cd781e2 100644 (file)
@@ -1,3 +1,7 @@
+2011-04-12  Ben Kibbey <bjk@luxsci.net>
+
+       * command.c (cmd_passwd): Fixed --preset when not previously cached.
+
 2011-04-12  Werner Koch  <wk@g10code.com>
 
        * agent.h (CACHE_TTL_NONCE, CACHE_TTL_OPT_PRESET): New.
 2011-04-12  Werner Koch  <wk@g10code.com>
 
        * agent.h (CACHE_TTL_NONCE, CACHE_TTL_OPT_PRESET): New.
index e5243ed..d2ed23a 100644 (file)
@@ -1528,15 +1528,15 @@ cmd_passwd (assuan_context_t ctx, char *line)
                   ctrl->server_local->last_passwd_nonce = passwd_nonce;
                   passwd_nonce = NULL;
                 }
                   ctrl->server_local->last_passwd_nonce = passwd_nonce;
                   passwd_nonce = NULL;
                 }
-             if (opt_preset)
-               {
-                 char hexgrip[40+1];
-                 bin2hex(grip, 20, hexgrip);
-                 err = agent_put_cache (hexgrip, CACHE_MODE_ANY, newpass,
-                                         CACHE_TTL_OPT_PRESET);
-               }
             }
         }
             }
         }
+      if (opt_preset)
+      {
+         char hexgrip[40+1];
+         bin2hex(grip, 20, hexgrip);
+         err = agent_put_cache (hexgrip, CACHE_MODE_ANY, newpass,
+                 CACHE_TTL_OPT_PRESET);
+      }
       xfree (newpass);
     }
   ctrl->in_passwd--;
       xfree (newpass);
     }
   ctrl->in_passwd--;