Esempio n. 1
0
 internal DeploymentManager(Uri deploymentSource, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp)
 {
     this._deploySource          = deploymentSource;
     this._isupdate              = isUpdate;
     this._isConfirmed           = isConfirmed;
     this._downloadOptions       = downloadOptions;
     this._events                = new EventHandlerList();
     this._syncGroupMap          = CollectionsUtil.CreateCaseInsensitiveHashtable();
     this._subStore              = SubscriptionStore.CurrentUser;
     this.bindWorker             = new ThreadStart(this.BindAsyncWorker);
     this.synchronizeWorker      = new ThreadStart(this.SynchronizeAsyncWorker);
     this.synchronizeGroupWorker = new WaitCallback(this.SynchronizeGroupAsyncWorker);
     this.bindCompleted          = new SendOrPostCallback(this.BindAsyncCompleted);
     this.synchronizeCompleted   = new SendOrPostCallback(this.SynchronizeAsyncCompleted);
     this.progressReporter       = new SendOrPostCallback(this.ProgressReporter);
     this.asyncOperation         = optionalAsyncOp != null ? optionalAsyncOp : AsyncOperationManager.CreateOperation((object)null);
     this._log = Logger.StartLogging();
     if (deploymentSource != (Uri)null)
     {
         Logger.SetSubscriptionUrl(this._log, deploymentSource);
     }
     this._assertApplicationReqEvents    = new ManualResetEvent[3];
     this._assertApplicationReqEvents[0] = this._trustNotGrantedEvent;
     this._assertApplicationReqEvents[1] = this._platformRequirementsFailedEvent;
     this._assertApplicationReqEvents[2] = this._trustGrantedEvent;
     this._callerType = DeploymentManager.CallerType.Other;
     PolicyKeys.SkipApplicationDependencyHashCheck();
     PolicyKeys.SkipDeploymentProvider();
     PolicyKeys.SkipSchemaValidation();
     PolicyKeys.SkipSemanticValidation();
     PolicyKeys.SkipSignatureValidation();
 }
Esempio n. 2
0
        public static bool FollowDeploymentProviderUri(SubscriptionStore subStore, ref AssemblyManifest deployment, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options)
        {
            Logger.AddMethodCall("FollowDeploymentProviderUri called.");
            tempFile = (TempFile)null;
            bool flag1    = false;
            Zone fromUrl1 = Zone.CreateFromUrl(sourceUri.AbsoluteUri);
            bool flag2    = false;

            if (fromUrl1.SecurityZone != SecurityZone.MyComputer)
            {
                Logger.AddInternalState("Deployment manifest zone is not local machine. Zone = " + (object)fromUrl1.SecurityZone);
                flag2 = true;
            }
            else
            {
                Logger.AddInternalState("Deployment manifest zone is local machine. Zone = " + (object)fromUrl1.SecurityZone);
                DependentAssembly dependentAssembly = deployment.MainDependentAssembly;
                if (dependentAssembly == null || dependentAssembly.Codebase == null)
                {
                    throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_NoAppInDeploymentManifest"));
                }
                Uri  uri      = new Uri(sourceUri, dependentAssembly.Codebase);
                Zone fromUrl2 = Zone.CreateFromUrl(uri.AbsoluteUri);
                if (fromUrl2.SecurityZone == SecurityZone.MyComputer)
                {
                    Logger.AddInternalState("Application manifest zone is local machine. Zone = " + (object)fromUrl2.SecurityZone);
                    if (!System.IO.File.Exists(uri.LocalPath))
                    {
                        Logger.AddInternalState(uri.LocalPath + " does not exist in local machine.");
                        flag2 = true;
                    }
                }
            }
            if (flag2)
            {
                Uri providerCodebaseUri = deployment.Deployment.ProviderCodebaseUri;
                Logger.SetDeploymentProviderUrl(providerCodebaseUri);
                Logger.AddInternalState("providerUri=" + (object)providerCodebaseUri + ",sourceUri=" + (object)sourceUri);
                if (!PolicyKeys.SkipDeploymentProvider() && providerCodebaseUri != (Uri)null && !providerCodebaseUri.Equals((object)sourceUri))
                {
                    ServerInformation serverInformation;
                    AssemblyManifest  deployment1;
                    try
                    {
                        deployment1 = DownloadManager.DownloadDeploymentManifestDirect(subStore, ref providerCodebaseUri, out tempFile, notification, options, out serverInformation);
                    }
                    catch (InvalidDeploymentException ex)
                    {
                        if (ex.SubType == ExceptionTypes.Manifest || ex.SubType == ExceptionTypes.ManifestLoad || (ex.SubType == ExceptionTypes.ManifestParse || ex.SubType == ExceptionTypes.ManifestSemanticValidation))
                        {
                            throw new InvalidDeploymentException(ExceptionTypes.Manifest, Resources.GetString("Ex_InvalidProviderManifest"), (Exception)ex);
                        }
                        throw;
                    }
                    Logger.SetDeploymentProviderServerInformation(serverInformation);
                    SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment);
                    if (!subStore.GetSubscriptionState(deployment1).SubscriptionId.Equals((object)subscriptionState.SubscriptionId))
                    {
                        throw new InvalidDeploymentException(ExceptionTypes.SubscriptionSemanticValidation, Resources.GetString("Ex_ProviderNotInSubscription"));
                    }
                    Logger.AddInternalState("Deployment provider followed: " + (object)providerCodebaseUri);
                    deployment = deployment1;
                    sourceUri  = providerCodebaseUri;
                    flag1      = true;
                }
            }
            if (!flag1)
            {
                Logger.AddInternalState("Deployment provider not followed.");
            }
            return(flag1);
        }
        public static bool FollowDeploymentProviderUri(SubscriptionStore subStore, ref AssemblyManifest deployment, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options)
        {
            Logger.AddMethodCall("FollowDeploymentProviderUri called.");
            tempFile = null;
            bool flag  = false;
            Zone zone  = Zone.CreateFromUrl(sourceUri.AbsoluteUri);
            bool flag2 = false;

            if (zone.SecurityZone != SecurityZone.MyComputer)
            {
                Logger.AddInternalState("Deployment manifest zone is not local machine. Zone = " + zone.SecurityZone);
                flag2 = true;
            }
            else
            {
                Logger.AddInternalState("Deployment manifest zone is local machine. Zone = " + zone.SecurityZone);
                DependentAssembly mainDependentAssembly = deployment.MainDependentAssembly;
                if ((mainDependentAssembly == null) || (mainDependentAssembly.Codebase == null))
                {
                    throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_NoAppInDeploymentManifest"));
                }
                Uri  uri   = new Uri(sourceUri, mainDependentAssembly.Codebase);
                Zone zone2 = Zone.CreateFromUrl(uri.AbsoluteUri);
                if (zone2.SecurityZone == SecurityZone.MyComputer)
                {
                    Logger.AddInternalState("Application manifest zone is local machine. Zone = " + zone2.SecurityZone);
                    if (!System.IO.File.Exists(uri.LocalPath))
                    {
                        Logger.AddInternalState(uri.LocalPath + " does not exist in local machine.");
                        flag2 = true;
                    }
                }
            }
            if (flag2)
            {
                Uri providerCodebaseUri = deployment.Deployment.ProviderCodebaseUri;
                Logger.SetDeploymentProviderUrl(providerCodebaseUri);
                Logger.AddInternalState(string.Concat(new object[] { "providerUri=", providerCodebaseUri, ",sourceUri=", sourceUri }));
                if ((!PolicyKeys.SkipDeploymentProvider() && (providerCodebaseUri != null)) && !providerCodebaseUri.Equals(sourceUri))
                {
                    ServerInformation information;
                    AssemblyManifest  manifest = null;
                    try
                    {
                        manifest = DownloadDeploymentManifestDirect(subStore, ref providerCodebaseUri, out tempFile, notification, options, out information);
                    }
                    catch (InvalidDeploymentException exception)
                    {
                        if (((exception.SubType != ExceptionTypes.Manifest) && (exception.SubType != ExceptionTypes.ManifestLoad)) && ((exception.SubType != ExceptionTypes.ManifestParse) && (exception.SubType != ExceptionTypes.ManifestSemanticValidation)))
                        {
                            throw;
                        }
                        throw new InvalidDeploymentException(ExceptionTypes.Manifest, Resources.GetString("Ex_InvalidProviderManifest"), exception);
                    }
                    Logger.SetDeploymentProviderServerInformation(information);
                    SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment);
                    if (!subStore.GetSubscriptionState(manifest).SubscriptionId.Equals(subscriptionState.SubscriptionId))
                    {
                        throw new InvalidDeploymentException(ExceptionTypes.SubscriptionSemanticValidation, Resources.GetString("Ex_ProviderNotInSubscription"));
                    }
                    Logger.AddInternalState("Deployment provider followed: " + providerCodebaseUri);
                    deployment = manifest;
                    sourceUri  = providerCodebaseUri;
                    flag       = true;
                }
            }
            if (!flag)
            {
                Logger.AddInternalState("Deployment provider not followed.");
            }
            return(flag);
        }