s3:winbindd: fix segfaults on addrchange errors and make DEBUG() statements more...
authorStefan Metzmacher <metze@samba.org>
Fri, 4 Feb 2011 11:29:42 +0000 (12:29 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 4 Feb 2011 14:04:57 +0000 (15:04 +0100)
metze

source3/winbindd/winbindd.c

index 701f7a098bab8cecacd39fabf516bb663cfcdea0..3a762316d230f7a97debbcf2cfb70c28963c0dc1 100644 (file)
@@ -1142,8 +1142,9 @@ static void winbindd_init_addrchange(TALLOC_CTX *mem_ctx,
        }
        req = addrchange_send(state, ev, state->ctx);
        if (req == NULL) {
-               DEBUG(10, ("addrchange_send failed\n"));
+               DEBUG(0, ("addrchange_send failed\n"));
                TALLOC_FREE(state);
+               return;
        }
        tevent_req_set_callback(req, winbindd_addr_changed, state);
 }
@@ -1162,6 +1163,7 @@ static void winbindd_addr_changed(struct tevent_req *req)
                DEBUG(10, ("addrchange_recv failed: %s, stop listening\n",
                           nt_errstr(status)));
                TALLOC_FREE(state);
+               return;
        }
        if (type == ADDRCHANGE_DEL) {
                char addrstr[INET6_ADDRSTRLEN];
@@ -1178,14 +1180,15 @@ static void winbindd_addr_changed(struct tevent_req *req)
                                        messaging_server_id(state->msg_ctx),
                                        MSG_WINBIND_IP_DROPPED, &blob);
                if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(10, ("messaging_send failed: %s\n",
+                       DEBUG(10, ("messaging_send failed: %s - ignoring\n",
                                   nt_errstr(status)));
                }
        }
        req = addrchange_send(state, state->ev, state->ctx);
        if (req == NULL) {
-               DEBUG(10, ("addrchange_send failed\n"));
+               DEBUG(0, ("addrchange_send failed\n"));
                TALLOC_FREE(state);
+               return;
        }
        tevent_req_set_callback(req, winbindd_addr_changed, state);
 }