mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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 <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
This commit is contained in:
parent
ecb8a99a2c
commit
22edd69503
@ -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()) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user