From cee1fc5ba8e0caf5fa7fedc988b23876c56724bc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 8 Aug 2014 19:26:46 +1200 Subject: [PATCH] dsdb: Permit creation of partitions of type INSTANCE_TYPE_UNINSTANT This is only allowed when we are creating the objects from a DsAddEntry call, not over LDAP. Change-Id: Ieec6b07556d58741ec04fede8bf9940811f12a62 Pair-programmed-with: Garming Sam Signed-off-by: Garming Sam Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher Reviewed-By: Jelmer Vernooij --- source4/dsdb/samdb/ldb_modules/instancetype.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c index d700adf69ac5..9a3fd1141fc0 100644 --- a/source4/dsdb/samdb/ldb_modules/instancetype.c +++ b/source4/dsdb/samdb/ldb_modules/instancetype.c @@ -79,11 +79,22 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req) * If we have a NC add operation then we need also the * "TYPE_WRITE" flag in order to succeed, * unless this NC is not instantiated - */ - if (!(instanceType & INSTANCE_TYPE_WRITE)) { - ldb_set_errstring(ldb, "instancetype: if TYPE_IS_NC_HEAD was set, then also TYPE_WRITE is requested!"); - return LDB_ERR_UNWILLING_TO_PERFORM; + */ + if (ldb_request_get_control(req, DSDB_CONTROL_PARTIAL_REPLICA)) { + if (!(instanceType & INSTANCE_TYPE_UNINSTANT)) { + ldb_set_errstring(ldb, "instancetype: if TYPE_IS_NC_HEAD " + "was set, and we are creating a new NC " + "over DsAddEntry then also TYPE_UNINSTANT is requested!"); + return LDB_ERR_UNWILLING_TO_PERFORM; + } + } else { + if (!(instanceType & INSTANCE_TYPE_WRITE)) { + ldb_set_errstring(ldb, "instancetype: if TYPE_IS_NC_HEAD " + "was set, then also TYPE_WRITE is requested!"); + return LDB_ERR_UNWILLING_TO_PERFORM; + } } + /* * TODO: Confirm we are naming master or start * a remote call to the naming master to -- 2.34.1