diff --git a/libssh2-ocloexec.patch b/libssh2-ocloexec.patch new file mode 100644 index 0000000..2cfad53 --- /dev/null +++ b/libssh2-ocloexec.patch @@ -0,0 +1,62 @@ +From 33a59a1905feb5d786e9d457f287dd9e81a9f747 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= +Date: Tue, 27 Dec 2011 00:33:28 -0300 +Subject: [PATCH] Use O_CLOEXEC where needed + +--- + src/agent.c | 2 +- + src/knownhost.c | 4 ++-- + src/userauth.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/agent.c b/src/agent.c +index 5a9e81c..af939a1 100644 +--- a/src/agent.c ++++ b/src/agent.c +@@ -152,7 +152,7 @@ agent_connect_unix(LIBSSH2_AGENT *agent) + return _libssh2_error(agent->session, LIBSSH2_ERROR_BAD_USE, + "no auth sock variable"); + +- agent->fd = socket(PF_UNIX, SOCK_STREAM, 0); ++ agent->fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); + if (agent->fd < 0) + return _libssh2_error(agent->session, LIBSSH2_ERROR_BAD_SOCKET, + "failed creating socket"); +diff --git a/src/knownhost.c b/src/knownhost.c +index 193bda3..418c08a 100644 +--- a/src/knownhost.c ++++ b/src/knownhost.c +@@ -907,7 +907,7 @@ libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts, + "Unsupported type of known-host information " + "store"); + +- file = fopen(filename, "r"); ++ file = fopen(filename, "re"); + if(file) { + while(fgets(buf, sizeof(buf), file)) { + if(libssh2_knownhost_readline(hosts, buf, strlen(buf), type)) +@@ -1079,7 +1079,7 @@ libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts, + "Unsupported type of known-host information " + "store"); + +- file = fopen(filename, "w"); ++ file = fopen(filename, "we"); + if(!file) + return _libssh2_error(hosts->session, LIBSSH2_ERROR_FILE, + "Failed to open file"); +diff --git a/src/userauth.c b/src/userauth.c +index 3fcb200..0f48a1d 100644 +--- a/src/userauth.c ++++ b/src/userauth.c +@@ -467,7 +467,7 @@ file_read_publickey(LIBSSH2_SESSION * session, unsigned char **method, + _libssh2_debug(session, LIBSSH2_TRACE_AUTH, "Loading public key file: %s", + pubkeyfile); + /* Read Public Key */ +- fd = fopen(pubkeyfile, "r"); ++ fd = fopen(pubkeyfile, "re"); + if (!fd) { + return _libssh2_error(session, LIBSSH2_ERROR_FILE, + "Unable to open public key file"); +-- +1.7.7 + diff --git a/libssh2_org.changes b/libssh2_org.changes index d4060b7..947d6e8 100644 --- a/libssh2_org.changes +++ b/libssh2_org.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Tue Dec 27 03:41:32 UTC 2011 - crrodriguez@opensuse.org + +- Refresh patches. + +------------------------------------------------------------------- +Thu Dec 1 03:41:02 UTC 2011 - jengelh@medozas.de + +- Remove redundant/unwanted tags/section (cf. specfile guidelines) + +------------------------------------------------------------------- +Thu Dec 1 02:43:46 UTC 2011 - crrodriguez@opensuse.org + +- open library file descriptors with O_CLOEXEC + ------------------------------------------------------------------- Fri Oct 21 18:15:49 UTC 2011 - crrodriguez@opensuse.org diff --git a/libssh2_org.spec b/libssh2_org.spec index 053c4f0..7f83d2e 100644 --- a/libssh2_org.spec +++ b/libssh2_org.spec @@ -33,6 +33,7 @@ BuildRequires: zlib-devel #for the test suite BuildRequires: openssh BuildRoot: %{_tmppath}/%{name}-%{version}-build +Patch: libssh2-ocloexec.patch %description libssh2 is a library implementing the SSH2 protocol as defined by @@ -40,10 +41,7 @@ Internet Drafts: SECSH-TRANS, SECSH-USERAUTH, SECSH-CONNECTION, SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS, and SECSH-PUBLICKEY. -%define debug_package_requires libssh2-1 = %{version}-%{release} - %package -n libssh2-1 -License: BSD3c Summary: A library implementing the SSH2 protocol Group: Development/Libraries/C and C++ @@ -54,7 +52,6 @@ SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS, and SECSH-PUBLICKEY. %package -n libssh2-devel -License: BSD3c Summary: A library implementing the SSH2 protocol Group: Development/Libraries/C and C++ Requires: glibc-devel @@ -68,6 +65,7 @@ SECSH-PUBLICKEY. %prep %setup -q -n %{pkg_name}-%{version} +%patch -p1 %build export CFLAGS="%optflags -DOPENSSL_LOAD_CONF" @@ -87,9 +85,6 @@ rm -f %{buildroot}%{_libdir}/*.la make check %endif -%clean -rm -rf %{buildroot} - %post -n libssh2-1 -p /sbin/ldconfig %postun -n libssh2-1 -p /sbin/ldconfig