Esempio n. 1
0
 private bool HasSecurityDescriptor(SecurityProp secProp)
 {
     if (secProp != SecurityProp.NTSD && this.mailbox.IsTitanium)
     {
         return(false);
     }
     if (secProp == SecurityProp.FreeBusyNTSD)
     {
         PropTag[] propList;
         using (this.Mailbox.RHTracker.Start())
         {
             propList = this.Folder.GetPropList();
         }
         bool flag = false;
         foreach (PropTag propTag in propList)
         {
             if (propTag == PropTag.FreeBusyNTSD)
             {
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             return(false);
         }
     }
     return(true);
 }
        void IDestinationFolder.SetACL(SecurityProp secProp, PropValueData[][] aclData)
        {
            if (base.Mailbox.ServerVersion >= Server.E15MinVersion)
            {
                MrsTracer.Provider.Warning("MAPI provider does not support SetACL against E15+ mailboxes", new object[0]);
                return;
            }
            PropValueData[][] acl       = ((IFolder)this).GetACL(secProp);
            FolderACL         folderACL = new FolderACL(aclData);

            RowEntry[] array = folderACL.UpdateExisting(acl);
            if (array == null)
            {
                MrsTracer.Provider.Debug("Folder ACL is unchanged.", new object[0]);
                return;
            }
            MrsTracer.Provider.Debug("Applying {0} updates to the folder ACL.", new object[]
            {
                array.Length
            });
            ModifyTableFlags modifyTableFlags = ModifyTableFlags.None;

            if (secProp == SecurityProp.FreeBusyNTSD)
            {
                modifyTableFlags |= ModifyTableFlags.FreeBusy;
            }
            using (base.Mailbox.RHTracker.Start())
            {
                using (MapiModifyTable mapiModifyTable = (MapiModifyTable)base.Folder.OpenProperty(PropTag.AclTable, InterfaceIds.IExchangeModifyTable, 0, OpenPropertyFlags.DeferredErrors))
                {
                    mapiModifyTable.ModifyTable(modifyTableFlags, array);
                }
            }
        }
        PropProblemData[] IDestinationFolder.SetSecurityDescriptor(SecurityProp secProp, RawSecurityDescriptor sd)
        {
            MrsTracer.Provider.Function("StorageDestinationFolder.SetSecurityDescriptor: {0}, is null: {1}", new object[]
            {
                base.DisplayNameForTracing,
                sd == null
            });
            if (sd == null)
            {
                return(null);
            }
            using (base.Mailbox.RHTracker.Start())
            {
                switch (secProp)
                {
                case SecurityProp.NTSD:
                    AclModifyTable.SetFolderSecurityDescriptor(base.CoreFolder, sd);
                    goto IL_7B;

                case SecurityProp.FreeBusyNTSD:
                    AclModifyTable.SetFolderFreeBusySecurityDescriptor(base.CoreFolder, sd);
                    goto IL_7B;
                }
                throw new UnknownSecurityPropException((int)secProp);
IL_7B:
                base.CoreFolder.Save(SaveMode.FailOnAnyConflict);
                base.CoreFolder.PropertyBag.Load(FolderSchema.Instance.AutoloadProperties);
            }
            return(Array <PropProblemData> .Empty);
        }
 void IDestinationFolder.SetACL(SecurityProp secProp, PropValueData[][] aclData)
 {
     if (!base.ServerVersion[8])
     {
         throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IDestinationFolder_SetACL");
     }
     base.MrsProxy.IDestinationFolder_SetACL(base.Handle, (int)secProp, aclData);
 }
Esempio n. 5
0
 void IDestinationFolder.SetACL(SecurityProp secProp, PropValueData[][] aclData)
 {
     base.CreateContext("IDestinationFolder.SetACL", new DataContext[]
     {
         new SimpleValueDataContext("SecProp", secProp),
         new PropValuesDataContext(aclData)
     }).Execute(delegate
     {
         ((IDestinationFolder)this.WrappedObject).SetACL(secProp, aclData);
     }, true);
 }
Esempio n. 6
0
 PropValueData[][] IFolder.GetACL(SecurityProp secProp)
 {
     PropValueData[][] result = null;
     base.CreateContext("IFolder.GetACL", new DataContext[]
     {
         new SimpleValueDataContext("SecProp", secProp)
     }).Execute(delegate
     {
         result = this.WrappedObject.GetACL(secProp);
     }, true);
     return(result);
 }
Esempio n. 7
0
 PropValueData[][] IFolder.GetACL(SecurityProp secProp)
 {
     MrsTracer.ProxyClient.Function("IFolder.GetACL(): {0}", new object[]
     {
         this.FolderName
     });
     if (!base.ServerVersion[8])
     {
         throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IFolder_GetACL");
     }
     return(base.MrsProxy.IFolder_GetACL(base.Handle, (int)secProp));
 }
Esempio n. 8
0
 PropProblemData[] IDestinationFolder.SetSecurityDescriptor(SecurityProp secProp, RawSecurityDescriptor sd)
 {
     PropProblemData[] result = null;
     base.CreateContext("IDestinationFolder.SetSecurityDescriptor", new DataContext[]
     {
         new SimpleValueDataContext("SecProp", secProp),
         new SimpleValueDataContext("SD", CommonUtils.GetSDDLString(sd))
     }).Execute(delegate
     {
         result = ((IDestinationFolder)this.WrappedObject).SetSecurityDescriptor(secProp, sd);
     }, true);
     return(result);
 }
Esempio n. 9
0
 RawSecurityDescriptor IFolder.GetSecurityDescriptor(SecurityProp secProp)
 {
     MrsTracer.ProxyClient.Function("IFolder.GetSecurityDescriptor(): {0}", new object[]
     {
         this.FolderName
     });
     byte[] array = base.MrsProxy.IFolder_GetSecurityDescriptor(base.Handle, (int)secProp);
     if (array == null)
     {
         return(null);
     }
     return(new RawSecurityDescriptor(array, 0));
 }
 PropProblemData[] IDestinationFolder.SetSecurityDescriptor(SecurityProp secProp, RawSecurityDescriptor sd)
 {
     if (sd == null || (secProp != SecurityProp.NTSD && base.Mailbox.IsTitanium))
     {
         return(null);
     }
     PropProblem[] a;
     using (base.Mailbox.RHTracker.Start())
     {
         a = base.Folder.SetSecurityDescriptor(secProp, sd);
     }
     return(DataConverter <PropProblemConverter, PropProblem, PropProblemData> .GetData(a));
 }
Esempio n. 11
0
        RawSecurityDescriptor IFolder.GetSecurityDescriptor(SecurityProp secProp)
        {
            RawSecurityDescriptor result = null;

            base.CreateContext("IFolder.GetSecurityDescriptor", new DataContext[]
            {
                new SimpleValueDataContext("SecProp", secProp)
            }).Execute(delegate
            {
                result = this.WrappedObject.GetSecurityDescriptor(secProp);
            }, true);
            return(result);
        }
Esempio n. 12
0
        PropValueData[][] IFolder.GetACL(SecurityProp secProp)
        {
            MrsTracer.Provider.Function("StorageFolder.GetACL: {0}", new object[]
            {
                this.DisplayNameForTracing
            });
            if (!this.HasSecurityDescriptor(secProp))
            {
                return(null);
            }
            ModifyTableOptions options = (secProp == SecurityProp.FreeBusyNTSD) ? ModifyTableOptions.FreeBusyAware : ModifyTableOptions.None;

            return(this.GetAcl(options, StorageFolder.AclTableColumns));
        }
 PropProblemData[] IDestinationFolder.SetSecurityDescriptor(SecurityProp secProp, RawSecurityDescriptor sd)
 {
     byte[] array;
     if (sd != null)
     {
         array = new byte[sd.BinaryLength];
         sd.GetBinaryForm(array, 0);
     }
     else
     {
         array = null;
     }
     return(base.MrsProxy.IDestinationFolder_SetSecurityDescriptor(base.Handle, (int)secProp, array));
 }
Esempio n. 14
0
        RawSecurityDescriptor IFolder.GetSecurityDescriptor(SecurityProp secProp)
        {
            MrsTracer.Provider.Function("MapiFolder.GetSecurityDescriptor", new object[0]);
            if (!this.HasSecurityDescriptor(secProp))
            {
                return(null);
            }
            RawSecurityDescriptor securityDescriptor;

            using (this.Mailbox.RHTracker.Start())
            {
                securityDescriptor = this.Folder.GetSecurityDescriptor(secProp);
            }
            return(securityDescriptor);
        }
Esempio n. 15
0
 PropValueData[][] IFolder.GetACL(SecurityProp secProp)
 {
     if (!this.HasSecurityDescriptor(secProp))
     {
         return(null);
     }
     if (this.Mailbox.ServerVersion >= Server.E15MinVersion)
     {
         MrsTracer.Provider.Warning("MAPI provider does not support GetACL against E15+ mailboxes", new object[0]);
         return(null);
     }
     PropValueData[][] result;
     using (this.Mailbox.RHTracker.Start())
     {
         using (MapiModifyTable mapiModifyTable = (MapiModifyTable)this.Folder.OpenProperty(PropTag.AclTable, InterfaceIds.IExchangeModifyTable, 0, OpenPropertyFlags.DeferredErrors))
         {
             GetTableFlags getTableFlags = GetTableFlags.DeferredErrors;
             if (secProp == SecurityProp.FreeBusyNTSD)
             {
                 getTableFlags |= GetTableFlags.FreeBusy;
             }
             using (MapiTable table = mapiModifyTable.GetTable(getTableFlags))
             {
                 PropTag[] propTags = new PropTag[]
                 {
                     PropTag.EntryId,
                     PropTag.MemberId,
                     PropTag.MemberRights,
                     PropTag.MemberName
                 };
                 table.SeekRow(BookMark.Beginning, 0);
                 PropValue[][]     array  = MapiUtils.QueryAllRows(table, null, propTags);
                 PropValueData[][] array2 = new PropValueData[array.Length][];
                 int num = 0;
                 foreach (PropValue[] a in array)
                 {
                     array2[num++] = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(a);
                 }
                 result = array2;
             }
         }
     }
     return(result);
 }
Esempio n. 16
0
        RawSecurityDescriptor IFolder.GetSecurityDescriptor(SecurityProp secProp)
        {
            MrsTracer.Provider.Function("StorageFolder.GetSecurityDescriptor: {0}", new object[]
            {
                this.DisplayNameForTracing
            });
            if (!this.HasSecurityDescriptor(secProp))
            {
                return(null);
            }
            PropertyDefinition propertyDefinitionFromSecurityProp = this.GetPropertyDefinitionFromSecurityProp(secProp);

            this.CoreFolder.PropertyBag.Load(new PropertyDefinition[]
            {
                propertyDefinitionFromSecurityProp
            });
            object obj = this.CoreFolder.PropertyBag[propertyDefinitionFromSecurityProp];

            if (obj == null || obj is PropertyError)
            {
                return(null);
            }
            return((RawSecurityDescriptor)obj);
        }
Esempio n. 17
0
 private RawSecurityDescriptor ReadSD(IFolder folder, SecurityProp secProp, Action <List <BadMessageRec> > reportBadItemsDelegate, Func <byte[], IFolder> openFolderDelegate)
 {
     return(this.ReadFolderData <RawSecurityDescriptor>(() => folder.GetSecurityDescriptor(secProp), reportBadItemsDelegate, openFolderDelegate));
 }
        void IDestinationFolder.SetACL(SecurityProp secProp, PropValueData[][] aclData)
        {
            MrsTracer.Provider.Function("StorageDestinationFolder.SetACL: {0}, isNullAcl: {1}", new object[]
            {
                base.DisplayNameForTracing,
                aclData == null
            });
            if (aclData == null)
            {
                return;
            }
            ModifyTableOptions options = (secProp == SecurityProp.FreeBusyNTSD) ? ModifyTableOptions.FreeBusyAware : ModifyTableOptions.None;

            using (IModifyTable permissionTable = base.CoreFolder.GetPermissionTable(options))
            {
                permissionTable.Clear();
                foreach (PropValueData[] array in aclData)
                {
                    long?        num          = null;
                    byte[]       array2       = null;
                    MemberRights memberRights = MemberRights.None;
                    foreach (PropValueData propValueData in array)
                    {
                        int propTag = propValueData.PropTag;
                        if (propTag != 268370178)
                        {
                            if (propTag != 1718681620)
                            {
                                if (propTag == 1718812675)
                                {
                                    memberRights = (MemberRights)propValueData.Value;
                                }
                            }
                            else
                            {
                                num = new long?((long)propValueData.Value);
                            }
                        }
                        else
                        {
                            array2 = (byte[])propValueData.Value;
                        }
                    }
                    PropValue[] array3 = new PropValue[2];
                    array3[0] = new PropValue(PermissionSchema.MemberRights, memberRights);
                    if (num != null && (num.Value == 0L || num.Value == -1L))
                    {
                        array3[1] = new PropValue(PermissionSchema.MemberId, num);
                        permissionTable.ModifyRow(array3);
                    }
                    else if (array2 != null)
                    {
                        array3[1] = new PropValue(PermissionSchema.MemberEntryId, array2);
                        permissionTable.AddRow(array3);
                    }
                }
                using (base.Mailbox.RHTracker.Start())
                {
                    permissionTable.ApplyPendingChanges();
                }
            }
        }
Esempio n. 19
0
 void IDestinationFolder.SetACL(SecurityProp secProp, PropValueData[][] aclData)
 {
     throw new NotImplementedException();
 }
Esempio n. 20
0
 PropProblemData[] IDestinationFolder.SetSecurityDescriptor(SecurityProp secProp, RawSecurityDescriptor sd)
 {
     throw new NotImplementedException();
 }
Esempio n. 21
0
 private PropValueData[][] ReadACL(IFolder folder, SecurityProp secProp, Action <List <BadMessageRec> > reportBadItemsDelegate, Func <byte[], IFolder> openFolderDelegate)
 {
     return(this.ReadFolderData <PropValueData[][]>(() => folder.GetACL(secProp), reportBadItemsDelegate, openFolderDelegate));
 }
Esempio n. 22
0
 RawSecurityDescriptor IFolder.GetSecurityDescriptor(SecurityProp secProp)
 {
     return(null);
 }
Esempio n. 23
0
 PropValueData[][] IFolder.GetACL(SecurityProp secProp)
 {
     throw new NotImplementedException();
 }
Esempio n. 24
0
 RawSecurityDescriptor IFolder.GetSecurityDescriptor(SecurityProp secProp)
 {
     throw new NotImplementedException();
 }