SmbComNegotiate.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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;
  18. using SharpCifs.Util.Sharpen;
  19. namespace SharpCifs.Smb
  20. {
  21. internal class SmbComNegotiate : ServerMessageBlock
  22. {
  23. private const string Dialects = "\u0002NT LM 0.12\u0000";
  24. public SmbComNegotiate()
  25. {
  26. Command = SmbComNegotiate;
  27. Flags2 = SmbConstants.DefaultFlags2;
  28. }
  29. internal override int WriteParameterWordsWireFormat(byte[] dst, int dstIndex)
  30. {
  31. return 0;
  32. }
  33. internal override int WriteBytesWireFormat(byte[] dst, int dstIndex)
  34. {
  35. byte[] dialects;
  36. try
  37. {
  38. //dialects = Runtime.GetBytesForString(Dialects, "ASCII");
  39. dialects = Runtime.GetBytesForString(Dialects, "UTF-8");
  40. }
  41. catch (UnsupportedEncodingException)
  42. {
  43. return 0;
  44. }
  45. Array.Copy(dialects, 0, dst, dstIndex, dialects.Length);
  46. return dialects.Length;
  47. }
  48. internal override int ReadParameterWordsWireFormat(byte[] buffer, int bufferIndex
  49. )
  50. {
  51. return 0;
  52. }
  53. internal override int ReadBytesWireFormat(byte[] buffer, int bufferIndex)
  54. {
  55. return 0;
  56. }
  57. public override string ToString()
  58. {
  59. return "SmbComNegotiate[" + base.ToString() + ",wordCount=" + WordCount
  60. + ",dialects=NT LM 0.12]";
  61. }
  62. }
  63. }