Files
curl/libcurl-ocloexec.patch
Pedro Monreal Gonzalez 1b4d5053ee - Update to version 8.10.0:
* Security fixes:
    - [bsc#1230093, CVE-2024-8096] curl: OCSP stapling bypass with GnuTLS
  * Changes:
    - curl: make --rate accept "number of units"
    - curl: make --show-headers the same as --include
    - curl: support --dump-header % to direct to stderr
    - curl: support embedding a CA bundle and --dump-ca-embed
    - curl: support repeated use of the verbose option; -vv etc
    - curl: use libuv for parallel transfers with --test-event
    - vtls: stop offering alpn http/1.1 for http2-prior-knowledge
  * Bugfixes:
    - curl: allow 500MB data URL encode strings
    - curl: warn on unsupported SSL options
    - Curl_rand_bytes to control env override
    - curl_sha512_256: fix symbol collisions with nettle library
    - dist: fix reproducible build from release tarball
    - http2: fix GOAWAY message sent to server
    - http2: improve rate limiting of downloads
    - INSTALL.md: MultiSSL and QUIC are mutually exclusive
    - lib: add eos flag to send methods
    - lib: make SSPI global symbols use Curl_ prefix
    - lib: prefer `CURL_SHA256_DIGEST_LENGTH` over the unprefixed name
    - lib: remove the final strncpy() calls
    - lib: remove use of RANDOM_FILE
    - Makefile.mk: fixup enabling libidn2
    - max-filesize.md: mention zero disables the limit
    - mime: avoid inifite loop in client reader
    - ngtcp2: use NGHTTP3 prefix instead of NGTCP2 for errors in h3 callbacks
    - openssl quic: fix memory leak

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/curl?expand=0&rev=376
2024-09-11 09:48:55 +00:00

94 lines
3.0 KiB
Diff

Open library file descriptors with O_CLOEXEC
This patch is non-portable, it needs linux 2.6.23 and glibc 2.7
or later, different combinations (old linux, new glibc and vice-versa)
will result in a crash.
To make it portable you have to test O_CLOEXEC support at *runtime*
compile time is not enough.
Index: curl-8.9.0/lib/file.c
===================================================================
--- curl-8.9.0.orig/lib/file.c
+++ curl-8.9.0/lib/file.c
@@ -242,7 +242,7 @@ static CURLcode file_connect(struct Curl
}
}
#else
- fd = open_readonly(real_path, O_RDONLY);
+ fd = open_readonly(real_path, O_RDONLY|O_CLOEXEC);
file->path = real_path;
#endif
#endif
@@ -329,7 +329,7 @@ static CURLcode file_upload(struct Curl_
else
mode = MODE_DEFAULT|O_TRUNC;
- fd = open(file->path, mode, data->set.new_file_perms);
+ fd = open(file->path, mode|O_CLOEXEC, data->set.new_file_perms);
if(fd < 0) {
failf(data, "cannot open %s for writing", file->path);
return CURLE_WRITE_ERROR;
Index: curl-8.9.0/lib/if2ip.c
===================================================================
--- curl-8.9.0.orig/lib/if2ip.c
+++ curl-8.9.0/lib/if2ip.c
@@ -208,7 +208,7 @@ if2ip_result_t Curl_if2ip(int af,
if(len >= sizeof(req.ifr_name))
return IF2IP_NOT_FOUND;
- dummy = socket(AF_INET, SOCK_STREAM, 0);
+ dummy = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0);
if(CURL_SOCKET_BAD == dummy)
return IF2IP_NOT_FOUND;
Index: curl-8.9.0/configure.ac
===================================================================
--- curl-8.9.0.orig/configure.ac
+++ curl-8.9.0/configure.ac
@@ -441,6 +441,8 @@ AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-m
# Silence warning: ar: 'u' modifier ignored since 'D' is the default
AC_SUBST(AR_FLAGS, [cr])
+AC_USE_SYSTEM_EXTENSIONS
+
dnl This defines _ALL_SOURCE for AIX
CURL_CHECK_AIX_ALL_SOURCE
Index: curl-8.9.0/lib/hostip.c
===================================================================
--- curl-8.9.0.orig/lib/hostip.c
+++ curl-8.9.0/lib/hostip.c
@@ -44,6 +44,7 @@
#include <setjmp.h>
#include <signal.h>
+#include <fcntl.h>
#include "urldata.h"
#include "sendf.h"
#include "hostip.h"
@@ -616,7 +617,7 @@ bool Curl_ipv6works(struct Curl_easy *da
else {
int ipv6_works = -1;
/* probe to see if we have a working IPv6 stack */
- curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);
+ curl_socket_t s = socket(PF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if(s == CURL_SOCKET_BAD)
/* an IPv6 address was requested but we cannot get/use one */
ipv6_works = 0;
Index: curl-8.9.0/lib/cf-socket.c
===================================================================
--- curl-8.9.0.orig/lib/cf-socket.c
+++ curl-8.9.0/lib/cf-socket.c
@@ -360,7 +360,9 @@ static CURLcode socket_open(struct Curl_
}
else {
/* opensocket callback not set, so simply create the socket now */
- *sockfd = socket(addr->family, addr->socktype, addr->protocol);
+ *sockfd = socket(addr->family,
+ addr->socktype|SOCK_CLOEXEC,
+ addr->protocol);
}
if(*sockfd == CURL_SOCKET_BAD)