summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-01-09 22:38:22 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-01-09 22:41:51 +0100
commit0885b26005fefa62adfd3b7e52f7209693462d9f (patch)
tree81c26d33f5a4cfe53a1197baa94184bab3d73bc7
parentdbde76bdd6018ba68bf7192a514e4048f014cea3 (diff)
downloadcurl-bagder/ldap-url-malformat.tar.gz
ldap: return CURLE_URL_MALFORMAT for bad URLbagder/ldap-url-malformat
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
-rw-r--r--docs/libcurl/libcurl-errors.34
-rw-r--r--docs/libcurl/symbols-in-versions2
-rw-r--r--include/curl/curl.h7
-rw-r--r--lib/ldap.c6
-rw-r--r--lib/strerror.c6
-rw-r--r--tests/data/test15382
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, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2022, 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
@@ -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, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, 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
@@ -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, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, 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
@@ -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, <daniel@haxx.se>, et al.
+ * Copyright (C) 2004 - 2022, 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
@@ -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