summaryrefslogtreecommitdiff
path: root/sbin/isakmpd/exchange.c
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2002-01-23 18:24:35 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2002-01-23 18:24:35 +0000
commit618c84368110cef1cef36fa77cdccb5fb64e67c2 (patch)
tree067421d084ae6e6acbfcb80d16ff93a6ecea92f0 /sbin/isakmpd/exchange.c
parent06a8d66b021d7c173881d28d46ce27b18871f0b3 (diff)
snprintf, and only dump exchange data if USE_DEBUG is defined
Diffstat (limited to 'sbin/isakmpd/exchange.c')
-rw-r--r--sbin/isakmpd/exchange.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sbin/isakmpd/exchange.c b/sbin/isakmpd/exchange.c
index 68b028306fd..826005aba9b 100644
--- a/sbin/isakmpd/exchange.c
+++ b/sbin/isakmpd/exchange.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exchange.c,v 1.63 2002/01/03 16:27:41 ho Exp $ */
+/* $OpenBSD: exchange.c,v 1.64 2002/01/23 18:24:34 ho Exp $ */
/* $EOM: exchange.c,v 1.143 2000/12/04 00:02:25 angelos Exp $ */
/*
@@ -808,7 +808,9 @@ exchange_establish_p1 (struct transport *t, u_int8_t type, u_int32_t doi,
exchange->finalize_arg = arg;
cookie_gen (t, exchange, exchange->cookies, ISAKMP_HDR_ICOOKIE_LEN);
exchange_enter (exchange);
+#ifdef USE_DEBUG
exchange_dump ("exchange_establish_p1", exchange);
+#endif
msg = message_alloc (t, 0, ISAKMP_HDR_SZ);
msg->exchange = exchange;
@@ -925,7 +927,9 @@ exchange_establish_p2 (struct sa *isakmp_sa, u_int8_t type, char *name,
getrandom (exchange->message_id, ISAKMP_HDR_MESSAGE_ID_LEN);
exchange->flags |= EXCHANGE_FLAG_ENCRYPT;
exchange_enter (exchange);
+#ifdef USE_DEBUG
exchange_dump ("exchange_establish_p2", exchange);
+#endif
/*
* Do not create SA's for informational exchanges.
@@ -1071,7 +1075,9 @@ exchange_setup_p1 (struct message *msg, u_int32_t doi)
ISAKMP_HDR_RCOOKIE_LEN);
GET_ISAKMP_HDR_ICOOKIE (msg->iov[0].iov_base, exchange->cookies);
exchange_enter (exchange);
+#ifdef USE_DEBUG
exchange_dump ("exchange_setup_p1", exchange);
+#endif
return exchange;
}
@@ -1089,7 +1095,9 @@ exchange_setup_p2 (struct message *msg, u_int8_t doi)
GET_ISAKMP_HDR_RCOOKIE (buf, exchange->cookies + ISAKMP_HDR_ICOOKIE_LEN);
GET_ISAKMP_HDR_MESSAGE_ID (buf, exchange->message_id);
exchange_enter (exchange);
+#ifdef USE_DEBUG
exchange_dump ("exchange_setup_p2", exchange);
+#endif
return exchange;
}
@@ -1121,7 +1129,7 @@ exchange_dump_real (char *header, struct exchange *exchange, int class,
snprintf (buf, bufsize_max, "sa_list ");
for (sa = TAILQ_FIRST (&exchange->sa_list);
sa && strlen (buf) < bufsize_max; sa = TAILQ_NEXT (sa, next))
- sprintf (buf + strlen (buf), "%p ", sa);
+ snprintf (buf + strlen (buf), bufsize_max - strlen (buf), "%p ", sa);
if (sa)
strlcat (buf, "...", bufsize_max);
}
@@ -1303,7 +1311,9 @@ exchange_finalize (struct message *msg)
struct cert_handler *handler;
int i;
+#ifdef USE_DEBUG
exchange_dump ("exchange_finalize", exchange);
+#endif
/*
* Walk over all the SAs and noting them as ready. If we set the