libsmbclient and IP numbers

Tom Jansen t.p.j.jansen at student.utwente.nl
Fri Nov 16 03:44:36 GMT 2001


Hi,

> > > > smbc_opendir("smb://<insert IP here>/); it fails! Is this not supported?
> > >
> > > It works perfectly here 
This is not true. My wrong. read on please.

> My guess is that the IP will work against a Samba box, but not against
> NT.  Can you verify.  With NT, you need a name for the NetBIOS session
> request.  smbd doesn't actually require this.

Linux client: libsmbclient from HEAD
Linux server: samba 2.2.2

I've tried the following with the program snippet attached:

Linux client vs. Windows 2000: 
corona is the netbios name of the box with ip 130.89.226.223

o smbc_opendir(smb://130.89.226.223) returned: -1 errno: 0 strerror: Success
o smbc_opendir(smb://130.89.226.223/mp3) returned: 11024
  All OK!
o smbc_opendir(smb://corona) returned: 11024
  All OK!
o smbc_opendir(smb://corona/mp3) returned: 11024
  All OK!

Linux client vs. Win98:
sir-bedevere is the netbios name of the box with ip 130.89.226.223

o smbc_opendir(smb://130.89.226.216) returned: -1 errno: 0 strerror: Success
o smbc_opendir(smb://130.89.226.216/upload) returned: -1 errno: 2 strerror: No
such    file or directory
o smbc_opendir(smb://sir-bedevere) returned: 11024
  All OK!
o smbc_opendir(smb://sir-bedevere/upload) returned: 11024
  All OK!

Linux client vs Linux server:
niihau is the netbios name of the box with ip 130.89.226.217

o smbc_opendir(smb://130.89.226.217) returned: -1 errno: 0 strerror: Success
o smbc_opendir(smb://130.89.226.217/upload) returned: 11024
  All OK!
o smbc_opendir(smb://niihau/) returned: 11024
  All OK!
o smbc_opendir(smb://niihau/upload) returned: 11024
  All OK!

Hope this helps. 

Yours,
	Tom
-------------- next part --------------
#include <stdio.h>
#include <errno.h>
#include <string.h>

static void auth_fn (const char *srv, const char *shr,
		                          char *wg, int wglen,
		                          char *un, int unlen,
		                          char *pw, int pwlen)
{
   
   strcpy(un, "guest");
   strcpy(pw, "");
}



int main(int argc, char *argv[])
{
   int err;
   int nDirEnt;
   
   if ((err =  smbc_init(auth_fn,  10)) < 0) {
	fprintf(stderr, "smbc_init barfed: %d\n", err);
	exit(err);
   }
   nDirEnt = smbc_opendir(argv[1]);
   if (nDirEnt < 0) {
      fprintf(stderr, "smbc_opendir(%s) returned: %d errno: %d strerror: %s\n",
	      argv[1], nDirEnt,errno, strerror(errno));
      exit(errno);
   }
   fprintf(stderr, "smbc_opendir(%s) returned: %d\n",argv[1], nDirEnt);
   fprintf(stderr, "All OK!\n");
}



More information about the samba-technical mailing list