From 0885b26005fefa62adfd3b7e52f7209693462d9f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 9 Jan 2022 22:38:22 +0100 Subject: ldap: return CURLE_URL_MALFORMAT for bad URL For consistency, use the same return code for URL malformats, independently of what scheme that is used. Previously this would return CURLE_LDAP_INVALID_URL, but starting now that error cannot be returned. Closes #8170 --- docs/libcurl/libcurl-errors.3 | 4 ++-- docs/libcurl/symbols-in-versions | 2 +- include/curl/curl.h | 7 +++---- lib/ldap.c | 6 +++--- lib/strerror.c | 6 ++---- tests/data/test1538 | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/docs/libcurl/libcurl-errors.3 b/docs/libcurl/libcurl-errors.3 index 6196e8edf..9ad29e8c8 100644 --- a/docs/libcurl/libcurl-errors.3 +++ b/docs/libcurl/libcurl-errors.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. +.\" * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -185,7 +185,7 @@ previous value was 51. .IP "CURLE_BAD_CONTENT_ENCODING (61)" Unrecognized transfer encoding. .IP "CURLE_LDAP_INVALID_URL (62)" -Invalid LDAP URL. +This error code is deprecated since 7.82.0 and cannot be returned anymore. .IP "CURLE_FILESIZE_EXCEEDED (63)" Maximum file size exceeded. .IP "CURLE_USE_SSL_FAILED (64)" diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions index dfc8c04ec..3fcfa339a 100644 --- a/docs/libcurl/symbols-in-versions +++ b/docs/libcurl/symbols-in-versions @@ -92,7 +92,7 @@ CURLE_HTTP_RANGE_ERROR 7.1 7.17.0 CURLE_HTTP_RETURNED_ERROR 7.10.3 CURLE_INTERFACE_FAILED 7.12.0 CURLE_LDAP_CANNOT_BIND 7.1 -CURLE_LDAP_INVALID_URL 7.10.8 +CURLE_LDAP_INVALID_URL 7.10.8 7.82.0 CURLE_LDAP_SEARCH_FAILED 7.1 CURLE_LIBRARY_NOT_FOUND 7.1 7.17.0 CURLE_LOGIN_DENIED 7.13.1 diff --git a/include/curl/curl.h b/include/curl/curl.h index 7b69ce2d6..a8e7c3457 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -569,7 +569,7 @@ typedef enum { CURLE_PEER_FAILED_VERIFICATION, /* 60 - peer's certificate or fingerprint wasn't verified fine */ CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ - CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ + CURLE_OBSOLETE62, /* 62 - NOT IN USE since 7.82.0 */ CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind @@ -683,13 +683,12 @@ typedef enum { /* The following were added earlier */ #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT - #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED - #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME +#define CURLE_LDAP_INVALID_URL CURLE_OBSOLETE62 /* This was the error code 50 in 7.7.3 and a few earlier versions, this is no longer used by libcurl but is instead #defined here only to not diff --git a/lib/ldap.c b/lib/ldap.c index 3154db5cf..3e3562078 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -306,8 +306,8 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done) rc = _ldap_url_parse(data, conn, &ludp); #endif if(rc) { - failf(data, "LDAP local: %s", ldap_err2string(rc)); - result = CURLE_LDAP_INVALID_URL; + failf(data, "Bad LDAP URL: %s", ldap_err2string(rc)); + result = CURLE_URL_MALFORMAT; goto quit; } diff --git a/lib/strerror.c b/lib/strerror.c index 07d73a74b..ae650aef3 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2004 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 2004 - 2022, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -224,9 +224,6 @@ curl_easy_strerror(CURLcode error) case CURLE_BAD_CONTENT_ENCODING: return "Unrecognized or bad HTTP Content or Transfer-Encoding"; - case CURLE_LDAP_INVALID_URL: - return "Invalid LDAP URL"; - case CURLE_FILESIZE_EXCEEDED: return "Maximum file size exceeded"; @@ -337,6 +334,7 @@ curl_easy_strerror(CURLcode error) case CURLE_OBSOLETE50: case CURLE_OBSOLETE51: case CURLE_OBSOLETE57: + case CURLE_OBSOLETE62: case CURL_LAST: break; } diff --git a/tests/data/test1538 b/tests/data/test1538 index d92ec219f..aa7d4b609 100644 --- a/tests/data/test1538 +++ b/tests/data/test1538 @@ -94,7 +94,7 @@ e58: Problem with the local SSL certificate e59: Couldn't use specified SSL cipher e60: SSL peer certificate or SSH remote key was not OK e61: Unrecognized or bad HTTP Content or Transfer-Encoding -e62: Invalid LDAP URL +e62: Unknown error e63: Maximum file size exceeded e64: Requested SSL level failed e65: Send failed since rewinding of the data stream failed -- cgit v1.2.1