Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/ipsec-tools/src/racoon free rsa structures when ...



details:   https://anonhg.NetBSD.org/src/rev/f9a36d966500
branches:  trunk
changeset: 762836:f9a36d966500
user:      vanhu <vanhu%NetBSD.org@localhost>
date:      Wed Mar 02 15:04:01 2011 +0000

description:
free rsa structures when deleting a struct rmconf. patch by Roman Hoog Antink <rha%open.ch@localhost>

diffstat:

 crypto/dist/ipsec-tools/src/racoon/remoteconf.c |   7 ++++++-
 crypto/dist/ipsec-tools/src/racoon/rsalist.c    |  19 ++++++++++++++++++-
 crypto/dist/ipsec-tools/src/racoon/rsalist.h    |   3 ++-
 3 files changed, 26 insertions(+), 3 deletions(-)

diffs (78 lines):

diff -r d4d614f1c19c -r f9a36d966500 crypto/dist/ipsec-tools/src/racoon/remoteconf.c
--- a/crypto/dist/ipsec-tools/src/racoon/remoteconf.c   Wed Mar 02 14:58:27 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/remoteconf.c   Wed Mar 02 15:04:01 2011 +0000
@@ -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)
diff -r d4d614f1c19c -r f9a36d966500 crypto/dist/ipsec-tools/src/racoon/rsalist.c
--- a/crypto/dist/ipsec-tools/src/racoon/rsalist.c      Wed Mar 02 14:58:27 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/rsalist.c      Wed Mar 02 15:04:01 2011 +0000
@@ -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)
 {
diff -r d4d614f1c19c -r f9a36d966500 crypto/dist/ipsec-tools/src/racoon/rsalist.h
--- a/crypto/dist/ipsec-tools/src/racoon/rsalist.h      Wed Mar 02 14:58:27 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/rsalist.h      Wed Mar 02 15:04:01 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index