s3: nmbd: Ensure we only set work_changed = true if we modify the record.
authorJeremy Allison <jra@samba.org>
Thu, 30 Apr 2015 19:05:17 +0000 (12:05 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 5 May 2015 18:53:26 +0000 (20:53 +0200)
https://bugzilla.samba.org/show_bug.cgi?id=11254

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit db6572ef80e20b0e577b9e9fb5d233f8bdd20713)

source3/nmbd/nmbd_incomingdgrams.c

index 153a86db55549c4ad775fcb14d4e6f11c209b8e9..2dc684e505132f3aa8c87b2505056ea058ca0000 100644 (file)
@@ -336,12 +336,25 @@ a local master browser for workgroup %s and we think we are master. Forcing elec
                                ttl, comment);
                } else {
                        /* Update the record. */
-                       servrec->serv.type = servertype|SV_TYPE_LOCAL_LIST_ONLY;
+                       if (servrec->serv.type !=
+                                       (servertype|SV_TYPE_LOCAL_LIST_ONLY)) {
+                               servrec->serv.type =
+                                       servertype|SV_TYPE_LOCAL_LIST_ONLY;
+                               subrec->work_changed = true;
+                       }
+                       if (!strequal(servrec->serv.comment,comment)) {
+                               strlcpy(servrec->serv.comment,
+                                       comment,
+                                       sizeof(servrec->serv.comment));
+                               subrec->work_changed = true;
+                       }
                        update_server_ttl(servrec, ttl);
-                       strlcpy(servrec->serv.comment,comment,sizeof(servrec->serv.comment));
                }
-       
-               set_workgroup_local_master_browser_name( work, server_name );
+
+               if (!strequal(work->local_master_browser_name, server_name)) {
+                       set_workgroup_local_master_browser_name( work, server_name );
+                       subrec->work_changed = true;
+               }
        } else {
                /*
                 * This server is announcing it is going down. Remove it from the
@@ -353,7 +366,6 @@ a local master browser for workgroup %s and we think we are master. Forcing elec
                }
        }
 
-       subrec->work_changed = True;
 done:
 
        END_PROFILE(local_master_announce);