libsmbclient: how to see if authentication succeeded

Andreas Schneider anschneider at
Tue May 27 09:26:00 GMT 2008

Willem van Engen wrote:
> Hi Andrew,


> Gnome's new virtual filesystem layer gvfs first opens a connection
> before any file access is done, similar to mounting a filesystem. Here
> connections are cached (not only smb but also other protocols), a fuse
> filesystem is mounted optionally, and the connection appears in the gui.

If it opens a connection it has to try if it can open the directory you're 
trying to access. So you should do a smbc_opendir() on the share or directory.

> This would be a sensible place to error out if authentication fails,
> inform the user, and cancel the mount. If merely a directory is
> unreadable, it still makes sense to have the connection opened. Or at
> least the user should be able to know the difference.

If the authentication fails libsmbclient calls the auth_fn callback.

> What would be the correct direction to proceed, exposing a login
> function as I described in the previous mail?

I suggest to use smbc_opendir() to check if you can access the share. If 
you're not authenticated or the username/password are wrong the auth_fn will 
be called.

> Kind regards,
> - Willem van Engen

	-- andreas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
Url :

More information about the samba-technical mailing list