Module Name: src
Committed By: vanhu
Date: Wed Mar 2 15:04:01 UTC 2011
Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: remoteconf.c rsalist.c
rsalist.h
Log Message:
free rsa structures when deleting a struct rmconf. patch by Roman Hoog Antink
<[email protected]>
To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 \
src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c
cvs rdiff -u -r1.4 -r1.5 src/crypto/dist/ipsec-tools/src/racoon/rsalist.c \
src/crypto/dist/ipsec-tools/src/racoon/rsalist.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c:1.24 src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c:1.25
--- src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c:1.24 Wed Mar 2 14:58:27 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c Wed Mar 2 15:04:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: remoteconf.c,v 1.24 2011/03/02 14:58:27 vanhu Exp $ */
+/* $NetBSD: remoteconf.c,v 1.25 2011/03/02 15:04:01 vanhu Exp $ */
/* Id: remoteconf.c,v 1.38 2006/05/06 15:52:44 manubsd Exp */
@@ -78,6 +78,7 @@
#include "isakmp_frag.h"
#include "handler.h"
#include "genlist.h"
+#include "rsalist.h"
typedef TAILQ_HEAD(_rmtree, remoteconf) remoteconf_tailq_head_t;
static remoteconf_tailq_head_t rmtree, rmtree_save;
@@ -650,6 +651,10 @@
vfree(rmconf->cacert);
if (rmconf->cacertfile)
racoon_free(rmconf->cacertfile);
+ if (rmconf->rsa_private)
+ genlist_free(rmconf->rsa_private, rsa_key_free);
+ if (rmconf->rsa_public)
+ genlist_free(rmconf->rsa_public, rsa_key_free);
if (rmconf->name)
racoon_free(rmconf->name);
if (rmconf->remote)
Index: src/crypto/dist/ipsec-tools/src/racoon/rsalist.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/rsalist.c:1.4 src/crypto/dist/ipsec-tools/src/racoon/rsalist.c:1.5
--- src/crypto/dist/ipsec-tools/src/racoon/rsalist.c:1.4 Sat Sep 9 16:22:10 2006
+++ src/crypto/dist/ipsec-tools/src/racoon/rsalist.c Wed Mar 2 15:04:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rsalist.c,v 1.4 2006/09/09 16:22:10 manu Exp $ */
+/* $NetBSD: rsalist.c,v 1.5 2011/03/02 15:04:01 vanhu Exp $ */
/* Id: rsalist.c,v 1.3 2004/11/08 12:04:23 ludvigm Exp */
@@ -88,6 +88,23 @@
return 0;
}
+void
+rsa_key_free(void *data)
+{
+ struct rsa_key *rsa_key;
+
+
+ rsa_key = (struct rsa_key *)data;
+ if (rsa_key->src)
+ free(rsa_key->src);
+ if (rsa_key->dst)
+ free(rsa_key->dst);
+ if (rsa_key->rsa)
+ RSA_free(rsa_key->rsa);
+
+ free(rsa_key);
+}
+
static void *
rsa_key_dump_one(void *entry, void *arg)
{
Index: src/crypto/dist/ipsec-tools/src/racoon/rsalist.h
diff -u src/crypto/dist/ipsec-tools/src/racoon/rsalist.h:1.4 src/crypto/dist/ipsec-tools/src/racoon/rsalist.h:1.5
--- src/crypto/dist/ipsec-tools/src/racoon/rsalist.h:1.4 Sat Sep 9 16:22:10 2006
+++ src/crypto/dist/ipsec-tools/src/racoon/rsalist.h Wed Mar 2 15:04:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rsalist.h,v 1.4 2006/09/09 16:22:10 manu Exp $ */
+/* $NetBSD: rsalist.h,v 1.5 2011/03/02 15:04:01 vanhu Exp $ */
/* Id: rsalist.h,v 1.2 2004/07/12 20:43:51 ludvigm Exp */
/*
@@ -53,6 +53,7 @@
};
int rsa_key_insert(struct genlist *list, struct netaddr *src, struct netaddr *dst, RSA *rsa);
+void rsa_key_free(void *data);
void rsa_key_dump(struct genlist *list);
struct genlist *rsa_lookup_keys(struct ph1handle *iph1, int my);