s3: Protect against flooding the DC with pwchange requests
authorVolker Lendecke <vl@samba.org>
Thu, 19 Nov 2009 16:20:47 +0000 (17:20 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 10 Mar 2010 12:22:17 +0000 (13:22 +0100)
When there is a temporary problem changing passwords we flooded the DC with
pwchange requests. This gives the DC a 60-second break to recover.

Signed-off-by: Michael Adam <obnox@samba.org>
source3/winbindd/winbindd_dual.c

index 40700db6649b33b3325aefb7f2c9e6fe8b427b19..2ab71ff7d4369bc9d45232343c3d9c85c0913b5e 100644 (file)
@@ -995,14 +995,15 @@ static void machine_password_change_handler(struct event_context *ctx,
                   timeval_string(talloc_tos(), &next_change, false)));
 
        if (!NT_STATUS_IS_OK(result)) {
-               DEBUG(10,("machine_password_change_handler: "
-                       "failed to change machine password: %s\n",
-                        nt_errstr(result)));
-       } else {
-               DEBUG(10,("machine_password_change_handler: "
-                       "successfully changed machine password\n"));
+               struct timeval tmp;
+               /*
+                * In case of failure, give the DC a minute to recover
+                */
+               tmp = timeval_current_ofs(60, 0);
+               next_change = timeval_max(&next_change, &tmp);
        }
 
+done:
        child->machine_password_change_event = event_add_timed(winbind_event_context(), NULL,
                                                              next_change,
                                                              machine_password_change_handler,