wfreerdp: minor fixes
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Tue, 28 Feb 2012 22:10:06 +0000 (17:10 -0500)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Tue, 28 Feb 2012 22:10:06 +0000 (17:10 -0500)
client/Windows/wfreerdp.c
libfreerdp-crypto/tls.c
libfreerdp-utils/file.c

index d293edb..2ffec2d 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <tchar.h>
 #include <sys/types.h>
 
 #ifdef _MSC_VER
@@ -178,7 +179,7 @@ boolean wf_pre_connect(freerdp* instance)
 
        wfi->clrconv = (HCLRCONV) xzalloc(sizeof(CLRCONV));
        wfi->clrconv->palette = NULL;
-       wfi->clrconv->alpha = 0;
+       wfi->clrconv->alpha = false;
 
        instance->context->cache = cache_new(settings);
 
@@ -385,6 +386,32 @@ boolean wf_post_connect(freerdp* instance)
 
 boolean wf_verify_certificate(freerdp* instance, char* subject, char* issuer, char* fingerprint)
 {
+#if 0
+       DWORD mode;
+       int read_size;
+       DWORD read_count;
+       TCHAR answer[2];
+       TCHAR* read_buffer;
+       HANDLE input_handle;
+#endif
+
+       printf("Certificate details:\n");
+       printf("\tSubject: %s\n", subject);
+       printf("\tIssuer: %s\n", issuer);
+       printf("\tThumbprint: %s\n", fingerprint);
+       printf("The above X.509 certificate could not be verified, possibly because you do not have "
+               "the CA certificate in your certificate store, or the certificate has expired. "
+               "Please look at the documentation on how to create local certificate store for a private CA.\n");
+
+       /* TODO: ask for user validation */
+#if 0
+       input_handle = GetStdHandle(STD_INPUT_HANDLE);
+
+       GetConsoleMode(input_handle, &mode);
+       mode |= ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT;
+       SetConsoleMode(input_handle, mode);
+#endif
+
        return true;
 }
 
index 09df895..ca342ad 100644 (file)
@@ -404,6 +404,7 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
                xfree(fingerprint);
        }
 
+#ifndef _WIN32
        if (common_name)
                xfree(common_name);
 
@@ -414,6 +415,7 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
 
                xfree(alt_names);
        }
+#endif
 
        if (certificate_data)
        {
index 05fc597..ba0706c 100644 (file)
@@ -44,7 +44,7 @@
 #include <windows.h>
 #define PATH_SEPARATOR_STR     "\\"
 #define PATH_SEPARATOR_CHR     '\\'
-#define HOME_ENV_VARIABLE      "HOMEPATH"
+#define HOME_ENV_VARIABLE      "HOME"
 #endif
 
 #ifdef _WIN32
@@ -94,7 +94,7 @@ char* freerdp_get_config_path(rdpSettings* settings)
                return settings->config_path;
 
        settings->config_path = (char*) xmalloc(strlen(settings->home_path) + sizeof(FREERDP_CONFIG_DIR) + 2);
-       sprintf(settings->config_path, "%s/%s", settings->home_path, FREERDP_CONFIG_DIR);
+       sprintf(settings->config_path, "%s" PATH_SEPARATOR_STR "%s", settings->home_path, FREERDP_CONFIG_DIR);
 
        if (!freerdp_check_file_exists(settings->config_path))
                freerdp_mkdir(settings->config_path);