summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2007-02-04 10:32:59 +0000
committerMatt Johnston <matt@ucc.asn.au>2007-02-04 10:32:59 +0000
commitfd304d763ace5074dc8e26b29fecc88d0d7ea006 (patch)
treef54c32bfbe83b44f715ab47a5863f84f585cfbe5
parentd9aeb2773e236e662c8b493f4bcee978f9908d7c (diff)
parent60d4cd599621a843095a0948c58c40b0ba286de2 (diff)
merge of 'b1dd3b94e60a07a176dba2b035ac79968595990a'
and 'bcb33fce2fad01a7626598209d43af3571bd86f0' --HG-- extra : convert_revision : 691c56da3db2685f58ea53540a73c1b79e7df9cd
-rw-r--r--cli-authpubkey.c6
-rw-r--r--cli-runopts.c8
-rw-r--r--common-algo.c2
-rw-r--r--common-kex.c8
-rw-r--r--dbutil.c4
-rw-r--r--random.c3
-rw-r--r--svr-session.c11
7 files changed, 24 insertions, 18 deletions
diff --git a/cli-authpubkey.c b/cli-authpubkey.c
index 8a8fb42..4798f62 100644
--- a/cli-authpubkey.c
+++ b/cli-authpubkey.c
@@ -60,8 +60,8 @@ void cli_pubkeyfail() {
void recv_msg_userauth_pk_ok() {
- struct SignKeyList *keyitem;
- buffer* keybuf;
+ struct SignKeyList *keyitem = NULL;
+ buffer* keybuf = NULL;
char* algotype = NULL;
unsigned int algolen;
int keytype;
@@ -122,6 +122,8 @@ void recv_msg_userauth_pk_ok() {
} else {
TRACE(("That was whacky. We got told that a key was valid, but it didn't match our list. Sounds like dodgy code on Dropbear's part"))
}
+
+ buf_free(keybuf);
TRACE(("leave recv_msg_userauth_pk_ok"))
}
diff --git a/cli-runopts.c b/cli-runopts.c
index 7a672da..732d7a4 100644
--- a/cli-runopts.c
+++ b/cli-runopts.c
@@ -373,8 +373,7 @@ static void addforward(char* origstr, struct TCPFwdList** fwdlist) {
TRACE(("connectaddr == NULL"))
goto fail;
}
-
- connectaddr[0] = '\0';
+ *connectaddr = '\0';
connectaddr++;
connectport = strchr(connectaddr, ':');
@@ -382,8 +381,7 @@ static void addforward(char* origstr, struct TCPFwdList** fwdlist) {
TRACE(("connectport == NULL"))
goto fail;
}
-
- connectport[0] = '\0';
+ *connectport = '\0';
connectport++;
newfwd = (struct TCPFwdList*)m_malloc(sizeof(struct TCPFwdList));
@@ -417,6 +415,8 @@ static void addforward(char* origstr, struct TCPFwdList** fwdlist) {
newfwd->next = *fwdlist;
*fwdlist = newfwd;
+ m_free(str);
+
TRACE(("leave addforward: done"))
return;
diff --git a/common-algo.c b/common-algo.c
index ae2102a..21ac96a 100644
--- a/common-algo.c
+++ b/common-algo.c
@@ -31,6 +31,8 @@
/* Mappings for ciphers, parameters are
{&cipher_desc, keysize, blocksize} */
+/* NOTE: if keysize > 2*SHA1_HASH_SIZE, code such as hashkeys()
+ needs revisiting */
#ifdef DROPBEAR_AES256_CBC
static const struct dropbear_cipher dropbear_aes256 =
diff --git a/common-kex.c b/common-kex.c
index af39d1a..dd36cd1 100644
--- a/common-kex.c
+++ b/common-kex.c
@@ -217,12 +217,10 @@ static void kexinitialise() {
* already initialised hash_state hs, which should already have processed
* the dh_K and hash, since these are common. X is the letter 'A', 'B' etc.
* out must have at least min(SHA1_HASH_SIZE, outlen) bytes allocated.
- * The output will only be expanded once, since that is all that is required
- * (for 3DES and SHA, with 24 and 20 bytes respectively).
+ * The output will only be expanded once, as we are assured that
+ * outlen <= 2*SHA1_HASH_SIZE for all known hashes.
*
- * See Section 5.2 of the IETF secsh Transport Draft for details */
-
-/* Duplicated verbatim from kex.c --mihnea */
+ * See Section 7.2 of rfc4253 (ssh transport) for details */
static void hashkeys(unsigned char *out, int outlen,
const hash_state * hs, const unsigned char X) {
diff --git a/dbutil.c b/dbutil.c
index 9445f0e..f06b8bf 100644
--- a/dbutil.c
+++ b/dbutil.c
@@ -286,9 +286,9 @@ int dropbear_listen(const char* address, const char* port,
len = 20 + strlen(strerror(err));
*errstring = (char*)m_malloc(len);
snprintf(*errstring, len, "Error listening: %s", strerror(err));
- TRACE(("leave dropbear_listen: failure, %s", strerror(err)))
- return -1;
}
+ TRACE(("leave dropbear_listen: failure, %s", strerror(err)))
+ return -1;
}
TRACE(("leave dropbear_listen: success, %d socks bound", nsock))
diff --git a/random.c b/random.c
index c836de9..36fedff 100644
--- a/random.c
+++ b/random.c
@@ -234,8 +234,7 @@ void gen_random_mpint(mp_int *max, mp_int *rand) {
/* keep regenerating until we get one satisfying
* 0 < rand < max */
- } while ( ( (max != NULL) && (mp_cmp(rand, max) != MP_LT) )
- || (mp_cmp_d(rand, 0) != MP_GT) );
+ } while (mp_cmp(rand, max) != MP_LT);
m_burn(randbuf, len);
m_free(randbuf);
}
diff --git a/svr-session.c b/svr-session.c
index 70029f8..fe78bcc 100644
--- a/svr-session.c
+++ b/svr-session.c
@@ -181,10 +181,15 @@ void svr_dropbear_log(int priority, const char* format, va_list param) {
if (!svr_opts.usingsyslog || havetrace)
{
+ struct tm * local_tm = NULL;
timesec = time(NULL);
- if (strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S",
- localtime(&timesec)) == 0) {
- datestr[0] = '?'; datestr[1] = '\0';
+ local_tm = localtime(&timesec);
+ if (local_tm == NULL
+ || strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S",
+ localtime(&timesec)) == 0)
+ {
+ // upon failure, just print the epoch-seconds time.
+ snprintf(datestr, sizeof(datestr), "%d", timesec);
}
fprintf(stderr, "[%d] %s %s\n", getpid(), datestr, printbuf);
}