summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2005-05-29 09:10:24 +0000
committerDamien Miller <djm@cvs.openbsd.org>2005-05-29 09:10:24 +0000
commitea129d667b2be94460f114707c43ca63e584950a (patch)
tree811cd95ea5ecbe08baac1a5c8e1bbde3cfb52bab
parent4ada0715ffd85900edbd3351e3f68cdf3223a269 (diff)
-Wall; feedback & ok marius@
-rw-r--r--usr.bin/gzsig/gzsig.c3
-rw-r--r--usr.bin/gzsig/sign.c22
-rw-r--r--usr.bin/gzsig/ssh.c6
-rw-r--r--usr.bin/gzsig/ssh2.c14
4 files changed, 25 insertions, 20 deletions
diff --git a/usr.bin/gzsig/gzsig.c b/usr.bin/gzsig/gzsig.c
index 855fbfe6991..af5ff780299 100644
--- a/usr.bin/gzsig/gzsig.c
+++ b/usr.bin/gzsig/gzsig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gzsig.c,v 1.2 2005/05/28 08:07:45 marius Exp $ */
+/* $OpenBSD: gzsig.c,v 1.3 2005/05/29 09:10:23 djm Exp $ */
/*
* gzsig.c
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "extern.h"
diff --git a/usr.bin/gzsig/sign.c b/usr.bin/gzsig/sign.c
index 4373c379c49..a7ea7a563a8 100644
--- a/usr.bin/gzsig/sign.c
+++ b/usr.bin/gzsig/sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sign.c,v 1.4 2005/05/29 08:54:13 djm Exp $ */
+/* $OpenBSD: sign.c,v 1.5 2005/05/29 09:10:23 djm Exp $ */
/*
* sign.c
@@ -216,7 +216,7 @@ void
sign(int argc, char *argv[])
{
struct key *key;
- char *gzipfile, tmpfile[MAXPATHLEN];
+ char *gzipfile, tmppath[MAXPATHLEN];
FILE *fin, *fout;
int i, fd, error, qflag;
@@ -270,24 +270,24 @@ sign(int argc, char *argv[])
gzipfile, strerror(errno));
continue;
}
- snprintf(tmpfile, sizeof(tmpfile), "%s.XXXXXX", gzipfile);
+ snprintf(tmppath, sizeof(tmppath), "%s.XXXXXX", gzipfile);
- if ((fd = mkstemp(tmpfile)) < 0) {
+ if ((fd = mkstemp(tmppath)) < 0) {
fprintf(stderr, "Error creating %s: %s\n",
- tmpfile, strerror(errno));
+ tmppath, strerror(errno));
fclose(fin);
continue;
}
if ((fout = fdopen(fd, "w")) == NULL) {
fprintf(stderr, "Error opening %s: %s\n",
- tmpfile, strerror(errno));
+ tmppath, strerror(errno));
fclose(fin);
close(fd);
continue;
}
- if (copy_permissions(gzipfile, tmpfile) < 0) {
+ if (copy_permissions(gzipfile, tmppath) < 0) {
fprintf(stderr, "Error initializing %s: %s\n",
- tmpfile, strerror(errno));
+ tmppath, strerror(errno));
fclose(fin);
fclose(fout);
continue;
@@ -298,14 +298,14 @@ sign(int argc, char *argv[])
fclose(fout);
if (!error) {
- if (rename(tmpfile, gzipfile) < 0) {
- unlink(tmpfile);
+ if (rename(tmppath, gzipfile) < 0) {
+ unlink(tmppath);
fatal(1, "Couldn't sign %s", gzipfile);
}
if (!qflag)
fprintf(stderr, "Signed %s\n", gzipfile);
} else {
- unlink(tmpfile);
+ unlink(tmppath);
fatal(1, "Couldn't sign %s", gzipfile);
}
}
diff --git a/usr.bin/gzsig/ssh.c b/usr.bin/gzsig/ssh.c
index 78f3c103a34..45e42aa1f35 100644
--- a/usr.bin/gzsig/ssh.c
+++ b/usr.bin/gzsig/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.1 2005/05/29 02:41:42 marius Exp $ */
+/* $OpenBSD: ssh.c,v 1.2 2005/05/29 09:10:23 djm Exp $ */
/*
* ssh.c
@@ -53,6 +53,8 @@
#define SSH1_MAGIC "SSH PRIVATE KEY FILE FORMAT 1.1\n"
+extern int sign_passwd_cb(char *, int, int, void *);
+
struct des3_state {
des_key_schedule k1, k2, k3;
des_cblock iv1, iv2, iv3;
@@ -215,7 +217,7 @@ load_ssh1_private(RSA *rsa, struct iovec *iov)
BN_CTX *ctx;
BIGNUM *aux;
MD5_CTX md;
- char pass[128], prompt[128], comment[BUFSIZ];
+ char pass[128], comment[BUFSIZ];
u_char *p, cipher_type, digest[16];
void *dstate;
int i;
diff --git a/usr.bin/gzsig/ssh2.c b/usr.bin/gzsig/ssh2.c
index f508058ca00..f221cb2d8c6 100644
--- a/usr.bin/gzsig/ssh2.c
+++ b/usr.bin/gzsig/ssh2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh2.c,v 1.1 2005/05/28 01:57:30 marius Exp $ */
+/* $OpenBSD: ssh2.c,v 1.2 2005/05/29 09:10:23 djm Exp $ */
/*
* ssh2.c
*
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <sys/uio.h>
+#include <netinet/in.h>
#include <arpa/nameser.h>
#include <openssl/ssl.h>
#include <openssl/des.h>
@@ -30,6 +31,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <resolv.h>
#include <err.h>
#include "key.h"
@@ -49,7 +51,7 @@ _uudecode(const char *src, u_char *target, size_t targsize)
/* copy the 'readonly' source */
if ((encoded = strdup(src)) == NULL)
- err(1, "");
+ err(1, "strdup");
/* skip whitespace and data */
for (p = encoded; *p == ' ' || *p == '\t'; p++)
;
@@ -131,7 +133,7 @@ _read_bignum(struct iovec *iov, BIGNUM *bn)
int
ssh2_load_public(struct key *k, struct iovec *iovp)
{
- int len, keytype, error = 0, blen;
+ int len, keytype, error = 0;
u_char *bp;
struct iovec iov;
/* iov->iov_base is NULL terminated */
@@ -150,7 +152,7 @@ ssh2_load_public(struct key *k, struct iovec *iovp)
len = 2*strlen(cp);
if ((savep = iov.iov_base = malloc(len)) == NULL)
- err(1, "");
+ err(1, "malloc(%d)", len);
iov.iov_len = _uudecode(cp, iov.iov_base, len);
if (_read_opaque(&iov, &bp, &len) < 0 ||
@@ -167,7 +169,7 @@ ssh2_load_public(struct key *k, struct iovec *iovp)
if ((rsa = RSA_new()) == NULL ||
(rsa->e = BN_new()) == NULL ||
(rsa->n = BN_new()) == NULL)
- errx(1, "");
+ errx(1, "BN_new");
if (_read_bignum(&iov, rsa->e) < 0 ||
_read_bignum(&iov, rsa->n) < 0) {
@@ -188,7 +190,7 @@ ssh2_load_public(struct key *k, struct iovec *iovp)
(dsa->q = BN_new()) == NULL ||
(dsa->g = BN_new()) == NULL ||
(dsa->pub_key = BN_new()) == NULL)
- errx(1, "");
+ errx(1, "BN_new");
if (_read_bignum(&iov, dsa->p) < 0 ||
_read_bignum(&iov, dsa->q) < 0 ||