unit: make unit test source code checksrc compliant

This commit is contained in:
Daniel Stenberg 2016-04-03 16:21:10 +02:00
parent d3252e000c
commit a981141b19
12 changed files with 109 additions and 66 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -38,10 +38,10 @@
#define verify_memory(dynamic, check, len) \ #define verify_memory(dynamic, check, len) \
if(dynamic && memcmp(dynamic, check, len)) { \ if(dynamic && memcmp(dynamic, check, len)) { \
fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \ fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \
__FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \ __FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \
fprintf(stderr, "%s:%d the same as '%s'\n", \ fprintf(stderr, "%s:%d the same as '%s'\n", \
__FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \ __FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \
unitfail++; \ unitfail++; \
} }
@ -85,10 +85,11 @@ extern int unitfail;
#define UNITTEST_START \ #define UNITTEST_START \
int test(char *arg) \ int test(char *arg) \
{ \ { \
(void)arg; \ (void)arg; \
if (unit_setup()) { \ if(unit_setup()) { \
fail("unit_setup() failure"); \ fail("unit_setup() failure"); \
} else { } \
else {
#define UNITTEST_STOP \ #define UNITTEST_STOP \
goto unit_test_abort; /* avoid warning */ \ goto unit_test_abort; /* avoid warning */ \

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -41,8 +41,8 @@ static CURLcode unit_setup(void)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
llist_destination = Curl_llist_alloc(test_curl_llist_dtor); llist_destination = Curl_llist_alloc(test_curl_llist_dtor);
if(!llist_destination) { if(!llist_destination) {
Curl_llist_destroy(llist, NULL); Curl_llist_destroy(llist, NULL);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
return CURLE_OK; return CURLE_OK;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -126,7 +126,8 @@ Curl_safefree(decoded);
size = 1; /* not zero */ size = 1; /* not zero */
decoded = &anychar; /* not NULL */ decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("aQ", &decoded, &size); 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_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL"); fail_if(decoded, "returned pointer should be NULL");
@ -134,7 +135,8 @@ fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */ size = 1; /* not zero */
decoded = &anychar; /* not NULL */ decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a===", &decoded, &size); 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_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL"); fail_if(decoded, "returned pointer should be NULL");
@ -142,7 +144,8 @@ fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */ size = 1; /* not zero */
decoded = &anychar; /* not NULL */ decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a=Q=", &decoded, &size); 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_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL"); fail_if(decoded, "returned pointer should be NULL");
@ -150,7 +153,8 @@ fail_if(decoded, "returned pointer should be NULL");
size = 1; /* not zero */ size = 1; /* not zero */
decoded = &anychar; /* not NULL */ decoded = &anychar; /* not NULL */
rc = Curl_base64_decode("a\x1f==", &decoded, &size); 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_unless(size == 0, "size should be 0");
fail_if(decoded, "returned pointer should be NULL"); fail_if(decoded, "returned pointer should be NULL");

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -30,7 +30,7 @@ static struct SessionHandle *data;
static CURLcode unit_setup( void ) static CURLcode unit_setup( void )
{ {
data = curl_easy_init(); data = curl_easy_init();
if (!data) if(!data)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
return CURLE_OK; return CURLE_OK;
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -31,10 +31,10 @@ static CURLcode unit_setup(void)
{ {
password = strdup(""); password = strdup("");
login = strdup(""); login = strdup("");
if (!password || !login) { if(!password || !login) {
Curl_safefree(password); Curl_safefree(password);
Curl_safefree(login); Curl_safefree(login);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
return CURLE_OK; return CURLE_OK;
} }
@ -72,7 +72,8 @@ UNITTEST_START
abort_unless(password != NULL, "returned NULL!"); abort_unless(password != NULL, "returned NULL!");
fail_unless(password[0] == 0, "password should not have been changed"); fail_unless(password[0] == 0, "password should not have been changed");
abort_unless(login != NULL, "returned NULL!"); 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. * Test a non existent login and host in our netrc file.
@ -85,7 +86,8 @@ UNITTEST_START
abort_unless(password != NULL, "returned NULL!"); abort_unless(password != NULL, "returned NULL!");
fail_unless(password[0] == 0, "password should not have been changed"); fail_unless(password[0] == 0, "password should not have been changed");
abort_unless(login != NULL, "returned NULL!"); 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 * Test a non existent login (substring of an existing one) in our
@ -99,7 +101,8 @@ UNITTEST_START
abort_unless(password != NULL, "returned NULL!"); abort_unless(password != NULL, "returned NULL!");
fail_unless(password[0] == 0, "password should not have been changed"); fail_unless(password[0] == 0, "password should not have been changed");
abort_unless(login != NULL, "returned NULL!"); 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) * Test a non existent login (superstring of an existing one)
@ -113,7 +116,8 @@ UNITTEST_START
abort_unless(password != NULL, "returned NULL!"); abort_unless(password != NULL, "returned NULL!");
fail_unless(password[0] == 0, "password should not have been changed"); fail_unless(password[0] == 0, "password should not have been changed");
abort_unless(login != NULL, "returned NULL!"); 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 * Test for the first existing host in our netrc file

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -48,7 +48,7 @@ static CURLcode unit_setup( void )
{ {
int rc; int rc;
data = curl_easy_init(); data = curl_easy_init();
if (!data) if(!data)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
rc = Curl_mk_dnscache(&hp); rc = Curl_mk_dnscache(&hp);
@ -62,7 +62,7 @@ static CURLcode unit_setup( void )
static void unit_stop( void ) static void unit_stop( void )
{ {
if (data_node) { if(data_node) {
Curl_freeaddrinfo(data_node->addr); Curl_freeaddrinfo(data_node->addr);
free(data_node); free(data_node);
} }
@ -103,15 +103,15 @@ static Curl_addrinfo *fake_ai(void)
static CURLcode create_node(void) static CURLcode create_node(void)
{ {
data_key = aprintf("%s:%d", "dummy", 0); data_key = aprintf("%s:%d", "dummy", 0);
if (!data_key) if(!data_key)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
data_node = calloc(1, sizeof(struct Curl_dns_entry)); data_node = calloc(1, sizeof(struct Curl_dns_entry));
if (!data_node) if(!data_node)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
data_node->addr = fake_ai(); data_node->addr = fake_ai();
if (!data_node->addr) if(!data_node->addr)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
return CURLE_OK; return CURLE_OK;
@ -124,7 +124,7 @@ UNITTEST_START
size_t key_len; size_t key_len;
/* Test 1305 exits without adding anything to the hash */ /* Test 1305 exits without adding anything to the hash */
if (strcmp(arg, "1305") != 0) { if(strcmp(arg, "1305") != 0) {
CURLcode rc = create_node(); CURLcode rc = create_node();
abort_unless(rc == CURLE_OK, "data node creation failed"); abort_unless(rc == CURLE_OK, "data node creation failed");
key_len = strlen(data_key); key_len = strlen(data_key);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -84,12 +84,14 @@ UNITTEST_START
"for -E param '%s'\n", p[1], certname, p[0]); "for -E param '%s'\n", p[1], certname, p[0]);
fail("assertion failure"); fail("assertion failure");
} }
} else { }
else {
printf("expected certname '%s' but got NULL " printf("expected certname '%s' but got NULL "
"for -E param '%s'\n", p[1], p[0]); "for -E param '%s'\n", p[1], p[0]);
fail("assertion failure"); fail("assertion failure");
} }
} else { }
else {
if(certname) { if(certname) {
printf("expected certname NULL but got '%s' " printf("expected certname NULL but got '%s' "
"for -E param '%s'\n", certname, p[0]); "for -E param '%s'\n", certname, p[0]);
@ -103,12 +105,14 @@ UNITTEST_START
"for -E param '%s'\n", p[2], passphrase, p[0]); "for -E param '%s'\n", p[2], passphrase, p[0]);
fail("assertion failure"); fail("assertion failure");
} }
} else { }
else {
printf("expected passphrase '%s' but got NULL " printf("expected passphrase '%s' but got NULL "
"for -E param '%s'\n", p[2], p[0]); "for -E param '%s'\n", p[2], p[0]);
fail("assertion failure"); fail("assertion failure");
} }
} else { }
else {
if(passphrase) { if(passphrase) {
printf("expected passphrase NULL but got '%s' " printf("expected passphrase NULL but got '%s' "
"for -E param '%s'\n", passphrase, p[0]); "for -E param '%s'\n", passphrase, p[0]);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -30,7 +30,7 @@ static CURLcode unit_setup(void)
static void unit_stop(void) static void unit_stop(void)
{ {
if (hnd) if(hnd)
curl_easy_cleanup(hnd); curl_easy_cleanup(hnd);
} }

View File

@ -1,3 +1,24 @@
/***************************************************************************
* _ _ ____ _
* 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 "curlcheck.h"
#include "hostcheck.h" /* from the lib dir */ #include "hostcheck.h" /* from the lib dir */
@ -19,29 +40,36 @@ UNITTEST_START
/* here you start doing things and checking that the results are good */ /* 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("www.example.com", "www.example.com"),
fail_unless( Curl_cert_hostcheck("*.example.com", "www.example.com"), "good 2" ); "good 1");
fail_unless( Curl_cert_hostcheck("xxx*.example.com", "xxxwww.example.com"), "good 3" ); fail_unless(Curl_cert_hostcheck("*.example.com", "www.example.com"),
fail_unless( Curl_cert_hostcheck("f*.example.com", "foo.example.com"), "good 4" ); "good 2");
fail_unless( Curl_cert_hostcheck("192.168.0.0", "192.168.0.0"), "good 5" ); 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("xxx.example.com", "www.example.com"), "bad 1" );
fail_if( Curl_cert_hostcheck("*", "www.example.com"), "bad 2" ); 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("*.*.com", "www.example.com"), "bad 3" );
fail_if( Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4" ); 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("f*.example.com", "baa.example.com"), "bad 5" );
fail_if( Curl_cert_hostcheck("*.com", "example.com"), "bad 6" ); 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("*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 8" );
fail_if( Curl_cert_hostcheck("*.example.", "www.example"), "bad 9" ); 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 10");
fail_if( Curl_cert_hostcheck("*", "www"), "bad 11" ); 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("*.168.0.0", "192.168.0.0"), "bad 12");
fail_if( Curl_cert_hostcheck("www.example.com", "192.168.0.0"), "bad 13" ); fail_if(Curl_cert_hostcheck("www.example.com", "192.168.0.0"), "bad 13");
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
fail_if( Curl_cert_hostcheck("*::3285:a9ff:fe46:b619", "fe80::3285:a9ff:fe46:b619"), "bad 14" ); fail_if(Curl_cert_hostcheck("*::3285:a9ff:fe46:b619",
fail_unless( Curl_cert_hostcheck("fe80::3285:a9ff:fe46:b619", "fe80::3285:a9ff:fe46:b619"), "good 6" ); "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
#endif #endif

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -39,7 +39,8 @@ static void unit_stop(void)
UNITTEST_START 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 output[21];
unsigned char *testp = output; unsigned char *testp = output;
Curl_ntlm_core_mk_nt_hash(easy, "1", output); Curl_ntlm_core_mk_nt_hash(easy, "1", output);
@ -54,6 +55,7 @@ UNITTEST_START
"\x39\xaf\x87\xa6\x75\x0a\x7a\x00\xba\xa0" "\x39\xaf\x87\xa6\x75\x0a\x7a\x00\xba\xa0"
"\xd3\x4f\x04\x9e\xc1\xd0\x00\x00\x00\x00\x00", 21); "\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); Curl_ntlm_core_mk_nt_hash(easy, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", output);
verify_memory(testp, verify_memory(testp,

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -40,6 +40,7 @@ UNITTEST_START
unsigned char *testp = output; unsigned char *testp = output;
Curl_md5it(output, (const unsigned char *)"1"); Curl_md5it(output, (const unsigned char *)"1");
/* !checksrc! disable LONGLINE 2 */
verify_memory(testp, verify_memory(testp,
"\xc4\xca\x42\x38\xa0\xb9\x23\x82\x0d\xcc\x50\x9a\x6f\x75\x84\x9b", 16); "\xc4\xca\x42\x38\xa0\xb9\x23\x82\x0d\xcc\x50\x9a\x6f\x75\x84\x9b", 16);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* 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 * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -64,7 +64,6 @@ UNITTEST_START
if(!nodep) if(!nodep)
free(value); free(value);
abort_unless(nodep, "insertion into hash failed"); abort_unless(nodep, "insertion into hash failed");
Curl_hash_clean(&hash_static); Curl_hash_clean(&hash_static);
/* Attempt to add another key/value pair */ /* Attempt to add another key/value pair */