Author: vlendec
Date: 2005-10-03 14:24:53 +0000 (Mon, 03 Oct 2005)
New Revision: 10684

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10684

Log:
Add a nasty hack for the failure case of wbinfo -t. Tridge has a proper fix
for it pending.

Also fix a bug with timed events: Don't call the same event recursively in the
handler's inner semi-async event loop.

Volker

Modified:
   branches/SAMBA_4_0/source/lib/events/events_standard.c
   branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/events/events_standard.c
===================================================================
--- branches/SAMBA_4_0/source/lib/events/events_standard.c      2005-10-03 
13:46:11 UTC (rev 10683)
+++ branches/SAMBA_4_0/source/lib/events/events_standard.c      2005-10-03 
14:24:53 UTC (rev 10684)
@@ -347,9 +347,17 @@
 
        /* deny the handler to free the event */
        talloc_set_destructor(te, std_event_timed_deny_destructor);
+
+       /* We need to remove the timer from the list before calling the
+        * handler because in a semi-async inner event loop called from the
+        * handler we don't want to come across this event again -- vl */
+       DLIST_REMOVE(std_ev->timed_events, te);
+
        te->handler(ev, te, t, te->private_data);
 
-       talloc_set_destructor(te, std_event_timed_destructor);
+       /* The destructor isn't necessary anymore, we've already removed the
+        * event from the list. */
+
        talloc_free(te);
 }
 

Modified: branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c
===================================================================
--- branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c   2005-10-03 13:46:11 UTC 
(rev 10683)
+++ branches/SAMBA_4_0/source/winbind/wb_samba3_cmd.c   2005-10-03 14:24:53 UTC 
(rev 10684)
@@ -257,6 +257,12 @@
        }
 }
 
+static void delete_pipe(struct event_context *ctx, struct timed_event *te,
+                       struct timeval tv, void *p)
+{
+       talloc_free(p);
+}
+
 static void wbsrv_samba3_check_machacc_receive_creds(struct composite_context 
*action)
 {
        struct wbsrv_samba3_call *s3call =
@@ -271,13 +277,22 @@
        NTSTATUS status;
        
        status = wb_get_schannel_creds_recv(action, service);
-       service->netlogon = state->getcreds->out.netlogon;
 
        talloc_unlink(state, state->conn->out.tree); /* The pipe owns it now */
        state->conn->out.tree = NULL;
 
-       if (!NT_STATUS_IS_OK(status)) goto done;
+       if (!NT_STATUS_IS_OK(status)) {
+               /* Nasty hack awaiting a proper fix. So far we can not
+                * delete a pipe from an async rpc callback which where we are
+                * in right now, so delete the pipe in 5 seconds.... :-) */
+               event_add_timed(s3call->call->event_ctx, service,
+                               timeval_current_ofs(5, 0),
+                               delete_pipe, state->getcreds->out.netlogon);
+               service->netlogon = NULL;
+               goto done;
+       }
 
+       service->netlogon = state->getcreds->out.netlogon;
        s3call->response.result = WINBINDD_OK;
  done:
        if (!NT_STATUS_IS_OK(status)) {

Reply via email to