浏览代码

Attempt to restore compatibility with older GnuTLS versions


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4264 3789f03b-4d11-0410-bbf8-ca57d06f2519
tags/v1.0.90
DRC 13 年前
父节点
当前提交
ff1e1ff941
共有 1 个文件被更改,包括 15 次插入2 次删除
  1. 15
    2
      common/rfb/CSecurityTLS.cxx

+ 15
- 2
common/rfb/CSecurityTLS.cxx 查看文件

/*
/*
* Copyright (C) 2004 Red Hat Inc. * Copyright (C) 2004 Red Hat Inc.
* Copyright (C) 2005 Martin Koegler * Copyright (C) 2005 Martin Koegler
* Copyright (C) 2010 TigerVNC Team * Copyright (C) 2010 TigerVNC Team
#error "This header should not be compiled without HAVE_GNUTLS defined" #error "This header should not be compiled without HAVE_GNUTLS defined"
#endif #endif


#if !defined(GNUTLS_VERSION_NUMBER) || (GNUTLS_VERSION_NUMBER < 0x020708)
#define GNUTLS_CERT_NOT_ACTIVATED 512
#define GNUTLS_CERT_EXPIRED 1024
#endif

#if !defined(GNUTLS_VERSION_NUMBER) || (GNUTLS_VERSION_NUMBER < 0x020301)
#define GNUTLS_CRT_PRINT_ONELINE 1
#endif



#include <stdlib.h> #include <stdlib.h>
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> #include <unistd.h>
const gnutls_datum *cert_list; const gnutls_datum *cert_list;
unsigned int cert_list_size = 0; unsigned int cert_list_size = 0;
unsigned int i; unsigned int i;
gnutls_datum_t info;
gnutls_datum info;


if (anon) if (anon)
return; return;
if (gnutls_x509_crt_import(crt, &cert_list[i],GNUTLS_X509_FMT_DER) < 0) if (gnutls_x509_crt_import(crt, &cert_list[i],GNUTLS_X509_FMT_DER) < 0)
throw AuthFailureException("decoding of certificate failed"); throw AuthFailureException("decoding of certificate failed");


#if defined(GNUTLS_VERSION_NUMBER) && (GNUTLS_VERSION_NUMBER >= 0x010706)
if (gnutls_x509_crt_print(crt, GNUTLS_CRT_PRINT_ONELINE, &info)) { if (gnutls_x509_crt_print(crt, GNUTLS_CRT_PRINT_ONELINE, &info)) {
/* /*
* GNUTLS doesn't correctly export gnutls_free symbol which is * GNUTLS doesn't correctly export gnutls_free symbol which is
#endif #endif
throw AuthFailureException("Could not find certificate to display"); throw AuthFailureException("Could not find certificate to display");
} }
#endif


if (gnutls_x509_crt_check_hostname(crt, client->getServerName()) == 0) { if (gnutls_x509_crt_check_hostname(crt, client->getServerName()) == 0) {
char buf[255]; char buf[255];

正在加载...
取消
保存