Accepting request 94634 from devel:libraries:c_c++
- Use O_CLOEXEC in library code. (forwarded request 94633 from elvigia) OBS-URL: https://build.opensuse.org/request/show/94634 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/curl?expand=0&rev=66
This commit is contained in:
commit
a48ebf92c8
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1c44c437374958fa3bc91fbcad2ac9c64f3b4e9ddf54d1efe252be76a58a5776
|
||||
size 1910085
|
3
curl-7.23.1.tar.lzma
Normal file
3
curl-7.23.1.tar.lzma
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:eff6cfd9d561f0d5e08abd99112dc13b2593560c748a78801366f4604c9062cb
|
||||
size 1937159
|
@ -1,27 +0,0 @@
|
||||
From 0a8361df11617fe0a59687b00f020a8e9f15e83f Mon Sep 17 00:00:00 2001
|
||||
From: Dominique Leuenberger <dimstar@opensuse.org>
|
||||
Date: Mon, 3 Oct 2011 17:53:43 +0200
|
||||
Subject: [PATCH] m4: Use x in order to avoid variable 'x' set but not used
|
||||
[-Werror=unused-but-set-variable]
|
||||
|
||||
This error could be caused by configure scripts being run with -Werror
|
||||
-Wall, which would lead to libcurl being detected as unusable.
|
||||
---
|
||||
docs/libcurl/libcurl.m4 | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/docs/libcurl/libcurl.m4 b/docs/libcurl/libcurl.m4
|
||||
index 01a0575..8cada05 100644
|
||||
--- a/docs/libcurl/libcurl.m4
|
||||
+++ b/docs/libcurl/libcurl.m4
|
||||
@@ -157,6 +157,7 @@ x=CURLOPT_FILE;
|
||||
x=CURLOPT_ERRORBUFFER;
|
||||
x=CURLOPT_STDERR;
|
||||
x=CURLOPT_VERBOSE;
|
||||
+if (x) ;
|
||||
])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
|
||||
|
||||
CPPFLAGS=$_libcurl_save_cppflags
|
||||
--
|
||||
1.7.6.4
|
||||
|
25
curl.changes
25
curl.changes
@ -1,4 +1,29 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 30 22:39:35 UTC 2011 - crrodriguez@opensuse.org
|
||||
|
||||
- Use O_CLOEXEC in library code.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 29 11:51:38 UTC 2011 - jengelh@medozas.de
|
||||
|
||||
- Remove redundant/unwanted tags/section (cf. specfile guidelines)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 29 08:20:23 UTC 2011 - idoenmez@suse.de
|
||||
|
||||
- Use original source tarball
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 28 12:00:00 UTC 2011 - opensuse@dstoecker.de
|
||||
|
||||
- Update to version 7.23.1:
|
||||
+ Empty headers can be sent in HTTP requests by terminating with a semicolon
|
||||
+ SSL session sharing support added to curl_share_setopt()
|
||||
+ Added support to MAIL FROM for the optional SIZE parameter
|
||||
+ smtp: Added support for NTLM authentication
|
||||
+ curl tool: code split into tool_*.[ch] files
|
||||
+ lots of bugfixes
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 3 15:44:17 UTC 2011 - dimstar@opensuse.org
|
||||
|
||||
- Update to version 7.22.0:
|
||||
|
24
curl.spec
24
curl.spec
@ -35,8 +35,7 @@ BuildRequires: libcares-devel
|
||||
# used by the testsuite
|
||||
BuildRequires: stunnel
|
||||
%endif
|
||||
#define cvs_suffix -20090302
|
||||
Version: 7.22.0
|
||||
Version: 7.23.1
|
||||
Release: 1
|
||||
# bug437293
|
||||
%ifarch ppc64
|
||||
@ -47,11 +46,10 @@ License: BSD3c(or similar) ; MIT License (or similar)
|
||||
Group: Productivity/Networking/Web/Utilities
|
||||
Summary: A Tool for Transferring Data from URLs
|
||||
Url: http://curl.haxx.se/
|
||||
Source: curl-%version%{?cvs_suffix}.tar.lzma
|
||||
Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma
|
||||
Source2: baselibs.conf
|
||||
# PATCH-FIX-UPSTREAM curl-fix-m4.patch dimstar@opensuse.org -- Fix m4 to work with -Werror -Wall configure scripts. Simply 'use' x. Patch sent upstream.
|
||||
Patch0: curl-fix-m4.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Patch: libcurl-ocloexec.patch
|
||||
|
||||
%description
|
||||
Curl is a client to get documents and files from or send documents to a
|
||||
@ -60,15 +58,14 @@ TFTP, DICT, TELNET, LDAP, or FILE). The command is designed to work
|
||||
without user interaction or any kind of interactivity.
|
||||
|
||||
%package -n libcurl4
|
||||
License: BSD3c(or similar) ; MIT License (or similar)
|
||||
Summary: cURL shared library version 4
|
||||
Summary: Version 4 of cURL shared library
|
||||
Group: Productivity/Networking/Web/Utilities
|
||||
|
||||
%description -n libcurl4
|
||||
cURL shared library version 4.
|
||||
The cURL shared library version 4 for accessing data using different
|
||||
network protocols.
|
||||
|
||||
%package -n libcurl-devel
|
||||
License: BSD3c(or similar) ; MIT License (or similar)
|
||||
Summary: A Tool for Transferring Data from URLs
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: libcurl4 = %{version} glibc-devel
|
||||
@ -83,17 +80,15 @@ DICT, TELNET, LDAP, or FILE). The command is designed to work without
|
||||
user interaction or any kind of interactivity.
|
||||
|
||||
%prep
|
||||
%setup -q -n curl-%version%{?cvs_suffix}
|
||||
%patch0 -p1
|
||||
%setup -q
|
||||
%patch -p1
|
||||
|
||||
%build
|
||||
# local hack to make curl-config --libs stop printing libraries it depends on
|
||||
# (currently, libtool sets link_all_deplibs=(yes|unknown) everywhere,
|
||||
# will hopefully change in the future)
|
||||
sed -i 's/link_all_deplibs=unknown/link_all_deplibs=no/' configure
|
||||
export CFLAGS="%{optflags}"
|
||||
./configure \
|
||||
--prefix=%{_prefix} \
|
||||
%configure \
|
||||
--enable-ipv6 \
|
||||
%if %{with openssl}
|
||||
--with-ssl \
|
||||
@ -106,7 +101,6 @@ export CFLAGS="%{optflags}"
|
||||
%endif
|
||||
--with-gssapi=/usr/lib/mit \
|
||||
--with-libssh2\
|
||||
--libdir=%{_libdir} \
|
||||
--enable-hidden-symbols \
|
||||
--disable-static \
|
||||
--enable-ares
|
||||
|
189
libcurl-ocloexec.patch
Normal file
189
libcurl-ocloexec.patch
Normal file
@ -0,0 +1,189 @@
|
||||
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.
|
||||
|
||||
|
||||
diff --git a/lib/connect.c b/lib/connect.c
|
||||
index 2a1876e..4a72f6a 100644
|
||||
--- a/lib/connect.c
|
||||
+++ b/lib/connect.c
|
||||
@@ -881,7 +881,7 @@ singleipconnect(struct connectdata *conn,
|
||||
(struct curl_sockaddr *)&addr);
|
||||
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)
|
||||
/* no socket, no connection */
|
||||
diff --git a/lib/cookie.c b/lib/cookie.c
|
||||
index 41ccdbe..35cfca3 100644
|
||||
--- a/lib/cookie.c
|
||||
+++ b/lib/cookie.c
|
||||
@@ -736,7 +736,7 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||
fp = NULL;
|
||||
}
|
||||
else
|
||||
- fp = file?fopen(file, "r"):NULL;
|
||||
+ fp = file?fopen(file, "re"):NULL;
|
||||
|
||||
c->newsession = newsession; /* new session? */
|
||||
|
||||
@@ -1060,7 +1060,7 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
|
||||
use_stdout=TRUE;
|
||||
}
|
||||
else {
|
||||
- out = fopen(dumphere, "w");
|
||||
+ out = fopen(dumphere, "we");
|
||||
if(!out)
|
||||
return 1; /* failure */
|
||||
}
|
||||
diff --git a/lib/file.c b/lib/file.c
|
||||
index 4447c73..7e15b21 100644
|
||||
--- a/lib/file.c
|
||||
+++ b/lib/file.c
|
||||
@@ -249,7 +249,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
|
||||
fd = open_readonly(actual_path, O_RDONLY|O_BINARY);
|
||||
file->path = actual_path;
|
||||
#else
|
||||
- fd = open_readonly(real_path, O_RDONLY);
|
||||
+ fd = open_readonly(real_path, O_RDONLY|O_CLOEXEC);
|
||||
file->path = real_path;
|
||||
#endif
|
||||
file->freepath = real_path; /* free this when done */
|
||||
@@ -336,7 +336,7 @@ static CURLcode file_upload(struct connectdata *conn)
|
||||
return CURLE_FILE_COULDNT_READ_FILE; /* fix: better error code */
|
||||
|
||||
if(data->state.resume_from)
|
||||
- fp = fopen( file->path, "ab" );
|
||||
+ fp = fopen( file->path, "abe" );
|
||||
else {
|
||||
int fd;
|
||||
|
||||
@@ -344,7 +344,7 @@ static CURLcode file_upload(struct connectdata *conn)
|
||||
fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,
|
||||
conn->data->set.new_file_perms);
|
||||
#else
|
||||
- fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC,
|
||||
+ fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC,
|
||||
conn->data->set.new_file_perms);
|
||||
#endif
|
||||
if(fd < 0) {
|
||||
@@ -352,7 +352,7 @@ static CURLcode file_upload(struct connectdata *conn)
|
||||
return CURLE_WRITE_ERROR;
|
||||
}
|
||||
close(fd);
|
||||
- fp = fopen(file->path, "wb");
|
||||
+ fp = fopen(file->path, "wbe");
|
||||
}
|
||||
|
||||
if(!fp) {
|
||||
diff --git a/lib/formdata.c b/lib/formdata.c
|
||||
index cbef511..187c88b 100644
|
||||
--- a/lib/formdata.c
|
||||
+++ b/lib/formdata.c
|
||||
@@ -1156,7 +1156,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data,
|
||||
FILE *fileread;
|
||||
|
||||
fileread = strequal("-", file->contents)?
|
||||
- stdin:fopen(file->contents, "rb"); /* binary read for win32 */
|
||||
+ stdin:fopen(file->contents, "rbe"); /* binary read for win32 */
|
||||
|
||||
/*
|
||||
* VMS: This only allows for stream files on VMS. Stream files are
|
||||
@@ -1292,7 +1292,7 @@ static size_t readfromfile(struct Form *form, char *buffer,
|
||||
else {
|
||||
if(!form->fp) {
|
||||
/* this file hasn't yet been opened */
|
||||
- form->fp = fopen(form->data->line, "rb"); /* b is for binary */
|
||||
+ form->fp = fopen(form->data->line, "rbe"); /* b is for binary */
|
||||
if(!form->fp)
|
||||
return (size_t)-1; /* failure */
|
||||
}
|
||||
diff --git a/lib/ftp.c b/lib/ftp.c
|
||||
index 05f6f45..11abaa3 100644
|
||||
--- a/lib/ftp.c
|
||||
+++ b/lib/ftp.c
|
||||
@@ -907,7 +907,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
|
||||
if(ai->ai_socktype == 0)
|
||||
ai->ai_socktype = conn->socktype;
|
||||
|
||||
- portsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
||||
+ portsock = socket(ai->ai_family, ai->ai_socktype | SOCK_CLOEXEC, ai->ai_protocol);
|
||||
if(portsock == CURL_SOCKET_BAD) {
|
||||
error = SOCKERRNO;
|
||||
continue;
|
||||
diff --git a/lib/hostip6.c b/lib/hostip6.c
|
||||
index 8241cb4..ac8d3d2 100644
|
||||
--- a/lib/hostip6.c
|
||||
+++ b/lib/hostip6.c
|
||||
@@ -45,7 +45,7 @@
|
||||
#ifdef HAVE_PROCESS_H
|
||||
#include <process.h>
|
||||
#endif
|
||||
-
|
||||
+#include <fcntl.h>
|
||||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
#include "hostip.h"
|
||||
@@ -113,7 +113,7 @@ bool Curl_ipv6works(void)
|
||||
static int ipv6_works = -1;
|
||||
if(-1 == ipv6_works) {
|
||||
/* 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 | O_CLOEXEC, 0);
|
||||
if(s == CURL_SOCKET_BAD)
|
||||
/* an ipv6 address was requested but we can't get/use one */
|
||||
ipv6_works = 0;
|
||||
diff --git a/lib/if2ip.c b/lib/if2ip.c
|
||||
index 4924f73..76c94ec 100644
|
||||
--- a/lib/if2ip.c
|
||||
+++ b/lib/if2ip.c
|
||||
@@ -125,7 +125,7 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
|
||||
if(len >= sizeof(req.ifr_name))
|
||||
return NULL;
|
||||
|
||||
- dummy = socket(AF_INET, SOCK_STREAM, 0);
|
||||
+ dummy = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if(CURL_SOCKET_BAD == dummy)
|
||||
return NULL;
|
||||
|
||||
diff --git a/lib/netrc.c b/lib/netrc.c
|
||||
index 6764b97..a605883 100644
|
||||
--- a/lib/netrc.c
|
||||
+++ b/lib/netrc.c
|
||||
@@ -110,7 +110,7 @@ int Curl_parsenetrc(const char *host,
|
||||
netrc_alloc = TRUE;
|
||||
}
|
||||
|
||||
- file = fopen(netrcfile, "r");
|
||||
+ file = fopen(netrcfile, "re");
|
||||
if(file) {
|
||||
char *tok;
|
||||
char *tok_buf;
|
||||
diff --git a/lib/ssluse.c b/lib/ssluse.c
|
||||
index af70fe0..54f07a4 100644
|
||||
--- a/lib/ssluse.c
|
||||
+++ b/lib/ssluse.c
|
||||
@@ -431,7 +431,7 @@ int cert_stuff(struct connectdata *conn,
|
||||
STACK_OF(X509) *ca = NULL;
|
||||
int i;
|
||||
|
||||
- f = fopen(cert_file,"rb");
|
||||
+ f = fopen(cert_file,"rbe");
|
||||
if(!f) {
|
||||
failf(data, "could not open PKCS12 file '%s'", cert_file);
|
||||
return 0;
|
||||
@@ -2280,7 +2280,7 @@ static CURLcode servercert(struct connectdata *conn,
|
||||
|
||||
/* e.g. match issuer name with provided issuer certificate */
|
||||
if(data->set.str[STRING_SSL_ISSUERCERT]) {
|
||||
- fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"r");
|
||||
+ fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"re");
|
||||
if(!fp) {
|
||||
if(strict)
|
||||
failf(data, "SSL: Unable to open issuer cert (%s)\n",
|
Loading…
x
Reference in New Issue
Block a user