* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
#define verify_memory(dynamic, check, len) \
if(dynamic && memcmp(dynamic, check, len)) { \
- fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \
- __FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \
+ fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \
+ __FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \
fprintf(stderr, "%s:%d the same as '%s'\n", \
- __FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \
+ __FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \
unitfail++; \
}
#define UNITTEST_START \
int test(char *arg) \
{ \
- (void)arg; \
- if (unit_setup()) { \
- fail("unit_setup() failure"); \
- } else {
+ (void)arg; \
+ if(unit_setup()) { \
+ fail("unit_setup() failure"); \
+ } \
+ else {
#define UNITTEST_STOP \
goto unit_test_abort; /* avoid warning */ \
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
return CURLE_OUT_OF_MEMORY;
llist_destination = Curl_llist_alloc(test_curl_llist_dtor);
if(!llist_destination) {
- Curl_llist_destroy(llist, NULL);
- return CURLE_OUT_OF_MEMORY;
+ Curl_llist_destroy(llist, NULL);
+ return CURLE_OUT_OF_MEMORY;
}
return CURLE_OK;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
size = 1; /* not zero */
decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("aQ", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING");
+fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */
decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a===", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING");
+fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */
decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a=Q=", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING");
+fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */
decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a\x1f==", &decoded, &size);
-fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING");
+fail_unless(rc == CURLE_BAD_CONTENT_ENCODING,
+ "return code should be CURLE_BAD_CONTENT_ENCODING");
fail_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL");
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
static CURLcode unit_setup( void )
{
data = curl_easy_init();
- if (!data)
+ if(!data)
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
{
password = strdup("");
login = strdup("");
- if (!password || !login) {
- Curl_safefree(password);
- Curl_safefree(login);
- return CURLE_OUT_OF_MEMORY;
+ if(!password || !login) {
+ Curl_safefree(password);
+ Curl_safefree(login);
+ return CURLE_OUT_OF_MEMORY;
}
return CURLE_OK;
}
abort_unless(password != NULL, "returned NULL!");
fail_unless(password[0] == 0, "password should not have been changed");
abort_unless(login != NULL, "returned NULL!");
- fail_unless(strncmp(login, "me", 2) == 0, "login should not have been changed");
+ fail_unless(strncmp(login, "me", 2) == 0,
+ "login should not have been changed");
/*
* Test a non existent login and host in our netrc file.
abort_unless(password != NULL, "returned NULL!");
fail_unless(password[0] == 0, "password should not have been changed");
abort_unless(login != NULL, "returned NULL!");
- fail_unless(strncmp(login, "me", 2) == 0, "login should not have been changed");
+ fail_unless(strncmp(login, "me", 2) == 0,
+ "login should not have been changed");
/*
* Test a non existent login (substring of an existing one) in our
abort_unless(password != NULL, "returned NULL!");
fail_unless(password[0] == 0, "password should not have been changed");
abort_unless(login != NULL, "returned NULL!");
- fail_unless(strncmp(login, "admi", 4) == 0, "login should not have been changed");
+ fail_unless(strncmp(login, "admi", 4) == 0,
+ "login should not have been changed");
/*
* Test a non existent login (superstring of an existing one)
abort_unless(password != NULL, "returned NULL!");
fail_unless(password[0] == 0, "password should not have been changed");
abort_unless(login != NULL, "returned NULL!");
- fail_unless(strncmp(login, "adminn", 6) == 0, "login should not have been changed");
+ fail_unless(strncmp(login, "adminn", 6) == 0,
+ "login should not have been changed");
/*
* Test for the first existing host in our netrc file
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
{
int rc;
data = curl_easy_init();
- if (!data)
+ if(!data)
return CURLE_OUT_OF_MEMORY;
rc = Curl_mk_dnscache(&hp);
static void unit_stop( void )
{
- if (data_node) {
+ if(data_node) {
Curl_freeaddrinfo(data_node->addr);
free(data_node);
}
static CURLcode create_node(void)
{
data_key = aprintf("%s:%d", "dummy", 0);
- if (!data_key)
+ if(!data_key)
return CURLE_OUT_OF_MEMORY;
data_node = calloc(1, sizeof(struct Curl_dns_entry));
- if (!data_node)
+ if(!data_node)
return CURLE_OUT_OF_MEMORY;
data_node->addr = fake_ai();
- if (!data_node->addr)
+ if(!data_node->addr)
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
size_t key_len;
/* Test 1305 exits without adding anything to the hash */
- if (strcmp(arg, "1305") != 0) {
+ if(strcmp(arg, "1305") != 0) {
CURLcode rc = create_node();
abort_unless(rc == CURLE_OK, "data node creation failed");
key_len = strlen(data_key);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
"for -E param '%s'\n", p[1], certname, p[0]);
fail("assertion failure");
}
- } else {
+ }
+ else {
printf("expected certname '%s' but got NULL "
"for -E param '%s'\n", p[1], p[0]);
fail("assertion failure");
}
- } else {
+ }
+ else {
if(certname) {
printf("expected certname NULL but got '%s' "
"for -E param '%s'\n", certname, p[0]);
"for -E param '%s'\n", p[2], passphrase, p[0]);
fail("assertion failure");
}
- } else {
+ }
+ else {
printf("expected passphrase '%s' but got NULL "
"for -E param '%s'\n", p[2], p[0]);
fail("assertion failure");
}
- } else {
+ }
+ else {
if(passphrase) {
printf("expected passphrase NULL but got '%s' "
"for -E param '%s'\n", passphrase, p[0]);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
static void unit_stop(void)
{
- if (hnd)
+ if(hnd)
curl_easy_cleanup(hnd);
}
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
#include "curlcheck.h"
#include "hostcheck.h" /* from the lib dir */
/* here you start doing things and checking that the results are good */
-fail_unless( Curl_cert_hostcheck("www.example.com", "www.example.com"), "good 1" );
-fail_unless( Curl_cert_hostcheck("*.example.com", "www.example.com"), "good 2" );
-fail_unless( Curl_cert_hostcheck("xxx*.example.com", "xxxwww.example.com"), "good 3" );
-fail_unless( Curl_cert_hostcheck("f*.example.com", "foo.example.com"), "good 4" );
-fail_unless( Curl_cert_hostcheck("192.168.0.0", "192.168.0.0"), "good 5" );
-
-fail_if( Curl_cert_hostcheck("xxx.example.com", "www.example.com"), "bad 1" );
-fail_if( Curl_cert_hostcheck("*", "www.example.com"), "bad 2" );
-fail_if( Curl_cert_hostcheck("*.*.com", "www.example.com"), "bad 3" );
-fail_if( Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4" );
-fail_if( Curl_cert_hostcheck("f*.example.com", "baa.example.com"), "bad 5" );
-fail_if( Curl_cert_hostcheck("*.com", "example.com"), "bad 6" );
-fail_if( Curl_cert_hostcheck("*fail.com", "example.com"), "bad 7" );
-fail_if( Curl_cert_hostcheck("*.example.", "www.example."), "bad 8" );
-fail_if( Curl_cert_hostcheck("*.example.", "www.example"), "bad 9" );
-fail_if( Curl_cert_hostcheck("", "www"), "bad 10" );
-fail_if( Curl_cert_hostcheck("*", "www"), "bad 11" );
-fail_if( Curl_cert_hostcheck("*.168.0.0", "192.168.0.0"), "bad 12" );
-fail_if( Curl_cert_hostcheck("www.example.com", "192.168.0.0"), "bad 13" );
+fail_unless(Curl_cert_hostcheck("www.example.com", "www.example.com"),
+ "good 1");
+fail_unless(Curl_cert_hostcheck("*.example.com", "www.example.com"),
+ "good 2");
+fail_unless(Curl_cert_hostcheck("xxx*.example.com", "xxxwww.example.com"),
+ "good 3");
+fail_unless(Curl_cert_hostcheck("f*.example.com", "foo.example.com"),
+ "good 4");
+fail_unless(Curl_cert_hostcheck("192.168.0.0", "192.168.0.0"),
+ "good 5");
+
+fail_if(Curl_cert_hostcheck("xxx.example.com", "www.example.com"), "bad 1" );
+fail_if(Curl_cert_hostcheck("*", "www.example.com"), "bad 2" );
+fail_if(Curl_cert_hostcheck("*.*.com", "www.example.com"), "bad 3" );
+fail_if(Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4" );
+fail_if(Curl_cert_hostcheck("f*.example.com", "baa.example.com"), "bad 5" );
+fail_if(Curl_cert_hostcheck("*.com", "example.com"), "bad 6" );
+fail_if(Curl_cert_hostcheck("*fail.com", "example.com"), "bad 7" );
+fail_if(Curl_cert_hostcheck("*.example.", "www.example."), "bad 8" );
+fail_if(Curl_cert_hostcheck("*.example.", "www.example"), "bad 9");
+fail_if(Curl_cert_hostcheck("", "www"), "bad 10");
+fail_if(Curl_cert_hostcheck("*", "www"), "bad 11");
+fail_if(Curl_cert_hostcheck("*.168.0.0", "192.168.0.0"), "bad 12");
+fail_if(Curl_cert_hostcheck("www.example.com", "192.168.0.0"), "bad 13");
#ifdef ENABLE_IPV6
-fail_if( Curl_cert_hostcheck("*::3285:a9ff:fe46:b619", "fe80::3285:a9ff:fe46:b619"), "bad 14" );
-fail_unless( Curl_cert_hostcheck("fe80::3285:a9ff:fe46:b619", "fe80::3285:a9ff:fe46:b619"), "good 6" );
+fail_if(Curl_cert_hostcheck("*::3285:a9ff:fe46:b619",
+ "fe80::3285:a9ff:fe46:b619"), "bad 14");
+fail_unless(Curl_cert_hostcheck("fe80::3285:a9ff:fe46:b619",
+ "fe80::3285:a9ff:fe46:b619"), "good 6");
#endif
#endif
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
UNITTEST_START
-#if defined(USE_NTLM) && (!defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO))
+#if defined(USE_NTLM) && (!defined(USE_WINDOWS_SSPI) || \
+ defined(USE_WIN32_CRYPTO))
unsigned char output[21];
unsigned char *testp = output;
Curl_ntlm_core_mk_nt_hash(easy, "1", output);
"\x39\xaf\x87\xa6\x75\x0a\x7a\x00\xba\xa0"
"\xd3\x4f\x04\x9e\xc1\xd0\x00\x00\x00\x00\x00", 21);
+/* !checksrc! disable LONGLINE 2 */
Curl_ntlm_core_mk_nt_hash(easy, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", output);
verify_memory(testp,
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
unsigned char *testp = output;
Curl_md5it(output, (const unsigned char *)"1");
+/* !checksrc! disable LONGLINE 2 */
verify_memory(testp,
"\xc4\xca\x42\x38\xa0\xb9\x23\x82\x0d\xcc\x50\x9a\x6f\x75\x84\x9b", 16);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
if(!nodep)
free(value);
abort_unless(nodep, "insertion into hash failed");
-
Curl_hash_clean(&hash_static);
/* Attempt to add another key/value pair */