1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

s4: install tevent tracing hooks to trigger logfile rotation

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14248

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme
2020-11-26 14:21:58 +01:00
committed by Jeremy Allison
parent 68f71f227b
commit 516c2a04a2
3 changed files with 33 additions and 2 deletions

View File

@ -45,6 +45,7 @@
#include "lib/util/tfork.h"
#include "lib/messaging/irpc.h"
#include "lib/util/util_process.h"
#include "server_util.h"
#define min(a, b) (((a) < (b)) ? (a) : (b))
@ -244,6 +245,7 @@ static void prefork_fork_master(
struct tevent_context *ev2;
struct task_server *task = NULL;
struct process_details pd = initial_process_details;
struct samba_tevent_trace_state *samba_tevent_trace_state = NULL;
int control_pipe[2];
t = tfork_create();
@ -327,6 +329,17 @@ static void prefork_fork_master(
*/
ev2 = s4_event_context_init(NULL);
samba_tevent_trace_state = create_samba_tevent_trace_state(ev2);
if (samba_tevent_trace_state == NULL) {
TALLOC_FREE(ev);
TALLOC_FREE(ev2);
exit(127);
}
tevent_set_trace_callback(ev2,
samba_tevent_trace_callback,
samba_tevent_trace_state);
/* setup this new connection: process will bind to it's sockets etc
*
* While we can use ev for the child, which has been re-initialised

View File

@ -46,6 +46,7 @@
#include "lib/util/tfork.h"
#include "dsdb/samdb/ldb_modules/util.h"
#include "lib/util/server_id.h"
#include "server_util.h"
#ifdef HAVE_PTHREAD
#include <pthread.h>
@ -572,6 +573,7 @@ static int binary_smbd_main(const char *binary_name,
};
struct server_state *state = NULL;
struct tevent_signal *se = NULL;
struct samba_tevent_trace_state *samba_tevent_trace_state = NULL;
setproctitle("root process");
@ -729,6 +731,21 @@ static int binary_smbd_main(const char *binary_name,
talloc_set_destructor(state->event_ctx, event_ctx_destructor);
samba_tevent_trace_state = create_samba_tevent_trace_state(state);
if (samba_tevent_trace_state == NULL) {
exit_daemon("Samba failed to setup tevent tracing state",
ENOTTY);
/*
* return is never reached but is here to satisfy static
* checkers
*/
return 1;
}
tevent_set_trace_callback(state->event_ctx,
samba_tevent_trace_callback,
samba_tevent_trace_state);
if (opt_interactive) {
/* terminate when stdin goes away */
stdin_event_flags = TEVENT_FD_READ;

View File

@ -25,7 +25,8 @@ bld.SAMBA_BINARY('samba',
source='server.c',
subsystem_name='service',
deps='''events process_model service samba-hostconfig samba-util POPT_SAMBA
popt gensec registry ntvfs share cluster COMMON_SCHANNEL SECRETS''',
popt gensec registry ntvfs share cluster COMMON_SCHANNEL SECRETS
samba_server_util''',
pyembed=True,
install_path='${SBINDIR}',
enabled=bld.AD_DC_BUILD_IS_ENABLED()
@ -52,6 +53,6 @@ bld.SAMBA_MODULE('process_model_prefork',
source='process_prefork.c',
subsystem='process_model',
init_function='process_model_prefork_init',
deps='MESSAGING events ldbsamba cluster samba-sockets process_model messages_dgm',
deps='MESSAGING events ldbsamba cluster samba-sockets process_model messages_dgm samba_server_util',
internal_module=False
)