void IDestinationFolder.SetExtendedAcl(AclFlags aclFlags, PropValueData[][] aclData)
 {
     if (!base.ServerVersion[51])
     {
         throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IDestinationFolder_SetExtendedAcl");
     }
     base.MrsProxy.IDestinationFolder_SetExtendedAcl(base.Handle, (int)aclFlags, aclData);
 }
Пример #2
0
        /// <summary>
        /// Creates an Access Control List from the DACL or SACL portion of an SDDL string
        /// </summary>
        /// <param name="aclString">The ACL String</param>
        public AccessControlListEx(string aclString)
        {
            this.aceList = new List <AccessControlEntryEx>();

            Regex aclRegex = new Regex(cAclExpr, RegexOptions.IgnoreCase);

            Match aclMatch = aclRegex.Match(aclString);

            if (!aclMatch.Success)
            {
                throw new FormatException("Invalid ACL String Format");
            }

            if (aclMatch.Groups["flags"] != null && aclMatch.Groups["flags"].Success && !String.IsNullOrEmpty(aclMatch.Groups["flags"].Value))
            {
                string flagString = aclMatch.Groups["flags"].Value.ToUpper();
                for (Int32 i = 0; i < flagString.Length; i++)
                {
                    if (flagString[i] == 'P')
                    {
                        this.flags = this.flags | AclFlags.Protected;
                    }
                    else if (flagString.Length - i >= 2)
                    {
                        switch (flagString.Substring(i, 2))
                        {
                        case "AR":
                            this.flags = this.flags | AclFlags.MustInherit;
                            i++;
                            break;

                        case "AI":
                            this.flags = this.flags | AclFlags.Inherited;
                            i++;
                            break;

                        default:
                            throw new FormatException("Invalid ACL String Format");
                        }
                    }
                    else
                    {
                        throw new FormatException("Invalid ACL String Format");
                    }
                }
            }

            if (aclMatch.Groups["ace_list"] != null && aclMatch.Groups["ace_list"].Success && !String.IsNullOrEmpty(aclMatch.Groups["ace_list"].Value))
            {
                Regex aceListRegex = new Regex(cAceListExpr);

                foreach (Match aceMatch in aceListRegex.Matches(aclMatch.Groups["ace_list"].Value))
                {
                    this.Add(new AccessControlEntryEx(aceMatch.Groups["ace"].Value));
                }
            }
        }
Пример #3
0
        /// <summary>
        ///     Creates a deep copy of an exusting Access Control List
        /// </summary>
        /// <param name="original"></param>
        public AccessControlList(AccessControlList original)
        {
            this.aceList = new List <AccessControlEntry>();
            this.flags   = original.flags;

            foreach (AccessControlEntry ace in original)
            {
                this.Add(new AccessControlEntry(ace));
            }
        }
        /// <summary>
        /// Creates a deep copy of an exusting Access Control List
        /// </summary>
        /// <param name="original"></param>
        public AccessControlList(AccessControlList original)
        {
            aceList = new List <AccessControlEntry>();
            flags   = original.flags;

            foreach (var ace in original)
            {
                Add(new AccessControlEntry(ace));
            }
        }
Пример #5
0
 void IDestinationFolder.SetExtendedAcl(AclFlags aclFlags, PropValueData[][] aclData)
 {
     base.CreateContext("IDestinationFolder.SetExtendedAcl", new DataContext[]
     {
         new SimpleValueDataContext("AclFlags", aclFlags),
         new PropValuesDataContext(aclData)
     }).Execute(delegate
     {
         ((IDestinationFolder)this.WrappedObject).SetExtendedAcl(aclFlags, aclData);
     }, true);
 }
Пример #6
0
 PropValueData[][] IFolder.GetExtendedAcl(AclFlags aclFlags)
 {
     PropValueData[][] result = null;
     base.CreateContext("IFolder.GetExtendedAcl", new DataContext[]
     {
         new SimpleValueDataContext("AclFlags", aclFlags)
     }).Execute(delegate
     {
         result = this.WrappedObject.GetExtendedAcl(aclFlags);
     }, true);
     return(result);
 }
Пример #7
0
 PropValueData[][] IFolder.GetExtendedAcl(AclFlags aclFlags)
 {
     MrsTracer.ProxyClient.Function("IFolder.GetExtendedAcl(): {0}", new object[]
     {
         this.FolderName
     });
     if (!base.ServerVersion[51])
     {
         throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IFolder_GetExtendedAcl");
     }
     return(base.MrsProxy.IFolder_GetExtendedAcl(base.Handle, (int)aclFlags));
 }
 void IDestinationFolder.SetExtendedAcl(AclFlags aclFlags, PropValueData[][] aclData)
 {
     MrsTracer.Provider.Function("StorageDestinationFolder.SetExtendedAcl: {0}, flags: {1}, isNullAcl: {2}", new object[]
     {
         base.DisplayNameForTracing,
         aclFlags,
         aclData == null
     });
     using (base.Mailbox.RHTracker.Start())
     {
         new FolderAcl(aclFlags, aclData).Apply(base.CoreFolder);
     }
 }
Пример #9
0
        PropValueData[][] IFolder.GetExtendedAcl(AclFlags aclFlags)
        {
            MrsTracer.Provider.Function("StorageFolder.GetExtendedAcl: flags = {0}, {1}", new object[]
            {
                aclFlags,
                this.DisplayNameForTracing
            });
            if (!this.HasSecurityDescriptor(aclFlags))
            {
                return(null);
            }
            ModifyTableOptions modifyTableOptions = aclFlags.HasFlag(AclFlags.FreeBusyAcl) ? ModifyTableOptions.FreeBusyAware : ModifyTableOptions.None;

            modifyTableOptions |= ModifyTableOptions.ExtendedPermissionInformation;
            return(this.GetAcl(modifyTableOptions, StorageFolder.ExtendedAclTableColumns));
        }
Пример #10
0
 private void ExportExtendedAcls(AclFlags extendedAclFlags, ISourceFolder srcFolder, IFolderProxy targetFolder)
 {
     base.VerifyCapability(MRSProxyCapabilities.SetItemProperties, CapabilityCheck.BothMRSAndOtherProvider);
     if (extendedAclFlags.HasFlag(AclFlags.FolderAcl))
     {
         PropValueData[][] extendedAcl = srcFolder.GetExtendedAcl(AclFlags.FolderAcl);
         if (extendedAcl != null)
         {
             targetFolder.SetItemProperties(new FolderAcl(AclFlags.FolderAcl, extendedAcl));
         }
     }
     if (extendedAclFlags.HasFlag(AclFlags.FreeBusyAcl))
     {
         PropValueData[][] extendedAcl2 = srcFolder.GetExtendedAcl(AclFlags.FreeBusyAcl);
         if (extendedAcl2 != null)
         {
             targetFolder.SetItemProperties(new FolderAcl(AclFlags.FreeBusyAcl, extendedAcl2));
         }
     }
 }
 void IDestinationFolder.SetExtendedAcl(AclFlags aclFlags, PropValueData[][] aclData)
 {
     throw new NotImplementedException();
 }
Пример #12
0
 void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
 {
     throw new NotImplementedException();
 }
 public FxProxyPoolSetExtendedAclMessage(AclFlags aclFlags, PropValueData[][] aclData)
 {
     this.aclFlags = aclFlags;
     this.aclData  = aclData;
 }
Пример #14
0
        void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
        {
            MrsTracer.ProxyClient.Function("StorageSourceMailbox.ExportFolders", new object[0]);
            base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None);
            bool exportCompleted = false;

            CommonUtils.ProcessKnownExceptions(delegate
            {
                foreach (byte[] folderEntryId in folderIds)
                {
                    this.ExportSingleFolder(proxyPool, folderEntryId, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps, copyPropertiesFlags, excludeProps, extendedAclFlags);
                }
                exportCompleted = true;
                proxyPool.Flush();
            }, delegate(Exception ex)
            {
                if (!exportCompleted)
                {
                    MrsTracer.Provider.Debug("Flushing target proxy after receiving an exception.", new object[0]);
                    CommonUtils.CatchKnownExceptions(new Action(proxyPool.Flush), null);
                }
                return(false);
            });
        }
Пример #15
0
 private PropValueData[][] ReadExtendedAcl(IFolder folder, AclFlags flags, Action <List <BadMessageRec> > reportBadItemsDelegate, Func <byte[], IFolder> openFolderDelegate)
 {
     return(this.ReadFolderData <PropValueData[][]>(() => folder.GetExtendedAcl(flags), reportBadItemsDelegate, openFolderDelegate));
 }
Пример #16
0
        void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
        {
            string    text           = "ISourceMailbox.ExportFolders";
            TimeSpan  targetDuration = TimeSpan.Zero;
            Stopwatch stopwatch      = Stopwatch.StartNew();

            base.CreateContext(text, new DataContext[]
            {
                new EntryIDsDataContext(folderIds),
                new SimpleValueDataContext("exportFoldersDataToCopyFlags", exportFoldersDataToCopyFlags),
                new SimpleValueDataContext("folderRecFlags", folderRecFlags),
                new PropTagsDataContext(additionalFolderRecProps),
                new SimpleValueDataContext("copyPropertiesFlags", copyPropertiesFlags),
                new PropTagsDataContext(excludeProps),
                new SimpleValueDataContext("extendedAclFlags", extendedAclFlags)
            }).Execute(delegate
            {
                using (FxProxyPoolFxCallbackWrapper fxProxyPoolFxCallbackWrapper = new FxProxyPoolFxCallbackWrapper(proxyPool, true, delegate(TimeSpan duration)
                {
                    targetDuration += duration;
                }))
                {
                    ((ISourceMailbox)this.WrappedObject).ExportFolders(folderIds, fxProxyPoolFxCallbackWrapper, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps, copyPropertiesFlags, excludeProps, extendedAclFlags);
                }
            }, false);
            base.UpdateDuration(text, stopwatch.Elapsed.Subtract(targetDuration));
        }
Пример #17
0
 public void FoldersExport(ISourceMailbox mailbox, List <byte[]> folderIds, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
 {
     this.RunExportThread(delegate
     {
         using (BufferedTransmitter bufferedTransmitter = new BufferedTransmitter(this, this.service.ExportBufferSizeFromMrsKB, false, this.service.UseBufferring, this.service.UseCompression))
         {
             using (AsynchronousTransmitter asynchronousTransmitter = new AsynchronousTransmitter(bufferedTransmitter, false))
             {
                 using (FxProxyPoolTransmitter fxProxyPoolTransmitter = new FxProxyPoolTransmitter(asynchronousTransmitter, false, this.service.ClientVersion))
                 {
                     mailbox.ExportFolders(folderIds, fxProxyPoolTransmitter, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps, copyPropertiesFlags, excludeProps, extendedAclFlags);
                 }
             }
         }
     });
 }
Пример #18
0
 public FolderAcl(AclFlags flags, PropValueData[][] pvda)
 {
     this.Flags = flags;
     this.Value = pvda;
 }
Пример #19
0
 private void ExportSingleFolder(IFxProxyPool proxyPool, byte[] folderEntryId, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludePropertiesFromCopy, AclFlags extendedAclFlags)
 {
     ExecutionContext.Create(new DataContext[]
     {
         new OperationDataContext("StorageSourceMailbox.ExportSingleFolder", OperationType.None),
         new EntryIDsDataContext(folderEntryId),
         new SimpleValueDataContext("exportFoldersDataToCopyFlags", exportFoldersDataToCopyFlags),
         new SimpleValueDataContext("folderRecFlags", folderRecFlags),
         new PropTagsDataContext(additionalFolderRecProps),
         new SimpleValueDataContext("copyPropertiesFlags", copyPropertiesFlags),
         new PropTagsDataContext(excludePropertiesFromCopy),
         new SimpleValueDataContext("extendedAclFlags", extendedAclFlags)
     }).Execute(delegate
     {
         using (this.RHTracker.Start())
         {
             using (ISourceFolder folder = this.GetFolder <StorageSourceFolder>(folderEntryId))
             {
                 if (folder == null)
                 {
                     MrsTracer.Provider.Debug("Folder {0} is missing in source. Skipping.", new object[]
                     {
                         TraceUtils.DumpEntryId(folderEntryId)
                     });
                 }
                 else
                 {
                     using (IFolderProxy folderProxyForExportFolder = StorageSourceMailbox.GetFolderProxyForExportFolder(proxyPool, folder, exportFoldersDataToCopyFlags, folderRecFlags, additionalFolderRecProps))
                     {
                         if (extendedAclFlags != AclFlags.None)
                         {
                             this.ExportExtendedAcls(extendedAclFlags, folder, folderProxyForExportFolder);
                         }
                         using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(folderProxyForExportFolder, false, new Func <IDisposable>(this.RHTracker.StartExclusive), new Action <uint>(this.RHTracker.Charge)))
                         {
                             if (exportFoldersDataToCopyFlags.HasFlag(ExportFoldersDataToCopyFlags.IncludeCopyToStream))
                             {
                                 folder.CopyTo(fxProxyBudgetWrapper, copyPropertiesFlags, excludePropertiesFromCopy);
                             }
                         }
                     }
                 }
             }
         }
     });
 }
Пример #20
0
 PropValueData[][] IFolder.GetExtendedAcl(AclFlags aclFlags)
 {
     throw new NotImplementedException();
 }
Пример #21
0
        void ISourceMailbox.ExportFolders(List <byte[]> folderIds, IFxProxyPool proxyPool, ExportFoldersDataToCopyFlags exportFoldersDataToCopyFlags, GetFolderRecFlags folderRecFlags, PropTag[] additionalFolderRecProps, CopyPropertiesFlags copyPropertiesFlags, PropTag[] excludeProps, AclFlags extendedAclFlags)
        {
            MrsTracer.ProxyClient.Function("RemoteSourceMailbox.ExportFolders", new object[0]);
            base.VerifyMailboxConnection();
            if (!base.ServerVersion[54])
            {
                throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "ISourceMailbox_ExportFolders");
            }
            DataExportBatch dataExportBatch = base.MrsProxy.ISourceMailbox_ExportFolders(base.Handle, folderIds, (int)exportFoldersDataToCopyFlags, (int)folderRecFlags, DataConverter <PropTagConverter, PropTag, int> .GetData(additionalFolderRecProps), (int)copyPropertiesFlags, DataConverter <PropTagConverter, PropTag, int> .GetData(excludeProps), (int)extendedAclFlags);

            using (IDataImport dataImport = new FxProxyPoolReceiver(proxyPool, false))
            {
                using (BufferedReceiver bufferedReceiver = new BufferedReceiver(dataImport, false, base.MrsProxyClient.UseBuffering, base.MrsProxyClient.UseCompression))
                {
                    RemoteDataExport.ExportRoutine(base.MrsProxy, dataExportBatch.DataExportHandle, bufferedReceiver, dataExportBatch, base.MrsProxyClient.UseCompression);
                }
            }
        }