diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-09-28 11:04:29 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-10-04 15:08:57 +1100 |
commit | 60cbc98051b430fc09358a09866c69a54cc726bc (patch) | |
tree | 7b8568e7fbc1b1b32396ba537d952192f55631ff /source4/dsdb/samdb | |
parent | fb937afbecb61896e8e8e56c19bbc193fc573e15 (diff) | |
download | samba-60cbc98051b430fc09358a09866c69a54cc726bc.tar.gz samba-60cbc98051b430fc09358a09866c69a54cc726bc.tar.bz2 samba-60cbc98051b430fc09358a09866c69a54cc726bc.zip |
s4-dsdb: added new control DSDB_MODIFY_PARTIAL_REPLICA
this control tells the partition module that the DN being created is a
partial replica, so it should modify the @PARTITION object to add the
partialReplica attribute
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/new_partition.c | 12 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/partition_init.c | 12 | ||||
-rw-r--r-- | source4/dsdb/samdb/samdb.h | 3 |
3 files changed, 27 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/new_partition.c b/source4/dsdb/samdb/ldb_modules/new_partition.c index 87983f41c8..3f730f97db 100644 --- a/source4/dsdb/samdb/ldb_modules/new_partition.c +++ b/source4/dsdb/samdb/ldb_modules/new_partition.c @@ -36,6 +36,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "dsdb/samdb/samdb.h" #include "../libds/common/flags.h" +#include "dsdb/common/util.h" struct np_context { struct ldb_module *module; @@ -122,6 +123,17 @@ static int np_part_search_callback(struct ldb_request *req, struct ldb_reply *ar ret = ldb_build_extended_req(&ac->part_add, ldb, ac, DSDB_EXTENDED_CREATE_PARTITION_OID, ex_op, NULL, ac, np_part_mod_callback, req); + + /* if the parent was asking for a partial replica, then we + * need the extended operation to also ask for a partial + * replica */ + if (ldb_request_get_control(req, DSDB_CONTROL_PARTIAL_REPLICA)) { + ret = dsdb_request_add_controls(ac->part_add, DSDB_MODIFY_PARTIAL_REPLICA); + if (ret != LDB_SUCCESS) { + return ret; + } + } + LDB_REQ_SET_LOCATION(ac->part_add); if (ret != LDB_SUCCESS) { diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c index 0dd3a472c2..030f592d3a 100644 --- a/source4/dsdb/samdb/ldb_modules/partition_init.c +++ b/source4/dsdb/samdb/ldb_modules/partition_init.c @@ -770,6 +770,18 @@ int partition_create(struct ldb_module *module, struct ldb_request *req) if (ret != LDB_SUCCESS) { return ret; } + + if (ldb_request_get_control(req, DSDB_CONTROL_PARTIAL_REPLICA)) { + /* this new partition is a partial replica */ + ret = ldb_msg_add_empty(mod_msg, "partialReplica", LDB_FLAG_MOD_ADD, NULL); + if (ret != LDB_SUCCESS) { + return ret; + } + ret = ldb_msg_add_fmt(mod_msg, "partialReplica", "%s", ldb_dn_get_linearized(dn)); + if (ret != LDB_SUCCESS) { + return ret; + } + } /* Perform modify on @PARTITION record */ ret = ldb_build_mod_req(&mod_req, ldb, req, mod_msg, NULL, NULL, diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h index 601b6765d1..4c89f24247 100644 --- a/source4/dsdb/samdb/samdb.h +++ b/source4/dsdb/samdb/samdb.h @@ -96,6 +96,9 @@ struct dsdb_control_password_change_status { /* passed when we want to get the behaviour of the non-global catalog port */ #define DSDB_CONTROL_NO_GLOBAL_CATALOG "1.3.6.1.4.1.7165.4.3.17" +/* passed when we want special behaviour for partial replicas */ +#define DSDB_CONTROL_PARTIAL_REPLICA "1.3.6.1.4.1.7165.4.3.18" + struct dsdb_control_password_change { const struct samr_Password *old_nt_pwd_hash; const struct samr_Password *old_lm_pwd_hash; |