s4:samldb LDB module - fix up the case when the old and new "primaryGroupID" are...
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 10 Jun 2010 14:15:10 +0000 (16:15 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 10 Jun 2010 14:22:09 +0000 (16:22 +0200)
source4/dsdb/samdb/ldb_modules/samldb.c

index a50739baa03db4c0392ce0f0027eef9ccfdf01b0..5d64b6d398655b1761bbf50eddc5963e4e0bd0f7 100644 (file)
@@ -1176,16 +1176,16 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
                return LDB_ERR_UNWILLING_TO_PERFORM;
        }
 
-       el = samdb_find_attribute(ldb, res->msgs[0], "memberOf",
-                                 ldb_dn_get_linearized(new_prim_group_dn));
-       if (el == NULL) {
+       /* Only update the "member" attributes when we really do have a change */
+       if (ldb_dn_compare(new_prim_group_dn, prev_prim_group_dn) != 0) {
                /* We need to be already a normal member of the new primary
                 * group in order to be successful. */
-               return LDB_ERR_UNWILLING_TO_PERFORM;
-       }
+               el = samdb_find_attribute(ldb, res->msgs[0], "memberOf",
+                                         ldb_dn_get_linearized(new_prim_group_dn));
+               if (el == NULL) {
+                       return LDB_ERR_UNWILLING_TO_PERFORM;
+               }
 
-       /* Only update the "member" attributes when we really do have a change */
-       if (ldb_dn_compare(new_prim_group_dn, prev_prim_group_dn) != 0) {
                /* Remove the "member" attribute on the new primary group */
                msg = talloc_zero(ac, struct ldb_message);
                msg->dn = new_prim_group_dn;