[Commits] r648 - in trunk/daemon: . src
new-commit at lists.openvcp.org
new-commit at lists.openvcp.org
Sat Jan 10 14:26:11 UTC 2009
Author: ftx
Date: 2009-01-10 14:26:10 +0000 (Sat, 10 Jan 2009)
New Revision: 648
Modified:
trunk/daemon/configure.ac
trunk/daemon/src/main.c
trunk/daemon/src/main.h
trunk/daemon/src/misc.c
Log:
fix for invalid memory access in ovcp_close
Modified: trunk/daemon/configure.ac
===================================================================
--- trunk/daemon/configure.ac 2009-01-02 20:59:04 UTC (rev 647)
+++ trunk/daemon/configure.ac 2009-01-10 14:26:10 UTC (rev 648)
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT([openvcpd], [0.4 rc1], [gerrit at t4a.net])
+AC_INIT([openvcpd], [0.4 rc2], [gerrit at t4a.net])
AC_CONFIG_SRCDIR([lib/fs.c])
# Checks for programs.
Modified: trunk/daemon/src/main.c
===================================================================
--- trunk/daemon/src/main.c 2009-01-02 20:59:04 UTC (rev 647)
+++ trunk/daemon/src/main.c 2009-01-10 14:26:10 UTC (rev 648)
@@ -213,8 +213,12 @@
if(session != NULL)
{
+ session->client_addr = client_addr;
if(authenticate_client(session) == 1)
+ {
+ ovcp_log(OVCP_INFO, "%s logged in successfully (tls=%d)", inet_ntoa(session->client_addr.sin_addr), session->tls);
handle_request(session);
+ }
}
ovcp_close(session);
@@ -269,14 +273,20 @@
if(cmd == NULL)
+ {
+ free(session);
return NULL;
-
+ }
+
arguments = split_string(cmd, ' ', &args);
free(cmd);
if(arguments == NULL || args < 1)
+ {
+ free_strings(arguments, args);
+ free(session);
return NULL;
-
+ }
if(strcmp(arguments[0], "PLAINTEXT") == 0)
{
@@ -292,7 +302,7 @@
ret = gnutls_handshake(*session->tls_session);
ovcp_log(OVCP_DEBUG, "Handshake complete (%d)", ret);
-
+ session->tls = 1;
#else
ovcp_write(session, "Not Supported\n", 15);
free(session);
Modified: trunk/daemon/src/main.h
===================================================================
--- trunk/daemon/src/main.h 2009-01-02 20:59:04 UTC (rev 647)
+++ trunk/daemon/src/main.h 2009-01-10 14:26:10 UTC (rev 648)
@@ -25,6 +25,7 @@
#define MAIN_H
#include <sqlite3.h>
+ #include <netinet/in.h>
#ifdef HAVE_LIBGNUTLS
#include <gnutls/gnutls.h>
@@ -38,6 +39,8 @@
struct ovcp_session
{
int session_socket;
+ struct sockaddr_in client_addr;
+ int tls;
#ifdef HAVE_LIBGNUTLS
gnutls_session_t *tls_session;
Modified: trunk/daemon/src/misc.c
===================================================================
--- trunk/daemon/src/misc.c 2009-01-02 20:59:04 UTC (rev 647)
+++ trunk/daemon/src/misc.c 2009-01-10 14:26:10 UTC (rev 648)
@@ -106,19 +106,20 @@
int ovcp_close(struct ovcp_session *session)
{
- #ifdef HAVE_LIBGNUTLS
+ if(session != NULL)
+ {
+
+ #ifdef HAVE_LIBGNUTLS
- if(session->tls_session != NULL)
- {
- gnutls_bye (*(session->tls_session), GNUTLS_SHUT_WR);
- gnutls_deinit (*(session->tls_session));
- free(session->tls_session);
- }
+ if(session->tls_session != NULL)
+ {
+ gnutls_bye (*(session->tls_session), GNUTLS_SHUT_WR);
+ gnutls_deinit (*(session->tls_session));
+ free(session->tls_session);
+ }
- #endif
-
- if(session != NULL)
- {
+ #endif
+
close(session->session_socket);
free(session);
}
More information about the Commits
mailing list