#define WITHOUT_X509_TIMES
#endif
-#define TLS_DEBUG
-
using namespace rfb;
StringParameter CSecurityTLS::x509ca("x509ca", "X509 CA certificate", "", ConfViewer);
StringParameter CSecurityTLS::x509crl("x509crl", "X509 CRL file", "", ConfViewer);
static LogWriter vlog("TLS");
-
-#ifdef TLS_DEBUG
-static LogWriter vlog_raw("Raw TLS");
+static LogWriter vlog_raw("RawTLS");
static void debug_log(int level, const char* str)
{
vlog_raw.debug(str);
}
-#endif
void CSecurityTLS::initGlobal()
{
if (!globalInitDone) {
gnutls_global_init();
-#ifdef TLS_DEBUG
- gnutls_global_set_log_level(10);
- gnutls_global_set_log_function(debug_log);
-#endif
+ /* 100 means debug log */
+ if (vlog_raw.getLevel() >= 100) {
+ gnutls_global_set_log_level(10);
+ gnutls_global_set_log_function(debug_log);
+ }
globalInitDone = true;
}
void setLog(Logger *logger);
void setLevel(int level);
+ int getLevel(void) { return m_level; }
inline void write(int level, const char* format, ...) {
if (m_log && (level <= m_level)) {
#include <rdr/TLSOutStream.h>
#define DH_BITS 1024 /* XXX This should be configurable! */
-#define TLS_DEBUG
using namespace rfb;
("x509key", "specifies path to the key of the x509 certificate in PEM format", "", ConfServer);
static LogWriter vlog("TLS");
+static LogWriter vlog_raw("RawTLS");
-#ifdef TLS_DEBUG
static void debug_log(int level, const char* str)
{
vlog.debug(str);
}
-#endif
void SSecurityTLS::initGlobal()
{
if (gnutls_global_init() != GNUTLS_E_SUCCESS)
throw AuthFailureException("gnutls_global_init failed");
-#ifdef TLS_DEBUG
- gnutls_global_set_log_level(10);
- gnutls_global_set_log_function(debug_log);
-#endif
+ /* 100 means debug log */
+ if (vlog_raw.getLevel() >= 100) {
+ gnutls_global_set_log_level(10);
+ gnutls_global_set_log_function(debug_log);
+ }
globalInitDone = true;
}