The branch, master has been updated
       via  cdc071a Bump version to 1.3.4
       via  ce05a82 swrap: Fix a TOCTOU issue in swrap_auto_bind()
      from  2e64ad0 gitlab-ci: Introduce stages

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


- Log -----------------------------------------------------------------
commit cdc071a1e7438143c6c75af123821b8672d05b8c
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Jul 21 14:48:02 2022 +0200

    Bump version to 1.3.4
    
    Reviewed-by: Stefan Metzmacher <me...@samba.org>

commit ce05a8276792a888802829c8a90d8b66a3edd1bf
Author: Andreas Schneider <a...@samba.org>
Date:   Thu Jul 21 07:22:08 2022 +0200

    swrap: Fix a TOCTOU issue in swrap_auto_bind()
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Stefan Metzmacher <me...@samba.org>

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

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


Changeset truncated at 500 lines:

diff --git a/CHANGELOG b/CHANGELOG
index ed579e2..8c29ec1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
 ChangeLog
 ==========
 
+version 1.3.4 (released 2022-07-21)
+  * Fixed TOCTOU issue with udp auto binding
+  * Fixed running on FreeBSD
+
 version 1.3.3 (released 2021-03-17)
   * Added public libsocket_wrapper_noop library
   * Added wrapper for wrap __close_nocancel()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc6a786..c6a34b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
 cmake_minimum_required(VERSION 3.5.0)
 cmake_policy(SET CMP0048 NEW)
 
-# Specify search path for CMake modules to be loaded by include() 
+# Specify search path for CMake modules to be loaded by include()
 # and find_package()
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
 
@@ -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.3 LANGUAGES C)
+project(socket_wrapper VERSION 1.3.4 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 0)
+set(LIBRARY_VERSION_PATCH 1)
 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 ef87519..5804e93 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -3815,7 +3815,6 @@ static int swrap_auto_bind(int fd, struct socket_info 
*si, int family)
        char type;
        int ret;
        int port;
-       struct stat st;
        char *swrap_dir = NULL;
 
        swrap_mutex_lock(&autobind_start_mutex);
@@ -3916,10 +3915,12 @@ static int swrap_auto_bind(int fd, struct socket_info 
*si, int family)
                              type,
                              socket_wrapper_default_iface(),
                              port);
-               if (stat(un_addr.sa.un.sun_path, &st) == 0) continue;
 
                ret = libc_bind(fd, &un_addr.sa.s, un_addr.sa_socklen);
                if (ret == -1) {
+                       if (errno == EALREADY || errno == EADDRINUSE) {
+                               continue;
+                       }
                        goto done;
                }
 


-- 
Socket Wrapper Repository

Reply via email to