#define DBGC_CLASS DBGC_WINBIND
extern BOOL override_logfile;
-extern struct winbindd_methods cache_methods;
/* Read some data from a client connection */
void *private_data;
};
+static void async_request_fail(struct winbindd_async_request *state);
static void async_main_request_sent(void *private_data, BOOL success);
static void async_request_sent(void *private_data, BOOL success);
static void async_reply_recv(void *private_data, BOOL success);
state->mem_ctx = mem_ctx;
state->child = child;
+ state->reply_timeout_event = NULL;
state->request = request;
state->response = response;
state->continuation = continuation;
if (!success) {
DEBUG(5, ("Could not send async request\n"));
-
- state->response->length = sizeof(struct winbindd_response);
- state->response->result = WINBINDD_ERROR;
- state->continuation(state->private_data, False);
+ async_request_fail(state);
return;
}
int fdpair[2];
struct winbindd_cli_state state;
struct winbindd_domain *domain;
+ struct winbindd_domain *primary_domain = NULL;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) != 0) {
DEBUG(0, ("Could not open child pipe: %s\n",
ZERO_STRUCT(state);
state.pid = sys_getpid();
- /* Stop zombies */
- CatchChild();
-
/* Ensure we don't process messages whilst we're
changing the disposition for the child. */
message_block();
/* Child */
+ /* Stop zombies in children */
+ CatchChild();
+
state.sock = fdpair[0];
close(fdpair[1]);
}
/* Ensure we have no pending check_online events other
- than one for this domain. */
+ than one for this domain or the primary domain. */
for (domain = domain_list(); domain; domain = domain->next) {
- if (domain != child->domain) {
+ if (domain->primary) {
+ primary_domain = domain;
+ }
+ if ((domain != child->domain) && !domain->primary) {
TALLOC_FREE(domain->check_online_event);
}
}
set_domain_online_request(child->domain);
+ if (primary_domain != child->domain) {
+ /* We need to talk to the primary
+ * domain as well as the trusted
+ * domain inside a trusted domain
+ * child.
+ * See the code in :
+ * winbindd_dual_pam_auth_samlogon()
+ * especially the calling of
+ * contact_domain = find_our_domain()
+ * in the non-DC case for details.
+ */
+ set_domain_online_request(primary_domain);
+ }
+
child->lockout_policy_event = event_add_timed(
winbind_event_context(), NULL, timeval_zero(),
"account_lockout_policy_handler",
child);
}
- /* Special case for Winbindd on a Samba DC,
- * We want to make sure the child can connect to smbd
- * but not the main daemon */
-
- if (child->domain && child->domain->internal && IS_DC) {
- child->domain->methods = &cache_methods;
- child->domain->online = False;
- }
-
while (1) {
int ret;
main_loop_TALLOC_FREE();
/* check for signals */
- winbind_check_sigterm();
- winbind_check_sighup();
+ winbind_check_sigterm(false);
+ winbind_check_sighup(override_logfile ? NULL :
+ child->logfilename);
run_events(winbind_event_context(), 0, NULL, NULL);