No smb_raw_search_next in smb_cliraw.h

Stef Bon stefbon at gmail.com
Tue Jul 1 03:04:55 MDT 2014


Hi Volker,

good to hear you are also working on it!

I've read the code of your fuse fs. That looks very good and advanced.
I've been digging in the samba4 code to understand how the sync versus
async handling works, and find it difficult to understand to be
frankly.

My code is at:

https://github.com/stefbon/fuse-workspace

it is a "super" fuse fs, it's meant as manager of different backends
(nfs using libnfs, smb using libsmbclient or other functions, overlay
using custom functions).

The basic implementation you'll find in the source, and functions for
backend in the subdir module.
In module/smb you'll see functions to get the shares per server (using
libsmbclient) libsmbclient-servers.c/h.

Depending on the configuration the functions in
libsmbclient-shares-sync.c/h or smbcli-shares-sync.c/h are used.

The whole idea is that the fuse fs is run as root. It creates a
mountpoint under:

/run/fuse-workspace/$USER/network

after the session for $USER starts.

now it's empty by default.

Add a server on the commandline like:

export WORKSPACE_URI=smb://192.168.2.2
cd /run/fuse-workspace/$USER/network

mkdir smb-server
(or whatever name you give it).
you have to be root for it.

This will create the directory smb-server, and when listning, it will
use the functions to detect the shares.
Per share the functions of your choice (libsmbclient or smbcli) are used.

If defining a server like above, the default auth method is used,
which is for smb guest. For adding more info, the environment var

export WORKSPACE_URI_FILE=/some/file

is used. The format is like:

cat /some/file
service=smb
address=192.168.2.2
authmethod=password:file:///path/to/credentials
forceuser=owner

This will create the same "server", but the credentials file is used,
and the uid and the gid are used of the owner of the mountpoint
(=$USER).

This way the whole population of the network with services can be done
using scripts which detect servers using nmblookup or avahi or
something else.

As you may see the implementation in smbcli-shares-sync is protected by a mutex.
Simular implementation in module/nfs.

Stef Bon


More information about the samba-technical mailing list