unit1397.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                  _   _ ____  _
00003  *  Project                     ___| | | |  _ \| |
00004  *                             / __| | | | |_) | |
00005  *                            | (__| |_| |  _ <| |___
00006  *                             \___|\___/|_| \_\_____|
00007  *
00008  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
00009  *
00010  * This software is licensed as described in the file COPYING, which
00011  * you should have received as part of this distribution. The terms
00012  * are also available at https://curl.haxx.se/docs/copyright.html.
00013  *
00014  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00015  * copies of the Software, and permit persons to whom the Software is
00016  * furnished to do so, under the terms of the COPYING file.
00017  *
00018  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00019  * KIND, either express or implied.
00020  *
00021  ***************************************************************************/
00022 #include "curlcheck.h"
00023 
00024 #include "hostcheck.h" /* from the lib dir */
00025 
00026 static CURLcode unit_setup(void)
00027 {
00028   return CURLE_OK;
00029 }
00030 
00031 static void unit_stop(void)
00032 {
00033   /* done before shutting down and exiting */
00034 }
00035 
00036 UNITTEST_START
00037 
00038 /* only these backends define the tested functions */
00039 #if defined(USE_OPENSSL) || defined(USE_AXTLS) || defined(USE_GSKIT)
00040 
00041   /* here you start doing things and checking that the results are good */
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   /* you end the test code like this: */
00078 
00079 UNITTEST_STOP


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:07