Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > f303dbf8118b28f1269ab965584cec5f > files > 3

strongswan-2.0.2-4mdk.src.rpm

--- strongswan-2.0.2/linux/lib/libfreeswan/pfkey_v2_build.c.gcc4	2005-09-09 15:51:28.000000000 -0300
+++ strongswan-2.0.2/linux/lib/libfreeswan/pfkey_v2_build.c	2005-09-09 15:51:28.000000000 -0300
@@ -189,8 +189,8 @@
 	}
 
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_msg = (struct sadb_msg*)
-	     MALLOC(sizeof(struct sadb_msg)))) {
+	     (pfkey_msg = (struct sadb_msg*)
+	     MALLOC(sizeof(struct sadb_msg))))) {
 		DEBUGGING(
 			"pfkey_msg_hdr_build: "
 			"memory allocation failed\n");
@@ -313,8 +313,8 @@
 	}
 	
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_sa = (struct sadb_sa*)
-	     MALLOC(sizeof(struct sadb_sa)))) {
+	     (pfkey_sa = (struct sadb_sa*)
+	     MALLOC(sizeof(struct sadb_sa))))) {
 		DEBUGGING(
 			"pfkey_sa_build: "
 			"memory allocation failed\n");
@@ -390,8 +390,8 @@
 	}
 
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_lifetime = (struct sadb_lifetime*)
-	     MALLOC(sizeof(struct sadb_lifetime)))) {
+	     (pfkey_lifetime = (struct sadb_lifetime*)
+	     MALLOC(sizeof(struct sadb_lifetime))))) {
 		DEBUGGING(
 			"pfkey_lifetime_build: "
 			"memory allocation failed\n");
@@ -513,8 +513,8 @@
 	}
 
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_address = (struct sadb_address*)
-	     MALLOC(ALIGN_N(sizeof(struct sadb_address) + saddr_len, IPSEC_PFKEYv2_ALIGN) ))) {
+	     (pfkey_address = (struct sadb_address*)
+	     MALLOC(ALIGN_N(sizeof(struct sadb_address) + saddr_len, IPSEC_PFKEYv2_ALIGN) )))) {
 		DEBUGGING(
 			"pfkey_lifetime_build: "
 			"memory allocation failed\n");
@@ -585,9 +585,9 @@
 	}
 
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_key = (struct sadb_key*)
+	     (pfkey_key = (struct sadb_key*)
 	     MALLOC(sizeof(struct sadb_key) +
-				    DIVUP(key_bits, 64) * IPSEC_PFKEYv2_ALIGN))) {
+				    DIVUP(key_bits, 64) * IPSEC_PFKEYv2_ALIGN)))) {
 		DEBUGGING(
 			"pfkey_key_build: "
 			"memory allocation failed\n");
@@ -672,8 +672,8 @@
 #endif
 	    
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_ident = (struct sadb_ident*)
-	     MALLOC(ident_len * IPSEC_PFKEYv2_ALIGN))) {
+	     (pfkey_ident = (struct sadb_ident*)
+	     MALLOC(ident_len * IPSEC_PFKEYv2_ALIGN)))) {
 		DEBUGGING(
 			"pfkey_ident_build: "
 			"memory allocation failed\n");
@@ -726,9 +726,9 @@
 	SENDERR(EINVAL); /* don't process these yet */
 
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_sens = (struct sadb_sens*)
+	     (pfkey_sens = (struct sadb_sens*)
 	     MALLOC(sizeof(struct sadb_sens) +
-		    (sens_len + integ_len) * sizeof(uint64_t)))) {
+		    (sens_len + integ_len) * sizeof(uint64_t))))) {
 		DEBUGGING(
 			"pfkey_sens_build: "
 			"memory allocation failed\n");
@@ -785,9 +785,9 @@
 	}
 
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_prop = (struct sadb_prop*)
+	     (pfkey_prop = (struct sadb_prop*)
 	     MALLOC(sizeof(struct sadb_prop) +
-		    comb_num * sizeof(struct sadb_comb)))) {
+		    comb_num * sizeof(struct sadb_comb))))) {
 		DEBUGGING(
 			"pfkey_prop_build: "
 			"memory allocation failed\n");
@@ -866,10 +866,10 @@
 	}
 
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_supported = (struct sadb_supported*)
+	     (pfkey_supported = (struct sadb_supported*)
 	     MALLOC(sizeof(struct sadb_supported) +
 					       alg_num *
-					       sizeof(struct sadb_alg)))) {
+					       sizeof(struct sadb_alg))))) {
 		DEBUGGING(
 			"pfkey_supported_build: "
 			"memory allocation failed\n");
@@ -947,8 +947,8 @@
 	}
 	
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_spirange = (struct sadb_spirange*)
-	     MALLOC(sizeof(struct sadb_spirange)))) {
+	     (pfkey_spirange = (struct sadb_spirange*)
+	     MALLOC(sizeof(struct sadb_spirange))))) {
 		DEBUGGING(
 			"pfkey_spirange_build: "
 			"memory allocation failed\n");
@@ -991,8 +991,8 @@
 	SENDERR(EINVAL); /* don't process these yet */
 
 	if(!(*pfkey_ext = (struct sadb_ext*)
-	     pfkey_x_kmprivate = (struct sadb_x_kmprivate*)
-	     MALLOC(sizeof(struct sadb_x_kmprivate)))) {
+	     (pfkey_x_kmprivate = (struct sadb_x_kmprivate*)
+	     MALLOC(sizeof(struct sadb_x_kmprivate))))) {
 		DEBUGGING(
 			"pfkey_x_kmprivate_build: "
 			"memory allocation failed\n");
@@ -1044,8 +1044,8 @@
 		SENDERR(EINVAL);
 	}
 
-	if(!(*pfkey_ext = (struct sadb_ext*)pfkey_x_satype = (struct sadb_x_satype*)
-	     MALLOC(sizeof(struct sadb_x_satype)))) {
+	if(!(*pfkey_ext = (struct sadb_ext*) (pfkey_x_satype = (struct sadb_x_satype*)
+	     MALLOC(sizeof(struct sadb_x_satype))))) {
 		DEBUGGING(
 			"pfkey_x_satype_build: "
 			"memory allocation failed\n");
@@ -1101,8 +1101,8 @@
 		"tunnel=%x netlink=%x xform=%x eroute=%x spi=%x radij=%x esp=%x ah=%x rcv=%x pfkey=%x ipcomp=%x verbose=%x?\n",
 		tunnel, netlink, xform, eroute, spi, radij, esp, ah, rcv, pfkey, ipcomp, verbose);
 
-	if(!(*pfkey_ext = (struct sadb_ext*)pfkey_x_debug = (struct sadb_x_debug*)
-	     MALLOC(sizeof(struct sadb_x_debug)))) {
+	if(!(*pfkey_ext = (struct sadb_ext*) (pfkey_x_debug = (struct sadb_x_debug*)
+	     MALLOC(sizeof(struct sadb_x_debug))))) {
 		DEBUGGING(
 			"pfkey_x_debug_build: "
 			"memory allocation failed\n");
@@ -1161,8 +1161,8 @@
 		"pfkey_x_nat_t_type_build: "
 		"type=%d\n", type);
 
-	if(!(*pfkey_ext = (struct sadb_ext*)pfkey_x_nat_t_type = (struct sadb_x_nat_t_type*)
-	     MALLOC(sizeof(struct sadb_x_nat_t_type)))) {
+	if(!(*pfkey_ext = (struct sadb_ext*) (pfkey_x_nat_t_type = (struct sadb_x_nat_t_type*)
+	     MALLOC(sizeof(struct sadb_x_nat_t_type))))) {
 		DEBUGGING(
 			"pfkey_x_nat_t_type_build: "
 			"memory allocation failed\n");
@@ -1213,8 +1213,8 @@
 		"pfkey_x_nat_t_port_build: "
 		"ext=%d, port=%d\n", exttype, port);
 
-	if(!(*pfkey_ext = (struct sadb_ext*)pfkey_x_nat_t_port = (struct sadb_x_nat_t_port*)
-	     MALLOC(sizeof(struct sadb_x_nat_t_port)))) {
+	if(!(*pfkey_ext = (struct sadb_ext*) (pfkey_x_nat_t_port = (struct sadb_x_nat_t_port*)
+	     MALLOC(sizeof(struct sadb_x_nat_t_port))))) {
 		DEBUGGING(
 			"pfkey_x_nat_t_port_build: "
 			"memory allocation failed\n");
@@ -1360,7 +1360,7 @@
 			memcpy(pfkey_ext,
 			       extensions[ext],
 			       (extensions[ext])->sadb_ext_len * IPSEC_PFKEYv2_ALIGN);
-			((char*)pfkey_ext) += (extensions[ext])->sadb_ext_len * IPSEC_PFKEYv2_ALIGN;
+			(*((char**)(&pfkey_ext))) += (extensions[ext])->sadb_ext_len * IPSEC_PFKEYv2_ALIGN;
 			/* Mark that we have seen this extension and remember the header location */
 			extensions_seen |= ( 1 << ext );
 		}
--- strongswan-2.0.2/programs/pluto/kernel_alg.c.orig	2005-09-09 15:52:38.000000000 -0300
+++ strongswan-2.0.2/programs/pluto/kernel_alg.c	2005-09-09 16:11:15.000000000 -0300
@@ -326,6 +326,7 @@
 						sadb_alg.sadb_alg_ivlen=ivlen;
 						sadb_alg.sadb_alg_minbits=minbits;
 						sadb_alg.sadb_alg_maxbits=maxbits;
+						sadb_alg.sadb_alg_reserved=0;
 						ret=kernel_alg_add(satype, supp_exttype, &sadb_alg);
 						DBG(DBG_CRYPT, DBG_log("kernel_alg_proc_read() alg_id=%d, "
 							"alg_ivlen=%d, alg_minbits=%d, alg_maxbits=%d, "
===================================================================
RCS file: /public/cvs/openswan-2/programs/pluto/db_ops.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- openswan-2/programs/pluto/db_ops.c	2004/06/04 01:59:33	1.5
+++ openswan-2/programs/pluto/db_ops.c	2004/10/16 23:42:42	1.6
@@ -181,7 +181,13 @@
 	ctx->trans0 = ctx->prop.trans = new_trans;
 	/* update trans_cur (by offset) */
 	offset = (char *)(new_trans) - (char *)(old_trans);
-	(char *)(ctx->trans_cur) += offset;
+
+	{
+	  char *cctx = (char *)(ctx->trans_cur);
+	  
+	  cctx += offset;
+	  ctx->trans_cur = (struct db_trans *)cctx;
+	}
 	/* update elem count */
 	ctx->max_trans = max_trans;
 	PFREE_ST(old_trans, db_trans_st);
@@ -213,11 +219,26 @@
 	
 	/* update attrs0 and attrs_cur (obviously) */
 	offset = (char *)(new_attrs) - (char *)(old_attrs);
-	(char *)ctx->attrs0 += offset;
-	(char *)ctx->attrs_cur += offset;
+	
+	{
+	  char *actx = (char *)(ctx->attrs0);
+	  
+	  actx += offset;
+	  ctx->attrs0 = (struct db_attr *)actx;
+	  
+	  actx = (char *)ctx->attrs_cur;
+	  actx += offset;
+	  ctx->attrs_cur = (struct db_attr *)actx;
+	}
+
 	/* for each transform, rewrite attrs pointer by offsetting it */
 	for (t=ctx->prop.trans, ti=0; ti < ctx->prop.trans_cnt; t++, ti++) {
-		(char *)(t->attrs) += offset;
+	  {
+	    char *actx = (char *)(t->attrs);
+	  
+	    actx += offset;
+	    t->attrs = (struct db_attr *)actx;
+	  }
 	}
 	/* update elem count */
 	ctx->max_attrs = max_attrs;
--- strongswan-2.0.2/programs/ikeping/ikeping.c.gcc4	2005-09-09 16:31:28.000000000 -0300
+++ strongswan-2.0.2/programs/ikeping/ikeping.c	2005-09-09 16:35:15.000000000 -0300
@@ -32,6 +32,7 @@
 #include <poll.h>
 
 #include <freeswan.h>
+#include "pfkeyv2.h"
 
 #include "../pluto/constants.h"
 #include "../pluto/packet.h"
@@ -196,14 +197,15 @@
 	ip_address sender;
 	struct isakmp_hdr ih;
 	char   buf[64];
-	int n, rport, sendlen;
+	int n, rport;
+	unsigned int sendlen;
 	const char *xchg_name;
 	int xchg;
 
 	rport = 500;
 	xchg  = 0;
 	sendlen=sizeof(sender);
-	n = recvfrom(s, &ih, sizeof(ih), 0, (struct sockaddr *)&sender, &sendlen);
+	n = recvfrom(s, &ih, sizeof(ih), 0, (struct sockaddr *)&sender, (socklen_t *)&sendlen);
 
 	addrtot(&sender, 0, buf, sizeof(buf));
 	switch(afamily) {