m = process_model_byname(model);
if (m == NULL) {
- DEBUG(0,("Unknown process model '%s'\n", model));
+ DBG_ERR("Unknown process model '%s'\n", model);
exit(-1);
}
{
if (process_model_byname(ops->name) != NULL) {
/* its already registered! */
- DEBUG(0,("PROCESS_MODEL '%s' already registered\n",
- ops->name));
+ DBG_ERR("PROCESS_MODEL '%s' already registered\n", ops->name);
return NT_STATUS_OBJECT_NAME_COLLISION;
}
num_models++;
- DEBUG(3,("PROCESS_MODEL '%s' registered\n", ops->name));
+ DBG_NOTICE("PROCESS_MODEL '%s' registered\n", ops->name);
return NT_STATUS_OK;
}
/* accept an incoming connection. */
status = socket_accept(listen_socket, &connected_socket);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("single_accept_connection: accept: %s\n", nt_errstr(status)));
+ DBG_ERR("single_accept_connection: accept: %s\n",
+ nt_errstr(status));
/* this looks strange, but is correct.
We can only be here if woken up from select, due to
const char *reason,
void *process_context)
{
- DEBUG(3,("single_terminate: reason[%s]\n",reason));
+ DBG_NOTICE("single_terminate: reason[%s]\n",reason);
}
/* called to set a title of a task or connection */
* We're the process group leader, send
* SIGTERM to our process group.
*/
- DEBUG(0,("SIGTERM: killing children\n"));
+ DBG_ERR("SIGTERM: killing children\n");
kill(-getpgrp(), SIGTERM);
}
#endif
- DEBUG(0,("Exiting pid %u on SIGTERM\n", (unsigned int)getpid()));
+ DBG_ERR("Exiting pid %u on SIGTERM\n", (unsigned int)getpid());
talloc_free(ev);
exit(127);
}
static void standard_pipe_handler(struct tevent_context *event_ctx, struct tevent_fd *fde,
uint16_t flags, void *private_data)
{
- DEBUG(10,("Child %d exiting\n", (int)getpid()));
+ DBG_DEBUG("Child %d exiting\n", (int)getpid());
talloc_free(event_ctx);
exit(0);
}
* SIGCHLD in the standard
* process model.
*/
- DEBUG(0, ("Error in waitpid() unexpectedly got ECHILD "
- "for child %d (%s) - %s, someone has set SIGCHLD "
- "to SIG_IGN!\n",
- (int)state->pid, state->name,
- strerror(errno)));
+ DBG_ERR("Error in waitpid() unexpectedly got ECHILD "
+ "for child %d (%s) - %s, someone has set SIGCHLD "
+ "to SIG_IGN!\n",
+ (int)state->pid, state->name,
+ strerror(errno));
TALLOC_FREE(state);
return;
}
- DEBUG(0, ("Error in waitpid() for child %d (%s) - %s \n",
- (int)state->pid, state->name, strerror(errno)));
+ DBG_ERR("Error in waitpid() for child %d (%s) - %s \n",
+ (int)state->pid, state->name, strerror(errno));
if (errno == 0) {
errno = ECHILD;
}
}
} else if (WIFSIGNALED(status)) {
status = WTERMSIG(status);
- DEBUG(0, ("Child %d (%s) terminated with signal %d\n",
- (int)state->pid, state->name, status));
+ DBG_ERR("Child %d (%s) terminated with signal %d\n",
+ (int)state->pid, state->name, status);
}
TALLOC_FREE(state);
return;
ret = pipe(parent_child_pipe);
if (ret == -1) {
- DEBUG(0, ("Failed to create parent-child pipe to handle "
- "SIGCHLD to track new process for socket\n"));
+ DBG_ERR("Failed to create parent-child pipe to handle "
+ "SIGCHLD to track new process for socket\n");
TALLOC_FREE(state);
return NULL;
}
/* accept an incoming connection. */
status = socket_accept(sock, &sock2);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("standard_accept_connection: accept: %s\n",
- nt_errstr(status)));
+ DBG_DEBUG("standard_accept_connection: accept: %s\n",
+ nt_errstr(status));
/* this looks strange, but is correct. We need to throttle
* things until the system clears enough resources to handle
* this new socket
continue;
}
if (unlink(fname) != 0) {
- DEBUG(0,("Unabled to delete '%s' - %s\n",
- fname, strerror(errno)));
+ DBG_ERR("Unabled to delete '%s' - %s\n",
+ fname, strerror(errno));
smb_panic("unable to cleanup tmp files");
}
talloc_free(fname);
* We're the process group leader, send
* SIGTERM to our process group.
*/
- DEBUG(0,("SIGTERM: killing children\n"));
+ DBG_ERR("SIGTERM: killing children\n");
kill(-getpgrp(), SIGTERM);
}
#endif
- DEBUG(0,("Exiting pid %d on SIGTERM\n", (int)getpid()));
+ DBG_ERR("Exiting pid %d on SIGTERM\n", (int)getpid());
exit(127);
}
struct server_state *state = talloc_get_type_abort(
private_data, struct server_state);
- DEBUG(10,("Process %s got SIGTERM\n", state->binary_name));
+ DBG_DEBUG("Process %s got SIGTERM\n", state->binary_name);
TALLOC_FREE(state);
sig_term(SIGTERM);
}
private_data, struct server_state);
uint8_t c;
if (read(0, &c, 1) == 0) {
- DEBUG(0,("%s: EOF on stdin - PID %d terminating\n",
- state->binary_name, (int)getpid()));
+ DBG_ERR("%s: EOF on stdin - PID %d terminating\n",
+ state->binary_name, (int)getpid());
#if HAVE_GETPGRP
if (getpgrp() == getpid()) {
- DEBUG(0,("Sending SIGTERM from pid %d\n",
- (int)getpid()));
+ DBG_ERR("Sending SIGTERM from pid %d\n",
+ (int)getpid());
kill(-getpgrp(), SIGTERM);
}
#endif
{
struct server_state *state = talloc_get_type_abort(
private_data, struct server_state);
- DEBUG(0,("%s: maximum runtime exceeded - "
+ DBG_ERR("%s: maximum runtime exceeded - "
"terminating PID %d at %llu, current ts: %llu\n",
state->binary_name,
(int)getpid(),
(unsigned long long)t.tv_sec,
- (unsigned long long)time(NULL)));
+ (unsigned long long)time(NULL));
TALLOC_FREE(state);
exit(0);
}
}
if (opt_daemon) {
- DEBUG(3,("Becoming a daemon.\n"));
+ DBG_NOTICE("Becoming a daemon.\n");
become_daemon(true, false, false);
}
if (max_runtime) {
struct tevent_timer *te;
- DEBUG(0,("%s PID %d was called with maxruntime %d - "
+ DBG_ERR("%s PID %d was called with maxruntime %d - "
"current ts %llu\n",
binary_name, (int)getpid(),
- max_runtime, (unsigned long long) time(NULL)));
+ max_runtime, (unsigned long long) time(NULL));
te = tevent_add_timer(state->event_ctx, state->event_ctx,
timeval_current_ofs(max_runtime, 0),
max_runtime_handler,
NT_STATUS_V(status));
}
- DEBUG(0,("%s: using '%s' process model\n", binary_name, model));
+ DBG_ERR("%s: using '%s' process model\n", binary_name, model);
{
int child_pipe[2];
const struct model_ops *model_ops;
if (!server_services) {
- DEBUG(0,("server_service_startup: no endpoint servers configured\n"));
+ DBG_ERR("server_service_startup: "
+ "no endpoint servers configured\n");
return NT_STATUS_INVALID_PARAMETER;
}
model_ops = process_model_startup(model);
if (!model_ops) {
- DEBUG(0,("process_model_startup('%s') failed\n", model));
+ DBG_ERR("process_model_startup('%s') failed\n", model);
return NT_STATUS_INTERNAL_ERROR;
}
status = server_service_init(server_services[i], event_ctx,
lp_ctx, model_ops, from_parent_fd);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("Failed to start service '%s' - %s\n",
- server_services[i], nt_errstr(status)));
+ DBG_ERR("Failed to start service '%s' - %s\n",
+ server_services[i], nt_errstr(status));
}
NT_STATUS_NOT_OK_RETURN(status);
}
conn->local_address = talloc_move(conn, &local_server_addr);
conn->remote_address = talloc_move(conn, &remote_client_addr);
- DEBUG(10, ("Accepted npa connection from %s. "
- "Client: %s (%s). Server: %s (%s)\n",
- tsocket_address_string(conn->remote_address, tmp_ctx),
- local_server_name,
- tsocket_address_string(local_server_addr, tmp_ctx),
- remote_client_name,
- tsocket_address_string(remote_client_addr, tmp_ctx)));
+ DBG_DEBUG("Accepted npa connection from %s. "
+ "Client: %s (%s). Server: %s (%s)\n",
+ tsocket_address_string(conn->remote_address, tmp_ctx),
+ local_server_name,
+ tsocket_address_string(local_server_addr, tmp_ctx),
+ remote_client_name,
+ tsocket_address_string(remote_client_addr, tmp_ctx));
conn->session_info = auth_session_info_from_transport(conn, session_info_transport,
conn->lp_ctx,
conn->private_data = pipe_sock->private_data;
conn->ops->accept_connection(conn);
- DEBUG(10, ("named pipe connection [%s] established\n",
- conn->ops->name));
+ DBG_DEBUG("named pipe connection [%s] established\n", conn->ops->name);
talloc_free(tmp_ctx);
return;
if (!directory_create_or_exist(lpcfg_ncalrpc_dir(lp_ctx), 0755)) {
status = map_nt_error_from_unix_common(errno);
- DEBUG(0,(__location__ ": Failed to create ncalrpc pipe directory '%s' - %s\n",
- lpcfg_ncalrpc_dir(lp_ctx), nt_errstr(status)));
+ DBG_ERR("Failed to create ncalrpc pipe directory '%s' - %s\n",
+ lpcfg_ncalrpc_dir(lp_ctx), nt_errstr(status));
goto fail;
}
if (!directory_create_or_exist_strict(dirname, geteuid(), 0700)) {
status = map_nt_error_from_unix_common(errno);
- DEBUG(0,(__location__ ": Failed to create stream pipe directory '%s' - %s\n",
- dirname, nt_errstr(status)));
+ DBG_ERR("Failed to create stream pipe directory '%s' - %s\n",
+ dirname, nt_errstr(status));
goto fail;
}
if (!reason) reason = "unknown reason";
if (srv_conn->processing) {
- DEBUG(3,("Terminating connection deferred - '%s'\n", reason));
+ DBG_NOTICE("Terminating connection deferred - '%s'\n", reason);
} else {
- DEBUG(3,("Terminating connection - '%s'\n", reason));
+ DBG_NOTICE("Terminating connection - '%s'\n", reason);
}
srv_conn->terminate = reason;
srv_conn = talloc_zero(ev, struct stream_connection);
if (!srv_conn) {
- DEBUG(0,("talloc(mem_ctx, struct stream_connection) failed\n"));
+ DBG_ERR("talloc(mem_ctx, struct stream_connection) failed\n");
return;
}
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("Failed to listen on %s:%u - %s\n",
+ DBG_ERR("Failed to listen on %s:%u - %s\n",
sock_addr, port ? (unsigned int)(*port) : 0,
- nt_errstr(status)));
+ nt_errstr(status));
talloc_free(stream_socket);
return status;
}
TEVENT_FD_READ,
stream_accept_handler, stream_socket);
if (!fde) {
- DEBUG(0,("Failed to setup fd event\n"));
+ DBG_ERR("Failed to setup fd event\n");
talloc_free(stream_socket);
return NT_STATUS_NO_MEMORY;
}
{
struct tevent_context *event_ctx = task->event_ctx;
const struct model_ops *model_ops = task->model_ops;
- DEBUG(0,("task_server_terminate: [%s]\n", reason));
+ if (fatal) {
+ DBG_ERR("task_server_terminate: [%s]\n", reason);
+ } else {
+ DBG_NOTICE("task_server_terminate: [%s]\n", reason);
+ }
if (fatal && task->msg_ctx != NULL) {
struct dcerpc_binding_handle *irpc_handle;