silc-client: handle key load error correctly
[silc.git] / apps / irssi / src / silc / core / clientutil.c
index a8a1b5b7328e318b547ac8f36e3a2b9d86049c51..56854526514bc5988148243e6b9c869dbe04d026 100644 (file)
@@ -363,9 +363,10 @@ int silc_client_load_keys(SilcClient client)
   ret = silc_load_key_pair(pub, prv, "", &irssi_pubkey, &irssi_privkey);
   if (!ret)
     ret = silc_load_key_pair(pub, prv, NULL, &irssi_pubkey, &irssi_privkey);
-
-  if (!ret)
+  if (!ret) {
     SILC_LOG_ERROR(("Could not load key pair"));
+    return ret;
+  }
 
   if (silc_pkcs_private_key_get_len(irssi_privkey) < 4096) {
     fprintf(stdout,
@@ -411,6 +412,14 @@ static void silc_keyboard_entry_redirect_abort(SilcAsyncOperation op,
    * the operation has been aborted.
    */
   ctx->user_prompt_proc(NULL, ctx->user_context, KeyboardCompletionAborted);
+
+  /*
+   * Allow new prompt after we've abored despite us leaking Irssi prompt
+   * data.  It's more important to get new prompt up and this abort
+   * guarantees we handle things correctly towards silcclient library by
+   * calling the callback above.
+   */
+  silc_keyboard_prompt_pending = FALSE;
 }
 
 static void silc_keyboard_entry_redirect_completion(const char *line,