s4-dsdb: fixed the defaultObjectCategory to have a full GUID
authorAndrew Tridgell <tridge@samba.org>
Wed, 13 Jul 2011 09:36:59 +0000 (19:36 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 13 Jul 2011 12:03:30 +0000 (14:03 +0200)
this fixes the DN to have a full GUID for new objects

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Wed Jul 13 14:03:30 CEST 2011 on sn-devel-104

source4/dsdb/samdb/ldb_modules/samldb.c

index 5f17e3bd6f687159ec771b1f0d33936cf947e15e..5c940992ae8f49e30e42bd97d4c3f2cbb29b3485 100644 (file)
@@ -379,6 +379,30 @@ static int samldb_find_for_defaultObjectCategory(struct samldb_ctx *ac)
                return ret;
        }
 
+       if (ret == LDB_SUCCESS) {
+               /* ensure the defaultObjectCategory has a full GUID */
+               struct ldb_message *m;
+               m = ldb_msg_new(ac->msg);
+               if (m == NULL) {
+                       return ldb_oom(ldb);
+               }
+               m->dn = ac->msg->dn;
+               if (ldb_msg_add_string(m, "defaultObjectCategory",
+                                      ldb_dn_get_extended_linearized(m, res->msgs[0]->dn, 1)) !=
+                   LDB_SUCCESS) {
+                       return ldb_oom(ldb);
+               }
+               m->elements[0].flags = LDB_FLAG_MOD_REPLACE;
+
+               ret = dsdb_module_modify(ac->module, m,
+                                        DSDB_FLAG_NEXT_MODULE,
+                                        ac->req);
+               if (ret != LDB_SUCCESS) {
+                       return ret;
+               }
+       }
+
+
        ac->res_dn = ac->dn;
 
        return samldb_next_step(ac);