コード例 #1
0
 // Token: 0x06000D7C RID: 3452 RVA: 0x00059D1C File Offset: 0x00057F1C
 private void LogConfigurationException(ExEventLog.EventTuple eventLogConstant, string traceMessage, string exceptionMessage)
 {
     ExTraceGlobals.ConfigurationManagerTracer.TraceDebug <string>(0L, traceMessage, exceptionMessage);
     OwaDiagnostics.LogEvent(eventLogConstant, string.Empty, new object[]
     {
         OwaConfigurationManager.virtualDirectoryName,
         OwaConfigurationManager.webSiteName,
         exceptionMessage
     });
 }
コード例 #2
0
        // Token: 0x06000FDD RID: 4061 RVA: 0x00062EB8 File Offset: 0x000610B8
        private void OnEndRequest(object sender, EventArgs e)
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "OwaModule.OnEndRequest");
            HttpApplication httpApplication = (HttpApplication)sender;

            if (this.ShouldInterceptRequest(httpApplication.Context, false))
            {
                if (!Globals.IsInitialized)
                {
                    return;
                }
                HttpContext context    = httpApplication.Context;
                OwaContext  owaContext = OwaContext.Get(context);
                if (owaContext == null)
                {
                    return;
                }
                try
                {
                    this.requestInspector.OnEndRequest(owaContext);
                }
                finally
                {
                    if (Globals.FilterETag && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).OwaDeployment.FilterETag.Enabled)
                    {
                        context.Response.Headers.Remove("ETag");
                    }
                    long requestLatencyMilliseconds = owaContext.RequestLatencyMilliseconds;
                    if (Globals.OwaVDirType == OWAVDirType.OWA && Globals.ArePerfCountersEnabled)
                    {
                        if (RequestDispatcher.IsUserInitiatedRequest(context.Request))
                        {
                            PerformanceCounterManager.UpdateResponseTimePerformanceCounter(requestLatencyMilliseconds, OwaContext.Current.RequestExecution == RequestExecution.Proxy);
                        }
                        OwaSingleCounters.TotalRequests.Increment();
                        if (owaContext.ErrorInformation != null)
                        {
                            OwaSingleCounters.TotalRequestsFailed.Increment();
                            Exception exception = owaContext.ErrorInformation.Exception;
                            this.UpdateExceptionsPerfCountersQueues(exception);
                        }
                        else
                        {
                            this.UpdateExceptionsPerfCountersQueues(null);
                        }
                        if (owaContext.RequestExecution == RequestExecution.Proxy)
                        {
                            OwaSingleCounters.ProxiedUserRequests.Increment();
                        }
                    }
                    ExTraceGlobals.RequestTracer.TraceDebug <string, long>((long)owaContext.GetHashCode(), "Response: HTTP {0}, time:{1} ms.", owaContext.HttpContext.Response.Status, requestLatencyMilliseconds);
                    OwaDiagnostics.ClearThreadTracing();
                }
            }
        }
コード例 #3
0
ファイル: Theme.cs プロジェクト: YHZX2013/exchange_diff
 private static void ThrowParserException(XmlTextReader reader, string folderName, string description, ExEventLog.EventTuple tuple, params object[] eventMessageArgs)
 {
     OwaDiagnostics.LogEvent(tuple, string.Empty, eventMessageArgs);
     throw new OwaThemeManagerInitializationException(string.Format(CultureInfo.InvariantCulture, "Invalid theme info file in folder '{0}'. Line  {1} Position {2}.{3}", new object[]
     {
         folderName,
         reader.LineNumber.ToString(CultureInfo.InvariantCulture),
         reader.LinePosition.ToString(CultureInfo.InvariantCulture),
         (description != null) ? (" " + description) : string.Empty
     }), null, null);
 }
コード例 #4
0
 private void ThrowParserException(string description, ExEventLog.EventTuple tuple, params object[] eventMessageArgs)
 {
     OwaDiagnostics.LogEvent(tuple, string.Empty, eventMessageArgs);
     throw new OwaInvalidInputException(string.Format(CultureInfo.InvariantCulture, "Invalid forms registry file {0}. Line Number: {1}. Position: {2}.{3}", new object[]
     {
         this.registryFile,
         this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
         this.reader.LinePosition.ToString(CultureInfo.InvariantCulture),
         (description != null) ? (" " + description) : string.Empty
     }), null, this);
 }
コード例 #5
0
ファイル: OwaIdentity.cs プロジェクト: YHZX2013/exchange_diff
        internal ExchangePrincipal CreateExchangePrincipal()
        {
            ExchangePrincipal result = null;

            try
            {
                OwaDiagnostics.TracePfd(18057, "Creating new ExchangePrincipal", new object[0]);
                if (ExTraceGlobals.CoreTracer.IsTraceEnabled(TraceType.DebugTrace))
                {
                    string text = null;
                    using (WindowsIdentity current = WindowsIdentity.GetCurrent())
                    {
                        text = current.Name;
                    }
                    if (string.IsNullOrEmpty(text))
                    {
                        text = "<n/a>";
                    }
                    string arg = this.SafeGetRenderableName();
                    ExTraceGlobals.CoreTracer.TraceDebug <string, string>(0L, "Using accout {0} to bind to ExchangePrincipal object for user {1}", text, arg);
                }
                result = this.InternalCreateExchangePrincipal();
            }
            catch (ObjectNotFoundException ex)
            {
                bool flag = false;
                DataValidationException ex2 = ex.InnerException as DataValidationException;
                if (ex2 != null)
                {
                    PropertyValidationError propertyValidationError = ex2.Error as PropertyValidationError;
                    if (propertyValidationError != null && propertyValidationError.PropertyDefinition == MiniRecipientSchema.Languages)
                    {
                        OWAMiniRecipient owaminiRecipient = this.FixCorruptOWAMiniRecipientCultureEntry();
                        if (owaminiRecipient != null)
                        {
                            try
                            {
                                result = ExchangePrincipal.FromMiniRecipient(owaminiRecipient, RemotingOptions.AllowCrossSite);
                                flag   = true;
                            }
                            catch (ObjectNotFoundException)
                            {
                            }
                        }
                    }
                }
                if (!flag)
                {
                    throw ex;
                }
            }
            return(result);
        }
コード例 #6
0
        // Token: 0x06000A1B RID: 2587 RVA: 0x00045C78 File Offset: 0x00043E78
        private static bool HasPrivateKey(X509Certificate2 cert)
        {
            bool result = true;

            if (!cert.HasPrivateKey)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate does not have a private key.");
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateNoPrivateKey, string.Empty, new object[0]);
                result = false;
            }
            return(result);
        }
コード例 #7
0
 // Token: 0x0600126D RID: 4717 RVA: 0x000706F4 File Offset: 0x0006E8F4
 internal static void EnsureProxyUrlSslPolicy(OwaContext owaContext, ProxyUri secondCasUri)
 {
     if (!OwaRegistryKeys.AllowProxyingWithoutSsl && secondCasUri.Uri.Scheme != Uri.UriSchemeHttps)
     {
         OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorSslConnection, secondCasUri.ToString(), new object[]
         {
             owaContext.LocalHostName,
             secondCasUri.ToString(),
             secondCasUri.ToString()
         });
         throw new OwaProxyException(string.Format("The URI found for proxying does not start with \"https\". Value={0}", secondCasUri.ToString()), LocalizedStrings.GetNonEncoded(-750997814));
     }
 }
コード例 #8
0
        private void IncomingTlsNegotiationFailedHandler(object sender, ErrorEventArgs args)
        {
            ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "Globals.IncomingTlsNegotiationFailedHandler");
            Exception ex = null;

            if (args != null)
            {
                ex = args.GetException();
            }
            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FailedToEstablishMTLSConnection, string.Empty, new object[]
            {
                (ex != null && ex.Message != null) ? ex.Message : string.Empty
            });
        }
コード例 #9
0
        // Token: 0x06000A1D RID: 2589 RVA: 0x00045CE8 File Offset: 0x00043EE8
        private static void DoesCertificateExpireSoon(X509Certificate2 cert)
        {
            ExDateTime exDateTime = new ExDateTime(ExTimeZone.CurrentTimeZone, cert.NotAfter);
            TimeSpan   threshold  = new TimeSpan(30, 0, 0, 0);

            if (ExDateTime.Compare(exDateTime, ExDateTime.Now) >= 0 && ExDateTime.Compare(exDateTime, ExDateTime.Now, threshold) == 0)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate will expire soon.");
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateWillExpireSoon, string.Empty, new object[]
                {
                    exDateTime
                });
            }
        }
コード例 #10
0
        // Token: 0x06001201 RID: 4609 RVA: 0x0006D43C File Offset: 0x0006B63C
        private bool CheckAndHandleConnectionFailure(WebException webException, Exception outerException)
        {
            ExTraceGlobals.ProxyCallTracer.TraceDebug((long)this.GetHashCode(), "ProxyEventHandler.HandleConnectionFailure");
            if (outerException == null)
            {
                outerException = webException;
            }
            if (!ProxyEventHandler.IsConnectionFailure(webException))
            {
                return(false);
            }
            ExTraceGlobals.ProxyTracer.TraceDebug((long)this.GetHashCode(), "The proxy attempt failed, so we'll fail over to another CAS");
            this.attemptedProxyUriCount++;
            if (base.OwaContext.ProxyUriQueue.Count == 1 || this.attemptedProxyUriCount > base.OwaContext.ProxyUriQueue.Count)
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorCASFailoverAllAttemptsFailed, base.OwaContext.SecondCasUri.ToString(), new object[]
                {
                    base.OwaContext.LocalHostName,
                    base.OwaContext.SecondCasUri.ToString(),
                    string.Format("webExceptionStatus={0}", webException.Status)
                });
                OwaProxyException exception = new OwaProxyException("None of the CAS servers are responding", LocalizedStrings.GetNonEncoded(-200732695), outerException, false);
                this.asyncResult.CompleteRequest(false, exception);
                return(true);
            }
            ProxyUri secondCasUri = base.OwaContext.SecondCasUri;

            this.GetNextFailoverCas();
            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorCASFailoverTryNextOne, secondCasUri.ToString(), new object[]
            {
                base.OwaContext.LocalHostName,
                secondCasUri.ToString(),
                base.OwaContext.SecondCasUri.ToString(),
                string.Format("webExceptionStatus={0}", webException.Status)
            });
            bool result;

            try
            {
                this.SendProxyRequest();
                result = true;
            }
            catch (Exception exception2)
            {
                this.asyncResult.CompleteRequest(false, exception2);
                result = true;
            }
            return(result);
        }
コード例 #11
0
        private void CheckIncompatibleTimeoutValues()
        {
            int sessionTimeout = OwaConfigurationManager.Configuration.SessionTimeout;

            if ((double)(sessionTimeout * 60) < Math.Ceiling(1.25 * (double)this.MaxPendingRequestLifeInSeconds))
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_IncompatibleTimeoutSetting, string.Empty, new object[]
                {
                    sessionTimeout,
                    this.MaxPendingRequestLifeInSeconds,
                    300
                });
                throw new OwaInvalidInputException("The timeout setting values for \"UserContextTimeout\" and \"MaxPendingRequestLife\" chosen by the admin are conflicting", null, 0);
            }
        }
コード例 #12
0
 // Token: 0x060011FF RID: 4607 RVA: 0x0006D3A4 File Offset: 0x0006B5A4
 private void HandleWebExceptionDefault(WebException webException, Exception outerException)
 {
     if (webException.Status == WebExceptionStatus.TrustFailure)
     {
         OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorSslTrustFailure, base.OwaContext.SecondCasUri.ToString(), new object[]
         {
             base.OwaContext.LocalHostName,
             base.OwaContext.SecondCasUri.ToString()
         });
         OwaProxyException exception = new OwaProxyException("Error establishing SSL connection", LocalizedStrings.GetNonEncoded(-750997814), outerException, false);
         this.asyncResult.CompleteRequest(false, exception);
         return;
     }
     this.asyncResult.CompleteRequest(false, outerException);
 }
コード例 #13
0
        // Token: 0x06000A1A RID: 2586 RVA: 0x00045C14 File Offset: 0x00043E14
        private static bool IsInvalidDate(X509Certificate2 cert)
        {
            bool       result     = false;
            ExDateTime exDateTime = new ExDateTime(ExTimeZone.CurrentTimeZone, cert.NotBefore);

            if (ExDateTime.Compare(exDateTime, ExDateTime.Now) >= 0)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate has not become valid yet.");
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateInvalidDate, string.Empty, new object[]
                {
                    exDateTime
                });
                result = true;
            }
            return(result);
        }
コード例 #14
0
        // Token: 0x06000A19 RID: 2585 RVA: 0x00045BB0 File Offset: 0x00043DB0
        private static bool IsExpired(X509Certificate2 cert)
        {
            bool       result     = false;
            ExDateTime exDateTime = new ExDateTime(ExTimeZone.CurrentTimeZone, cert.NotAfter);

            if (ExDateTime.Compare(exDateTime, ExDateTime.Now) <= 0)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "IM Certificate has expired.");
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateExpired, string.Empty, new object[]
                {
                    exDateTime
                });
                result = true;
            }
            return(result);
        }
コード例 #15
0
        // Token: 0x0600126B RID: 4715 RVA: 0x00070594 File Offset: 0x0006E794
        internal static void ThrowMalformedCasUriException(OwaContext owaContext, string malformedUri)
        {
            string text = owaContext.ExchangePrincipal.LegacyDn;

            if (text == null)
            {
                text = string.Empty;
            }
            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ProxyErrorWrongUriFormat, malformedUri, new object[]
            {
                owaContext.LocalHostName,
                text,
                malformedUri
            });
            throw new OwaProxyException(string.Format("The format of the uri is wrong: {0}", malformedUri), string.Format(Strings.ErrorWrongUriFormat, malformedUri));
        }
コード例 #16
0
        private T DoWebAction <T>(Func <T> callback) where T : class
        {
            T result;

            try
            {
                result = callback();
            }
            catch (WebException ex)
            {
                HttpWebResponse httpWebResponse = ex.Response as HttpWebResponse;
                ExTraceGlobals.ProxyCallTracer.TraceError <WebExceptionStatus, object>(0L, "Exception hit during AsyncProcessing, webException.Status = {0}, webRequest.Status = {1}", ex.Status, (httpWebResponse != null) ? ((int)httpWebResponse.StatusCode) : "null");
                if (httpWebResponse != null)
                {
                    OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_OwaEwsConnectionError, string.Empty, new object[]
                    {
                        (int)httpWebResponse.StatusCode
                    });
                    result = (httpWebResponse as T);
                }
                else
                {
                    OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_OwaEwsConnectionError, string.Empty, new object[]
                    {
                        string.Format("null, webException.Status = {0}", ex.Status)
                    });
                    switch (ex.Status)
                    {
                    case WebExceptionStatus.ConnectFailure:
                    case WebExceptionStatus.ReceiveFailure:
                    case WebExceptionStatus.SendFailure:
                    case WebExceptionStatus.ConnectionClosed:
                        this.HttpContext.Response.StatusCode        = 584;
                        this.HttpContext.Response.StatusDescription = "Ews is not found on OWA server";
                        goto IL_137;
                    }
                    this.HttpContext.Response.StatusCode        = 594;
                    this.HttpContext.Response.StatusDescription = "Unknown connection failure";
IL_137:
                    this.HttpContext.Response.Output.Write("Ews Error, Handling through WebException. webException.Status = {0}, Message = '{1}'", ex.Status, ex.Message);
                    result = default(T);
                }
            }
            return(result);
        }
コード例 #17
0
 internal void AddFolderCountPayload(OwaStoreObjectId folderId, long itemCount, long itemUnreadCount)
 {
     lock (this)
     {
         if (this.payloadStringRefreshAll.Length == 0)
         {
             this.folderCountTable[folderId] = new ItemCountPair(itemCount, itemUnreadCount);
             if (this.folderCountTable.Count > 200)
             {
                 OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_MessagingPayloadNotBeingPickedup, string.Empty, new object[]
                 {
                     this.mailboxSessionDisplayName
                 });
                 this.AddRefreshPayload();
             }
         }
     }
 }
コード例 #18
0
        internal override bool FilterRequest(object source, EventArgs e, RequestEventType eventType)
        {
            HttpApplication httpApplication = (HttpApplication)source;
            HttpContext     context         = httpApplication.Context;
            HttpRequest     request         = context.Request;
            Configuration   configuration   = OwaConfigurationManager.Configuration;

            if (!Utilities.IsOwaUrl(request.Url, OwaUrl.AuthPost, true) || configuration == null)
            {
                return(false);
            }
            if (configuration.FormsAuthenticationEnabled)
            {
                if (eventType == RequestEventType.BeginRequest)
                {
                    this.SimulateBasicAuthenticationHeader(context);
                }
                else
                {
                    if (eventType != RequestEventType.PostAuthorizeRequest)
                    {
                        throw new OwaInvalidOperationException("FBASingleSignOn was unexpectedly called");
                    }
                    HttpResponse    response        = context.Response;
                    WindowsIdentity windowsIdentity = context.User.Identity as WindowsIdentity;
                    if (windowsIdentity != null && !windowsIdentity.IsAnonymous)
                    {
                        this.TransferToAuthDll(httpApplication);
                        return(true);
                    }
                    OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_WebConfigAuthenticationIncorrect, string.Empty, new object[]
                    {
                        HttpRuntime.AppDomainAppPath
                    });
                    Utilities.RewritePathToError(OwaContext.Current, LocalizedStrings.GetNonEncoded(-1556449487));
                }
            }
            else
            {
                Utilities.EndResponse(context, HttpStatusCode.BadRequest);
            }
            return(false);
        }
コード例 #19
0
 // Token: 0x060014D4 RID: 5332 RVA: 0x0007EAB0 File Offset: 0x0007CCB0
 internal static void Initialize()
 {
     if (!File.Exists(UIExtensionManager.FullExtensionFileName))
     {
         return;
     }
     try
     {
         using (XmlTextReader xmlTextReader = SafeXmlFactory.CreateSafeXmlTextReader(UIExtensionManager.FullExtensionFileName))
         {
             xmlTextReader.WhitespaceHandling = WhitespaceHandling.None;
             while (xmlTextReader.Read())
             {
                 if (xmlTextReader.NodeType == XmlNodeType.Element)
                 {
                     if (xmlTextReader.Name == "MainNavigationBarExtensions")
                     {
                         UIExtensionManager.ParseNavigationBarEntries(xmlTextReader, UIExtensionManager.navigationBarEntries);
                     }
                     else if (xmlTextReader.Name == "NewItemMenuEntries")
                     {
                         UIExtensionManager.ParseNewItemMenuEntries(xmlTextReader, UIExtensionManager.menuItemEntries);
                     }
                     else if (xmlTextReader.Name == "RightClickMenuExtensions")
                     {
                         UIExtensionManager.ParseRightClickMenuItemEntries(xmlTextReader, UIExtensionManager.contextMenuItemEntries);
                     }
                 }
             }
         }
     }
     catch (Exception)
     {
         OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_CustomizationUIExtensionParseError, string.Empty, new object[]
         {
             UIExtensionManager.FullExtensionFileName
         });
         UIExtensionManager.navigationBarEntries.Clear();
         UIExtensionManager.menuItemEntries.Clear();
         UIExtensionManager.contextMenuItemEntries.Clear();
     }
 }
コード例 #20
0
 public void AddFolderRefreshPayload(OwaStoreObjectId folderId, bool forceRefresh)
 {
     lock (this)
     {
         if (this.payloadStringRefreshAll.Length == 0)
         {
             if (!this.folderRefreshList.Contains(folderId) && (forceRefresh || !this.folderContentChangeNotifications.ContainsKey(folderId) || this.folderContentChangeNotifications[folderId].NotificationHandler == null || this.folderContentChangeNotifications[folderId].NotificationHandler.AllowFolderRefreshNotification))
             {
                 this.folderRefreshList.Add(folderId);
                 this.ClearFolderContentChangePayload(folderId);
             }
             if (this.folderRefreshList.Count > 20)
             {
                 OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_MessagingPayloadNotBeingPickedup, string.Empty, new object[]
                 {
                     this.mailboxSessionDisplayName
                 });
                 this.AddRefreshPayload();
             }
         }
     }
 }
コード例 #21
0
        // Token: 0x06001334 RID: 4916 RVA: 0x000772B0 File Offset: 0x000754B0
        internal static void SetProxyRequestUrl(OwaContext owaContext)
        {
            UriBuilder uriBuilder = new UriBuilder(owaContext.HttpContext.Request.Url);
            Uri        uri        = uriBuilder.Uri;

            uriBuilder      = new UriBuilder(owaContext.SecondCasUri.Uri);
            uriBuilder.Path = uri.AbsolutePath;
            string text = uri.Query;

            if (text.StartsWith("?", StringComparison.Ordinal))
            {
                text = text.Substring(1, text.Length - 1);
            }
            uriBuilder.Query = text;
            Uri uri2 = uriBuilder.Uri;

            OwaDiagnostics.TracePfd(23177, "The request will be proxied to \"{0}\"", new object[]
            {
                uri2
            });
            owaContext.SetInternalHandlerParameter("pru", uri2);
        }
コード例 #22
0
 private static void LoadXmlData(string xmlFilePath, string folderName, Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> > prefixIconTable, Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> > iconTable)
 {
     ExTraceGlobals.SmallIconCallTracer.TraceDebug <string>(0L, "LoadXmlData: XmlFilePath = '{0}'", xmlFilePath);
     using (XmlTextReader xmlTextReader = SmallIconManager.InitializeXmlTextReader(xmlFilePath))
     {
         bool          flag          = false;
         StringBuilder stringBuilder = new StringBuilder();
         while (xmlTextReader.Read())
         {
             XmlNodeType nodeType = xmlTextReader.NodeType;
             if (nodeType != XmlNodeType.Element)
             {
                 if (nodeType == XmlNodeType.EndElement)
                 {
                     if (xmlTextReader.Name == xmlTextReader.NameTable.Get("SmallIconMappings"))
                     {
                         flag = false;
                     }
                 }
             }
             else if (xmlTextReader.Name == xmlTextReader.NameTable.Get("SmallIconMappings"))
             {
                 flag = true;
             }
             else if (flag && xmlTextReader.Name == xmlTextReader.NameTable.Get("Mapping"))
             {
                 SmallIconManager.ParseMappingElement(xmlTextReader, folderName, stringBuilder, prefixIconTable, iconTable);
             }
         }
         if (stringBuilder.Length != 0)
         {
             OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_SmallIconsAltReferenceInvalid, string.Empty, new object[]
             {
                 stringBuilder.ToString()
             });
         }
     }
 }
コード例 #23
0
        private static XmlTextReader InitializeXmlTextReader(string xmlFilePath)
        {
            ExTraceGlobals.SmallIconCallTracer.TraceDebug <string>(0L, "InitializeXmlTextReader: XmlFilePath = '{0}'", xmlFilePath);
            if (!File.Exists(xmlFilePath))
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_SmallIconsFileNotFound, string.Empty, new object[]
                {
                    xmlFilePath
                });
                throw new OwaSmallIconManagerInitializationException("SmallIcon XML file is not found: '" + xmlFilePath + "'");
            }
            XmlTextReader xmlTextReader = SafeXmlFactory.CreateSafeXmlTextReader(xmlFilePath);

            xmlTextReader.WhitespaceHandling = WhitespaceHandling.None;
            xmlTextReader.NameTable.Add("SmallIconMappings");
            xmlTextReader.NameTable.Add("Mapping");
            xmlTextReader.NameTable.Add("ItemClass");
            xmlTextReader.NameTable.Add("IconFlag");
            xmlTextReader.NameTable.Add("SmallIcon");
            xmlTextReader.NameTable.Add("PrefixMatch");
            xmlTextReader.NameTable.Add("Alt");
            return(xmlTextReader);
        }
コード例 #24
0
ファイル: Theme.cs プロジェクト: YHZX2013/exchange_diff
        private static bool IsValidThemeFolder(string folderPath)
        {
            List <string> list = new List <string>();

            for (int i = 0; i < Theme.RequiredFiles.Length; i++)
            {
                string path = Path.Combine(folderPath, Theme.RequiredFiles[i]);
                if (!File.Exists(path))
                {
                    list.Add(Theme.RequiredFiles[i]);
                }
            }
            if (list.Count > 0)
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_InvalidThemeFolder, string.Empty, new object[]
                {
                    folderPath,
                    string.Join(", ", list.ToArray())
                });
                return(false);
            }
            return(true);
        }
コード例 #25
0
        // Token: 0x06000A18 RID: 2584 RVA: 0x00045AB8 File Offset: 0x00043CB8
        private static X509Certificate2 FindCertByThumbprint(string thumbprint)
        {
            X509Certificate2 x509Certificate = null;
            X509Store        x509Store       = new X509Store(StoreName.My, StoreLocation.LocalMachine);

            try
            {
                x509Store.Open(OpenFlags.ReadOnly);
                X509Certificate2Collection x509Certificate2Collection = x509Store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);
                x509Certificate = ((x509Certificate2Collection.Count > 0) ? x509Certificate2Collection[0] : null);
                if (x509Certificate == null)
                {
                    ExTraceGlobals.InstantMessagingTracer.TraceDebug <string>(0L, "IM Certificate with thumbprint {0} could not be found.", thumbprint);
                    OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ErrorIMCertificateNotFound, string.Empty, new object[]
                    {
                        thumbprint
                    });
                }
            }
            catch (CryptographicException arg)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceError <CryptographicException>(0L, "Cryptographic exception is thrown: {0}", arg);
            }
            catch (SecurityException arg2)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceError <SecurityException>(0L, "Security exception is thrown: {0}", arg2);
            }
            catch (ArgumentException arg3)
            {
                ExTraceGlobals.InstantMessagingTracer.TraceError <ArgumentException>(0L, "Argument exception is thrown: {0}", arg3);
            }
            finally
            {
                x509Store.Close();
            }
            return(x509Certificate);
        }
コード例 #26
0
 // Token: 0x06000D79 RID: 3449 RVA: 0x00059B04 File Offset: 0x00057D04
 private static void InitializeConfigurationManager()
 {
     try
     {
         OwaConfigurationManager.session = Utilities.CreateADSystemConfigurationSessionScopedToFirstOrg(false, ConsistencyMode.FullyConsistent);
         Server server = OwaConfigurationManager.session.FindLocalServer();
         OwaConfigurationManager.isPhoneticSupportEnabled = server.IsPhoneticSupportEnabled;
         OwaConfigurationManager.virtualDirectoryName     = HttpRuntime.AppDomainAppVirtualPath.Replace("'", "''");
         if (OwaConfigurationManager.virtualDirectoryName[0] == '/')
         {
             OwaConfigurationManager.virtualDirectoryName = OwaConfigurationManager.virtualDirectoryName.Substring(1);
         }
         OwaConfigurationManager.webSiteName = HttpRuntime.AppDomainAppId;
         if (OwaConfigurationManager.webSiteName[0] == '/')
         {
             OwaConfigurationManager.webSiteName = OwaConfigurationManager.webSiteName.Substring(1);
         }
         int num = OwaConfigurationManager.webSiteName.IndexOf('/');
         OwaConfigurationManager.webSiteName = OwaConfigurationManager.webSiteName.Substring(num);
         OwaConfigurationManager.webSiteName = string.Format("IIS://{0}{1}", server.Fqdn, OwaConfigurationManager.webSiteName);
         num = OwaConfigurationManager.webSiteName.LastIndexOf('/');
         OwaConfigurationManager.webSiteName        = IisUtility.GetWebSiteName(OwaConfigurationManager.webSiteName.Substring(0, num));
         OwaConfigurationManager.virtualDirectoryDN = new ADObjectId(server.DistinguishedName).GetDescendantId("Protocols", "HTTP", new string[]
         {
             string.Format("{0} ({1})", OwaConfigurationManager.virtualDirectoryName, OwaConfigurationManager.webSiteName)
         });
     }
     catch (Exception ex)
     {
         ExTraceGlobals.ConfigurationManagerTracer.TraceDebug <string>(0L, "Unable to retrieve the AD session or the server object. {0}", ex.Message);
         OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_ADSystemConfigurationSession, string.Empty, new object[]
         {
             ex.Message
         });
         throw;
     }
 }
コード例 #27
0
 private void LogPayloadNotPickedEvent()
 {
     if (!this.overMaxSize)
     {
         this.overMaxSize = true;
         string uriForUser = this.GetUriForUser();
         ExTraceGlobals.InstantMessagingTracer.TraceError <string>((long)this.GetHashCode(), "InstantMessagePayload.LogPayloadNotPickedEvent. Payload has grown too large without being picked up. User: {0}", uriForUser);
         OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_PayloadNotBeingPickedup, string.Empty, new object[]
         {
             this.GetUriForUser()
         });
         PendingRequestManager pendingRequestManager = this.userContext.PendingRequestManager;
         if (pendingRequestManager != null)
         {
             ChunkedHttpResponse chunkedHttpResponse = pendingRequestManager.ChunkedHttpResponse;
             if (chunkedHttpResponse != null && chunkedHttpResponse.IsClientConnected)
             {
                 InstantMessageUtilities.SendWatsonReport("InstantMessagePayload.LogPayloadNotPickedEvent", this.userContext, new OverflowException(string.Format("Payload has grown too large without being picked up. User: {0}", uriForUser)));
             }
         }
         this.Cancel();
         this.payloadString.Append(InstantMessagePayload.overMaxSizeUnavailablePayload);
     }
 }
コード例 #28
0
        public void LoadRegistries(string directory)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug <string>((long)this.GetHashCode(), "FormsRegistryLoader.LoadRegistries directory = {0}", directory);
            Hashtable hashtable  = new Hashtable();
            Hashtable hashtable2 = new Hashtable();

            if (!Directory.Exists(directory))
            {
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FormsFolderNotFound, string.Empty, new object[]
                {
                    directory
                });
                throw new OwaInvalidInputException("Forms directory not found", null, this);
            }
            foreach (string text in Directory.GetDirectories(directory))
            {
                string text2 = Path.Combine(text, "registry.xml").Replace('/', '\\');
                if (!File.Exists(text2))
                {
                    ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Registry file not found. file = {0}", text2);
                }
                else
                {
                    int num = text.LastIndexOf('\\');
                    if (num >= 0)
                    {
                        text = text.Substring(num + 1);
                    }
                    FormsRegistryParser formsRegistryParser = new FormsRegistryParser();
                    try
                    {
                        formsRegistryParser.Load(text2, text);
                    }
                    catch (Exception)
                    {
                        if (formsRegistryParser.Registry.IsCustomRegistry)
                        {
                            goto IL_251;
                        }
                        throw;
                    }
                    if (this.registries.ContainsKey(formsRegistryParser.Registry.Name))
                    {
                        OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FormsRegistryReDefinition, string.Empty, new object[]
                        {
                            formsRegistryParser.Registry.Name
                        });
                        if (formsRegistryParser.Registry.IsCustomRegistry)
                        {
                            goto IL_251;
                        }
                        if (!((FormsRegistry)this.registries[formsRegistryParser.Registry.Name]).IsCustomRegistry)
                        {
                            throw new OwaInvalidInputException(string.Format("Duplicate registry found ('{0}')", formsRegistryParser.Registry.Name), null, this);
                        }
                        this.registries.Remove(formsRegistryParser.Registry.Name);
                        hashtable.Remove(formsRegistryParser.Registry.Name);
                        hashtable2.Remove(formsRegistryParser.Registry.Name);
                        this.loadedCustomRegistryFiles.Remove(formsRegistryParser.Registry.Name);
                    }
                    if (formsRegistryParser.Registry.HasCustomForm)
                    {
                        this.loadedCustomRegistryFiles.Add(formsRegistryParser.Registry.Name, text2);
                    }
                    this.registries.Add(formsRegistryParser.Registry.Name, formsRegistryParser.Registry);
                    hashtable.Add(formsRegistryParser.Registry.Name, formsRegistryParser.ClientMappings);
                    hashtable2.Add(formsRegistryParser.Registry.Name, formsRegistryParser.BaseClientMappings);
                }
                IL_251 :;
            }
            if (this.loadedCustomRegistryFiles.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (object obj in this.loadedCustomRegistryFiles.Values)
                {
                    string value = (string)obj;
                    stringBuilder.AppendLine(value);
                }
                OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_CustomizationFormsRegistryLoadSuccessfully, string.Empty, new object[]
                {
                    stringBuilder.ToString()
                });
            }
            IDictionaryEnumerator enumerator2 = this.registries.GetEnumerator();

            while (enumerator2.MoveNext())
            {
                FormsRegistry formsRegistry = (FormsRegistry)enumerator2.Value;
                ArrayList     arrayList     = (ArrayList)hashtable[formsRegistry.Name];
                if (formsRegistry.InheritsFrom.Length > 0)
                {
                    FormsRegistry formsRegistry2 = formsRegistry;
                    while (formsRegistry2.InheritsFrom.Length > 0)
                    {
                        if (!this.registries.ContainsKey(formsRegistry.InheritsFrom))
                        {
                            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FormsRegistryNotFound, string.Empty, new object[]
                            {
                                formsRegistry.Name,
                                formsRegistry.InheritsFrom
                            });
                            throw new OwaInvalidInputException(string.Format("Forms registry {0} inherits forms registry {1} that could not be found", formsRegistry.Name, formsRegistry.InheritsFrom), null, this);
                        }
                        formsRegistry2 = (FormsRegistry)this.registries[formsRegistry2.InheritsFrom];
                        arrayList.AddRange((ArrayList)hashtable[formsRegistry2.Name]);
                    }
                    ArrayList arrayList2 = (ArrayList)hashtable2[formsRegistry2.Name];
                    for (int j = 0; j < arrayList2.Count; j++)
                    {
                        ClientMapping clientMapping = ClientMapping.Copy((ClientMapping)arrayList2[j]);
                        ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <ClientMapping>((long)this.GetHashCode(), "Copied client mapping form inherited registry. ClientMapping = {0}", clientMapping);
                        clientMapping.Experience.FormsRegistry = formsRegistry;
                        this.baseExperienceClientMappings.Add(clientMapping);
                    }
                }
                else
                {
                    int k;
                    for (k = 0; k < arrayList.Count; k++)
                    {
                        ClientMapping clientMapping2 = (ClientMapping)arrayList[k];
                        if (formsRegistry.BaseExperience == clientMapping2.Experience.Name)
                        {
                            ExTraceGlobals.FormsRegistryTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Registry '{0}' Verified existence of base experience '{1}'", formsRegistry.Name, formsRegistry.BaseExperience);
                            break;
                        }
                    }
                    if (k == arrayList.Count)
                    {
                        OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FormsRegistryMissingBaseExperience, string.Empty, new object[]
                        {
                            formsRegistry.Name,
                            formsRegistry.BaseExperience
                        });
                        throw new OwaInvalidInputException(string.Format("Registry {0} does not define the specified base experience named {1}", formsRegistry.Name, formsRegistry.BaseExperience), null, this);
                    }
                    ArrayList c = (ArrayList)hashtable2[formsRegistry.Name];
                    this.baseExperienceClientMappings.AddRange(c);
                }
                arrayList.Sort(new ClientMappingComparer(this.Registries));
                formsRegistry.ClientMappingList = new ClientMappingList((ClientMapping[])arrayList.ToArray(typeof(ClientMapping)));
            }
            ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <int>((long)this.GetHashCode(), "Total client mappings for all base experiences: {0}", this.baseExperienceClientMappings.Count);
            this.baseExperienceClientMappings.Sort(new ClientMappingComparer(this.Registries));
        }
コード例 #29
0
        internal void Load(string registryFile, string folder)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug <string, string>((long)this.GetHashCode(), "FormsRegistryParser.Load  registry file = {0}, folder = {1}", registryFile, folder);
            this.registryFile = registryFile;
            bool   flag           = false;
            string name           = string.Empty;
            string inheritsFrom   = string.Empty;
            string baseExperience = string.Empty;
            bool   isRichClient   = false;

            try
            {
                this.reader = SafeXmlFactory.CreateSafeXmlTextReader(registryFile);
                this.reader.WhitespaceHandling = WhitespaceHandling.None;
                this.registry = new FormsRegistry();
                this.reader.Read();
                if (this.reader.Name != FormsRegistryParser.nameTableValues[0])
                {
                    this.ThrowExpectedElementException(FormsRegistryParser.NameTableValues.Registry);
                }
                if (!this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[1]))
                {
                    this.ThrowExpectedAttributeException(FormsRegistryParser.NameTableValues.Name);
                }
                name = this.reader.Value;
                if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[3]))
                {
                    inheritsFrom = this.reader.Value;
                    if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[2]))
                    {
                        this.ThrowParserException("BaseExperience is not valid when inheriting from another registry. The BaseExperience from the inherited registry is used instead", ClientsEventLogConstants.Tuple_FormsRegistryInvalidUserOfBaseExperience, new object[]
                        {
                            registryFile,
                            this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                            this.reader.LinePosition.ToString(CultureInfo.InvariantCulture)
                        });
                    }
                }
                else if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[2]))
                {
                    baseExperience = this.reader.Value;
                }
                else
                {
                    this.ThrowParserException("Expected BaseExperience or InheritsFrom attribute", ClientsEventLogConstants.Tuple_FormsRegistryExpectedBaseExperienceOrInheritsFrom, new object[]
                    {
                        registryFile,
                        this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                        this.reader.LinePosition.ToString(CultureInfo.InvariantCulture)
                    });
                }
                if (!this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[4]))
                {
                    this.ThrowExpectedAttributeException(FormsRegistryParser.NameTableValues.IsRichClient);
                }
                try
                {
                    isRichClient = bool.Parse(this.reader.Value);
                }
                catch (FormatException)
                {
                    this.ThrowParserException("Expected a valid boolean value in IsRichClient property", ClientsEventLogConstants.Tuple_FormsRegistryInvalidUserOfIsRichClient, new object[]
                    {
                        registryFile,
                        this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                        this.reader.LinePosition.ToString(CultureInfo.InvariantCulture),
                        this.reader.Value
                    });
                }
                try
                {
                    this.registry.Initialize(name, baseExperience, inheritsFrom, folder, isRichClient);
                    goto IL_33E;
                }
                catch (OwaInvalidInputException ex)
                {
                    OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FormsRegistryParseError, ex.Message, new object[]
                    {
                        registryFile,
                        this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                        this.reader.LinePosition.ToString(CultureInfo.InvariantCulture),
                        ex.Message
                    });
                    throw ex;
                }
IL_2D4:
                XmlNodeType nodeType = this.reader.NodeType;
                if (nodeType != XmlNodeType.Element)
                {
                    if (nodeType == XmlNodeType.EndElement)
                    {
                        if (this.reader.Name == FormsRegistryParser.nameTableValues[0])
                        {
                            flag = true;
                        }
                    }
                }
                else if (this.reader.Name == FormsRegistryParser.nameTableValues[5])
                {
                    this.clientMappings.AddRange(this.ParseExperience());
                }
                else
                {
                    this.ThrowExpectedElementException(FormsRegistryParser.NameTableValues.Experience);
                }
IL_33E:
                if (!flag && this.reader.Read())
                {
                    goto IL_2D4;
                }
            }
            catch (XmlException ex2)
            {
                this.ThrowParserException(ex2.Message, ClientsEventLogConstants.Tuple_FormsRegistryParseError, new object[]
                {
                    registryFile,
                    this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                    this.reader.LinePosition.ToString(CultureInfo.InvariantCulture),
                    ex2.Message
                });
            }
            finally
            {
                if (this.reader != null)
                {
                    this.reader.Close();
                }
            }
        }
コード例 #30
0
        private void ParseElementClass(string experience, ApplicationElement applicationElement)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug((long)this.GetHashCode(), "FormsRegistryParser.ParseElementClass");
            bool   flag      = false;
            string itemClass = string.Empty;

            if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[14]))
            {
                itemClass = this.reader.Value;
            }
            ulong num = 0UL;

            if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[18]))
            {
                num = this.ParseRequiredFeatures(this.reader.Value);
            }
            while (!flag && this.reader.Read())
            {
                XmlNodeType nodeType = this.reader.NodeType;
                if (nodeType != XmlNodeType.Element)
                {
                    if (nodeType == XmlNodeType.EndElement)
                    {
                        if (this.reader.Name == FormsRegistryParser.nameTableValues[12])
                        {
                            flag = true;
                        }
                    }
                }
                else
                {
                    if (this.reader.Name == FormsRegistryParser.nameTableValues[13])
                    {
                        string text              = string.Empty;
                        string action            = string.Empty;
                        string state             = string.Empty;
                        ulong  segmentationFlags = num;
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[16]))
                        {
                            action = this.reader.Value;
                        }
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[17]))
                        {
                            state = this.reader.Value;
                        }
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[18]))
                        {
                            segmentationFlags = this.ParseRequiredFeatures(this.reader.Value);
                        }
                        if (!this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[15]))
                        {
                            this.ThrowExpectedAttributeException(FormsRegistryParser.NameTableValues.Form);
                        }
                        text = this.reader.Value;
                        FormKey formKey = new FormKey(experience, applicationElement, itemClass, action, state);
                        ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <FormKey, string>((long)this.GetHashCode(), "Parsed Mapping - key = ({0}), form = {1}", formKey, text);
                        try
                        {
                            if (applicationElement == ApplicationElement.PreFormAction)
                            {
                                this.registry.AddPreForm(formKey, text, segmentationFlags);
                            }
                            else
                            {
                                this.registry.AddForm(formKey, text, segmentationFlags);
                            }
                            continue;
                        }
                        catch (OwaInvalidInputException ex)
                        {
                            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FormsRegistryParseError, ex.Message, new object[]
                            {
                                this.registryFile,
                                this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                                this.reader.LinePosition.ToString(CultureInfo.InvariantCulture),
                                ex.Message
                            });
                            throw ex;
                        }
                    }
                    this.ThrowExpectedElementException(FormsRegistryParser.NameTableValues.Mapping);
                }
            }
        }