diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-08-31 04:16:18 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-09-03 13:23:48 +0300 |
commit | 715743b38dec1968dce843573a12947407d74324 (patch) | |
tree | b0d36581334a8e7db6b5b764229d5ca59f16ad39 /source4/dsdb/repl | |
parent | 3691e6c97b2187730d42a2bb79ecc06f37aab344 (diff) | |
download | samba-715743b38dec1968dce843573a12947407d74324.tar.gz samba-715743b38dec1968dce843573a12947407d74324.tar.bz2 samba-715743b38dec1968dce843573a12947407d74324.zip |
s4-dreplsrv: Helpers to locate source DSA in a partition by GUID or DNS name
Diffstat (limited to 'source4/dsdb/repl')
-rw-r--r-- | source4/dsdb/repl/drepl_partitions.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c index c388a4b516..caa93e6d54 100644 --- a/source4/dsdb/repl/drepl_partitions.c +++ b/source4/dsdb/repl/drepl_partitions.c @@ -268,6 +268,46 @@ WERROR dreplsrv_partition_find_for_nc(struct dreplsrv_service *s, return WERR_DS_DRA_BAD_NC; } +WERROR dreplsrv_partition_source_dsa_by_guid(struct dreplsrv_partition *p, + const struct GUID *dsa_guid, + struct dreplsrv_partition_source_dsa **_dsa) +{ + struct dreplsrv_partition_source_dsa *dsa; + + SMB_ASSERT(dsa_guid != NULL); + SMB_ASSERT(!GUID_all_zero(dsa_guid)); + SMB_ASSERT(_dsa); + + for (dsa = p->sources; dsa; dsa = dsa->next) { + if (GUID_equal(dsa_guid, &dsa->repsFrom1->source_dsa_obj_guid)) { + *_dsa = dsa; + return WERR_OK; + } + } + + return WERR_DS_DRA_NO_REPLICA; +} + +WERROR dreplsrv_partition_source_dsa_by_dns(const struct dreplsrv_partition *p, + const char *dsa_dns, + struct dreplsrv_partition_source_dsa **_dsa) +{ + struct dreplsrv_partition_source_dsa *dsa; + + SMB_ASSERT(dsa_dns != NULL); + SMB_ASSERT(_dsa); + + for (dsa = p->sources; dsa; dsa = dsa->next) { + if (strequal(dsa_dns, dsa->repsFrom1->other_info->dns_name)) { + *_dsa = dsa; + return WERR_OK; + } + } + + return WERR_DS_DRA_NO_REPLICA; +} + + static WERROR dreplsrv_refresh_partition(struct dreplsrv_service *s, struct dreplsrv_partition *p) { |