diff options
Diffstat (limited to 'Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc')
21 files changed, 0 insertions, 3707 deletions
diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/LsaPolicyHandle.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/LsaPolicyHandle.cs deleted file mode 100644 index 03964fcc7..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/LsaPolicyHandle.cs +++ /dev/null @@ -1,43 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Smb; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class LsaPolicyHandle : Rpc.PolicyHandle - { - /// <exception cref="System.IO.IOException"></exception> - public LsaPolicyHandle(DcerpcHandle handle, string server, int access) - { - if (server == null) - { - server = "\\\\"; - } - MsrpcLsarOpenPolicy2 rpc = new MsrpcLsarOpenPolicy2(server, access, this); - handle.Sendrecv(rpc); - if (rpc.Retval != 0) - { - throw new SmbException(rpc.Retval, false); - } - } - - /// <exception cref="System.IO.IOException"></exception> - public virtual void Close() - { - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/LsarSidArrayX.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/LsarSidArrayX.cs deleted file mode 100644 index ef09bb16e..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/LsarSidArrayX.cs +++ /dev/null @@ -1,34 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Smb; - -namespace SharpCifs.Dcerpc.Msrpc -{ - internal class LsarSidArrayX : Lsarpc.LsarSidArray - { - internal LsarSidArrayX(Sid[] sids) - { - NumSids = sids.Length; - this.Sids = new Lsarpc.LsarSidPtr[sids.Length]; - for (int si = 0; si < sids.Length; si++) - { - this.Sids[si] = new Lsarpc.LsarSidPtr(); - this.Sids[si].Sid = sids[si]; - } - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Lsarpc.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Lsarpc.cs deleted file mode 100644 index 1ae85c473..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Lsarpc.cs +++ /dev/null @@ -1,1161 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Dcerpc.Ndr; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class Lsarpc - { - public static string GetSyntax() - { - return "12345778-1234-abcd-ef00-0123456789ab:0.0"; - } - - public class LsarQosInfo : NdrObject - { - public int Length; - - public short ImpersonationLevel; - - public byte ContextMode; - - public byte EffectiveOnly; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Length); - dst.Enc_ndr_short(ImpersonationLevel); - dst.Enc_ndr_small(ContextMode); - dst.Enc_ndr_small(EffectiveOnly); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Length = src.Dec_ndr_long(); - ImpersonationLevel = (short)src.Dec_ndr_short(); - ContextMode = unchecked((byte)src.Dec_ndr_small()); - EffectiveOnly = unchecked((byte)src.Dec_ndr_small()); - } - } - - public class LsarObjectAttributes : NdrObject - { - public int Length; - - public NdrSmall RootDirectory; - - public Rpc.Unicode_string ObjectName; - - public int Attributes; - - public int SecurityDescriptor; - - public LsarQosInfo SecurityQualityOfService; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Length); - dst.Enc_ndr_referent(RootDirectory, 1); - dst.Enc_ndr_referent(ObjectName, 1); - dst.Enc_ndr_long(Attributes); - dst.Enc_ndr_long(SecurityDescriptor); - dst.Enc_ndr_referent(SecurityQualityOfService, 1); - if (RootDirectory != null) - { - dst = dst.Deferred; - RootDirectory.Encode(dst); - } - if (ObjectName != null) - { - dst = dst.Deferred; - ObjectName.Encode(dst); - } - if (SecurityQualityOfService != null) - { - dst = dst.Deferred; - SecurityQualityOfService.Encode(dst); - } - } - - /// <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); - } - } - } - - public class LsarDomainInfo : NdrObject - { - public Rpc.Unicode_string Name; - - public Rpc.SidT Sid; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_short(Name.Length); - dst.Enc_ndr_short(Name.MaximumLength); - dst.Enc_ndr_referent(Name.Buffer, 1); - dst.Enc_ndr_referent(Sid, 1); - if (Name.Buffer != null) - { - dst = dst.Deferred; - int nameBufferl = Name.Length / 2; - int nameBuffers = Name.MaximumLength / 2; - dst.Enc_ndr_long(nameBuffers); - dst.Enc_ndr_long(0); - dst.Enc_ndr_long(nameBufferl); - int nameBufferi = dst.Index; - dst.Advance(2 * nameBufferl); - dst = dst.Derive(nameBufferi); - for (int i = 0; i < nameBufferl; i++) - { - dst.Enc_ndr_short(Name.Buffer[i]); - } - } - if (Sid != null) - { - dst = dst.Deferred; - Sid.Encode(dst); - } - } - - /// <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); - } - } - } - - public class LsarDnsDomainInfo : NdrObject - { - public Rpc.Unicode_string Name; - - public Rpc.Unicode_string DnsDomain; - - public Rpc.Unicode_string DnsForest; - - public Rpc.UuidT DomainGuid; - - public Rpc.SidT Sid; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_short(Name.Length); - dst.Enc_ndr_short(Name.MaximumLength); - dst.Enc_ndr_referent(Name.Buffer, 1); - dst.Enc_ndr_short(DnsDomain.Length); - dst.Enc_ndr_short(DnsDomain.MaximumLength); - dst.Enc_ndr_referent(DnsDomain.Buffer, 1); - dst.Enc_ndr_short(DnsForest.Length); - dst.Enc_ndr_short(DnsForest.MaximumLength); - dst.Enc_ndr_referent(DnsForest.Buffer, 1); - dst.Enc_ndr_long(DomainGuid.TimeLow); - dst.Enc_ndr_short(DomainGuid.TimeMid); - dst.Enc_ndr_short(DomainGuid.TimeHiAndVersion); - dst.Enc_ndr_small(DomainGuid.ClockSeqHiAndReserved); - dst.Enc_ndr_small(DomainGuid.ClockSeqLow); - int domainGuidNodes = 6; - int domainGuidNodei = dst.Index; - dst.Advance(1 * domainGuidNodes); - dst.Enc_ndr_referent(Sid, 1); - if (Name.Buffer != null) - { - dst = dst.Deferred; - int nameBufferl = Name.Length / 2; - int nameBuffers = Name.MaximumLength / 2; - dst.Enc_ndr_long(nameBuffers); - dst.Enc_ndr_long(0); - dst.Enc_ndr_long(nameBufferl); - int nameBufferi = dst.Index; - dst.Advance(2 * nameBufferl); - dst = dst.Derive(nameBufferi); - for (int i = 0; i < nameBufferl; i++) - { - dst.Enc_ndr_short(Name.Buffer[i]); - } - } - if (DnsDomain.Buffer != null) - { - dst = dst.Deferred; - int dnsDomainBufferl = DnsDomain.Length / 2; - int dnsDomainBuffers = DnsDomain.MaximumLength / 2; - dst.Enc_ndr_long(dnsDomainBuffers); - dst.Enc_ndr_long(0); - dst.Enc_ndr_long(dnsDomainBufferl); - int dnsDomainBufferi = dst.Index; - dst.Advance(2 * dnsDomainBufferl); - dst = dst.Derive(dnsDomainBufferi); - for (int i = 0; i < dnsDomainBufferl; i++) - { - dst.Enc_ndr_short(DnsDomain.Buffer[i]); - } - } - if (DnsForest.Buffer != null) - { - dst = dst.Deferred; - int dnsForestBufferl = DnsForest.Length / 2; - int dnsForestBuffers = DnsForest.MaximumLength / 2; - dst.Enc_ndr_long(dnsForestBuffers); - dst.Enc_ndr_long(0); - dst.Enc_ndr_long(dnsForestBufferl); - int dnsForestBufferi = dst.Index; - dst.Advance(2 * dnsForestBufferl); - dst = dst.Derive(dnsForestBufferi); - for (int i = 0; i < dnsForestBufferl; i++) - { - dst.Enc_ndr_short(DnsForest.Buffer[i]); - } - } - dst = dst.Derive(domainGuidNodei); - for (int i1 = 0; i1 < domainGuidNodes; i1++) - { - dst.Enc_ndr_small(DomainGuid.Node[i1]); - } - if (Sid != null) - { - dst = dst.Deferred; - Sid.Encode(dst); - } - } - - /// <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); - } - } - } - - public const int PolicyInfoAuditEvents = 2; - - public const int PolicyInfoPrimaryDomain = 3; - - public const int PolicyInfoAccountDomain = 5; - - public const int PolicyInfoServerRole = 6; - - public const int PolicyInfoModification = 9; - - public const int PolicyInfoDnsDomain = 12; - - public class LsarSidPtr : NdrObject - { - public Rpc.SidT Sid; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_referent(Sid, 1); - if (Sid != null) - { - dst = dst.Deferred; - Sid.Encode(dst); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - int sidp = src.Dec_ndr_long(); - if (sidp != 0) - { - if (Sid == null) - { - Sid = new Rpc.SidT(); - } - src = src.Deferred; - Sid.Decode(src); - } - } - } - - public class LsarSidArray : NdrObject - { - public int NumSids; - - public LsarSidPtr[] Sids; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(NumSids); - dst.Enc_ndr_referent(Sids, 1); - if (Sids != null) - { - dst = dst.Deferred; - int sidss = NumSids; - dst.Enc_ndr_long(sidss); - int sidsi = dst.Index; - dst.Advance(4 * sidss); - dst = dst.Derive(sidsi); - for (int i = 0; i < sidss; i++) - { - Sids[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - NumSids = src.Dec_ndr_long(); - int sidsp = src.Dec_ndr_long(); - if (sidsp != 0) - { - src = src.Deferred; - int sidss = src.Dec_ndr_long(); - int sidsi = src.Index; - src.Advance(4 * sidss); - if (Sids == null) - { - if (sidss < 0 || sidss > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Sids = new LsarSidPtr[sidss]; - } - src = src.Derive(sidsi); - for (int i = 0; i < sidss; i++) - { - if (Sids[i] == null) - { - Sids[i] = new LsarSidPtr(); - } - Sids[i].Decode(src); - } - } - } - } - - public const int SidNameUseNone = 0; - - public const int SidNameUser = 1; - - public const int SidNameDomGrp = 2; - - public const int SidNameDomain = 3; - - public const int SidNameAlias = 4; - - public const int SidNameWknGrp = 5; - - public const int SidNameDeleted = 6; - - public const int SidNameInvalid = 7; - - public const int SidNameUnknown = 8; - - public class LsarTranslatedSid : NdrObject - { - public int SidType; - - public int Rid; - - public int SidIndex; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_short(SidType); - dst.Enc_ndr_long(Rid); - dst.Enc_ndr_long(SidIndex); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - SidType = src.Dec_ndr_short(); - Rid = src.Dec_ndr_long(); - SidIndex = src.Dec_ndr_long(); - } - } - - public class LsarTransSidArray : NdrObject - { - public int Count; - - public LsarTranslatedSid[] Sids; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(Sids, 1); - if (Sids != null) - { - dst = dst.Deferred; - int sidss = Count; - dst.Enc_ndr_long(sidss); - int sidsi = dst.Index; - dst.Advance(12 * sidss); - dst = dst.Derive(sidsi); - for (int i = 0; i < sidss; i++) - { - Sids[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int sidsp = src.Dec_ndr_long(); - if (sidsp != 0) - { - src = src.Deferred; - int sidss = src.Dec_ndr_long(); - int sidsi = src.Index; - src.Advance(12 * sidss); - if (Sids == null) - { - if (sidss < 0 || sidss > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Sids = new LsarTranslatedSid[sidss]; - } - src = src.Derive(sidsi); - for (int i = 0; i < sidss; i++) - { - if (Sids[i] == null) - { - Sids[i] = new LsarTranslatedSid(); - } - Sids[i].Decode(src); - } - } - } - } - - public class LsarTrustInformation : NdrObject - { - public Rpc.Unicode_string Name; - - public Rpc.SidT Sid; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_short(Name.Length); - dst.Enc_ndr_short(Name.MaximumLength); - dst.Enc_ndr_referent(Name.Buffer, 1); - dst.Enc_ndr_referent(Sid, 1); - if (Name.Buffer != null) - { - dst = dst.Deferred; - int nameBufferl = Name.Length / 2; - int nameBuffers = Name.MaximumLength / 2; - dst.Enc_ndr_long(nameBuffers); - dst.Enc_ndr_long(0); - dst.Enc_ndr_long(nameBufferl); - int nameBufferi = dst.Index; - dst.Advance(2 * nameBufferl); - dst = dst.Derive(nameBufferi); - for (int i = 0; i < nameBufferl; i++) - { - dst.Enc_ndr_short(Name.Buffer[i]); - } - } - if (Sid != null) - { - dst = dst.Deferred; - Sid.Encode(dst); - } - } - - /// <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); - } - } - } - - public class LsarRefDomainList : NdrObject - { - public int Count; - - public LsarTrustInformation[] Domains; - - public int MaxCount; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(Domains, 1); - dst.Enc_ndr_long(MaxCount); - if (Domains != null) - { - dst = dst.Deferred; - int domainss = Count; - dst.Enc_ndr_long(domainss); - int domainsi = dst.Index; - dst.Advance(12 * domainss); - dst = dst.Derive(domainsi); - for (int i = 0; i < domainss; i++) - { - Domains[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int domainsp = src.Dec_ndr_long(); - MaxCount = src.Dec_ndr_long(); - if (domainsp != 0) - { - src = src.Deferred; - int domainss = src.Dec_ndr_long(); - int domainsi = src.Index; - src.Advance(12 * domainss); - if (Domains == null) - { - if (domainss < 0 || domainss > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Domains = new LsarTrustInformation[domainss]; - } - src = src.Derive(domainsi); - for (int i = 0; i < domainss; i++) - { - if (Domains[i] == null) - { - Domains[i] = new LsarTrustInformation(); - } - Domains[i].Decode(src); - } - } - } - } - - public class LsarTranslatedName : NdrObject - { - public short SidType; - - public Rpc.Unicode_string Name; - - public int SidIndex; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_short(SidType); - dst.Enc_ndr_short(Name.Length); - dst.Enc_ndr_short(Name.MaximumLength); - dst.Enc_ndr_referent(Name.Buffer, 1); - dst.Enc_ndr_long(SidIndex); - if (Name.Buffer != null) - { - dst = dst.Deferred; - int nameBufferl = Name.Length / 2; - int nameBuffers = Name.MaximumLength / 2; - dst.Enc_ndr_long(nameBuffers); - dst.Enc_ndr_long(0); - dst.Enc_ndr_long(nameBufferl); - int nameBufferi = dst.Index; - dst.Advance(2 * nameBufferl); - dst = dst.Derive(nameBufferi); - for (int i = 0; i < nameBufferl; i++) - { - dst.Enc_ndr_short(Name.Buffer[i]); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - SidType = (short)src.Dec_ndr_short(); - 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(); - SidIndex = 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(); - } - } - } - } - - public class LsarTransNameArray : NdrObject - { - public int Count; - - public LsarTranslatedName[] Names; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(Names, 1); - if (Names != null) - { - dst = dst.Deferred; - int namess = Count; - dst.Enc_ndr_long(namess); - int namesi = dst.Index; - dst.Advance(16 * namess); - dst = dst.Derive(namesi); - for (int i = 0; i < namess; i++) - { - Names[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int namesp = src.Dec_ndr_long(); - if (namesp != 0) - { - src = src.Deferred; - int namess = src.Dec_ndr_long(); - int namesi = src.Index; - src.Advance(16 * namess); - if (Names == null) - { - if (namess < 0 || namess > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Names = new LsarTranslatedName[namess]; - } - src = src.Derive(namesi); - for (int i = 0; i < namess; i++) - { - if (Names[i] == null) - { - Names[i] = new LsarTranslatedName(); - } - Names[i].Decode(src); - } - } - } - } - - public class LsarClose : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x00); - } - - public int Retval; - - public Rpc.PolicyHandle Handle; - - public LsarClose(Rpc.PolicyHandle handle) - { - this.Handle = handle; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - Handle.Encode(dst); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - Handle.Decode(src); - Retval = src.Dec_ndr_long(); - } - } - - public class LsarQueryInformationPolicy : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x07); - } - - public int Retval; - - public Rpc.PolicyHandle Handle; - - public short Level; - - public NdrObject Info; - - public LsarQueryInformationPolicy(Rpc.PolicyHandle handle, short level, NdrObject - info) - { - this.Handle = handle; - this.Level = level; - this.Info = info; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - Handle.Encode(dst); - dst.Enc_ndr_short(Level); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - int infop = src.Dec_ndr_long(); - if (infop != 0) - { - src.Dec_ndr_short(); - Info.Decode(src); - } - Retval = src.Dec_ndr_long(); - } - } - - public class LsarLookupSids : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x0f); - } - - public int Retval; - - public Rpc.PolicyHandle Handle; - - public LsarSidArray Sids; - - public LsarRefDomainList Domains; - - public LsarTransNameArray Names; - - public short Level; - - public int Count; - - public LsarLookupSids(Rpc.PolicyHandle handle, LsarSidArray sids, LsarRefDomainList - domains, LsarTransNameArray names, short level, int count) - { - this.Handle = handle; - this.Sids = sids; - this.Domains = domains; - this.Names = names; - this.Level = level; - this.Count = count; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - Handle.Encode(dst); - Sids.Encode(dst); - Names.Encode(dst); - dst.Enc_ndr_short(Level); - dst.Enc_ndr_long(Count); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - int domainsp = src.Dec_ndr_long(); - if (domainsp != 0) - { - if (Domains == null) - { - Domains = new LsarRefDomainList(); - } - Domains.Decode(src); - } - Names.Decode(src); - Count = src.Dec_ndr_long(); - Retval = src.Dec_ndr_long(); - } - } - - public class LsarOpenPolicy2 : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x2c); - } - - public int Retval; - - public string SystemName; - - public LsarObjectAttributes ObjectAttributes; - - public int DesiredAccess; - - public Rpc.PolicyHandle PolicyHandle; - - public LsarOpenPolicy2(string systemName, LsarObjectAttributes objectAttributes - , int desiredAccess, Rpc.PolicyHandle policyHandle) - { - this.SystemName = systemName; - this.ObjectAttributes = objectAttributes; - this.DesiredAccess = desiredAccess; - this.PolicyHandle = policyHandle; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - dst.Enc_ndr_referent(SystemName, 1); - if (SystemName != null) - { - dst.Enc_ndr_string(SystemName); - } - ObjectAttributes.Encode(dst); - dst.Enc_ndr_long(DesiredAccess); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - PolicyHandle.Decode(src); - Retval = src.Dec_ndr_long(); - } - } - - public class LsarQueryInformationPolicy2 : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x2e); - } - - public int Retval; - - public Rpc.PolicyHandle Handle; - - public short Level; - - public NdrObject Info; - - public LsarQueryInformationPolicy2(Rpc.PolicyHandle handle, short level, NdrObject - info) - { - this.Handle = handle; - this.Level = level; - this.Info = info; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - Handle.Encode(dst); - dst.Enc_ndr_short(Level); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - int infop = src.Dec_ndr_long(); - if (infop != 0) - { - src.Dec_ndr_short(); - Info.Decode(src); - } - Retval = src.Dec_ndr_long(); - } - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcDfsRootEnum.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcDfsRootEnum.cs deleted file mode 100644 index 6a9d4302a..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcDfsRootEnum.cs +++ /dev/null @@ -1,43 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Dcerpc.Ndr; -using SharpCifs.Smb; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcDfsRootEnum : Netdfs.NetrDfsEnumEx - { - public MsrpcDfsRootEnum(string server) : base(server, 200, unchecked(0xFFFF), new Netdfs.DfsEnumStruct(), new NdrLong(0)) - { - Info.Level = Level; - Info.E = new Netdfs.DfsEnumArray200(); - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - - public virtual IFileEntry[] GetEntries() - { - Netdfs.DfsEnumArray200 a200 = (Netdfs.DfsEnumArray200)Info.E; - SmbShareInfo[] entries = new SmbShareInfo[a200.Count]; - for (int i = 0; i < a200.Count; i++) - { - entries[i] = new SmbShareInfo(a200.S[i].DfsName, 0, null); - } - return entries; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcEnumerateAliasesInDomain.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcEnumerateAliasesInDomain.cs deleted file mode 100644 index d9c0afb34..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcEnumerateAliasesInDomain.cs +++ /dev/null @@ -1,29 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcEnumerateAliasesInDomain : Samr.SamrEnumerateAliasesInDomain - { - public MsrpcEnumerateAliasesInDomain(SamrDomainHandle domainHandle, int acctFlags - , Samr.SamrSamArray sam) : base(domainHandle, 0, acctFlags, null, 0) - { - this.Sam = sam; - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcGetMembersInAlias.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcGetMembersInAlias.cs deleted file mode 100644 index 77b2ee375..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcGetMembersInAlias.cs +++ /dev/null @@ -1,29 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcGetMembersInAlias : Samr.SamrGetMembersInAlias - { - public MsrpcGetMembersInAlias(SamrAliasHandle aliasHandle, Lsarpc.LsarSidArray sids - ) : base(aliasHandle, sids) - { - this.Sids = sids; - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcLookupSids.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcLookupSids.cs deleted file mode 100644 index 0aaf31026..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcLookupSids.cs +++ /dev/null @@ -1,34 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Smb; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcLookupSids : Lsarpc.LsarLookupSids - { - internal Sid[] sids; - - public MsrpcLookupSids(LsaPolicyHandle policyHandle, Sid[] sids) : base(policyHandle - , new LsarSidArrayX(sids), new Lsarpc.LsarRefDomainList(), new Lsarpc.LsarTransNameArray - (), 1, sids.Length) - { - this.sids = sids; - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcLsarOpenPolicy2.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcLsarOpenPolicy2.cs deleted file mode 100644 index 9d2c2a0f4..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcLsarOpenPolicy2.cs +++ /dev/null @@ -1,35 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcLsarOpenPolicy2 : Lsarpc.LsarOpenPolicy2 - { - public MsrpcLsarOpenPolicy2(string server, int access, LsaPolicyHandle policyHandle - ) : base(server, new Lsarpc.LsarObjectAttributes(), access, policyHandle) - { - ObjectAttributes.Length = 24; - Lsarpc.LsarQosInfo qos = new Lsarpc.LsarQosInfo(); - qos.Length = 12; - qos.ImpersonationLevel = 2; - qos.ContextMode = 1; - qos.EffectiveOnly = 0; - ObjectAttributes.SecurityQualityOfService = qos; - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcQueryInformationPolicy.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcQueryInformationPolicy.cs deleted file mode 100644 index 820d81ab2..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcQueryInformationPolicy.cs +++ /dev/null @@ -1,30 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Dcerpc.Ndr; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcQueryInformationPolicy : Lsarpc.LsarQueryInformationPolicy - { - public MsrpcQueryInformationPolicy(LsaPolicyHandle policyHandle, short level, NdrObject - info) : base(policyHandle, level, info) - { - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrConnect2.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrConnect2.cs deleted file mode 100644 index 80c45257c..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrConnect2.cs +++ /dev/null @@ -1,28 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcSamrConnect2 : Samr.SamrConnect2 - { - public MsrpcSamrConnect2(string server, int access, SamrPolicyHandle policyHandle - ) : base(server, access, policyHandle) - { - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrConnect4.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrConnect4.cs deleted file mode 100644 index 0f2603e9c..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrConnect4.cs +++ /dev/null @@ -1,28 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcSamrConnect4 : Samr.SamrConnect4 - { - public MsrpcSamrConnect4(string server, int access, SamrPolicyHandle policyHandle - ) : base(server, 2, access, policyHandle) - { - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrOpenAlias.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrOpenAlias.cs deleted file mode 100644 index e0b9b68d3..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrOpenAlias.cs +++ /dev/null @@ -1,28 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcSamrOpenAlias : Samr.SamrOpenAlias - { - public MsrpcSamrOpenAlias(SamrDomainHandle handle, int access, int rid, SamrAliasHandle - aliasHandle) : base(handle, access, rid, aliasHandle) - { - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrOpenDomain.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrOpenDomain.cs deleted file mode 100644 index 2ac6bceed..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcSamrOpenDomain.cs +++ /dev/null @@ -1,28 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcSamrOpenDomain : Samr.SamrOpenDomain - { - public MsrpcSamrOpenDomain(SamrPolicyHandle handle, int access, Rpc.SidT sid, SamrDomainHandle - domainHandle) : base(handle, access, sid, domainHandle) - { - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcShareEnum.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcShareEnum.cs deleted file mode 100644 index 7c7b64abf..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcShareEnum.cs +++ /dev/null @@ -1,55 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Smb; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcShareEnum : Srvsvc.ShareEnumAll - { - internal class MsrpcShareInfo1 : SmbShareInfo - { - internal MsrpcShareInfo1(MsrpcShareEnum enclosing, Srvsvc.ShareInfo1 info1) - { - this._enclosing = enclosing; - NetName = info1.Netname; - Type = info1.Type; - Remark = info1.Remark; - } - - private readonly MsrpcShareEnum _enclosing; - } - - public MsrpcShareEnum(string server) : base("\\\\" + server, 1, new Srvsvc.ShareInfoCtr1 - (), -1, 0, 0) - { - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - - public virtual IFileEntry[] GetEntries() - { - Srvsvc.ShareInfoCtr1 ctr = (Srvsvc.ShareInfoCtr1)Info; - MsrpcShareInfo1[] entries = new MsrpcShareInfo1[ctr - .Count]; - for (int i = 0; i < ctr.Count; i++) - { - entries[i] = new MsrpcShareInfo1(this, ctr.Array[i]); - } - return entries; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcShareGetInfo.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcShareGetInfo.cs deleted file mode 100644 index 802ed61a3..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/MsrpcShareGetInfo.cs +++ /dev/null @@ -1,43 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Smb; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class MsrpcShareGetInfo : Srvsvc.ShareGetInfo - { - public MsrpcShareGetInfo(string server, string sharename) : base(server, sharename - , 502, new Srvsvc.ShareInfo502()) - { - Ptype = 0; - Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag; - } - - /// <exception cref="System.IO.IOException"></exception> - public virtual Ace[] GetSecurity() - { - Srvsvc.ShareInfo502 info502 = (Srvsvc.ShareInfo502)Info; - if (info502.SecurityDescriptor != null) - { - SecurityDescriptor sd; - sd = new SecurityDescriptor(info502.SecurityDescriptor, 0, info502.SdSize); - return sd.Aces; - } - return null; - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Netdfs.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Netdfs.cs deleted file mode 100644 index a338b2885..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Netdfs.cs +++ /dev/null @@ -1,616 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Dcerpc.Ndr; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class Netdfs - { - public static string GetSyntax() - { - return "4fc742e0-4a10-11cf-8273-00aa004ae673:3.0"; - } - - public const int DfsVolumeFlavorStandalone = unchecked(0x100); - - public const int DfsVolumeFlavorAdBlob = unchecked(0x200); - - public const int DfsStorageStateOffline = unchecked(0x0001); - - public const int DfsStorageStateOnline = unchecked(0x0002); - - public const int DfsStorageStateActive = unchecked(0x0004); - - public class DfsInfo1 : NdrObject - { - public string EntryPath; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_referent(EntryPath, 1); - if (EntryPath != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(EntryPath); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - int entryPathp = src.Dec_ndr_long(); - if (entryPathp != 0) - { - src = src.Deferred; - EntryPath = src.Dec_ndr_string(); - } - } - } - - public class DfsEnumArray1 : NdrObject - { - public int Count; - - public DfsInfo1[] S; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(S, 1); - if (S != null) - { - dst = dst.Deferred; - int ss = Count; - dst.Enc_ndr_long(ss); - int si = dst.Index; - dst.Advance(4 * ss); - dst = dst.Derive(si); - for (int i = 0; i < ss; i++) - { - S[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int sp = src.Dec_ndr_long(); - if (sp != 0) - { - src = src.Deferred; - int ss = src.Dec_ndr_long(); - int si = src.Index; - src.Advance(4 * ss); - if (S == null) - { - if (ss < 0 || ss > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - S = new DfsInfo1[ss]; - } - src = src.Derive(si); - for (int i = 0; i < ss; i++) - { - if (S[i] == null) - { - S[i] = new DfsInfo1(); - } - S[i].Decode(src); - } - } - } - } - - public class DfsStorageInfo : NdrObject - { - public int State; - - public string ServerName; - - public string ShareName; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(State); - dst.Enc_ndr_referent(ServerName, 1); - dst.Enc_ndr_referent(ShareName, 1); - if (ServerName != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(ServerName); - } - if (ShareName != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(ShareName); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - State = src.Dec_ndr_long(); - int serverNamep = src.Dec_ndr_long(); - int shareNamep = src.Dec_ndr_long(); - if (serverNamep != 0) - { - src = src.Deferred; - ServerName = src.Dec_ndr_string(); - } - if (shareNamep != 0) - { - src = src.Deferred; - ShareName = src.Dec_ndr_string(); - } - } - } - - public class DfsInfo3 : NdrObject - { - public string Path; - - public string Comment; - - public int State; - - public int NumStores; - - public DfsStorageInfo[] Stores; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_referent(Path, 1); - dst.Enc_ndr_referent(Comment, 1); - dst.Enc_ndr_long(State); - dst.Enc_ndr_long(NumStores); - dst.Enc_ndr_referent(Stores, 1); - if (Path != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Path); - } - if (Comment != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Comment); - } - if (Stores != null) - { - dst = dst.Deferred; - int storess = NumStores; - dst.Enc_ndr_long(storess); - int storesi = dst.Index; - dst.Advance(12 * storess); - dst = dst.Derive(storesi); - for (int i = 0; i < storess; i++) - { - Stores[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - int pathp = src.Dec_ndr_long(); - int commentp = src.Dec_ndr_long(); - State = src.Dec_ndr_long(); - NumStores = src.Dec_ndr_long(); - int storesp = src.Dec_ndr_long(); - if (pathp != 0) - { - src = src.Deferred; - Path = src.Dec_ndr_string(); - } - if (commentp != 0) - { - src = src.Deferred; - Comment = src.Dec_ndr_string(); - } - if (storesp != 0) - { - src = src.Deferred; - int storess = src.Dec_ndr_long(); - int storesi = src.Index; - src.Advance(12 * storess); - if (Stores == null) - { - if (storess < 0 || storess > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Stores = new DfsStorageInfo[storess]; - } - src = src.Derive(storesi); - for (int i = 0; i < storess; i++) - { - if (Stores[i] == null) - { - Stores[i] = new DfsStorageInfo(); - } - Stores[i].Decode(src); - } - } - } - } - - public class DfsEnumArray3 : NdrObject - { - public int Count; - - public DfsInfo3[] S; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(S, 1); - if (S != null) - { - dst = dst.Deferred; - int ss = Count; - dst.Enc_ndr_long(ss); - int si = dst.Index; - dst.Advance(20 * ss); - dst = dst.Derive(si); - for (int i = 0; i < ss; i++) - { - S[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int sp = src.Dec_ndr_long(); - if (sp != 0) - { - src = src.Deferred; - int ss = src.Dec_ndr_long(); - int si = src.Index; - src.Advance(20 * ss); - if (S == null) - { - if (ss < 0 || ss > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - S = new DfsInfo3[ss]; - } - src = src.Derive(si); - for (int i = 0; i < ss; i++) - { - if (S[i] == null) - { - S[i] = new DfsInfo3(); - } - S[i].Decode(src); - } - } - } - } - - public class DfsInfo200 : NdrObject - { - public string DfsName; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_referent(DfsName, 1); - if (DfsName != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(DfsName); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - int dfsNamep = src.Dec_ndr_long(); - if (dfsNamep != 0) - { - src = src.Deferred; - DfsName = src.Dec_ndr_string(); - } - } - } - - public class DfsEnumArray200 : NdrObject - { - public int Count; - - public DfsInfo200[] S; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(S, 1); - if (S != null) - { - dst = dst.Deferred; - int ss = Count; - dst.Enc_ndr_long(ss); - int si = dst.Index; - dst.Advance(4 * ss); - dst = dst.Derive(si); - for (int i = 0; i < ss; i++) - { - S[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int sp = src.Dec_ndr_long(); - if (sp != 0) - { - src = src.Deferred; - int ss = src.Dec_ndr_long(); - int si = src.Index; - src.Advance(4 * ss); - if (S == null) - { - if (ss < 0 || ss > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - S = new DfsInfo200[ss]; - } - src = src.Derive(si); - for (int i = 0; i < ss; i++) - { - if (S[i] == null) - { - S[i] = new DfsInfo200(); - } - S[i].Decode(src); - } - } - } - } - - public class DfsInfo300 : NdrObject - { - public int Flags; - - public string DfsName; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Flags); - dst.Enc_ndr_referent(DfsName, 1); - if (DfsName != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(DfsName); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Flags = src.Dec_ndr_long(); - int dfsNamep = src.Dec_ndr_long(); - if (dfsNamep != 0) - { - src = src.Deferred; - DfsName = src.Dec_ndr_string(); - } - } - } - - public class DfsEnumArray300 : NdrObject - { - public int Count; - - public DfsInfo300[] S; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(S, 1); - if (S != null) - { - dst = dst.Deferred; - int ss = Count; - dst.Enc_ndr_long(ss); - int si = dst.Index; - dst.Advance(8 * ss); - dst = dst.Derive(si); - for (int i = 0; i < ss; i++) - { - S[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int sp = src.Dec_ndr_long(); - if (sp != 0) - { - src = src.Deferred; - int ss = src.Dec_ndr_long(); - int si = src.Index; - src.Advance(8 * ss); - if (S == null) - { - if (ss < 0 || ss > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - S = new DfsInfo300[ss]; - } - src = src.Derive(si); - for (int i = 0; i < ss; i++) - { - if (S[i] == null) - { - S[i] = new DfsInfo300(); - } - S[i].Decode(src); - } - } - } - } - - public class DfsEnumStruct : NdrObject - { - public int Level; - - public NdrObject E; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Level); - int descr = Level; - dst.Enc_ndr_long(descr); - dst.Enc_ndr_referent(E, 1); - if (E != null) - { - dst = dst.Deferred; - E.Encode(dst); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Level = src.Dec_ndr_long(); - src.Dec_ndr_long(); - int ep = src.Dec_ndr_long(); - if (ep != 0) - { - if (E == null) - { - E = new DfsEnumArray1(); - } - src = src.Deferred; - E.Decode(src); - } - } - } - - public class NetrDfsEnumEx : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x15); - } - - public int Retval; - - public string DfsName; - - public int Level; - - public int Prefmaxlen; - - public DfsEnumStruct Info; - - public NdrLong Totalentries; - - public NetrDfsEnumEx(string dfsName, int level, int prefmaxlen, DfsEnumStruct - info, NdrLong totalentries) - { - this.DfsName = dfsName; - this.Level = level; - this.Prefmaxlen = prefmaxlen; - this.Info = info; - this.Totalentries = totalentries; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - dst.Enc_ndr_string(DfsName); - dst.Enc_ndr_long(Level); - dst.Enc_ndr_long(Prefmaxlen); - dst.Enc_ndr_referent(Info, 1); - if (Info != null) - { - Info.Encode(dst); - } - dst.Enc_ndr_referent(Totalentries, 1); - if (Totalentries != null) - { - Totalentries.Encode(dst); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - int infop = src.Dec_ndr_long(); - if (infop != 0) - { - if (Info == null) - { - Info = new DfsEnumStruct(); - } - Info.Decode(src); - } - int totalentriesp = src.Dec_ndr_long(); - if (totalentriesp != 0) - { - Totalentries.Decode(src); - } - Retval = src.Dec_ndr_long(); - } - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Samr.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Samr.cs deleted file mode 100644 index bdc71695e..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Samr.cs +++ /dev/null @@ -1,579 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Dcerpc.Ndr; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class Samr - { - public static string GetSyntax() - { - return "12345778-1234-abcd-ef00-0123456789ac:1.0"; - } - - public const int AcbDisabled = 1; - - public const int AcbHomdirreq = 2; - - public const int AcbPwnotreq = 4; - - public const int AcbTempdup = 8; - - public const int AcbNormal = 16; - - public const int AcbMns = 32; - - public const int AcbDomtrust = 64; - - public const int AcbWstrust = 128; - - public const int AcbSvrtrust = 256; - - public const int AcbPwnoexp = 512; - - public const int AcbAutolock = 1024; - - public const int AcbEncTxtPwdAllowed = 2048; - - public const int AcbSmartcardRequired = 4096; - - public const int AcbTrustedForDelegation = 8192; - - public const int AcbNotDelegated = 16384; - - public const int AcbUseDesKeyOnly = 32768; - - public const int AcbDontRequirePreauth = 65536; - - public class SamrCloseHandle : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x01); - } - - public int Retval; - - public Rpc.PolicyHandle Handle; - - public SamrCloseHandle(Rpc.PolicyHandle handle) - { - this.Handle = handle; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - Handle.Encode(dst); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - Retval = src.Dec_ndr_long(); - } - } - - public class SamrConnect2 : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x39); - } - - public int Retval; - - public string SystemName; - - public int AccessMask; - - public Rpc.PolicyHandle Handle; - - public SamrConnect2(string systemName, int accessMask, Rpc.PolicyHandle handle - ) - { - this.SystemName = systemName; - this.AccessMask = accessMask; - this.Handle = handle; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - dst.Enc_ndr_referent(SystemName, 1); - if (SystemName != null) - { - dst.Enc_ndr_string(SystemName); - } - dst.Enc_ndr_long(AccessMask); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - Handle.Decode(src); - Retval = src.Dec_ndr_long(); - } - } - - public class SamrConnect4 : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x3e); - } - - public int Retval; - - public string SystemName; - - public int Unknown; - - public int AccessMask; - - public Rpc.PolicyHandle Handle; - - public SamrConnect4(string systemName, int unknown, int accessMask, Rpc.PolicyHandle - handle) - { - this.SystemName = systemName; - this.Unknown = unknown; - this.AccessMask = accessMask; - this.Handle = handle; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - dst.Enc_ndr_referent(SystemName, 1); - if (SystemName != null) - { - dst.Enc_ndr_string(SystemName); - } - dst.Enc_ndr_long(Unknown); - dst.Enc_ndr_long(AccessMask); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - Handle.Decode(src); - Retval = src.Dec_ndr_long(); - } - } - - public class SamrOpenDomain : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x07); - } - - public int Retval; - - public Rpc.PolicyHandle Handle; - - public int AccessMask; - - public Rpc.SidT Sid; - - public Rpc.PolicyHandle DomainHandle; - - public SamrOpenDomain(Rpc.PolicyHandle handle, int accessMask, Rpc.SidT sid, Rpc.PolicyHandle - domainHandle) - { - this.Handle = handle; - this.AccessMask = accessMask; - this.Sid = sid; - this.DomainHandle = domainHandle; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - Handle.Encode(dst); - dst.Enc_ndr_long(AccessMask); - Sid.Encode(dst); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - DomainHandle.Decode(src); - Retval = src.Dec_ndr_long(); - } - } - - public class SamrSamEntry : NdrObject - { - public int Idx; - - public Rpc.Unicode_string Name; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Idx); - dst.Enc_ndr_short(Name.Length); - dst.Enc_ndr_short(Name.MaximumLength); - dst.Enc_ndr_referent(Name.Buffer, 1); - if (Name.Buffer != null) - { - dst = dst.Deferred; - int nameBufferl = Name.Length / 2; - int nameBuffers = Name.MaximumLength / 2; - dst.Enc_ndr_long(nameBuffers); - dst.Enc_ndr_long(0); - dst.Enc_ndr_long(nameBufferl); - int nameBufferi = dst.Index; - dst.Advance(2 * nameBufferl); - dst = dst.Derive(nameBufferi); - for (int i = 0; i < nameBufferl; i++) - { - dst.Enc_ndr_short(Name.Buffer[i]); - } - } - } - - /// <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(); - } - } - } - } - - public class SamrSamArray : NdrObject - { - public int Count; - - public SamrSamEntry[] Entries; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(Entries, 1); - if (Entries != null) - { - dst = dst.Deferred; - int entriess = Count; - dst.Enc_ndr_long(entriess); - int entriesi = dst.Index; - dst.Advance(12 * entriess); - dst = dst.Derive(entriesi); - for (int i = 0; i < entriess; i++) - { - Entries[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int entriesp = src.Dec_ndr_long(); - if (entriesp != 0) - { - src = src.Deferred; - int entriess = src.Dec_ndr_long(); - int entriesi = src.Index; - src.Advance(12 * entriess); - if (Entries == null) - { - if (entriess < 0 || entriess > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Entries = new SamrSamEntry[entriess]; - } - src = src.Derive(entriesi); - for (int i = 0; i < entriess; i++) - { - if (Entries[i] == null) - { - Entries[i] = new SamrSamEntry(); - } - Entries[i].Decode(src); - } - } - } - } - - public class SamrEnumerateAliasesInDomain : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x0f); - } - - public int Retval; - - public Rpc.PolicyHandle DomainHandle; - - public int ResumeHandle; - - public int AcctFlags; - - public SamrSamArray Sam; - - public int NumEntries; - - public SamrEnumerateAliasesInDomain(Rpc.PolicyHandle domainHandle, int resumeHandle - , int acctFlags, SamrSamArray sam, int numEntries) - { - this.DomainHandle = domainHandle; - this.ResumeHandle = resumeHandle; - this.AcctFlags = acctFlags; - this.Sam = sam; - this.NumEntries = numEntries; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - DomainHandle.Encode(dst); - dst.Enc_ndr_long(ResumeHandle); - dst.Enc_ndr_long(AcctFlags); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - ResumeHandle = src.Dec_ndr_long(); - int samp = src.Dec_ndr_long(); - if (samp != 0) - { - if (Sam == null) - { - Sam = new SamrSamArray(); - } - Sam.Decode(src); - } - NumEntries = src.Dec_ndr_long(); - Retval = src.Dec_ndr_long(); - } - } - - public class SamrOpenAlias : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x1b); - } - - public int Retval; - - public Rpc.PolicyHandle DomainHandle; - - public int AccessMask; - - public int Rid; - - public Rpc.PolicyHandle AliasHandle; - - public SamrOpenAlias(Rpc.PolicyHandle domainHandle, int accessMask, int rid, Rpc.PolicyHandle - aliasHandle) - { - this.DomainHandle = domainHandle; - this.AccessMask = accessMask; - this.Rid = rid; - this.AliasHandle = aliasHandle; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - DomainHandle.Encode(dst); - dst.Enc_ndr_long(AccessMask); - dst.Enc_ndr_long(Rid); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - AliasHandle.Decode(src); - Retval = src.Dec_ndr_long(); - } - } - - public class SamrGetMembersInAlias : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x21); - } - - public int Retval; - - public Rpc.PolicyHandle AliasHandle; - - public Lsarpc.LsarSidArray Sids; - - public SamrGetMembersInAlias(Rpc.PolicyHandle aliasHandle, Lsarpc.LsarSidArray - sids) - { - this.AliasHandle = aliasHandle; - this.Sids = sids; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - AliasHandle.Encode(dst); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - Sids.Decode(src); - Retval = src.Dec_ndr_long(); - } - } - - public const int SeGroupMandatory = 1; - - public const int SeGroupEnabledByDefault = 2; - - public const int SeGroupEnabled = 4; - - public const int SeGroupOwner = 8; - - public const int SeGroupUseForDenyOnly = 16; - - public const int SeGroupResource = 536870912; - - public const int SeGroupLogonId = -1073741824; - - public class SamrRidWithAttribute : NdrObject - { - public int Rid; - - public int Attributes; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Rid); - dst.Enc_ndr_long(Attributes); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Rid = src.Dec_ndr_long(); - Attributes = src.Dec_ndr_long(); - } - } - - public class SamrRidWithAttributeArray : NdrObject - { - public int Count; - - public SamrRidWithAttribute[] Rids; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(Rids, 1); - if (Rids != null) - { - dst = dst.Deferred; - int ridss = Count; - dst.Enc_ndr_long(ridss); - int ridsi = dst.Index; - dst.Advance(8 * ridss); - dst = dst.Derive(ridsi); - for (int i = 0; i < ridss; i++) - { - Rids[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int ridsp = src.Dec_ndr_long(); - if (ridsp != 0) - { - src = src.Deferred; - int ridss = src.Dec_ndr_long(); - int ridsi = src.Index; - src.Advance(8 * ridss); - if (Rids == null) - { - if (ridss < 0 || ridss > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Rids = new SamrRidWithAttribute[ridss]; - } - src = src.Derive(ridsi); - for (int i = 0; i < ridss; i++) - { - if (Rids[i] == null) - { - Rids[i] = new SamrRidWithAttribute(); - } - Rids[i].Decode(src); - } - } - } - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrAliasHandle.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrAliasHandle.cs deleted file mode 100644 index d4ebdacc4..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrAliasHandle.cs +++ /dev/null @@ -1,40 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Smb; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class SamrAliasHandle : Rpc.PolicyHandle - { - /// <exception cref="System.IO.IOException"></exception> - public SamrAliasHandle(DcerpcHandle handle, SamrDomainHandle domainHandle, int access - , int rid) - { - MsrpcSamrOpenAlias rpc = new MsrpcSamrOpenAlias(domainHandle, access, rid, this); - handle.Sendrecv(rpc); - if (rpc.Retval != 0) - { - throw new SmbException(rpc.Retval, false); - } - } - - /// <exception cref="System.IO.IOException"></exception> - public virtual void Close() - { - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrDomainHandle.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrDomainHandle.cs deleted file mode 100644 index d44c79886..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrDomainHandle.cs +++ /dev/null @@ -1,41 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Smb; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class SamrDomainHandle : Rpc.PolicyHandle - { - /// <exception cref="System.IO.IOException"></exception> - public SamrDomainHandle(DcerpcHandle handle, SamrPolicyHandle policyHandle, int access - , Rpc.SidT sid) - { - MsrpcSamrOpenDomain rpc = new MsrpcSamrOpenDomain(policyHandle, access, sid, this - ); - handle.Sendrecv(rpc); - if (rpc.Retval != 0) - { - throw new SmbException(rpc.Retval, false); - } - } - - /// <exception cref="System.IO.IOException"></exception> - public virtual void Close() - { - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrPolicyHandle.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrPolicyHandle.cs deleted file mode 100644 index 0cd3f9369..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/SamrPolicyHandle.cs +++ /dev/null @@ -1,49 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -namespace SharpCifs.Dcerpc.Msrpc -{ - public class SamrPolicyHandle : Rpc.PolicyHandle - { - /// <exception cref="System.IO.IOException"></exception> - public SamrPolicyHandle(DcerpcHandle handle, string server, int access) - { - if (server == null) - { - server = "\\\\"; - } - MsrpcSamrConnect4 rpc = new MsrpcSamrConnect4(server, access, this); - try - { - handle.Sendrecv(rpc); - } - catch (DcerpcException de) - { - if (de.GetErrorCode() != DcerpcError.DcerpcFaultOpRngError) - { - throw; - } - MsrpcSamrConnect2 rpc2 = new MsrpcSamrConnect2(server, access, this); - handle.Sendrecv(rpc2); - } - } - - /// <exception cref="System.IO.IOException"></exception> - public virtual void Close() - { - } - } -} diff --git a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Srvsvc.cs b/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Srvsvc.cs deleted file mode 100644 index f33f48327..000000000 --- a/Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Srvsvc.cs +++ /dev/null @@ -1,734 +0,0 @@ -// This code is derived from jcifs smb client library <jcifs at samba dot org> -// Ported by J. Arturo <webmaster at komodosoft dot net> -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using SharpCifs.Dcerpc.Ndr; - -namespace SharpCifs.Dcerpc.Msrpc -{ - public class Srvsvc - { - public static string GetSyntax() - { - return "4b324fc8-1670-01d3-1278-5a47bf6ee188:3.0"; - } - - public class ShareInfo0 : NdrObject - { - public string Netname; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_referent(Netname, 1); - if (Netname != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Netname); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - int netnamep = src.Dec_ndr_long(); - if (netnamep != 0) - { - src = src.Deferred; - Netname = src.Dec_ndr_string(); - } - } - } - - public class ShareInfoCtr0 : NdrObject - { - public int Count; - - public ShareInfo0[] Array; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(Array, 1); - if (Array != null) - { - dst = dst.Deferred; - int arrays = Count; - dst.Enc_ndr_long(arrays); - int arrayi = dst.Index; - dst.Advance(4 * arrays); - dst = dst.Derive(arrayi); - for (int i = 0; i < arrays; i++) - { - Array[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int arrayp = src.Dec_ndr_long(); - if (arrayp != 0) - { - src = src.Deferred; - int arrays = src.Dec_ndr_long(); - int arrayi = src.Index; - src.Advance(4 * arrays); - if (Array == null) - { - if (arrays < 0 || arrays > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Array = new ShareInfo0[arrays]; - } - src = src.Derive(arrayi); - for (int i = 0; i < arrays; i++) - { - if (Array[i] == null) - { - Array[i] = new ShareInfo0(); - } - Array[i].Decode(src); - } - } - } - } - - public class ShareInfo1 : NdrObject - { - public string Netname; - - public int Type; - - public string Remark; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_referent(Netname, 1); - dst.Enc_ndr_long(Type); - dst.Enc_ndr_referent(Remark, 1); - if (Netname != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Netname); - } - if (Remark != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Remark); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - int netnamep = src.Dec_ndr_long(); - Type = src.Dec_ndr_long(); - int remarkp = src.Dec_ndr_long(); - if (netnamep != 0) - { - src = src.Deferred; - Netname = src.Dec_ndr_string(); - } - if (remarkp != 0) - { - src = src.Deferred; - Remark = src.Dec_ndr_string(); - } - } - } - - public class ShareInfoCtr1 : NdrObject - { - public int Count; - - public ShareInfo1[] Array; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(Array, 1); - if (Array != null) - { - dst = dst.Deferred; - int arrays = Count; - dst.Enc_ndr_long(arrays); - int arrayi = dst.Index; - dst.Advance(12 * arrays); - dst = dst.Derive(arrayi); - for (int i = 0; i < arrays; i++) - { - Array[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int arrayp = src.Dec_ndr_long(); - if (arrayp != 0) - { - src = src.Deferred; - int arrays = src.Dec_ndr_long(); - int arrayi = src.Index; - src.Advance(12 * arrays); - if (Array == null) - { - if (arrays < 0 || arrays > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Array = new ShareInfo1[arrays]; - } - src = src.Derive(arrayi); - for (int i = 0; i < arrays; i++) - { - if (Array[i] == null) - { - Array[i] = new ShareInfo1(); - } - Array[i].Decode(src); - } - } - } - } - - public class ShareInfo502 : NdrObject - { - public string Netname; - - public int Type; - - public string Remark; - - public int Permissions; - - public int MaxUses; - - public int CurrentUses; - - public string Path; - - public string Password; - - public int SdSize; - - public byte[] SecurityDescriptor; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_referent(Netname, 1); - dst.Enc_ndr_long(Type); - dst.Enc_ndr_referent(Remark, 1); - dst.Enc_ndr_long(Permissions); - dst.Enc_ndr_long(MaxUses); - dst.Enc_ndr_long(CurrentUses); - dst.Enc_ndr_referent(Path, 1); - dst.Enc_ndr_referent(Password, 1); - dst.Enc_ndr_long(SdSize); - dst.Enc_ndr_referent(SecurityDescriptor, 1); - if (Netname != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Netname); - } - if (Remark != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Remark); - } - if (Path != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Path); - } - if (Password != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Password); - } - if (SecurityDescriptor != null) - { - dst = dst.Deferred; - int securityDescriptors = SdSize; - dst.Enc_ndr_long(securityDescriptors); - int securityDescriptori = dst.Index; - dst.Advance(1 * securityDescriptors); - dst = dst.Derive(securityDescriptori); - for (int i = 0; i < securityDescriptors; i++) - { - dst.Enc_ndr_small(SecurityDescriptor[i]); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - int netnamep = src.Dec_ndr_long(); - Type = src.Dec_ndr_long(); - int remarkp = src.Dec_ndr_long(); - Permissions = src.Dec_ndr_long(); - MaxUses = src.Dec_ndr_long(); - CurrentUses = src.Dec_ndr_long(); - int pathp = src.Dec_ndr_long(); - int passwordp = src.Dec_ndr_long(); - SdSize = src.Dec_ndr_long(); - int securityDescriptorp = src.Dec_ndr_long(); - if (netnamep != 0) - { - src = src.Deferred; - Netname = src.Dec_ndr_string(); - } - if (remarkp != 0) - { - src = src.Deferred; - Remark = src.Dec_ndr_string(); - } - if (pathp != 0) - { - src = src.Deferred; - Path = src.Dec_ndr_string(); - } - if (passwordp != 0) - { - src = src.Deferred; - Password = src.Dec_ndr_string(); - } - if (securityDescriptorp != 0) - { - src = src.Deferred; - int securityDescriptors = src.Dec_ndr_long(); - int securityDescriptori = src.Index; - src.Advance(1 * securityDescriptors); - if (SecurityDescriptor == null) - { - if (securityDescriptors < 0 || securityDescriptors > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - SecurityDescriptor = new byte[securityDescriptors]; - } - src = src.Derive(securityDescriptori); - for (int i = 0; i < securityDescriptors; i++) - { - SecurityDescriptor[i] = unchecked((byte)src.Dec_ndr_small()); - } - } - } - } - - public class ShareInfoCtr502 : NdrObject - { - public int Count; - - public ShareInfo502[] Array; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Count); - dst.Enc_ndr_referent(Array, 1); - if (Array != null) - { - dst = dst.Deferred; - int arrays = Count; - dst.Enc_ndr_long(arrays); - int arrayi = dst.Index; - dst.Advance(40 * arrays); - dst = dst.Derive(arrayi); - for (int i = 0; i < arrays; i++) - { - Array[i].Encode(dst); - } - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Count = src.Dec_ndr_long(); - int arrayp = src.Dec_ndr_long(); - if (arrayp != 0) - { - src = src.Deferred; - int arrays = src.Dec_ndr_long(); - int arrayi = src.Index; - src.Advance(40 * arrays); - if (Array == null) - { - if (arrays < 0 || arrays > unchecked(0xFFFF)) - { - throw new NdrException(NdrException.InvalidConformance); - } - Array = new ShareInfo502[arrays]; - } - src = src.Derive(arrayi); - for (int i = 0; i < arrays; i++) - { - if (Array[i] == null) - { - Array[i] = new ShareInfo502(); - } - Array[i].Decode(src); - } - } - } - } - - public class ShareEnumAll : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x0f); - } - - public int Retval; - - public string Servername; - - public int Level; - - public NdrObject Info; - - public int Prefmaxlen; - - public int Totalentries; - - public int ResumeHandle; - - public ShareEnumAll(string servername, int level, NdrObject info, int prefmaxlen, - int totalentries, int resumeHandle) - { - this.Servername = servername; - this.Level = level; - this.Info = info; - this.Prefmaxlen = prefmaxlen; - this.Totalentries = totalentries; - this.ResumeHandle = resumeHandle; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - dst.Enc_ndr_referent(Servername, 1); - if (Servername != null) - { - dst.Enc_ndr_string(Servername); - } - dst.Enc_ndr_long(Level); - int descr = Level; - dst.Enc_ndr_long(descr); - dst.Enc_ndr_referent(Info, 1); - if (Info != null) - { - dst = dst.Deferred; - Info.Encode(dst); - } - dst.Enc_ndr_long(Prefmaxlen); - dst.Enc_ndr_long(ResumeHandle); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - Level = src.Dec_ndr_long(); - src.Dec_ndr_long(); - int infop = src.Dec_ndr_long(); - if (infop != 0) - { - if (Info == null) - { - Info = new ShareInfoCtr0(); - } - src = src.Deferred; - Info.Decode(src); - } - Totalentries = src.Dec_ndr_long(); - ResumeHandle = src.Dec_ndr_long(); - Retval = src.Dec_ndr_long(); - } - } - - public class ShareGetInfo : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x10); - } - - public int Retval; - - public string Servername; - - public string Sharename; - - public int Level; - - public NdrObject Info; - - public ShareGetInfo(string servername, string sharename, int level, NdrObject info - ) - { - this.Servername = servername; - this.Sharename = sharename; - this.Level = level; - this.Info = info; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - dst.Enc_ndr_referent(Servername, 1); - if (Servername != null) - { - dst.Enc_ndr_string(Servername); - } - dst.Enc_ndr_string(Sharename); - dst.Enc_ndr_long(Level); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - src.Dec_ndr_long(); - int infop = src.Dec_ndr_long(); - if (infop != 0) - { - if (Info == null) - { - Info = new ShareInfo0(); - } - src = src.Deferred; - Info.Decode(src); - } - Retval = src.Dec_ndr_long(); - } - } - - public class ServerInfo100 : NdrObject - { - public int PlatformId; - - public string Name; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(PlatformId); - dst.Enc_ndr_referent(Name, 1); - if (Name != null) - { - dst = dst.Deferred; - dst.Enc_ndr_string(Name); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - PlatformId = src.Dec_ndr_long(); - int namep = src.Dec_ndr_long(); - if (namep != 0) - { - src = src.Deferred; - Name = src.Dec_ndr_string(); - } - } - } - - public class ServerGetInfo : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x15); - } - - public int Retval; - - public string Servername; - - public int Level; - - public NdrObject Info; - - public ServerGetInfo(string servername, int level, NdrObject info) - { - this.Servername = servername; - this.Level = level; - this.Info = info; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - dst.Enc_ndr_referent(Servername, 1); - if (Servername != null) - { - dst.Enc_ndr_string(Servername); - } - dst.Enc_ndr_long(Level); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - src.Dec_ndr_long(); - int infop = src.Dec_ndr_long(); - if (infop != 0) - { - if (Info == null) - { - Info = new ServerInfo100(); - } - src = src.Deferred; - Info.Decode(src); - } - Retval = src.Dec_ndr_long(); - } - } - - public class TimeOfDayInfo : NdrObject - { - public int Elapsedt; - - public int Msecs; - - public int Hours; - - public int Mins; - - public int Secs; - - public int Hunds; - - public int Timezone; - - public int Tinterval; - - public int Day; - - public int Month; - - public int Year; - - public int Weekday; - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode(NdrBuffer dst) - { - dst.Align(4); - dst.Enc_ndr_long(Elapsedt); - dst.Enc_ndr_long(Msecs); - dst.Enc_ndr_long(Hours); - dst.Enc_ndr_long(Mins); - dst.Enc_ndr_long(Secs); - dst.Enc_ndr_long(Hunds); - dst.Enc_ndr_long(Timezone); - dst.Enc_ndr_long(Tinterval); - dst.Enc_ndr_long(Day); - dst.Enc_ndr_long(Month); - dst.Enc_ndr_long(Year); - dst.Enc_ndr_long(Weekday); - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode(NdrBuffer src) - { - src.Align(4); - Elapsedt = src.Dec_ndr_long(); - Msecs = src.Dec_ndr_long(); - Hours = src.Dec_ndr_long(); - Mins = src.Dec_ndr_long(); - Secs = src.Dec_ndr_long(); - Hunds = src.Dec_ndr_long(); - Timezone = src.Dec_ndr_long(); - Tinterval = src.Dec_ndr_long(); - Day = src.Dec_ndr_long(); - Month = src.Dec_ndr_long(); - Year = src.Dec_ndr_long(); - Weekday = src.Dec_ndr_long(); - } - } - - public class RemoteTod : DcerpcMessage - { - public override int GetOpnum() - { - return unchecked(0x1c); - } - - public int Retval; - - public string Servername; - - public TimeOfDayInfo Info; - - public RemoteTod(string servername, TimeOfDayInfo info) - { - this.Servername = servername; - this.Info = info; - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Encode_in(NdrBuffer dst) - { - dst.Enc_ndr_referent(Servername, 1); - if (Servername != null) - { - dst.Enc_ndr_string(Servername); - } - } - - /// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception> - public override void Decode_out(NdrBuffer src) - { - int infop = src.Dec_ndr_long(); - if (infop != 0) - { - if (Info == null) - { - Info = new TimeOfDayInfo(); - } - Info.Decode(src); - } - Retval = src.Dec_ndr_long(); - } - } - } -} |
