예제 #1
0
 public UnicodeString(Rpc.Unicode_string rus, bool zterm)
 {
     Length        = rus.Length;
     MaximumLength = rus.MaximumLength;
     Buffer        = rus.Buffer;
     this.Zterm    = zterm;
 }
예제 #2
0
파일: Lsarpc.cs 프로젝트: zxz2020/Emby
            /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
            public override void Decode(NdrBuffer src)
            {
                src.Align(4);
                Length = src.Dec_ndr_long();
                int rootDirectoryp = src.Dec_ndr_long();
                int objectNamep    = src.Dec_ndr_long();

                Attributes         = src.Dec_ndr_long();
                SecurityDescriptor = src.Dec_ndr_long();
                int securityQualityOfServicep = src.Dec_ndr_long();

                if (rootDirectoryp != 0)
                {
                    src = src.Deferred;
                    RootDirectory.Decode(src);
                }
                if (objectNamep != 0)
                {
                    if (ObjectName == null)
                    {
                        ObjectName = new Rpc.Unicode_string();
                    }
                    src = src.Deferred;
                    ObjectName.Decode(src);
                }
                if (securityQualityOfServicep != 0)
                {
                    if (SecurityQualityOfService == null)
                    {
                        SecurityQualityOfService = new LsarQosInfo();
                    }
                    src = src.Deferred;
                    SecurityQualityOfService.Decode(src);
                }
            }
예제 #3
0
        /// <exception cref="System.IO.IOException"></exception>
        internal static void ResolveSids(DcerpcHandle handle, LsaPolicyHandle policyHandle
                                         , Sid[] sids)
        {
            MsrpcLookupSids rpc = new MsrpcLookupSids(policyHandle, sids);

            handle.Sendrecv(rpc);
            switch (rpc.Retval)
            {
            case 0:
            case NtStatus.NtStatusNoneMapped:
            case unchecked (0x00000107):
            {
                // NT_STATUS_SOME_NOT_MAPPED
                break;
            }

            default:
            {
                throw new SmbException(rpc.Retval, false);
            }
            }
            for (int si = 0; si < sids.Length; si++)
            {
                sids[si].Type       = rpc.Names.Names[si].SidType;
                sids[si].DomainName = null;
                switch (sids[si].Type)
                {
                case SidTypeUser:
                case SidTypeDomGrp:
                case SidTypeDomain:
                case SidTypeAlias:
                case SidTypeWknGrp:
                {
                    int sidIndex            = rpc.Names.Names[si].SidIndex;
                    Rpc.Unicode_string ustr = rpc.Domains.Domains[sidIndex].Name;
                    sids[si].DomainName = (new UnicodeString(ustr, false)).ToString();
                    break;
                }
                }
                sids[si].AcctName = (new UnicodeString(rpc.Names.Names[si].Name, false)).ToString
                                        ();
                sids[si].OriginServer = null;
                sids[si].OriginAuth   = null;
            }
        }
예제 #4
0
파일: Lsarpc.cs 프로젝트: zxz2020/Emby
            /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
            public override void Decode(NdrBuffer src)
            {
                src.Align(4);
                src.Align(4);
                if (Name == null)
                {
                    Name = new Rpc.Unicode_string();
                }
                Name.Length        = (short)src.Dec_ndr_short();
                Name.MaximumLength = (short)src.Dec_ndr_short();
                int nameBufferp = src.Dec_ndr_long();
                int sidp        = src.Dec_ndr_long();

                if (nameBufferp != 0)
                {
                    src = src.Deferred;
                    int nameBuffers = src.Dec_ndr_long();
                    src.Dec_ndr_long();
                    int nameBufferl = src.Dec_ndr_long();
                    int nameBufferi = src.Index;
                    src.Advance(2 * nameBufferl);
                    if (Name.Buffer == null)
                    {
                        if (nameBuffers < 0 || nameBuffers > unchecked (0xFFFF))
                        {
                            throw new NdrException(NdrException.InvalidConformance);
                        }
                        Name.Buffer = new short[nameBuffers];
                    }
                    src = src.Derive(nameBufferi);
                    for (int i = 0; i < nameBufferl; i++)
                    {
                        Name.Buffer[i] = (short)src.Dec_ndr_short();
                    }
                }
                if (sidp != 0)
                {
                    if (Sid == null)
                    {
                        Sid = new Rpc.SidT();
                    }
                    src = src.Deferred;
                    Sid.Decode(src);
                }
            }
예제 #5
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Idx = src.Dec_ndr_long();
				src.Align(4);
				if (Name == null)
				{
					Name = new Rpc.Unicode_string();
				}
				Name.Length = (short)src.Dec_ndr_short();
				Name.MaximumLength = (short)src.Dec_ndr_short();
				int nameBufferp = src.Dec_ndr_long();
				if (nameBufferp != 0)
				{
					src = src.Deferred;
					int nameBuffers = src.Dec_ndr_long();
					src.Dec_ndr_long();
					int nameBufferl = src.Dec_ndr_long();
					int nameBufferi = src.Index;
					src.Advance(2 * nameBufferl);
					if (Name.Buffer == null)
					{
						if (nameBuffers < 0 || nameBuffers > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Name.Buffer = new short[nameBuffers];
					}
					src = src.Derive(nameBufferi);
					for (int i = 0; i < nameBufferl; i++)
					{
						Name.Buffer[i] = (short)src.Dec_ndr_short();
					}
				}
			}
예제 #6
0
파일: Lsarpc.cs 프로젝트: zxz2020/Emby
            /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
            public override void Decode(NdrBuffer src)
            {
                src.Align(4);
                src.Align(4);
                if (Name == null)
                {
                    Name = new Rpc.Unicode_string();
                }
                Name.Length        = (short)src.Dec_ndr_short();
                Name.MaximumLength = (short)src.Dec_ndr_short();
                int nameBufferp = src.Dec_ndr_long();

                src.Align(4);
                if (DnsDomain == null)
                {
                    DnsDomain = new Rpc.Unicode_string();
                }
                DnsDomain.Length        = (short)src.Dec_ndr_short();
                DnsDomain.MaximumLength = (short)src.Dec_ndr_short();
                int dnsDomainBufferp = src.Dec_ndr_long();

                src.Align(4);
                if (DnsForest == null)
                {
                    DnsForest = new Rpc.Unicode_string();
                }
                DnsForest.Length        = (short)src.Dec_ndr_short();
                DnsForest.MaximumLength = (short)src.Dec_ndr_short();
                int dnsForestBufferp = src.Dec_ndr_long();

                src.Align(4);
                if (DomainGuid == null)
                {
                    DomainGuid = new Rpc.UuidT();
                }
                DomainGuid.TimeLow               = src.Dec_ndr_long();
                DomainGuid.TimeMid               = (short)src.Dec_ndr_short();
                DomainGuid.TimeHiAndVersion      = (short)src.Dec_ndr_short();
                DomainGuid.ClockSeqHiAndReserved = unchecked ((byte)src.Dec_ndr_small());
                DomainGuid.ClockSeqLow           = unchecked ((byte)src.Dec_ndr_small());
                int domainGuidNodes = 6;
                int domainGuidNodei = src.Index;

                src.Advance(1 * domainGuidNodes);
                int sidp = src.Dec_ndr_long();

                if (nameBufferp != 0)
                {
                    src = src.Deferred;
                    int nameBuffers = src.Dec_ndr_long();
                    src.Dec_ndr_long();
                    int nameBufferl = src.Dec_ndr_long();
                    int nameBufferi = src.Index;
                    src.Advance(2 * nameBufferl);
                    if (Name.Buffer == null)
                    {
                        if (nameBuffers < 0 || nameBuffers > unchecked (0xFFFF))
                        {
                            throw new NdrException(NdrException.InvalidConformance);
                        }
                        Name.Buffer = new short[nameBuffers];
                    }
                    src = src.Derive(nameBufferi);
                    for (int i = 0; i < nameBufferl; i++)
                    {
                        Name.Buffer[i] = (short)src.Dec_ndr_short();
                    }
                }
                if (dnsDomainBufferp != 0)
                {
                    src = src.Deferred;
                    int dnsDomainBuffers = src.Dec_ndr_long();
                    src.Dec_ndr_long();
                    int dnsDomainBufferl = src.Dec_ndr_long();
                    int dnsDomainBufferi = src.Index;
                    src.Advance(2 * dnsDomainBufferl);
                    if (DnsDomain.Buffer == null)
                    {
                        if (dnsDomainBuffers < 0 || dnsDomainBuffers > unchecked (0xFFFF))
                        {
                            throw new NdrException(NdrException.InvalidConformance);
                        }
                        DnsDomain.Buffer = new short[dnsDomainBuffers];
                    }
                    src = src.Derive(dnsDomainBufferi);
                    for (int i = 0; i < dnsDomainBufferl; i++)
                    {
                        DnsDomain.Buffer[i] = (short)src.Dec_ndr_short();
                    }
                }
                if (dnsForestBufferp != 0)
                {
                    src = src.Deferred;
                    int dnsForestBuffers = src.Dec_ndr_long();
                    src.Dec_ndr_long();
                    int dnsForestBufferl = src.Dec_ndr_long();
                    int dnsForestBufferi = src.Index;
                    src.Advance(2 * dnsForestBufferl);
                    if (DnsForest.Buffer == null)
                    {
                        if (dnsForestBuffers < 0 || dnsForestBuffers > unchecked (0xFFFF))
                        {
                            throw new NdrException(NdrException.InvalidConformance);
                        }
                        DnsForest.Buffer = new short[dnsForestBuffers];
                    }
                    src = src.Derive(dnsForestBufferi);
                    for (int i = 0; i < dnsForestBufferl; i++)
                    {
                        DnsForest.Buffer[i] = (short)src.Dec_ndr_short();
                    }
                }
                if (DomainGuid.Node == null)
                {
                    if (domainGuidNodes < 0 || domainGuidNodes > unchecked (0xFFFF))
                    {
                        throw new NdrException(NdrException.InvalidConformance);
                    }
                    DomainGuid.Node = new byte[domainGuidNodes];
                }
                src = src.Derive(domainGuidNodei);
                for (int i1 = 0; i1 < domainGuidNodes; i1++)
                {
                    DomainGuid.Node[i1] = unchecked ((byte)src.Dec_ndr_small());
                }
                if (sidp != 0)
                {
                    if (Sid == null)
                    {
                        Sid = new Rpc.SidT();
                    }
                    src = src.Deferred;
                    Sid.Decode(src);
                }
            }
예제 #7
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				src.Align(4);
				if (Name == null)
				{
					Name = new Rpc.Unicode_string();
				}
				Name.Length = (short)src.Dec_ndr_short();
				Name.MaximumLength = (short)src.Dec_ndr_short();
				int nameBufferp = src.Dec_ndr_long();
				src.Align(4);
				if (DnsDomain == null)
				{
					DnsDomain = new Rpc.Unicode_string();
				}
				DnsDomain.Length = (short)src.Dec_ndr_short();
				DnsDomain.MaximumLength = (short)src.Dec_ndr_short();
				int dnsDomainBufferp = src.Dec_ndr_long();
				src.Align(4);
				if (DnsForest == null)
				{
					DnsForest = new Rpc.Unicode_string();
				}
				DnsForest.Length = (short)src.Dec_ndr_short();
				DnsForest.MaximumLength = (short)src.Dec_ndr_short();
				int dnsForestBufferp = src.Dec_ndr_long();
				src.Align(4);
				if (DomainGuid == null)
				{
					DomainGuid = new Rpc.UuidT();
				}
				DomainGuid.TimeLow = src.Dec_ndr_long();
				DomainGuid.TimeMid = (short)src.Dec_ndr_short();
				DomainGuid.TimeHiAndVersion = (short)src.Dec_ndr_short();
				DomainGuid.ClockSeqHiAndReserved = unchecked((byte)src.Dec_ndr_small());
				DomainGuid.ClockSeqLow = unchecked((byte)src.Dec_ndr_small());
				int domainGuidNodes = 6;
				int domainGuidNodei = src.Index;
				src.Advance(1 * domainGuidNodes);
				int sidp = src.Dec_ndr_long();
				if (nameBufferp != 0)
				{
					src = src.Deferred;
					int nameBuffers = src.Dec_ndr_long();
					src.Dec_ndr_long();
					int nameBufferl = src.Dec_ndr_long();
					int nameBufferi = src.Index;
					src.Advance(2 * nameBufferl);
					if (Name.Buffer == null)
					{
						if (nameBuffers < 0 || nameBuffers > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Name.Buffer = new short[nameBuffers];
					}
					src = src.Derive(nameBufferi);
					for (int i = 0; i < nameBufferl; i++)
					{
						Name.Buffer[i] = (short)src.Dec_ndr_short();
					}
				}
				if (dnsDomainBufferp != 0)
				{
					src = src.Deferred;
					int dnsDomainBuffers = src.Dec_ndr_long();
					src.Dec_ndr_long();
					int dnsDomainBufferl = src.Dec_ndr_long();
					int dnsDomainBufferi = src.Index;
					src.Advance(2 * dnsDomainBufferl);
					if (DnsDomain.Buffer == null)
					{
						if (dnsDomainBuffers < 0 || dnsDomainBuffers > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						DnsDomain.Buffer = new short[dnsDomainBuffers];
					}
					src = src.Derive(dnsDomainBufferi);
					for (int i = 0; i < dnsDomainBufferl; i++)
					{
						DnsDomain.Buffer[i] = (short)src.Dec_ndr_short();
					}
				}
				if (dnsForestBufferp != 0)
				{
					src = src.Deferred;
					int dnsForestBuffers = src.Dec_ndr_long();
					src.Dec_ndr_long();
					int dnsForestBufferl = src.Dec_ndr_long();
					int dnsForestBufferi = src.Index;
					src.Advance(2 * dnsForestBufferl);
					if (DnsForest.Buffer == null)
					{
						if (dnsForestBuffers < 0 || dnsForestBuffers > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						DnsForest.Buffer = new short[dnsForestBuffers];
					}
					src = src.Derive(dnsForestBufferi);
					for (int i = 0; i < dnsForestBufferl; i++)
					{
						DnsForest.Buffer[i] = (short)src.Dec_ndr_short();
					}
				}
				if (DomainGuid.Node == null)
				{
					if (domainGuidNodes < 0 || domainGuidNodes > unchecked(0xFFFF))
					{
						throw new NdrException(NdrException.InvalidConformance);
					}
					DomainGuid.Node = new byte[domainGuidNodes];
				}
				src = src.Derive(domainGuidNodei);
				for (int i1 = 0; i1 < domainGuidNodes; i1++)
				{
					DomainGuid.Node[i1] = unchecked((byte)src.Dec_ndr_small());
				}
				if (sidp != 0)
				{
					if (Sid == null)
					{
						Sid = new Rpc.SidT();
					}
					src = src.Deferred;
					Sid.Decode(src);
				}
			}
예제 #8
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Length = src.Dec_ndr_long();
				int rootDirectoryp = src.Dec_ndr_long();
				int objectNamep = src.Dec_ndr_long();
				Attributes = src.Dec_ndr_long();
				SecurityDescriptor = src.Dec_ndr_long();
				int securityQualityOfServicep = src.Dec_ndr_long();
				if (rootDirectoryp != 0)
				{
					src = src.Deferred;
					RootDirectory.Decode(src);
				}
				if (objectNamep != 0)
				{
					if (ObjectName == null)
					{
						ObjectName = new Rpc.Unicode_string();
					}
					src = src.Deferred;
					ObjectName.Decode(src);
				}
				if (securityQualityOfServicep != 0)
				{
					if (SecurityQualityOfService == null)
					{
						SecurityQualityOfService = new LsarQosInfo();
					}
					src = src.Deferred;
					SecurityQualityOfService.Decode(src);
				}
			}