[Openvas-commits] r230 - in trunk/openvas-libraries: . libopenvas
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jun 20 19:22:03 CEST 2007
Author: bh
Date: 2007-06-20 19:22:00 +0200 (Wed, 20 Jun 2007)
New Revision: 230
Modified:
trunk/openvas-libraries/ChangeLog
trunk/openvas-libraries/libopenvas/network.c
Log:
* libopenvas/network.c: Keep a pointer to the gnutls credentials
struct so that it can be freed properly:
(struct nessus_connection): New member tls_cred
(release_connection_fd): Free tls_cred
(open_SSL_connection): Store the credentials in the tls_cred
member
Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog 2007-06-20 17:08:47 UTC (rev 229)
+++ trunk/openvas-libraries/ChangeLog 2007-06-20 17:22:00 UTC (rev 230)
@@ -1,5 +1,14 @@
2007-06-20 Bernhard Herzog <bh at intevation.de>
+ * libopenvas/network.c: Keep a pointer to the gnutls credentials
+ struct so that it can be freed properly:
+ (struct nessus_connection): New member tls_cred
+ (release_connection_fd): Free tls_cred
+ (open_SSL_connection): Store the credentials in the tls_cred
+ member
+
+2007-06-20 Bernhard Herzog <bh at intevation.de>
+
* libopenvas/network.c (load_file, unload_file): New. Helper
functions to load certificates and keys.
(load_cert_and_key): New. Loads certificate and key files into
Modified: trunk/openvas-libraries/libopenvas/network.c
===================================================================
--- trunk/openvas-libraries/libopenvas/network.c 2007-06-20 17:08:47 UTC (rev 229)
+++ trunk/openvas-libraries/libopenvas/network.c 2007-06-20 17:22:00 UTC (rev 230)
@@ -64,6 +64,7 @@
int port;
gnutls_session_t tls_session; /* GnuTLS session */
+ gnutls_certificate_credentials_t tls_cred; /* GnuTLS credentials */
pid_t pid; /* Owner - for debugging only */
@@ -218,6 +219,8 @@
if (p->tls_session != NULL)
gnutls_deinit(p->tls_session);
+ if (p->tls_cred != NULL)
+ gnutls_certificate_free_credentials(p->tls_cred);
bzero(p, sizeof(*p));
p->transport = -1;
@@ -679,7 +682,6 @@
time_t tictac;
fd_set fdw, fdr;
struct timeval to;
- gnutls_certificate_credentials_t xcred;
nessus_SSL_init(NULL);
@@ -712,18 +714,18 @@
break;
}
- gnutls_certificate_allocate_credentials(&xcred);
- gnutls_credentials_set(fp->tls_session, GNUTLS_CRD_CERTIFICATE, xcred);
+ gnutls_certificate_allocate_credentials(&fp->tls_cred);
+ gnutls_credentials_set(fp->tls_session, GNUTLS_CRD_CERTIFICATE, fp->tls_cred);
if (cert != NULL && key != NULL)
{
- if (load_cert_and_key(xcred, cert, key, passwd) < 0)
+ if (load_cert_and_key(fp->tls_cred, cert, key, passwd) < 0)
return -1;
}
if (cafile != NULL)
{
- ret = gnutls_certificate_set_x509_trust_file(xcred, cafile,
+ ret = gnutls_certificate_set_x509_trust_file(fp->tls_cred, cafile,
GNUTLS_X509_FMT_PEM);
if (ret < 0)
{
More information about the Openvas-commits
mailing list