public void SetDomainFlag(string domainFqdn, GlsDomainFlags flag, bool value) { string address = MServDirectorySession.EntryIdForGlsDomainFlag(domainFqdn, flag); MServDirectorySession.RemoveMserveEntry(address, value ? 0 : 1); MServDirectorySession.AddMserveEntry(address, value ? 1 : 0); }
private string GetRedirectServerFromMemberName(string memberName, out bool alreadyInTheRightForest, bool throwExceptionsOnTenantNotFound) { string address = string.Format("E5CB63F56E8B4b69A1F70C192276D6AD@{0}", GlsDirectorySession.ParseMemberName(memberName).Domain); int partnerId = MServDirectorySession.ReadMservEntry(address); return(this.GetRedirectServerFromPartnerId(partnerId, out alreadyInTheRightForest, throwExceptionsOnTenantNotFound)); }
internal static bool RemoveMserveEntry(string address, int value) { try { if (MServDirectorySession.RemoveMserveEntryWithExactValue(address, value)) { return(true); } } catch (MServPermanentException) { ExTraceGlobals.MServTracer.TraceWarning <string, int>(0L, "Could not remove {0} with PartnerId {1}, will read the actual value now", address, value); value = MServDirectorySession.ReadMservEntry(address); if (value == -1) { ExTraceGlobals.MServTracer.TraceWarning <string>(0L, "Entry {0} does not exist, no need to remove", address); return(true); } } if (!MServDirectorySession.RemoveMserveEntryWithExactValue(address, value)) { Globals.LogEvent(DirectoryEventLogConstants.Tuple_CannotDeleteMServEntry, address, new object[] { address }); return(false); } return(true); }
public string GetRedirectServer(Guid orgGuid) { string address = string.Format("43BA6209CC0F4542958F65F8BF1CDED6@{0}.exchangereserved", orgGuid.ToString()); int partnerId = MServDirectorySession.ReadMservEntry(address); bool flag; return(this.GetRedirectServerFromPartnerId(partnerId, out flag, true)); }
private void UpdateAcceptedDomainMservEntry(Guid externalDirectoryOrganizationId, string domainFqdn, bool allowOverwrite) { string mservEntryKey = string.Format("E5CB63F56E8B4b69A1F70C192276D6AD@{0}", domainFqdn); int partnerId = this.UpdateMservEntry(externalDirectoryOrganizationId, allowOverwrite, mservEntryKey); string mservEntryKey2 = string.Format("21668DE042684883B19BCB376E3BE474@{0}", domainFqdn); this.UpdateMservEntry(externalDirectoryOrganizationId, allowOverwrite, mservEntryKey2); MServDirectorySession.CleanupLegacyEntries(externalDirectoryOrganizationId, domainFqdn, partnerId); }
public bool TryGetRedirectServer(Guid orgGuid, out string fqdn) { string address = string.Format("43BA6209CC0F4542958F65F8BF1CDED6@{0}.exchangereserved", orgGuid.ToString()); int partnerId = MServDirectorySession.ReadMservEntry(address); bool flag; fqdn = this.GetRedirectServerFromPartnerId(partnerId, out flag, false); return(flag || string.Empty != fqdn); }
private static bool RemoveMserveEntryWithExactValue(string address, int value) { RecipientSyncOperation recipientSyncOperation = new RecipientSyncOperation(); recipientSyncOperation.RemovedEntries.Add(address); recipientSyncOperation.PartnerId = value; MServDirectorySession.SyncToMserv(address, recipientSyncOperation); return(recipientSyncOperation.Synchronized); }
internal static bool AddMserveEntry(string address, int value) { RecipientSyncOperation recipientSyncOperation = new RecipientSyncOperation(); recipientSyncOperation.AddedEntries.Add(address); recipientSyncOperation.PartnerId = value; MServDirectorySession.SyncToMserv(address, recipientSyncOperation); return(recipientSyncOperation.Synchronized); }
private string GetResourceForestFqdnFromMservKey(string partnerIdEntryKey) { string result = null; int partnerId = MServDirectorySession.ReadMservEntry(partnerIdEntryKey); if (!this.TryGetForestFqdnFromPartnerId(partnerId, out result)) { return(null); } return(result); }
private static void CleanupLegacyEntries(Guid externalDirectoryOrganizationId, string domainFqdn, int partnerId) { Tuple <string, int>[] array = new Tuple <string, int>[] { new Tuple <string, int>(string.Format("7f66cd009b304aeda37ffdeea1733ff6@{0}", domainFqdn), partnerId), new Tuple <string, int>(string.Format("3da19c7b44a74bd3896daaf008594b6c@{0}.exchangereserved", externalDirectoryOrganizationId.ToString()), partnerId) }; foreach (Tuple <string, int> tuple in array) { MServDirectorySession.RemoveMserveEntry(tuple.Item1, tuple.Item2); } }
public void RemoveTenant(Guid externalDirectoryOrganizationId) { int partnerId = this.GetLocalSite().PartnerId; string[] array = new string[] { string.Format("43BA6209CC0F4542958F65F8BF1CDED6@{0}.exchangereserved", externalDirectoryOrganizationId.ToString()) }; foreach (string address in array) { MServDirectorySession.RemoveMserveEntry(address, partnerId); } }
public bool TryGetDomainFlag(string domainFqdn, GlsDomainFlags flag, out bool value) { string address = MServDirectorySession.EntryIdForGlsDomainFlag(domainFqdn, flag); int num = MServDirectorySession.ReadMservEntry(address); if (num == -1) { value = false; } else { value = (num > 0); } return(true); }
internal static int ReadMservEntry(string address) { List <RecipientSyncOperation> list = MServDirectorySession.SyncToMserv(address, new RecipientSyncOperation { ReadEntries = { address } }); if (list.Count <= 0) { return(-1); } return(list[0].PartnerId); }
public void RemoveAcceptedDomain(Guid externalDirectoryOrganizationId, string domainFqdn) { int partnerId = this.GetLocalSite().PartnerId; Tuple <string, int>[] array = new Tuple <string, int>[] { new Tuple <string, int>(string.Format("21668DE042684883B19BCB376E3BE474@{0}", domainFqdn), partnerId), new Tuple <string, int>(string.Format("ade5142cfe3d4ff19fed54a7f6087a98@{0}", domainFqdn), 0), new Tuple <string, int>(string.Format("0f01471e875a455a80c59def2a36ee3f@{0}", domainFqdn), 0), new Tuple <string, int>(string.Format("E5CB63F56E8B4b69A1F70C192276D6AD@{0}", domainFqdn), partnerId) }; foreach (Tuple <string, int> tuple in array) { MServDirectorySession.RemoveMserveEntry(tuple.Item1, tuple.Item2); } }
private int UpdateMservEntry(Guid externalDirectoryOrganizationId, bool allowOverwrite, string mservEntryKey) { int partnerId = this.GetLocalSite().PartnerId; int num = MServDirectorySession.ReadMservEntry(mservEntryKey); if (num == -1) { MServDirectorySession.AddMserveEntry(mservEntryKey, partnerId); } else if (num != partnerId) { if (!allowOverwrite) { throw new MServPermanentException(DirectoryStrings.TenantAlreadyExistsInMserv(externalDirectoryOrganizationId, num, partnerId)); } MServDirectorySession.RemoveMserveEntry(mservEntryKey, num); MServDirectorySession.AddMserveEntry(mservEntryKey, partnerId); } return(num); }
static MServDirectorySession() { MServDirectorySession.InitializePartnerIdMap(); }