[PATCH 08/22] dsdb: Permit creation of partitions of type INSTANCE_TYPE_UNINSTANT

abartlet at samba.org abartlet at samba.org
Tue Aug 19 20:06:43 MDT 2014


From: Andrew Bartlett <abartlet at samba.org>

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 <garming at catalyst.net.nz>
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
 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 d700adf..9a3fd11 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.0.1



More information about the samba-technical mailing list