Submitted By:            Douglas R. Reno <renodr at linuxfromscratch dot org>
Date:                    2021-12-30
Initial Package Version: 1.3.9
Origin:                  Fedora Rawhide (https://src.fedoraproject.org/rpms/libserf/tree/rawhide)
Upstream Status:         Merge Request
Description:             Fixes a build error in Subversion caused by serf using
                         internal OpenSSL API functions for it's own use. Also
                         fixes a crash bug that happens due to a return value
                         being invalid.

diff -Naurp serf-1.3.9.orig/buckets/ssl_buckets.c serf-1.3.9/buckets/ssl_buckets.c
--- serf-1.3.9.orig/buckets/ssl_buckets.c	2016-06-30 10:45:07.000000000 -0500
+++ serf-1.3.9/buckets/ssl_buckets.c	2021-12-30 10:56:53.101158440 -0600
@@ -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, in
         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:
@@ -1204,6 +1205,10 @@ static void init_ssl_libraries(void)
     }
 }
 
+#ifndef ERR_GET_FUNC
+#define ERR_GET_FUNC(ec) (0)
+#endif
+
 static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
 {
     serf_ssl_context_t *ctx = SSL_get_app_data(ssl);
