Пример #1
0
        /// <summary>
        /// Get the connection string for the provider.
        /// </summary>
        /// <param name="providerName">The name of the provider.</param>
        /// <returns>The connection string.</returns>
        private string GetConnectionString(string providerName)
        {
            string connStr = string.Empty;

            try
            {
                RoleManagerSection configSection = (RoleManagerSection)HttpContext.Current.GetSection("system.web/roleManager");

                ProviderSettings providerItem = configSection.Providers[providerName];
                if (providerItem != null)
                {
                    string connStrName = providerItem.Parameters["connectionStringName"];
                    if (!string.IsNullOrEmpty(connStrName))
                    {
                        connStr = WebConfigurationManager.ConnectionStrings[connStrName].ConnectionString;
                    }
                }
            }
            catch (Exception e)
            {
                ULS.LogError("SqlSiteRoleProvider.GetConnectionString", "No Connection String Retrieved for provider name: " + providerName + "\n" + e.ToString(), "RoleProvider");
                throw new ProviderException(e.ToString());
            }

            return(connStr);
        }
Пример #2
0
        public static void LogMessage(ActivityExecutionContext executionContext, SPWorkflowHistoryEventType eventType, string outcome, string message, int userID, bool ccULS)
        {
            try
            {
                //write to Workflow History List
                ISharePointService spService = (ISharePointService)executionContext.GetService(typeof(ISharePointService));
                spService.LogToHistoryList(executionContext.ContextGuid, eventType, userID, TimeSpan.MinValue, outcome, message, message);

                //Write to ULS trace log
                if (ccULS)
                {
                    string source = executionContext.Activity.Name;
                    TraceProvider.TraceSeverity traceSeverity = TraceProvider.TraceSeverity.InformationEvent;

                    if (eventType == SPWorkflowHistoryEventType.WorkflowError)
                    {
                        traceSeverity = TraceProvider.TraceSeverity.Exception;
                    }

                    ULS.LogMessage(source, message, "Site Management", traceSeverity);
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("SiteManagementActivity", "History Logging Failed:" + ex.ToString());
            }
        }
        // Token: 0x06000040 RID: 64 RVA: 0x00002F4C File Offset: 0x0000114C
        private RULE_PACKAGE_DETAILS LoadRules(string packageId)
        {
            ULS.SendTraceTag(4850015U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationStore.GetDefaultRulePackageDetails :: Loading rules for package [{0}]", new object[]
            {
                packageId
            });
            RULE_PACKAGE_DETAILS result = default(RULE_PACKAGE_DETAILS);

            result.RulePackageID    = packageId;
            result.RulePackageSetID = "NA";
            List <string> list = new List <string>();

            if (this.defaultRuleSet.PackageId == packageId)
            {
                foreach (string text in this.defaultRuleSet.AllRuleIds)
                {
                    if (VariantConfiguration.IsFeatureEnabled(40, text))
                    {
                        ULS.SendTraceTag(4850016U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetDefaultRulePackageDetails :: Adding rule [{0}]", new object[]
                        {
                            text
                        });
                        list.Add(text);
                    }
                }
            }
            result.RuleIDs = list.ToArray();
            return(result);
        }
Пример #4
0
 // Token: 0x0600004C RID: 76 RVA: 0x00003314 File Offset: 0x00001514
 protected override IRecordProducer GetProducer(DLPClassificationOperator op, IRecordSetTypeDescriptor type, IEvaluationContext context)
 {
     if (op == null)
     {
         throw new ArgumentNullException("op");
     }
     try
     {
         ULS.SendTraceTag(4850019U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPClassificationEvaluator.GetProducer :: Using Operator :: {0}", new object[]
         {
             op
         });
         if (!DLPClassificationEvaluator.initialized)
         {
             DLPClassificationEvaluator.InitializeClassificationEngine(op.ClassificationConfiguration);
         }
         return(new DLPClassificationEvaluator.DLPClassificationProducer(DLPClassificationEvaluator.classificationService, DLPClassificationEvaluator.ruleStore));
     }
     catch (ThreadAbortException)
     {
     }
     catch (OutOfMemoryException)
     {
         throw;
     }
     catch (Exception ex)
     {
         ULS.SendTraceTag(4850048U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 10, "Exception in DLPClassificationEvaluator.GetProducer :: {0}", new object[]
         {
             ex
         });
     }
     return(null);
 }
Пример #5
0
        // Token: 0x0600009C RID: 156 RVA: 0x00004654 File Offset: 0x00002854
        protected override TreeNode ProcessScopeSubQueryTree(TreeNode scopeSubQueryTree)
        {
            if (this.isDLPAuthorized)
            {
                return(scopeSubQueryTree);
            }
            ScopeNode scopeNode = scopeSubQueryTree as ScopeNode;

            if (scopeNode == null || scopeNode.Scope == null)
            {
                ULS.SendTraceTag(5578898U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree ::tenantId={0};  Argument is null or is not a ScopeNode.", new object[]
                {
                    this.tenantId
                });
                return(scopeSubQueryTree);
            }
            string scope = scopeNode.Scope;

            if (this.classificationScopes.Contains(scope))
            {
                ULS.SendTraceTag(5256290U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree :: tenantId={0}; property={1}; Attempt by unauthorized user to access data-loss-prevention properties.", new object[]
                {
                    this.tenantId,
                    scope
                });
                throw new SecurityAccessDeniedException("You do not have access to the property identified in this scope: " + scopeSubQueryTree);
            }
            ULS.SendTraceTag(5578899U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree :: tenantId={0}; scopeSubQueryTree={1}; Erroneously entered ProcessScopeSubQueryTree with an argument that is not a classification property.  This should not have happened because the scopes of the associated operator should only contain classification properties.", new object[]
            {
                this.tenantId,
                scopeSubQueryTree.ToString()
            });
            return(scopeSubQueryTree);
        }
Пример #6
0
        public string ResetUserPassword(string appName, string userName, bool MappedApplication)
        {
            string oldApp      = Membership.ApplicationName;
            string newPassword = string.Empty;

            try
            {
                if (MappedApplication)
                {
                    Membership.ApplicationName = GetMapping(appName);
                }
                else
                {
                    Membership.ApplicationName = appName;
                }

                MembershipUser user = Membership.GetUser(userName);
                if (user == null)
                {
                    ULS.LogError("SQLMembershipWS", "No user found for " + appName + ":" + userName, "SQLMembershipWS");
                    throw new Exception("User (" + userName + ") Could Not Be Found");
                }

                newPassword = user.ResetPassword();
            }
            finally
            {
                Membership.ApplicationName = oldApp;
            }
            return(newPassword);
        }
Пример #7
0
        /// <summary>
        /// Delete a user from the membership directory
        /// </summary>
        /// <param name="UserName">The user name of the user to delete</param>
        private static void DeleteUser(string UserName)
        {
            bool bDeleted = false;

            bDeleted = Membership.DeleteUser(UserName, true);
            if (bDeleted == false)
            {
                ULS.LogError("DeleteUser", "The user could not be deleted: " + UserName, "SQLMembershipWS");
                throw new Exception("The user could not be deleted.");
            }
        }
        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
#if DEBUG
            Debugger.Break();
#endif
            ULS.LogMessage(ULS_PRODUCT_NAME, string.Format("Started Activation of {0} feature", FEATURE_NAME), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
            SPSite siteCollection = properties.Feature.Parent as SPSite;
            if (siteCollection != null)
            {
                ULS.LogMessage(ULS_PRODUCT_NAME, string.Format("Started Activation of {0} feature for {1}", FEATURE_NAME, siteCollection.Port), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
                SPWeb topLevelSite = siteCollection.RootWeb;

                // Calculate relative path to site from Web Application root.
                string WebAppRelativePath = topLevelSite.ServerRelativeUrl;
                if (!WebAppRelativePath.EndsWith("/"))
                {
                    WebAppRelativePath += "/";
                }

                ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Processed: {0}", topLevelSite.Title), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);

                // Enumerate through each site and apply branding.
                foreach (SPWeb site in siteCollection.AllWebs)
                {
                    try
                    {
                        ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Started Activating {0} Feature in the {1} site ", FEATURE_NAME, site.Name), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
                        site.AllowUnsafeUpdates = true;
                        site.MasterUrl          = WebAppRelativePath + customizedMasterUrl;
                        site.CustomMasterUrl    = WebAppRelativePath + customizedMasterUrl;
                        site.AlternateCssUrl    = WebAppRelativePath + alternateCSSUrl;
                        //site.SiteLogoUrl = WebAppRelativePath + "Style%20Library/Branding101/Images/Logo.gif";
                        site.SiteLogoUrl = "";
                        site.UIVersion   = 4;
                        site.Update();
                        site.AllowUnsafeUpdates = false;
                    }
                    catch (Exception ex)
                    {
                        ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("{0};{1}", ex.Message, ex.StackTrace), Microsoft.SharePoint.Administration.TraceSeverity.Unexpected, Microsoft.SharePoint.Administration.EventSeverity.Error);
                    }
                    finally
                    {
                        if (site != null)
                        {
                            site.Dispose();
                        }
                        ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Finished Activating {0} Feature in the {1} site ", FEATURE_NAME, site.Name), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
                    }
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Create a new user in the membership directory
        /// </summary>
        /// <param name="login">The user name for the new user.</param>
        /// <param name="password">The password for the new user.</param>
        /// <param name="email">The e-mail address for the new user.</param>
        /// <param name="passwordQuestion">The password-question value for the membership user.</param>
        /// <param name="passwordAnswer">The password-answer value for the membership user.</param>
        private static void CreateUser(string login, string password, string email, string passwordQuestion, string passwordAnswer)
        {
            MembershipCreateStatus userStatus = new MembershipCreateStatus();

            // Create the user in the SQL membership database
            Membership.CreateUser(login, password, email, passwordQuestion, passwordAnswer, true, out userStatus);

            // Check the Status
            if (userStatus != MembershipCreateStatus.Success)
            {
                ULS.LogError("CreateUser", "User " + login + " failed with status " + userStatus.ToString(), "SQLMembershipWS");
                throw new Exception("User " + login + " failed with status " + userStatus.ToString());
            }
        }
Пример #10
0
        // Token: 0x06000093 RID: 147 RVA: 0x00003EE8 File Offset: 0x000020E8
        public TreeNode CreateSubtree()
        {
            ScopeNode        scopeNode = null;
            RangeNode <long> rangeNode = new RangeNode <long>();

            rangeNode.StartInclusive = new bool?(true);
            rangeNode.Start          = this.CountMinimum;
            rangeNode.EndInclusive   = new bool?(true);
            rangeNode.End            = this.CountMaximum;
            ScopeNode scopeNode2 = new ScopeNode("ClassificationCount");

            scopeNode2.FirstChild = rangeNode;
            if (!this.isDefaultConfidenceRange)
            {
                RangeNode <long> rangeNode2 = new RangeNode <long>();
                rangeNode2.StartInclusive = new bool?(true);
                rangeNode2.Start          = this.ConfidenceMinimum;
                rangeNode2.EndInclusive   = new bool?(true);
                rangeNode2.End            = this.ConfidenceMaximum;
                scopeNode            = new ScopeNode("ClassificationConfidence");
                scopeNode.FirstChild = rangeNode2;
            }
            TreeNode treeNode;

            if (this.isDefaultConfidenceRange)
            {
                treeNode = scopeNode2;
            }
            else if (this.isDefaultCountRange)
            {
                treeNode = scopeNode;
            }
            else
            {
                AndNode andNode = new AndNode();
                andNode.AddNode(scopeNode2);
                andNode.AddNode(scopeNode);
                treeNode = andNode;
            }
            if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
            {
                ULS.SendTraceTag(6121180U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "ClassificationDecoding.CreateSubtree :: subtree={0}; Result of transforming the query.", new object[]
                {
                    treeNode
                });
            }
            return(treeNode);
        }
Пример #11
0
 // Token: 0x06000053 RID: 83 RVA: 0x00003804 File Offset: 0x00001A04
 private void EvaluateFlights(string path, string tenantId, IRecord record, out bool crawl, out bool persist)
 {
     crawl   = false;
     persist = false;
     if (VariantConfiguration.IsFeatureEnabled(41, tenantId))
     {
         crawl   = true;
         persist = true;
     }
     ULS.SendTraceTag(4850052U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPClassificationEvaluator.EvaluateFlights :: path=[{0}] crawl={1}  persist={2}", new object[]
     {
         path,
         crawl,
         persist
     });
 }
Пример #12
0
 // Token: 0x0600004D RID: 77 RVA: 0x000033CC File Offset: 0x000015CC
 private static void InitializeClassificationEngine(ClassificationConfiguration configuration)
 {
     if (!DLPClassificationEvaluator.initialized)
     {
         lock (DLPClassificationEvaluator.lockObj)
         {
             if (!DLPClassificationEvaluator.initialized)
             {
                 ULS.SendTraceTag(4850049U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPClassificationEvaluator.InitializeClassificationEngine :: Creating Classification Service");
                 DLPClassificationEvaluator.ruleStore = new FASTClassificationStore();
                 ExecutionLog executionLog = new FASTExcecutionLog();
                 DLPClassificationEvaluator.classificationService = new ClassificationService(DLPClassificationEvaluator.ruleStore, configuration, executionLog);
                 DLPClassificationEvaluator.initialized           = true;
             }
         }
     }
 }
        // Token: 0x0600003C RID: 60 RVA: 0x00002DE0 File Offset: 0x00000FE0
        public void GetRulePackages(uint ulRulePackageRequestDetailsSize, RULE_PACKAGE_REQUEST_DETAILS[] rulePackageRequestDetails)
        {
            if (rulePackageRequestDetails == null)
            {
                return;
            }
            int num = 0;

            while ((long)num < (long)((ulong)ulRulePackageRequestDetailsSize))
            {
                ULS.SendTraceTag(4850013U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetRulePackages :: Requested Package :: {0}", new object[]
                {
                    rulePackageRequestDetails[num].RulePackageID
                });
                ClassificationRuleSet classificationRuleSet = this.ruleSets[rulePackageRequestDetails[num].RulePackageID];
                rulePackageRequestDetails[num].RulePackage = classificationRuleSet.RuleXML;
                num++;
            }
        }
Пример #14
0
        /// <summary>
        /// Get the application name that corresponds to the fully qualified domain name.
        /// </summary>
        /// <param name="fqdn">The fully qualified domain name.</param>
        /// <param name="connString">The connection string for this provider.</param>
        /// <returns>The application name.</returns>
        private string GetMappedAppName(string fqdn, string connString)
        {
            string        appName    = string.Empty;
            SqlConnection connection = null;
            SqlCommand    command    = null;

            try
            {
                connection          = new SqlConnection(connString);
                command             = new SqlCommand("dbo.aspnet_Sitemaps_GetApplicationNameByFQDN", connection);
                command.CommandType = CommandType.StoredProcedure;
                SqlParameter parameter = command.Parameters.Add("@fqdn", SqlDbType.NVarChar);
                parameter.Value = fqdn;

                // elevate permissions to allow user to read database.
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    connection.Open();
                    appName = command.ExecuteScalar() as string;
                });
                if (string.IsNullOrEmpty(appName))
                {
                    ULS.LogMessage("SQLSiteMembershipProvider.GetMappedAppName", "Could Not Get Mapped Application Name for FQDN: " + fqdn, "Membership", TraceProvider.TraceSeverity.CriticalEvent);
                }
            }
            finally
            {
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
                if (connection != null)
                {
                    connection.Dispose();
                }
                if (command != null)
                {
                    command.Dispose();
                }
            }
            return(appName);
        }
Пример #15
0
        // Token: 0x0600009D RID: 157 RVA: 0x00004740 File Offset: 0x00002940
        private bool CanAccessDataLossPreventionProperties(IRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }
            IUpdateableBucketField updateableBucketField = record[this.propertyBagPosition] as IUpdateableBucketField;

            if (updateableBucketField == null)
            {
                ULS.SendTraceTag(5256291U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySecurityProducer.CanAccessDataLossPreventionProperties :: tenantId={0}; The record did not have a 'PropertyBag' entry.   We cannot determine if the user has permission, so we assume not.", new object[]
                {
                    this.tenantId
                });
                return(false);
            }
            IStringField stringField = updateableBucketField["RootWebTemplate"] as IStringField;

            if (stringField == null)
            {
                ULS.SendTraceTag(5256320U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySecurityProducer.CanAccessDataLossPreventionProperties :: tenantId={0}; The record did not have a 'RootWebTemplate' entry in its 'PropertyBag' or the value was not of type IStringField.   We cannot determine if the user has permission, so we assume not.", new object[]
                {
                    this.tenantId
                });
                return(false);
            }
            if (DLPQuerySecurityProducer.AuthorizedWebTemplateIdentifiers.Contains(stringField.StringValue, StringComparer.Ordinal))
            {
                ULS.SendTraceTag(5256321U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySecurityProducer.CanAccessDataLossPreventionProperties :: tenantId={0}; RootWebTemplate={1}; The query comes from an authorized template.  The user, by virtue of having access to an authorized template, has permission to query for data-loss-prevention properties.", new object[]
                {
                    this.tenantId,
                    stringField.StringValue
                });
                return(true);
            }
            ULS.SendTraceTag(5256322U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySecurityProducer.CanAccessDataLossPreventionProperties :: tenantId={0}; RootWebTemplate={1}; The query does not come from an authorized template.  If the query contains data-loss-prevention properties, it will be rejected.  Identifier for the web template where the query originated: ", new object[]
            {
                this.tenantId,
                stringField.StringValue
            });
            return(false);
        }
        // Token: 0x060000AD RID: 173 RVA: 0x00004A44 File Offset: 0x00002C44
        private Guid GetTenantId(IRecord record)
        {
            Guid result = Guid.Empty;

            if (record == null)
            {
                throw new ArgumentNullException("record");
            }
            IField field = record[this.partitionIdPosition];

            if (field != null)
            {
                result = (Guid)field.Value;
            }
            else
            {
                ULS.SendTraceTag(5833438U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveResultTranslationProducer.GetTenantId :: Could not extract the 'PartitionId' entry (which represents the tenant ID) from the record.  Using the empty Guid.");
            }
            return(result);
        }
Пример #17
0
        private DetailsResult GetULSEntries()
        {
            if (CorrelationId == Guid.Empty)
            {
                return(DetailsResult.Empty());
            }

            var entries = new ULS().FindLogs(CorrelationId);

            if (entries == null)
            {
                return(DetailsResult.Empty());
            }

            var response = new DetailsResult();

            response.Entries = entries.Take(ULS.Limit - 1).ToList();
            response.More    = entries.Count >= ULS.Limit;

            return(response);
        }
Пример #18
0
 /// <summary>
 /// When this feature is deactivated, it removes the connection string,
 /// membership provider, and role provider information from the web.config
 /// for the web application.  The People picker setting for the web app
 /// is left as is because we don't know what the correct state would be.
 /// </summary>
 public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
 {
     try
     {
         SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
         if (webApp != null)
         {
             WebConfigManager.WebConfigManager.RemoveConfiguration(webApp, _MODIFICATIONOWNER);
             ULS.LogMessage("SecProviderFeatureReceiver.FeatureDeactivating", "Feature Deactivated on web app: " + webApp.Name, "Membership", TraceProvider.TraceSeverity.InformationEvent);
         }
         else
         {
             ULS.LogMessage("SecProviderFeatureReceiver.FeatureDeactivating", "Not able to retrieve SPWebApplication", "Membership", TraceProvider.TraceSeverity.CriticalEvent);
         }
     }
     catch (Exception ex)
     {
         ULS.LogError("SecProviderFeatureReceiver.FeatureDeactivating", ex);
         throw ex;
     }
 }
        // Token: 0x06000034 RID: 52 RVA: 0x00002D1C File Offset: 0x00000F1C
        public RULE_PACKAGE_DETAILS[] GetRulePackageDetails(IClassificationItem classificationItem)
        {
            if (classificationItem == null)
            {
                return(null);
            }
            ULS.SendTraceTag(4850012U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetRulePackageDetails :: ClassificationItem :: {0}", new object[]
            {
                classificationItem.ItemId
            });
            RULE_PACKAGE_DETAILS value = this.defaultRuleDetails.Value;

            if (value.RuleIDs.Length > 0)
            {
                return(new RULE_PACKAGE_DETAILS[]
                {
                    value
                });
            }
            return(null);
        }
Пример #20
0
        /// <summary>
        /// changes the user's password
        /// </summary>
        /// <param name="UserName">user name</param>
        /// <param name="OldPassword">old password</param>
        /// <param name="NewPassword">new password</param>
        private static void ChangePassword(string UserName, string OldPassword, string NewPassword)
        {
            MembershipProvider defaultProvider;
            bool bChanged = false;

            defaultProvider = Membership.Provider;

            if (defaultProvider.EnablePasswordReset)
            {
                bChanged = defaultProvider.ChangePassword(UserName, OldPassword, NewPassword);
                if (bChanged == false)
                {
                    ULS.LogError("ChangePassword", "Password Not Changed: " + UserName, "SQLMembershipWS");
                    throw new Exception("This password could not be changed.");
                }
            }
            else
            {
                // This provider is not configured to let users change their passwords
                throw new Exception("You do not have permissions to change your password.");
            }
        }
Пример #21
0
        // Token: 0x06000049 RID: 73 RVA: 0x0000325C File Offset: 0x0000145C
        public override void LogOneEntry(string client, string tenantId, string correlationId, ExecutionLog.EventType eventType, string tag, string contextData, Exception exception, params KeyValuePair <string, object>[] customData)
        {
            ULSTraceLevel ulstraceLevel = FASTExcecutionLog.ConvertEventTypeToULSLevel(eventType);

            if (exception == null)
            {
                ULS.SendTraceTag(4850017U, ULSCat.msoulscat_SEARCH_DataLossPrevention, ulstraceLevel, "Client : [{0}] ; CorrelationId : [{1}] ; ContextData : [{2}]", new object[]
                {
                    client,
                    correlationId,
                    contextData
                });
                return;
            }
            ULS.SendTraceTag(4850018U, ULSCat.msoulscat_SEARCH_DataLossPrevention, ulstraceLevel, "Client=[{0}]  CorrelationId=[{1}]  ContextData=[{2}]  Exception=[{3}]", new object[]
            {
                client,
                correlationId,
                contextData,
                exception
            });
        }
Пример #22
0
 /// <summary>
 /// When this feature is activated it adds connection string, membership
 /// provider, and role provider entries into the web.config for the
 /// web application.
 ///
 /// It also sets the web application's people picker to only search within
 /// the current site collection
 /// </summary>
 public override void FeatureActivated(SPFeatureReceiverProperties properties)
 {
     try
     {
         SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
         if (webApp != null)
         {
             WebConfigManager.WebConfigManager.AddConfigModifications(webApp, _MODIFICATIONOWNER, GetWebConfigMods());
             webApp.PeoplePickerSettings.OnlySearchWithinSiteCollection = true;
             ULS.LogMessage("SecProviderFeatureReceiver.FeatureActivated", "Feature Activated on web app: " + webApp.Name, "Membership", TraceProvider.TraceSeverity.InformationEvent);
         }
         else
         {
             ULS.LogMessage("SecProviderFeatureReceiver.FeatureActivated", "Not able to retrieve SPWebApplication", "Membership", TraceProvider.TraceSeverity.CriticalEvent);
         }
     }
     catch (Exception ex)
     {
         ULS.LogError("SecProviderFeatureReceiver.FeatureActivated", ex);
         throw ex;
     }
 }
Пример #23
0
        public string FindUser(string appName, string userName, bool MappedApplication)
        {
            StringBuilder userXml = new StringBuilder();
            string        oldApp  = Membership.ApplicationName;

            try
            {
                if (MappedApplication)
                {
                    Membership.ApplicationName = GetMapping(appName);
                }
                else
                {
                    Membership.ApplicationName = appName;
                }
                MembershipUser user = Membership.GetUser(userName);
                if (user == null)
                {
                    ULS.LogError("FindUser", "No user found for " + appName + ":" + userName, "SQLMembershipWS");
                    throw new Exception("User (" + userName + ") not found");
                }

                userXml.Append("<user>");
                userXml.Append("<login>");
                userXml.Append(user.UserName);
                userXml.Append("</login>");
                userXml.Append("<email>");
                userXml.Append(user.Email);
                userXml.Append("</email>");
                userXml.Append("</user>");
            }
            finally
            {
                Membership.ApplicationName = oldApp;
            }
            return(userXml.ToString());
        }
        // Token: 0x06000033 RID: 51 RVA: 0x00002C80 File Offset: 0x00000E80
        private void LoadDefaultRuleSet()
        {
            ULS.SendTraceTag(4850011U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.LoadDefaultRuleSet :: loading default classification rules");
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            Stream   stream            = null;

            try
            {
                stream = executingAssembly.GetManifestResourceStream("defaultClassificationRules");
                using (TextReader textReader = new StreamReader(stream))
                {
                    stream = null;
                    this.defaultRuleSet = new ClassificationRuleSet(textReader);
                }
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
            }
            this.ruleSets.Add(this.defaultRuleSet.PackageId, this.defaultRuleSet);
        }
Пример #25
0
        static void Main(string[] args)
        {
            try
            {
                string host                = ConfigurationManager.AppSettings.Get("popHost");
                int    port                = Convert.ToInt32(ConfigurationManager.AppSettings.Get("popPort"));
                bool   useSSL              = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("useSSL"));
                string username            = ConfigurationManager.AppSettings.Get("popUser");
                string password            = ConfigurationManager.AppSettings.Get("popPassword");
                string dropPath            = ConfigurationManager.AppSettings.Get("dropFolderPath");
                bool   traceToConsole      = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("traceToConsole"));
                bool   deleteAfterRetrieve = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("deleteAfterRetrieve"));

                TraceProvider.RegisterTraceProvider();

                using (Pop3Client popClient = new Pop3Client(host, port, useSSL, username, password))
                {
                    if (traceToConsole)
                    {
                        popClient.Trace += new Action <string>(Console.WriteLine);
                    }

                    //connects to Pop3 Server, Executes POP3 USER and PASS
                    popClient.Authenticate();
                    popClient.Stat();

                    System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient();
                    smtpClient.DeliveryMethod          = System.Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory;
                    smtpClient.PickupDirectoryLocation = dropPath;
                    StringBuilder traceMessage = new StringBuilder("Messages To Retrieve: " + popClient.List().Count);
                    Console.WriteLine(traceMessage.ToString());
                    ULS.LogMessage("Pop Client", traceMessage.ToString(), "E-Mail", TraceProvider.TraceSeverity.InformationEvent);
                    foreach (Pop3ListItem item in popClient.List())
                    {
                        using (MailMessageEx popMessage = popClient.RetrMailMessageEx(item))
                        {
                            using (System.Net.Mail.MailMessage smtpMessage = new System.Net.Mail.MailMessage())
                            {
                                if (traceToConsole)
                                {
                                    foreach (System.Net.Mail.MailAddress toAddress in popMessage.To)
                                    {
                                        Console.WriteLine("To:  " + toAddress.Address);
                                    }
                                    Console.WriteLine("From: " + popMessage.From.Address);
                                    Console.WriteLine("Subject: " + popMessage.Subject);
                                    Console.WriteLine("Attachments: " + popMessage.Attachments.Count);
                                    foreach (System.Net.Mail.Attachment attachment in popMessage.Attachments)
                                    {
                                        Console.WriteLine("Attachment: " + attachment.Name);
                                    }
                                    Console.Write("Body: " + popMessage.Body + "\n");
                                }

                                smtpMessage.From            = popMessage.From;
                                smtpMessage.Subject         = popMessage.Subject;
                                smtpMessage.SubjectEncoding = popMessage.SubjectEncoding;
                                smtpMessage.Body            = popMessage.Body;
                                smtpMessage.BodyEncoding    = popMessage.BodyEncoding;
                                smtpMessage.Sender          = popMessage.Sender;

                                traceMessage = new StringBuilder("Message Processed:<br/>\n");

                                foreach (System.Net.Mail.MailAddress toAddress in popMessage.To)
                                {
                                    traceMessage.Append("To: " + toAddress + "<br/>\n");
                                    smtpMessage.To.Add(toAddress);
                                }
                                foreach (System.Net.Mail.MailAddress ccAddress in popMessage.CC)
                                {
                                    traceMessage.Append("CC: " + ccAddress + "<br/>\n");
                                    smtpMessage.CC.Add(ccAddress);
                                }
                                traceMessage.Append("From: " + popMessage.From.Address + "<br/>\n");
                                traceMessage.Append("Subject: " + popMessage.Subject + "<br/>\n");

                                foreach (System.Net.Mail.Attachment attachment in popMessage.Attachments)
                                {
                                    smtpMessage.Attachments.Add(attachment);
                                    traceMessage.Append("Attachment: " + attachment.Name + "<br/>\n");
                                }

                                smtpMessage.IsBodyHtml = popMessage.IsBodyHtml;

                                foreach (string key in popMessage.Headers.AllKeys)
                                {
                                    smtpMessage.Headers.Add(key, popMessage.Headers[key]);
                                }

                                ULS.LogMessage("Pop Client", traceMessage.ToString(), "E-Mail", TraceProvider.TraceSeverity.InformationEvent);

                                smtpClient.Send(smtpMessage);

                                if (deleteAfterRetrieve)
                                {
                                    popClient.Dele(item);
                                }
                            }
                        }
                    }
                    popClient.Noop();
                    if (!deleteAfterRetrieve)
                    {
                        popClient.Rset();
                    }
                    popClient.Quit();
                }
            }
            catch (Exception ex)
            {
                ULS.LogError("Pop Client", ex.ToString(), "E-Mail");
            }
            TraceProvider.UnregisterTraceProvider();
        }
Пример #26
0
        // Token: 0x06000094 RID: 148 RVA: 0x00004000 File Offset: 0x00002200
        private static void TranslateRangeToken(string rangeToken, uint maximum, out uint firstNumber, out uint secondNumber)
        {
            int  num  = -1;
            int  num2 = -1;
            int  num3 = -1;
            int  num4 = -1;
            int  i    = 0;
            bool flag = false;

            char[] array = rangeToken.ToCharArray();
            while (i < array.Length && char.IsWhiteSpace(array[i]))
            {
                i++;
            }
            if (i >= array.Length)
            {
                firstNumber  = 1U;
                secondNumber = maximum;
                return;
            }
            if (array[i] == '*')
            {
                for (i++; i < array.Length; i++)
                {
                    if (!char.IsWhiteSpace(array[i]))
                    {
                        throw new ArgumentException("The wildcard character must be alone (except for whitespace).  Token: " + rangeToken);
                    }
                }
                firstNumber  = 1U;
                secondNumber = maximum;
                return;
            }
            if (i < array.Length && char.IsDigit(array[i]))
            {
                num = i;
                do
                {
                    i++;
                }while (i < array.Length && char.IsDigit(array[i]));
                num2 = i - 1;
            }
            while (i < array.Length && char.IsWhiteSpace(array[i]))
            {
                i++;
            }
            if (i < array.Length && object.Equals('.', array[i]))
            {
                flag = true;
                i++;
                if (i >= array.Length || !object.Equals('.', array[i]))
                {
                    throw new ArgumentException(string.Concat(new object[]
                    {
                        "Expected the end of '..' at index ",
                        i,
                        " of ",
                        rangeToken
                    }));
                }
                i++;
            }
            while (i < array.Length && char.IsWhiteSpace(array[i]))
            {
                i++;
            }
            if (i < array.Length && char.IsDigit(array[i]))
            {
                if (!flag)
                {
                    throw new ArgumentException(string.Concat(new object[]
                    {
                        "Expected '..' between the two numbers at index ",
                        i,
                        " of ",
                        rangeToken
                    }));
                }
                num3 = i;
                while (i < array.Length && char.IsDigit(array[i]))
                {
                    i++;
                }
                num4 = i - 1;
            }
            while (i < array.Length && char.IsWhiteSpace(array[i]))
            {
                i++;
            }
            if (i < array.Length)
            {
                throw new ArgumentException(string.Concat(new object[]
                {
                    "Unexpected characters in the token, starting at index ",
                    i,
                    ", range: ",
                    rangeToken
                }));
            }
            ULS.SendTraceTag(5884048U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "ClassificationDecoding.ctor :: rangeToken={0}, firstNumberStart={1}, firstNumberEnd={2}, secondNumberStart={3}, secondNumberEnd={4}", new object[]
            {
                rangeToken,
                num,
                num2,
                num3,
                num4
            });
            if (num2 >= 0)
            {
                if (flag)
                {
                    if (num4 < 0)
                    {
                        if (!uint.TryParse(new string(array, num, 1 + num2 - num), out firstNumber))
                        {
                            throw new ArgumentException("Failed to parse first number as a 32-bit unsigned integer.");
                        }
                        secondNumber = maximum;
                        return;
                    }
                    else
                    {
                        if (!uint.TryParse(new string(array, num, 1 + num2 - num), out firstNumber))
                        {
                            throw new ArgumentException("Failed to parse first number as a 32-bit unsigned integer.  Range: " + rangeToken);
                        }
                        if (!uint.TryParse(new string(array, num3, 1 + num4 - num3), out secondNumber))
                        {
                            throw new ArgumentException("Failed to parse second number as a 32-bit unsigned integer.  Range: " + rangeToken);
                        }
                        if (firstNumber > secondNumber)
                        {
                            throw new ArgumentException("Illegal range.  The first number is larger than the second.  Range: " + rangeToken);
                        }
                    }
                }
                else
                {
                    if (!uint.TryParse(new string(array, num, 1 + num2 - num), out firstNumber))
                    {
                        throw new ArgumentException("Failed to parse the number as a 32-bit unsigned integer.");
                    }
                    secondNumber = firstNumber;
                }
                return;
            }
            if (num4 < 0)
            {
                throw new ArgumentException("A range must have at least one number.  Range: " + rangeToken);
            }
            if (!uint.TryParse(new string(array, num3, 1 + num4 - num3), out secondNumber))
            {
                throw new ArgumentException("Failed to parse the number as a 32-bit unsigned integer.");
            }
            firstNumber = 1U;
        }
        // Token: 0x06000017 RID: 23 RVA: 0x000027A4 File Offset: 0x000009A4
        public void SetClassificationResults(ICAClassificationResultCollection results)
        {
            if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
            {
                ULS.SendTraceTag(4850008U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: saving results for [{0}]", new object[]
                {
                    this.ItemId
                });
            }
            IUpdateableBucketField updateableBucketField = this.record[this.managedPropertiesPosition] as IUpdateableBucketField;

            if (updateableBucketField != null)
            {
                if (this.persistClassificationData)
                {
                    updateableBucketField.AddField(this.lastScanPropertyName, StandardFields.GetStandardDateTimeField(new DateTime?(DateTime.UtcNow)), BuiltInTypes.DateTimeType);
                }
                ICollection <long?>  collection  = new List <long?>();
                ICollection <long?>  collection2 = new List <long?>();
                ICollection <string> collection3 = new List <string>();
                HashSet <long>       hashSet     = new HashSet <long>();
                if (results != null && results.Count > 0)
                {
                    this.resultCount = results.Count;
                    for (int i = 0; i < this.resultCount; i++)
                    {
                        ICAClassificationResult icaclassificationResult = results[i + 1];
                        if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                        {
                            ULS.SendTraceTag(4850009U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: Results Found :: package={0} ruleId={1}", new object[]
                            {
                                icaclassificationResult.RulePackageID,
                                icaclassificationResult.ID
                            });
                        }
                        long?resultBase = this.ruleStore.GetResultBase(icaclassificationResult.RulePackageID, icaclassificationResult.ID);
                        if (resultBase == null)
                        {
                            ULS.SendTraceTag(6038295U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationItem.SetClassificationResults :: Unkwown rule ID in result (should not happen). :: package={0} ruleId={1}", new object[]
                            {
                                icaclassificationResult.RulePackageID,
                                icaclassificationResult.ID
                            });
                        }
                        else
                        {
                            long value = resultBase.Value;
                            if (!hashSet.Add(value))
                            {
                                ULS.SendTraceTag(5833436U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationItem.SetClassificationResults :: Duplicate rule entry is being ignored.  Duplicate rule entries should not happen. :: package={0} ruleId={1}", new object[]
                                {
                                    icaclassificationResult.RulePackageID,
                                    icaclassificationResult.ID
                                });
                            }
                            else
                            {
                                long value2 = value + (long)((int)icaclassificationResult.GetAttributeValue("BD770258-EA9C-4162-B79C-7AD408EC7CD5"));
                                long value3 = value + (long)((int)icaclassificationResult.GetAttributeValue("AFF85B32-1BA9-4EDE-9286-F08A7EE5A421"));
                                collection.Add(new long?(value2));
                                collection2.Add(new long?(value3));
                                collection3.Add(icaclassificationResult.ID);
                            }
                        }
                    }
                    if (this.persistClassificationData && this.resultCount > 0)
                    {
                        if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                        {
                            ULS.SendTraceTag(4850010U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: Updating managed properties");
                        }
                        IUpdateableListField <long?> updateableListField = (IUpdateableListField <long?>)StandardFields.ListDescriptor <long?>(BuiltInTypes.Int64Type).CreateField();
                        updateableListField.Value = collection;
                        updateableBucketField.AddField(this.countPropertyName, updateableListField, BuiltInTypes.ListType(BuiltInTypes.Int64Type));
                        updateableListField       = (IUpdateableListField <long?>)StandardFields.ListDescriptor <long?>(BuiltInTypes.Int64Type).CreateField();
                        updateableListField.Value = collection2;
                        updateableBucketField.AddField(this.confidencePropertyName, updateableListField, BuiltInTypes.ListType(BuiltInTypes.Int64Type));
                        IUpdateableListField <string> updateableListField2 = (IUpdateableListField <string>)StandardFields.ListDescriptor <string>(BuiltInTypes.StringType).CreateField();
                        updateableListField2.Value = collection3;
                        updateableBucketField.AddField(this.typePropertyName, updateableListField2, BuiltInTypes.ListType(BuiltInTypes.StringType));
                    }
                }
            }
        }
        // Token: 0x060000AE RID: 174 RVA: 0x00004A9C File Offset: 0x00002C9C
        public override void ProcessRecordCore(IRecord record)
        {
            Guid tenantId = this.GetTenantId(record);

            if (!this.isIPClassificationQueryEnabled)
            {
                base.SetNextRecord();
                return;
            }
            IUpdateableBucketField updateableBucketField = record[this.otherPosition] as IUpdateableBucketField;

            if (updateableBucketField != null)
            {
                for (int i = 0; i < updateableBucketField.FieldCount; i++)
                {
                    string text = updateableBucketField.Name(i);
                    if (string.Equals(text, "SensitiveType", StringComparison.OrdinalIgnoreCase))
                    {
                        IUpdateableListField <string> updateableListField = updateableBucketField[text] as IUpdateableListField <string>;
                        if (updateableListField == null)
                        {
                            ULS.SendTraceTag(5833439U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveResultTranslationProducer.ProcessRecordCore :: tenantId={0}, fieldName={1}; Found a result entry for the field name (expected to represent the sensitive type list), but its type was not IUpdateableListField<string> or its value was null.  Cannot do any data-loss-prevention result-set translation.", new object[]
                            {
                                tenantId,
                                text
                            });
                        }
                        else
                        {
                            for (int j = 0; j < updateableListField.Count; j++)
                            {
                                string text2 = DLPQuerySensitiveResultTranslationOperator.Store.RuleIdToRuleName(updateableListField[j]);
                                if (text2 == null)
                                {
                                    ULS.SendTraceTag(5833440U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveResultTranslationProducer.ProcessRecordCore :: tenantId={0}, fieldIndex={1}, fieldValue={2}; Found a result entry for the field name (expected to represent the sensitive type list), but the value at this index was either null or an invalid rule ID.  Cannot translate this value.", new object[]
                                    {
                                        tenantId,
                                        j,
                                        updateableListField[j]
                                    });
                                }
                                else
                                {
                                    updateableListField[j] = text2;
                                }
                            }
                        }
                    }
                    else if (string.Equals(text, "SensitiveMatchCount", StringComparison.OrdinalIgnoreCase) || string.Equals(text, "SensitiveMatchConfidence", StringComparison.OrdinalIgnoreCase))
                    {
                        IUpdateableListField <long?> updateableListField2 = updateableBucketField[text] as IUpdateableListField <long?>;
                        long?[] array = updateableBucketField[text].Value as long?[];
                        if (array == null || updateableListField2 == null)
                        {
                            ULS.SendTraceTag(5833441U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveResultTranslationProducer.ProcessRecordCore :: tenantId={0}, fieldName={1}; Found a result entry for the field name, but its value was null or not of type long?[] or the field was not of type IUpdateableListField<long?>.  Cannot do any data-loss-prevention result-set translation.", new object[]
                            {
                                tenantId,
                                text
                            });
                        }
                        else
                        {
                            for (int k = 0; k < array.Length; k++)
                            {
                                array[k] &= (long)((ulong)-1);
                            }
                            updateableListField2.Value = array;
                        }
                    }
                }
            }
            else
            {
                ULS.SendTraceTag(5833442U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveResultTranslationProducer.ProcessRecordCore :: tenantId={0}; The 'Other' field in the record was null, so we cannot do any data-loss-prevention result-set translation.", new object[]
                {
                    tenantId
                });
            }
            base.SetNextRecord();
        }
 // Token: 0x0600003D RID: 61 RVA: 0x00002E56 File Offset: 0x00001056
 public void GetUpdatedRulePackageInfo(uint ulRulePackageTimestampDetailsSize, RULE_PACKAGE_TIMESTAMP_DETAILS[] rulePackageTimestampDetails)
 {
     ULS.SendTraceTag(4850014U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetUpdatedRulePackageInfo");
 }
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
#if DEBUG
            Debugger.Break();
#endif
            ULS.LogMessage(ULS_PRODUCT_NAME, string.Format("Started De-activating {0}", FEATURE_NAME), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
            SPSite siteCollection = properties.Feature.Parent as SPSite;
            if (siteCollection != null)
            {
                SPWeb topLevelSite = siteCollection.RootWeb;

                ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Started De-activating {0} Feature in {1} portal ", FEATURE_NAME, siteCollection.PortalName), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);

                // Calculate relative path of site from Web Application root.
                string WebAppRelativePath = topLevelSite.ServerRelativeUrl;
                if (!WebAppRelativePath.EndsWith("/"))
                {
                    WebAppRelativePath += "/";
                }

                ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Processed: {0}", topLevelSite.Title), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);

                // Enumerate through each site and remove custom branding.
                foreach (SPWeb site in siteCollection.AllWebs)
                {
                    try
                    {
                        ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Started De-activating {0} Feature in the {1} site ", FEATURE_NAME, site.Name), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
                        site.MasterUrl       = WebAppRelativePath + defaultMasterUrl;
                        site.CustomMasterUrl = WebAppRelativePath + defaultMasterUrl;
                        site.AlternateCssUrl = "";
                        site.SiteLogoUrl     = "";
                        site.Update();
                    }
                    catch (Exception ex)
                    {
                        ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("{0};{1}", ex.Message, ex.StackTrace), Microsoft.SharePoint.Administration.TraceSeverity.Unexpected, Microsoft.SharePoint.Administration.EventSeverity.Error);
                    }
                    finally
                    {
                        if (site != null)
                        {
                            site.Dispose();
                        }
                        ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Finished De-activating {0} Feature in the {1} site ", FEATURE_NAME, site.Name), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
                    }
                }

                // Now delete the master page
                string serverRelPath = topLevelSite.ServerRelativeUrl;
                if (!serverRelPath.EndsWith("/"))
                {
                    serverRelPath += "/";
                }
                string customUrlToUse = serverRelPath + customizedMasterUrl;
                try
                {
                    using (SPWeb web = siteCollection.OpenWeb())
                    {
                        SPFile file = web.GetFile(customUrlToUse);
                        ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Started Deleting the old master page in in the {0} site ", web.Title), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
                        SPFolder masterPageGallery = file.ParentFolder;
                        SPFolder temp        = masterPageGallery.SubFolders.Add("Temp");
                        string   newFilePath = String.Format("{0}/{1}", temp.Url, file.Name);
                        file.MoveTo(newFilePath, SPMoveOperations.Overwrite);
                        SPFile movedFile = web.GetFile(newFilePath);
                        movedFile.Delete();
                        ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Finished deleting the old master page in in the {0} site ", web.Title), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
                    }
                }
                catch (Exception ex)
                {
                    ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("{0};{1}", ex.Message, ex.StackTrace), Microsoft.SharePoint.Administration.TraceSeverity.Unexpected, Microsoft.SharePoint.Administration.EventSeverity.Error);
                }
                finally
                {
                    ULS.LogMessage(ULS_PRODUCT_NAME, String.Format("Finished De-activating {0} Feature in {0} portal ", FEATURE_NAME, siteCollection.PortalName), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
                }
            }
            ULS.LogMessage(ULS_PRODUCT_NAME, string.Format("Started De-activating {0}", FEATURE_NAME), Microsoft.SharePoint.Administration.TraceSeverity.Verbose, Microsoft.SharePoint.Administration.EventSeverity.Information);
        }