#include "winbindd.h"
#include "../../nsswitch/libwbclient/wbc_async.h"
#include "librpc/gen_ndr/messaging.h"
+#include "secrets.h"
+#include "../lib/util/select.h"
+#include "../libcli/security/security.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
if (logprefix && logname) {
char *logbase = NULL;
- if (lp_logfile()) {
+ if (*lp_logfile()) {
char *end = NULL;
if (asprintf(&logbase, "%s", lp_logfile()) < 0) {
child->table = table;
child->queue = tevent_queue_create(NULL, "winbind_child");
SMB_ASSERT(child->queue != NULL);
- child->rpccli = wbint_rpccli_create(NULL, domain, child);
- SMB_ASSERT(child->rpccli != NULL);
+ child->binding_handle = wbint_binding_handle(NULL, domain, child);
+ SMB_ASSERT(child->binding_handle != NULL);
}
static struct winbindd_child *winbindd_children = NULL;
struct winbindd_child *cl;
NTSTATUS status;
- status = reinit_after_fork(winbind_messaging_context(),
- winbind_event_context(),
- procid_self(), true);
+ status = reinit_after_fork(
+ winbind_messaging_context(),
+ winbind_event_context(),
+ procid_self(),
+ true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
return false;
MSG_DUMP_EVENT_LIST, child_msg_dump_event_list);
messaging_register(winbind_messaging_context(), NULL,
MSG_DEBUG, debug_message);
+ messaging_register(winbind_messaging_context(), NULL,
+ MSG_WINBIND_IP_DROPPED,
+ winbind_msg_ip_dropped);
+
primary_domain = find_our_domain();
* try to bring domain online after fork. */
if ( child->domain ) {
child->domain->startup = True;
- child->domain->startup_time = time(NULL);
+ child->domain->startup_time = time_mono(NULL);
/* we can be in primary domain or in trusted domain
* If we are in trusted domain, set the primary domain
* in start-up mode */
set_domain_online_request(child->domain);
if (!(child->domain->primary)) {
primary_domain->startup = True;
- primary_domain->startup_time = time(NULL);
+ primary_domain->startup_time = time_mono(NULL);
set_domain_online_request(primary_domain);
}
}
while (1) {
- int ret;
+ int ret = 0;
fd_set r_fds;
fd_set w_fds;
int maxfd;
int iov_count;
NTSTATUS status;
- if (run_events(winbind_event_context(), 0, NULL, NULL)) {
+ if (run_events(winbind_event_context(), &ret, NULL, NULL)) {
TALLOC_FREE(frame);
continue;
}
GetTimeOfDay(&now);
if (child->domain && child->domain->startup &&
- (now.tv_sec > child->domain->startup_time + 30)) {
+ (time_mono(NULL) > child->domain->startup_time + 30)) {
/* No longer in "startup" mode. */
DEBUG(10,("fork_domain_child: domain %s no longer in 'startup' mode.\n",
child->domain->name ));
ret = sys_select(maxfd + 1, &r_fds, &w_fds, NULL, tp);
- if (run_events(winbind_event_context(), ret, &r_fds, &w_fds)) {
+ if (run_events(winbind_event_context(), &ret, &r_fds, &w_fds)) {
/* We got a signal - continue. */
TALLOC_FREE(frame);
continue;
TALLOC_FREE(frame);
}
}
+
+void winbind_msg_ip_dropped_parent(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
+{
+ struct winbindd_child *child;
+
+ winbind_msg_ip_dropped(msg_ctx, private_data, msg_type,
+ server_id, data);
+
+
+ for (child = winbindd_children; child != NULL; child = child->next) {
+ messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
+ msg_type, data->data, data->length);
+ }
+}