Try to make our PGP signing more useful:
[u/mdw/putty] / windows / wincons.c
index 38b46fa..c38fa01 100644 (file)
@@ -33,6 +33,10 @@ void cleanup_exit(int code)
     exit(code);
 }
 
+void set_busy_status(void *frontend, int status)
+{
+}
+
 void notify_remote_exit(void *frontend)
 {
 }
@@ -41,8 +45,9 @@ void timer_change_notify(long next)
 {
 }
 
-void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
-                        char *keystr, char *fingerprint)
+int verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
+                        char *keystr, char *fingerprint,
+                        void (*callback)(void *ctx, int result), void *ctx)
 {
     int ret;
     HANDLE hin;
@@ -107,12 +112,12 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
     ret = verify_host_key(host, port, keytype, keystr);
 
     if (ret == 0)                     /* success - key matched OK */
-       return;
+       return 1;
 
     if (ret == 2) {                   /* key was different */
        if (console_batch_mode) {
            fprintf(stderr, wrongmsg_batch, keytype, fingerprint);
-           cleanup_exit(1);
+            return 0;
        }
        fprintf(stderr, wrongmsg, keytype, fingerprint);
        fflush(stderr);
@@ -120,7 +125,7 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
     if (ret == 1) {                   /* key was absent */
        if (console_batch_mode) {
            fprintf(stderr, absentmsg_batch, keytype, fingerprint);
-           cleanup_exit(1);
+            return 0;
        }
        fprintf(stderr, absentmsg, keytype, fingerprint);
        fflush(stderr);
@@ -136,9 +141,10 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
     if (line[0] != '\0' && line[0] != '\r' && line[0] != '\n') {
        if (line[0] == 'y' || line[0] == 'Y')
            store_host_key(host, port, keytype, keystr);
+        return 1;
     } else {
        fprintf(stderr, abandoned);
-       cleanup_exit(0);
+        return 0;
     }
 }
 
@@ -150,7 +156,8 @@ void update_specials_menu(void *frontend)
  * Ask whether the selected algorithm is acceptable (since it was
  * below the configured 'warn' threshold).
  */
-void askalg(void *frontend, const char *algtype, const char *algname)
+int askalg(void *frontend, const char *algtype, const char *algname,
+          void (*callback)(void *ctx, int result), void *ctx)
 {
     HANDLE hin;
     DWORD savemode, i;
@@ -169,7 +176,7 @@ void askalg(void *frontend, const char *algtype, const char *algname)
 
     if (console_batch_mode) {
        fprintf(stderr, msg_batch, algtype, algname);
-       cleanup_exit(1);
+       return 0;
     }
 
     fprintf(stderr, msg, algtype, algname);
@@ -183,10 +190,10 @@ void askalg(void *frontend, const char *algtype, const char *algname)
     SetConsoleMode(hin, savemode);
 
     if (line[0] == 'y' || line[0] == 'Y') {
-       return;
+       return 1;
     } else {
        fprintf(stderr, abandoned);
-       cleanup_exit(0);
+       return 0;
     }
 }
 
@@ -194,7 +201,8 @@ void askalg(void *frontend, const char *algtype, const char *algname)
  * Ask whether to wipe a session log file before writing to it.
  * Returns 2 for wipe, 1 for append, 0 for cancel (don't log).
  */
-int askappend(void *frontend, Filename filename)
+int askappend(void *frontend, Filename filename,
+             void (*callback)(void *ctx, int result), void *ctx)
 {
     HANDLE hin;
     DWORD savemode, i;
@@ -250,7 +258,7 @@ int askappend(void *frontend, Filename filename)
 void old_keyfile_warning(void)
 {
     static const char message[] =
-       "You are loading an SSH 2 private key which has an\n"
+       "You are loading an SSH-2 private key which has an\n"
        "old version of the file format. This means your key\n"
        "file is not fully tamperproof. Future versions of\n"
        "PuTTY may stop supporting this private key format,\n"
@@ -263,6 +271,22 @@ void old_keyfile_warning(void)
     fputs(message, stderr);
 }
 
+/*
+ * Display the fingerprints of the PGP Master Keys to the user.
+ */
+void pgp_fingerprints(void)
+{
+    fputs("These are the fingerprints of the PuTTY PGP Master Keys. They can\n"
+         "be used to establish a trust path from this executable to another\n"
+         "one. See the manual for more information.\n"
+         "(Note: these fingerprints have nothing to do with SSH!)\n"
+         "\n"
+         "PuTTY Master Key (RSA), 1024-bit:\n"
+         "  " PGP_RSA_MASTER_KEY_FP "\n"
+         "PuTTY Master Key (DSA), 1024-bit:\n"
+         "  " PGP_DSA_MASTER_KEY_FP "\n", stdout);
+}
+
 void console_provide_logctx(void *logctx)
 {
     console_logctx = logctx;