summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-08-04 13:18:18 +0200
committerSimon Josefsson <simon@josefsson.org>2009-08-07 01:02:39 +0200
commit39c7b1df6f29ae3037129950d7ef48b403fd41d3 (patch)
tree376886d7427312ccd0af8a36d4a39634d464faa2
parent59780bd1fff8cc4e6f5725127b6fe9c17f499a1c (diff)
downloadgnutls-39c7b1df6f29ae3037129950d7ef48b403fd41d3.tar.gz
Cleanup code.
-rw-r--r--lib/gnutls_str.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/gnutls_str.c b/lib/gnutls_str.c
index 0dc5b5a5e2..a02d9afcae 100644
--- a/lib/gnutls_str.c
+++ b/lib/gnutls_str.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2004, 2005, 2007, 2008 Free Software Foundation
+ * Copyright (C) 2002, 2004, 2005, 2007, 2008, 2009 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -364,11 +364,13 @@ _gnutls_hex2bin (const opaque * hex_data, int hex_size, opaque * bin_data,
/* compare hostname against certificate, taking account of wildcards
* return 1 on success or 0 on error
*
- * note: certnamesize is required as X509 certs can contain embedded NULLs in
+ * note: certnamesize is required as X509 certs can contain embedded NULs in
* the strings such as CN or subjectAltName
*/
int
-_gnutls_hostname_compare (const char *certname, size_t certnamesize, const char *hostname)
+_gnutls_hostname_compare (const char *certname,
+ size_t certnamesize,
+ const char *hostname)
{
/* find the first different character */
for (; *certname && *hostname && toupper (*certname) == toupper (*hostname);
@@ -376,7 +378,7 @@ _gnutls_hostname_compare (const char *certname, size_t certnamesize, const char
;
/* the strings are the same */
- if (certnamesize == 0 && strlen (hostname) == 0)
+ if (certnamesize == 0 && *hostname == '\0')
return 1;
if (*certname == '*')
@@ -390,10 +392,10 @@ _gnutls_hostname_compare (const char *certname, size_t certnamesize, const char
{
/* Use a recursive call to allow multiple wildcards */
if (_gnutls_hostname_compare (certname, certnamesize, hostname))
- {
- return 1;
- }
- /* wildcards are only allowed to match a single domain component or component fragment */
+ return 1;
+
+ /* wildcards are only allowed to match a single domain
+ component or component fragment */
if (*hostname == '\0' || *hostname == '.')
break;
hostname++;