コード例 #1
0
        public sealed override Stream OpenPropertyStream(PropertyDefinition propertyDefinition, PropertyOpenMode openMode)
        {
            EnumValidator.AssertValid <PropertyOpenMode>(openMode);
            NativeStorePropertyDefinition nativeStorePropertyDefinition = propertyDefinition as NativeStorePropertyDefinition;

            if (nativeStorePropertyDefinition == null)
            {
                throw new InvalidOperationException(ServerStrings.ExPropertyNotStreamable(propertyDefinition.ToString()));
            }
            return(new FolderPropertyStream(base.MapiPropertyBag, nativeStorePropertyDefinition, openMode));
        }
コード例 #2
0
        private IConversationTreeNode GetEquivalentNodeFromFamilyTree(IConversationTreeNode nodeFromSelectedConversation)
        {
            IConversationTreeNode result = null;

            if (nodeFromSelectedConversation == null || !this.conversationFamilyTree.TryGetConversationTreeNode(nodeFromSelectedConversation.MainStoreObjectId, out result))
            {
                LocalizedString localizedString = ServerStrings.ExItemNotFoundInConversation((nodeFromSelectedConversation != null) ? nodeFromSelectedConversation.MainStoreObjectId : null, this.ConversationFamilyId);
                ExTraceGlobals.ConversationTracer.TraceError((long)this.GetHashCode(), localizedString);
                throw new ObjectNotFoundException(localizedString);
            }
            return(result);
        }
コード例 #3
0
        private ExchangeRunspaceConfiguration CreateRunspaceConfigurationFromExecutingUser()
        {
            this.CheckRecipientSessionIsNotNull();
            ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = Util.ReadExchangeRunspaceConfiguration(this.recipientSession, this.ExecutingUserId);

            if (exchangeRunspaceConfiguration == null)
            {
                Util.Tracer.TraceError <string>((long)this.GetHashCode(), "Unable to find executing user: {0}", this.ExecutingUserId);
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFoundId(this.ExecutingUserId));
            }
            return(exchangeRunspaceConfiguration);
        }
コード例 #4
0
 public ImapItemConverter(Item itemIn, OutboundConversionOptions options)
 {
     StorageGlobals.ContextTraceInformation(ExTraceGlobals.CcOutboundMimeTracer, "ImapItemConverter::ctor.");
     using (DisposeGuard disposeGuard = this.Guard())
     {
         Util.ThrowOnNullArgument(itemIn, "itemIn");
         Util.ThrowOnNullArgument(options, "options");
         Util.ThrowOnNullOrEmptyArgument(options.ImceaEncapsulationDomain, "options.ImceaEncapsulationDomain");
         if (!ItemConversion.IsItemClassConvertibleToMime(itemIn.ClassName))
         {
             StorageGlobals.ContextTraceError <string>(ExTraceGlobals.CcOutboundMimeTracer, "ImapItemConverter::CheckItemType: wrong item type, {0}", itemIn.ClassName);
             throw new WrongObjectTypeException(ServerStrings.ConversionInvalidItemType(itemIn.ClassName));
         }
         this.itemIn  = itemIn;
         this.options = options;
         using (StorageGlobals.SetTraceContext(this.options))
         {
             using (StorageGlobals.SetTraceContext(this.itemIn))
             {
                 if (this.options.GenerateMimeSkeleton)
                 {
                     PropertyError propertyError = this.itemIn.TryGetProperty(InternalSchema.MimeSkeleton) as PropertyError;
                     if (propertyError != null && propertyError.PropertyErrorCode == PropertyErrorCode.NotFound)
                     {
                         if (this.itemIn.IsReadOnly)
                         {
                             this.itemIn.OpenAsReadWrite();
                         }
                         this.itemNeedsSave = true;
                         using (Stream stream = this.itemIn.OpenPropertyStream(InternalSchema.MimeSkeleton, PropertyOpenMode.Create))
                         {
                             using (Stream stream2 = new MimeStreamWriter.MimeTextStream(null))
                             {
                                 using (ItemToMimeConverter itemToMimeConverter = new ItemToMimeConverter(itemIn, options, ConverterFlags.GenerateSkeleton))
                                 {
                                     using (MimeStreamWriter mimeStreamWriter = new MimeStreamWriter(stream2, stream, itemToMimeConverter.GetItemMimeEncodingOptions(this.options), MimeStreamWriter.Flags.ForceMime))
                                     {
                                         ConversionLimitsTracker limits = new ConversionLimitsTracker(this.options.Limits);
                                         itemToMimeConverter.ConvertItemToMime(mimeStreamWriter, limits);
                                     }
                                 }
                             }
                         }
                     }
                 }
                 ItemToMimeConverter itemToMimeConverter2 = new ItemToMimeConverter(itemIn, options, ConverterFlags.None);
                 this.mimeProvider        = IImapMimeProvider.CreateInstance(itemToMimeConverter2);
                 this.itemEncodingOptions = itemToMimeConverter2.GetItemMimeEncodingOptions(this.options);
             }
         }
         disposeGuard.Success();
     }
 }
コード例 #5
0
        private void SetBlockedList(MailboxJunkEmailConfiguration o, JunkEmailRule rule)
        {
            MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationTuple junkEmailValidationTuple = this.SetList(o.BlockedSendersAndDomains, rule.BlockedSenderEmailCollection, rule.BlockedSenderDomainCollection);
            LocalizedString localizedString = LocalizedString.Empty;

            switch (junkEmailValidationTuple.Problem)
            {
            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsUsersEmailOrDomain:
                localizedString = ServerStrings.JunkEmailBlockedListOwnersEmailAddressException(junkEmailValidationTuple.Address);
                goto IL_C7;

            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsInternalToOrganization:
                localizedString = ServerStrings.JunkEmailBlockedListInternalToOrganizationException(junkEmailValidationTuple.Address);
                goto IL_C7;

            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsDuplicate:
                localizedString = ServerStrings.JunkEmailBlockedListXsoDuplicateException(junkEmailValidationTuple.Address);
                goto IL_C7;

            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsEmpty:
                localizedString = ServerStrings.JunkEmailBlockedListXsoEmptyException;
                goto IL_C7;

            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsMalformatted:
                localizedString = ServerStrings.JunkEmailBlockedListXsoFormatException(junkEmailValidationTuple.Address);
                goto IL_C7;

            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsNull:
                localizedString = ServerStrings.JunkEmailBlockedListXsoNullException;
                goto IL_C7;

            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsTooBig:
                localizedString = ServerStrings.JunkEmailBlockedListXsoTooBigException(junkEmailValidationTuple.Address);
                goto IL_C7;

            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsFull:
                localizedString = ServerStrings.JunkEmailBlockedListXsoTooManyException;
                goto IL_C7;

            case MailboxJunkEmailConfigurationDataProvider.JunkEmailValidationProblem.IsGood:
                goto IL_C7;
            }
            localizedString = ServerStrings.JunkEmailBlockedListXsoGenericException(junkEmailValidationTuple.Address);
IL_C7:
            if (localizedString != LocalizedString.Empty)
            {
                PropertyValidationError propertyValidationError = new PropertyValidationError(localizedString, MailboxJunkEmailConfigurationSchema.BlockedSendersAndDomains, o.BlockedSendersAndDomains);
                throw new PropertyValidationException(localizedString.ToString(), propertyValidationError.PropertyDefinition, new PropertyValidationError[]
                {
                    propertyValidationError
                });
            }
        }
コード例 #6
0
 protected override void SetValidatedStoreProperty(StorePropertyDefinition propertyDefinition, object propertyValue)
 {
     if (propertyDefinition == null)
     {
         throw new ArgumentNullException(ServerStrings.ExNullParameter("propertyDefinition", 1));
     }
     if (propertyValue == null)
     {
         throw new ArgumentNullException(ServerStrings.ExNullParameter("propertyValue", 2));
     }
     this.InternalSetValidatedStoreProperty(propertyDefinition, propertyValue);
 }
コード例 #7
0
 public override PropertyConstraintViolationError Validate(object value, PropertyDefinition propertyDefinition, IPropertyBag propertyBag)
 {
     if (value != null)
     {
         ClientSupportedLanguage value2 = ((ClientSupportedLanguage?)value).Value;
         if (!ClientLanguageConstraint.IsSupportedCulture(CultureInfo.GetCultureInfo((int)value2)))
         {
             return(new PropertyConstraintViolationError(ServerStrings.ErrorNotSupportedLanguageWithInstalledLanguagePack(value.ToString()), propertyDefinition, value, this));
         }
     }
     return(null);
 }
コード例 #8
0
        private IConversationTreeNode GetEquivalentNodeFromConversationTree(StoreObjectId itemId)
        {
            IConversationTreeNode result = null;

            if (!this.conversationTree.TryGetConversationTreeNode(itemId, out result))
            {
                LocalizedString localizedString = ServerStrings.ExItemNotFoundInConversation(itemId, this.conversationTree.RootMessageNode.ConversationId);
                ExTraceGlobals.ConversationTracer.TraceError((long)this.GetHashCode(), localizedString);
                throw new ObjectNotFoundException(localizedString);
            }
            return(result);
        }
コード例 #9
0
ファイル: AclHelper.cs プロジェクト: YHZX2013/exchange_diff
        private static bool ResolveRecipientParametersFromLegacyDN(string legacyDN, StoreSession session, IRecipientSession recipientSession, out SecurityIdentifier securityIdentifier, out List <SecurityIdentifier> sidHistory, out bool isGroup, out string displayName)
        {
            securityIdentifier = null;
            sidHistory         = null;
            isGroup            = false;
            displayName        = string.Empty;
            if (legacyDN == string.Empty)
            {
                securityIdentifier = AclHelper.everyoneSecurityIdentifier;
                return(true);
            }
            if (string.Compare(legacyDN, "Anonymous", StringComparison.OrdinalIgnoreCase) == 0)
            {
                securityIdentifier = AclHelper.anonymousSecurityIdentifier;
                displayName        = "Anonymous";
                return(true);
            }
            MiniRecipient[] array = recipientSession.FindMiniRecipient(null, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, MiniRecipientSchema.LegacyExchangeDN, legacyDN), null, 2, Array <PropertyDefinition> .Empty);
            if (array == null || array.Length == 0)
            {
                return(false);
            }
            if (array.Length > 1)
            {
                throw new NonUniqueLegacyExchangeDNException(ServerStrings.ErrorNonUniqueLegacyDN(legacyDN));
            }
            SecurityIdentifier masterAccountSid = array[0].MasterAccountSid;

            if (masterAccountSid != null && !masterAccountSid.IsWellKnown(WellKnownSidType.SelfSid))
            {
                securityIdentifier = masterAccountSid;
            }
            else
            {
                securityIdentifier = array[0].Sid;
                MultiValuedProperty <SecurityIdentifier> sidHistory2 = array[0].SidHistory;
                if (sidHistory2 != null && sidHistory2.Count != 0)
                {
                    sidHistory = new List <SecurityIdentifier>(sidHistory2);
                }
            }
            if (securityIdentifier == null)
            {
                throw new CorruptDataException(ServerStrings.UserSidNotFound(legacyDN));
            }
            isGroup = AclHelper.IsGroupRecipientType(array[0].RecipientType);
            if (!AclHelper.IsNTUserLegacyDN(legacyDN, session.InternalPreferedCulture, securityIdentifier, out displayName))
            {
                displayName = array[0].DisplayName;
            }
            return(true);
        }
コード例 #10
0
        // Token: 0x06000FCE RID: 4046 RVA: 0x000409D0 File Offset: 0x0003EBD0
        private static List <RecipientInfoCacheEntry> Deserialize(Stream stream, string parentNodeName, out int backendCacheVersion)
        {
            backendCacheVersion = 0;
            List <RecipientInfoCacheEntry> result;

            using (XmlReader xmlReader = XmlReader.Create(stream, new XmlReaderSettings
            {
                CloseInput = false,
                CheckCharacters = false,
                IgnoreWhitespace = false
            }))
            {
                List <RecipientInfoCacheEntry> list = new List <RecipientInfoCacheEntry>(100);
                try
                {
                    if (xmlReader.Read())
                    {
                        if (!string.Equals(xmlReader.Name, parentNodeName, StringComparison.OrdinalIgnoreCase))
                        {
                            throw new CorruptDataException(ServerStrings.InvalidTagName(parentNodeName, xmlReader.Name));
                        }
                        if (xmlReader.HasAttributes)
                        {
                            string s = xmlReader["version"];
                            if (!int.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out backendCacheVersion))
                            {
                                throw new CorruptDataException(ServerStrings.VersionNotInteger);
                            }
                            if (backendCacheVersion < 3)
                            {
                                return(new List <RecipientInfoCacheEntry>(0));
                            }
                        }
                        while (xmlReader.Read() && (xmlReader.NodeType != XmlNodeType.EndElement || !string.Equals(parentNodeName, xmlReader.Name, StringComparison.OrdinalIgnoreCase)))
                        {
                            list.Add(RecipientInfoCacheEntry.ParseEntry(xmlReader));
                        }
                        if (xmlReader.Read())
                        {
                            throw new CorruptDataException(ServerStrings.UnexpectedTag(xmlReader.Name));
                        }
                    }
                }
                catch (XmlException ex)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug <string>(0L, "RecipientInfoCache.Deserialize: Failed. Exception: {0}", ex.Message);
                    throw new CorruptDataException(ServerStrings.InvalidXml, ex);
                }
                result = list;
            }
            return(result);
        }
コード例 #11
0
        public static OutlookSearchFolder Create(MailboxSession session, string displayName)
        {
            StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.SearchFolders);

            if (defaultFolderId == null)
            {
                throw new ObjectNotFoundException(ServerStrings.ExDefaultFolderNotFound(DefaultFolderType.SearchFolders));
            }
            OutlookSearchFolder outlookSearchFolder = (OutlookSearchFolder)Folder.Create(session, defaultFolderId, StoreObjectType.OutlookSearchFolder, displayName, CreateMode.CreateNew);

            outlookSearchFolder[InternalSchema.OutlookSearchFolderClsId] = Guid.NewGuid();
            return(outlookSearchFolder);
        }
コード例 #12
0
 private void CheckOpenBodyStreamForRead()
 {
     if (this.bodyWriteStream != null && !this.bodyWriteStream.IsDisposed())
     {
         throw new NoSupportException(ServerStrings.ExTooManyObjects("BodyConversionStream", 1, 1));
     }
     if (this.bodyReadStreams.Count > 0)
     {
         this.bodyReadStreams = (from x in this.bodyReadStreams
                                 where x != null && !x.IsDisposed()
                                 select x).ToList <Body.IBodyStream>();
     }
 }
コード例 #13
0
        internal StoreObjectId CreateDefaultSystemFolder()
        {
            DefaultFolder defaultFolder = this.GetDefaultFolder(DefaultFolderType.System);

            defaultFolder.Create();
            StoreObjectId result;

            if (!defaultFolder.TryGetFolderId(out result))
            {
                throw new AccessDeniedException(ServerStrings.DefaultFolderAccessDenied(defaultFolder.ToString()));
            }
            return(result);
        }
コード例 #14
0
        private bool PromoteProperties()
        {
            this.HandleFloatingTime();
            CalendarMethod method = base.Context.Method;

            foreach (CalendarPropertyBase calendarPropertyBase in base.ICalProperties)
            {
                SchemaInfo schemaInfo;
                if (VTodo.conversionSchema.TryGetValue(calendarPropertyBase.CalendarPropertyId.Key, out schemaInfo) && schemaInfo.PromotionMethod != null)
                {
                    if ((method & schemaInfo.Methods) != method)
                    {
                        continue;
                    }
                    object promotionMethod = schemaInfo.PromotionMethod;
                    PromoteTaskPropertyDelegate promoteTaskPropertyDelegate = promotionMethod as PromoteTaskPropertyDelegate;
                    try
                    {
                        if (promoteTaskPropertyDelegate != null)
                        {
                            if (!promoteTaskPropertyDelegate(this, calendarPropertyBase))
                            {
                                string propertyName = calendarPropertyBase.CalendarPropertyId.PropertyName;
                                ExTraceGlobals.ICalTracer.TraceError <string>((long)this.GetHashCode(), "VTodo::PromoteProperties. Failed to promote property. Property:'{1}'.", propertyName);
                                base.Context.AddError(ServerStrings.InvalidICalElement(propertyName));
                                return(false);
                            }
                        }
                        else
                        {
                            PropertyDefinition propertyDefinition = (PropertyDefinition)promotionMethod;
                            base.SetProperty(propertyDefinition, calendarPropertyBase.Value);
                        }
                        continue;
                    }
                    catch (ArgumentException)
                    {
                        if (calendarPropertyBase.ValueType == CalendarValueType.DateTime || calendarPropertyBase.ValueType == CalendarValueType.Date)
                        {
                            string propertyName2 = calendarPropertyBase.CalendarPropertyId.PropertyName;
                            ExTraceGlobals.ICalTracer.TraceError <string>((long)this.GetHashCode(), "VTodo::PromoteProperties. Failed to promote data time property. Property:'{1}'.", propertyName2);
                            base.Context.AddError(ServerStrings.InvalidICalElement(propertyName2));
                            return(false);
                        }
                        throw;
                    }
                }
                ExTraceGlobals.ICalTracer.TraceDebug <CalendarPropertyId>((long)this.GetHashCode(), "VTodo::PromoteProperties. There is no method to promote property: {0}", calendarPropertyBase.CalendarPropertyId);
            }
            return(true);
        }
コード例 #15
0
        public static void Execute()
        {
            var collection = new List <MinimalPackage>();
            var pack       = new PackageRepository();


            foreach (var item in pack.GetAllElements())
            {
                if (!item.RawMetaData.Contains("http://192.168.0.10:5000", StringComparison.CurrentCulture))
                {
                    collection.Add(item);
                }
            }

            foreach (var item in collection)
            {
                var jsonObjPreFix = JObject.Parse(item.RawMetaData);
                var latestVersion = jsonObjPreFix["dist-tags"].First.First.ToString().Replace("{", "", StringComparison.CurrentCulture).Replace("}", "", StringComparison.CurrentCulture);
                //The following code is ment to download the tgz so we can serve it from our own repository, but there's some issues with race conditions...
                var dist = jsonObjPreFix["versions"][latestVersion]["dist"]["tarball"].ToString();
                _ = DownloadLocalCopyOfPackage(dist);
                var input    = ReplaceDownloadURL(item.RawMetaData);
                var jsonObj  = JObject.Parse(input);
                var stringfu = JsonConvert.SerializeObject(jsonObj);
                if (stringfu.Length >= 5 * 1024 * 1024)
                {
                    Debug.WriteLine("Size greater than 5MB");
#pragma warning disable CA1303 // Do not pass literals as localized parameters
                    throw new Exception(message: _exMessage);
                    return;

#pragma warning restore CA1303 // Do not pass literals as localized parameters
                }
                var packageVersions  = jsonObj["versions"].ToString();
                var connectionString = ServerStrings.GetMySQLConnectionString();
                using (var conn = new MySqlConnection(connectionString))
                {
                    var result = conn.Execute("INSERT INTO Packages (_ID,RawMetaData,Versions,IsFromPublicRepo) " +
                                              "VALUES (@name,@rawMetaData,@versions,1) ON DUPLICATE KEY UPDATE " +
                                              "RawMetaData = @rawMetaDataOne, Versions = @versionsOne",
                                              new
                    {
                        name           = item._ID,
                        rawMetaData    = stringfu,
                        versions       = packageVersions,
                        rawMetaDataOne = stringfu,
                        versionsOne    = packageVersions
                    });
                }
            }
        }
コード例 #16
0
        private static LocalizedString GenerateOldFashionedReportBody(MessageItem message, out CultureInfo culture)
        {
            message.Load(ReportMessageSchema.Instance.AutoloadProperties);
            ExDateTime?  valueAsNullable = message.GetValueAsNullable <ExDateTime>(InternalSchema.ReportTime);
            ExTimeZone   exTimeZone      = ExTimeZone.CurrentTimeZone;
            StoreSession session         = message.Session;

            if (session != null)
            {
                exTimeZone = session.ExTimeZone;
            }
            byte[]     valueOrDefault = message.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionStart);
            ExTimeZone exTimeZone2;

            if (valueOrDefault != null && O12TimeZoneFormatter.TryParseTruncatedTimeZoneBlob(valueOrDefault, out exTimeZone2))
            {
                exTimeZone = (TimeZoneHelper.PromoteCustomizedTimeZone(exTimeZone2) ?? exTimeZone2);
            }
            culture = ReportMessage.GetMdnCulture(message.CoreItem);
            LocalizedString originalMessageInfo = ReportMessage.GetOriginalMessageInfo(message, exTimeZone, culture);
            LocalizedString result;

            if (ObjectClass.IsReport(message.ClassName, "IPNRN"))
            {
                if (valueAsNullable != null)
                {
                    result = ClientStrings.MdnRead(originalMessageInfo, exTimeZone.ConvertDateTime(valueAsNullable.Value), new LocalizedString(exTimeZone.LocalizableDisplayName.ToString(culture)));
                }
                else
                {
                    result = ClientStrings.MdnReadNoTime(originalMessageInfo);
                }
            }
            else
            {
                if (!ObjectClass.IsReport(message.ClassName, "IPNNRN"))
                {
                    ExTraceGlobals.StorageTracer.TraceDebug((long)message.GetHashCode(), ServerStrings.UnsupportedReportType(message.ClassName));
                    return(new LocalizedString(ServerStrings.UnsupportedReportType(message.ClassName)));
                }
                if (valueAsNullable != null)
                {
                    result = ClientStrings.MdnNotRead(originalMessageInfo, exTimeZone.ConvertDateTime(valueAsNullable.Value), new LocalizedString(exTimeZone.LocalizableDisplayName.ToString(culture)));
                }
                else
                {
                    result = ClientStrings.MdnNotReadNoTime(originalMessageInfo);
                }
            }
            return(result);
        }
コード例 #17
0
 internal static byte[][] StoreIdsToEntryIds(params StoreId[] itemIds)
 {
     byte[][] array = new byte[itemIds.Length][];
     for (int i = 0; i < itemIds.Length; i++)
     {
         if (itemIds[i] == null)
         {
             ExTraceGlobals.StorageTracer.TraceError(0L, "ItemId::ItemIdsToEntryIds. The in itemId cannot be null.");
             throw new ArgumentException(ServerStrings.ExNullItemIdParameter(i));
         }
         array[i] = StoreId.StoreIdToEntryId(itemIds[i], i);
     }
     return(array);
 }
コード例 #18
0
        public int CompareTo(StorePropertyDefinition other)
        {
            if (other == null)
            {
                throw new ArgumentException(ServerStrings.ObjectMustBeOfType(base.GetType().Name));
            }
            int num = string.Compare(this.GetHashString(), other.GetHashString(), StringComparison.OrdinalIgnoreCase);

            if (num != 0)
            {
                return(num);
            }
            return(string.Compare(base.Type.ToString(), other.Type.ToString(), StringComparison.OrdinalIgnoreCase));
        }
コード例 #19
0
        private static Exception MapToReportableException(Exception exception)
        {
            if (exception is PublicFolderSyncTransientException || exception is PublicFolderSyncPermanentException)
            {
                return(exception);
            }
            LocalizedString message = ServerStrings.PublicFolderSyncFolderHierarchyFailed(CommonUtils.FullExceptionMessage(exception, true));

            if (CommonUtils.IsTransientException(exception))
            {
                return(new PublicFolderSyncTransientException(message));
            }
            return(new PublicFolderSyncPermanentException(message));
        }
コード例 #20
0
        private long StoreIdToIdHash(StoreObjectId id)
        {
            long midFromMessageId = this.session.IdConverter.GetMidFromMessageId(id);

            try
            {
                this.hashToIdMap.Add(midFromMessageId, id);
            }
            catch (ArgumentException)
            {
                throw new StoragePermanentException(ServerStrings.ConversationContainsDuplicateMids(this.session.MailboxOwner.LegacyDn, midFromMessageId));
            }
            return(midFromMessageId);
        }
コード例 #21
0
        public NativeStorePropertyDefinition[] GetPropertyDefinitionsIgnoreTypeChecking(StoreSession session, ICorePropertyBag corePropertyBag, uint[] propertyTags)
        {
            Util.ThrowOnNullArgument(session, "session");
            Util.ThrowOnNullArgument(corePropertyBag, "corePropertyBag");
            Util.ThrowOnNullArgument(propertyTags, "propertyTags");
            NativeStorePropertyDefinition[] result = null;
            uint num;

            if (!this.TryGetPropertyDefinitionsFromPropertyTags(session, corePropertyBag, propertyTags, NativeStorePropertyDefinition.TypeCheckingFlag.DisableTypeCheck, out result, out num))
            {
                throw new ResolvePropertyDefinitionException(num, ServerStrings.CannotResolvePropertyTagsToPropertyDefinitions(num));
            }
            return(result);
        }
コード例 #22
0
        private bool ParseProperties(CalendarReader calReader)
        {
            CalendarPropertyReader propertyReader = calReader.PropertyReader;

            while (propertyReader.ReadNextProperty())
            {
                if (!this.ParseProperty(propertyReader) && !string.IsNullOrEmpty(propertyReader.Name))
                {
                    this.Context.AddError(ServerStrings.InvalidICalElement(propertyReader.Name));
                    return(false);
                }
            }
            return(true);
        }
コード例 #23
0
 public ParticipantEntryId.LTEntryId ReadLTEntryId()
 {
     ParticipantEntryId.LTEntryId result = default(ParticipantEntryId.LTEntryId);
     result.ABFlags   = this.ReadUInt32();
     result.StoreGuid = this.ReadGuid();
     if (this.BytesRemaining != 4)
     {
         result.Eit       = this.ReadUInt16();
         result.FolderId  = this.ReadLTId();
         result.MessageId = this.ReadLTId();
         return(result);
     }
     throw new NotSupportedException(ServerStrings.ExUnsupportedABProvider("PST", string.Empty));
 }
コード例 #24
0
        internal StoreObjectId CreateDefaultFolder(DefaultFolderType defaultFolderType)
        {
            EnumValidator.ThrowIfInvalid <DefaultFolderType>(defaultFolderType, DefaultFolderManager.validFolderTypesForCreateDefaultFolder);
            DefaultFolder defaultFolder = this.GetDefaultFolder(defaultFolderType);

            defaultFolder.Create();
            StoreObjectId result;

            if (!defaultFolder.TryGetFolderId(out result))
            {
                throw new AccessDeniedException(ServerStrings.DefaultFolderAccessDenied(defaultFolder.ToString()));
            }
            return(result);
        }
コード例 #25
0
        internal static QueryFilter NativeIdFilterToSmartIdFilter(QueryFilter filter, SmartPropertyDefinition smartProperty, PropertyDefinition nativeProperty)
        {
            ComparisonFilter comparisonFilter = filter as ComparisonFilter;

            if (comparisonFilter == null || !comparisonFilter.Property.Equals(nativeProperty))
            {
                return(null);
            }
            if (comparisonFilter.ComparisonOperator != ComparisonOperator.Equal && comparisonFilter.ComparisonOperator != ComparisonOperator.NotEqual)
            {
                throw new CorruptDataException(ServerStrings.ExComparisonOperatorNotSupportedForProperty(comparisonFilter.ComparisonOperator.ToString(), smartProperty.Name));
            }
            return(new ComparisonFilter(comparisonFilter.ComparisonOperator, smartProperty, StoreObjectId.FromProviderSpecificId((byte[])comparisonFilter.PropertyValue, StoreObjectType.Unknown)));
        }
コード例 #26
0
        public static PublicUrl Create(string externalUrl, SharingDataType dataType, SmtpAddress smtpAddress, string folderName, SharingAnonymousIdentityCollection sharingAnonymousIdentities)
        {
            Util.ThrowOnNullOrEmptyArgument(externalUrl, "externalUrl");
            Util.ThrowOnNullArgument(dataType, "dataType");
            Util.ThrowOnNullOrEmptyArgument(dataType.ExternalName, "dataType.ExternalName");
            Util.ThrowOnNullOrEmptyArgument(folderName, "folderName");
            string text = string.Join(string.Empty, folderName.Split(".*$&+,/:;=?@\"\\<>#%{}|\\^~[]`".ToCharArray()));

            if (string.IsNullOrEmpty(text))
            {
                text = "MyCalendar";
            }
            text = text.Replace(" ", "_");
            if (sharingAnonymousIdentities != null)
            {
                string text2 = text;
                int    num   = 0;
                for (;;)
                {
                    string urlId = PublicUrl.CalculateIdentity(dataType, text2);
                    if (!sharingAnonymousIdentities.Contains(urlId))
                    {
                        goto IL_CD;
                    }
                    if (++num > 50)
                    {
                        break;
                    }
                    ExTraceGlobals.SharingTracer.TraceDebug <string, int>(0L, "PublicUrl.Create(): {0} has been used in Sharing Anonymous Identities - Appending post fix: {1}.", text, num);
                    text2 = string.Format("{0}({1})", text, num);
                }
                throw new CannotShareFolderException(ServerStrings.ExTooManyObjects("PublicUrl", num, 50));
IL_CD:
                text = text2;
            }
            string uriString = string.Format("{0}/{1}/{2}/{3}/{1}", new object[]
            {
                externalUrl.TrimEnd(new char[]
                {
                    '/'
                }),
                dataType.ExternalName,
                smtpAddress.ToString(),
                text
            });
            PublicUrl publicUrl = new PublicUrl(new Uri(uriString, UriKind.Absolute), dataType, smtpAddress, text);

            ExTraceGlobals.SharingTracer.TraceDebug <PublicUrl, string>(0L, "PublicUrl.Create(): Created an instance of PublicUrl: {0} - {1}.", publicUrl, publicUrl.TraceInfo);
            return(publicUrl);
        }
コード例 #27
0
        public bool Validate(DefaultFolderContext context, PropertyBag propertyBag)
        {
            ELCFolderFlags?valueAsNullable = propertyBag.GetValueAsNullable <ELCFolderFlags>(InternalSchema.AdminFolderFlags);

            if (valueAsNullable != null && valueAsNullable.Value == this.adminFolderFlags)
            {
                return(true);
            }
            if (valueAsNullable == null && this.adminFolderFlags == ELCFolderFlags.DumpsterFolder)
            {
                throw new DefaultFolderPropertyValidationException(ServerStrings.PropertyErrorString("AdminFolderFlags", PropertyErrorCode.NotFound, this.adminFolderFlags.ToString()));
            }
            return(false);
        }
コード例 #28
0
        private static Notification ValidateNotNullAndCastArgument(IConfigurable argument, string argumentName)
        {
            if (argument == null)
            {
                throw new ArgumentNullException(argumentName);
            }
            Notification result = argument as Notification;

            if (argument == null)
            {
                throw new ArgumentException(ServerStrings.ObjectMustBeOfType(typeof(Notification).ToString()));
            }
            return(result);
        }
コード例 #29
0
        public static SharingPolicy ReadSharingPolicy(Guid mailboxGuid, bool isArchive, IRecipientSession recipientSession)
        {
            ADRecipient adrecipient = DirectoryHelper.ReadADRecipient(mailboxGuid, isArchive, recipientSession);

            if (adrecipient == null)
            {
                throw new ObjectNotFoundException(ServerStrings.ADUserNotFound);
            }
            ADUser aduser = adrecipient as ADUser;

            if (aduser == null)
            {
                ExTraceGlobals.StorageTracer.TraceError <ADRecipient>((long)mailboxGuid.GetHashCode(), "ExchangePrincipal::ReadSharingPolicy. This is not an ADUser so policy doesn't apply. Recipient = {0}.", adrecipient);
                return(null);
            }
            ADObjectId        adobjectId = aduser.SharingPolicy;
            ADSessionSettings adsessionSettings;

            if (SharedConfiguration.IsDehydratedConfiguration(aduser.OrganizationId))
            {
                SharedConfiguration sharedConfiguration = SharedConfiguration.GetSharedConfiguration(aduser.OrganizationId);
                adsessionSettings = sharedConfiguration.GetSharedConfigurationSessionSettings();
            }
            else
            {
                adsessionSettings = aduser.OrganizationId.ToADSessionSettings();
                adsessionSettings.IsSharedConfigChecked = true;
            }
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, adsessionSettings, 248, "ReadSharingPolicy", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\DirectoryHelper.cs");

            if (adobjectId == null)
            {
                FederatedOrganizationId federatedOrganizationId = tenantOrTopologyConfigurationSession.GetFederatedOrganizationId(tenantOrTopologyConfigurationSession.SessionSettings.CurrentOrganizationId);
                if (federatedOrganizationId != null)
                {
                    adobjectId = federatedOrganizationId.DefaultSharingPolicyLink;
                }
            }
            SharingPolicy sharingPolicy = null;

            if (adobjectId != null)
            {
                sharingPolicy = tenantOrTopologyConfigurationSession.Read <SharingPolicy>(adobjectId);
                if (sharingPolicy == null)
                {
                    throw new ObjectNotFoundException(ServerStrings.SharingPolicyNotFound(adobjectId.Name));
                }
            }
            return(sharingPolicy);
        }
コード例 #30
0
 public static Type GetTypeInstance(string category, Version version)
 {
     if (string.IsNullOrEmpty(category))
     {
         throw new CustomSerializationException(ServerStrings.ErrorInvalidConfigurationXml, new ArgumentNullException("category"));
     }
     if (null == version)
     {
         new CustomSerializationException(ServerStrings.ErrorUnsupportedConfigurationXmlCategory(category), new ArgumentNullException("version"));
     }
     category = category.Trim();
     if (string.Equals("TextMessagingSettings", category, StringComparison.Ordinal))
     {
         int major = version.Major;
         if (major != 1)
         {
             throw new CustomSerializationException(ServerStrings.ErrorUnsupportedConfigurationXmlVersion(category, version.ToString(2)));
         }
         if (0 <= version.Minor)
         {
             return(typeof(TextMessagingSettingsVersion1Point0));
         }
     }
     else if (string.Equals("CalendarNotificationSettings", category, StringComparison.Ordinal))
     {
         int major2 = version.Major;
         if (major2 != 1)
         {
             throw new CustomSerializationException(ServerStrings.ErrorUnsupportedConfigurationXmlVersion(category, version.ToString(2)));
         }
         if (0 <= version.Minor)
         {
             return(typeof(CalendarNotificationSettingsVersion1Point0));
         }
     }
     else if (string.Equals("CalendarNotificationContent", category, StringComparison.Ordinal))
     {
         int major3 = version.Major;
         if (major3 != 1)
         {
             throw new CustomSerializationException(ServerStrings.ErrorUnsupportedConfigurationXmlVersion(category, version.ToString(2)));
         }
         if (0 <= version.Minor)
         {
             return(typeof(CalendarNotificationContentVersion1Point0));
         }
     }
     throw new CustomSerializationException(ServerStrings.ErrorUnsupportedConfigurationXmlCategory(category));
 }