gnutls changes from ubuntu package

This commit is contained in:
Isaac Connor 2013-04-29 15:32:55 -04:00
parent 0913287ee1
commit ce61512a0d
2 changed files with 74 additions and 83 deletions

View File

@ -1,5 +1,5 @@
/*
* ZoneMinder regular expression class implementation, $Date$, $Revision$
* ZoneMinder regular expression class implementation, $Date: 2011-08-03 12:31:06 +0100 (Wed, 03 Aug 2011) $, $Revision: 3489 $
* Copyright (C) 2001-2008 Philip Coombes
*
* This program is free software; you can redistribute it and/or
@ -143,7 +143,7 @@ User *zmLoadUser( const char *username, const char *password )
// Function to validate an authentication string
User *zmLoadAuthUser( const char *auth, bool use_remote_addr )
{
#if HAVE_DECL_MD5 || HAVE_DECL_GNUTLS_FINGERPRINT
#if HAVE_DECL_MD5
#ifdef HAVE_GCRYPT_H
// Special initialisation for libgcrypt
if ( !gcry_check_version( GCRYPT_VERSION ) )
@ -196,8 +196,7 @@ User *zmLoadAuthUser( const char *auth, bool use_remote_addr )
char auth_key[512] = "";
char auth_md5[32+1] = "";
size_t md5len = 32;
unsigned char md5sum[md5len];
unsigned char md5sum[MD5_DIGEST_LENGTH];
time_t now = time( 0 );
int max_tries = 2;
@ -217,14 +216,9 @@ User *zmLoadAuthUser( const char *auth, bool use_remote_addr )
now_tm->tm_year
);
#if HAVE_DECL_MD5
MD5( (unsigned char *)auth_key, strlen(auth_key), md5sum );
#elif HAVE_DECL_GNUTLS_FINGERPRINT
gnutls_datum_t md5data = { (unsigned char *)auth_key, strlen(auth_key) };
gnutls_fingerprint( GNUTLS_DIG_MD5, &md5data, md5sum, &md5len );
#endif
auth_md5[0] = '\0';
for ( int j = 0; j < md5len; j++ )
for ( int j = 0; j < MD5_DIGEST_LENGTH; j++ )
{
sprintf( &auth_md5[2*j], "%02x", md5sum[j] );
}

View File

@ -1,5 +1,5 @@
/*
* ZoneMinder User Class Interface, $Date$, $Revision$
* ZoneMinder User Class Interface, $Date: 2010-11-11 12:11:06 +0000 (Thu, 11 Nov 2010) $, $Revision: 3188 $
* Copyright (C) 2001-2008 Philip Coombes
*
* This program is free software; you can redistribute it and/or
@ -23,17 +23,14 @@
#ifndef ZM_USER_H
#define ZM_USER_H
#if HAVE_GNUTLS_OPENSSL_H
#if HAVE_LIBGNUTLS_OPENSSL
#include <gnutls/openssl.h>
#endif
#if HAVE_GNUTLS_GNUTLS_H
#include <gnutls/gnutls.h>
#endif
#if HAVE_GCRYPT_H
#include <gcrypt.h>
#endif // HAVE_GCRYPT_H
#elif HAVE_LIBCRYPTO
#include <openssl/md5.h>
#endif // HAVE_L || HAVE_LIBCRYPTO
#endif // HAVE_LIBGNUTLS_OPENSSL || HAVE_LIBCRYPTO
class User
{