NetServerEnum2 from libsmbclient on port 445.

Derrell.Lipman at UnwiredUniverse.com Derrell.Lipman at UnwiredUniverse.com
Tue Apr 8 12:31:08 GMT 2003


"Christopher R. Hertel" <crh at ubiqx.mn.org> writes:

> This is an interesting area of study.  The NetServerEnum2() function
> call is supposed to return a list of NetBIOS names.  SMB on port 445
> is NetBIOS-less SMB.  In theory, it makes some sort of sense that a
> NetServerEnum2() call via port 445 would not return any NetBIOS server
> names.

I had this issue in smbwrapper as well.  After some discussion with people on
this list, I came to the following solution which has worked well for me so
far.

        /* Force use of port 139 for first try, so browse lists can work*/
        c.port = 139;
        
        /* Attempt to connect */
        if (!cli_connect(&c, server_n, &ip)) {
                /*
                 * Port 139 connection failed.  Try port 445 to handle
                 * connections to newer (e.g. XP) hosts with NetBIOS disabled.
                 */
                c.port = 445;
                if (!cli_connect(&c, server_n, &ip)) {
                        errno = ENOENT;
                        free(username);
                        free(workgroup);
                        free(password);
                        return NULL;
                }
        }

Derrell


More information about the samba-technical mailing list