The branch, master has been updated
       via  22edd69503f smbd: improve reinit_after_fork error handling
      from  ecb8a99a2c7 smbd: use metadata_fsp(fsp) in copy_access_posix_acl() 
for SMB_VFS_SYS_ACL_SET_FD

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


- Log -----------------------------------------------------------------
commit 22edd69503fc5985cd85160ddae7b57e64296a1e
Author: David Disseldorp <dd...@samba.org>
Date:   Wed Sep 4 02:54:09 2024 +0000

    smbd: improve reinit_after_fork error handling
    
    reinit_after_fork() may panic or return an error on failure. When smbd
    is started in interactive mode, it ignores the reinit_after_fork()
    return status and unconditionally proceeds to smbd_process().
    
    Similarly, if messaging_reinit() fails within reinit_after_fork() then
    it will subsequently call ctdb_async_ctx_reinit() if clustering is
    enabled.
    
    There's no reason why these errors shouldn't be handled immediately, so
    add appropriate error handling.
    
    Found by code inspection; not seen in the wild.
    
    Signed-off-by: David Disseldorp <dd...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>
    
    Autobuild-User(master): David Disseldorp <dd...@samba.org>
    Autobuild-Date(master): Wed Sep  4 09:53:01 UTC 2024 on atb-devel-224

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

Summary of changes:
 source3/lib/util.c    | 1 +
 source3/smbd/server.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/util.c b/source3/lib/util.c
index 5561aa815ce..2e7cf649ebe 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -482,6 +482,7 @@ NTSTATUS reinit_after_fork(struct messaging_context 
*msg_ctx,
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0,("messaging_reinit() failed: %s\n",
                                 nt_errstr(status)));
+                       goto done;
                }
 
                if (lp_clustering()) {
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index e9ba7be9166..b43d654d6a5 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -976,7 +976,13 @@ static void smbd_accept_connection(struct tevent_context 
*ev,
        smb_set_close_on_exec(fd);
 
        if (s->parent->interactive) {
-               reinit_after_fork(msg_ctx, ev, true);
+               NTSTATUS status;
+
+               status = reinit_after_fork(msg_ctx, ev, true);
+               if (!NT_STATUS_IS_OK(status)) {
+                       exit_server("reinit_after_fork() failed");
+                       return;
+               }
                smbd_process(ev, msg_ctx, fd, true);
                exit_server_cleanly("end of interactive mode");
                return;


-- 
Samba Shared Repository

Reply via email to