-
Notifications
You must be signed in to change notification settings - Fork 603
[AutoPR- Security] Patch curl for CVE-2025-14017 [MEDIUM] #15474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
azurelinux-security
wants to merge
2
commits into
microsoft:3.0-dev
Choose a base branch
from
azurelinux-security:azure-autosec/curl/3.0/1022846
base: 3.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+136
−15
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| From 477745dc74450c96f10afdacdcfecac67b50f138 Mon Sep 17 00:00:00 2001 | ||
| From: AllSpark <allspark@microsoft.com> | ||
| Date: Fri, 9 Jan 2026 03:55:08 +0000 | ||
| Subject: [PATCH] ldap: call ldap_init() before setting the options; set | ||
| options on server; adjust CACERTFILE and REQUIRE_CERT; move init earlier and | ||
| remove duplicate init; update error message; consistent with upstream patch | ||
|
|
||
| Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> | ||
| Upstream-reference: AI Backport of https://github.com/curl/curl/commit/39d1976b7f709a516e324333.patch | ||
| --- | ||
| lib/ldap.c | 49 +++++++++++++++++++------------------------------ | ||
| 1 file changed, 19 insertions(+), 30 deletions(-) | ||
|
|
||
| diff --git a/lib/ldap.c b/lib/ldap.c | ||
| index 2cbdb9c..a1e60b0 100644 | ||
| --- a/lib/ldap.c | ||
| +++ b/lib/ldap.c | ||
| @@ -367,16 +367,29 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done) | ||
| passwd = conn->passwd; | ||
| } | ||
|
|
||
| +#ifdef USE_WIN32_LDAP | ||
| + if(ldap_ssl) | ||
| + server = ldap_sslinit(host, (curl_ldap_num_t)conn->primary.remote_port, 1); | ||
| + else | ||
| +#else | ||
| + server = ldap_init(host, (curl_ldap_num_t)conn->primary.remote_port); | ||
| +#endif | ||
| + if(!server) { | ||
| + failf(data, "LDAP: cannot setup connect to %s:%u", | ||
| + conn->host.dispname, conn->primary.remote_port); | ||
| + result = CURLE_COULDNT_CONNECT; | ||
| + goto quit; | ||
| + } | ||
| + | ||
| #ifdef LDAP_OPT_NETWORK_TIMEOUT | ||
| - ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &ldap_timeout); | ||
| + ldap_set_option(server, LDAP_OPT_NETWORK_TIMEOUT, &ldap_timeout); | ||
| #endif | ||
| - ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto); | ||
| + ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto); | ||
|
|
||
| if(ldap_ssl) { | ||
| #ifdef HAVE_LDAP_SSL | ||
| #ifdef USE_WIN32_LDAP | ||
| /* Win32 LDAP SDK does not support insecure mode without CA! */ | ||
| - server = ldap_sslinit(host, (curl_ldap_num_t)conn->primary.remote_port, 1); | ||
| ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON); | ||
| #else | ||
| int ldap_option; | ||
| @@ -444,7 +457,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done) | ||
| goto quit; | ||
| } | ||
| infof(data, "LDAP local: using PEM CA cert: %s", ldap_ca); | ||
| - rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, ldap_ca); | ||
| + rc = ldap_set_option(server, LDAP_OPT_X_TLS_CACERTFILE, ldap_ca); | ||
| if(rc != LDAP_SUCCESS) { | ||
| failf(data, "LDAP local: ERROR setting PEM CA cert: %s", | ||
| ldap_err2string(rc)); | ||
| @@ -456,20 +469,13 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done) | ||
| else | ||
| ldap_option = LDAP_OPT_X_TLS_NEVER; | ||
|
|
||
| - rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &ldap_option); | ||
| + rc = ldap_set_option(server, LDAP_OPT_X_TLS_REQUIRE_CERT, &ldap_option); | ||
| if(rc != LDAP_SUCCESS) { | ||
| failf(data, "LDAP local: ERROR setting cert verify mode: %s", | ||
| ldap_err2string(rc)); | ||
| result = CURLE_SSL_CERTPROBLEM; | ||
| goto quit; | ||
| } | ||
| - server = ldap_init(host, conn->primary.remote_port); | ||
| - if(!server) { | ||
| - failf(data, "LDAP local: Cannot connect to %s:%u", | ||
| - conn->host.dispname, conn->primary.remote_port); | ||
| - result = CURLE_COULDNT_CONNECT; | ||
| - goto quit; | ||
| - } | ||
| ldap_option = LDAP_OPT_X_TLS_HARD; | ||
| rc = ldap_set_option(server, LDAP_OPT_X_TLS, &ldap_option); | ||
| if(rc != LDAP_SUCCESS) { | ||
| @@ -478,15 +484,6 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done) | ||
| result = CURLE_SSL_CERTPROBLEM; | ||
| goto quit; | ||
| } | ||
| -/* | ||
| - rc = ldap_start_tls_s(server, NULL, NULL); | ||
| - if(rc != LDAP_SUCCESS) { | ||
| - failf(data, "LDAP local: ERROR starting SSL/TLS mode: %s", | ||
| - ldap_err2string(rc)); | ||
| - result = CURLE_SSL_CERTPROBLEM; | ||
| - goto quit; | ||
| - } | ||
| -*/ | ||
| #else | ||
| (void)ldap_option; | ||
| (void)ldap_ca; | ||
| @@ -505,15 +502,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done) | ||
| result = CURLE_NOT_BUILT_IN; | ||
| goto quit; | ||
| } | ||
| - else { | ||
| - server = ldap_init(host, (curl_ldap_num_t)conn->primary.remote_port); | ||
| - if(!server) { | ||
| - failf(data, "LDAP local: Cannot connect to %s:%u", | ||
| - conn->host.dispname, conn->primary.remote_port); | ||
| - result = CURLE_COULDNT_CONNECT; | ||
| - goto quit; | ||
| - } | ||
| - } | ||
| + | ||
| #ifdef USE_WIN32_LDAP | ||
| ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto); | ||
| rc = ldap_win_bind(data, server, user, passwd); | ||
| -- | ||
| 2.45.4 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch looks good w.r.t upstream