Ups and downs with samba

Using Windows as development environment for Ruby applications is not very good idea. So I have moved to setup with FreeBSD on VMWare and access via samba to files. Far away from perfect but better than before.

When I have changed VMWare player to VMWare server I made decision to create new virtual machine, since with server I can create new machines (player could not). Old one was created for other tasks, and partitioning was not well suited to current tasks.

(c) Joe Geranio

So I have created new virtual machine installed new FreeBSD 7.0 and as first task I wanted to configure samba to serve files to my Windows host. Dead simple setup. Installation was smooth, I have configured it, created user and…

net use \\\local_ruby * /USER:ruby
Enter password for \\\local_ruby:
System error 1326 has occurred. 
Logon failure: unknown user name or bad password.

I started debugging and fast got frustrated – since it is dead simple setup. I’m not heavy samba user, so logs were not very helpful. At this moment my opinion about this could be summarized with samba sucks. But then came solution.

After raising log level to maximum level I have noticed this sequence:

[2008/07/09 12:38:38, 3] auth/auth.c:check_ntlm_password(221)
  check_ntlm_password:  Checking password for unmapped user [WRNB]\[ruby]@[WRNB] with the new password interface
[2008/07/09 12:38:38, 3] auth/auth.c:check_ntlm_password(224)
  check_ntlm_password:  mapped user is: []\[ruby]@[WRNB]
[2008/07/09 12:38:38, 10] auth/auth.c:check_ntlm_password(233)
  check_ntlm_password: auth_context challenge created by NTLMSSP callback (NTLM2)
[2008/07/09 12:38:38, 10] auth/auth.c:check_ntlm_password(235)
  challenge is:
[2008/07/09 12:38:38, 5] lib/util.c:dump_data(2264)
  [000] C7 C0 65 DD B0 91 86 EF                           ..e.....
[2008/07/09 12:38:38, 10] auth/auth.c:check_ntlm_password(261)
  check_ntlm_password: guest had nothing to say
[2008/07/09 12:38:38, 8] lib/util.c:is_myname(2076)
  is_myname("") returns 0
[2008/07/09 12:38:38, 6] auth/auth_sam.c:check_samstrict_security(414)
  check_samstrict_security:  is not one of my local names (ROLE_STANDALONE)
[2008/07/09 12:38:38, 10] auth/auth.c:check_ntlm_password(261)
  check_ntlm_password: sam had nothing to say
[2008/07/09 12:38:38, 2] auth/auth.c:check_ntlm_password(319)
  check_ntlm_password:  Authentication for user [ruby] -> [ruby] FAILED with error  NT_STATUS_NO_SUCH_USER
[2008/07/09 12:38:38, 5] auth/auth_util.c:free_user_info(2056)
  attempting to free (and zero) a user_info structure
[2008/07/09 12:38:38, 10] auth/auth_util.c:free_user_info(2060)
  structure was created for ruby
[2008/07/09 12:38:38, 3] smbd/error.c:error_packet_set(106)
  error packet at smbd/sesssetup.c(105) cmd=115 (SMBsesssetupX) NT_STATUS_LOGON_FAILURE

I started to dig in C code to understand what those messages, and in auth_sam.c I have discovered real reason. Did I said that it was very fresh FreeBSD install? Well I did not set it’s hostname! And this was reason that whole thing was failing. For me log entry does not say what is going on…

So, samba does not suck :) and open source rules. I could not imagine what would I do if it had bite me with some closed software. As other lesson learned from that is – know at least basics of C and C++ to be able to understand what is going on in code…

C is like Latin :) almost dead language but You need to know it to be taken for educated programmer ;))

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.