summaryrefslogtreecommitdiff
path: root/src/libfreeswan
diff options
context:
space:
mode:
Diffstat (limited to 'src/libfreeswan')
-rw-r--r--src/libfreeswan/Makefile.in3
-rw-r--r--src/libfreeswan/atoaddr.c24
-rw-r--r--src/libfreeswan/pfkey_v2_debug.c44
-rw-r--r--src/libfreeswan/pfkey_v2_parse.c1
-rw-r--r--src/libfreeswan/satot.c12
5 files changed, 48 insertions, 36 deletions
diff --git a/src/libfreeswan/Makefile.in b/src/libfreeswan/Makefile.in
index 88ceab557..d00ae91e0 100644
--- a/src/libfreeswan/Makefile.in
+++ b/src/libfreeswan/Makefile.in
@@ -253,6 +253,8 @@ nm_ca_dir = @nm_ca_dir@
oldincludedir = @oldincludedir@
openac_plugins = @openac_plugins@
p_plugins = @p_plugins@
+pcsclite_CFLAGS = @pcsclite_CFLAGS@
+pcsclite_LIBS = @pcsclite_LIBS@
pdfdir = @pdfdir@
piddir = @piddir@
pki_plugins = @pki_plugins@
@@ -276,6 +278,7 @@ soup_LIBS = @soup_LIBS@
srcdir = @srcdir@
strongswan_conf = @strongswan_conf@
sysconfdir = @sysconfdir@
+systemdsystemunitdir = @systemdsystemunitdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
diff --git a/src/libfreeswan/atoaddr.c b/src/libfreeswan/atoaddr.c
index 8f1be0a84..a3643801e 100644
--- a/src/libfreeswan/atoaddr.c
+++ b/src/libfreeswan/atoaddr.c
@@ -45,7 +45,7 @@ struct in_addr *addrp;
{
struct addrinfo hints, *res;
struct netent *ne = NULL;
- const char *oops;
+ const char *oops, *msg = NULL;
# define HEXLEN 10 /* strlen("0x11223344") */
# ifndef ATOADDRBUF
# define ATOADDRBUF 100
@@ -84,10 +84,18 @@ struct in_addr *addrp;
/* next, check that it's a vaguely legal name */
for (q = p; *q != '\0'; q++)
+ {
if (!isprint(*q))
- return "unprintable character in name";
+ {
+ msg = "unprintable character in name";
+ goto error;
+ }
+ }
if (strspn(p, namechars) != srclen)
- return "illegal (non-DNS-name) character in name";
+ {
+ msg = "illegal (non-DNS-name) character in name";
+ goto error;
+ }
/* try as host name, failing that as /etc/networks network name */
memset(&hints, 0, sizeof(hints));
@@ -98,11 +106,8 @@ struct in_addr *addrp;
ne = getnetbyname(p);
if (ne == NULL)
{
- if (p != namebuf)
- {
- FREE(p);
- }
- return "name lookup failed";
+ msg = "name lookup failed";
+ goto error;
}
addrp->s_addr = htonl(ne->n_net);
}
@@ -113,12 +118,13 @@ struct in_addr *addrp;
freeaddrinfo(res);
}
+error:
if (p != namebuf)
{
FREE(p);
}
- return NULL;
+ return msg;
}
/*
diff --git a/src/libfreeswan/pfkey_v2_debug.c b/src/libfreeswan/pfkey_v2_debug.c
index 0217538a0..0762d8f2b 100644
--- a/src/libfreeswan/pfkey_v2_debug.c
+++ b/src/libfreeswan/pfkey_v2_debug.c
@@ -54,10 +54,11 @@ static char *pfkey_sadb_ext_strings[]={
"X-source-mask", /* SADB_X_EXT_ADDRESS_SRC_MASK 23 */
"X-dest-mask", /* SADB_X_EXT_ADDRESS_DST_MASK 24 */
"X-set-debug", /* SADB_X_EXT_DEBUG 25 */
- "X-NAT-T-type", /* SADB_X_EXT_NAT_T_TYPE 26 */
- "X-NAT-T-sport", /* SADB_X_EXT_NAT_T_SPORT 27 */
- "X-NAT-T-dport", /* SADB_X_EXT_NAT_T_DPORT 28 */
- "X-NAT-T-OA", /* SADB_X_EXT_NAT_T_OA 29 */
+ "X-protocol", /* SADB_X_EXT_PROTOCOL 26 */
+ "X-NAT-T-type", /* SADB_X_EXT_NAT_T_TYPE 27 */
+ "X-NAT-T-sport", /* SADB_X_EXT_NAT_T_SPORT 28 */
+ "X-NAT-T-dport", /* SADB_X_EXT_NAT_T_DPORT 29 */
+ "X-NAT-T-OA", /* SADB_X_EXT_NAT_T_OA 30 */
};
const char *
@@ -72,23 +73,24 @@ pfkey_v2_sadb_ext_string(int ext)
static char *pfkey_sadb_type_strings[]={
- "reserved", /* SADB_RESERVED */
- "getspi", /* SADB_GETSPI */
- "update", /* SADB_UPDATE */
- "add", /* SADB_ADD */
- "delete", /* SADB_DELETE */
- "get", /* SADB_GET */
- "acquire", /* SADB_ACQUIRE */
- "register", /* SADB_REGISTER */
- "expire", /* SADB_EXPIRE */
- "flush", /* SADB_FLUSH */
- "dump", /* SADB_DUMP */
- "x-promisc", /* SADB_X_PROMISC */
- "x-pchange", /* SADB_X_PCHANGE */
- "x-groupsa", /* SADB_X_GRPSA */
- "x-addflow(eroute)", /* SADB_X_ADDFLOW */
- "x-delflow(eroute)", /* SADB_X_DELFLOW */
- "x-debug", /* SADB_X_DEBUG */
+ "reserved", /* SADB_RESERVED */
+ "getspi", /* SADB_GETSPI */
+ "update", /* SADB_UPDATE */
+ "add", /* SADB_ADD */
+ "delete", /* SADB_DELETE */
+ "get", /* SADB_GET */
+ "acquire", /* SADB_ACQUIRE */
+ "register", /* SADB_REGISTER */
+ "expire", /* SADB_EXPIRE */
+ "flush", /* SADB_FLUSH */
+ "dump", /* SADB_DUMP */
+ "x-promisc", /* SADB_X_PROMISC */
+ "x-pchange", /* SADB_X_PCHANGE */
+ "x-groupsa", /* SADB_X_GRPSA */
+ "x-addflow(eroute)", /* SADB_X_ADDFLOW */
+ "x-delflow(eroute)", /* SADB_X_DELFLOW */
+ "x-debug", /* SADB_X_DEBUG */
+ "x-nat-t-new-mapping", /* SADB_X_NAT_T_NEW_MAPPING */
};
const char *
diff --git a/src/libfreeswan/pfkey_v2_parse.c b/src/libfreeswan/pfkey_v2_parse.c
index 49d5cdf4a..a143003b3 100644
--- a/src/libfreeswan/pfkey_v2_parse.c
+++ b/src/libfreeswan/pfkey_v2_parse.c
@@ -1247,6 +1247,7 @@ pfkey_msg_parse(struct sadb_msg *pfkey_msg,
pfkey_msg->sadb_msg_type,
pfkey_v2_sadb_type_string(pfkey_msg->sadb_msg_type));
}
+ /* fall through */
case SADB_ACQUIRE:
case SADB_REGISTER:
case SADB_EXPIRE:
diff --git a/src/libfreeswan/satot.c b/src/libfreeswan/satot.c
index e70036482..a3feb1591 100644
--- a/src/libfreeswan/satot.c
+++ b/src/libfreeswan/satot.c
@@ -77,7 +77,7 @@ size_t dstlen;
break; /* NOTE BREAK OUT */
}
if (pre == NULL) { /* unknown protocol */
- strcpy(unk, "unk");
+ strncpy(unk, "unk", sizeof(unk));
(void) ultot((unsigned char)sa->proto, 10, unk+strlen(unk),
sizeof(unk)-strlen(unk));
pre = unk;
@@ -86,9 +86,9 @@ size_t dstlen;
if (strcmp(pre, PASSTHROUGHTYPE) == 0 &&
sa->spi == PASSTHROUGHSPI &&
isunspecaddr(&sa->dst)) {
- strcpy(buf, (addrtypeof(&sa->dst) == AF_INET) ?
+ strncpy(buf, (addrtypeof(&sa->dst) == AF_INET) ?
PASSTHROUGH4NAME :
- PASSTHROUGH6NAME);
+ PASSTHROUGH6NAME, sizeof(buf));
len = strlen(buf);
}
@@ -104,13 +104,13 @@ size_t dstlen;
default: p = NULL; break;
}
if (p != NULL) {
- strcpy(buf, p);
+ strncpy(buf, p, sizeof(buf));
len = strlen(buf);
}
}
if (len == 0) { /* general case needed */
- strcpy(buf, pre);
+ strncpy(buf, pre, sizeof(buf));
len = strlen(buf);
if (showversion) {
*(buf+len) = (addrtypeof(&sa->dst) == AF_INET) ? '.' :
@@ -126,7 +126,7 @@ size_t dstlen;
if (dst != NULL) {
if (len > dstlen)
*(buf+dstlen-1) = '\0';
- strcpy(dst, buf);
+ strncpy(dst, buf, dstlen);
}
return len;
}