NtTransQuerySecurityDescResponse.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // This code is derived from jcifs smb client library <jcifs at samba dot org>
  2. // Ported by J. Arturo <webmaster at komodosoft dot net>
  3. //
  4. // This library is free software; you can redistribute it and/or
  5. // modify it under the terms of the GNU Lesser General Public
  6. // License as published by the Free Software Foundation; either
  7. // version 2.1 of the License, or (at your option) any later version.
  8. //
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. // Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public
  15. // License along with this library; if not, write to the Free Software
  16. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. using System.IO;
  18. using SharpCifs.Util.Sharpen;
  19. namespace SharpCifs.Smb
  20. {
  21. internal class NtTransQuerySecurityDescResponse : SmbComNtTransactionResponse
  22. {
  23. internal SecurityDescriptor SecurityDescriptor;
  24. internal override int WriteSetupWireFormat(byte[] dst, int dstIndex)
  25. {
  26. return 0;
  27. }
  28. internal override int WriteParametersWireFormat(byte[] dst, int dstIndex)
  29. {
  30. return 0;
  31. }
  32. internal override int WriteDataWireFormat(byte[] dst, int dstIndex)
  33. {
  34. return 0;
  35. }
  36. internal override int ReadSetupWireFormat(byte[] buffer, int bufferIndex, int len)
  37. {
  38. return 0;
  39. }
  40. internal override int ReadParametersWireFormat(byte[] buffer, int bufferIndex, int len)
  41. {
  42. Length = ReadInt4(buffer, bufferIndex);
  43. return 4;
  44. }
  45. internal override int ReadDataWireFormat(byte[] buffer, int bufferIndex, int len)
  46. {
  47. int start = bufferIndex;
  48. if (ErrorCode != 0)
  49. {
  50. return 4;
  51. }
  52. try
  53. {
  54. SecurityDescriptor = new SecurityDescriptor();
  55. bufferIndex += SecurityDescriptor.Decode(buffer, bufferIndex, len);
  56. }
  57. catch (IOException ioe)
  58. {
  59. throw new RuntimeException(ioe.Message);
  60. }
  61. return bufferIndex - start;
  62. }
  63. public override string ToString()
  64. {
  65. return "NtTransQuerySecurityResponse[" + base.ToString() + "]";
  66. }
  67. }
  68. }