summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules
diff options
context:
space:
mode:
authorFernando J V da Silva <fernandojvsilva@yahoo.com.br>2009-11-19 15:37:45 -0300
committerAndrew Tridgell <tridge@samba.org>2009-11-20 13:56:50 +1100
commit70d8db86b92c57f7ff736fb6e275a085da92f856 (patch)
tree797bdfdf5c8ef348de8faa0a1ee59760abd1a61f /source4/dsdb/samdb/ldb_modules
parent8481581dc4d1795b943a46cabc718e3c558f41aa (diff)
downloadsamba-70d8db86b92c57f7ff736fb6e275a085da92f856.tar.gz
samba-70d8db86b92c57f7ff736fb6e275a085da92f856.tar.bz2
samba-70d8db86b92c57f7ff736fb6e275a085da92f856.zip
s4-drs: Synchronous Implementation of generated parentGUID
This generated parentGUID on demand, rather than getting it from the database Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r--source4/dsdb/samdb/ldb_modules/operational.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/operational.c b/source4/dsdb/samdb/ldb_modules/operational.c
index cd2a6bc0f6..ccfddbe56e 100644
--- a/source4/dsdb/samdb/ldb_modules/operational.c
+++ b/source4/dsdb/samdb/ldb_modules/operational.c
@@ -63,10 +63,12 @@
modifiersName: not supported by w2k3?
*/
+#include "includes.h"
#include "ldb_includes.h"
#include "ldb_module.h"
-#include "includes.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "param/param.h"
#include "dsdb/samdb/samdb.h"
#ifndef ARRAY_SIZE
@@ -108,6 +110,35 @@ static int construct_primary_group_token(struct ldb_module *module,
}
}
+static int construct_parent_guid(struct ldb_module *module,
+ struct ldb_message *msg)
+{
+ struct ldb_context *ldb;
+ struct GUID parent_guid;
+ int ret;
+
+ ldb = ldb_module_get_ctx(module);
+
+ ret = dsdb_find_parentguid_by_dn(ldb, msg->dn, &parent_guid);
+
+
+ if (ret != LDB_SUCCESS){
+
+ /* if there is no parentGUID for this object, then return */
+ if (ret == LDB_ERR_NO_SUCH_OBJECT){
+ return LDB_SUCCESS;
+ }else{
+ return ret;
+ }
+
+ }
+
+ ret = dsdb_msg_add_guid(msg, &parent_guid, "parentGUID");
+
+ return ret;
+
+}
+
/*
a list of attribute names that should be substituted in the parse
@@ -135,7 +166,8 @@ static const struct {
{ "modifyTimestamp", "whenChanged", NULL },
{ "structuralObjectClass", "objectClass", NULL },
{ "canonicalName", "distinguishedName", construct_canonical_name },
- { "primaryGroupToken", "objectSid", construct_primary_group_token }
+ { "primaryGroupToken", "objectSid", construct_primary_group_token },
+ { "parentGUID", NULL, construct_parent_guid }
};
/*