|
|
24c59a |
From 500b87127e6c4edc5f7182cc1a5261c4f96f38e1 Mon Sep 17 00:00:00 2001
|
|
|
24c59a |
From: Chris <ccpp@gmx.at>
|
|
|
24c59a |
Date: Mon, 17 Jun 2013 21:26:35 +0200
|
|
|
24c59a |
Subject: [PATCH 4/5] Using the more efficient code for comparing host names
|
|
|
24c59a |
|
|
|
24c59a |
---
|
|
|
24c59a |
libfreerdp-core/tls.c | 24 ------------------------
|
|
|
24c59a |
1 file changed, 24 deletions(-)
|
|
|
24c59a |
|
|
|
24c59a |
diff --git a/libfreerdp-core/tls.c b/libfreerdp-core/tls.c
|
|
|
24c59a |
index db09960..2fbaa2c 100644
|
|
|
24c59a |
--- a/libfreerdp-core/tls.c
|
|
|
24c59a |
+++ b/libfreerdp-core/tls.c
|
|
|
24c59a |
@@ -268,30 +268,6 @@ boolean tls_match_hostname(char *pattern, int pattern_length, char *hostname)
|
|
|
56112c |
return true;
|
|
|
24c59a |
}
|
|
|
24c59a |
|
|
|
24c59a |
- /* ccpp: Check for wildcard certificates */
|
|
|
24c59a |
- if (memchr(pattern, '*', pattern_length) != NULL)
|
|
|
24c59a |
- {
|
|
|
24c59a |
- /* The wildcard matches one subdomain level (all except a dot) */
|
|
|
24c59a |
-
|
|
|
24c59a |
- int pattern_position = 0;
|
|
|
24c59a |
- int hostname_position = 0;
|
|
|
24c59a |
-
|
|
|
24c59a |
- for(; hostname[hostname_position] && pattern_position < pattern_length; pattern_position++, hostname_position++)
|
|
|
24c59a |
- {
|
|
|
24c59a |
- if( pattern[pattern_position] == '*' ) {
|
|
|
24c59a |
- while( hostname[hostname_position] != '.' && hostname[hostname_position] != '\0' )
|
|
|
24c59a |
- hostname_position++;
|
|
|
24c59a |
-
|
|
|
24c59a |
- pattern_position++;
|
|
|
24c59a |
- }
|
|
|
24c59a |
-
|
|
|
24c59a |
- if (hostname[hostname_position] != pattern[pattern_position] )
|
|
|
24c59a |
- {
|
|
|
56112c |
- return false;
|
|
|
24c59a |
- }
|
|
|
24c59a |
- }
|
|
|
24c59a |
- }
|
|
|
24c59a |
-
|
|
|
24c59a |
if (pattern_length > 2 && pattern[0] == '*' && pattern[1] == '.')
|
|
|
24c59a |
{
|
|
|
24c59a |
char *check_hostname = &hostname[ strlen(hostname) - pattern_length+1 ];
|
|
|
24c59a |
--
|
|
|
24c59a |
2.5.5
|
|
|
24c59a |
|