[SCM] Socket Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Thu Nov 24 09:27:07 UTC 2022


The branch, master has been updated
       via  f88fe92 Bump version to 1.3.5
       via  c562535 socket_wrapper: inject O_LARGEFILE to open[64|at]() if needed
       via  f0a511f Avoid dclose(RTLD_NEXT)
      from  6854835 pkgconfig: Fix path to libsocket_wrapper.so

https://git.samba.org/?p=socket_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f88fe92249b156d90ecff78d3a5ef0e5bbcaa6b0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Nov 23 12:12:12 2022 +0100

    Bump version to 1.3.5
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit c562535f1efef204f553ed793cfd9c7efada8b3f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Nov 23 11:46:45 2022 +0100

    socket_wrapper: inject O_LARGEFILE to open[64|at]() if needed
    
    On 32bit systems this is normally done by glibc if _FILE_OFFSET_BITS is 64,
    but with socket wrapper we don't want to define _FILE_OFFSET_BITS=64,
    as we need to overload open64 explicitly. But we need to inject
    O_LARGEFILE for being transparent to the application.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15251
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit f0a511f6a4b60b63efcf0ddeec889672bd6d6a76
Author: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date:   Thu Nov 10 18:36:29 2022 +0000

    Avoid dclose(RTLD_NEXT)
    
    In case the libc was not found and RTLD_NEXT is used instead, we should not
    dlclose it, otherwise mayhem happens.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15228
    
    Signed-off-by: Samuel Thibault <samuel.thibault at ens-lyon.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 CHANGELOG            |  6 ++++++
 CMakeLists.txt       |  4 ++--
 src/socket_wrapper.c | 31 +++++++++++++++++++++++++++++--
 3 files changed, 37 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CHANGELOG b/CHANGELOG
index 8c29ec1..31954d6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,12 @@
 ChangeLog
 ==========
 
+version 1.3.5 (released 2022-11-23)
+  * Inject O_LARGEFILE as needed on 32bit
+  * pkgconfig: Fix path to libsocket_wrapper.so
+  * Fix -Wcast-qual warnings
+  * Fix dclose(RTLD_NEXT)
+
 version 1.3.4 (released 2022-07-21)
   * Fixed TOCTOU issue with udp auto binding
   * Fixed running on FreeBSD
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6a34b0..8a0c129 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
 include(DefineCMakeDefaults)
 include(DefineCompilerFlags)
 
-project(socket_wrapper VERSION 1.3.4 LANGUAGES C)
+project(socket_wrapper VERSION 1.3.5 LANGUAGES C)
 
 # global needed variables
 set(APPLICATION_NAME ${PROJECT_NAME})
@@ -25,7 +25,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 #     Increment PATCH.
 set(LIBRARY_VERSION_MAJOR 0)
 set(LIBRARY_VERSION_MINOR 3)
-set(LIBRARY_VERSION_PATCH 1)
+set(LIBRARY_VERSION_PATCH 2)
 set(LIBRARY_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}")
 set(LIBRARY_SOVERSION ${LIBRARY_VERSION_MAJOR})
 
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index ec8321f..bedda07 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -984,6 +984,19 @@ static FILE *libc_fopen64(const char *name, const char *mode)
 }
 #endif /* HAVE_FOPEN64 */
 
+static void swrap_inject_o_largefile(int *flags)
+{
+	(void)*flags; /* maybe unused */
+#if SIZE_MAX == 0xffffffffUL && defined(O_LARGEFILE)
+#ifdef O_PATH
+	if (((*flags) & O_PATH) == 0)
+#endif
+	{
+		*flags |= O_LARGEFILE;
+	}
+#endif
+}
+
 static int libc_vopen(const char *pathname, int flags, va_list ap)
 {
 	int mode = 0;
@@ -991,6 +1004,8 @@ static int libc_vopen(const char *pathname, int flags, va_list ap)
 
 	swrap_bind_symbol_all();
 
+	swrap_inject_o_largefile(&flags);
+
 	if (flags & O_CREAT) {
 		mode = va_arg(ap, int);
 	}
@@ -1019,6 +1034,8 @@ static int libc_vopen64(const char *pathname, int flags, va_list ap)
 
 	swrap_bind_symbol_all();
 
+	swrap_inject_o_largefile(&flags);
+
 	if (flags & O_CREAT) {
 		mode = va_arg(ap, int);
 	}
@@ -1035,6 +1052,8 @@ static int libc_vopenat(int dirfd, const char *path, int flags, va_list ap)
 
 	swrap_bind_symbol_all();
 
+	swrap_inject_o_largefile(&flags);
+
 	if (flags & O_CREAT) {
 		mode = va_arg(ap, int);
 	}
@@ -7831,10 +7850,18 @@ void swrap_destructor(void)
 
 	SAFE_FREE(sockets);
 
-	if (swrap.libc.handle != NULL) {
+	if (swrap.libc.handle != NULL
+#ifdef RTLD_NEXT
+	    && swrap.libc.handle != RTLD_NEXT
+#endif
+			) {
 		dlclose(swrap.libc.handle);
 	}
-	if (swrap.libc.socket_handle) {
+	if (swrap.libc.socket_handle
+#ifdef RTLD_NEXT
+	    && swrap.libc.socket_handle != RTLD_NEXT
+#endif
+			) {
 		dlclose(swrap.libc.socket_handle);
 	}
 }


-- 
Socket Wrapper Repository



More information about the samba-cvs mailing list