summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-09-18 05:49:14 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-09-18 05:49:14 +0000
commit99a30f11c2e698916f3a3d8434a438085d9f298f (patch)
tree86288e2a6e09298839afd9e64ffe770d9354eb16
parent6a337633321a3aef52d766e643f0abba7cdad02f (diff)
- markus@cvs.openbsd.org 2001/09/17 20:50:22
[key.c ssh-keygen.c] better error handling if you try to export a bad key to ssh.com
-rw-r--r--ChangeLog5
-rw-r--r--key.c7
-rw-r--r--ssh-keygen.c7
3 files changed, 13 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 199c4e35..e6582c9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,9 @@
- stevesk@cvs.openbsd.org 2001/09/17 20:38:09
[sftp.1 sftp.c]
cleanup and document -1, -s and -S; ok markus@
+ - markus@cvs.openbsd.org 2001/09/17 20:50:22
+ [key.c ssh-keygen.c]
+ better error handling if you try to export a bad key to ssh.com
20010917
- (djm) x11-ssh-askpass-1.2.4 in RPM spec, revert workarounds
@@ -6483,4 +6486,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.1535 2001/09/18 05:47:32 mouring Exp $
+$Id: ChangeLog,v 1.1536 2001/09/18 05:49:14 mouring Exp $
diff --git a/key.c b/key.c
index 482168de..b382f36c 100644
--- a/key.c
+++ b/key.c
@@ -32,7 +32,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: key.c,v 1.30 2001/09/17 19:27:15 stevesk Exp $");
+RCSID("$OpenBSD: key.c,v 1.31 2001/09/17 20:50:22 markus Exp $");
#include <openssl/evp.h>
@@ -728,8 +728,9 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp)
buffer_put_bignum2(&b, key->rsa->n);
break;
default:
- error("key_to_blob: illegal key type %d", key->type);
- break;
+ error("key_to_blob: unsupported key type %d", key->type);
+ buffer_free(&b);
+ return 0;
}
len = buffer_len(&b);
buf = xmalloc(len);
diff --git a/ssh-keygen.c b/ssh-keygen.c
index db4fef2f..299ba79c 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.80 2001/09/17 19:27:15 stevesk Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.81 2001/09/17 20:50:22 markus Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
@@ -163,7 +163,10 @@ do_convert_to_ssh2(struct passwd *pw)
exit(1);
}
}
- key_to_blob(k, &blob, &len);
+ if (key_to_blob(k, &blob, &len) <= 0) {
+ fprintf(stderr, "key_to_blob failed\n");
+ exit(1);
+ }
fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN);
fprintf(stdout,
"Comment: \"%d-bit %s, converted from OpenSSH by %s@%s\"\n",