Bug 6678 - smbc_opendir(ctx, "smb://localhost/") returns NULL if nmbd not running
Summary: smbc_opendir(ctx, "smb://localhost/") returns NULL if nmbd not running
Status: RESOLVED INVALID
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.4.0
Hardware: x86 Linux
: P3 normal
Target Milestone: ---
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-31 02:49 UTC by Robert Ancell
Modified: 2009-08-31 20:38 UTC (History)
0 users

See Also:


Attachments
Log of running test program without nmbd running (5.53 KB, text/plain)
2009-08-31 02:51 UTC, Robert Ancell
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Ancell 2009-08-31 02:49:38 UTC
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.
Comment 1 Robert Ancell 2009-08-31 02:50:09 UTC
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;
}
Comment 2 Robert Ancell 2009-08-31 02:51:15 UTC
Created attachment 4615 [details]
Log of running test program without nmbd running
Comment 3 Derrell Lipman 2009-08-31 20:38:14 UTC
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