mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-26 18:48:21 +01:00
merge common implementations and server implementations
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1161
Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Lsarpc.cs
Normal file
1161
Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Lsarpc.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,43 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
616
Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Netdfs.cs
Normal file
616
Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Netdfs.cs
Normal file
@@ -0,0 +1,616 @@
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
579
Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Samr.cs
Normal file
579
Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Samr.cs
Normal file
@@ -0,0 +1,579 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
734
Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Srvsvc.cs
Normal file
734
Emby.Server.Implementations/IO/SharpCifs/Dcerpc/Msrpc/Srvsvc.cs
Normal file
@@ -0,0 +1,734 @@
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user