Fix case sensitive hostname comparison in tls

To do this I've swapped _strnicmp with memcmp. Seemless, but does lock it to the restrictions of that function.

Signed-off-by: Jason Plum <jplum@archlinuxarm.org>
This commit is contained in:
Jason Plum 2015-03-10 16:48:35 -04:00
parent c9c8f8cc89
commit 30f28d4ac9
1 changed files with 3 additions and 2 deletions

View File

@ -22,6 +22,7 @@
#endif
#include <assert.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/sspi.h>
@ -924,7 +925,7 @@ BOOL tls_match_hostname(char *pattern, int pattern_length, char *hostname)
{
if (strlen(hostname) == pattern_length)
{
if (memcmp((void*) hostname, (void*) pattern, pattern_length) == 0)
if (_strnicmp( hostname, pattern, pattern_length) == 0)
return TRUE;
}
@ -932,7 +933,7 @@ BOOL tls_match_hostname(char *pattern, int pattern_length, char *hostname)
{
char* check_hostname = &hostname[strlen(hostname) - pattern_length + 1];
if (memcmp((void*) check_hostname, (void*) &pattern[1], pattern_length - 1) == 0)
if (_strnicmp( check_hostname, &pattern[1], pattern_length - 1) == 0)
{
return TRUE;
}