Esempio n. 1
0
        internal static bool Decode(ref string addressType, ref string address, string imceaResolvableDomain)
        {
            if (imceaResolvableDomain == null)
            {
                return(false);
            }
            int num = ImceaAddress.FindImceaDashPosition(address);

            if (num <= "IMCEA".Length)
            {
                return(false);
            }
            string text = address.Substring("IMCEA".Length, num - "IMCEA".Length);
            int    num2 = address.LastIndexOf('@');

            if (num2 < 0 || num2 == address.Length - 1)
            {
                return(false);
            }
            string strA = address.Substring(num2 + 1, address.Length - num2 - 1);

            if (string.Compare(strA, imceaResolvableDomain, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(false);
            }
            ProxyAddress proxyAddress = null;

            if (!SmtpProxyAddress.TryDeencapsulate(address, out proxyAddress))
            {
                return(false);
            }
            addressType = text.ToUpper();
            address     = proxyAddress.AddressString;
            return(true);
        }
Esempio n. 2
0
        internal IEnumerable <string> Resolve(IEnumerable <string> addresses, IRecipientSession session)
        {
            if (addresses == null)
            {
                return(null);
            }
            int num = 0;
            List <ProxyAddress> list = new List <ProxyAddress>();

            foreach (string text in addresses)
            {
                num++;
                if (!this.lookupCache.ContainsKey(text))
                {
                    list.Add(ProxyAddress.Parse(text));
                    this.lookupCache[text] = null;
                }
            }
            this.AddressesLookedUp = list.Count;
            if (list.Count > 0)
            {
                ProxyAddress[]        array  = list.ToArray();
                Result <ADRawEntry>[] array2 = session.FindByProxyAddresses(array, BulkRecipientLookupCache.displayNameProperty);
                for (int i = 0; i < array.Length; i++)
                {
                    ADRawEntry data          = array2[i].Data;
                    string     addressString = array[i].AddressString;
                    string     value         = null;
                    if (data != null)
                    {
                        value = (data[ADRecipientSchema.DisplayName] as string);
                    }
                    if (string.IsNullOrEmpty(value))
                    {
                        ProxyAddress proxyAddress;
                        if (SmtpProxyAddress.TryDeencapsulate(array[i].AddressString, out proxyAddress) && !string.IsNullOrEmpty(proxyAddress.AddressString))
                        {
                            value = proxyAddress.AddressString;
                        }
                        else
                        {
                            value = array[i].AddressString;
                        }
                    }
                    this.lookupCache[addressString] = value;
                }
            }
            return(from address in addresses
                   select this.lookupCache[address]);
        }
        // Token: 0x06000C20 RID: 3104 RVA: 0x00053828 File Offset: 0x00051A28
        private static void ProcessRecipients(MessageItem mailToMessage, string value, RecipientItemType recipientItemType)
        {
            if (string.IsNullOrEmpty(value))
            {
                return;
            }
            value = HttpUtility.UrlDecode(value);
            Participant participant;
            bool        flag = Participant.TryParse(value, out participant);

            if (flag)
            {
                ProxyAddress proxyAddress;
                if (ImceaAddress.IsImceaAddress(participant.EmailAddress) && SmtpProxyAddress.TryDeencapsulate(participant.EmailAddress, out proxyAddress))
                {
                    participant = new Participant((participant.DisplayName != participant.EmailAddress) ? participant.DisplayName : proxyAddress.AddressString, proxyAddress.AddressString, proxyAddress.PrefixString);
                }
                mailToMessage.Recipients.Add(participant, recipientItemType);
            }
        }
        public Message LegacyAction(Message input)
        {
            Message reply = null;

            Common.SendWatsonReportOnUnhandledException(delegate
            {
                RequestData requestData = null;
                object obj = null;
                HttpContext httpContext = HttpContext.Current;
                if (input.Properties.TryGetValue("RequestData", out obj))
                {
                    requestData = (RequestData)obj;
                }
                else
                {
                    bool useClientCertificateAuthentication = Common.CheckClientCertificate(httpContext.Request);
                    requestData = new RequestData(null, useClientCertificateAuthentication, CallerRequestedCapabilities.GetInstance(httpContext));
                    input.Properties["RequestData"]  = requestData;
                    input.Properties["ParseSuccess"] = false;
                }
                string userAgent = Common.SafeGetUserAgent(httpContext.Request);
                ProxyAddress proxyAddress;
                if (VariantConfiguration.InvariantNoFlightingSnapshot.Autodiscover.RedirectOutlookClient.Enabled && AutodiscoverProxy.CanRedirectOutlookClient(userAgent) && !string.IsNullOrEmpty(requestData.EMailAddress) && SmtpProxyAddress.TryDeencapsulate(requestData.EMailAddress, out proxyAddress))
                {
                    requestData.EMailAddress = proxyAddress.AddressString;
                }
                LegacyBodyWriter bodyWriter;
                RequestDetailsLoggerBase <RequestDetailsLogger> .Current.TrackLatency(ServiceLatencyMetadata.CoreExecutionLatency, delegate()
                {
                    if (!HttpContext.Current.Request.IsAuthenticated)
                    {
                        requestData.Clear();
                        input.Properties["ParseSuccess"] = false;
                        bodyWriter = new LegacyBodyWriter(input, HttpContext.Current);
                        reply      = Message.CreateMessage(MessageVersion.None, "*", bodyWriter);
                        HttpResponseMessageProperty httpResponseMessageProperty = new HttpResponseMessageProperty();
                        httpResponseMessageProperty.StatusCode = HttpStatusCode.Unauthorized;
                        reply.Properties.Add(HttpResponseMessageProperty.Name, httpResponseMessageProperty);
                        return;
                    }
                    bodyWriter = new LegacyBodyWriter(input, HttpContext.Current);
                    reply      = Message.CreateMessage(MessageVersion.None, "*", bodyWriter);
                });
            });
            return(reply);
        }
        // Token: 0x06000114 RID: 276 RVA: 0x00006EAC File Offset: 0x000050AC
        private static void HandleSmsMessage(MailboxSession session, Item item, MailboxData mailboxData, ConversationIndexTrackingEx indexTrackingEx)
        {
            MessageItem messageItem = item as MessageItem;

            if (messageItem == null)
            {
                SentItemsProcessor.Tracer.TraceDebug(0L, "{0}: the SMS message is not MessageItem", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            RecipientCollection recipients = messageItem.Recipients;

            if (recipients.Count == 0)
            {
                return;
            }
            using (SmsRecipientInfoCache smsRecipientInfoCache = SmsRecipientInfoCache.Create(session, SentItemsProcessor.Tracer))
            {
                Dictionary <ConversationIndex, Recipient> dictionary = new Dictionary <ConversationIndex, Recipient>(recipients.Count);
                for (int i = recipients.Count - 1; i >= 0; i--)
                {
                    Recipient   recipient   = recipients[i];
                    Participant participant = recipient.Participant;
                    if (!(participant == null) && !string.IsNullOrEmpty(participant.EmailAddress))
                    {
                        string text = null;
                        if (string.Equals(participant.RoutingType, "MOBILE", StringComparison.OrdinalIgnoreCase))
                        {
                            text = participant.EmailAddress;
                            smsRecipientInfoCache.AddRecipient(participant);
                        }
                        else if (string.Equals(participant.RoutingType, "SMTP", StringComparison.OrdinalIgnoreCase))
                        {
                            ProxyAddress proxyAddress;
                            if (SmtpProxyAddress.TryDeencapsulate(participant.EmailAddress, out proxyAddress) && string.Equals(proxyAddress.PrefixString, "MOBILE", StringComparison.OrdinalIgnoreCase))
                            {
                                text = proxyAddress.AddressString;
                            }
                            smsRecipientInfoCache.AddRecipient(new Participant(participant.DisplayName, text, "MOBILE"));
                        }
                        if (text != null)
                        {
                            ConversationIndex conversationIndex = ConversationIndex.GenerateFromPhoneNumber(text);
                            if (!(conversationIndex == ConversationIndex.Empty))
                            {
                                recipients.RemoveAt(i);
                                if (!dictionary.ContainsKey(conversationIndex))
                                {
                                    dictionary.Add(conversationIndex, recipient);
                                }
                            }
                        }
                    }
                }
                if (recipients.Count > 0)
                {
                    messageItem.Save(SaveMode.ResolveConflicts);
                    messageItem.Load();
                }
                int num = 0;
                foreach (KeyValuePair <ConversationIndex, Recipient> keyValuePair in dictionary)
                {
                    num++;
                    AggregationBySmsItemClassProcessor.ChunkSmsConversation(XSOFactory.Default, session, keyValuePair.Key, indexTrackingEx);
                    if (num < dictionary.Count || recipients.Count > 0)
                    {
                        SentItemsProcessor.CloneSmsItem(session, messageItem, mailboxData, keyValuePair.Value, keyValuePair.Key);
                    }
                    else
                    {
                        recipients.Add(keyValuePair.Value);
                        SentItemsProcessor.SaveSmsItem(messageItem, keyValuePair.Key);
                        messageItem.Load();
                    }
                }
                smsRecipientInfoCache.Commit();
            }
        }
Esempio n. 6
0
        internal static bool IsSMSRecipient(string recipient)
        {
            ProxyAddress proxyAddress;

            return(SmtpProxyAddress.TryDeencapsulate(recipient, out proxyAddress) && string.Equals(proxyAddress.PrefixString, "MOBILE", StringComparison.OrdinalIgnoreCase));
        }
Esempio n. 7
0
        protected override void OnLoad(EventArgs e)
        {
            if (Redir.IsUrlRefererFBALogonPage(base.Request.UrlReferrer))
            {
                Utilities.EndResponse(this.Context, HttpStatusCode.Forbidden);
            }
            string queryStringParameter;
            bool   signedUrl = Redir.GetSignedUrl(base.Request, base.UserContext.Key.Canary.UserContextIdGuid, base.UserContext.Key.Canary.LogonUniqueKey, out queryStringParameter);

            if (!signedUrl)
            {
                queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "URL");
            }
            string queryStringParameter2 = Utilities.GetQueryStringParameter(base.Request, "TranslatedURL", false);
            bool   flag  = !string.IsNullOrEmpty(queryStringParameter2);
            bool   flag2 = string.IsNullOrEmpty(Utilities.GetQueryStringParameter(base.Request, "NoDocLnkCls", false));

            if (Redir.IsSafeUrl(queryStringParameter, base.Request))
            {
                ErrorInformation errorInformation = null;
                Uri uri;
                if (null == (uri = Utilities.TryParseUri(queryStringParameter)))
                {
                    Utilities.EndResponse(this.Context, HttpStatusCode.Forbidden);
                }
                string scheme = uri.Scheme;
                if (CultureInfo.InvariantCulture.CompareInfo.Compare(scheme, "mailto", CompareOptions.IgnoreCase) == 0)
                {
                    StringBuilder stringBuilder = new StringBuilder(512);
                    stringBuilder.Append(OwaUrl.ApplicationRoot.GetExplicitUrl(base.OwaContext));
                    stringBuilder.Append("?ae=Item&a=New&t=");
                    string value = "IPM.Note";
                    if (base.UserContext.IsSmsEnabled)
                    {
                        int length = "mailto:".Length;
                        if (queryStringParameter.Length > length)
                        {
                            string       inputString = queryStringParameter.Substring(length);
                            Participant  participant;
                            ProxyAddress proxyAddress;
                            if (Participant.TryParse(inputString, out participant) && ImceaAddress.IsImceaAddress(participant.EmailAddress) && SmtpProxyAddress.TryDeencapsulate(participant.EmailAddress, out proxyAddress) && Utilities.IsMobileRoutingType(proxyAddress.PrefixString))
                            {
                                value = "IPM.Note.Mobile.SMS";
                            }
                        }
                    }
                    stringBuilder.Append(value);
                    stringBuilder.Append('&');
                    stringBuilder.Append("email");
                    stringBuilder.Append('=');
                    stringBuilder.Append(Utilities.UrlEncode(queryStringParameter));
                    this.safeUrl = stringBuilder.ToString();
                    this.isNewMailLinkCreated = true;
                    return;
                }
                if (flag2)
                {
                    this.safeUrl = this.TryNavigateToInternalWssUnc(queryStringParameter, out errorInformation);
                }
                if (this.safeUrl == null)
                {
                    if (flag && Redir.IsSafeUrl(queryStringParameter2, base.Request))
                    {
                        this.safeUrl = queryStringParameter2;
                    }
                    else
                    {
                        if (errorInformation != null)
                        {
                            Utilities.TransferToErrorPage(base.OwaContext, errorInformation);
                            return;
                        }
                        this.safeUrl = queryStringParameter;
                    }
                }
            }
            else if (flag && Redir.IsSafeUrl(queryStringParameter2, base.Request))
            {
                this.safeUrl = queryStringParameter2;
            }
            else
            {
                Utilities.EndResponse(this.Context, HttpStatusCode.Forbidden);
            }
            if (!signedUrl)
            {
                throw new OwaInvalidCanary14Exception(null, "Invalid canary in redir.aspx query.");
            }
        }