#include "lib/conn_tdb.h"
#include "../lib/util/pidfile.h"
#include "lib/smbd_shim.h"
+#include "scavenger.h"
struct smbd_open_socket;
struct smbd_child_pid;
struct smbd_child_pid *children;
size_t num_children;
- struct timed_event *cleanup_te;
+ struct tevent_timer *cleanup_te;
};
struct smbd_open_socket {
extern void start_epmd(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx);
-extern void start_lsasd(struct event_context *ev_ctx,
+extern void start_lsasd(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx);
#ifdef WITH_DFS
state = talloc(mem_ctx, struct smbd_parent_notify_state);
if (state == NULL) {
- return NULL;
+ return false;
}
state->msg = msg;
state->ev = ev;
network outage).
*/
-static void cleanup_timeout_fn(struct event_context *event_ctx,
- struct timed_event *te,
+static void cleanup_timeout_fn(struct tevent_context *event_ctx,
+ struct tevent_timer *te,
struct timeval now,
void *private_data)
{
return;
if (fd == -1) {
- DEBUG(0,("open_sockets_smbd: accept: %s\n",
+ DEBUG(0,("accept: %s\n",
strerror(errno)));
return;
}
static bool smbd_open_one_socket(struct smbd_parent_context *parent,
struct tevent_context *ev_ctx,
- struct messaging_context *msg_ctx,
const struct sockaddr_storage *ifss,
uint16_t port)
{
if (!smbd_open_one_socket(parent,
ev_ctx,
- msg_ctx,
ifss,
port)) {
return false;
if (!smbd_open_one_socket(parent,
ev_ctx,
- msg_ctx,
&ss,
port)) {
return false;
exit(1);
}
+ if (lp_clustering()) {
+ NTSTATUS status;
+
+ status = ctdbd_probe();
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("clustering=yes but ctdbd connect failed: "
+ "%s\n", nt_errstr(status)));
+ exit(1);
+ }
+ }
+
/* Init the security context and global current_user */
init_sec_ctx();
exit(1);
}
- if (!sessionid_init()) {
- exit(1);
- }
status = smbXsrv_session_global_init();
if (!NT_STATUS_IS_OK(status)) {
exit(1);
}
- if (!connections_init(true)) {
- exit(1);
- }
status = smbXsrv_tcon_global_init();
if (!NT_STATUS_IS_OK(status)) {
exit(1);
exit(1);
}
+ if (!smbd_scavenger_init(NULL, msg_ctx, ev_ctx)) {
+ exit(1);
+ }
+
if (!serverid_parent_init(ev_ctx)) {
exit(1);
}
return -1;
}
- if (!directory_create_or_exist(np_dir, geteuid(), 0700)) {
+ if (!directory_create_or_exist_strict(np_dir, geteuid(), 0700)) {
DEBUG(0, ("Failed to create pipe directory %s - %s\n",
np_dir, strerror(errno)));
return -1;
/* if we are running in the foreground then look for
EOF on stdin, and exit if it happens. This allows
us to die if the parent process dies
+ Only do this on a pipe or socket, no other device.
*/
- tevent_add_fd(ev_ctx, parent, 0, TEVENT_FD_READ, smbd_stdin_handler, NULL);
+ struct stat st;
+ if (fstat(0, &st) != 0) {
+ return false;
+ }
+ if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) {
+ tevent_add_fd(ev_ctx,
+ parent,
+ 0,
+ TEVENT_FD_READ,
+ smbd_stdin_handler,
+ NULL);
+ }
}
smbd_parent_loop(ev_ctx, parent);