blob: 5c091474501e49b3d425e61a2f85b8423abd423e [file] [log] [blame]
Brad Bishop7f28bc52017-12-03 23:42:40 -05001From 9135ca401186fb14e5e5110bbb04d1ccc480360a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 15 Nov 2016 04:15:44 +0000
4Subject: [PATCH] Fix build with clang
5
6Fixes for following errors found by clang
7
8src/racoon/eaytest.c:316:6: error: comparison of array 'dnstr_w1' not equal to a null pointer is always true
9 [-Werror,-Wtautological-pointer-compare]
10 if (dnstr_w1 != NULL) {
11 ^~~~~~~~ ~~~~
12src/racoon/eaytest.c:326:6: error: comparison of array 'dnstr_w1' not equal to a null pointer is always true
13 [-Werror,-Wtautological-pointer-compare]
14 if (dnstr_w1 != NULL) {
15 ^~~~~~~~ ~~~~
16
17src/racoon/isakmp.c:1134:11: error: promoted type 'int' of K&R function parameter is not compatible with the
18 parameter type 'u_int8_t' (aka 'unsigned char') declared in a previous prototype [-Werror,-Wknr-promoted-parameter]
19 u_int8_t etype;
20 ^
21src/racoon/isakmp.c:184:48: note: previous declaration is here
22 struct sockaddr *, struct sockaddr *, u_int8_t));
23 ^
24 1 error generated.
25
26src/racoon/racoonctl.c:1457:15: error: incompatible pointer types passing 'struct evt_async *' to parameter of type
27 'caddr_t' (aka 'char *') [-Werror,-Wincompatible-pointer-types]
28 print_cfg(ec, len);
29 ^~
30
31Signed-off-by: Khem Raj <raj.khem@gmail.com>
32---
33 src/racoon/eaytest.c | 4 ++--
34 src/racoon/isakmp.c | 10 +++++-----
35 src/racoon/racoonctl.c | 7 +++----
36 3 files changed, 10 insertions(+), 11 deletions(-)
37
38diff --git a/src/racoon/eaytest.c b/src/racoon/eaytest.c
39index 1474bdc..d609e4f 100644
40--- a/src/racoon/eaytest.c
41+++ b/src/racoon/eaytest.c
42@@ -313,7 +313,7 @@ certtest(ac, av)
43
44 printf("exact match: succeed.\n");
45
46- if (dnstr_w1 != NULL) {
47+ if (dnstr_w1[0] != '\0') {
48 asn1dn = eay_str2asn1dn(dnstr_w1, strlen(dnstr_w1));
49 if (asn1dn == NULL || asn1dn->l == asn1dn0.l)
50 errx(1, "asn1dn length wrong for wildcard 1\n");
51@@ -323,7 +323,7 @@ certtest(ac, av)
52 printf("wildcard 1 match: succeed.\n");
53 }
54
55- if (dnstr_w1 != NULL) {
56+ if (dnstr_w1[0] != '\0') {
57 asn1dn = eay_str2asn1dn(dnstr_w2, strlen(dnstr_w2));
58 if (asn1dn == NULL || asn1dn->l == asn1dn0.l)
59 errx(1, "asn1dn length wrong for wildcard 2\n");
60diff --git a/src/racoon/isakmp.c b/src/racoon/isakmp.c
61index 2672f7a..da7ebe8 100644
62--- a/src/racoon/isakmp.c
63+++ b/src/racoon/isakmp.c
64@@ -567,7 +567,7 @@ isakmp_main(msg, remote, local)
65
66 /* it must be responder's 1st exchange. */
67 if (isakmp_ph1begin_r(msg, remote, local,
68- isakmp->etype) < 0)
69+ (u_int8_t)isakmp->etype) < 0)
70 return -1;
71 break;
72
73@@ -1128,10 +1128,10 @@ isakmp_ph1begin_i(rmconf, remote, local)
74
75 /* new negotiation of phase 1 for responder */
76 static int
77-isakmp_ph1begin_r(msg, remote, local, etype)
78- vchar_t *msg;
79- struct sockaddr *remote, *local;
80- u_int8_t etype;
81+isakmp_ph1begin_r(vchar_t *msg,
82+ struct sockaddr *remote,
83+ struct sockaddr *local,
84+ u_int8_t etype)
85 {
86 struct isakmp *isakmp = (struct isakmp *)msg->v;
87 struct ph1handle *iph1;
88diff --git a/src/racoon/racoonctl.c b/src/racoon/racoonctl.c
89index da28ecd..bbf068e 100644
90--- a/src/racoon/racoonctl.c
91+++ b/src/racoon/racoonctl.c
92@@ -1299,9 +1299,8 @@ print_evt(evtdump)
93 * Print ISAKMP mode config info (IP and banner)
94 */
95 void
96-print_cfg(buf, len)
97- caddr_t buf;
98- int len;
99+print_cfg(caddr_t buf,
100+ int len)
101 {
102 struct evt_async *evtdump = (struct evt_async *)buf;
103 struct isakmp_data *attr;
104@@ -1454,7 +1453,7 @@ handle_recv(combuf)
105 else if (evt_quit_event == ec->ec_type) {
106 switch (ec->ec_type) {
107 case EVT_PHASE1_MODE_CFG:
108- print_cfg(ec, len);
109+ print_cfg((caddr_t)ec, len);
110 break;
111 default:
112 print_evt(ec);
113--
1141.9.1
115