Allow rsakey_pubblob() to return the key comment.
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sun, 30 Oct 2005 15:16:42 +0000 (15:16 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Sun, 30 Oct 2005 15:16:42 +0000 (15:16 +0000)
(like r6433 but for SSH-1)

git-svn-id: svn://svn.tartarus.org/sgt/putty@6434 cda61777-01e9-0310-a592-d414129be87e

cmdgen.c
ssh.c
ssh.h
sshpubk.c
windows/winpgnt.c

index f84938e..13c9ca1 100644 (file)
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -690,7 +690,8 @@ int main(int argc, char **argv)
                char *blob;
                int n, l, bloblen;
 
-               ret = rsakey_pubblob(&infilename, &vblob, &bloblen, &error);
+               ret = rsakey_pubblob(&infilename, &vblob, &bloblen, NULL,
+                                    &error);
                blob = (char *)vblob;
 
                n = 4;                 /* skip modulus bits */
diff --git a/ssh.c b/ssh.c
index b30d026..5493191 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -3256,7 +3256,8 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen,
     /* Load the public half of ssh->cfg.keyfile so we notice if it's in Pageant */
     if (!filename_is_null(ssh->cfg.keyfile)) {
        if (!rsakey_pubblob(&ssh->cfg.keyfile,
-                           &s->publickey_blob, &s->publickey_bloblen, NULL))
+                           &s->publickey_blob, &s->publickey_bloblen,
+                           NULL, NULL))
            s->publickey_blob = NULL;
     } else
        s->publickey_blob = NULL;
diff --git a/ssh.h b/ssh.h
index 61de044..d0543cd 100644 (file)
--- a/ssh.h
+++ b/ssh.h
@@ -383,7 +383,7 @@ int loadrsakey(const Filename *filename, struct RSAKey *key,
               char *passphrase, const char **errorstr);
 int rsakey_encrypted(const Filename *filename, char **comment);
 int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
-                  const char **errorstr);
+                  char **commentptr, const char **errorstr);
 
 int saversakey(const Filename *filename, struct RSAKey *key, char *passphrase);
 
index 923ebe9..fddc6e5 100644 (file)
--- a/sshpubk.c
+++ b/sshpubk.c
@@ -225,7 +225,7 @@ int rsakey_encrypted(const Filename *filename, char **comment)
  * exponent, modulus).
  */
 int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
-                  const char **errorstr)
+                  char **commentptr, const char **errorstr)
 {
     FILE *fp;
     char buf[64];
@@ -250,7 +250,7 @@ int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
      */
     if (fgets(buf, sizeof(buf), fp) && !strcmp(buf, rsa_signature)) {
        memset(&key, 0, sizeof(key));
-       if (loadrsakey_main(fp, &key, TRUE, NULL, NULL, &error)) {
+       if (loadrsakey_main(fp, &key, TRUE, commentptr, NULL, &error)) {
            *blob = rsa_public_blob(&key, bloblen);
            freersakey(&key);
            ret = 1;
index d446315..d4b445b 100644 (file)
@@ -415,7 +415,7 @@ static void add_keyfile(Filename filename)
        int i, nkeys, bloblen, keylistlen;
 
        if (type == SSH_KEYTYPE_SSH1) {
-           if (!rsakey_pubblob(&filename, &blob, &bloblen, &error)) {
+           if (!rsakey_pubblob(&filename, &blob, &bloblen, NULL, &error)) {
                char *msg = dupprintf("Couldn't load private key (%s)", error);
                message_box(msg, APPNAME, MB_OK | MB_ICONERROR,
                            HELPCTXID(errors_cantloadkey));