mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
tidy-up: make conditional checks more consistent
... remove '== NULL' and '!= 0' Closes #6912
This commit is contained in:
parent
19ea52da4d
commit
063d3f3b96
@ -372,7 +372,7 @@ int main(int argc, char **argv)
|
|||||||
args++;
|
args++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mimetype == NULL || mimetypeaccept == NULL || p.p12file == NULL)
|
if(!mimetype || !mimetypeaccept || !p.p12file)
|
||||||
badarg = 1;
|
badarg = 1;
|
||||||
|
|
||||||
if(badarg) {
|
if(badarg) {
|
||||||
@ -385,11 +385,11 @@ int main(int argc, char **argv)
|
|||||||
/* set input */
|
/* set input */
|
||||||
|
|
||||||
in = BIO_new(BIO_s_file());
|
in = BIO_new(BIO_s_file());
|
||||||
if(in == NULL) {
|
if(!in) {
|
||||||
BIO_printf(p.errorbio, "Error setting input bio\n");
|
BIO_printf(p.errorbio, "Error setting input bio\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else if(infile == NULL)
|
else if(!infile)
|
||||||
BIO_set_fp(in, stdin, BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(in, stdin, BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
else if(BIO_read_filename(in, infile) <= 0) {
|
else if(BIO_read_filename(in, infile) <= 0) {
|
||||||
BIO_printf(p.errorbio, "Error opening input file %s\n", infile);
|
BIO_printf(p.errorbio, "Error opening input file %s\n", infile);
|
||||||
@ -400,11 +400,11 @@ int main(int argc, char **argv)
|
|||||||
/* set output */
|
/* set output */
|
||||||
|
|
||||||
out = BIO_new(BIO_s_file());
|
out = BIO_new(BIO_s_file());
|
||||||
if(out == NULL) {
|
if(!out) {
|
||||||
BIO_printf(p.errorbio, "Error setting output bio.\n");
|
BIO_printf(p.errorbio, "Error setting output bio.\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else if(outfile == NULL)
|
else if(!outfile)
|
||||||
BIO_set_fp(out, stdout, BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(out, stdout, BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
else if(BIO_write_filename(out, outfile) <= 0) {
|
else if(BIO_write_filename(out, outfile) <= 0) {
|
||||||
BIO_printf(p.errorbio, "Error opening output file %s\n", outfile);
|
BIO_printf(p.errorbio, "Error opening output file %s\n", outfile);
|
||||||
@ -453,7 +453,7 @@ int main(int argc, char **argv)
|
|||||||
serverurl = malloc(len);
|
serverurl = malloc(len);
|
||||||
snprintf(serverurl, len, "https://%s", hostporturl);
|
snprintf(serverurl, len, "https://%s", hostporturl);
|
||||||
}
|
}
|
||||||
else if(p.accesstype != 0) { /* see whether we can find an AIA or SIA for a
|
else if(p.accesstype) { /* see whether we can find an AIA or SIA for a
|
||||||
given access type */
|
given access type */
|
||||||
serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access);
|
serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access);
|
||||||
if(!serverurl) {
|
if(!serverurl) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -98,7 +98,7 @@ int main(void)
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
int initwsa = WSAStartup(MAKEWORD(2, 0), &wsaData);
|
int initwsa = WSAStartup(MAKEWORD(2, 0), &wsaData);
|
||||||
if(initwsa != 0) {
|
if(initwsa) {
|
||||||
printf("WSAStartup failed: %d\n", initwsa);
|
printf("WSAStartup failed: %d\n", initwsa);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* See the main() function at the bottom that shows an app that retrieves from
|
* See the main() function at the bottom that shows an app that retrieves from
|
||||||
* a specified url using fgets() and fread() and saves as two output files.
|
* a specified url using fgets() and fread() and saves as two output files.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2003 - 2019 Simtec Electronics
|
* Copyright (c) 2003 - 2021 Simtec Electronics
|
||||||
*
|
*
|
||||||
* Re-implemented by Vincent Sanders <vince@kyllikki.org> with extensive
|
* Re-implemented by Vincent Sanders <vince@kyllikki.org> with extensive
|
||||||
* reference to original curl example code
|
* reference to original curl example code
|
||||||
@ -107,7 +107,7 @@ static size_t write_callback(char *buffer,
|
|||||||
if(size > rembuff) {
|
if(size > rembuff) {
|
||||||
/* not enough space in buffer */
|
/* not enough space in buffer */
|
||||||
newbuff = realloc(url->buffer, url->buffer_len + (size - rembuff));
|
newbuff = realloc(url->buffer, url->buffer_len + (size - rembuff));
|
||||||
if(newbuff == NULL) {
|
if(!newbuff) {
|
||||||
fprintf(stderr, "callback buffer grow failed\n");
|
fprintf(stderr, "callback buffer grow failed\n");
|
||||||
size = rembuff;
|
size = rembuff;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -43,7 +43,7 @@ WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
|||||||
struct MemoryStruct *mem = (struct MemoryStruct *)userp;
|
struct MemoryStruct *mem = (struct MemoryStruct *)userp;
|
||||||
|
|
||||||
char *ptr = realloc(mem->memory, mem->size + realsize + 1);
|
char *ptr = realloc(mem->memory, mem->size + realsize + 1);
|
||||||
if(ptr == NULL) {
|
if(!ptr) {
|
||||||
/* out of memory! */
|
/* out of memory! */
|
||||||
printf("not enough memory (realloc returned NULL)\n");
|
printf("not enough memory (realloc returned NULL)\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 - 2020, Jim Hollinger
|
* Copyright (c) 2011 - 2021, Jim Hollinger
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -94,7 +94,7 @@ static void rtsp_describe(CURL *curl, const char *uri,
|
|||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
FILE *sdp_fp = fopen(sdp_filename, "wb");
|
FILE *sdp_fp = fopen(sdp_filename, "wb");
|
||||||
printf("\nRTSP: DESCRIBE %s\n", uri);
|
printf("\nRTSP: DESCRIBE %s\n", uri);
|
||||||
if(sdp_fp == NULL) {
|
if(!sdp_fp) {
|
||||||
fprintf(stderr, "Could not open '%s' for writing\n", sdp_filename);
|
fprintf(stderr, "Could not open '%s' for writing\n", sdp_filename);
|
||||||
sdp_fp = stdout;
|
sdp_fp = stdout;
|
||||||
}
|
}
|
||||||
@ -202,10 +202,10 @@ int main(int argc, char * const argv[])
|
|||||||
/* check command line */
|
/* check command line */
|
||||||
if((argc != 2) && (argc != 3)) {
|
if((argc != 2) && (argc != 3)) {
|
||||||
base_name = strrchr(argv[0], '/');
|
base_name = strrchr(argv[0], '/');
|
||||||
if(base_name == NULL) {
|
if(!base_name) {
|
||||||
base_name = strrchr(argv[0], '\\');
|
base_name = strrchr(argv[0], '\\');
|
||||||
}
|
}
|
||||||
if(base_name == NULL) {
|
if(!base_name) {
|
||||||
base_name = argv[0];
|
base_name = argv[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 2013 - 2021, 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
|
||||||
@ -119,7 +119,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
|||||||
/* get a BIO */
|
/* get a BIO */
|
||||||
bio = BIO_new_mem_buf((char *)mypem, -1);
|
bio = BIO_new_mem_buf((char *)mypem, -1);
|
||||||
|
|
||||||
if(bio == NULL) {
|
if(!bio) {
|
||||||
printf("BIO_new_mem_buf failed\n");
|
printf("BIO_new_mem_buf failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
|||||||
* structure that SSL can use
|
* structure that SSL can use
|
||||||
*/
|
*/
|
||||||
cert = PEM_read_bio_X509(bio, NULL, 0, NULL);
|
cert = PEM_read_bio_X509(bio, NULL, 0, NULL);
|
||||||
if(cert == NULL) {
|
if(!cert) {
|
||||||
printf("PEM_read_bio_X509 failed...\n");
|
printf("PEM_read_bio_X509 failed...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,13 +139,13 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
|||||||
|
|
||||||
/*create a bio for the RSA key*/
|
/*create a bio for the RSA key*/
|
||||||
kbio = BIO_new_mem_buf((char *)mykey, -1);
|
kbio = BIO_new_mem_buf((char *)mykey, -1);
|
||||||
if(kbio == NULL) {
|
if(!kbio) {
|
||||||
printf("BIO_new_mem_buf failed\n");
|
printf("BIO_new_mem_buf failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*read the key bio into an RSA object*/
|
/*read the key bio into an RSA object*/
|
||||||
rsa = PEM_read_bio_RSAPrivateKey(kbio, NULL, 0, NULL);
|
rsa = PEM_read_bio_RSAPrivateKey(kbio, NULL, 0, NULL);
|
||||||
if(rsa == NULL) {
|
if(!rsa) {
|
||||||
printf("Failed to create key bio\n");
|
printf("Failed to create key bio\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
|
|||||||
pfd[i].fd = socks[i];
|
pfd[i].fd = socks[i];
|
||||||
pfd[i].events |= POLLWRNORM|POLLOUT;
|
pfd[i].events |= POLLWRNORM|POLLOUT;
|
||||||
}
|
}
|
||||||
if(pfd[i].events != 0)
|
if(pfd[i].events)
|
||||||
num++;
|
num++;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
@ -238,7 +238,7 @@ int init_thread_sync_data(struct thread_data *td,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
tsd->mtx = malloc(sizeof(curl_mutex_t));
|
tsd->mtx = malloc(sizeof(curl_mutex_t));
|
||||||
if(tsd->mtx == NULL)
|
if(!tsd->mtx)
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
|
|
||||||
Curl_mutex_init(tsd->mtx);
|
Curl_mutex_init(tsd->mtx);
|
||||||
@ -305,7 +305,7 @@ static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
|
|||||||
|
|
||||||
rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res);
|
rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res);
|
||||||
|
|
||||||
if(rc != 0) {
|
if(rc) {
|
||||||
tsd->sock_error = SOCKERRNO?SOCKERRNO:rc;
|
tsd->sock_error = SOCKERRNO?SOCKERRNO:rc;
|
||||||
if(tsd->sock_error == 0)
|
if(tsd->sock_error == 0)
|
||||||
tsd->sock_error = RESOLVER_ENOMEM;
|
tsd->sock_error = RESOLVER_ENOMEM;
|
||||||
|
@ -178,7 +178,7 @@ static CURLcode inflate_stream(struct Curl_easy *data,
|
|||||||
/* Dynamically allocate a buffer for decompression because it's uncommonly
|
/* Dynamically allocate a buffer for decompression because it's uncommonly
|
||||||
large to hold on the stack */
|
large to hold on the stack */
|
||||||
decomp = malloc(DSIZ);
|
decomp = malloc(DSIZ);
|
||||||
if(decomp == NULL)
|
if(!decomp)
|
||||||
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
|
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
|
||||||
|
|
||||||
/* because the buffer size is fixed, iteratively decompress and transfer to
|
/* because the buffer size is fixed, iteratively decompress and transfer to
|
||||||
@ -487,7 +487,7 @@ static CURLcode gzip_unencode_write(struct Curl_easy *data,
|
|||||||
*/
|
*/
|
||||||
z->avail_in = (uInt) nbytes;
|
z->avail_in = (uInt) nbytes;
|
||||||
z->next_in = malloc(z->avail_in);
|
z->next_in = malloc(z->avail_in);
|
||||||
if(z->next_in == NULL) {
|
if(!z->next_in) {
|
||||||
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
|
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
memcpy(z->next_in, buf, z->avail_in);
|
memcpy(z->next_in, buf, z->avail_in);
|
||||||
@ -509,7 +509,7 @@ static CURLcode gzip_unencode_write(struct Curl_easy *data,
|
|||||||
ssize_t hlen;
|
ssize_t hlen;
|
||||||
z->avail_in += (uInt) nbytes;
|
z->avail_in += (uInt) nbytes;
|
||||||
z->next_in = Curl_saferealloc(z->next_in, z->avail_in);
|
z->next_in = Curl_saferealloc(z->next_in, z->avail_in);
|
||||||
if(z->next_in == NULL) {
|
if(!z->next_in) {
|
||||||
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
|
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
/* Append the new block of data to the previous one */
|
/* Append the new block of data to the previous one */
|
||||||
|
@ -1579,7 +1579,7 @@ static int cookie_output(struct Curl_easy *data,
|
|||||||
|
|
||||||
for(i = 0; i < nvalid; i++) {
|
for(i = 0; i < nvalid; i++) {
|
||||||
char *format_ptr = get_netscape_format(array[i]);
|
char *format_ptr = get_netscape_format(array[i]);
|
||||||
if(format_ptr == NULL) {
|
if(!format_ptr) {
|
||||||
fprintf(out, "#\n# Fatal libcurl error\n");
|
fprintf(out, "#\n# Fatal libcurl error\n");
|
||||||
free(array);
|
free(array);
|
||||||
goto error;
|
goto error;
|
||||||
@ -1618,8 +1618,7 @@ static struct curl_slist *cookie_list(struct Curl_easy *data)
|
|||||||
char *line;
|
char *line;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if((data->cookies == NULL) ||
|
if(!data->cookies || (data->cookies->numcookies == 0))
|
||||||
(data->cookies->numcookies == 0))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for(i = 0; i < COOKIE_HASH_SIZE; i++) {
|
for(i = 0; i < COOKIE_HASH_SIZE; i++) {
|
||||||
|
@ -141,7 +141,7 @@ Curl_getaddrinfo_ex(const char *nodename,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* ignore elements without required address info */
|
/* ignore elements without required address info */
|
||||||
if((ai->ai_addr == NULL) || !(ai->ai_addrlen > 0))
|
if(!ai->ai_addr || !(ai->ai_addrlen > 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* ignore elements with bogus address size */
|
/* ignore elements with bogus address size */
|
||||||
|
@ -102,7 +102,7 @@ static size_t display_gss_error(OM_uint32 status, int type,
|
|||||||
(char *)status_string.value);
|
(char *)status_string.value);
|
||||||
}
|
}
|
||||||
gss_release_buffer(&min_stat, &status_string);
|
gss_release_buffer(&min_stat, &status_string);
|
||||||
} while(!GSS_ERROR(maj_stat) && msg_ctx != 0);
|
} while(!GSS_ERROR(maj_stat) && msg_ctx);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
|
|||||||
/* Check for /~/, indicating relative to the user's home directory */
|
/* Check for /~/, indicating relative to the user's home directory */
|
||||||
if(data->conn->handler->protocol & CURLPROTO_SCP) {
|
if(data->conn->handler->protocol & CURLPROTO_SCP) {
|
||||||
real_path = malloc(working_path_len + 1);
|
real_path = malloc(working_path_len + 1);
|
||||||
if(real_path == NULL) {
|
if(!real_path) {
|
||||||
free(working_path);
|
free(working_path);
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
|
|||||||
if((working_path_len > 1) && (working_path[1] == '~')) {
|
if((working_path_len > 1) && (working_path[1] == '~')) {
|
||||||
size_t homelen = strlen(homedir);
|
size_t homelen = strlen(homedir);
|
||||||
real_path = malloc(homelen + working_path_len + 1);
|
real_path = malloc(homelen + working_path_len + 1);
|
||||||
if(real_path == NULL) {
|
if(!real_path) {
|
||||||
free(working_path);
|
free(working_path);
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ CURLcode Curl_getworkingpath(struct Curl_easy *data,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
real_path = malloc(working_path_len + 1);
|
real_path = malloc(working_path_len + 1);
|
||||||
if(real_path == NULL) {
|
if(!real_path) {
|
||||||
free(working_path);
|
free(working_path);
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir)
|
|||||||
/* Allocate enough space for home directory and filename + separator */
|
/* Allocate enough space for home directory and filename + separator */
|
||||||
fullPathLength = strlen(cp) + strlen(homedir) + 2;
|
fullPathLength = strlen(cp) + strlen(homedir) + 2;
|
||||||
*path = malloc(fullPathLength);
|
*path = malloc(fullPathLength);
|
||||||
if(*path == NULL)
|
if(!*path)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
/* Check for quoted filenames */
|
/* Check for quoted filenames */
|
||||||
@ -169,7 +169,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir)
|
|||||||
else {
|
else {
|
||||||
/* Read to end of filename - either to whitespace or terminator */
|
/* Read to end of filename - either to whitespace or terminator */
|
||||||
end = strpbrk(cp, WHITESPACE);
|
end = strpbrk(cp, WHITESPACE);
|
||||||
if(end == NULL)
|
if(!end)
|
||||||
end = strchr(cp, '\0');
|
end = strchr(cp, '\0');
|
||||||
/* return pointer to second parameter if it exists */
|
/* return pointer to second parameter if it exists */
|
||||||
*cpp = end + strspn(end, WHITESPACE);
|
*cpp = end + strspn(end, WHITESPACE);
|
||||||
|
10
lib/dict.c
10
lib/dict.c
@ -214,14 +214,14 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((word == NULL) || (*word == (char)0)) {
|
if(!word || (*word == (char)0)) {
|
||||||
infof(data, "lookup word is missing\n");
|
infof(data, "lookup word is missing\n");
|
||||||
word = (char *)"default";
|
word = (char *)"default";
|
||||||
}
|
}
|
||||||
if((database == NULL) || (*database == (char)0)) {
|
if(!database || (*database == (char)0)) {
|
||||||
database = (char *)"!";
|
database = (char *)"!";
|
||||||
}
|
}
|
||||||
if((strategy == NULL) || (*strategy == (char)0)) {
|
if(!strategy || (*strategy == (char)0)) {
|
||||||
strategy = (char *)".";
|
strategy = (char *)".";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,11 +265,11 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((word == NULL) || (*word == (char)0)) {
|
if(!word || (*word == (char)0)) {
|
||||||
infof(data, "lookup word is missing\n");
|
infof(data, "lookup word is missing\n");
|
||||||
word = (char *)"default";
|
word = (char *)"default";
|
||||||
}
|
}
|
||||||
if((database == NULL) || (*database == (char)0)) {
|
if(!database || (*database == (char)0)) {
|
||||||
database = (char *)"!";
|
database = (char *)"!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1105,7 +1105,7 @@ static CURLcode easy_connection(struct Curl_easy *data,
|
|||||||
curl_socket_t *sfd,
|
curl_socket_t *sfd,
|
||||||
struct connectdata **connp)
|
struct connectdata **connp)
|
||||||
{
|
{
|
||||||
if(data == NULL)
|
if(!data)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
|
||||||
/* only allow these to be called on handles with CURLOPT_CONNECT_ONLY */
|
/* only allow these to be called on handles with CURLOPT_CONNECT_ONLY */
|
||||||
|
@ -1090,7 +1090,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
|
|||||||
else
|
else
|
||||||
res = NULL; /* failure! */
|
res = NULL; /* failure! */
|
||||||
|
|
||||||
if(res == NULL) {
|
if(!res) {
|
||||||
failf(data, "failed to resolve the address provided to PORT: %s", host);
|
failf(data, "failed to resolve the address provided to PORT: %s", host);
|
||||||
free(addr);
|
free(addr);
|
||||||
return CURLE_FTP_PORT_FAILED;
|
return CURLE_FTP_PORT_FAILED;
|
||||||
|
@ -424,7 +424,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
|
|||||||
endptr++;
|
endptr++;
|
||||||
while(ISDIGIT(*endptr))
|
while(ISDIGIT(*endptr))
|
||||||
endptr++;
|
endptr++;
|
||||||
if(*endptr != 0) {
|
if(*endptr) {
|
||||||
parser->error = CURLE_FTP_BAD_FILE_LIST;
|
parser->error = CURLE_FTP_BAD_FILE_LIST;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -245,7 +245,7 @@ Curl_hash_clean_with_criterium(struct Curl_hash *h, void *user,
|
|||||||
struct Curl_hash_element *he = le->ptr;
|
struct Curl_hash_element *he = le->ptr;
|
||||||
lnext = le->next;
|
lnext = le->next;
|
||||||
/* ask the callback function if we shall remove this entry or not */
|
/* ask the callback function if we shall remove this entry or not */
|
||||||
if(comp == NULL || comp(user, he->ptr)) {
|
if(!comp || comp(user, he->ptr)) {
|
||||||
Curl_llist_remove(list, le, (void *) h);
|
Curl_llist_remove(list, le, (void *) h);
|
||||||
--h->size; /* one less entry in the hash now */
|
--h->size; /* one less entry in the hash now */
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -81,7 +81,7 @@ static int hostmatch(char *hostname, char *pattern)
|
|||||||
pattern[len-1] = 0;
|
pattern[len-1] = 0;
|
||||||
|
|
||||||
pattern_wildcard = strchr(pattern, '*');
|
pattern_wildcard = strchr(pattern, '*');
|
||||||
if(pattern_wildcard == NULL)
|
if(!pattern_wildcard)
|
||||||
return strcasecompare(pattern, hostname) ?
|
return strcasecompare(pattern, hostname) ?
|
||||||
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ static int hostmatch(char *hostname, char *pattern)
|
|||||||
match. */
|
match. */
|
||||||
wildcard_enabled = 1;
|
wildcard_enabled = 1;
|
||||||
pattern_label_end = strchr(pattern, '.');
|
pattern_label_end = strchr(pattern, '.');
|
||||||
if(pattern_label_end == NULL || strchr(pattern_label_end + 1, '.') == NULL ||
|
if(!pattern_label_end || strchr(pattern_label_end + 1, '.') == NULL ||
|
||||||
pattern_wildcard > pattern_label_end ||
|
pattern_wildcard > pattern_label_end ||
|
||||||
strncasecompare(pattern, "xn--", 4)) {
|
strncasecompare(pattern, "xn--", 4)) {
|
||||||
wildcard_enabled = 0;
|
wildcard_enabled = 0;
|
||||||
@ -107,7 +107,7 @@ static int hostmatch(char *hostname, char *pattern)
|
|||||||
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
|
||||||
|
|
||||||
hostname_label_end = strchr(hostname, '.');
|
hostname_label_end = strchr(hostname, '.');
|
||||||
if(hostname_label_end == NULL ||
|
if(!hostname_label_end ||
|
||||||
!strcasecompare(pattern_label_end, hostname_label_end))
|
!strcasecompare(pattern_label_end, hostname_label_end))
|
||||||
return CURL_HOST_NOMATCH;
|
return CURL_HOST_NOMATCH;
|
||||||
|
|
||||||
|
18
lib/http2.c
18
lib/http2.c
@ -1242,7 +1242,7 @@ static CURLcode http2_init(struct Curl_easy *data, struct connectdata *conn)
|
|||||||
nghttp2_session_callbacks *callbacks;
|
nghttp2_session_callbacks *callbacks;
|
||||||
|
|
||||||
conn->proto.httpc.inbuf = malloc(H2_BUFSIZE);
|
conn->proto.httpc.inbuf = malloc(H2_BUFSIZE);
|
||||||
if(conn->proto.httpc.inbuf == NULL)
|
if(!conn->proto.httpc.inbuf)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
rc = nghttp2_session_callbacks_new(&callbacks);
|
rc = nghttp2_session_callbacks_new(&callbacks);
|
||||||
@ -1383,7 +1383,7 @@ static int h2_process_pending_input(struct Curl_easy *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rv = h2_session_send(data, httpc->h2);
|
rv = h2_session_send(data, httpc->h2);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
*err = CURLE_SEND_ERROR;
|
*err = CURLE_SEND_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1447,7 +1447,7 @@ CURLcode Curl_http2_done_sending(struct Curl_easy *data,
|
|||||||
|
|
||||||
/* and attempt to send the pending frames */
|
/* and attempt to send the pending frames */
|
||||||
rv = h2_session_send(data, h2);
|
rv = h2_session_send(data, h2);
|
||||||
if(rv != 0)
|
if(rv)
|
||||||
result = CURLE_SEND_ERROR;
|
result = CURLE_SEND_ERROR;
|
||||||
|
|
||||||
if(nghttp2_session_want_write(h2)) {
|
if(nghttp2_session_want_write(h2)) {
|
||||||
@ -1963,7 +1963,7 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
|
|||||||
more space. */
|
more space. */
|
||||||
nheader += 1;
|
nheader += 1;
|
||||||
nva = malloc(sizeof(nghttp2_nv) * nheader);
|
nva = malloc(sizeof(nghttp2_nv) * nheader);
|
||||||
if(nva == NULL) {
|
if(!nva) {
|
||||||
*err = CURLE_OUT_OF_MEMORY;
|
*err = CURLE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2086,7 +2086,7 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* :authority must come before non-pseudo header fields */
|
/* :authority must come before non-pseudo header fields */
|
||||||
if(authority_idx != 0 && authority_idx != AUTHORITY_DST_IDX) {
|
if(authority_idx && authority_idx != AUTHORITY_DST_IDX) {
|
||||||
nghttp2_nv authority = nva[authority_idx];
|
nghttp2_nv authority = nva[authority_idx];
|
||||||
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
|
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
|
||||||
nva[i] = nva[i - 1];
|
nva[i] = nva[i - 1];
|
||||||
@ -2156,7 +2156,7 @@ static ssize_t http2_send(struct Curl_easy *data, int sockindex,
|
|||||||
stream->stream_id = stream_id;
|
stream->stream_id = stream_id;
|
||||||
|
|
||||||
rv = h2_session_send(data, h2);
|
rv = h2_session_send(data, h2);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
H2BUGF(infof(data,
|
H2BUGF(infof(data,
|
||||||
"http2_send() nghttp2_session_send error (%s)%d\n",
|
"http2_send() nghttp2_session_send error (%s)%d\n",
|
||||||
nghttp2_strerror(rv), rv));
|
nghttp2_strerror(rv), rv));
|
||||||
@ -2264,7 +2264,7 @@ CURLcode Curl_http2_switched(struct Curl_easy *data,
|
|||||||
/* queue SETTINGS frame (again) */
|
/* queue SETTINGS frame (again) */
|
||||||
rv = nghttp2_session_upgrade(httpc->h2, httpc->binsettings,
|
rv = nghttp2_session_upgrade(httpc->h2, httpc->binsettings,
|
||||||
httpc->binlen, NULL);
|
httpc->binlen, NULL);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
failf(data, "nghttp2_session_upgrade() failed: %s(%d)",
|
failf(data, "nghttp2_session_upgrade() failed: %s(%d)",
|
||||||
nghttp2_strerror(rv), rv);
|
nghttp2_strerror(rv), rv);
|
||||||
return CURLE_HTTP2;
|
return CURLE_HTTP2;
|
||||||
@ -2287,7 +2287,7 @@ CURLcode Curl_http2_switched(struct Curl_easy *data,
|
|||||||
rv = nghttp2_submit_settings(httpc->h2, NGHTTP2_FLAG_NONE,
|
rv = nghttp2_submit_settings(httpc->h2, NGHTTP2_FLAG_NONE,
|
||||||
httpc->local_settings,
|
httpc->local_settings,
|
||||||
httpc->local_settings_num);
|
httpc->local_settings_num);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
failf(data, "nghttp2_submit_settings() failed: %s(%d)",
|
failf(data, "nghttp2_submit_settings() failed: %s(%d)",
|
||||||
nghttp2_strerror(rv), rv);
|
nghttp2_strerror(rv), rv);
|
||||||
return CURLE_HTTP2;
|
return CURLE_HTTP2;
|
||||||
@ -2296,7 +2296,7 @@ CURLcode Curl_http2_switched(struct Curl_easy *data,
|
|||||||
|
|
||||||
rv = nghttp2_session_set_local_window_size(httpc->h2, NGHTTP2_FLAG_NONE, 0,
|
rv = nghttp2_session_set_local_window_size(httpc->h2, NGHTTP2_FLAG_NONE, 0,
|
||||||
HTTP2_HUGE_WINDOW_SIZE);
|
HTTP2_HUGE_WINDOW_SIZE);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)",
|
failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)",
|
||||||
nghttp2_strerror(rv), rv);
|
nghttp2_strerror(rv), rv);
|
||||||
return CURLE_HTTP2;
|
return CURLE_HTTP2;
|
||||||
|
@ -179,7 +179,7 @@ CURLcode Curl_output_negotiate(struct Curl_easy *data,
|
|||||||
|
|
||||||
free(base64);
|
free(base64);
|
||||||
|
|
||||||
if(userp == NULL) {
|
if(!userp) {
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,10 +186,10 @@ CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy)
|
|||||||
passwdp = "";
|
passwdp = "";
|
||||||
|
|
||||||
#ifdef USE_WINDOWS_SSPI
|
#ifdef USE_WINDOWS_SSPI
|
||||||
if(s_hSecDll == NULL) {
|
if(!s_hSecDll) {
|
||||||
/* not thread safe and leaks - use curl_global_init() to avoid */
|
/* not thread safe and leaks - use curl_global_init() to avoid */
|
||||||
CURLcode err = Curl_sspi_global_init();
|
CURLcode err = Curl_sspi_global_init();
|
||||||
if(s_hSecDll == NULL)
|
if(!s_hSecDll)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
#ifdef SECPKG_ATTR_ENDPOINT_BINDINGS
|
#ifdef SECPKG_ATTR_ENDPOINT_BINDINGS
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 1996-2019 Internet Software Consortium.
|
* Copyright (C) 1996-2021 Internet Software Consortium.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@ -134,7 +134,7 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
|
|||||||
|
|
||||||
/* Are we following an initial run of 0x00s or any real hex?
|
/* Are we following an initial run of 0x00s or any real hex?
|
||||||
*/
|
*/
|
||||||
if(i != 0)
|
if(i)
|
||||||
*tp++ = ':';
|
*tp++ = ':';
|
||||||
|
|
||||||
/* Is this address an encapsulated IPv4?
|
/* Is this address an encapsulated IPv4?
|
||||||
|
@ -305,7 +305,7 @@ krb5_auth(void *app_data, struct Curl_easy *data, struct connectdata *conn)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(output_buffer.length != 0) {
|
if(output_buffer.length) {
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
result = Curl_base64_encode(data, (char *)output_buffer.value,
|
result = Curl_base64_encode(data, (char *)output_buffer.value,
|
||||||
@ -817,7 +817,7 @@ static CURLcode choose_mech(struct Curl_easy *data, struct connectdata *conn)
|
|||||||
const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech;
|
const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech;
|
||||||
|
|
||||||
tmp_allocation = realloc(conn->app_data, mech->size);
|
tmp_allocation = realloc(conn->app_data, mech->size);
|
||||||
if(tmp_allocation == NULL) {
|
if(!tmp_allocation) {
|
||||||
failf(data, "Failed realloc of size %zu", mech->size);
|
failf(data, "Failed realloc of size %zu", mech->size);
|
||||||
mech = NULL;
|
mech = NULL;
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
14
lib/ldap.c
14
lib/ldap.c
@ -303,7 +303,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||||||
#else
|
#else
|
||||||
rc = _ldap_url_parse(data, conn, &ludp);
|
rc = _ldap_url_parse(data, conn, &ludp);
|
||||||
#endif
|
#endif
|
||||||
if(rc != 0) {
|
if(rc) {
|
||||||
failf(data, "LDAP local: %s", ldap_err2string(rc));
|
failf(data, "LDAP local: %s", ldap_err2string(rc));
|
||||||
result = CURLE_LDAP_INVALID_URL;
|
result = CURLE_LDAP_INVALID_URL;
|
||||||
goto quit;
|
goto quit;
|
||||||
@ -387,7 +387,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
server = ldapssl_init(host, (int)conn->port, 1);
|
server = ldapssl_init(host, (int)conn->port, 1);
|
||||||
if(server == NULL) {
|
if(!server) {
|
||||||
failf(data, "LDAP local: Cannot connect to %s:%ld",
|
failf(data, "LDAP local: Cannot connect to %s:%ld",
|
||||||
conn->host.dispname, conn->port);
|
conn->host.dispname, conn->port);
|
||||||
result = CURLE_COULDNT_CONNECT;
|
result = CURLE_COULDNT_CONNECT;
|
||||||
@ -428,7 +428,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
server = ldap_init(host, (int)conn->port);
|
server = ldap_init(host, (int)conn->port);
|
||||||
if(server == NULL) {
|
if(!server) {
|
||||||
failf(data, "LDAP local: Cannot connect to %s:%ld",
|
failf(data, "LDAP local: Cannot connect to %s:%ld",
|
||||||
conn->host.dispname, conn->port);
|
conn->host.dispname, conn->port);
|
||||||
result = CURLE_COULDNT_CONNECT;
|
result = CURLE_COULDNT_CONNECT;
|
||||||
@ -464,7 +464,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
server = ldap_init(host, (int)conn->port);
|
server = ldap_init(host, (int)conn->port);
|
||||||
if(server == NULL) {
|
if(!server) {
|
||||||
failf(data, "LDAP local: Cannot connect to %s:%ld",
|
failf(data, "LDAP local: Cannot connect to %s:%ld",
|
||||||
conn->host.dispname, conn->port);
|
conn->host.dispname, conn->port);
|
||||||
result = CURLE_COULDNT_CONNECT;
|
result = CURLE_COULDNT_CONNECT;
|
||||||
@ -477,7 +477,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||||||
#else
|
#else
|
||||||
rc = ldap_simple_bind_s(server, user, passwd);
|
rc = ldap_simple_bind_s(server, user, passwd);
|
||||||
#endif
|
#endif
|
||||||
if(!ldap_ssl && rc != 0) {
|
if(!ldap_ssl && rc) {
|
||||||
ldap_proto = LDAP_VERSION2;
|
ldap_proto = LDAP_VERSION2;
|
||||||
ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
|
ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
|
||||||
#ifdef USE_WIN32_LDAP
|
#ifdef USE_WIN32_LDAP
|
||||||
@ -486,7 +486,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||||||
rc = ldap_simple_bind_s(server, user, passwd);
|
rc = ldap_simple_bind_s(server, user, passwd);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if(rc != 0) {
|
if(rc) {
|
||||||
#ifdef USE_WIN32_LDAP
|
#ifdef USE_WIN32_LDAP
|
||||||
failf(data, "LDAP local: bind via ldap_win_bind %s",
|
failf(data, "LDAP local: bind via ldap_win_bind %s",
|
||||||
ldap_err2string(rc));
|
ldap_err2string(rc));
|
||||||
@ -501,7 +501,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||||||
rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope,
|
rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope,
|
||||||
ludp->lud_filter, ludp->lud_attrs, 0, &ldapmsg);
|
ludp->lud_filter, ludp->lud_attrs, 0, &ldapmsg);
|
||||||
|
|
||||||
if(rc != 0 && rc != LDAP_SIZELIMIT_EXCEEDED) {
|
if(rc && rc != LDAP_SIZELIMIT_EXCEEDED) {
|
||||||
failf(data, "LDAP remote: %s", ldap_err2string(rc));
|
failf(data, "LDAP remote: %s", ldap_err2string(rc));
|
||||||
result = CURLE_LDAP_SEARCH_FAILED;
|
result = CURLE_LDAP_SEARCH_FAILED;
|
||||||
goto quit;
|
goto quit;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -94,13 +94,13 @@ Curl_llist_remove(struct Curl_llist *list, struct Curl_llist_element *e,
|
|||||||
void *user)
|
void *user)
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
if(e == NULL || list->size == 0)
|
if(!e || list->size == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(e == list->head) {
|
if(e == list->head) {
|
||||||
list->head = e->next;
|
list->head = e->next;
|
||||||
|
|
||||||
if(list->head == NULL)
|
if(!list->head)
|
||||||
list->tail = NULL;
|
list->tail = NULL;
|
||||||
else
|
else
|
||||||
e->next->prev = NULL;
|
e->next->prev = NULL;
|
||||||
|
@ -174,7 +174,7 @@ static void MD4_Init(MD4_CTX *ctx)
|
|||||||
|
|
||||||
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
|
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
|
||||||
{
|
{
|
||||||
if(ctx->data == NULL) {
|
if(!ctx->data) {
|
||||||
ctx->data = malloc(size);
|
ctx->data = malloc(size);
|
||||||
if(ctx->data != NULL) {
|
if(ctx->data != NULL) {
|
||||||
memcpy(ctx->data, data, size);
|
memcpy(ctx->data, data, size);
|
||||||
|
@ -152,14 +152,14 @@ curl_off_t VmsRealFileSize(const char *name,
|
|||||||
FILE * file;
|
FILE * file;
|
||||||
|
|
||||||
file = fopen(name, FOPEN_READTEXT); /* VMS */
|
file = fopen(name, FOPEN_READTEXT); /* VMS */
|
||||||
if(file == NULL)
|
if(!file)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
ret_stat = 1;
|
ret_stat = 1;
|
||||||
while(ret_stat > 0) {
|
while(ret_stat > 0) {
|
||||||
ret_stat = fread(buffer, 1, sizeof(buffer), file);
|
ret_stat = fread(buffer, 1, sizeof(buffer), file);
|
||||||
if(ret_stat != 0)
|
if(ret_stat)
|
||||||
count += ret_stat;
|
count += ret_stat;
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1999 - 2021, 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
|
||||||
@ -815,7 +815,7 @@ static int dprintf_formatf(
|
|||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
str = (char *) p->data.str;
|
str = (char *) p->data.str;
|
||||||
if(str == NULL) {
|
if(!str) {
|
||||||
/* Write null[] if there's space. */
|
/* Write null[] if there's space. */
|
||||||
if(prec == -1 || prec >= (long) sizeof(null) - 1) {
|
if(prec == -1 || prec >= (long) sizeof(null) - 1) {
|
||||||
str = null;
|
str = null;
|
||||||
|
@ -1289,7 +1289,7 @@ static CURLMcode multi_wait(struct Curl_multi *multi,
|
|||||||
mask |= CURL_WAIT_POLLOUT;
|
mask |= CURL_WAIT_POLLOUT;
|
||||||
if(wsa_events.lNetworkEvents & FD_OOB)
|
if(wsa_events.lNetworkEvents & FD_OOB)
|
||||||
mask |= CURL_WAIT_POLLPRI;
|
mask |= CURL_WAIT_POLLPRI;
|
||||||
if(ret && pollrc <= 0 && wsa_events.lNetworkEvents != 0)
|
if(ret && pollrc <= 0 && wsa_events.lNetworkEvents)
|
||||||
retcode++;
|
retcode++;
|
||||||
}
|
}
|
||||||
WSAEventSelect(extra_fds[i].fd, multi->wsa_event, 0);
|
WSAEventSelect(extra_fds[i].fd, multi->wsa_event, 0);
|
||||||
@ -1317,7 +1317,7 @@ static CURLMcode multi_wait(struct Curl_multi *multi,
|
|||||||
if(bitmap & (GETSOCK_READSOCK(i) | GETSOCK_WRITESOCK(i))) {
|
if(bitmap & (GETSOCK_READSOCK(i) | GETSOCK_WRITESOCK(i))) {
|
||||||
wsa_events.lNetworkEvents = 0;
|
wsa_events.lNetworkEvents = 0;
|
||||||
if(WSAEnumNetworkEvents(sockbunch[i], NULL, &wsa_events) == 0) {
|
if(WSAEnumNetworkEvents(sockbunch[i], NULL, &wsa_events) == 0) {
|
||||||
if(ret && pollrc <= 0 && wsa_events.lNetworkEvents != 0)
|
if(ret && pollrc <= 0 && wsa_events.lNetworkEvents)
|
||||||
retcode++;
|
retcode++;
|
||||||
}
|
}
|
||||||
WSAEventSelect(sockbunch[i], multi->wsa_event, 0);
|
WSAEventSelect(sockbunch[i], multi->wsa_event, 0);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -127,7 +127,7 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data,
|
|||||||
&output_ptr, &out_bytes);
|
&output_ptr, &out_bytes);
|
||||||
if(!data)
|
if(!data)
|
||||||
iconv_close(tmpcd);
|
iconv_close(tmpcd);
|
||||||
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
|
if((rc == ICONV_ERROR) || (in_bytes)) {
|
||||||
failf(data,
|
failf(data,
|
||||||
"The Curl_convert_to_network iconv call failed with errno %i: %s",
|
"The Curl_convert_to_network iconv call failed with errno %i: %s",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
@ -193,7 +193,7 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data,
|
|||||||
&output_ptr, &out_bytes);
|
&output_ptr, &out_bytes);
|
||||||
if(!data)
|
if(!data)
|
||||||
iconv_close(tmpcd);
|
iconv_close(tmpcd);
|
||||||
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
|
if((rc == ICONV_ERROR) || (in_bytes)) {
|
||||||
failf(data,
|
failf(data,
|
||||||
"Curl_convert_from_network iconv call failed with errno %i: %s",
|
"Curl_convert_from_network iconv call failed with errno %i: %s",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
@ -260,7 +260,7 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data,
|
|||||||
&output_ptr, &out_bytes);
|
&output_ptr, &out_bytes);
|
||||||
if(!data)
|
if(!data)
|
||||||
iconv_close(tmpcd);
|
iconv_close(tmpcd);
|
||||||
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
|
if((rc == ICONV_ERROR) || (in_bytes)) {
|
||||||
failf(data,
|
failf(data,
|
||||||
"The Curl_convert_from_utf8 iconv call failed with errno %i: %s",
|
"The Curl_convert_from_utf8 iconv call failed with errno %i: %s",
|
||||||
errno, strerror(errno));
|
errno, strerror(errno));
|
||||||
|
@ -549,7 +549,7 @@ static ssize_t ldap_recv(struct Curl_easy *data, int sockindex, char *buf,
|
|||||||
rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, &bvals)) {
|
rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, &bvals)) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(bv.bv_val == NULL)
|
if(!bv.bv_val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7))
|
if(bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7))
|
||||||
@ -557,7 +557,7 @@ static ssize_t ldap_recv(struct Curl_easy *data, int sockindex, char *buf,
|
|||||||
else
|
else
|
||||||
binary = 0;
|
binary = 0;
|
||||||
|
|
||||||
if(bvals == NULL) {
|
if(!bvals) {
|
||||||
writeerr = Curl_client_write(data, CLIENTWRITE_BODY, (char *)"\t", 1);
|
writeerr = Curl_client_write(data, CLIENTWRITE_BODY, (char *)"\t", 1);
|
||||||
if(writeerr) {
|
if(writeerr) {
|
||||||
*err = writeerr;
|
*err = writeerr;
|
||||||
|
@ -680,7 +680,7 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rtp_dataleft != 0 && rtp[0] == '$') {
|
if(rtp_dataleft && rtp[0] == '$') {
|
||||||
DEBUGF(infof(data, "RTP Rewinding %zd %s\n", rtp_dataleft,
|
DEBUGF(infof(data, "RTP Rewinding %zd %s\n", rtp_dataleft,
|
||||||
*readmore ? "(READMORE)" : ""));
|
*readmore ? "(READMORE)" : ""));
|
||||||
|
|
||||||
@ -824,7 +824,7 @@ CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, char *header)
|
|||||||
|
|
||||||
/* Copy the id substring into a new buffer */
|
/* Copy the id substring into a new buffer */
|
||||||
data->set.str[STRING_RTSP_SESSION_ID] = malloc(idlen + 1);
|
data->set.str[STRING_RTSP_SESSION_ID] = malloc(idlen + 1);
|
||||||
if(data->set.str[STRING_RTSP_SESSION_ID] == NULL)
|
if(!data->set.str[STRING_RTSP_SESSION_ID])
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
memcpy(data->set.str[STRING_RTSP_SESSION_ID], start, idlen);
|
memcpy(data->set.str[STRING_RTSP_SESSION_ID], start, idlen);
|
||||||
(data->set.str[STRING_RTSP_SESSION_ID])[idlen] = '\0';
|
(data->set.str[STRING_RTSP_SESSION_ID])[idlen] = '\0';
|
||||||
|
@ -442,7 +442,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
|
|||||||
if(ufds[i].events & POLLPRI)
|
if(ufds[i].events & POLLPRI)
|
||||||
ufds[i].revents |= POLLPRI;
|
ufds[i].revents |= POLLPRI;
|
||||||
}
|
}
|
||||||
if(ufds[i].revents != 0)
|
if(ufds[i].revents)
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ static size_t convert_lineends(struct Curl_easy *data,
|
|||||||
char *inPtr, *outPtr;
|
char *inPtr, *outPtr;
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if((startPtr == NULL) || (size < 1)) {
|
if(!startPtr || (size < 1)) {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +813,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||||||
case CURLOPT_COOKIELIST:
|
case CURLOPT_COOKIELIST:
|
||||||
argptr = va_arg(param, char *);
|
argptr = va_arg(param, char *);
|
||||||
|
|
||||||
if(argptr == NULL)
|
if(!argptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(strcasecompare(argptr, "ALL")) {
|
if(strcasecompare(argptr, "ALL")) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -87,7 +87,7 @@ static char *vms_translate_path(const char *path)
|
|||||||
/* See if the result is in VMS format, if not, we are done */
|
/* See if the result is in VMS format, if not, we are done */
|
||||||
/* Assume that this is a PATH, not just some data */
|
/* Assume that this is a PATH, not just some data */
|
||||||
test_str = strpbrk(path, ":[<^");
|
test_str = strpbrk(path, ":[<^");
|
||||||
if(test_str == NULL) {
|
if(!test_str) {
|
||||||
return (char *)path;
|
return (char *)path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ static char *vms_getenv(const char *envvar)
|
|||||||
|
|
||||||
/* first use the DECC getenv() function */
|
/* first use the DECC getenv() function */
|
||||||
result = decc$getenv(envvar);
|
result = decc$getenv(envvar);
|
||||||
if(result == NULL) {
|
if(!result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ static struct passwd *vms_getpwuid(uid_t uid)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
my_passwd = decc_getpwuid(uid);
|
my_passwd = decc_getpwuid(uid);
|
||||||
if(my_passwd == NULL) {
|
if(!my_passwd) {
|
||||||
return my_passwd;
|
return my_passwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ Curl_share_lock(struct Curl_easy *data, curl_lock_data type,
|
|||||||
{
|
{
|
||||||
struct Curl_share *share = data->share;
|
struct Curl_share *share = data->share;
|
||||||
|
|
||||||
if(share == NULL)
|
if(!share)
|
||||||
return CURLSHE_INVALID;
|
return CURLSHE_INVALID;
|
||||||
|
|
||||||
if(share->specifier & (1<<type)) {
|
if(share->specifier & (1<<type)) {
|
||||||
@ -252,7 +252,7 @@ Curl_share_unlock(struct Curl_easy *data, curl_lock_data type)
|
|||||||
{
|
{
|
||||||
struct Curl_share *share = data->share;
|
struct Curl_share *share = data->share;
|
||||||
|
|
||||||
if(share == NULL)
|
if(!share)
|
||||||
return CURLSHE_INVALID;
|
return CURLSHE_INVALID;
|
||||||
|
|
||||||
if(share->specifier & (1<<type)) {
|
if(share->specifier & (1<<type)) {
|
||||||
|
@ -426,7 +426,7 @@ CURLproxycode Curl_SOCKS4(const char *proxy_user,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* wrong version ? */
|
/* wrong version ? */
|
||||||
if(socksreq[0] != 0) {
|
if(socksreq[0]) {
|
||||||
failf(data,
|
failf(data,
|
||||||
"SOCKS4 reply has wrong version, version should be 0.");
|
"SOCKS4 reply has wrong version, version should be 0.");
|
||||||
return CURLPX_BAD_VERSION;
|
return CURLPX_BAD_VERSION;
|
||||||
@ -742,7 +742,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
|
|||||||
return CURLPX_OK;
|
return CURLPX_OK;
|
||||||
}
|
}
|
||||||
/* ignore the first (VER) byte */
|
/* ignore the first (VER) byte */
|
||||||
else if(socksreq[1] != 0) { /* status */
|
else if(socksreq[1]) { /* status */
|
||||||
failf(data, "User was rejected by the SOCKS5 server (%d %d).",
|
failf(data, "User was rejected by the SOCKS5 server (%d %d).",
|
||||||
socksreq[0], socksreq[1]);
|
socksreq[0], socksreq[1]);
|
||||||
return CURLPX_USER_REJECTED;
|
return CURLPX_USER_REJECTED;
|
||||||
@ -927,7 +927,7 @@ CURLproxycode Curl_SOCKS5(const char *proxy_user,
|
|||||||
"SOCKS5 reply has wrong version, version should be 5.");
|
"SOCKS5 reply has wrong version, version should be 5.");
|
||||||
return CURLPX_BAD_VERSION;
|
return CURLPX_BAD_VERSION;
|
||||||
}
|
}
|
||||||
else if(socksreq[1] != 0) { /* Anything besides 0 is an error */
|
else if(socksreq[1]) { /* Anything besides 0 is an error */
|
||||||
CURLproxycode rc = CURLPX_REPLY_UNASSIGNED;
|
CURLproxycode rc = CURLPX_REPLY_UNASSIGNED;
|
||||||
int code = socksreq[1];
|
int code = socksreq[1];
|
||||||
failf(data, "Can't complete SOCKS5 connection to %s. (%d)",
|
failf(data, "Can't complete SOCKS5 connection to %s. (%d)",
|
||||||
|
@ -195,7 +195,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
|||||||
return CURLE_COULDNT_CONNECT;
|
return CURLE_COULDNT_CONNECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gss_send_token.length != 0) {
|
if(gss_send_token.length) {
|
||||||
socksreq[0] = 1; /* GSS-API subnegotiation version */
|
socksreq[0] = 1; /* GSS-API subnegotiation version */
|
||||||
socksreq[1] = 1; /* authentication message type */
|
socksreq[1] = 1; /* authentication message type */
|
||||||
us_length = htons((short)gss_send_token.length);
|
us_length = htons((short)gss_send_token.length);
|
||||||
|
@ -198,7 +198,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
|||||||
return CURLE_COULDNT_CONNECT;
|
return CURLE_COULDNT_CONNECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sspi_send_token.cbBuffer != 0) {
|
if(sspi_send_token.cbBuffer) {
|
||||||
socksreq[0] = 1; /* GSS-API subnegotiation version */
|
socksreq[0] = 1; /* GSS-API subnegotiation version */
|
||||||
socksreq[1] = 1; /* authentication message type */
|
socksreq[1] = 1; /* authentication message type */
|
||||||
us_length = htons((short)sspi_send_token.cbBuffer);
|
us_length = htons((short)sspi_send_token.cbBuffer);
|
||||||
|
18
lib/splay.c
18
lib/splay.c
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1997 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1997 - 2021, 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
|
||||||
@ -42,7 +42,7 @@ struct Curl_tree *Curl_splay(struct curltime i,
|
|||||||
{
|
{
|
||||||
struct Curl_tree N, *l, *r, *y;
|
struct Curl_tree N, *l, *r, *y;
|
||||||
|
|
||||||
if(t == NULL)
|
if(!t)
|
||||||
return t;
|
return t;
|
||||||
N.smaller = N.larger = NULL;
|
N.smaller = N.larger = NULL;
|
||||||
l = r = &N;
|
l = r = &N;
|
||||||
@ -50,14 +50,14 @@ struct Curl_tree *Curl_splay(struct curltime i,
|
|||||||
for(;;) {
|
for(;;) {
|
||||||
long comp = compare(i, t->key);
|
long comp = compare(i, t->key);
|
||||||
if(comp < 0) {
|
if(comp < 0) {
|
||||||
if(t->smaller == NULL)
|
if(!t->smaller)
|
||||||
break;
|
break;
|
||||||
if(compare(i, t->smaller->key) < 0) {
|
if(compare(i, t->smaller->key) < 0) {
|
||||||
y = t->smaller; /* rotate smaller */
|
y = t->smaller; /* rotate smaller */
|
||||||
t->smaller = y->larger;
|
t->smaller = y->larger;
|
||||||
y->larger = t;
|
y->larger = t;
|
||||||
t = y;
|
t = y;
|
||||||
if(t->smaller == NULL)
|
if(!t->smaller)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r->smaller = t; /* link smaller */
|
r->smaller = t; /* link smaller */
|
||||||
@ -65,14 +65,14 @@ struct Curl_tree *Curl_splay(struct curltime i,
|
|||||||
t = t->smaller;
|
t = t->smaller;
|
||||||
}
|
}
|
||||||
else if(comp > 0) {
|
else if(comp > 0) {
|
||||||
if(t->larger == NULL)
|
if(!t->larger)
|
||||||
break;
|
break;
|
||||||
if(compare(i, t->larger->key) > 0) {
|
if(compare(i, t->larger->key) > 0) {
|
||||||
y = t->larger; /* rotate larger */
|
y = t->larger; /* rotate larger */
|
||||||
t->larger = y->smaller;
|
t->larger = y->smaller;
|
||||||
y->smaller = t;
|
y->smaller = t;
|
||||||
t = y;
|
t = y;
|
||||||
if(t->larger == NULL)
|
if(!t->larger)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
l->larger = t; /* link larger */
|
l->larger = t; /* link larger */
|
||||||
@ -104,7 +104,7 @@ struct Curl_tree *Curl_splayinsert(struct curltime i,
|
|||||||
(time_t)-1, (unsigned int)-1
|
(time_t)-1, (unsigned int)-1
|
||||||
}; /* will *NEVER* appear */
|
}; /* will *NEVER* appear */
|
||||||
|
|
||||||
if(node == NULL)
|
if(!node)
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
if(t != NULL) {
|
if(t != NULL) {
|
||||||
@ -125,7 +125,7 @@ struct Curl_tree *Curl_splayinsert(struct curltime i,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t == NULL) {
|
if(!t) {
|
||||||
node->smaller = node->larger = NULL;
|
node->smaller = node->larger = NULL;
|
||||||
}
|
}
|
||||||
else if(compare(i, t->key) < 0) {
|
else if(compare(i, t->key) < 0) {
|
||||||
@ -262,7 +262,7 @@ int Curl_splayremove(struct Curl_tree *t,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Remove the root node */
|
/* Remove the root node */
|
||||||
if(t->smaller == NULL)
|
if(!t->smaller)
|
||||||
x = t->larger;
|
x = t->larger;
|
||||||
else {
|
else {
|
||||||
x = Curl_splay(removenode->key, t->smaller);
|
x = Curl_splay(removenode->key, t->smaller);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
|
* Copyright (C) 2016 - 2021, Steve Holme, <steve_holme@hotmail.com>.
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -58,7 +58,7 @@ CURLcode Curl_win32_init(long flags)
|
|||||||
wVersionRequested = MAKEWORD(2, 2);
|
wVersionRequested = MAKEWORD(2, 2);
|
||||||
res = WSAStartup(wVersionRequested, &wsaData);
|
res = WSAStartup(wVersionRequested, &wsaData);
|
||||||
|
|
||||||
if(res != 0)
|
if(res)
|
||||||
/* Tell the user that we couldn't find a usable */
|
/* Tell the user that we couldn't find a usable */
|
||||||
/* winsock.dll. */
|
/* winsock.dll. */
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
|
@ -319,7 +319,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_state_data *state,
|
|||||||
const char *option, *value;
|
const char *option, *value;
|
||||||
|
|
||||||
tmp = tftp_option_get(tmp, ptr + len - tmp, &option, &value);
|
tmp = tftp_option_get(tmp, ptr + len - tmp, &option, &value);
|
||||||
if(tmp == NULL) {
|
if(!tmp) {
|
||||||
failf(data, "Malformed ACK packet, rejecting");
|
failf(data, "Malformed ACK packet, rejecting");
|
||||||
return CURLE_TFTP_ILLEGAL;
|
return CURLE_TFTP_ILLEGAL;
|
||||||
}
|
}
|
||||||
@ -776,7 +776,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
|
|||||||
return result;
|
return result;
|
||||||
state->sbytes += (int)cb;
|
state->sbytes += (int)cb;
|
||||||
state->data->req.upload_fromhere += cb;
|
state->data->req.upload_fromhere += cb;
|
||||||
} while(state->sbytes < state->blksize && cb != 0);
|
} while(state->sbytes < state->blksize && cb);
|
||||||
|
|
||||||
sbytes = sendto(state->sockfd, (void *) state->spacket.data,
|
sbytes = sendto(state->sockfd, (void *) state->spacket.data,
|
||||||
4 + state->sbytes, SEND_4TH_ARG,
|
4 + state->sbytes, SEND_4TH_ARG,
|
||||||
@ -1256,7 +1256,7 @@ static CURLcode tftp_multi_statemach(struct Curl_easy *data, bool *done)
|
|||||||
failf(data, "%s", Curl_strerror(error, buffer, sizeof(buffer)));
|
failf(data, "%s", Curl_strerror(error, buffer, sizeof(buffer)));
|
||||||
state->event = TFTP_EVENT_ERROR;
|
state->event = TFTP_EVENT_ERROR;
|
||||||
}
|
}
|
||||||
else if(rc != 0) {
|
else if(rc) {
|
||||||
result = tftp_receive_packet(data);
|
result = tftp_receive_packet(data);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
@ -923,14 +923,14 @@ socks_proxy_info_matches(const struct proxy_info *data,
|
|||||||
/* the user information is case-sensitive
|
/* the user information is case-sensitive
|
||||||
or at least it is not defined as case-insensitive
|
or at least it is not defined as case-insensitive
|
||||||
see https://tools.ietf.org/html/rfc3986#section-3.2.1 */
|
see https://tools.ietf.org/html/rfc3986#section-3.2.1 */
|
||||||
if((data->user == NULL) != (needle->user == NULL))
|
if(!data->user != !needle->user)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* curl_strequal does a case insentive comparison, so do not use it here! */
|
/* curl_strequal does a case insentive comparison, so do not use it here! */
|
||||||
if(data->user &&
|
if(data->user &&
|
||||||
needle->user &&
|
needle->user &&
|
||||||
strcmp(data->user, needle->user) != 0)
|
strcmp(data->user, needle->user) != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if((data->passwd == NULL) != (needle->passwd == NULL))
|
if(!data->passwd != !needle->passwd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* curl_strequal does a case insentive comparison, so do not use it here! */
|
/* curl_strequal does a case insentive comparison, so do not use it here! */
|
||||||
if(data->passwd &&
|
if(data->passwd &&
|
||||||
@ -3563,7 +3563,7 @@ static CURLcode create_conn(struct Curl_easy *data,
|
|||||||
#ifdef USE_UNIX_SOCKETS
|
#ifdef USE_UNIX_SOCKETS
|
||||||
if(data->set.str[STRING_UNIX_SOCKET_PATH]) {
|
if(data->set.str[STRING_UNIX_SOCKET_PATH]) {
|
||||||
conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]);
|
conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]);
|
||||||
if(conn->unix_domain_socket == NULL) {
|
if(!conn->unix_domain_socket) {
|
||||||
result = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ CURLcode Curl_auth_create_plain_message(const char *authzid,
|
|||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
/* Calculate the reply */
|
/* Calculate the reply */
|
||||||
if(zlen != 0)
|
if(zlen)
|
||||||
memcpy(plainauth, authzid, zlen);
|
memcpy(plainauth, authzid, zlen);
|
||||||
plainauth[zlen] = '\0';
|
plainauth[zlen] = '\0';
|
||||||
memcpy(plainauth + zlen + 1, authcid, clen);
|
memcpy(plainauth + zlen + 1, authcid, clen);
|
||||||
|
@ -226,7 +226,7 @@ static int write_client_handshake(struct quicsocket *qs,
|
|||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
crypto_data = &qs->crypto_data[level];
|
crypto_data = &qs->crypto_data[level];
|
||||||
if(crypto_data->buf == NULL) {
|
if(!crypto_data->buf) {
|
||||||
crypto_data->buf = malloc(4096);
|
crypto_data->buf = malloc(4096);
|
||||||
if(!crypto_data->buf)
|
if(!crypto_data->buf)
|
||||||
return 0;
|
return 0;
|
||||||
@ -615,7 +615,7 @@ cb_acked_stream_data_offset(ngtcp2_conn *tconn, int64_t stream_id,
|
|||||||
(void)stream_user_data;
|
(void)stream_user_data;
|
||||||
|
|
||||||
rv = nghttp3_conn_add_ack_offset(qs->h3conn, stream_id, datalen);
|
rv = nghttp3_conn_add_ack_offset(qs->h3conn, stream_id, datalen);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
return NGTCP2_ERR_CALLBACK_FAILURE;
|
return NGTCP2_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +634,7 @@ static int cb_stream_close(ngtcp2_conn *tconn, int64_t stream_id,
|
|||||||
|
|
||||||
rv = nghttp3_conn_close_stream(qs->h3conn, stream_id,
|
rv = nghttp3_conn_close_stream(qs->h3conn, stream_id,
|
||||||
app_error_code);
|
app_error_code);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
return NGTCP2_ERR_CALLBACK_FAILURE;
|
return NGTCP2_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ static int cb_stream_reset(ngtcp2_conn *tconn, int64_t stream_id,
|
|||||||
(void)stream_user_data;
|
(void)stream_user_data;
|
||||||
|
|
||||||
rv = nghttp3_conn_reset_stream(qs->h3conn, stream_id);
|
rv = nghttp3_conn_reset_stream(qs->h3conn, stream_id);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
return NGTCP2_ERR_CALLBACK_FAILURE;
|
return NGTCP2_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,7 +682,7 @@ static int cb_extend_max_stream_data(ngtcp2_conn *tconn, int64_t stream_id,
|
|||||||
(void)stream_user_data;
|
(void)stream_user_data;
|
||||||
|
|
||||||
rv = nghttp3_conn_unblock_stream(qs->h3conn, stream_id);
|
rv = nghttp3_conn_unblock_stream(qs->h3conn, stream_id);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
return NGTCP2_ERR_CALLBACK_FAILURE;
|
return NGTCP2_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1309,7 +1309,7 @@ static int cb_h3_acked_stream_data(nghttp3_conn *conn, int64_t stream_id,
|
|||||||
|
|
||||||
if(stream->h3out->used == 0) {
|
if(stream->h3out->used == 0) {
|
||||||
int rv = nghttp3_conn_resume_stream(conn, stream_id);
|
int rv = nghttp3_conn_resume_stream(conn, stream_id);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
return NGTCP2_ERR_CALLBACK_FAILURE;
|
return NGTCP2_ERR_CALLBACK_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1545,7 +1545,7 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* :authority must come before non-pseudo header fields */
|
/* :authority must come before non-pseudo header fields */
|
||||||
if(authority_idx != 0 && authority_idx != AUTHORITY_DST_IDX) {
|
if(authority_idx && authority_idx != AUTHORITY_DST_IDX) {
|
||||||
nghttp3_nv authority = nva[authority_idx];
|
nghttp3_nv authority = nva[authority_idx];
|
||||||
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
|
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
|
||||||
nva[i] = nva[i - 1];
|
nva[i] = nva[i - 1];
|
||||||
@ -1741,7 +1741,7 @@ static CURLcode ng_process_ingress(struct Curl_easy *data,
|
|||||||
remote_addrlen);
|
remote_addrlen);
|
||||||
|
|
||||||
rv = ngtcp2_conn_read_pkt(qs->qconn, &path, &pi, buf, recvd, ts);
|
rv = ngtcp2_conn_read_pkt(qs->qconn, &path, &pi, buf, recvd, ts);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
/* TODO Send CONNECTION_CLOSE if possible */
|
/* TODO Send CONNECTION_CLOSE if possible */
|
||||||
return CURLE_RECV_ERROR;
|
return CURLE_RECV_ERROR;
|
||||||
}
|
}
|
||||||
@ -1785,7 +1785,7 @@ static CURLcode ng_flush_egress(struct Curl_easy *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rv = ngtcp2_conn_handle_expiry(qs->qconn, ts);
|
rv = ngtcp2_conn_handle_expiry(qs->qconn, ts);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
failf(data, "ngtcp2_conn_handle_expiry returned error: %s",
|
failf(data, "ngtcp2_conn_handle_expiry returned error: %s",
|
||||||
ngtcp2_strerror(rv));
|
ngtcp2_strerror(rv));
|
||||||
return CURLE_SEND_ERROR;
|
return CURLE_SEND_ERROR;
|
||||||
@ -1821,7 +1821,7 @@ static CURLcode ng_flush_egress(struct Curl_easy *data,
|
|||||||
outlen == NGTCP2_ERR_STREAM_SHUT_WR) {
|
outlen == NGTCP2_ERR_STREAM_SHUT_WR) {
|
||||||
assert(ndatalen == -1);
|
assert(ndatalen == -1);
|
||||||
rv = nghttp3_conn_block_stream(qs->h3conn, stream_id);
|
rv = nghttp3_conn_block_stream(qs->h3conn, stream_id);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
failf(data, "nghttp3_conn_block_stream returned error: %s\n",
|
failf(data, "nghttp3_conn_block_stream returned error: %s\n",
|
||||||
nghttp3_strerror(rv));
|
nghttp3_strerror(rv));
|
||||||
return CURLE_SEND_ERROR;
|
return CURLE_SEND_ERROR;
|
||||||
@ -1831,7 +1831,7 @@ static CURLcode ng_flush_egress(struct Curl_easy *data,
|
|||||||
else if(outlen == NGTCP2_ERR_WRITE_MORE) {
|
else if(outlen == NGTCP2_ERR_WRITE_MORE) {
|
||||||
assert(ndatalen >= 0);
|
assert(ndatalen >= 0);
|
||||||
rv = nghttp3_conn_add_write_offset(qs->h3conn, stream_id, ndatalen);
|
rv = nghttp3_conn_add_write_offset(qs->h3conn, stream_id, ndatalen);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
failf(data, "nghttp3_conn_add_write_offset returned error: %s\n",
|
failf(data, "nghttp3_conn_add_write_offset returned error: %s\n",
|
||||||
nghttp3_strerror(rv));
|
nghttp3_strerror(rv));
|
||||||
return CURLE_SEND_ERROR;
|
return CURLE_SEND_ERROR;
|
||||||
@ -1847,7 +1847,7 @@ static CURLcode ng_flush_egress(struct Curl_easy *data,
|
|||||||
}
|
}
|
||||||
else if(ndatalen >= 0) {
|
else if(ndatalen >= 0) {
|
||||||
rv = nghttp3_conn_add_write_offset(qs->h3conn, stream_id, ndatalen);
|
rv = nghttp3_conn_add_write_offset(qs->h3conn, stream_id, ndatalen);
|
||||||
if(rv != 0) {
|
if(rv) {
|
||||||
failf(data, "nghttp3_conn_add_write_offset returned error: %s\n",
|
failf(data, "nghttp3_conn_add_write_offset returned error: %s\n",
|
||||||
nghttp3_strerror(rv));
|
nghttp3_strerror(rv));
|
||||||
return CURLE_SEND_ERROR;
|
return CURLE_SEND_ERROR;
|
||||||
|
@ -750,7 +750,7 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* :authority must come before non-pseudo header fields */
|
/* :authority must come before non-pseudo header fields */
|
||||||
if(authority_idx != 0 && authority_idx != AUTHORITY_DST_IDX) {
|
if(authority_idx && authority_idx != AUTHORITY_DST_IDX) {
|
||||||
quiche_h3_header authority = nva[authority_idx];
|
quiche_h3_header authority = nva[authority_idx];
|
||||||
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
|
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
|
||||||
nva[i] = nva[i - 1];
|
nva[i] = nva[i - 1];
|
||||||
|
@ -628,7 +628,7 @@ restart:
|
|||||||
rc = SSH_OK;
|
rc = SSH_OK;
|
||||||
else if(rc == SSH_AUTH_INFO) {
|
else if(rc == SSH_AUTH_INFO) {
|
||||||
nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session);
|
nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session);
|
||||||
if(nprompts != 0)
|
if(nprompts)
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
|
|
||||||
sshc->kbd_state = 2;
|
sshc->kbd_state = 2;
|
||||||
@ -958,7 +958,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
* Get the "home" directory
|
* Get the "home" directory
|
||||||
*/
|
*/
|
||||||
sshc->homedir = sftp_canonicalize_path(sshc->sftp_session, ".");
|
sshc->homedir = sftp_canonicalize_path(sshc->sftp_session, ".");
|
||||||
if(sshc->homedir == NULL) {
|
if(!sshc->homedir) {
|
||||||
MOVE_TO_ERROR_STATE(CURLE_COULDNT_CONNECT);
|
MOVE_TO_ERROR_STATE(CURLE_COULDNT_CONNECT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1033,7 +1033,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
case SSH_SFTP_QUOTE_SETSTAT:
|
case SSH_SFTP_QUOTE_SETSTAT:
|
||||||
rc = sftp_setstat(sshc->sftp_session, sshc->quote_path2,
|
rc = sftp_setstat(sshc->sftp_session, sshc->quote_path2,
|
||||||
sshc->quote_attrs);
|
sshc->quote_attrs);
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
failf(data, "Attempt to set SFTP stats failed: %s",
|
failf(data, "Attempt to set SFTP stats failed: %s",
|
||||||
@ -1052,7 +1052,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
case SSH_SFTP_QUOTE_SYMLINK:
|
case SSH_SFTP_QUOTE_SYMLINK:
|
||||||
rc = sftp_symlink(sshc->sftp_session, sshc->quote_path2,
|
rc = sftp_symlink(sshc->sftp_session, sshc->quote_path2,
|
||||||
sshc->quote_path1);
|
sshc->quote_path1);
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
failf(data, "symlink command failed: %s",
|
failf(data, "symlink command failed: %s",
|
||||||
@ -1068,7 +1068,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
case SSH_SFTP_QUOTE_MKDIR:
|
case SSH_SFTP_QUOTE_MKDIR:
|
||||||
rc = sftp_mkdir(sshc->sftp_session, sshc->quote_path1,
|
rc = sftp_mkdir(sshc->sftp_session, sshc->quote_path1,
|
||||||
(mode_t)data->set.new_directory_perms);
|
(mode_t)data->set.new_directory_perms);
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
failf(data, "mkdir command failed: %s",
|
failf(data, "mkdir command failed: %s",
|
||||||
ssh_get_error(sshc->ssh_session));
|
ssh_get_error(sshc->ssh_session));
|
||||||
@ -1083,7 +1083,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
case SSH_SFTP_QUOTE_RENAME:
|
case SSH_SFTP_QUOTE_RENAME:
|
||||||
rc = sftp_rename(sshc->sftp_session, sshc->quote_path1,
|
rc = sftp_rename(sshc->sftp_session, sshc->quote_path1,
|
||||||
sshc->quote_path2);
|
sshc->quote_path2);
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
failf(data, "rename command failed: %s",
|
failf(data, "rename command failed: %s",
|
||||||
@ -1098,7 +1098,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
|
|
||||||
case SSH_SFTP_QUOTE_RMDIR:
|
case SSH_SFTP_QUOTE_RMDIR:
|
||||||
rc = sftp_rmdir(sshc->sftp_session, sshc->quote_path1);
|
rc = sftp_rmdir(sshc->sftp_session, sshc->quote_path1);
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
failf(data, "rmdir command failed: %s",
|
failf(data, "rmdir command failed: %s",
|
||||||
ssh_get_error(sshc->ssh_session));
|
ssh_get_error(sshc->ssh_session));
|
||||||
@ -1112,7 +1112,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
|
|
||||||
case SSH_SFTP_QUOTE_UNLINK:
|
case SSH_SFTP_QUOTE_UNLINK:
|
||||||
rc = sftp_unlink(sshc->sftp_session, sshc->quote_path1);
|
rc = sftp_unlink(sshc->sftp_session, sshc->quote_path1);
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
failf(data, "rm command failed: %s",
|
failf(data, "rm command failed: %s",
|
||||||
ssh_get_error(sshc->ssh_session));
|
ssh_get_error(sshc->ssh_session));
|
||||||
@ -1187,7 +1187,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
sftp_attributes attrs;
|
sftp_attributes attrs;
|
||||||
|
|
||||||
attrs = sftp_stat(sshc->sftp_session, protop->path);
|
attrs = sftp_stat(sshc->sftp_session, protop->path);
|
||||||
if(attrs != 0) {
|
if(attrs) {
|
||||||
data->info.filetime = attrs->mtime;
|
data->info.filetime = attrs->mtime;
|
||||||
sftp_attributes_free(attrs);
|
sftp_attributes_free(attrs);
|
||||||
}
|
}
|
||||||
@ -1211,12 +1211,12 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
if(data->state.resume_from != 0) {
|
if(data->state.resume_from) {
|
||||||
sftp_attributes attrs;
|
sftp_attributes attrs;
|
||||||
|
|
||||||
if(data->state.resume_from < 0) {
|
if(data->state.resume_from < 0) {
|
||||||
attrs = sftp_stat(sshc->sftp_session, protop->path);
|
attrs = sftp_stat(sshc->sftp_session, protop->path);
|
||||||
if(attrs != 0) {
|
if(attrs) {
|
||||||
curl_off_t size = attrs->size;
|
curl_off_t size = attrs->size;
|
||||||
if(size < 0) {
|
if(size < 0) {
|
||||||
failf(data, "Bad file size (%" CURL_FORMAT_CURL_OFF_T ")", size);
|
failf(data, "Bad file size (%" CURL_FORMAT_CURL_OFF_T ")", size);
|
||||||
@ -1317,7 +1317,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = sftp_seek64(sshc->sftp_file, data->state.resume_from);
|
rc = sftp_seek64(sshc->sftp_file, data->state.resume_from);
|
||||||
if(rc != 0) {
|
if(rc) {
|
||||||
MOVE_TO_SFTP_CLOSE_STATE();
|
MOVE_TO_SFTP_CLOSE_STATE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1433,7 +1433,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
char *tmpLine;
|
char *tmpLine;
|
||||||
|
|
||||||
tmpLine = aprintf("%s\n", sshc->readdir_filename);
|
tmpLine = aprintf("%s\n", sshc->readdir_filename);
|
||||||
if(tmpLine == NULL) {
|
if(!tmpLine) {
|
||||||
state(data, SSH_SFTP_CLOSE);
|
state(data, SSH_SFTP_CLOSE);
|
||||||
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
@ -1472,7 +1472,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
sshc->readdir_linkPath = aprintf("%s%s", protop->path,
|
sshc->readdir_linkPath = aprintf("%s%s", protop->path,
|
||||||
sshc->readdir_filename);
|
sshc->readdir_filename);
|
||||||
|
|
||||||
if(sshc->readdir_linkPath == NULL) {
|
if(!sshc->readdir_linkPath) {
|
||||||
state(data, SSH_SFTP_CLOSE);
|
state(data, SSH_SFTP_CLOSE);
|
||||||
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
@ -1510,10 +1510,10 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sshc->readdir_link_attrs->name == NULL) {
|
if(!sshc->readdir_link_attrs->name) {
|
||||||
sshc->readdir_tmp = sftp_readlink(sshc->sftp_session,
|
sshc->readdir_tmp = sftp_readlink(sshc->sftp_session,
|
||||||
sshc->readdir_linkPath);
|
sshc->readdir_linkPath);
|
||||||
if(sshc->readdir_filename == NULL)
|
if(!sshc->readdir_filename)
|
||||||
sshc->readdir_len = 0;
|
sshc->readdir_len = 0;
|
||||||
else
|
else
|
||||||
sshc->readdir_len = strlen(sshc->readdir_tmp);
|
sshc->readdir_len = strlen(sshc->readdir_tmp);
|
||||||
@ -1679,7 +1679,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = sftp_seek64(sshc->sftp_file, from);
|
rc = sftp_seek64(sshc->sftp_file, from);
|
||||||
if(rc != 0) {
|
if(rc) {
|
||||||
MOVE_TO_SFTP_CLOSE_STATE();
|
MOVE_TO_SFTP_CLOSE_STATE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1718,7 +1718,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
size - data->state.resume_from);
|
size - data->state.resume_from);
|
||||||
|
|
||||||
rc = sftp_seek64(sshc->sftp_file, data->state.resume_from);
|
rc = sftp_seek64(sshc->sftp_file, data->state.resume_from);
|
||||||
if(rc != 0) {
|
if(rc) {
|
||||||
MOVE_TO_SFTP_CLOSE_STATE();
|
MOVE_TO_SFTP_CLOSE_STATE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2187,7 +2187,7 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
|
|||||||
ssh = &conn->proto.sshc;
|
ssh = &conn->proto.sshc;
|
||||||
|
|
||||||
ssh->ssh_session = ssh_new();
|
ssh->ssh_session = ssh_new();
|
||||||
if(ssh->ssh_session == NULL) {
|
if(!ssh->ssh_session) {
|
||||||
failf(data, "Failure initialising ssh session");
|
failf(data, "Failure initialising ssh session");
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
}
|
}
|
||||||
@ -2685,7 +2685,7 @@ static void sftp_quote(struct Curl_easy *data)
|
|||||||
* command with a space so we can check for it unconditionally
|
* command with a space so we can check for it unconditionally
|
||||||
*/
|
*/
|
||||||
cp = strchr(cmd, ' ');
|
cp = strchr(cmd, ' ');
|
||||||
if(cp == NULL) {
|
if(!cp) {
|
||||||
failf(data, "Syntax error in SFTP command. Supply parameter(s)!");
|
failf(data, "Syntax error in SFTP command. Supply parameter(s)!");
|
||||||
state(data, SSH_SFTP_CLOSE);
|
state(data, SSH_SFTP_CLOSE);
|
||||||
sshc->nextstate = SSH_NO_STATE;
|
sshc->nextstate = SSH_NO_STATE;
|
||||||
@ -2834,7 +2834,7 @@ static void sftp_quote_stat(struct Curl_easy *data)
|
|||||||
if(sshc->quote_attrs)
|
if(sshc->quote_attrs)
|
||||||
sftp_attributes_free(sshc->quote_attrs);
|
sftp_attributes_free(sshc->quote_attrs);
|
||||||
sshc->quote_attrs = sftp_stat(sshc->sftp_session, sshc->quote_path2);
|
sshc->quote_attrs = sftp_stat(sshc->sftp_session, sshc->quote_path2);
|
||||||
if(sshc->quote_attrs == NULL) {
|
if(!sshc->quote_attrs) {
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
failf(data, "Attempt to get SFTP stats failed: %d",
|
failf(data, "Attempt to get SFTP stats failed: %d",
|
||||||
|
@ -956,7 +956,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
out_of_memory = TRUE;
|
out_of_memory = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(out_of_memory || sshc->rsa == NULL) {
|
if(out_of_memory || !sshc->rsa) {
|
||||||
Curl_safefree(sshc->rsa);
|
Curl_safefree(sshc->rsa);
|
||||||
Curl_safefree(sshc->rsa_pub);
|
Curl_safefree(sshc->rsa_pub);
|
||||||
state(data, SSH_SESSION_FREE);
|
state(data, SSH_SESSION_FREE);
|
||||||
@ -1359,7 +1359,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
* command with a space so we can check for it unconditionally
|
* command with a space so we can check for it unconditionally
|
||||||
*/
|
*/
|
||||||
cp = strchr(cmd, ' ');
|
cp = strchr(cmd, ' ');
|
||||||
if(cp == NULL) {
|
if(!cp) {
|
||||||
failf(data, "Syntax error command '%s'. Missing parameter!",
|
failf(data, "Syntax error command '%s'. Missing parameter!",
|
||||||
cmd);
|
cmd);
|
||||||
state(data, SSH_SFTP_CLOSE);
|
state(data, SSH_SFTP_CLOSE);
|
||||||
@ -1534,7 +1534,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
|
if(rc && !sshc->acceptfail) { /* get those attributes */
|
||||||
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
@ -1633,7 +1633,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
@ -1656,7 +1656,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
@ -1677,7 +1677,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
failf(data, "mkdir command failed: %s",
|
failf(data, "mkdir command failed: %s",
|
||||||
@ -1702,7 +1702,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
Curl_safefree(sshc->quote_path2);
|
Curl_safefree(sshc->quote_path2);
|
||||||
@ -1722,7 +1722,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
failf(data, "rmdir command failed: %s",
|
failf(data, "rmdir command failed: %s",
|
||||||
@ -1741,7 +1741,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
failf(data, "rm command failed: %s", sftp_libssh2_strerror(sftperr));
|
failf(data, "rm command failed: %s", sftp_libssh2_strerror(sftperr));
|
||||||
@ -1764,7 +1764,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
if(rc == LIBSSH2_ERROR_EAGAIN) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(rc != 0 && !sshc->acceptfail) {
|
if(rc && !sshc->acceptfail) {
|
||||||
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
|
||||||
Curl_safefree(sshc->quote_path1);
|
Curl_safefree(sshc->quote_path1);
|
||||||
failf(data, "statvfs command failed: %s",
|
failf(data, "statvfs command failed: %s",
|
||||||
@ -1857,7 +1857,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
* same name as the last directory in the path.
|
* same name as the last directory in the path.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(data->state.resume_from != 0) {
|
if(data->state.resume_from) {
|
||||||
LIBSSH2_SFTP_ATTRIBUTES attrs;
|
LIBSSH2_SFTP_ATTRIBUTES attrs;
|
||||||
if(data->state.resume_from < 0) {
|
if(data->state.resume_from < 0) {
|
||||||
rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshp->path,
|
rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshp->path,
|
||||||
@ -3084,7 +3084,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
|
|||||||
sshc->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,
|
sshc->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,
|
||||||
my_libssh2_free,
|
my_libssh2_free,
|
||||||
my_libssh2_realloc, data);
|
my_libssh2_realloc, data);
|
||||||
if(sshc->ssh_session == NULL) {
|
if(!sshc->ssh_session) {
|
||||||
failf(data, "Failure initialising ssh session");
|
failf(data, "Failure initialising ssh session");
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ static CURLcode wssh_connect(struct Curl_easy *data, bool *done)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sshc->ssh_session = wolfSSH_new(sshc->ctx);
|
sshc->ssh_session = wolfSSH_new(sshc->ctx);
|
||||||
if(sshc->ssh_session == NULL) {
|
if(!sshc->ssh_session) {
|
||||||
failf(data, "No wolfSSH session");
|
failf(data, "No wolfSSH session");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -861,7 +861,7 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
char *line = aprintf("%s\n",
|
char *line = aprintf("%s\n",
|
||||||
data->set.list_only ?
|
data->set.list_only ?
|
||||||
name->fName : name->lName);
|
name->fName : name->lName);
|
||||||
if(line == NULL) {
|
if(!line) {
|
||||||
state(data, SSH_SFTP_CLOSE);
|
state(data, SSH_SFTP_CLOSE);
|
||||||
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
|
@ -263,7 +263,7 @@ static CURLcode handshake(struct Curl_easy *data,
|
|||||||
strerr = gnutls_alert_get_name(alert);
|
strerr = gnutls_alert_get_name(alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strerr == NULL)
|
if(!strerr)
|
||||||
strerr = gnutls_strerror(rc);
|
strerr = gnutls_strerror(rc);
|
||||||
|
|
||||||
infof(data, "gnutls_handshake() warning: %s\n", strerr);
|
infof(data, "gnutls_handshake() warning: %s\n", strerr);
|
||||||
@ -277,7 +277,7 @@ static CURLcode handshake(struct Curl_easy *data,
|
|||||||
strerr = gnutls_alert_get_name(alert);
|
strerr = gnutls_alert_get_name(alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strerr == NULL)
|
if(!strerr)
|
||||||
strerr = gnutls_strerror(rc);
|
strerr = gnutls_strerror(rc);
|
||||||
|
|
||||||
failf(data, "gnutls_handshake() failed: %s", strerr);
|
failf(data, "gnutls_handshake() failed: %s", strerr);
|
||||||
|
@ -405,7 +405,7 @@ static int is_file(const char *filename)
|
|||||||
{
|
{
|
||||||
struct_stat st;
|
struct_stat st;
|
||||||
|
|
||||||
if(filename == NULL)
|
if(!filename)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(stat(filename, &st) == 0)
|
if(stat(filename, &st) == 0)
|
||||||
@ -1448,7 +1448,7 @@ static CURLcode nss_setup(struct Curl_easy *data)
|
|||||||
static int nss_init(void)
|
static int nss_init(void)
|
||||||
{
|
{
|
||||||
/* curl_global_init() is not thread-safe so this test is ok */
|
/* curl_global_init() is not thread-safe so this test is ok */
|
||||||
if(nss_initlock == NULL) {
|
if(!nss_initlock) {
|
||||||
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
|
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
|
||||||
nss_initlock = PR_NewLock();
|
nss_initlock = PR_NewLock();
|
||||||
nss_crllock = PR_NewLock();
|
nss_crllock = PR_NewLock();
|
||||||
|
@ -619,7 +619,7 @@ SSL_CTX_use_certificate_blob(SSL_CTX *ctx, const struct curl_blob *blob,
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(x == NULL) {
|
if(!x) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -650,7 +650,7 @@ SSL_CTX_use_PrivateKey_blob(SSL_CTX *ctx, const struct curl_blob *blob,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if(pkey == NULL) {
|
if(!pkey) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -681,7 +681,7 @@ SSL_CTX_use_certificate_chain_blob(SSL_CTX *ctx, const struct curl_blob *blob,
|
|||||||
x = PEM_read_bio_X509_AUX(in, NULL,
|
x = PEM_read_bio_X509_AUX(in, NULL,
|
||||||
passwd_callback, (void *)key_passwd);
|
passwd_callback, (void *)key_passwd);
|
||||||
|
|
||||||
if(x == NULL) {
|
if(!x) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -869,7 +869,7 @@ int cert_stuff(struct Curl_easy *data,
|
|||||||
STACK_OF(X509) *ca = NULL;
|
STACK_OF(X509) *ca = NULL;
|
||||||
if(cert_blob) {
|
if(cert_blob) {
|
||||||
cert_bio = BIO_new_mem_buf(cert_blob->data, (int)(cert_blob->len));
|
cert_bio = BIO_new_mem_buf(cert_blob->data, (int)(cert_blob->len));
|
||||||
if(cert_bio == NULL) {
|
if(!cert_bio) {
|
||||||
failf(data,
|
failf(data,
|
||||||
"BIO_new_mem_buf NULL, " OSSL_PACKAGE
|
"BIO_new_mem_buf NULL, " OSSL_PACKAGE
|
||||||
" error %s",
|
" error %s",
|
||||||
@ -880,7 +880,7 @@ int cert_stuff(struct Curl_easy *data,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cert_bio = BIO_new(BIO_s_file());
|
cert_bio = BIO_new(BIO_s_file());
|
||||||
if(cert_bio == NULL) {
|
if(!cert_bio) {
|
||||||
failf(data,
|
failf(data,
|
||||||
"BIO_new return NULL, " OSSL_PACKAGE
|
"BIO_new return NULL, " OSSL_PACKAGE
|
||||||
" error %s",
|
" error %s",
|
||||||
@ -3346,7 +3346,7 @@ static CURLcode ossl_connect_step2(struct Curl_easy *data,
|
|||||||
const unsigned char *neg_protocol;
|
const unsigned char *neg_protocol;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
SSL_get0_alpn_selected(backend->handle, &neg_protocol, &len);
|
SSL_get0_alpn_selected(backend->handle, &neg_protocol, &len);
|
||||||
if(len != 0) {
|
if(len) {
|
||||||
infof(data, "ALPN, server accepted to use %.*s\n", len, neg_protocol);
|
infof(data, "ALPN, server accepted to use %.*s\n", len, neg_protocol);
|
||||||
|
|
||||||
#ifdef USE_NGHTTP2
|
#ifdef USE_NGHTTP2
|
||||||
@ -3838,7 +3838,7 @@ static CURLcode servercert(struct Curl_easy *data,
|
|||||||
(int)SSL_SET_OPTION(issuercert_blob)->len);
|
(int)SSL_SET_OPTION(issuercert_blob)->len);
|
||||||
else {
|
else {
|
||||||
fp = BIO_new(BIO_s_file());
|
fp = BIO_new(BIO_s_file());
|
||||||
if(fp == NULL) {
|
if(!fp) {
|
||||||
failf(data,
|
failf(data,
|
||||||
"BIO_new return NULL, " OSSL_PACKAGE
|
"BIO_new return NULL, " OSSL_PACKAGE
|
||||||
" error %s",
|
" error %s",
|
||||||
|
@ -323,7 +323,7 @@ cr_init_backend(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
int result;
|
int result;
|
||||||
|
|
||||||
backend->tlsbuf = calloc(TLSBUF_SIZE, 1);
|
backend->tlsbuf = calloc(TLSBUF_SIZE, 1);
|
||||||
if(backend->tlsbuf == NULL) {
|
if(!backend->tlsbuf) {
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ get_cert_location(TCHAR *path, DWORD *store_name, TCHAR **store_path,
|
|||||||
size_t store_name_len;
|
size_t store_name_len;
|
||||||
|
|
||||||
sep = _tcschr(path, TEXT('\\'));
|
sep = _tcschr(path, TEXT('\\'));
|
||||||
if(sep == NULL)
|
if(!sep)
|
||||||
return CURLE_SSL_CERTPROBLEM;
|
return CURLE_SSL_CERTPROBLEM;
|
||||||
|
|
||||||
store_name_len = sep - path;
|
store_name_len = sep - path;
|
||||||
@ -388,7 +388,7 @@ get_cert_location(TCHAR *path, DWORD *store_name, TCHAR **store_path,
|
|||||||
store_path_start = sep + 1;
|
store_path_start = sep + 1;
|
||||||
|
|
||||||
sep = _tcschr(store_path_start, TEXT('\\'));
|
sep = _tcschr(store_path_start, TEXT('\\'));
|
||||||
if(sep == NULL)
|
if(!sep)
|
||||||
return CURLE_SSL_CERTPROBLEM;
|
return CURLE_SSL_CERTPROBLEM;
|
||||||
|
|
||||||
*thumbprint = sep + 1;
|
*thumbprint = sep + 1;
|
||||||
@ -398,7 +398,7 @@ get_cert_location(TCHAR *path, DWORD *store_name, TCHAR **store_path,
|
|||||||
*sep = TEXT('\0');
|
*sep = TEXT('\0');
|
||||||
*store_path = _tcsdup(store_path_start);
|
*store_path = _tcsdup(store_path_start);
|
||||||
*sep = TEXT('\\');
|
*sep = TEXT('\\');
|
||||||
if(*store_path == NULL)
|
if(!*store_path)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
@ -698,7 +698,7 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
if(!blob)
|
if(!blob)
|
||||||
free(certdata);
|
free(certdata);
|
||||||
if(cert_store == NULL) {
|
if(!cert_store) {
|
||||||
DWORD errorcode = GetLastError();
|
DWORD errorcode = GetLastError();
|
||||||
if(errorcode == ERROR_INVALID_PASSWORD)
|
if(errorcode == ERROR_INVALID_PASSWORD)
|
||||||
failf(data, "schannel: Failed to import cert file %s, "
|
failf(data, "schannel: Failed to import cert file %s, "
|
||||||
@ -715,7 +715,7 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
cert_store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0,
|
cert_store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0,
|
||||||
CERT_FIND_ANY, NULL, NULL);
|
CERT_FIND_ANY, NULL, NULL);
|
||||||
|
|
||||||
if(client_certs[0] == NULL) {
|
if(!client_certs[0]) {
|
||||||
failf(data, "schannel: Failed to get certificate from file %s"
|
failf(data, "schannel: Failed to get certificate from file %s"
|
||||||
", last error is 0x%x",
|
", last error is 0x%x",
|
||||||
cert_showfilename_error, GetLastError());
|
cert_showfilename_error, GetLastError());
|
||||||
@ -1013,23 +1013,23 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
return CURLE_SSL_CONNECT_ERROR;
|
return CURLE_SSL_CONNECT_ERROR;
|
||||||
|
|
||||||
/* buffer to store previously received and decrypted data */
|
/* buffer to store previously received and decrypted data */
|
||||||
if(BACKEND->decdata_buffer == NULL) {
|
if(!BACKEND->decdata_buffer) {
|
||||||
BACKEND->decdata_offset = 0;
|
BACKEND->decdata_offset = 0;
|
||||||
BACKEND->decdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE;
|
BACKEND->decdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE;
|
||||||
BACKEND->decdata_buffer = malloc(BACKEND->decdata_length);
|
BACKEND->decdata_buffer = malloc(BACKEND->decdata_length);
|
||||||
if(BACKEND->decdata_buffer == NULL) {
|
if(!BACKEND->decdata_buffer) {
|
||||||
failf(data, "schannel: unable to allocate memory");
|
failf(data, "schannel: unable to allocate memory");
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* buffer to store previously received and encrypted data */
|
/* buffer to store previously received and encrypted data */
|
||||||
if(BACKEND->encdata_buffer == NULL) {
|
if(!BACKEND->encdata_buffer) {
|
||||||
BACKEND->encdata_is_incomplete = false;
|
BACKEND->encdata_is_incomplete = false;
|
||||||
BACKEND->encdata_offset = 0;
|
BACKEND->encdata_offset = 0;
|
||||||
BACKEND->encdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE;
|
BACKEND->encdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE;
|
||||||
BACKEND->encdata_buffer = malloc(BACKEND->encdata_length);
|
BACKEND->encdata_buffer = malloc(BACKEND->encdata_length);
|
||||||
if(BACKEND->encdata_buffer == NULL) {
|
if(!BACKEND->encdata_buffer) {
|
||||||
failf(data, "schannel: unable to allocate memory");
|
failf(data, "schannel: unable to allocate memory");
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -1044,7 +1044,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
reallocated_buffer = realloc(BACKEND->encdata_buffer,
|
reallocated_buffer = realloc(BACKEND->encdata_buffer,
|
||||||
reallocated_length);
|
reallocated_length);
|
||||||
|
|
||||||
if(reallocated_buffer == NULL) {
|
if(!reallocated_buffer) {
|
||||||
failf(data, "schannel: unable to re-allocate memory");
|
failf(data, "schannel: unable to re-allocate memory");
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -1099,7 +1099,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
InitSecBuffer(&outbuf[2], SECBUFFER_EMPTY, NULL, 0);
|
InitSecBuffer(&outbuf[2], SECBUFFER_EMPTY, NULL, 0);
|
||||||
InitSecBufferDesc(&outbuf_desc, outbuf, 3);
|
InitSecBufferDesc(&outbuf_desc, outbuf, 3);
|
||||||
|
|
||||||
if(inbuf[0].pvBuffer == NULL) {
|
if(!inbuf[0].pvBuffer) {
|
||||||
failf(data, "schannel: unable to allocate memory");
|
failf(data, "schannel: unable to allocate memory");
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -1451,7 +1451,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
|
|||||||
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
|
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
|
||||||
&ccert_context);
|
&ccert_context);
|
||||||
|
|
||||||
if((sspi_status != SEC_E_OK) || (ccert_context == NULL)) {
|
if((sspi_status != SEC_E_OK) || !ccert_context) {
|
||||||
failf(data, "schannel: failed to retrieve remote cert context");
|
failf(data, "schannel: failed to retrieve remote cert context");
|
||||||
return CURLE_PEER_FAILED_VERIFICATION;
|
return CURLE_PEER_FAILED_VERIFICATION;
|
||||||
}
|
}
|
||||||
@ -1803,7 +1803,7 @@ schannel_recv(struct Curl_easy *data, int sockindex,
|
|||||||
}
|
}
|
||||||
reallocated_buffer = realloc(BACKEND->encdata_buffer,
|
reallocated_buffer = realloc(BACKEND->encdata_buffer,
|
||||||
reallocated_length);
|
reallocated_length);
|
||||||
if(reallocated_buffer == NULL) {
|
if(!reallocated_buffer) {
|
||||||
*err = CURLE_OUT_OF_MEMORY;
|
*err = CURLE_OUT_OF_MEMORY;
|
||||||
failf(data, "schannel: unable to re-allocate memory");
|
failf(data, "schannel: unable to re-allocate memory");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1892,7 +1892,7 @@ schannel_recv(struct Curl_easy *data, int sockindex,
|
|||||||
}
|
}
|
||||||
reallocated_buffer = realloc(BACKEND->decdata_buffer,
|
reallocated_buffer = realloc(BACKEND->decdata_buffer,
|
||||||
reallocated_length);
|
reallocated_length);
|
||||||
if(reallocated_buffer == NULL) {
|
if(!reallocated_buffer) {
|
||||||
*err = CURLE_OUT_OF_MEMORY;
|
*err = CURLE_OUT_OF_MEMORY;
|
||||||
failf(data, "schannel: unable to re-allocate memory");
|
failf(data, "schannel: unable to re-allocate memory");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2294,7 +2294,7 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
|
|||||||
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
|
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
|
||||||
&pCertContextServer);
|
&pCertContextServer);
|
||||||
|
|
||||||
if((sspi_status != SEC_E_OK) || (pCertContextServer == NULL)) {
|
if((sspi_status != SEC_E_OK) || !pCertContextServer) {
|
||||||
char buffer[STRERROR_LEN];
|
char buffer[STRERROR_LEN];
|
||||||
failf(data, "schannel: Failed to read remote certificate context: %s",
|
failf(data, "schannel: Failed to read remote certificate context: %s",
|
||||||
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
|
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
|
||||||
|
@ -389,7 +389,7 @@ static DWORD cert_get_name_string(struct Curl_easy *data,
|
|||||||
if(entry->dwAltNameChoice != CERT_ALT_NAME_DNS_NAME) {
|
if(entry->dwAltNameChoice != CERT_ALT_NAME_DNS_NAME) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(entry->pwszDNSName == NULL) {
|
if(!entry->pwszDNSName) {
|
||||||
infof(data, "schannel: Empty DNS name.");
|
infof(data, "schannel: Empty DNS name.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -549,7 +549,7 @@ CURLcode Curl_verify_certificate(struct Curl_easy *data,
|
|||||||
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
|
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
|
||||||
&pCertContextServer);
|
&pCertContextServer);
|
||||||
|
|
||||||
if((sspi_status != SEC_E_OK) || (pCertContextServer == NULL)) {
|
if((sspi_status != SEC_E_OK) || !pCertContextServer) {
|
||||||
char buffer[STRERROR_LEN];
|
char buffer[STRERROR_LEN];
|
||||||
failf(data, "schannel: Failed to read remote certificate context: %s",
|
failf(data, "schannel: Failed to read remote certificate context: %s",
|
||||||
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
|
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
|
||||||
|
@ -1324,7 +1324,7 @@ CF_INLINE bool is_file(const char *filename)
|
|||||||
{
|
{
|
||||||
struct_stat st;
|
struct_stat st;
|
||||||
|
|
||||||
if(filename == NULL)
|
if(!filename)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(stat(filename, &st) == 0)
|
if(stat(filename, &st) == 0)
|
||||||
@ -2142,21 +2142,21 @@ static long pem_to_der(const char *in, unsigned char **out, size_t *outlen)
|
|||||||
|
|
||||||
/* Jump through the separators at the beginning of the certificate. */
|
/* Jump through the separators at the beginning of the certificate. */
|
||||||
sep_start = strstr(in, "-----");
|
sep_start = strstr(in, "-----");
|
||||||
if(sep_start == NULL)
|
if(!sep_start)
|
||||||
return 0;
|
return 0;
|
||||||
cert_start = strstr(sep_start + 1, "-----");
|
cert_start = strstr(sep_start + 1, "-----");
|
||||||
if(cert_start == NULL)
|
if(!cert_start)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cert_start += 5;
|
cert_start += 5;
|
||||||
|
|
||||||
/* Find separator after the end of the certificate. */
|
/* Find separator after the end of the certificate. */
|
||||||
cert_end = strstr(cert_start, "-----");
|
cert_end = strstr(cert_start, "-----");
|
||||||
if(cert_end == NULL)
|
if(!cert_end)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
sep_end = strstr(cert_end + 1, "-----");
|
sep_end = strstr(cert_end + 1, "-----");
|
||||||
if(sep_end == NULL)
|
if(!sep_end)
|
||||||
return -1;
|
return -1;
|
||||||
sep_end += 5;
|
sep_end += 5;
|
||||||
|
|
||||||
@ -2293,7 +2293,7 @@ static CURLcode verify_cert(const char *cafile, struct Curl_easy *data,
|
|||||||
*/
|
*/
|
||||||
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0,
|
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0,
|
||||||
&kCFTypeArrayCallBacks);
|
&kCFTypeArrayCallBacks);
|
||||||
if(array == NULL) {
|
if(!array) {
|
||||||
free(certbuf);
|
free(certbuf);
|
||||||
failf(data, "SSL: out of memory creating CA certificate array");
|
failf(data, "SSL: out of memory creating CA certificate array");
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
@ -2343,7 +2343,7 @@ static CURLcode verify_cert(const char *cafile, struct Curl_easy *data,
|
|||||||
|
|
||||||
SecTrustRef trust;
|
SecTrustRef trust;
|
||||||
OSStatus ret = SSLCopyPeerTrust(ctx, &trust);
|
OSStatus ret = SSLCopyPeerTrust(ctx, &trust);
|
||||||
if(trust == NULL) {
|
if(!trust) {
|
||||||
failf(data, "SSL: error getting certificate chain");
|
failf(data, "SSL: error getting certificate chain");
|
||||||
CFRelease(array);
|
CFRelease(array);
|
||||||
return CURLE_PEER_FAILED_VERIFICATION;
|
return CURLE_PEER_FAILED_VERIFICATION;
|
||||||
@ -2416,19 +2416,19 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
|
|||||||
do {
|
do {
|
||||||
SecTrustRef trust;
|
SecTrustRef trust;
|
||||||
OSStatus ret = SSLCopyPeerTrust(ctx, &trust);
|
OSStatus ret = SSLCopyPeerTrust(ctx, &trust);
|
||||||
if(ret != noErr || trust == NULL)
|
if(ret != noErr || !trust)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SecKeyRef keyRef = SecTrustCopyPublicKey(trust);
|
SecKeyRef keyRef = SecTrustCopyPublicKey(trust);
|
||||||
CFRelease(trust);
|
CFRelease(trust);
|
||||||
if(keyRef == NULL)
|
if(!keyRef)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef SECTRANSP_PINNEDPUBKEY_V1
|
#ifdef SECTRANSP_PINNEDPUBKEY_V1
|
||||||
|
|
||||||
publicKeyBits = SecKeyCopyExternalRepresentation(keyRef, NULL);
|
publicKeyBits = SecKeyCopyExternalRepresentation(keyRef, NULL);
|
||||||
CFRelease(keyRef);
|
CFRelease(keyRef);
|
||||||
if(publicKeyBits == NULL)
|
if(!publicKeyBits)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#elif SECTRANSP_PINNEDPUBKEY_V2
|
#elif SECTRANSP_PINNEDPUBKEY_V2
|
||||||
@ -2436,7 +2436,7 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
|
|||||||
OSStatus success = SecItemExport(keyRef, kSecFormatOpenSSL, 0, NULL,
|
OSStatus success = SecItemExport(keyRef, kSecFormatOpenSSL, 0, NULL,
|
||||||
&publicKeyBits);
|
&publicKeyBits);
|
||||||
CFRelease(keyRef);
|
CFRelease(keyRef);
|
||||||
if(success != errSecSuccess || publicKeyBits == NULL)
|
if(success != errSecSuccess || !publicKeyBits)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif /* SECTRANSP_PINNEDPUBKEY_V2 */
|
#endif /* SECTRANSP_PINNEDPUBKEY_V2 */
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -65,7 +65,7 @@ CURLcode convert_to_network(char *buffer, size_t length)
|
|||||||
in_bytes = out_bytes = length;
|
in_bytes = out_bytes = length;
|
||||||
res = iconv(outbound_cd, &input_ptr, &in_bytes,
|
res = iconv(outbound_cd, &input_ptr, &in_bytes,
|
||||||
&output_ptr, &out_bytes);
|
&output_ptr, &out_bytes);
|
||||||
if((res == (size_t)-1) || (in_bytes != 0)) {
|
if((res == (size_t)-1) || (in_bytes)) {
|
||||||
return CURLE_CONV_FAILED;
|
return CURLE_CONV_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ CURLcode convert_from_network(char *buffer, size_t length)
|
|||||||
in_bytes = out_bytes = length;
|
in_bytes = out_bytes = length;
|
||||||
res = iconv(inbound_cd, &input_ptr, &in_bytes,
|
res = iconv(inbound_cd, &input_ptr, &in_bytes,
|
||||||
&output_ptr, &out_bytes);
|
&output_ptr, &out_bytes);
|
||||||
if((res == (size_t)-1) || (in_bytes != 0)) {
|
if((res == (size_t)-1) || (in_bytes)) {
|
||||||
return CURLE_CONV_FAILED;
|
return CURLE_CONV_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ int metalink_check_hash(struct GlobalConfig *config,
|
|||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
fprintf(config->errors, "Metalink: validating (%s)...\n", filename);
|
fprintf(config->errors, "Metalink: validating (%s)...\n", filename);
|
||||||
if(mlfile->checksum == NULL) {
|
if(!mlfile->checksum) {
|
||||||
fprintf(config->errors,
|
fprintf(config->errors,
|
||||||
"Metalink: validating (%s) FAILED (digest missing)\n", filename);
|
"Metalink: validating (%s) FAILED (digest missing)\n", filename);
|
||||||
return -2;
|
return -2;
|
||||||
@ -649,7 +649,7 @@ static struct metalinkfile *new_metalinkfile(metalink_file_t *fileinfo)
|
|||||||
fileinfo->resources point to the target file. BitTorrent
|
fileinfo->resources point to the target file. BitTorrent
|
||||||
metainfo file URL may be appeared in fileinfo->metaurls.
|
metainfo file URL may be appeared in fileinfo->metaurls.
|
||||||
*/
|
*/
|
||||||
if((*p)->type == NULL ||
|
if(!(*p)->type ||
|
||||||
curl_strequal((*p)->type, "http") ||
|
curl_strequal((*p)->type, "http") ||
|
||||||
curl_strequal((*p)->type, "https") ||
|
curl_strequal((*p)->type, "https") ||
|
||||||
curl_strequal((*p)->type, "ftp") ||
|
curl_strequal((*p)->type, "ftp") ||
|
||||||
@ -691,10 +691,10 @@ int parse_metalink(struct OperationConfig *config, struct OutStruct *outs,
|
|||||||
/* metlaink_parse_final deletes outs->metalink_parser */
|
/* metlaink_parse_final deletes outs->metalink_parser */
|
||||||
r = metalink_parse_final(outs->metalink_parser, NULL, 0, &metalink);
|
r = metalink_parse_final(outs->metalink_parser, NULL, 0, &metalink);
|
||||||
outs->metalink_parser = NULL;
|
outs->metalink_parser = NULL;
|
||||||
if(r != 0) {
|
if(r) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(metalink->files == NULL) {
|
if(!metalink->files) {
|
||||||
fprintf(config->global->errors, "Metalink: parsing (%s) WARNING "
|
fprintf(config->global->errors, "Metalink: parsing (%s) WARNING "
|
||||||
"(missing or invalid file name)\n",
|
"(missing or invalid file name)\n",
|
||||||
metalink_url);
|
metalink_url);
|
||||||
@ -824,7 +824,7 @@ static void delete_metalink_checksum(struct metalink_checksum *chksum)
|
|||||||
|
|
||||||
static void delete_metalink_resource(struct metalink_resource *res)
|
static void delete_metalink_resource(struct metalink_resource *res)
|
||||||
{
|
{
|
||||||
if(res == NULL) {
|
if(!res) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Curl_safefree(res->url);
|
Curl_safefree(res->url);
|
||||||
@ -834,7 +834,7 @@ static void delete_metalink_resource(struct metalink_resource *res)
|
|||||||
void delete_metalinkfile(struct metalinkfile *mlfile)
|
void delete_metalinkfile(struct metalinkfile *mlfile)
|
||||||
{
|
{
|
||||||
struct metalink_resource *res;
|
struct metalink_resource *res;
|
||||||
if(mlfile == NULL) {
|
if(!mlfile) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Curl_safefree(mlfile->filename);
|
Curl_safefree(mlfile->filename);
|
||||||
|
@ -167,14 +167,14 @@ static curl_off_t vms_realfilesize(const char *name,
|
|||||||
|
|
||||||
/* !checksrc! disable FOPENMODE 1 */
|
/* !checksrc! disable FOPENMODE 1 */
|
||||||
file = fopen(name, "r"); /* VMS */
|
file = fopen(name, "r"); /* VMS */
|
||||||
if(file == NULL) {
|
if(!file) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
count = 0;
|
count = 0;
|
||||||
ret_stat = 1;
|
ret_stat = 1;
|
||||||
while(ret_stat > 0) {
|
while(ret_stat > 0) {
|
||||||
ret_stat = fread(buffer, 1, sizeof(buffer), file);
|
ret_stat = fread(buffer, 1, sizeof(buffer), file);
|
||||||
if(ret_stat != 0)
|
if(ret_stat)
|
||||||
count += ret_stat;
|
count += ret_stat;
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
@ -764,7 +764,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
|||||||
urlnode = config->state.urlnode;
|
urlnode = config->state.urlnode;
|
||||||
if(urlnode->flags & GETOUT_METALINK) {
|
if(urlnode->flags & GETOUT_METALINK) {
|
||||||
metalink = 1;
|
metalink = 1;
|
||||||
if(mlfile_last == NULL) {
|
if(!mlfile_last) {
|
||||||
mlfile_last = config->metalinkfile_list;
|
mlfile_last = config->metalinkfile_list;
|
||||||
}
|
}
|
||||||
mlfile = mlfile_last;
|
mlfile = mlfile_last;
|
||||||
@ -1979,7 +1979,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
|||||||
/* curl 7.17.1 */
|
/* curl 7.17.1 */
|
||||||
if(!config->nokeepalive) {
|
if(!config->nokeepalive) {
|
||||||
my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
|
my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
|
||||||
if(config->alivetime != 0) {
|
if(config->alivetime) {
|
||||||
my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);
|
my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);
|
||||||
my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);
|
my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);
|
||||||
}
|
}
|
||||||
@ -2128,7 +2128,7 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
|||||||
#ifdef USE_METALINK
|
#ifdef USE_METALINK
|
||||||
if(!metalink && config->use_metalink) {
|
if(!metalink && config->use_metalink) {
|
||||||
outs->metalink_parser = metalink_parser_context_new();
|
outs->metalink_parser = metalink_parser_context_new();
|
||||||
if(outs->metalink_parser == NULL) {
|
if(!outs->metalink_parser) {
|
||||||
result = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ int is_vms_shell(void)
|
|||||||
shell = getenv("SHELL");
|
shell = getenv("SHELL");
|
||||||
|
|
||||||
/* No shell, means DCL */
|
/* No shell, means DCL */
|
||||||
if(shell == NULL) {
|
if(!shell) {
|
||||||
vms_shell = 1;
|
vms_shell = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -58,7 +58,7 @@ int test(char *URL)
|
|||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
|
|
||||||
curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
|
curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
|
||||||
if(unmet != 0L) {
|
if(unmet) {
|
||||||
res = TEST_ERR_FAILURE; /* not correct */
|
res = TEST_ERR_FAILURE; /* not correct */
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -66,7 +66,7 @@ int test(char *URL)
|
|||||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
if(httpcode != 0) {
|
if(httpcode) {
|
||||||
fprintf(stderr, "%s:%d curl_easy_reset failed to zero the response code\n"
|
fprintf(stderr, "%s:%d curl_easy_reset failed to zero the response code\n"
|
||||||
"possible regression of github bug 1017\n", __FILE__, __LINE__);
|
"possible regression of github bug 1017\n", __FILE__, __LINE__);
|
||||||
res = CURLE_HTTP_RETURNED_ERROR;
|
res = CURLE_HTTP_RETURNED_ERROR;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -137,7 +137,7 @@ int test(char *URL)
|
|||||||
}
|
}
|
||||||
|
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
if(curl == NULL) {
|
if(!curl) {
|
||||||
fprintf(stderr, "curl_easy_init() failed\n");
|
fprintf(stderr, "curl_easy_init() failed\n");
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -44,7 +44,7 @@ int test(char *URL)
|
|||||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
if(protocol != 0) {
|
if(protocol) {
|
||||||
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
|
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
|
||||||
__FILE__, __LINE__, protocol);
|
__FILE__, __LINE__, protocol);
|
||||||
res = CURLE_FAILED_INIT;
|
res = CURLE_FAILED_INIT;
|
||||||
@ -94,7 +94,7 @@ int test(char *URL)
|
|||||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
if(protocol != 0) {
|
if(protocol) {
|
||||||
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
|
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
|
||||||
__FILE__, __LINE__, protocol);
|
__FILE__, __LINE__, protocol);
|
||||||
res = CURLE_FAILED_INIT;
|
res = CURLE_FAILED_INIT;
|
||||||
@ -113,7 +113,7 @@ int test(char *URL)
|
|||||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
if(protocol != 0) {
|
if(protocol) {
|
||||||
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
|
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
|
||||||
__FILE__, __LINE__, protocol);
|
__FILE__, __LINE__, protocol);
|
||||||
res = CURLE_FAILED_INIT;
|
res = CURLE_FAILED_INIT;
|
||||||
|
@ -69,7 +69,7 @@ int test(char *URL)
|
|||||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
if(scheme == NULL || memcmp(scheme, "HTTP", 5) != 0) {
|
if(!scheme || memcmp(scheme, "HTTP", 5) != 0) {
|
||||||
fprintf(stderr, "%s:%d scheme of http resource is incorrect; "
|
fprintf(stderr, "%s:%d scheme of http resource is incorrect; "
|
||||||
"expected 'HTTP' but is %s\n",
|
"expected 'HTTP' but is %s\n",
|
||||||
__FILE__, __LINE__,
|
__FILE__, __LINE__,
|
||||||
@ -95,7 +95,7 @@ int test(char *URL)
|
|||||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
if(scheme != 0) {
|
if(scheme) {
|
||||||
fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
|
fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
|
||||||
__FILE__, __LINE__);
|
__FILE__, __LINE__);
|
||||||
res = CURLE_FAILED_INIT;
|
res = CURLE_FAILED_INIT;
|
||||||
@ -114,7 +114,7 @@ int test(char *URL)
|
|||||||
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
__FILE__, __LINE__, res, curl_easy_strerror(res));
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
}
|
}
|
||||||
if(scheme != 0) {
|
if(scheme) {
|
||||||
fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
|
fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
|
||||||
__FILE__, __LINE__);
|
__FILE__, __LINE__);
|
||||||
res = CURLE_FAILED_INIT;
|
res = CURLE_FAILED_INIT;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -80,7 +80,7 @@ int test(char *URL)
|
|||||||
}
|
}
|
||||||
|
|
||||||
slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
|
slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
|
||||||
if(slist == NULL) {
|
if(!slist) {
|
||||||
fprintf(stderr, "curl_slist_append() failed\n");
|
fprintf(stderr, "curl_slist_append() failed\n");
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -83,7 +83,7 @@ static int fopen_works(void)
|
|||||||
}
|
}
|
||||||
for(i = 0; i < 3; i++) {
|
for(i = 0; i < 3; i++) {
|
||||||
fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
|
fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
|
||||||
if(fpa[i] == NULL) {
|
if(!fpa[i]) {
|
||||||
store_errmsg("fopen failed", errno);
|
store_errmsg("fopen failed", errno);
|
||||||
fprintf(stderr, "%s\n", msgbuff);
|
fprintf(stderr, "%s\n", msgbuff);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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,7 +84,7 @@ static int fopen_works(void)
|
|||||||
}
|
}
|
||||||
for(i = 0; i < 3; i++) {
|
for(i = 0; i < 3; i++) {
|
||||||
fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
|
fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
|
||||||
if(fpa[i] == NULL) {
|
if(!fpa[i]) {
|
||||||
store_errmsg("fopen failed", errno);
|
store_errmsg("fopen failed", errno);
|
||||||
fprintf(stderr, "%s\n", msgbuff);
|
fprintf(stderr, "%s\n", msgbuff);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -60,14 +60,14 @@ int test(char *URL)
|
|||||||
* call to freedirs).
|
* call to freedirs).
|
||||||
*/
|
*/
|
||||||
newURL = aprintf("%s./", URL);
|
newURL = aprintf("%s./", URL);
|
||||||
if(newURL == NULL) {
|
if(!newURL) {
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
slist = curl_slist_append(NULL, "SYST");
|
slist = curl_slist_append(NULL, "SYST");
|
||||||
if(slist == NULL) {
|
if(!slist) {
|
||||||
free(newURL);
|
free(newURL);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
@ -92,10 +92,10 @@ int test(char *URL)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while((res == CURLE_OK && iolen != 0) || (res == CURLE_AGAIN));
|
} while((res == CURLE_OK && iolen) || (res == CURLE_AGAIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iolen != 0)
|
if(iolen)
|
||||||
res = (CURLcode)TEST_ERR_FAILURE;
|
res = (CURLcode)TEST_ERR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -81,7 +81,7 @@ int test(char *URL)
|
|||||||
close(sdp);
|
close(sdp);
|
||||||
|
|
||||||
sdpf = fopen("log/file568.txt", "rb");
|
sdpf = fopen("log/file568.txt", "rb");
|
||||||
if(sdpf == NULL) {
|
if(!sdpf) {
|
||||||
fprintf(stderr, "can't open log/file568.txt\n");
|
fprintf(stderr, "can't open log/file568.txt\n");
|
||||||
res = TEST_ERR_MAJOR_BAD;
|
res = TEST_ERR_MAJOR_BAD;
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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,7 +41,7 @@ int test(char *URL)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
FILE *idfile = fopen(libtest_arg2, "wb");
|
FILE *idfile = fopen(libtest_arg2, "wb");
|
||||||
if(idfile == NULL) {
|
if(!idfile) {
|
||||||
fprintf(stderr, "couldn't open the Session ID File\n");
|
fprintf(stderr, "couldn't open the Session ID File\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -106,7 +106,7 @@ int test(char *URL)
|
|||||||
int request = 1;
|
int request = 1;
|
||||||
|
|
||||||
FILE *protofile = fopen(libtest_arg2, "wb");
|
FILE *protofile = fopen(libtest_arg2, "wb");
|
||||||
if(protofile == NULL) {
|
if(!protofile) {
|
||||||
fprintf(stderr, "Couldn't open the protocol dump file\n");
|
fprintf(stderr, "Couldn't open the protocol dump file\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -100,7 +100,7 @@ int test(char *URL)
|
|||||||
close(params);
|
close(params);
|
||||||
|
|
||||||
paramsf = fopen("log/file572.txt", "rb");
|
paramsf = fopen("log/file572.txt", "rb");
|
||||||
if(paramsf == NULL) {
|
if(!paramsf) {
|
||||||
fprintf(stderr, "can't open log/file572.txt\n");
|
fprintf(stderr, "can't open log/file572.txt\n");
|
||||||
res = TEST_ERR_MAJOR_BAD;
|
res = TEST_ERR_MAJOR_BAD;
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -104,7 +104,7 @@ int test(char *URL)
|
|||||||
}
|
}
|
||||||
|
|
||||||
slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
|
slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
|
||||||
if(slist == NULL) {
|
if(!slist) {
|
||||||
fprintf(stderr, "curl_slist_append() failed\n");
|
fprintf(stderr, "curl_slist_append() failed\n");
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -97,7 +97,7 @@ int test(char *URL)
|
|||||||
}
|
}
|
||||||
|
|
||||||
slist = curl_slist_append(NULL, "SYST");
|
slist = curl_slist_append(NULL, "SYST");
|
||||||
if(slist == NULL) {
|
if(!slist) {
|
||||||
fprintf(stderr, "curl_slist_append() failed\n");
|
fprintf(stderr, "curl_slist_append() failed\n");
|
||||||
res = TEST_ERR_MAJOR_BAD;
|
res = TEST_ERR_MAJOR_BAD;
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
|
@ -369,7 +369,7 @@ static int ProcessRequest(struct httprequest *req)
|
|||||||
memcpy(rtp_scratch + 4 + i, RTP_DATA, RTP_DATA_SIZE);
|
memcpy(rtp_scratch + 4 + i, RTP_DATA, RTP_DATA_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(req->rtp_buffer == NULL) {
|
if(!req->rtp_buffer) {
|
||||||
req->rtp_buffer = rtp_scratch;
|
req->rtp_buffer = rtp_scratch;
|
||||||
req->rtp_buffersize = rtp_size + 4;
|
req->rtp_buffersize = rtp_size + 4;
|
||||||
}
|
}
|
||||||
@ -599,15 +599,15 @@ static void storerequest(char *reqbuf, size_t totalsize)
|
|||||||
size_t writeleft;
|
size_t writeleft;
|
||||||
FILE *dump;
|
FILE *dump;
|
||||||
|
|
||||||
if(reqbuf == NULL)
|
if(!reqbuf)
|
||||||
return;
|
return;
|
||||||
if(totalsize == 0)
|
if(totalsize == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dump = fopen(REQUEST_DUMP, "ab");
|
dump = fopen(REQUEST_DUMP, "ab");
|
||||||
} while((dump == NULL) && ((error = errno) == EINTR));
|
} while(!dump && ((error = errno) == EINTR));
|
||||||
if(dump == NULL) {
|
if(!dump) {
|
||||||
logmsg("Error opening file %s error: %d %s",
|
logmsg("Error opening file %s error: %d %s",
|
||||||
REQUEST_DUMP, error, strerror(error));
|
REQUEST_DUMP, error, strerror(error));
|
||||||
logmsg("Failed to write request input to " REQUEST_DUMP);
|
logmsg("Failed to write request input to " REQUEST_DUMP);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -668,7 +668,7 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
|
|||||||
|
|
||||||
/* allocate internal array for the internal data */
|
/* allocate internal array for the internal data */
|
||||||
data = calloc(nfds, sizeof(struct select_ws_data));
|
data = calloc(nfds, sizeof(struct select_ws_data));
|
||||||
if(data == NULL) {
|
if(!data) {
|
||||||
CloseHandle(abort);
|
CloseHandle(abort);
|
||||||
CloseHandle(mutex);
|
CloseHandle(mutex);
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
@ -677,7 +677,7 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds,
|
|||||||
|
|
||||||
/* allocate internal array for the internal event handles */
|
/* allocate internal array for the internal event handles */
|
||||||
handles = calloc(nfds + 1, sizeof(HANDLE));
|
handles = calloc(nfds + 1, sizeof(HANDLE));
|
||||||
if(handles == NULL) {
|
if(!handles) {
|
||||||
CloseHandle(abort);
|
CloseHandle(abort);
|
||||||
CloseHandle(mutex);
|
CloseHandle(mutex);
|
||||||
free(data);
|
free(data);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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
|
||||||
@ -479,7 +479,7 @@ static curl_socket_t sockit(curl_socket_t fd)
|
|||||||
return CURL_SOCKET_BAD;
|
return CURL_SOCKET_BAD;
|
||||||
}
|
}
|
||||||
/* reserved, should be zero */
|
/* reserved, should be zero */
|
||||||
if(buffer[SOCKS5_RESERVED] != 0) {
|
if(buffer[SOCKS5_RESERVED]) {
|
||||||
logmsg("Request COMMAND byte not %d", config.reqcmd);
|
logmsg("Request COMMAND byte not %d", config.reqcmd);
|
||||||
return CURL_SOCKET_BAD;
|
return CURL_SOCKET_BAD;
|
||||||
}
|
}
|
||||||
|
@ -792,15 +792,15 @@ static void storerequest(const char *reqbuf, size_t totalsize)
|
|||||||
FILE *dump;
|
FILE *dump;
|
||||||
const char *dumpfile = is_proxy?REQUEST_PROXY_DUMP:REQUEST_DUMP;
|
const char *dumpfile = is_proxy?REQUEST_PROXY_DUMP:REQUEST_DUMP;
|
||||||
|
|
||||||
if(reqbuf == NULL)
|
if(!reqbuf)
|
||||||
return;
|
return;
|
||||||
if(totalsize == 0)
|
if(totalsize == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dump = fopen(dumpfile, "ab");
|
dump = fopen(dumpfile, "ab");
|
||||||
} while((dump == NULL) && ((error = errno) == EINTR));
|
} while(!dump && ((error = errno) == EINTR));
|
||||||
if(dump == NULL) {
|
if(!dump) {
|
||||||
logmsg("[2] Error opening file %s error: %d %s",
|
logmsg("[2] Error opening file %s error: %d %s",
|
||||||
dumpfile, error, strerror(error));
|
dumpfile, error, strerror(error));
|
||||||
logmsg("Failed to write request input ");
|
logmsg("Failed to write request input ");
|
||||||
@ -2313,7 +2313,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the request, unless we're still in the middle of reading */
|
/* Reset the request, unless we're still in the middle of reading */
|
||||||
if(rc != 0)
|
if(rc)
|
||||||
init_httprequest(&req);
|
init_httprequest(&req);
|
||||||
} while(rc > 0);
|
} while(rc > 0);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ void win32_init(void)
|
|||||||
wVersionRequested = MAKEWORD(2, 2);
|
wVersionRequested = MAKEWORD(2, 2);
|
||||||
err = WSAStartup(wVersionRequested, &wsaData);
|
err = WSAStartup(wVersionRequested, &wsaData);
|
||||||
|
|
||||||
if(err != 0) {
|
if(err) {
|
||||||
perror("Winsock init failed");
|
perror("Winsock init failed");
|
||||||
logmsg("Error initialising winsock -- aborting");
|
logmsg("Error initialising winsock -- aborting");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -317,8 +317,8 @@ void set_advisor_read_lock(const char *filename)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
lockfile = fopen(filename, "wb");
|
lockfile = fopen(filename, "wb");
|
||||||
} while((lockfile == NULL) && ((error = errno) == EINTR));
|
} while(!lockfile && ((error = errno) == EINTR));
|
||||||
if(lockfile == NULL) {
|
if(!lockfile) {
|
||||||
logmsg("Error creating lock file %s error: %d %s",
|
logmsg("Error creating lock file %s error: %d %s",
|
||||||
filename, error, strerror(error));
|
filename, error, strerror(error));
|
||||||
return;
|
return;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, 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,7 +40,7 @@ static void splayprint(struct Curl_tree *t, int d, char output)
|
|||||||
struct Curl_tree *node;
|
struct Curl_tree *node;
|
||||||
int i;
|
int i;
|
||||||
int count;
|
int count;
|
||||||
if(t == NULL)
|
if(!t)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
splayprint(t->larger, d + 1, output);
|
splayprint(t->larger, d + 1, output);
|
||||||
|
@ -194,7 +194,7 @@ UNITTEST_START
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dns->timestamp != 0 && tests[i].permanent) {
|
if(dns->timestamp && tests[i].permanent) {
|
||||||
fprintf(stderr, "%s:%d tests[%d] failed. the timestamp is not zero "
|
fprintf(stderr, "%s:%d tests[%d] failed. the timestamp is not zero "
|
||||||
"but tests[%d].permanent is TRUE\n",
|
"but tests[%d].permanent is TRUE\n",
|
||||||
__FILE__, __LINE__, i, i);
|
__FILE__, __LINE__, i, i);
|
||||||
|
Loading…
Reference in New Issue
Block a user