Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode client and domain in oem/unicode in Client#authenticate! #19

Merged
merged 2 commits into from
Feb 22, 2015

Conversation

jlee-r7
Copy link

@jlee-r7 jlee-r7 commented Feb 10, 2015

I'm using my SMB2 implementation to exercise this code. Type1 messages have to have the domain/workstation encoded as OEM (ascii), so we need to pass them in as either "binary" or "utf-8" encoding to the Client constructor. However, when we build the Type3 message, it has to be in whatever encoding was negotiated, usually Unicode ("utf-16le").

Without this change, passing correct user/pass:

  • domain encoded as ascii-8bit or utf-8 results in STATUS_LOGON_FAILURE
  • domain encoded as unicode results in this stack trace:
Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-16LE
    from /home/egypt/repo/rubyntlm/lib/net/ntlm/message.rb:90:in `serialize'
    from /home/egypt/repo/smb2/lib/smb2/client.rb:72:in `authenticate'
    from (irb):2
    from /home/egypt/.rvm/rubies/ruby-2.1.5/bin/irb:11:in `<main>'

After this change, passing domain as ascii-8bit or utf-8 works as expected.

@jlee-r7 jlee-r7 changed the title Encode client and domain in oem/unicode in authenticate! Encode client and domain in oem/unicode in Client#authenticate! Feb 10, 2015
@zenchild zenchild merged commit e7544b9 into WinRb:dan/ntlm-client Feb 22, 2015
@zenchild
Copy link
Member

@jlee-r7 Thanks for the fix and the testing.

@jlee-r7 jlee-r7 deleted the bug/client-domain-encoding branch March 2, 2015 20:27
@jlee-r7 jlee-r7 restored the bug/client-domain-encoding branch April 16, 2015 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants