[packages/ocaml-ssl] - added upstream patches, fixes compatibility with ocaml 4.04
baggins
baggins at pld-linux.org
Mon Jun 5 19:56:05 CEST 2017
commit af93ca5c1cd04c522bc2a7b53a47df8501518ba4
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Mon Jun 5 19:55:39 2017 +0200
- added upstream patches, fixes compatibility with ocaml 4.04
0001-Stalkd-example.patch | 140 +++++++++++++++++++++
0002-Remove-duplicate-declaration-of-write.patch | 35 ++++++
0003-Bump-version-number.patch | 22 ++++
0004-Remove-ansi-flag.patch | 38 ++++++
...Use-accessor-functions-for-X509_STORE_CTX.patch | 59 +++++++++
...hange-CLIBS-order-to-allow-static-linking.patch | 56 +++++++++
ocaml-ssl.spec | 14 ++-
7 files changed, 363 insertions(+), 1 deletion(-)
---
diff --git a/ocaml-ssl.spec b/ocaml-ssl.spec
index a210721..48f6983 100644
--- a/ocaml-ssl.spec
+++ b/ocaml-ssl.spec
@@ -8,6 +8,12 @@ License: LGPL + OCaml linking exception
Group: Libraries
Source0: http://downloads.sourceforge.net/savonet/%{name}-%{version}.tar.gz
# Source0-md5: 404f71d33885c985a8ff579996a5cda8
+Patch0: 0001-Stalkd-example.patch
+Patch1: 0002-Remove-duplicate-declaration-of-write.patch
+Patch2: 0003-Bump-version-number.patch
+Patch3: 0004-Remove-ansi-flag.patch
+Patch4: 0005-Use-accessor-functions-for-X509_STORE_CTX.patch
+Patch5: 0006-Change-CLIBS-order-to-allow-static-linking.patch
URL: http://savonet.sourceforge.net/
BuildRequires: ocaml >= %{ocaml_ver}
BuildRequires: ocaml-findlib
@@ -36,6 +42,12 @@ Wiązania OpenSSL do OCamla.
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
%build
%configure
@@ -61,7 +73,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc CHANGES COPYING README
+%doc CHANGES COPYING README.md
%dir %{_libdir}/ocaml/ssl
%attr(755,root,root) %{_libdir}/ocaml/stublibs/*.so
diff --git a/0001-Stalkd-example.patch b/0001-Stalkd-example.patch
new file mode 100644
index 0000000..63ecac3
--- /dev/null
+++ b/0001-Stalkd-example.patch
@@ -0,0 +1,140 @@
+From 9bbbda1c5015cc2a8ddaeae4fdc4a19f24448a9e Mon Sep 17 00:00:00 2001
+From: Samuel Mimram <smimram at gmail.com>
+Date: Mon, 23 Nov 2015 09:24:20 +0100
+Subject: [PATCH 1/6] Stalkd example.
+
+Use bytes and reindent.
+---
+ examples/stalkd.ml | 100 ++++++++++++++++++++++++++---------------------------
+ 1 file changed, 49 insertions(+), 51 deletions(-)
+
+diff --git a/examples/stalkd.ml b/examples/stalkd.ml
+index 234d2cb..21084d2 100644
+--- a/examples/stalkd.ml
++++ b/examples/stalkd.ml
+@@ -25,8 +25,6 @@
+ * @author Samuel Mimram
+ *)
+
+-(* $Id$ *)
+-
+ let certfile = ref "cert.pem"
+ let privkey = ref "privkey.pem"
+ let port = ref 9876
+@@ -39,8 +37,8 @@ let establish_threaded_server server_handler sockaddr nbconn =
+ log "establishing server";
+ let domain =
+ begin match sockaddr with
+- | Unix.ADDR_UNIX _ -> Unix.PF_UNIX
+- | Unix.ADDR_INET (_, _) -> Unix.PF_INET
++ | Unix.ADDR_UNIX _ -> Unix.PF_UNIX
++ | Unix.ADDR_INET (_, _) -> Unix.PF_INET
+ end
+ in
+ let sock = Unix.socket domain Unix.SOCK_STREAM 0 in
+@@ -51,55 +49,55 @@ let establish_threaded_server server_handler sockaddr nbconn =
+ in
+ let inet_addr = inet_addr_of_sockaddr caller in
+ let ip = Unix.string_of_inet_addr inet_addr in
+- log (Printf.sprintf "openning connection for [%s]" ip);
+- server_handler inet_addr s;
+- Ssl.shutdown s
++ log (Printf.sprintf "openning connection for [%s]" ip);
++ server_handler inet_addr s;
++ Ssl.shutdown s
+ in
+ let ctx = Ssl.create_context Ssl.SSLv23 Ssl.Server_context in
+- if !password <> "" then
+- Ssl.set_password_callback ctx (fun _ -> !password);
+- Ssl.use_certificate ctx !certfile !privkey;
+- Unix.setsockopt sock Unix.SO_REUSEADDR true;
+- Unix.bind sock sockaddr;
+- Unix.listen sock nbconn;
+- let ssl_sock = Ssl.embed_socket sock ctx in
+- while true do
+- log "listening for connections";
+- let (s, caller) = Unix.accept sock in
+- let ssl_s = Ssl.embed_socket s ctx in
+- Ssl.accept ssl_s;
+- ignore (Thread.create handle_connexion (ssl_s, caller));
+- done
++ if !password <> "" then
++ Ssl.set_password_callback ctx (fun _ -> !password);
++ Ssl.use_certificate ctx !certfile !privkey;
++ Unix.setsockopt sock Unix.SO_REUSEADDR true;
++ Unix.bind sock sockaddr;
++ Unix.listen sock nbconn;
++ (* let ssl_sock = Ssl.embed_socket sock ctx in *)
++ while true do
++ log "listening for connections";
++ let (s, caller) = Unix.accept sock in
++ let ssl_s = Ssl.embed_socket s ctx in
++ Ssl.accept ssl_s;
++ ignore (Thread.create handle_connexion (ssl_s, caller));
++ done
+
+-let _ =
++let () =
+ let bufsize = 1024 in
+- let buf = String.create bufsize in
++ let buf = Bytes.create bufsize in
+ let connected_clients = ref [] in
+- Ssl_threads.init ();
+- Ssl.init ();
+- establish_threaded_server
+- (fun addr ssl ->
+- connected_clients := (addr, ssl) :: !connected_clients;
+- log "accepted a new connection";
+- let loop = ref true in
+- while !loop
+- do
+- let l = Ssl.read ssl buf 0 bufsize in
+- let m = String.sub buf 0 l in
+- let msg = String.sub m 0 ((String.length m) - 1) in
+- log (Printf.sprintf "revceived '%s'" msg);
+- if msg = "exit" then
+- (
+- log "A client has quit";
+- connected_clients := List.filter (fun (_, s) -> s != ssl) !connected_clients;
+- Ssl.shutdown ssl;
+- loop := false
+- )
+- else
+- List.iter
+- (fun (_, s) ->
+- ignore (Ssl.output_string s m)
+- ) !connected_clients
+- done
+- )
+- (Unix.ADDR_INET(Unix.inet_addr_any, !port)) 100
++ Ssl_threads.init ();
++ Ssl.init ();
++ establish_threaded_server
++ (fun addr ssl ->
++ connected_clients := (addr, ssl) :: !connected_clients;
++ log "accepted a new connection";
++ let loop = ref true in
++ while !loop
++ do
++ let l = Ssl.read ssl buf 0 bufsize in
++ let m = Bytes.sub buf 0 l in
++ let msg = Bytes.sub m 0 ((Bytes.length m) - 1) in
++ log (Printf.sprintf "revceived '%s'" msg);
++ if msg = "exit" then
++ (
++ log "A client has quit";
++ connected_clients := List.filter (fun (_, s) -> s != ssl) !connected_clients;
++ Ssl.shutdown ssl;
++ loop := false
++ )
++ else
++ List.iter
++ (fun (_, s) ->
++ ignore (Ssl.output_string s m)
++ ) !connected_clients
++ done
++ )
++ (Unix.ADDR_INET(Unix.inet_addr_any, !port)) 100
+--
+2.9.3
+
diff --git a/0002-Remove-duplicate-declaration-of-write.patch b/0002-Remove-duplicate-declaration-of-write.patch
new file mode 100644
index 0000000..3e778f4
--- /dev/null
+++ b/0002-Remove-duplicate-declaration-of-write.patch
@@ -0,0 +1,35 @@
+From a726db8e1a66d6374eead53dbbb30a0f779cc410 Mon Sep 17 00:00:00 2001
+From: Samuel Mimram <smimram at gmail.com>
+Date: Wed, 25 May 2016 10:31:33 +0200
+Subject: [PATCH 2/6] Remove duplicate declaration of write.
+
+---
+ src/ssl.mli | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/src/ssl.mli b/src/ssl.mli
+index 4f67dd2..5776328 100644
+--- a/src/ssl.mli
++++ b/src/ssl.mli
+@@ -395,9 +395,6 @@ val file_descr_of_socket : socket -> Unix.file_descr
+ (** [read sock buf off len] receives data from a connected SSL socket. *)
+ val read : socket -> Bytes.t -> int -> int -> int
+
+-(** [write sock buf off len] sends data over a connected SSL socket. *)
+-val write : socket -> Bytes.t -> int -> int -> int
+-
+ (** [read_into_bigarray sock ba off len] receives data from a connected SSL socket.
+ This function releases the runtime while the read takes place. *)
+ val read_into_bigarray : socket -> bigarray -> int -> int -> int
+@@ -409,7 +406,7 @@ val read_into_bigarray : socket -> bigarray -> int -> int -> int
+ val read_into_bigarray_blocking : socket -> bigarray -> int -> int -> int
+
+ (** [write sock buf off len] sends data over a connected SSL socket. *)
+-val write : socket -> string -> int -> int -> int
++val write : socket -> Bytes.t -> int -> int -> int
+
+ (** [write_bigarray sock ba off len] sends data over a connected SSL socket.
+ This function releases the runtime while the read takes place.
+--
+2.9.3
+
diff --git a/0003-Bump-version-number.patch b/0003-Bump-version-number.patch
new file mode 100644
index 0000000..a6738c3
--- /dev/null
+++ b/0003-Bump-version-number.patch
@@ -0,0 +1,22 @@
+From f94658b844464945bfeef4396fc2461943b8b964 Mon Sep 17 00:00:00 2001
+From: Samuel Mimram <smimram at gmail.com>
+Date: Thu, 28 Jul 2016 10:27:30 +0200
+Subject: [PATCH 3/6] Bump version number.
+
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 853e9a0..9613001 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,4 +1,4 @@
+-AC_INIT([ocaml-ssl],[0.5.2],[savonet-users at lists.sourceforge.net])
++AC_INIT([ocaml-ssl],[0.5.3],[savonet-users at lists.sourceforge.net])
+
+ VERSION=$PACKAGE_VERSION
+ AC_MSG_RESULT([configuring $PACKAGE_STRING])
+--
+2.9.3
+
diff --git a/0004-Remove-ansi-flag.patch b/0004-Remove-ansi-flag.patch
new file mode 100644
index 0000000..39bd4bd
--- /dev/null
+++ b/0004-Remove-ansi-flag.patch
@@ -0,0 +1,38 @@
+From ceec769a0d56a7d5d78440168d4bd78e5af51d9d Mon Sep 17 00:00:00 2001
+From: Samuel Mimram <smimram at gmail.com>
+Date: Thu, 28 Jul 2016 10:28:01 +0200
+Subject: [PATCH 4/6] Remove -ansi flag.
+
+---
+ CHANGES | 4 ++++
+ src/Makefile.in | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/CHANGES b/CHANGES
+index 7b619af..7fa5ec1 100644
+--- a/CHANGES
++++ b/CHANGES
+@@ -1,3 +1,7 @@
++0.5.3 (unreleased)
++=====
++* Remove -ansi flag to be compatible with OCaml 4.04 (thanks Mark Shinwell).
++
+ 0.5.2 (2015-11-23)
+ =====
+ * Add OPENSSL_NO_SSL3 preprocessor flag to disable SSLv3 (thanks Jérémie
+diff --git a/src/Makefile.in b/src/Makefile.in
+index c32ce26..c0edfc6 100644
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -30,7 +30,7 @@ else
+ export CLIBS = crypto ssl
+ endif
+ export CC = @CC@
+-export CFLAGS = @CFLAGS@ -ansi -DCAML_NAME_SPACE -Wall
++export CFLAGS = @CFLAGS@ -DCAML_NAME_SPACE -Wall
+ export CLIBFLAGS = @LDFLAGS@
+ export CPPFLAGS = @CPPFLAGS@
+ export NO_CUSTOM = yes
+--
+2.9.3
+
diff --git a/0005-Use-accessor-functions-for-X509_STORE_CTX.patch b/0005-Use-accessor-functions-for-X509_STORE_CTX.patch
new file mode 100644
index 0000000..64776a2
--- /dev/null
+++ b/0005-Use-accessor-functions-for-X509_STORE_CTX.patch
@@ -0,0 +1,59 @@
+From e49b6a741ac7a86057acb7bdef609e67491b292e Mon Sep 17 00:00:00 2001
+From: Samuel Mimram <smimram at gmail.com>
+Date: Thu, 28 Jul 2016 12:34:31 +0200
+Subject: [PATCH 5/6] Use accessor functions for X509_STORE_CTX.
+
+---
+ CHANGES | 1 +
+ src/ssl_stubs.c | 9 +++++----
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/CHANGES b/CHANGES
+index 7fa5ec1..87bd915 100644
+--- a/CHANGES
++++ b/CHANGES
+@@ -1,6 +1,7 @@
+ 0.5.3 (unreleased)
+ =====
+ * Remove -ansi flag to be compatible with OCaml 4.04 (thanks Mark Shinwell).
++* Use accessor functions for X509_STORE_CTX.
+
+ 0.5.2 (2015-11-23)
+ =====
+diff --git a/src/ssl_stubs.c b/src/ssl_stubs.c
+index 1b175fa..e131527 100644
+--- a/src/ssl_stubs.c
++++ b/src/ssl_stubs.c
+@@ -656,7 +656,7 @@ CAMLprim value ocaml_ssl_get_cipher_name(value vcipher)
+
+ CAMLprim value ocaml_ssl_get_cipher_version(value vcipher)
+ {
+- char *version;
++ const char *version;
+ SSL_CIPHER *cipher = (SSL_CIPHER*)vcipher;
+
+ caml_enter_blocking_section();
+@@ -1228,9 +1228,9 @@ static int client_verify_callback(int ok, X509_STORE_CTX *ctx)
+ int depth, error;
+ char *xs;
+
+- depth = ctx->error_depth;
+- error = ctx->error;
+- xs = (char *)X509_STORE_CTX_get_current_cert(ctx);
++ depth = X509_STORE_CTX_get_error_depth(ctx);
++ error = X509_STORE_CTX_get_error(ctx);
++ xs = (char*)X509_STORE_CTX_get_current_cert(ctx);
+
+ subject = issuer = NULL;
+
+@@ -1339,6 +1339,7 @@ return_time:
+
+ return ok;
+ }
++
+ static DH *load_dh_param(const char *dhfile)
+ {
+ DH *ret=NULL;
+--
+2.9.3
+
diff --git a/0006-Change-CLIBS-order-to-allow-static-linking.patch b/0006-Change-CLIBS-order-to-allow-static-linking.patch
new file mode 100644
index 0000000..20388c0
--- /dev/null
+++ b/0006-Change-CLIBS-order-to-allow-static-linking.patch
@@ -0,0 +1,56 @@
+From 19de50eae439507f75d4491e4b8608ee3ac4caf3 Mon Sep 17 00:00:00 2001
+From: Samuel Mimram <smimram at gmail.com>
+Date: Thu, 3 Nov 2016 16:58:03 +0100
+Subject: [PATCH 6/6] Change CLIBS order to allow static linking
+
+Fixes #27.
+---
+ CHANGES | 1 +
+ src/Makefile.in | 4 ++--
+ src/ssl_stubs.c | 2 --
+ 3 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/CHANGES b/CHANGES
+index 87bd915..9f1ef84 100644
+--- a/CHANGES
++++ b/CHANGES
+@@ -2,6 +2,7 @@
+ =====
+ * Remove -ansi flag to be compatible with OCaml 4.04 (thanks Mark Shinwell).
+ * Use accessor functions for X509_STORE_CTX.
++* Change CLIBS order to allow static linking.
+
+ 0.5.2 (2015-11-23)
+ =====
+diff --git a/src/Makefile.in b/src/Makefile.in
+index c0edfc6..843885e 100644
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -25,9 +25,9 @@ export LIBINSTALL_FILES = $(wildcard *.mli *.cmi *.cma *.cmxa *.cmx *$(shell oca
+ export OCAMLLDFLAGS =
+ export OCAMLDOCFLAGS = -stars
+ ifeq (1, $(shell uname -s | grep -c "MINGW"))
+- export CLIBS = crypto ssl ws2_32 gdi32 crypt32
++ export CLIBS = ssl crypto ws2_32 gdi32 crypt32
+ else
+- export CLIBS = crypto ssl
++ export CLIBS = ssl crypto
+ endif
+ export CC = @CC@
+ export CFLAGS = @CFLAGS@ -DCAML_NAME_SPACE -Wall
+diff --git a/src/ssl_stubs.c b/src/ssl_stubs.c
+index e131527..fa4cbbf 100644
+--- a/src/ssl_stubs.c
++++ b/src/ssl_stubs.c
+@@ -24,8 +24,6 @@
+ * @author Samuel Mimram
+ */
+
+-/* $Id$ */
+-
+ /*
+ * WARNING: because of thread callbacks, all ssl functions should be in
+ * blocking sections.
+--
+2.9.3
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/ocaml-ssl.git/commitdiff/af93ca5c1cd04c522bc2a7b53a47df8501518ba4
More information about the pld-cvs-commit
mailing list