libsmbclient: lp_load() and setting the order of interfaces

David Wuertele dave-gnus at bfnet.com
Mon Nov 17 19:56:51 GMT 2003


My program contains the following code:

    lp_load ("eth0.conf", True, False, False);
    smbc_init(auth_fn, 0);
    setup_logging("read-all-browse-lists", False);
    dh = smbc_opendir(url);
    while (dirptr = smbc_readdir( dh )) {
      char newurl[MAX_BUFF_SIZE];
      if (debug > 2) fprintf (stderr, "adding server %s\n", dirptr->name);
      add_server (dirptr->name);
    }
    smbc_closedir(dh);

This works great for enumerating servers known to the LMB on eth0.  My
problem is that I want to run it again, like this:

    lp_load ("eth1.conf", True, False, False);
    smbc_init(auth_fn, 0);
    setup_logging("read-all-browse-lists", False);
    dh = smbc_opendir(url);
    while (dirptr = smbc_readdir( dh )) {
      char newurl[MAX_BUFF_SIZE];
      if (debug > 2) fprintf (stderr, "adding server %s\n", dirptr->name);
      add_server (dirptr->name);
    }
    smbc_closedir(dh);

The only difference is that I'm loading eth1.conf instead of
eth0.conf.  The purpose is to load the interface list with a different
interface, so that smbc_opendir() uses a different interface to scan
an LMB on a different subnet.

The problem is that lp_load() only seems to work once:  the second
time I run it, eth1.conf is not loaded, or at least the behavior of
smbc_opendir() is as if eth1.conf had not been loaded.

If I just want to change the interfaces that smbc_opendir() uses, is
there a simple way to do it?

Thanks,
Dave




More information about the samba-technical mailing list