Compare commits

...

No commits in common. 'c9' and 'i10c-beta' have entirely different histories.

2
.gitignore vendored

@ -1 +1 @@
SOURCES/serf-1.3.9.tar.bz2
SOURCES/serf-1.3.10.tar.bz2

@ -1 +1 @@
26015c63e3bbb108c1689bf2090e4c26351db674 SOURCES/serf-1.3.9.tar.bz2
d67c209cb0161c4707ba114d1195c5ba3becfa73 SOURCES/serf-1.3.10.tar.bz2

@ -0,0 +1,60 @@
commit 821fc34e224a4e82563f0561be2e60fd1d4ec92b
Author: Tomas Korbar <tkorbar@redhat.com>
Date: Tue Nov 14 12:42:45 2023 +0100
Add gssapi linking
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f10eae..e435e29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,7 @@ option(DEBUG "Enable debugging info and strict compile warnings" OFF)
option(SKIP_SHARED "Disable building shared Serf libraries" OFF)
option(SKIP_STATIC "Disable building static Serf libraries" OFF)
option(LIBDIR "Install directory for architecture-dependent libraries" "")
-option(GSSAPI "Path to GSSAPI's install area" "")
+option(GSSAPI "Use pkg-config to link with GSSAPI" OFF)
option(BROTLI "Path to Brotli's install area" "")
option(DISABLE_LOGGING "Disable the logging framework at compile time" OFF)
option(SKIP_TESTS "Disable building the unit tests and utilities" OFF)
@@ -156,10 +156,14 @@ if(SERF_WINDOWS)
)
endif(SERF_WINDOWS)
-
# Process build options for dependency search
if(GSSAPI)
- message(WARNING "option GSSAPI is not implemented")
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(GSSAPI krb5-gssapi)
+ if (NOT GSSAPI_FOUND)
+ message(WARNING "GSSAPI pkgconfig module was not found")
+ endif()
+ add_definitions("-DSERF_HAVE_GSSAPI")
endif()
if(BROTLI)
@@ -285,6 +289,11 @@ if(NOT SKIP_SHARED)
PRIVATE ${SERF_PRIVATE_TARGETS}
${SERF_STANDARD_LIBRARIES}
PUBLIC ${SERF_PUBLIC_TARGETS})
+ if (GSSAPI_FOUND)
+ target_link_libraries(serf_shared PRIVATE ${GSSAPI_LIBRARIES})
+ target_include_directories(serf_shared PRIVATE ${GSSAPI_INCLUDE_DIRS})
+ target_compile_options(serf_shared PRIVATE ${GSSAPI_CFLAGS_OTHER})
+ endif (GSSAPI_FOUND)
set_target_properties(serf_shared PROPERTIES
VERSION ${SERF_VERSION}
SOVERSION ${SERF_SOVERSION})
@@ -307,6 +316,11 @@ if(NOT SKIP_STATIC)
${SERF_PRIVATE_TARGETS}
${SERF_PUBLIC_TARGETS}
${SERF_STANDARD_LIBRARIES})
+ if (GSSAPI_FOUND)
+ target_link_libraries(serf_shared PRIVATE ${GSSAPI_LIBRARIES})
+ target_include_directories(serf_shared PRIVATE ${GSSAPI_INCLUDE_DIRS})
+ target_compile_options(serf_shared PRIVATE ${GSSAPI_CFLAGS_OTHER})
+ endif (GSSAPI_FOUND)
list(APPEND SERF_TARGETS "serf_static")
endif()

@ -1,21 +0,0 @@
diff --git a/buckets/ssl_buckets.c b/buckets/ssl_buckets.c
index b01e5359db08..3c8b7e2a685f 100644
--- a/buckets/ssl_buckets.c
+++ b/buckets/ssl_buckets.c
@@ -407,7 +407,7 @@ static int bio_bucket_destroy(BIO *bio)
static long bio_bucket_ctrl(BIO *bio, int cmd, long num, void *ptr)
{
- long ret = 1;
+ long ret = 0;
switch (cmd) {
default:
@@ -415,6 +415,7 @@ static long bio_bucket_ctrl(BIO *bio, int cmd, long num, void *ptr)
break;
case BIO_CTRL_FLUSH:
/* At this point we can't force a flush. */
+ ret = 1;
break;
case BIO_CTRL_PUSH:
case BIO_CTRL_POP:

@ -0,0 +1,132 @@
commit 9f03432308609644d633ed79aaa17bcf19b6060e
Author: Tomas Korbar <tkorbar@redhat.com>
Date: Fri Jan 27 14:01:11 2023 +0100
Fix connection to multihome servers
When libserfs connection is rejected, epoll socket receives EPOLLHUP
and its handling has to be suspended if the connection was never
set up, so we can check another address if the target server
is located on more ip addresses.
diff --git a/outgoing.c b/outgoing.c
index 5f5f6b5..313b6c9 100644
--- a/outgoing.c
+++ b/outgoing.c
@@ -153,6 +153,11 @@ apr_status_t serf__conn_update_pollset(serf_connection_t *conn)
/* Now put it back in with the correct read/write values. */
desc.reqevents = APR_POLLHUP | APR_POLLERR;
+
+ if (conn->wait_for_connect) {
+ desc.reqevents |= APR_POLLOUT;
+ }
+
if (conn->requests &&
conn->state != SERF_CONN_INIT) {
/* If there are any outstanding events, then we want to read. */
@@ -391,6 +396,9 @@ apr_status_t serf__open_connections(serf_context_t *ctx)
if (status != APR_SUCCESS) {
if (!APR_STATUS_IS_EINPROGRESS(status))
return status;
+
+ /* Keep track of when we really connect */
+ conn->wait_for_connect = true;
}
/* Flag our pollset as dirty now that we have a new socket. */
@@ -1253,7 +1261,7 @@ apr_status_t serf__process_connection(serf_connection_t *conn,
* the like sitting on the connection, we give the app a chance to read
* it before we trigger a reset condition.
*/
- if ((events & APR_POLLIN) != 0) {
+ if ((events & APR_POLLIN) != 0 && !conn->wait_for_connect) {
if ((status = read_from_connection(conn)) != APR_SUCCESS)
return status;
@@ -1264,7 +1272,13 @@ apr_status_t serf__process_connection(serf_connection_t *conn,
return APR_SUCCESS;
}
}
- if ((events & APR_POLLHUP) != 0) {
+ /*
+ * Since new connection which is refused also creates HUP event,
+ * we need to suppress its handling until we are sure that connection
+ * was established, so we can eventually handle denial of connection
+ * by trying different server
+ */
+ if ((events & APR_POLLHUP) != 0 && !conn->wait_for_connect) {
/* The connection got reset by the server. On Windows this can happen
when all data is read, so just cleanup the connection and open
a new one.
@@ -1292,11 +1306,16 @@ apr_status_t serf__process_connection(serf_connection_t *conn,
{
apr_os_sock_t osskt;
if (!apr_os_sock_get(&osskt, conn->skt)) {
- int error;
+ int error = 0;
+ int rv;
apr_socklen_t l = sizeof(error);
- if (!getsockopt(osskt, SOL_SOCKET, SO_ERROR, (char*)&error,
- &l)) {
+ rv = getsockopt(osskt, SOL_SOCKET, SO_ERROR, (char*)&error, &l);
+ /* The error is placed in errno on Solaris for SO_ERROR */
+ if(rv)
+ error = errno;
+
+ if (error) {
status = APR_FROM_OS_ERROR(error);
/* Handle fallback for multi-homed servers.
@@ -1310,7 +1329,8 @@ apr_status_t serf__process_connection(serf_connection_t *conn,
&& conn->address->next != NULL
&& (APR_STATUS_IS_ECONNREFUSED(status)
|| APR_STATUS_IS_TIMEUP(status)
- || APR_STATUS_IS_ENETUNREACH(status))) {
+ || APR_STATUS_IS_ENETUNREACH(status)
+ || APR_STATUS_IS_EHOSTUNREACH(status))) {
conn->address = conn->address->next;
return reset_connection(conn, 1);
@@ -1324,6 +1344,8 @@ apr_status_t serf__process_connection(serf_connection_t *conn,
return APR_EGENERAL;
}
if ((events & APR_POLLOUT) != 0) {
+ if (conn->wait_for_connect)
+ conn->wait_for_connect = false;
if ((status = write_to_connection(conn)) != APR_SUCCESS)
return status;
}
@@ -1358,6 +1380,7 @@ serf_connection_t *serf_connection_create(
conn->baton.u.conn = conn;
conn->hit_eof = 0;
conn->state = SERF_CONN_INIT;
+ conn->wait_for_connect = false;
conn->latency = -1; /* unknown */
/* Create a subpool for our connection. */
diff --git a/serf_private.h b/serf_private.h
index f906379..b2da7df 100644
--- a/serf_private.h
+++ b/serf_private.h
@@ -21,6 +21,8 @@
#ifndef _SERF_PRIVATE_H_
#define _SERF_PRIVATE_H_
+#include <stdbool.h>
+
/* ### what the hell? why does the APR interface have a "size" ??
### the implication is that, if we bust this limit, we'd need to
### stop, rebuild a pollset, and repopulate it. what suckage. */
@@ -284,6 +286,10 @@ struct serf_connection_t {
/* Calculated connection latency. Negative value if latency is unknown. */
apr_interval_time_t latency;
+ /* Wait for connect: connect() returned APR_EINPROGRESS.
+ Socket not usable yet */
+ bool wait_for_connect;
+
/* Needs to read first before we can write again. */
int stop_writing;
};

@ -1,60 +0,0 @@
diff -up serf-1.3.9/SConstruct.python3 serf-1.3.9/SConstruct
--- serf-1.3.9/SConstruct.python3 2018-07-02 17:21:47.331685070 +0200
+++ serf-1.3.9/SConstruct 2018-07-02 17:27:12.316413515 +0200
@@ -20,6 +20,8 @@
# ====================================================================
#
+from __future__ import print_function
+
import sys
import os
import re
@@ -166,7 +168,7 @@ env.Append(BUILDERS = {
match = re.search('SERF_MAJOR_VERSION ([0-9]+).*'
'SERF_MINOR_VERSION ([0-9]+).*'
'SERF_PATCH_VERSION ([0-9]+)',
- env.File('serf.h').get_contents(),
+ env.File('serf.h').get_contents().decode('utf-8'),
re.DOTALL)
MAJOR, MINOR, PATCH = [int(x) for x in match.groups()]
env.Append(MAJOR=str(MAJOR))
@@ -183,7 +185,7 @@ CALLOUT_OKAY = not (env.GetOption('clean
unknown = opts.UnknownVariables()
if unknown:
- print 'Warning: Used unknown variables:', ', '.join(unknown.keys())
+ print('Warning: Used unknown variables:', ', '.join(unknown.keys()))
apr = str(env['APR'])
apu = str(env['APU'])
diff -uap serf-1.3.9/build/check.py.python3 serf-1.3.9/build/check.py
--- serf-1.3.9/build/check.py.python3 2015-09-17 13:46:24.000000000 +0100
+++ serf-1.3.9/build/check.py 2018-12-17 11:40:06.524901129 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
# check.py : Run all the test cases.
#
@@ -52,16 +52,16 @@ if __name__ == '__main__':
# Find test responses and run them one by one
for case in glob.glob(testdir + "/testcases/*.response"):
- print "== Testing %s ==" % (case)
+ print("== Testing %s ==" % (case))
try:
subprocess.check_call([SERF_RESPONSE_EXE, case])
except subprocess.CalledProcessError:
- print "ERROR: test case %s failed" % (case)
+ print("ERROR: test case %s failed" % (case))
sys.exit(1)
- print "== Running the unit tests =="
+ print("== Running the unit tests ==")
try:
subprocess.check_call(TEST_ALL_EXE)
except subprocess.CalledProcessError:
- print "ERROR: test(s) failed in test_all"
+ print("ERROR: test(s) failed in test_all")
sys.exit(1)

@ -1,20 +1,21 @@
Name: libserf
Version: 1.3.9
Release: 26%{?dist}
Version: 1.3.10
Release: 6%{?dist}
Summary: High-Performance Asynchronous HTTP Client Library
License: ASL 2.0
License: Apache-2.0
URL: http://serf.apache.org/
Source0: https://archive.apache.org/dist/serf/serf-%{version}.tar.bz2
BuildRequires: gcc, pkgconfig
BuildRequires: apr-devel, apr-util-devel, krb5-devel, openssl-devel
BuildRequires: zlib-devel, cmake
%ifnarch %ix86
BuildRequires: openssl, libfaketime
%endif
Patch0: %{name}-norpath.patch
Patch1: %{name}-python3.patch
Patch2: %{name}-1.3.9-cmake.patch
Patch3: %{name}-1.3.9-errgetfunc.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2004714
# Patch BIO to work with openssl 3
Patch4: %{name}-1.3.9-bio-ctrl.patch
Patch1: %{name}-1.3.9-errgetfunc.patch
Patch2: %{name}-1.3.9-multihome.patch
Patch3: %{name}-1.3.9-cmake.patch
Patch4: %{name}-1.3.10-gssapi.patch
%description
The serf library is a C-based HTTP client library built upon the Apache
@ -33,21 +34,35 @@ developing applications that use %{name}.
%prep
%autosetup -n serf-%{version} -p1
%ifnarch %ix86
pushd test/server
openssl req -x509 -newkey rsa:2048 -keyout serfrootcacert.pem -out serfrootcacert.pem -sha256 -days 3650 -nodes -subj "/C=BE/ST=Antwerp/L=Mechelen/O=In Serf we trust, Inc./OU=Test Suite Root CA/CN=Serf Root CA/emailAddress=serfrootca@example.com"
openssl req -x509 -newkey rsa:2048 -keyout serfcacert.pem -out serfcacert.pem -sha256 -days 3650 -nodes -subj "/C=BE/ST=Antwerp/L=Mechelen/O=In Serf we trust, Inc./OU=Test Suite CA/CN=Serf CA/emailAddress=serfca@example.com" -CA serfrootcacert.pem -CAkey serfrootcacert.pem
openssl req -x509 -newkey rsa:2048 -keyout serfserverkey.pem -out serfservercert.pem -sha256 -days 3650 -subj "/C=BE/ST=Antwerp/L=Mechelen/O=In Serf we trust, Inc./OU=Test Suite Server/CN=localhost/emailAddress=serfserver@example.com" -CA serfcacert.pem -CAkey serfcacert.pem -passout pass:serftest
faketime '2050-12-24 08:15:42' openssl req -x509 -out serfserver_future_cert.pem -subj "/C=BE/ST=Antwerp/L=Mechelen/O=In Serf we trust, Inc./OU=Test Suite Server/CN=localhost/emailAddress=serfserver@example.com" -CA serfcacert.pem -CAkey serfcacert.pem -key serfserverkey.pem -days 30 -passout pass:serftest -passin pass:serftest
faketime '1990-12-24 08:15:42' openssl req -x509 -out serfserver_expired_cert.pem -subj "/C=BE/ST=Antwerp/L=Mechelen/O=In Serf we trust, Inc./OU=Test Suite Server/CN=localhost/emailAddress=serfserver@example.com" -CA serfcacert.pem -CAkey serfcacert.pem -key serfserverkey.pem -days 30 -passout pass:serftest -passin pass:serftest
openssl req -x509 -newkey rsa:2048 -keyout serfclientkey.pem -out serfclientcert.pem -sha256 -days 3650 --CA serfcacert.pem --CAkey serfcacert.pem -subj "/C=BE/ST=Antwerp/L=Mechelen/O=In Serf we trust, Inc./OU=Test Suite Client/CN=Serf Client/emailAddress=serfclient@example.com" --nodes
openssl pkcs12 -export -in serfclientcert.pem -inkey serfclientkey.pem -out serfclientcert.p12 -passout pass:serftest
popd
%endif
%build
%cmake -DCMAKE_INSTALL_LIBDIR=%{_libdir}
%cmake -DCMAKE_INSTALL_LIBDIR=%{_libdir} -DGSSAPI=ON -DSKIP_STATIC=ON
%cmake_build
%install
%cmake_install
find %{buildroot}%{_libdir} -type f -name '*.*a' -delete -print
mkdir -p %{buildroot}%{_libdir}/pkgconfig
mv %{buildroot}%{_datadir}/pkgconfig/serf.pc %{buildroot}%{_libdir}/pkgconfig/serf.pc
rm -rf %{buildroot}%{_datadir}
%check
%ctest || true
%ifnarch %ix86
%ctest
%else
true
%endif
%ldconfig_scriptlets
@ -62,35 +77,60 @@ rm -rf %{buildroot}%{_datadir}
%{_libdir}/pkgconfig/serf*.pc
%changelog
* Fri Sep 17 2021 Tomas Korbar <tkorbar@redhat.com> - 1.3.9-26
- Fix BIO control function implementation
- Resolves: rhbz#2004714
* Tue Nov 26 2024 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 1.3.10-6
- Rebuilt for MSVSphere 10
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.3.9-25
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.3.10-6
- Bump release for June 2024 mass rebuild
* Mon Aug 9 2021 Joe Orton <jorton@redhat.com> - 1.3.9-24
- fix FTBFS with OpenSSL 3.0 beta 2 (#1991008)
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.10-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jun 30 2021 Tomas Korbar <tkorbar@redhat.com> - 1.3.9-23
- Fix soname problems
- Related: rhbz#1974621
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jun 30 2021 Tomas Korbar <tkorbar@redhat.com> - 1.3.9-22
- Remove scons from build requirements
- Related: rhbz#1974621
* Thu Dec 07 2023 Tomas Korbar <tkorbar@redhat.com> - 1.3.10-3
- Add linking of gssapi to support Kerberos authentication
- Resolves: rhbz#2245095
* Wed Jun 30 2021 Tomas Korbar <tkorbar@redhat.com> - 1.3.9-21
- Backport cmake support
- Resolves: rhbz#1974621
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.3.9-20
- Rebuilt for RHEL 9 BETA for openssl 3.0
Related: rhbz#1971065
* Tue Jun 06 2023 Tomas Korbar <tkorbar@redhat.com> - 1.3.10-1
- Update to 1.3.10
- Resolves: rhbz#2211498
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.3.9-19
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Sun Mar 12 2023 Tomas Korbar <tkorbar@redhat.com> - 1.3.9-28
- Change the License tag to the SPDX format
* Mon Feb 06 2023 Tomas Korbar <tkorbar@redhat.com> - 1.3.9-27
- Fix testsuite
- Resolves: rhbz#2166252
* Tue Jan 31 2023 Tomas Korbar <tkorbar@redhat.com> - 1.3.9-26
- Fix multihome server handling and backport cmake support
- Related: rhbz#1130328
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.9-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.9-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.9-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Oct 4 2021 Joe Orton <jorton@redhat.com> - 1.3.9-22
- fix build with OpenSSL 3.0
* Mon Sep 20 2021 Tomas Korbar <tkorbar@redhat.com> - 1.3.9-21
- Fix internal BIO control function
* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com> - 1.3.9-20
- Rebuilt with OpenSSL 3.0.0
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.9-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.9-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

Loading…
Cancel
Save