From 73e5b41339193e7760445ebce0b274859cbe6d4bdbefea630cdc23ee6d96e471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Thu, 1 Dec 2011 02:46:12 +0000 Subject: [PATCH 1/3] Accepting request 94640 from home:elvigia:branches:devel:libraries:c_c++ - open library file descriptors with O_CLOEXEC OBS-URL: https://build.opensuse.org/request/show/94640 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libssh2_org?expand=0&rev=34 --- libssh2-ocloexec.patch | 61 ++++++++++++++++++++++++++++++++++++++++++ libssh2_org.changes | 5 ++++ libssh2_org.spec | 2 ++ 3 files changed, 68 insertions(+) create mode 100644 libssh2-ocloexec.patch diff --git a/libssh2-ocloexec.patch b/libssh2-ocloexec.patch new file mode 100644 index 0000000..5f50f95 --- /dev/null +++ b/libssh2-ocloexec.patch @@ -0,0 +1,61 @@ +diff --git a/src/agent.c b/src/agent.c +index 5a9e81c..989b7ec 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 d90f1d4..8862c58 100644 +--- a/src/knownhost.c ++++ b/src/knownhost.c +@@ -905,7 +905,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)) +@@ -1077,7 +1077,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 d74c0c8..7e8efb6 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"); +diff --git a/tests/ssh2.c b/tests/ssh2.c +index e09ba8a..9469970 100644 +--- a/tests/ssh2.c ++++ b/tests/ssh2.c +@@ -64,7 +64,7 @@ int main(int argc, char *argv[]) + + hostaddr = htonl(0x7F000001); + +- sock = socket(AF_INET, SOCK_STREAM, 0); ++ sock = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); + #ifndef WIN32 + fcntl(sock, F_SETFL, 0); + #endif diff --git a/libssh2_org.changes b/libssh2_org.changes index d4060b7..c3ee3f9 100644 --- a/libssh2_org.changes +++ b/libssh2_org.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +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..a3dcd69 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 @@ -68,6 +69,7 @@ SECSH-PUBLICKEY. %prep %setup -q -n %{pkg_name}-%{version} +%patch -p1 %build export CFLAGS="%optflags -DOPENSSL_LOAD_CONF" From f5a95ea363550cd753e5cb93d97bc57b8ce1e354813eb00f993d2dc0a19ac08d Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 1 Dec 2011 03:42:14 +0000 Subject: [PATCH 2/3] Remove redundant/unwanted tags/section (cf. specfile guidelines) OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libssh2_org?expand=0&rev=35 --- libssh2_org.changes | 5 +++++ libssh2_org.spec | 9 +-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libssh2_org.changes b/libssh2_org.changes index c3ee3f9..ba12a11 100644 --- a/libssh2_org.changes +++ b/libssh2_org.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +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 diff --git a/libssh2_org.spec b/libssh2_org.spec index a3dcd69..ab03ce5 100644 --- a/libssh2_org.spec +++ b/libssh2_org.spec @@ -22,7 +22,7 @@ Name: libssh2_org Version: 1.3.0 Release: 3 License: BSD3c -Url: http://www.libssh2.org/ +URL: http://www.libssh2.org/ %define pkg_name libssh2 Group: Development/Libraries/C and C++ Source: http://heanet.dl.sourceforge.net/sourceforge/libssh2/%{pkg_name}-%{version}.tar.bz2 @@ -41,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++ @@ -55,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 @@ -89,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 From 87203238c9d7360b0e2b051d176848afd8ee1b7850944901030b99c8aec44d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Tue, 27 Dec 2011 04:11:19 +0000 Subject: [PATCH 3/3] Accepting request 98259 from home:elvigia:branches:devel:libraries:c_c++ - Refresh patches. OBS-URL: https://build.opensuse.org/request/show/98259 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libssh2_org?expand=0&rev=36 --- libssh2-ocloexec.patch | 39 ++++++++++++++++++++------------------- libssh2_org.changes | 5 +++++ libssh2_org.spec | 2 +- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/libssh2-ocloexec.patch b/libssh2-ocloexec.patch index 5f50f95..2cfad53 100644 --- a/libssh2-ocloexec.patch +++ b/libssh2-ocloexec.patch @@ -1,5 +1,16 @@ +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..989b7ec 100644 +index 5a9e81c..af939a1 100644 --- a/src/agent.c +++ b/src/agent.c @@ -152,7 +152,7 @@ agent_connect_unix(LIBSSH2_AGENT *agent) @@ -7,15 +18,15 @@ index 5a9e81c..989b7ec 100644 "no auth sock variable"); - agent->fd = socket(PF_UNIX, SOCK_STREAM, 0); -+ agent->fd = socket(PF_UNIX, SOCK_STREAM| SOCK_CLOEXEC, 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 d90f1d4..8862c58 100644 +index 193bda3..418c08a 100644 --- a/src/knownhost.c +++ b/src/knownhost.c -@@ -905,7 +905,7 @@ libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts, +@@ -907,7 +907,7 @@ libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts, "Unsupported type of known-host information " "store"); @@ -24,7 +35,7 @@ index d90f1d4..8862c58 100644 if(file) { while(fgets(buf, sizeof(buf), file)) { if(libssh2_knownhost_readline(hosts, buf, strlen(buf), type)) -@@ -1077,7 +1077,7 @@ libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts, +@@ -1079,7 +1079,7 @@ libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts, "Unsupported type of known-host information " "store"); @@ -34,7 +45,7 @@ index d90f1d4..8862c58 100644 return _libssh2_error(hosts->session, LIBSSH2_ERROR_FILE, "Failed to open file"); diff --git a/src/userauth.c b/src/userauth.c -index d74c0c8..7e8efb6 100644 +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, @@ -46,16 +57,6 @@ index d74c0c8..7e8efb6 100644 if (!fd) { return _libssh2_error(session, LIBSSH2_ERROR_FILE, "Unable to open public key file"); -diff --git a/tests/ssh2.c b/tests/ssh2.c -index e09ba8a..9469970 100644 ---- a/tests/ssh2.c -+++ b/tests/ssh2.c -@@ -64,7 +64,7 @@ int main(int argc, char *argv[]) - - hostaddr = htonl(0x7F000001); - -- sock = socket(AF_INET, SOCK_STREAM, 0); -+ sock = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); - #ifndef WIN32 - fcntl(sock, F_SETFL, 0); - #endif +-- +1.7.7 + diff --git a/libssh2_org.changes b/libssh2_org.changes index ba12a11..947d6e8 100644 --- a/libssh2_org.changes +++ b/libssh2_org.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Dec 27 03:41:32 UTC 2011 - crrodriguez@opensuse.org + +- Refresh patches. + ------------------------------------------------------------------- Thu Dec 1 03:41:02 UTC 2011 - jengelh@medozas.de diff --git a/libssh2_org.spec b/libssh2_org.spec index ab03ce5..7f83d2e 100644 --- a/libssh2_org.spec +++ b/libssh2_org.spec @@ -22,7 +22,7 @@ Name: libssh2_org Version: 1.3.0 Release: 3 License: BSD3c -URL: http://www.libssh2.org/ +Url: http://www.libssh2.org/ %define pkg_name libssh2 Group: Development/Libraries/C and C++ Source: http://heanet.dl.sourceforge.net/sourceforge/libssh2/%{pkg_name}-%{version}.tar.bz2