Example #1
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            ADMobileVirtualDirectory dataObject = this.DataObject;

            MobileSyncVirtualDirectoryHelper.SetToMetabase(dataObject, this);
            if (base.Fields.Contains("InstallIsapiFilter") && this.InstallIsapiFilter)
            {
                try
                {
                    MobileSyncVirtualDirectoryHelper.InstallIsapiFilter(this.DataObject, !ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(this.DataObject));
                }
                catch (Exception ex)
                {
                    TaskLogger.Trace("Exception occurred in InstallIsapiFilter(): {0}", new object[]
                    {
                        ex.Message
                    });
                    this.WriteWarning(Strings.ActiveSyncMetabaseIsapiInstallFailure);
                    throw;
                }
            }
            TaskLogger.LogExit();
        }
Example #2
0
 protected override void StampChangesOn(IConfigurable dataObject)
 {
     try
     {
         MobileSyncVirtualDirectoryHelper.ReadFromMetabase((ADMobileVirtualDirectory)dataObject, this);
     }
     catch (IISNotInstalledException exception)
     {
         base.WriteError(exception, ErrorCategory.ObjectNotFound, null);
     }
     catch (UnauthorizedAccessException exception2)
     {
         this.WriteError(exception2, ErrorCategory.PermissionDenied, null, false);
     }
     base.StampChangesOn(dataObject);
 }
Example #3
0
 protected override void PreDeleteFromMetabase()
 {
     if (!DirectoryEntry.Exists(base.DataObject.MetabasePath))
     {
         return;
     }
     try
     {
         MobileSyncVirtualDirectoryHelper.UninstallIsapiFilter(base.DataObject);
     }
     catch (Exception)
     {
         this.WriteWarning(Strings.ActiveSyncMetabaseIsapiUninstallFailure);
         throw;
     }
 }
        protected override void ProcessMetabaseProperties(ExchangeVirtualDirectory dataObject)
        {
            ADMobileVirtualDirectory vdirObject = (ADMobileVirtualDirectory)dataObject;

            try
            {
                MobileSyncVirtualDirectoryHelper.ReadFromMetabase(vdirObject, this);
            }
            catch (IISNotInstalledException exception)
            {
                this.WriteError(exception, ErrorCategory.ObjectNotFound, null, false);
            }
            catch (UnauthorizedAccessException exception2)
            {
                this.WriteError(exception2, ErrorCategory.PermissionDenied, null, false);
            }
        }
 protected override void InternalProcessMetabase()
 {
     TaskLogger.LogEnter();
     base.InternalProcessMetabase();
     if (base.Role == VirtualDirectoryRole.Mailbox)
     {
         this.UpdateVDirScriptMaps();
         this.UpdateCompressionLevel();
     }
     if (DirectoryEntry.Exists(this.DataObject.MetabasePath))
     {
         if (base.Role != VirtualDirectoryRole.Mailbox)
         {
             try
             {
                 MobileSyncVirtualDirectoryHelper.InstallIsapiFilter(this.DataObject, true);
             }
             catch (Exception ex)
             {
                 TaskLogger.Trace("Exception occurred in InstallIsapiFilter(): {0}", new object[]
                 {
                     ex.Message
                 });
                 this.WriteWarning(Strings.ActiveSyncMetabaseIsapiInstallFailure);
                 throw;
             }
         }
         try
         {
             if (this.InstallProxySubDirectory)
             {
                 MobileSyncVirtualDirectoryHelper.InstallProxySubDirectory(this.DataObject, this);
             }
         }
         catch (Exception ex2)
         {
             TaskLogger.Trace("Exception occurred in InstallProxySubDirectory(): {0}", new object[]
             {
                 ex2.Message
             });
             this.WriteWarning(Strings.ActiveSyncMetabaseProxyInstallFailure);
             throw;
         }
     }
     TaskLogger.LogExit();
 }
 private static void UpdateSubDirectory(ADMobileVirtualDirectory dataObject, string vdirPath, Task task)
 {
     if (IisUtility.Exists(vdirPath))
     {
         using (DirectoryEntry directoryEntry = IisUtility.CreateIISDirectoryEntry(vdirPath))
         {
             IisUtility.SetAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.None, false);
             IisUtility.SetAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.WindowsIntegrated, true);
             IisUtility.SetProperty(directoryEntry, "AccessFlags", MetabasePropertyTypes.AccessFlags.Script, true);
             directoryEntry.CommitChanges();
         }
     }
     if (dataObject.ProxyVirtualDirectoryObject != null)
     {
         MobileSyncVirtualDirectoryHelper.CopyProxyExtendedParameters(dataObject);
         ExtendedProtection.CommitToMetabase(dataObject.ProxyVirtualDirectoryObject, task);
     }
 }
        public static void SetToMetabase(ADMobileVirtualDirectory adObject, Task task)
        {
            string metabasePath = adObject.MetabasePath;

            using (DirectoryEntry directoryEntry = IisUtility.CreateIISDirectoryEntry(metabasePath))
            {
                ArrayList arrayList = new ArrayList();
                int?      num       = (int?)directoryEntry.Properties["AccessSSLFlags"].Value;
                if (num == null)
                {
                    num = new int?(0);
                }
                if (adObject.ClientCertAuth == ClientCertAuthTypes.Ignore)
                {
                    int num2 = 96;
                    num &= ~num2;
                }
                else if (adObject.ClientCertAuth == ClientCertAuthTypes.Required)
                {
                    num |= 96;
                }
                else if (adObject.ClientCertAuth == ClientCertAuthTypes.Accepted)
                {
                    num = ((num & -65) | 32);
                }
                else
                {
                    int num3 = 96;
                    num &= ~num3;
                }
                MetabaseProperty value = new MetabaseProperty("AccessSSLFlags", num);
                arrayList.Add(value);
                IisUtility.SetAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Basic, adObject.BasicAuthEnabled);
                IisUtility.SetAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.WindowsIntegrated, adObject.WindowsAuthEnabled);
                MetabaseProperty value2 = new MetabaseProperty("DoDynamicCompression", adObject.CompressionEnabled);
                arrayList.Add(value2);
                IisUtility.SetProperties(directoryEntry, arrayList);
                directoryEntry.CommitChanges();
                string vdirPath = string.Format("{0}/{1}", adObject.MetabasePath, "Proxy");
                MobileSyncVirtualDirectoryHelper.UpdateSubDirectory(adObject, vdirPath, task);
                IisUtility.CommitMetabaseChanges((adObject.Server == null) ? null : adObject.Server.ToString());
            }
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     base.InternalProcessRecord();
     try
     {
         MobileSyncVirtualDirectoryHelper.InstallProxySubDirectory(this.DataObject, this);
     }
     catch (Exception ex)
     {
         TaskLogger.Trace("Exception occurred in InstallProxySubDirectory(): {0}", new object[]
         {
             ex.Message
         });
         this.WriteWarning(Strings.ActiveSyncMetabaseProxyInstallFailure);
         throw;
     }
     TaskLogger.LogExit();
 }
        private static void InstallSubDirectory(ADMobileVirtualDirectory dataObject, string subDirectoryName, Task task)
        {
            bool flag = false;

            using (DirectoryEntry directoryEntry = IisUtility.CreateIISDirectoryEntry(dataObject.MetabasePath, new Task.TaskErrorLoggingReThrowDelegate(task.WriteError), dataObject.Identity))
            {
                string path = Path.Combine(directoryEntry.Properties["Path"].Value.ToString(), subDirectoryName);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string text = string.Format("{0}/{1}", dataObject.MetabasePath, subDirectoryName);
                if (!IisUtility.Exists(text))
                {
                    IisUtility.CreateWebDirectory(directoryEntry, subDirectoryName);
                    MobileSyncVirtualDirectoryHelper.UpdateSubDirectory(dataObject, text, task);
                    directoryEntry.CommitChanges();
                    IisUtility.CommitMetabaseChanges((dataObject.Server == null) ? null : dataObject.Server.Name);
                    flag = true;
                }
                ExTraceGlobals.TaskTracer.Information(0L, string.Format("Installed SubDirectory '{0}' with result '{1}'", subDirectoryName, flag));
            }
        }
 internal static void InstallProxySubDirectory(ADMobileVirtualDirectory dataObject, Task task)
 {
     dataObject.InitProxyVDirDataObject();
     MobileSyncVirtualDirectoryHelper.InstallSubDirectory(dataObject, "Proxy", task);
 }