private string Write2_SyncTreeType(SyncTreeType v) { switch (v) { case SyncTreeType.Configuration: return("Configuration"); case SyncTreeType.Recipients: return("Recipients"); case SyncTreeType.General: return("General"); } return(XmlSerializationWriter.FromEnum((long)v, new string[] { "Configuration", "Recipients", "General" }, new long[] { 1L, 2L, 4L }, "Microsoft.Exchange.EdgeSync.Common.SyncTreeType")); }
public override List <TypeSynchronizer> CreateTypeSynchronizer(SyncTreeType type) { List <TypeSynchronizer> list = new List <TypeSynchronizer>(); if (type == SyncTreeType.Recipients) { list.Add(new TypeSynchronizer(new Filter(MserveSynchronizationProvider.LoadAndFilter), new PreDecorate(MserveSynchronizationProvider.PreDecorate), null, null, null, null, "Mserve hosted recipients", Schema.Query.QueryAllHostedSmtpRecipients, null, SearchScope.Subtree, MserveSynchronizationProvider.ReplicationAttributes, null, true)); ExTraceGlobals.ProviderTracer.TraceDebug((long)this.GetHashCode(), "Mserve provider created typeSynchronizer"); } return(list); }
public override List <TypeSynchronizer> CreateTypeSynchronizer(SyncTreeType type) { List <TypeSynchronizer> list = new List <TypeSynchronizer>(); if (this.ehfWebServiceVersion != EhfWebServiceVersion.Version1 && this.ehfWebServiceVersion != EhfWebServiceVersion.Version2) { EdgeSyncEvents.Log.LogEvent(EdgeSyncEventLogConstants.Tuple_EhfWebServiceVersionIsNotSupported, null, new object[] { this.ehfWebServiceVersion, this.identity }); return(list); } if (type == SyncTreeType.Configuration) { list.Add(EhfCompanySynchronizer.CreateTypeSynchronizer()); list.Add(EhfDomainSynchronizer.CreateTypeSynchronizer()); } else if (type == SyncTreeType.Recipients) { list.Add(EhfAdminAccountSynchronizer.CreateTypeSynchronizer()); } return(list); }
public LdapTargetConnection(int localServerVersion, TargetServerConfig config, NetworkCredential credentials, SyncTreeType type, EdgeSyncLogSession logSession) : base(localServerVersion, config) { this.type = type; this.logSession = logSession; LdapDirectoryIdentifier identifier = new LdapDirectoryIdentifier(string.Format(CultureInfo.InvariantCulture, "{0}:{1}", new object[] { base.Host, base.Port })); ExTraceGlobals.ConnectionTracer.TraceDebug <string>((long)this.GetHashCode(), "Attempting to connect to {0}", base.Host); try { this.connection = new LdapConnection(identifier); } catch (LdapException ex) { ExTraceGlobals.ConnectionTracer.TraceError <string, string>((long)this.GetHashCode(), "Failed to create a LdapConnection to {0} because {1}", base.Host, ex.Message); throw new ExDirectoryException(ex); } this.connection.SessionOptions.VerifyServerCertificate = new VerifyServerCertificateCallback(this.VerifyServerCertificate); this.connection.SessionOptions.SecureSocketLayer = true; this.connection.SessionOptions.Signing = false; this.connection.SessionOptions.Sealing = false; this.connection.SessionOptions.ReferralChasing = ReferralChasingOptions.None; this.connection.SessionOptions.ProtocolVersion = 3; this.connection.AuthType = AuthType.Basic; try { this.connection.Bind(credentials); } catch (DirectoryException ex2) { ExTraceGlobals.ConnectionTracer.TraceError <string, string>((long)this.GetHashCode(), "Failed to connect to {0} because {1}", base.Host, ex2.Message); throw new ExDirectoryException(ex2); } SearchResponse searchResponse = (SearchResponse)this.SendRequest(new SearchRequest(string.Empty, Schema.Query.QueryAll, System.DirectoryServices.Protocols.SearchScope.Base, null)); if (searchResponse.Entries.Count == 1) { SearchResultAttributeCollection attributes = searchResponse.Entries[0].Attributes; this.adamConfigurationNamingContext = (string)attributes["configurationNamingContext"][0]; this.adamRootOrgContainerDN = "CN=First Organization,CN=Microsoft Exchange,CN=Services," + this.adamConfigurationNamingContext; string ldapFilter = "(&(objectClass=msExchExchangeServer)(networkAddress=ncacn_ip_tcp:" + base.Host + "))"; SearchRequest request = new SearchRequest(this.adamConfigurationNamingContext, ldapFilter, System.DirectoryServices.Protocols.SearchScope.Subtree, new string[] { "name" }); searchResponse = (SearchResponse)this.SendRequest(request); if (searchResponse.Entries.Count > 0) { this.serverDistinguishedName = searchResponse.Entries[0].DistinguishedName; this.serverName = (string)searchResponse.Entries[0].Attributes["name"][0]; return; } throw new ExDirectoryException(ResultCode.NoSuchAttribute, "Could not read Edge server config object"); } else { if (searchResponse.Entries.Count == 0) { throw new ExDirectoryException(ResultCode.NoSuchAttribute, "Could not read ADAM config naming context"); } throw new InvalidOperationException("expected single result"); } }
public override TargetConnection CreateTargetConnection(TargetServerConfig targetServerConfig, SyncTreeType type, TestShutdownAndLeaseDelegate testShutdownAndLease, EdgeSyncLogSession logSession) { return(new MserveTargetConnection(EdgeSyncSvc.EdgeSync.Topology.LocalServer.VersionNumber, targetServerConfig as MserveTargetServerConfig, this.RecipientSyncInterval, testShutdownAndLease, logSession)); }
public static TargetConnection Create(Server localHub, TargetServerConfig targetServerConfig, NetworkCredential credential, SyncTreeType type, EdgeSyncLogSession logSession) { TargetConnection result; try { result = new LdapTargetConnection(localHub.VersionNumber, targetServerConfig, credential, type, logSession); } catch (ExDirectoryException ex) { if (ex.InnerException is LdapException) { LdapException ex2 = ex.InnerException as LdapException; if (ex2.ErrorCode == 49) { string userName = credential.UserName; string host = targetServerConfig.Host; } } throw; } return(result); }
public override TargetConnection CreateTargetConnection(TargetServerConfig targetServerConfig, SyncTreeType type, TestShutdownAndLeaseDelegate testShutdownAndLease, EdgeSyncLogSession logSession) { if (type == SyncTreeType.Configuration) { return(new EhfConfigTargetConnection(EdgeSyncSvc.EdgeSync.Topology.LocalServer.VersionNumber, (EhfTargetServerConfig)targetServerConfig, this.ConfigurationSyncInterval, logSession)); } if (type == SyncTreeType.Recipients) { return(new EhfRecipientTargetConnection(EdgeSyncSvc.EdgeSync.Topology.LocalServer.VersionNumber, (EhfTargetServerConfig)targetServerConfig, this, logSession)); } throw new NotSupportedException("Only config and recipient synchronization is supported by EHF sync provider"); }
public Status(string name, SyncTreeType type) { this.Name = name; this.Type = type; }
public abstract TargetConnection CreateTargetConnection(TargetServerConfig targetServerConfig, SyncTreeType type, TestShutdownAndLeaseDelegate testShutdownAndLease, EdgeSyncLogSession logSession);
public abstract List <TypeSynchronizer> CreateTypeSynchronizer(SyncTreeType type);