Why does registry_init_smbconf call registry_init_common instead of registry_init_full?

Michael Adam obnox at samba.org
Sun Jan 4 18:13:01 MST 2015


Generally, the registry_init_common is the basic initialization.
That does nothing special. registry_init_basic ist just a trivial
wrapper around it that closes the db at the end.
Then there are other init functions that add special behaviour
to various keys by overloading the standard db methods.

The registry_init_smbconf only overloads the smbconf key
which in turn only adds an different access check. All else
is handed down to the regdb methods.
This is intended for use from libsmbconf, in particular for
all client tools.

The registry_init_full additionally overloads various keys
which partly completely replace the regdb backend, e.g.
the Printers key and netlogon params. This is intended to
be used only in smbd.

This structure is certainly far from perfect, but it
has worked for a while.

I am not quite clear yet what you are trying to

- If you want to overload a special key's behaviour,
  you could create a custom init function and/or make
  sure that all other overload it.
  If you want it to be always loaded, you could even
  add it to reg_init_basic.
  This will, with the current layout, only work if
  you don't want to stack that with other special methods

  If you want to configure such a thing via smb.conf,
  I think it is important to not put a corresponding
  setting into the registry config but into the initial
  text config.

- If you would like to replace the tdb database backend
  altoghether, then you basically have to replace

  This is currently not pluggable, so you'd have
  to replace the initialization in registry_init_common.
  In order to make it pluggable, a config setting
  "registry backend" would be appropriate, and
  the code in registry_init_common would have to be
  extended to honour this.

- If you would like to especially change the
  backend for smbconf key and nothing else, then
  I think you'd need to establis an alternative
  module to reg_backend_smbconf and load its operations
  in registry_init_smbconf(). Which ops to load
  here could be controlled by an smb.conf (text file!)
  option. Everything else should work automatically then.

Hope this helps, and happy to discuss this further...


On 2015-01-04 at 08:52 -0800, Richard Sharpe wrote:
> Hi folks,
> I have started looking at the changes required to support Zookeeper as
> a registry backend.
> I have come up with an approach that uses a couple of smb.conf
> parameters, only one of which is relevant here:
>    registry backend replace = HKLM\SOFTWARE\Samba\smbconf=zookeeper,[...]
> The parsing of this is relatively easy, but I have encountered a
> problem in that the smb.conf parsing code only calls
> registry_init_basic so my override code does not get called and it is
> all to no avail. My override code is currently in registry_init_full,
> and after the registry hooks are applied, then sorts through the list
> supplied by the above and overrides any that it needs to.
> However, things do not work as I intend because my code is not called
> when the smb.conf is being processed, so nothing comes from zookeeper.
> If registry_init_smbconf called registry_init_full, I think things
> would work as I require but I wonder if doing that will break
> anything?
> Does anyone know?
> -- 
> Regards,
> Richard Sharpe
> (何以解憂?唯有杜康。--曹操)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150105/a92a47ba/attachment.pgp>

More information about the samba-technical mailing list