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 <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Sep 4 09:53:01 UTC 2024 on atb-devel-224
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("messaging_reinit() failed: %s\n",
nt_errstr(status)));
+ goto done;
}
if (lp_clustering()) {
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;