auto-loading of smb.conf

Andrew Tridgell tridge at
Wed Sep 9 10:08:26 GMT 1998

> In a struct I store the handle (20 bytes) and the corresponding
> lp_servicename(). I need to do so as all the spoolss functions are
> referencing an handle.

> Now imagine, a user open a printer (to check the spooled jobs for
> instance) and the samba admin decides to delete this share, and the
> smb.conf file is reloaded.

rare, but possible
> As I'm lazy, I don't want to add code everywhere to check if the share
> name stored in the handle struct still exist, I prefer to disable
> auto-reloading of smb.conf until all printers are open by a given smbd
> process.

no, don't do that. What if the client doesn't open all printers? Then
you'd leave the smb.conf loading permanently disabled.

I think the correct solution is to either add checks to see if the
share name is valid (it can't be that hard!) or just not ignore the
checks and bear with a possible segv if the reload happens when the
share is deleted.

there is also a 3rd alternative. Samba doesn't allow a reload to
delete a share that is currently in use. (see the call to
lp_killunused() in server.c). You could add a "inuse" flag to a share
and make conn_snum_used() check that flag. Then add lp_set_used() and
lp_unset_used() calls.

More information about the samba-technical mailing list