// lazy dev.
        private void LoadingExamples(ShirtVariation currentContent)
        {
            // some of this is / will be in Find
            //currentContent.LoadEntry(CatalogEntryResponseGroup.ResponseGroup.)

            ContentReference parent = currentContent.ParentLink; //...from "me" as the variation
            IEnumerable <EntryContentBase> nodeChildren = base._contentLoader.GetChildren <EntryContentBase>(parent);

            IEnumerable <ContentReference> allLinks = currentContent.GetCategories();

            IEnumerable <Relation> nodes = currentContent.GetNodeRelations();

            var theType = currentContent.GetOriginalType(); // handy

            var proxy = currentContent.GetType();

            IEnumerable <ContentReference> prodParents = currentContent.GetParentProducts();

            IEnumerable <ContentReference> parentPackages = currentContent.GetParentPackages();

            IMarket market    = _currentMarketService.GetCurrentMarket();
            bool    available = currentContent.IsAvailableInMarket(market.MarketId); // if we want to know about another market

            bool available2 = currentContent.IsAvailableInCurrentMarket();

            ISecurityDescriptor sec = currentContent.GetSecurityDescriptor();

            // CatalogContext.Current.GetCatalogEntriesDto()

            //currentContent.LoadEntryDt
        }
        //friendly shotrcut helper method
        public static bool HasAccess <T>(this ISecurityDescriptor sd, T right) where T : struct, IConvertible
        {
            if (!sd.Results.ContainsRightType(right))
            {
                sd.Results.InitResult(right);
            }

            return(sd.Results[right.GetFriendlyRightTypeName()][Convert.ToInt32(right)].AccessAllowed);
        }
        private void ParseSecurityDescriptor(NtProcess process, long address)
        {
            SecurityDescriptorHeader header = process.ReadMemory <SecurityDescriptorHeader>(address);

            if (header.Revision != 1)
            {
                throw new NtException(NtStatus.STATUS_INVALID_SECURITY_DESCR);
            }
            Revision = header.Revision;
            Control  = header.Control & ~SecurityDescriptorControl.SelfRelative;

            ISecurityDescriptor sd = null;

            if (header.HasFlag(SecurityDescriptorControl.SelfRelative))
            {
                sd = process.ReadMemory <SecurityDescriptorRelative>(address);
            }
            else if (process.Is64Bit)
            {
                sd = process.ReadMemory <SecurityDescriptorAbsolute>(address);
            }
            else
            {
                sd = process.ReadMemory <SecurityDescriptorAbsolute32>(address);
            }

            Owner = ReadSid(process, sd.GetOwner(address), header.HasFlag(SecurityDescriptorControl.OwnerDefaulted));
            Group = ReadSid(process, sd.GetGroup(address), header.HasFlag(SecurityDescriptorControl.GroupDefaulted));
            if (header.HasFlag(SecurityDescriptorControl.DaclPresent))
            {
                Dacl = ReadAcl(process, sd.GetDacl(address), header.HasFlag(SecurityDescriptorControl.DaclDefaulted));
            }
            if (header.HasFlag(SecurityDescriptorControl.SaclPresent))
            {
                Sacl = ReadAcl(process, sd.GetSacl(address), header.HasFlag(SecurityDescriptorControl.SaclDefaulted));
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of <see cref="SecurityDescriptorBuilder"/>
 /// </summary>
 /// <param name="descriptor">The <see cref="ISecurityDescriptor"/> we are building</param>
 public SecurityDescriptorBuilder(ISecurityDescriptor descriptor)
 {
     Descriptor = descriptor;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of <see cref="SecurityDescriptorBuilder"/>
 /// </summary>
 /// <param name="descriptor">The <see cref="ISecurityDescriptor"/> we are building</param>
 public SecurityDescriptorBuilder(ISecurityDescriptor descriptor)
 {
     Descriptor = descriptor;
 }
Exemplo n.º 6
0
        private static string ReadSecurityDescriptorFromAddress(SafeProcessHandle process, IntPtr address)
        {
            SecurityDescriptorHeader header = process.ReadStruct <SecurityDescriptorHeader>(address);

            if (header.Revision != 1)
            {
                return(String.Empty);
            }

            ISecurityDescriptor sd = null;

            if (header.HasFlag(SecurityDescriptorControl.SelfRelative))
            {
                sd = process.ReadStruct <SecurityDescriptorRelative>(address);
            }
            else if (process.Is64Bit)
            {
                sd = process.ReadStruct <SecurityDescriptorAbsolute>(address);
            }
            else
            {
                sd = process.ReadStruct <SecurityDescriptorAbsolute32>(address);
            }

            SecurityDescriptorAbsolute new_sd = new SecurityDescriptorAbsolute();

            new_sd.Header         = header;
            new_sd.Header.Control = header.Control & ~SecurityDescriptorControl.SelfRelative;
            List <SafeBuffer> buffers = new List <SafeBuffer>();

            try
            {
                if (!header.HasFlag(SecurityDescriptorControl.OwnerDefaulted))
                {
                    SafeBuffer buf = ReadSid(process, sd.GetOwner(address));
                    if (buf != null)
                    {
                        buffers.Add(buf);
                        new_sd.Owner = buf.DangerousGetHandle();
                    }
                }
                if (!header.HasFlag(SecurityDescriptorControl.OwnerDefaulted))
                {
                    SafeBuffer buf = ReadSid(process, sd.GetGroup(address));
                    if (buf != null)
                    {
                        buffers.Add(buf);
                        new_sd.Group = buf.DangerousGetHandle();
                    }
                }
                if (header.HasFlag(SecurityDescriptorControl.DaclPresent))
                {
                    SafeBuffer buf = ReadAcl(process, sd.GetDacl(address));
                    if (buf != null)
                    {
                        buffers.Add(buf);
                        new_sd.Dacl = buf.DangerousGetHandle();
                    }
                }
                if (header.HasFlag(SecurityDescriptorControl.SaclPresent))
                {
                    SafeBuffer buf = ReadAcl(process, sd.GetSacl(address));
                    if (buf != null)
                    {
                        buffers.Add(buf);
                        new_sd.Sacl = buf.DangerousGetHandle();
                    }
                }

                IntPtr str;
                int    length;
                if (ConvertSecurityDescriptorToStringSecurityDescriptor(ref new_sd, SDDL_REVISION_1,
                                                                        SecurityInformation.All, out str, out length))
                {
                    string ret = Marshal.PtrToStringUni(str);
                    LocalFree(str);
                    return(ret);
                }
            }
            finally
            {
                foreach (SafeBuffer buf in buffers)
                {
                    buf.Close();
                }
            }

            return(String.Empty);
        }
 public static void Eval(this ISecurityDescriptor sd)
 {
     sd.Dacl.Eval(sd.Results);
     sd.Sacl.Eval(sd.Results);
 }
 public static void Clear(this ISecurityDescriptor sd)
 {
     sd.Dacl.Clear();
     sd.Sacl.Clear();
     sd.Results.Clear();
 }
 public static void CopyTo(this ISecurityDescriptor sd, ISecurityDescriptor targetSecurityDescriptor, bool forceInheritance = false)
 {
     sd.Dacl.CopyTo(targetSecurityDescriptor.Dacl, forceInheritance);
     sd.Sacl.CopyTo(targetSecurityDescriptor.Sacl, forceInheritance);
 }
 public static void Eval <T>(this ISecurityDescriptor sd) where T : struct, IConvertible
 {
     sd.Dacl.Eval <T>(sd.Results);
     sd.Sacl.Eval <T>(sd.Results);
 }
 public static void Eval(this ISecurityDescriptor sd, Type rightType)
 {
     sd.Dacl.Eval(rightType, sd.Results);
     sd.Sacl.Eval(rightType, sd.Results);
 }