Wed Mar 23 11:20:33 CET 2005 Jochen Eisinger <jochen@penguin-breeder.org>
authorJochen Eisinger <coffee@silcnet.org>
Wed, 23 Mar 2005 10:23:09 +0000 (10:23 +0000)
committerJochen Eisinger <coffee@silcnet.org>
Wed, 23 Mar 2005 10:23:09 +0000 (10:23 +0000)
* If the passphrases entered do not match while generating a new key,
  completly start over instead of going into an infinite loop asking
  the user to re-enter the passphrase correctly.  Affected file
  lib/silcutil/silcapputil.c

CHANGES
lib/silcutil/silcapputil.c

diff --git a/CHANGES b/CHANGES
index 7834e25c545947cc253173830af7aef026edd58a..871e47f7338925dac581cca697c083ec25f6b738 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,10 @@
+Wed Mar 23 11:20:33 CET 2005  Jochen Eisinger <jochen@penguin-breeder.org>
+
+       * If the passphrases entered do not match while generating a new key,
+         completly start over instead of going into an infinite loop asking
+         the user to re-enter the passphrase correctly.  Affected file
+         lib/silcutil/silcapputil.c
+
 Sun Jan  9 14:28:51 CET 2005  Pekka Riikonen <priikone@silcnet.org>
 
        * Make sure server is removed from backup list when it is
index 1f486afad170656c23a30f0b0a18d9450654a4a6..a79ee597549e91a21c7ae838b3cb6335a64e8202 100644 (file)
@@ -175,21 +175,24 @@ New pair of keys will be created.  Please, answer to following questions.\n\
   }
 
   if (!pass) {
-    char *pass2 = NULL;
-    pass = silc_get_input("Private key passphrase: ", TRUE);
-    if (!pass) {
-      pass = strdup("");
-    } else {
-      while (TRUE) {
+    while (TRUE) {
+      char *pass2 = NULL;
+      pass = silc_get_input("Private key passphrase: ", TRUE);
+      if (!pass) {
+        pass = strdup("");
+       break;
+      } else {
+       bool match;
        printf("\n");
        pass2 = silc_get_input("Retype private key passphrase: ", TRUE);
        if (!pass2)
          pass2 = strdup("");
-       if (!strcmp(pass, pass2))
+       match = !strcmp(pass, pass2);
+       silc_free(pass2);
+       if (match)
          break;
-       fprintf(stderr, "\nPassphrases do not match");
+       fprintf(stderr, "\nPassphrases do not match\n\n");
       }
-      silc_free(pass2);
     }
   }