If nmbd is not running smbc_opendir(ctx, "smb://localhost/") returns NULL. Expected behaviour: You should still be able to browse hosts without requiring nmbd.
Test program that returns NULL: #include <stdio.h> #include <libsmbclient.h> int main(int argc, char **argv) { smbc_opendir_fn smbc_opendir; SMBCCTX *smb_context; SMBCFILE *dir; smb_context = smbc_new_context (); smbc_setDebug (smb_context, 4); smbc_setOptionDebugToStderr (smb_context, 1); smbc_init_context (smb_context); smbc_opendir = smbc_getFunctionOpendir (smb_context); dir = smbc_opendir (smb_context, "smb://localhost/"); printf("%p\n", dir); return 0; }
Created attachment 4615 [details] Log of running test program without nmbd running
The problem here is not one of nmbd not running. As your test program output shows, the name 'localhost' is being resolved using the "hosts" resolve method, and is being resolved correctly. It's the actual connection to *smbd* that's failing. A debug level 10 at the server (rather than at the client) might help discover why the connection is being refused. Your test program works for me if I start samba normally then kill nmbd. The connection succeeds. I believe there's something wrong with your test environment. Derrell