Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "curlcheck.h"
00023
00024 #include "hostcheck.h"
00025
00026 static CURLcode unit_setup(void)
00027 {
00028 return CURLE_OK;
00029 }
00030
00031 static void unit_stop(void)
00032 {
00033
00034 }
00035
00036 UNITTEST_START
00037
00038
00039 #if defined(USE_OPENSSL) || defined(USE_AXTLS) || defined(USE_GSKIT)
00040
00041
00042
00043 fail_unless(Curl_cert_hostcheck("www.example.com", "www.example.com"),
00044 "good 1");
00045 fail_unless(Curl_cert_hostcheck("*.example.com", "www.example.com"),
00046 "good 2");
00047 fail_unless(Curl_cert_hostcheck("xxx*.example.com", "xxxwww.example.com"),
00048 "good 3");
00049 fail_unless(Curl_cert_hostcheck("f*.example.com", "foo.example.com"),
00050 "good 4");
00051 fail_unless(Curl_cert_hostcheck("192.168.0.0", "192.168.0.0"),
00052 "good 5");
00053
00054 fail_if(Curl_cert_hostcheck("xxx.example.com", "www.example.com"), "bad 1");
00055 fail_if(Curl_cert_hostcheck("*", "www.example.com"), "bad 2");
00056 fail_if(Curl_cert_hostcheck("*.*.com", "www.example.com"), "bad 3");
00057 fail_if(Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4");
00058 fail_if(Curl_cert_hostcheck("f*.example.com", "baa.example.com"), "bad 5");
00059 fail_if(Curl_cert_hostcheck("*.com", "example.com"), "bad 6");
00060 fail_if(Curl_cert_hostcheck("*fail.com", "example.com"), "bad 7");
00061 fail_if(Curl_cert_hostcheck("*.example.", "www.example."), "bad 8");
00062 fail_if(Curl_cert_hostcheck("*.example.", "www.example"), "bad 9");
00063 fail_if(Curl_cert_hostcheck("", "www"), "bad 10");
00064 fail_if(Curl_cert_hostcheck("*", "www"), "bad 11");
00065 fail_if(Curl_cert_hostcheck("*.168.0.0", "192.168.0.0"), "bad 12");
00066 fail_if(Curl_cert_hostcheck("www.example.com", "192.168.0.0"), "bad 13");
00067
00068 #ifdef ENABLE_IPV6
00069 fail_if(Curl_cert_hostcheck("*::3285:a9ff:fe46:b619",
00070 "fe80::3285:a9ff:fe46:b619"), "bad 14");
00071 fail_unless(Curl_cert_hostcheck("fe80::3285:a9ff:fe46:b619",
00072 "fe80::3285:a9ff:fe46:b619"), "good 6");
00073 #endif
00074
00075 #endif
00076
00077
00078
00079 UNITTEST_STOP