コード例 #1
0
ファイル: WinRMInfo.cs プロジェクト: YHZX2013/exchange_diff
 public static void SetFailureCategoryInfo(NameValueCollection httpHeaders, FailureCategory fc, string fcSubInfo)
 {
     if (string.IsNullOrEmpty(httpHeaders["X-RemotePS-FailureCategory"]))
     {
         httpHeaders["X-RemotePS-FailureCategory"] = string.Format("{0}-{1}", fc, fcSubInfo);
     }
 }
コード例 #2
0
 public static string ToDescriptionString(this FailureCategory val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val
                                         .GetType()
                                         .GetField(val.ToString())
                                         .GetCustomAttributes(typeof(DescriptionAttribute), false);
     return(attributes.Length > 0 ? attributes[0].Description : string.Empty);
 }
コード例 #3
0
        protected async Task LogFailedRequest(HttpRequestMessage req, HttpResponseMessage res)
        {
            int             statusCodeValue = (int)res.StatusCode;
            FailureCategory category        = statusCodeValue >= 400 && statusCodeValue < 500
                ? FailureCategory.Build
                : FailureCategory.Helix;

            Log.LogError(category, $"Request to {req.RequestUri} returned failed status {statusCodeValue} {res.ReasonPhrase}\n\n{(res.Content != null ? await res.Content.ReadAsStringAsync() : "")}");
            if (res.StatusCode == HttpStatusCode.Found)
            {
                Log.LogError(
                    FailureCategory.Build,
                    "A call to an Azure DevOps api returned 302 Indicating a bad 'System.AccessToken' value.\n\nPlease Check the 'Make secrets available to builds of forks' in the pipeline pull request validation trigger settings.\nWe have evaluated the security considerations of this setting and have determined that it is fine to use for our public PR validation builds.");
            }
        }
コード例 #4
0
        public static void FilterResultsLists(MeetingValidationResult cmdLetValidationResult, MeetingValidationResult result, FailureCategory failureCategory, bool onlyReportErrors)
        {
            List <ResultsPerAttendee> list = new List <ResultsPerAttendee>();

            foreach (KeyValuePair <string, MeetingComparisonResult> keyValuePair in result.ResultsPerAttendee)
            {
                ResultsPerAttendee resultsPerAttendee = new ResultsPerAttendee();
                resultsPerAttendee.PrimarySMTPAddress = new SmtpAddress(keyValuePair.Key);
                foreach (ConsistencyCheckResult consistencyCheckResult in keyValuePair.Value)
                {
                    if (!onlyReportErrors || consistencyCheckResult.Status != CheckStatusType.Passed)
                    {
                        foreach (Inconsistency inconsistency in consistencyCheckResult)
                        {
                            switch (consistencyCheckResult.CheckType)
                            {
                            case ConsistencyCheckType.CanValidateOwnerCheck:
                                if (inconsistency.Flag == CalendarInconsistencyFlag.Organizer)
                                {
                                    resultsPerAttendee.CantOpen = "CanValidateCheck failed " + inconsistency.Description;
                                }
                                else
                                {
                                    resultsPerAttendee.MailboxUnavailable = "CanValidateCheck failed " + consistencyCheckResult.ErrorString;
                                }
                                break;

                            case ConsistencyCheckType.MeetingExistenceCheck:
                                if (inconsistency.Flag == CalendarInconsistencyFlag.Response)
                                {
                                    resultsPerAttendee.IntentionalWrongTrackingInfo = string.Format("MeetingExistenceCheck failed (intent: {0}) {1}", inconsistency.Intent, consistencyCheckResult.ErrorString);
                                }
                                else if (inconsistency.Flag == CalendarInconsistencyFlag.OrphanedMeeting && ClientIntentQuery.CheckDesiredClientIntent(inconsistency.Intent, new ClientIntentFlags[]
                                {
                                    ClientIntentFlags.MeetingCanceled,
                                    ClientIntentFlags.MeetingExceptionCanceled
                                }))
                                {
                                    resultsPerAttendee.IntentionalMissingMeetings = string.Format("MeetingExistenceCheck failed (intent: {0}) {1}", inconsistency.Intent, consistencyCheckResult.ErrorString);
                                }
                                else
                                {
                                    resultsPerAttendee.MissingMeetings = string.Format("MeetingExistenceCheck failed (intent: {0}) {1}", inconsistency.Intent, consistencyCheckResult.ErrorString);
                                }
                                break;

                            case ConsistencyCheckType.ValidateStoreObjectCheck:
                                resultsPerAttendee.CantOpen = "ValidateStoreObjectCheck failed " + inconsistency.Description;
                                break;

                            case ConsistencyCheckType.MeetingCancellationCheck:
                                resultsPerAttendee.WrongTrackingInfo = "MeetingCancellationCheck failed " + consistencyCheckResult.ErrorString;
                                break;

                            case ConsistencyCheckType.AttendeeOnListCheck:
                                resultsPerAttendee.WrongTrackingInfo = "AttendeeOnListCheck failed " + consistencyCheckResult.ErrorString;
                                break;

                            case ConsistencyCheckType.CorrectResponseCheck:
                            {
                                ResponseInconsistency responseInconsistency = inconsistency as ResponseInconsistency;
                                if (responseInconsistency != null)
                                {
                                    resultsPerAttendee.WrongTrackingInfo = "CorrectResponseCheck: Attendee has a response that is different from what was sent to the organizer.";
                                    ResultsPerAttendee resultsPerAttendee2 = resultsPerAttendee;
                                    resultsPerAttendee2.WrongTrackingInfo += string.Format("User {0} at {1}, the organizer expected {2} at {3}. ", new object[]
                                        {
                                            responseInconsistency.ExpectedResponse,
                                            responseInconsistency.AttendeeReplyTime,
                                            responseInconsistency.ActualResponse,
                                            responseInconsistency.OrganizerRecordedTime
                                        });
                                    ResultsPerAttendee resultsPerAttendee3 = resultsPerAttendee;
                                    resultsPerAttendee3.WrongTrackingInfo += responseInconsistency.Description;
                                }
                                break;
                            }

                            case ConsistencyCheckType.MeetingPropertiesMatchCheck:
                            {
                                PropertyInconsistency propertyInconsistency = inconsistency as PropertyInconsistency;
                                if (propertyInconsistency != null)
                                {
                                    string text;
                                    if (result.IsOrganizer)
                                    {
                                        text = propertyInconsistency.ActualValue;
                                    }
                                    else
                                    {
                                        text = propertyInconsistency.ExpectedValue;
                                    }
                                    if (propertyInconsistency.PropertyName.Contains("StartTime"))
                                    {
                                        Match match = Regex.Match(text, "Start\\[(?<value>.+)\\]");
                                        resultsPerAttendee.WrongStartTime = (match.Success ? match.Groups["value"].Value : text);
                                    }
                                    else if (propertyInconsistency.PropertyName.Contains("EndTime"))
                                    {
                                        Match match2 = Regex.Match(text, "End\\[(?<value>.+)\\]");
                                        resultsPerAttendee.WrongEndTime = (match2.Success ? match2.Groups["value"].Value : text);
                                    }
                                    else if (propertyInconsistency.PropertyName.Contains("Location"))
                                    {
                                        resultsPerAttendee.WrongLocation = text;
                                    }
                                    else if (propertyInconsistency.PropertyName.Contains("MeetingOverlap"))
                                    {
                                        resultsPerAttendee.WrongOverlap = text;
                                    }
                                    else if (propertyInconsistency.PropertyName.Contains("SequenceNumber"))
                                    {
                                        ResultsPerAttendee resultsPerAttendee4 = resultsPerAttendee;
                                        resultsPerAttendee4.DelayedUpdatesWrongVersion = resultsPerAttendee4.DelayedUpdatesWrongVersion + text + ", ";
                                    }
                                    else if (propertyInconsistency.PropertyName.Contains("OwnerCriticalChangeTime"))
                                    {
                                        ResultsPerAttendee resultsPerAttendee5 = resultsPerAttendee;
                                        resultsPerAttendee5.DelayedUpdatesWrongVersion = resultsPerAttendee5.DelayedUpdatesWrongVersion + text + ", ";
                                    }
                                    else if (propertyInconsistency.PropertyName.Contains("AttendeeCriticalChangeTime"))
                                    {
                                        ResultsPerAttendee resultsPerAttendee6 = resultsPerAttendee;
                                        resultsPerAttendee6.DelayedUpdatesWrongVersion = resultsPerAttendee6.DelayedUpdatesWrongVersion + text + ", ";
                                    }
                                }
                                break;
                            }

                            case ConsistencyCheckType.RecurrenceBlobsConsistentCheck:
                                resultsPerAttendee.RecurrenceProblems = "RecurrenceBlobsConsistentCheck failed " + consistencyCheckResult.ErrorString;
                                break;

                            case ConsistencyCheckType.RecurrencesMatchCheck:
                                resultsPerAttendee.RecurrenceProblems = "RecurrencesMatchCheck failed " + consistencyCheckResult.ErrorString;
                                break;

                            case ConsistencyCheckType.TimeZoneMatchCheck:
                            {
                                PropertyInconsistency propertyInconsistency2 = inconsistency as PropertyInconsistency;
                                if (propertyInconsistency2 != null)
                                {
                                    resultsPerAttendee.WrongTimeZone = propertyInconsistency2.ActualValue + "(Expected: " + propertyInconsistency2.ExpectedValue + ")";
                                }
                                break;
                            }
                            }
                        }
                    }
                }
                bool flag = false;
                if (failureCategory != FailureCategory.All)
                {
                    if ((failureCategory & FailureCategory.DuplicateMeetings) == FailureCategory.DuplicateMeetings && !string.IsNullOrEmpty(resultsPerAttendee.Duplicates))
                    {
                        flag = true;
                    }
                    else if ((failureCategory & FailureCategory.WrongLocation) == FailureCategory.WrongLocation && !string.IsNullOrEmpty(resultsPerAttendee.WrongLocation))
                    {
                        flag = true;
                    }
                    else if ((failureCategory & FailureCategory.WrongTime) == FailureCategory.WrongTime && (!string.IsNullOrEmpty(resultsPerAttendee.WrongStartTime) || !string.IsNullOrEmpty(resultsPerAttendee.WrongEndTime)))
                    {
                        flag = true;
                    }
                    else if ((failureCategory & FailureCategory.WrongTrackingStatus) == FailureCategory.WrongTrackingStatus && !string.IsNullOrEmpty(resultsPerAttendee.WrongTrackingInfo))
                    {
                        flag = true;
                    }
                    else if ((failureCategory & FailureCategory.CorruptMeetings) == FailureCategory.CorruptMeetings && (!string.IsNullOrEmpty(resultsPerAttendee.CantOpen) || !string.IsNullOrEmpty(cmdLetValidationResult.ErrorDescription)))
                    {
                        flag = true;
                    }
                    else if ((failureCategory & FailureCategory.MissingMeetings) == FailureCategory.MissingMeetings && !string.IsNullOrEmpty(resultsPerAttendee.MissingMeetings))
                    {
                        flag = true;
                    }
                    else if ((failureCategory & FailureCategory.RecurrenceProblems) == FailureCategory.RecurrenceProblems && !string.IsNullOrEmpty(resultsPerAttendee.RecurrenceProblems))
                    {
                        flag = true;
                    }
                    else if ((failureCategory & FailureCategory.MailboxUnavailable) == FailureCategory.MailboxUnavailable && !string.IsNullOrEmpty(resultsPerAttendee.MailboxUnavailable))
                    {
                        flag = true;
                    }
                }
                else if (!onlyReportErrors || resultsPerAttendee.HasErrors())
                {
                    flag = true;
                }
                if (flag)
                {
                    list.Add(resultsPerAttendee);
                }
            }
            cmdLetValidationResult.ResultsPerAttendee = list.ToArray();
        }
コード例 #5
0
        // Token: 0x060000C9 RID: 201 RVA: 0x00005CC8 File Offset: 0x00003EC8
        internal static void EndPowerShellRequestWithFriendlyError(HttpContext context, FailureCategory failureCategory, string failureName, string errorMessage, string className, bool isCriticalError)
        {
            context.Response.StatusCode = 400;
            string text = string.Format("[FailureCategory={0}] ", failureCategory + "-" + failureName) + errorMessage;

            HttpLogger.SafeAppendGenericError(className, text, isCriticalError);
            ExTraceGlobals.HttpModuleTracer.TraceError <string>(0L, className + " Get error. {0}", text);
            context.Response.Write(text);
            context.Response.End();
        }