summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2002-06-09 04:25:32 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2002-06-09 04:25:32 +0000
commit581af3f0e739b119532f388160b021195f073d57 (patch)
treeece6ae6aa05396b00733a287e80b801a3f73bd98 /sbin
parent86f802bd077d519ee2104ccca8220e64547636d5 (diff)
Mark attr payload as handled. Also make sure the correct payload
length is returned.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/isakmp_cfg.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sbin/isakmpd/isakmp_cfg.c b/sbin/isakmpd/isakmp_cfg.c
index f59bb765fc0..f2d9608e414 100644
--- a/sbin/isakmpd/isakmp_cfg.c
+++ b/sbin/isakmpd/isakmp_cfg.c
@@ -408,7 +408,7 @@ cfg_initiator_recv_ATTR (struct message *msg)
case ISAKMP_CFG_ACK:
if (ie->cfg_type != ISAKMP_CFG_SET)
{
- log_print ("cfg_initiator_recv_ATTR: backup packet type ACK");
+ log_print ("cfg_initiator_recv_ATTR: bad packet type ACK");
message_drop (msg, ISAKMP_NOTIFY_PAYLOAD_MALFORMED, 0, 1, 0);
return -1;
}
@@ -476,6 +476,7 @@ cfg_initiator_recv_ATTR (struct message *msg)
break;
}
+ attrp->flags |= PL_MARK;
return 0;
}
@@ -772,11 +773,11 @@ cfg_encode_attributes (struct isakmp_cfg_attr_head *attrs, u_int32_t type,
struct sockaddr *sa;
sa_family_t family;
u_int32_t value;
- u_int16_t attrlen, off;
+ u_int16_t off;
char *field;
/* Compute length */
- attrlen = ISAKMP_ATTRIBUTE_SZ;
+ *len = ISAKMP_ATTRIBUTE_SZ;
for (attr = LIST_FIRST (attrs); attr; attr = LIST_NEXT (attr, link))
{
/* With ACK we only include the attrs we've actually used. */
@@ -823,15 +824,15 @@ cfg_encode_attributes (struct isakmp_cfg_attr_head *attrs, u_int32_t type,
attr->ignore++;
/* XXX Log! */
}
- attrlen += ISAKMP_ATTR_SZ + attr->length;
+ *len += ISAKMP_ATTR_SZ + attr->length;
}
/* Allocate enough space for the payload */
- *attrp = calloc (1, attrlen);
+ *attrp = calloc (1, *len);
if (!*attrp)
{
log_error ("cfg_encode_attributes: calloc (1, %lu) failed",
- (unsigned long)attrlen);
+ (unsigned long)*len);
return -1;
}