bugfix and dead code removal

This commit is contained in:
Christian Grothoff committed 2008-09-11 03:20:52 +00:00
1 parent cf41cfa6ae
commit da1654cffd
6 files changed
+39 -275

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ auth_dhe.c \
auth_rsa.c \
auth_rsa_export.c \
debug.c \
defines.h \
ext_cert_type.c \
ext_max_record.c \
ext_oprfi.c \
+2 -3
View File
@@ -30,9 +30,8 @@
#endif
/* I18n of error codes. */
#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)
#define N_(String) gettext_noop (String)
#define _(String) (String)
#define N_(String) (String)
extern LOG_FUNC _gnutls_log_func;
-2
View File
@@ -44,8 +44,6 @@
GCRY_THREAD_OPTION_PTHREAD_IMPL;
#include "gettext.h"
#define gnutls_log_func LOG_FUNC
/* created by asn1c */
+2 -1
View File
@@ -210,7 +210,8 @@ _gnutls_finished (mhd_gtls_session_t session, int type, void *ret)
if (td_sha == NULL)
{
gnutls_assert ();
mhd_gnutls_hash_deinit (td_md5, NULL);
if (td_md5 != NULL)
mhd_gnutls_hash_deinit (td_md5, NULL);
return GNUTLS_E_HASH_FAILED;
}
+34 -4
View File
@@ -42,7 +42,10 @@
#include <debug.h>
#include <x509_b64.h>
#include <gnutls_x509.h>
#include <read-file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
/* x509 */
#include "common.h"
@@ -602,6 +605,33 @@ read_key_mem (mhd_gtls_cert_credentials_t res,
return 0;
}
static char *
read_file (const char *filename, size_t * length)
{
struct stat st;
char *out;
int fd;
fd = open (filename, O_RDONLY);
if (-1 == fd)
return NULL;
if (0 != fstat(fd, &st))
goto ERR;
out = malloc(st.st_size);
if (out == NULL)
goto ERR;
if (st.st_size != read(fd, out, st.st_size))
{
free(out);
goto ERR;
}
close(fd);
return out;
ERR:
close(fd);
return NULL;
}
/* Reads a certificate file
*/
static int
@@ -610,7 +640,7 @@ read_cert_file (mhd_gtls_cert_credentials_t res,
{
int ret;
size_t size;
char *data = read_binary_file (certfile, &size);
char *data = read_file (certfile, &size);
if (data == NULL)
{
@@ -636,7 +666,7 @@ read_key_file (mhd_gtls_cert_credentials_t res,
{
int ret;
size_t size;
char *data = read_binary_file (keyfile, &size);
char *data = read_file (keyfile, &size);
if (data == NULL)
{
@@ -1080,7 +1110,7 @@ MHD_gnutls_certificate_set_x509_trust_file (mhd_gtls_cert_credentials_t
{
int ret, ret2;
size_t size;
unsigned char *data = (unsigned char*) read_binary_file (cafile, &size);
unsigned char *data = (unsigned char*) read_file (cafile, &size);
if (data == NULL)
{