gnutls changes from ubuntu package
This commit is contained in:
parent
0913287ee1
commit
ce61512a0d
|
@ -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
|
* Copyright (C) 2001-2008 Philip Coombes
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* 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
|
// Function to validate an authentication string
|
||||||
User *zmLoadAuthUser( const char *auth, bool use_remote_addr )
|
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
|
#ifdef HAVE_GCRYPT_H
|
||||||
// Special initialisation for libgcrypt
|
// Special initialisation for libgcrypt
|
||||||
if ( !gcry_check_version( GCRYPT_VERSION ) )
|
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_key[512] = "";
|
||||||
char auth_md5[32+1] = "";
|
char auth_md5[32+1] = "";
|
||||||
size_t md5len = 32;
|
unsigned char md5sum[MD5_DIGEST_LENGTH];
|
||||||
unsigned char md5sum[md5len];
|
|
||||||
|
|
||||||
time_t now = time( 0 );
|
time_t now = time( 0 );
|
||||||
int max_tries = 2;
|
int max_tries = 2;
|
||||||
|
@ -217,14 +216,9 @@ User *zmLoadAuthUser( const char *auth, bool use_remote_addr )
|
||||||
now_tm->tm_year
|
now_tm->tm_year
|
||||||
);
|
);
|
||||||
|
|
||||||
#if HAVE_DECL_MD5
|
|
||||||
MD5( (unsigned char *)auth_key, strlen(auth_key), md5sum );
|
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';
|
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] );
|
sprintf( &auth_md5[2*j], "%02x", md5sum[j] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* Copyright (C) 2001-2008 Philip Coombes
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -23,17 +23,14 @@
|
||||||
#ifndef ZM_USER_H
|
#ifndef ZM_USER_H
|
||||||
#define ZM_USER_H
|
#define ZM_USER_H
|
||||||
|
|
||||||
#if HAVE_GNUTLS_OPENSSL_H
|
#if HAVE_LIBGNUTLS_OPENSSL
|
||||||
#include <gnutls/openssl.h>
|
#include <gnutls/openssl.h>
|
||||||
#endif
|
|
||||||
#if HAVE_GNUTLS_GNUTLS_H
|
|
||||||
#include <gnutls/gnutls.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_GCRYPT_H
|
#if HAVE_GCRYPT_H
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
#endif // HAVE_GCRYPT_H
|
||||||
#elif HAVE_LIBCRYPTO
|
#elif HAVE_LIBCRYPTO
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
#endif // HAVE_L || HAVE_LIBCRYPTO
|
#endif // HAVE_LIBGNUTLS_OPENSSL || HAVE_LIBCRYPTO
|
||||||
|
|
||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue