コード例 #1
0
ファイル: SecurityIdentifier.cs プロジェクト: yonder/mono
        public bool IsWellKnown(WellKnownSidType type)
        {
            WellKnownAccount acct = WellKnownAccount.LookupByType(type);

            if (acct == null)
            {
                return(false);
            }

            string sid = Value;

            if (acct.IsAbsolute)
            {
                return(sid == acct.Sid);
            }

            return(sid.StartsWith("S-1-5-21", StringComparison.OrdinalIgnoreCase) &&
                   sid.EndsWith("-" + acct.Rid, StringComparison.OrdinalIgnoreCase));
        }
コード例 #2
0
ファイル: SecurityIdentifier.cs プロジェクト: yonder/mono
        public SecurityIdentifier(WellKnownSidType sidType,
                                  SecurityIdentifier domainSid)
        {
            WellKnownAccount acct = WellKnownAccount.LookupByType(sidType);

            if (acct == null)
            {
                throw new ArgumentException("Unable to convert SID type: " + sidType);
            }

            if (acct.IsAbsolute)
            {
                buffer = ParseSddlForm(acct.Sid);
            }
            else
            {
                if (domainSid == null)
                {
                    throw new ArgumentNullException("domainSid");
                }

                buffer = ParseSddlForm(domainSid.Value + "-" + acct.Rid);
            }
        }