state->response->result = WINBINDD_ERROR;
state->response->length = sizeof(struct winbindd_response);
- /* as all requests in the child are sync, we can use talloc_tos() */
- state->mem_ctx = talloc_tos();
-
/* Process command */
for (; table->name; table++) {
struct winbindd_domain *primary_domain = NULL;
NTSTATUS status;
ssize_t nwritten;
+ struct tevent_context *ev;
if (child->domain) {
DEBUG(10, ("fork_domain_child called for domain '%s'\n",
nt_errstr(status)));
_exit(0);
}
+ ev = winbind_event_context();
/* Handle online/offline messages. */
messaging_register(winbind_messaging_context(), NULL,
}
child->lockout_policy_event = event_add_timed(
- winbind_event_context(), NULL, timeval_zero(),
+ ev, NULL, timeval_zero(),
account_lockout_policy_handler,
child);
}
if (calculate_next_machine_pwd_change(child->domain->name,
&next_change)) {
child->machine_password_change_event = event_add_timed(
- winbind_event_context(), NULL, next_change,
+ ev, NULL, next_change,
machine_password_change_handler,
child);
}
int timeout;
struct timeval t;
struct timeval *tp;
- TALLOC_CTX *frame = talloc_stackframe();
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ if (mem_ctx == NULL) {
+ _exit(1);
+ }
- if (run_events_poll(winbind_event_context(), 0, NULL, 0)) {
- TALLOC_FREE(frame);
+ if (run_events_poll(ev, 0, NULL, 0)) {
+ TALLOC_FREE(mem_ctx);
continue;
}
child->domain->startup = False;
}
- pfds = talloc_zero(talloc_tos(), struct pollfd);
+ pfds = talloc_zero(mem_ctx, struct pollfd);
if (pfds == NULL) {
DEBUG(1, ("talloc failed\n"));
_exit(1);
timeout = INT_MAX;
if (!event_add_to_poll_args(
- winbind_event_context(), talloc_tos(),
+ ev, mem_ctx,
&pfds, &num_pfds, &timeout)) {
DEBUG(1, ("event_add_to_poll_args failed\n"));
_exit(1);
}
- tp = get_timed_events_timeout(winbind_event_context(), &t);
+ tp = get_timed_events_timeout(ev, &t);
if (tp) {
DEBUG(11,("select will use timeout of %u.%u seconds\n",
(unsigned int)tp->tv_sec, (unsigned int)tp->tv_usec ));
ret = poll(pfds, num_pfds, timeout);
- if (run_events_poll(winbind_event_context(), ret,
+ if (run_events_poll(ev, ret,
pfds, num_pfds)) {
/* We got a signal - continue. */
- TALLOC_FREE(frame);
+ TALLOC_FREE(mem_ctx);
continue;
}
if (ret == 0) {
DEBUG(11,("nothing is ready yet, continue\n"));
- TALLOC_FREE(frame);
+ TALLOC_FREE(mem_ctx);
continue;
}
if (ret == -1 && errno == EINTR) {
/* We got a signal - continue. */
- TALLOC_FREE(frame);
+ TALLOC_FREE(mem_ctx);
continue;
}
if (ret == -1 && errno != EINTR) {
DEBUG(0,("poll error occured\n"));
- TALLOC_FREE(frame);
+ TALLOC_FREE(mem_ctx);
perror("poll");
_exit(1);
}
ZERO_STRUCTP(state.response);
state.request->null_term = '\0';
- state.mem_ctx = frame;
+ state.mem_ctx = mem_ctx;
child_process_request(child, &state);
DEBUG(4, ("Finished processing child request %d\n",
if (!NT_STATUS_IS_OK(status)) {
_exit(1);
}
- TALLOC_FREE(frame);
+ TALLOC_FREE(mem_ctx);
}
}