diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/cookie.c | 5 | ||||
-rw-r--r-- | lib/curl_sasl.c | 3 | ||||
-rw-r--r-- | lib/curlx.h | 10 | ||||
-rw-r--r-- | lib/dict.c | 1 | ||||
-rw-r--r-- | lib/easy.c | 1 | ||||
-rw-r--r-- | lib/formdata.c | 12 | ||||
-rw-r--r-- | lib/ftp.c | 6 | ||||
-rw-r--r-- | lib/gopher.c | 1 | ||||
-rw-r--r-- | lib/http.c | 1 | ||||
-rw-r--r-- | lib/if2ip.c | 8 | ||||
-rw-r--r-- | lib/imap.c | 5 | ||||
-rw-r--r-- | lib/netrc.c | 2 | ||||
-rw-r--r-- | lib/pop3.c | 7 | ||||
-rw-r--r-- | lib/smtp.c | 5 | ||||
-rw-r--r-- | lib/socks.c | 1 | ||||
-rw-r--r-- | lib/ssh.c | 2 | ||||
-rw-r--r-- | lib/strcase.c (renamed from lib/strequal.c) | 8 | ||||
-rw-r--r-- | lib/strcase.h (renamed from lib/strequal.h) | 15 | ||||
-rw-r--r-- | lib/telnet.c | 1 | ||||
-rw-r--r-- | lib/transfer.c | 2 | ||||
-rw-r--r-- | lib/url.c | 7 | ||||
-rw-r--r-- | lib/vauth/cleartext.c | 1 | ||||
-rw-r--r-- | lib/vtls/openssl.c | 1 | ||||
-rw-r--r-- | lib/x509asn1.c | 10 |
25 files changed, 53 insertions, 66 deletions
diff --git a/lib/Makefile.inc b/lib/Makefile.inc index 0ed998c13..5b1540928 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -40,7 +40,7 @@ LIB_VTLS_HFILES = vtls/openssl.h vtls/vtls.h vtls/gtls.h \ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \ ldap.c version.c getenv.c escape.c mprintf.c telnet.c netrc.c \ - getinfo.c transfer.c strequal.c easy.c security.c curl_fnmatch.c \ + getinfo.c transfer.c strcase.c easy.c security.c curl_fnmatch.c \ fileinfo.c ftplistparser.c wildcard.c krb5.c memdebug.c http_chunks.c \ strtok.c connect.c llist.c hash.c multi.c content_encoding.c share.c \ http_digest.c md4.c md5.c http_negotiate.c inet_pton.c strtoofft.c \ @@ -58,7 +58,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \ formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \ speedcheck.h urldata.h curl_ldap.h escape.h telnet.h getinfo.h \ - strequal.h curl_sec.h memdebug.h http_chunks.h curl_fnmatch.h \ + strcase.h curl_sec.h memdebug.h http_chunks.h curl_fnmatch.h \ wildcard.h fileinfo.h ftplistparser.h strtok.h connect.h llist.h \ hash.h content_encoding.h share.h curl_md4.h curl_md5.h http_digest.h \ http_negotiate.h inet_pton.h amigaos.h strtoofft.h strerror.h \ diff --git a/lib/cookie.c b/lib/cookie.c index 8607ce3e7..317468274 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -90,7 +90,6 @@ Example set of cookies: #include "urldata.h" #include "cookie.h" -#include "strequal.h" #include "strtok.h" #include "sendf.h" #include "slist.h" @@ -939,7 +938,7 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data, } c->running = FALSE; /* this is not running, this is init */ - if(file && strequal(file, "-")) { + if(file && !strcmp(file, "-")) { fp = stdin; fromfile=FALSE; } @@ -1310,7 +1309,7 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere) /* at first, remove expired cookies */ remove_expired(c); - if(strequal("-", dumphere)) { + if(!strcmp("-", dumphere)) { /* use stdout */ out = stdout; use_stdout=TRUE; diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index 65fa52932..f329c0ded 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -42,7 +42,6 @@ #include "curl_sasl.h" #include "warnless.h" #include "strtok.h" -#include "strequal.h" #include "rawstr.h" #include "sendf.h" #include "non-ascii.h" /* included for Curl_convert_... prototypes */ @@ -159,7 +158,7 @@ CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl, sasl->prefmech = SASL_AUTH_NONE; } - if(strnequal(value, "*", len)) + if(!strncmp(value, "*", len)) sasl->prefmech = SASL_AUTH_DEFAULT; else { mechbit = Curl_sasl_decode_mech(value, len, &mechlen); diff --git a/lib/curlx.h b/lib/curlx.h index 448a34ff3..521350e5d 100644 --- a/lib/curlx.h +++ b/lib/curlx.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -34,8 +34,8 @@ functions while they still are offered publicly. They will be made library- private one day */ -#include "strequal.h" -/* "strequal.h" provides the strequal protos */ +#include "strcase.h" +/* "strcase.h" provides the strcasecompare protos */ #include "strtoofft.h" /* "strtoofft.h" provides this function: curlx_strtoofft(), returns a @@ -73,8 +73,8 @@ */ #define curlx_getenv curl_getenv -#define curlx_strequal curl_strequal -#define curlx_strnequal curl_strnequal +#define curlx_strcasecompare curl_strcasecompare +#define curlx_strncasecompare curl_strncasecompare #define curlx_raw_equal Curl_raw_equal #define curlx_mvsnprintf curl_mvsnprintf #define curlx_msnprintf curl_msnprintf diff --git a/lib/dict.c b/lib/dict.c index 48a4e0a81..9dd76e738 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -54,7 +54,6 @@ #include "sendf.h" #include "escape.h" #include "progress.h" -#include "strequal.h" #include "dict.h" #include "rawstr.h" #include "curl_memory.h" diff --git a/lib/easy.c b/lib/easy.c index cb0ac6740..eee1061e8 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -50,7 +50,6 @@ #include <sys/param.h> #endif -#include "strequal.h" #include "urldata.h" #include <curl/curl.h> #include "transfer.h" diff --git a/lib/formdata.c b/lib/formdata.c index ae75fe175..785f1a678 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -33,7 +33,7 @@ #include "urldata.h" /* for struct Curl_easy */ #include "formdata.h" #include "vtls/vtls.h" -#include "strequal.h" +#include "strcase.h" #include "sendf.h" #include "strdup.h" /* The last 3 #include files should be in this order */ @@ -201,9 +201,9 @@ static const char *ContentTypeForFilename(const char *filename, if(filename) { /* in case a NULL was passed in */ for(i=0; i<sizeof(ctts)/sizeof(ctts[0]); i++) { if(strlen(filename) >= strlen(ctts[i].extension)) { - if(strequal(filename + - strlen(filename) - strlen(ctts[i].extension), - ctts[i].extension)) { + if(strcasecompare(filename + + strlen(filename) - strlen(ctts[i].extension), + ctts[i].extension)) { contenttype = ctts[i].type; break; } @@ -878,7 +878,7 @@ static CURLcode AddFormData(struct FormData **formp, else { /* Since this is a file to be uploaded here, add the size of the actual file */ - if(!strequal("-", newform->line)) { + if(strcmp("-", newform->line)) { struct_stat file; if(!stat(newform->line, &file) && !S_ISDIR(file.st_mode)) *size += filesize(newform->line, file); @@ -1305,7 +1305,7 @@ CURLcode Curl_getformdata(struct Curl_easy *data, /* we should include the contents from the specified file */ FILE *fileread; - fileread = strequal("-", file->contents)? + fileread = !strcmp("-", file->contents)? stdin:fopen(file->contents, "rb"); /* binary read for win32 */ /* @@ -61,7 +61,7 @@ #include "ftplistparser.h" #include "curl_sec.h" #include "strtoofft.h" -#include "strequal.h" +#include "strcase.h" #include "vtls/vtls.h" #include "connect.h" #include "strerror.h" @@ -2999,7 +2999,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn) /* Check for special servers here. */ - if(strequal(os, "OS/400")) { + if(strcasecompare(os, "OS/400")) { /* Force OS400 name format 1. */ result = Curl_pp_sendf(&ftpc->pp, "%s", "SITE NAMEFMT 1"); if(result) { @@ -4320,7 +4320,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn) return CURLE_OUT_OF_MEMORY; /* we have a special case for listing the root dir only */ - if(strequal(path_to_use, "/")) { + if(!strcmp(path_to_use, "/")) { cur_pos++; /* make it point to the zero byte */ ftpc->dirs[0] = strdup("/"); ftpc->dirdepth++; diff --git a/lib/gopher.c b/lib/gopher.c index 4939ad540..690d5f1dc 100644 --- a/lib/gopher.c +++ b/lib/gopher.c @@ -30,7 +30,6 @@ #include "sendf.h" #include "progress.h" -#include "strequal.h" #include "gopher.h" #include "rawstr.h" #include "select.h" diff --git a/lib/http.c b/lib/http.c index e6e7d377a..05d138f73 100644 --- a/lib/http.c +++ b/lib/http.c @@ -53,7 +53,6 @@ #include "progress.h" #include "curl_base64.h" #include "cookie.h" -#include "strequal.h" #include "vauth/vauth.h" #include "vtls/vtls.h" #include "http_digest.h" diff --git a/lib/if2ip.c b/lib/if2ip.c index 2f92b2def..e6faa4b80 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -51,7 +51,7 @@ #endif #include "inet_ntop.h" -#include "strequal.h" +#include "strcase.h" #include "if2ip.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" @@ -102,7 +102,7 @@ bool Curl_if_is_interface_name(const char *interf) if(getifaddrs(&head) >= 0) { for(iface=head; iface != NULL; iface=iface->ifa_next) { - if(curl_strequal(iface->ifa_name, interf)) { + if(strcasecompare(iface->ifa_name, interf)) { result = TRUE; break; } @@ -132,7 +132,7 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, for(iface = head; iface != NULL; iface=iface->ifa_next) { if(iface->ifa_addr != NULL) { if(iface->ifa_addr->sa_family == af) { - if(curl_strequal(iface->ifa_name, interf)) { + if(strcasecompare(iface->ifa_name, interf)) { void *addr; char *ip; char scope[12] = ""; @@ -180,7 +180,7 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, } } else if((res == IF2IP_NOT_FOUND) && - curl_strequal(iface->ifa_name, interf)) { + strcasecompare(iface->ifa_name, interf)) { res = IF2IP_AF_NOT_SUPPORTED; } } diff --git a/lib/imap.c b/lib/imap.c index 50a351284..6681a4d73 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -68,9 +68,8 @@ #include "http.h" /* for HTTP proxy tunnel stuff */ #include "socks.h" #include "imap.h" - #include "strtoofft.h" -#include "strequal.h" +#include "strcase.h" #include "vtls/vtls.h" #include "connect.h" #include "strerror.h" @@ -1935,7 +1934,7 @@ static CURLcode imap_parse_url_options(struct connectdata *conn) while(*ptr && *ptr != ';') ptr++; - if(strnequal(key, "AUTH=", 5)) + if(strncasecompare(key, "AUTH=", 5)) result = Curl_sasl_parse_url_auth_option(&imapc->sasl, value, ptr - value); else diff --git a/lib/netrc.c b/lib/netrc.c index 46f427a2b..558440a11 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -28,8 +28,6 @@ #include <curl/curl.h> #include "netrc.h" - -#include "strequal.h" #include "strtok.h" #include "rawstr.h" diff --git a/lib/pop3.c b/lib/pop3.c index 154e5c38b..55ad98c0d 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -70,9 +70,8 @@ #include "http.h" /* for HTTP proxy tunnel stuff */ #include "socks.h" #include "pop3.h" - #include "strtoofft.h" -#include "strequal.h" +#include "strcase.h" #include "vtls/vtls.h" #include "connect.h" #include "strerror.h" @@ -1412,11 +1411,11 @@ static CURLcode pop3_parse_url_options(struct connectdata *conn) while(*ptr && *ptr != ';') ptr++; - if(strnequal(key, "AUTH=", 5)) { + if(strncasecompare(key, "AUTH=", 5)) { result = Curl_sasl_parse_url_auth_option(&pop3c->sasl, value, ptr - value); - if(result && strnequal(value, "+APOP", ptr - value)) { + if(result && strncasecompare(value, "+APOP", ptr - value)) { pop3c->preftype = POP3_TYPE_APOP; pop3c->sasl.prefmech = SASL_AUTH_NONE; result = CURLE_OK; diff --git a/lib/smtp.c b/lib/smtp.c index 98504df79..d127750ac 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -69,9 +69,8 @@ #include "http.h" /* for HTTP proxy tunnel stuff */ #include "socks.h" #include "smtp.h" - #include "strtoofft.h" -#include "strequal.h" +#include "strcase.h" #include "vtls/vtls.h" #include "connect.h" #include "strerror.h" @@ -1512,7 +1511,7 @@ static CURLcode smtp_parse_url_options(struct connectdata *conn) while(*ptr && *ptr != ';') ptr++; - if(strnequal(key, "AUTH=", 5)) + if(strncasecompare(key, "AUTH=", 5)) result = Curl_sasl_parse_url_auth_option(&smtpc->sasl, value, ptr - value); else diff --git a/lib/socks.c b/lib/socks.c index 291a2fb59..742d41156 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -33,7 +33,6 @@ #include "urldata.h" #include "sendf.h" -#include "strequal.h" #include "select.h" #include "connect.h" #include "timeval.h" @@ -1233,7 +1233,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) sshc->acceptfail = TRUE; } - if(curl_strequal("pwd", cmd)) { + if(strcasecompare("pwd", cmd)) { /* output debug output if that is requested */ char *tmp = aprintf("257 \"%s\" is current directory.\n", sftp_scp->path); diff --git a/lib/strequal.c b/lib/strcase.c index 01c378442..14cbe4c54 100644 --- a/lib/strequal.c +++ b/lib/strcase.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -26,12 +26,12 @@ #include <strings.h> #endif -#include "strequal.h" +#include "strcase.h" /* * @unittest: 1301 */ -int curl_strequal(const char *first, const char *second) +int curl_strcasecompare(const char *first, const char *second) { #if defined(HAVE_STRCASECMP) return !(strcasecmp)(first, second); @@ -54,7 +54,7 @@ int curl_strequal(const char *first, const char *second) /* * @unittest: 1301 */ -int curl_strnequal(const char *first, const char *second, size_t max) +int curl_strncasecompare(const char *first, const char *second, size_t max) { #if defined(HAVE_STRNCASECMP) return !strncasecmp(first, second, max); diff --git a/lib/strequal.h b/lib/strcase.h index ff56df51f..aa36d9fab 100644 --- a/lib/strequal.h +++ b/lib/strcase.h @@ -1,5 +1,5 @@ -#ifndef HEADER_CURL_STREQUAL_H -#define HEADER_CURL_STREQUAL_H +#ifndef HEADER_CURL_STRCASE_H +#define HEADER_CURL_STRCASE_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -24,8 +24,11 @@ #include <curl/curl.h> -#define strequal(a,b) curl_strequal(a,b) -#define strnequal(a,b,c) curl_strnequal(a,b,c) +#define strcasecompare(a,b) curl_strcasecompare(a,b) +#define strncasecompare(a,b,c) curl_strncasecompare(a,b,c) -#endif /* HEADER_CURL_STREQUAL_H */ +int curl_strcasecompare(const char *first, const char *second); +int curl_strncasecompare(const char *first, const char *second, size_t max); + +#endif /* HEADER_CURL_STRCASE_H */ diff --git a/lib/telnet.c b/lib/telnet.c index cc705cfc6..4f3af0340 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -58,7 +58,6 @@ #include "arpa_telnet.h" #include "select.h" -#include "strequal.h" #include "rawstr.h" #include "warnless.h" diff --git a/lib/transfer.c b/lib/transfer.c index a96baa2fc..d689d683e 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -21,9 +21,7 @@ ***************************************************************************/ #include "curl_setup.h" - #include "strtoofft.h" -#include "strequal.h" #include "rawstr.h" #ifdef HAVE_NETINET_IN_H @@ -79,7 +79,7 @@ bool curl_win32_idn_to_ascii(const char *in, char **out); #include "sendf.h" #include "progress.h" #include "cookie.h" -#include "strequal.h" +#include "strcase.h" #include "strerror.h" #include "escape.h" #include "strtok.h" @@ -2610,7 +2610,7 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option, data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */ break; case CURLOPT_TLSAUTH_TYPE: - if(strnequal((char *)va_arg(param, char *), "SRP", strlen("SRP"))) + if(strncasecompare((char *)va_arg(param, char *), "SRP", strlen("SRP"))) data->set.ssl.authtype = CURL_TLSAUTH_SRP; else data->set.ssl.authtype = CURL_TLSAUTH_NONE; @@ -5422,7 +5422,8 @@ static CURLcode parse_connect_to_string(struct Curl_easy *data, if(!hostname_to_match) return CURLE_OUT_OF_MEMORY; hostname_to_match_len = strlen(hostname_to_match); - host_match = curl_strnequal(ptr, hostname_to_match, hostname_to_match_len); + host_match = strncasecompare(ptr, hostname_to_match, + hostname_to_match_len); free(hostname_to_match); ptr += hostname_to_match_len; diff --git a/lib/vauth/cleartext.c b/lib/vauth/cleartext.c index 4e906bc07..a9d72bfbe 100644 --- a/lib/vauth/cleartext.c +++ b/lib/vauth/cleartext.c @@ -33,7 +33,6 @@ #include "curl_md5.h" #include "warnless.h" #include "strtok.h" -#include "strequal.h" #include "rawstr.h" #include "sendf.h" #include "curl_printf.h" diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 9befbeb77..b93b53fa2 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -46,7 +46,6 @@ #include "openssl.h" #include "connect.h" #include "slist.h" -#include "strequal.h" #include "select.h" #include "vtls.h" #include "rawstr.h" diff --git a/lib/x509asn1.c b/lib/x509asn1.c index e17bcd92d..0559cb6c4 100644 --- a/lib/x509asn1.c +++ b/lib/x509asn1.c @@ -178,7 +178,7 @@ static const curl_OID * searchOID(const char * oid) Return the table entry pointer or NULL if not found. */ for(op = OIDtable; op->numoid; op++) - if(!strcmp(op->numoid, oid) || curl_strequal(op->textoid, oid)) + if(!strcmp(op->numoid, oid) || strcasecompare(op->textoid, oid)) return op; return (const curl_OID *) NULL; @@ -817,7 +817,7 @@ static void do_pubkey(struct Curl_easy * data, int certnum, /* Get the public key (single element). */ Curl_getASN1Element(&pk, pubkey->beg + 1, pubkey->end); - if(curl_strequal(algo, "rsaEncryption")) { + if(strcasecompare(algo, "rsaEncryption")) { p = Curl_getASN1Element(&elem, pk.beg, pk.end); /* Compute key length. */ for(q = elem.beg; !*q && q < elem.end; q++) @@ -842,7 +842,7 @@ static void do_pubkey(struct Curl_easy * data, int certnum, Curl_getASN1Element(&elem, p, pk.end); do_pubkey_field(data, certnum, "rsa(e)", &elem); } - else if(curl_strequal(algo, "dsa")) { + else if(strcasecompare(algo, "dsa")) { p = Curl_getASN1Element(&elem, param->beg, param->end); do_pubkey_field(data, certnum, "dsa(p)", &elem); p = Curl_getASN1Element(&elem, p, param->end); @@ -851,7 +851,7 @@ static void do_pubkey(struct Curl_easy * data, int certnum, do_pubkey_field(data, certnum, "dsa(g)", &elem); do_pubkey_field(data, certnum, "dsa(pub_key)", &pk); } - else if(curl_strequal(algo, "dhpublicnumber")) { + else if(strcasecompare(algo, "dhpublicnumber")) { p = Curl_getASN1Element(&elem, param->beg, param->end); do_pubkey_field(data, certnum, "dh(p)", &elem); Curl_getASN1Element(&elem, param->beg, param->end); @@ -859,7 +859,7 @@ static void do_pubkey(struct Curl_easy * data, int certnum, do_pubkey_field(data, certnum, "dh(pub_key)", &pk); } #if 0 /* Patent-encumbered. */ - else if(curl_strequal(algo, "ecPublicKey")) { + else if(strcasecompare(algo, "ecPublicKey")) { /* Left TODO. */ } #endif |