moving libaddns top-level and "merging" libcli/dns

Alexander Bokovoy ab at
Fri May 25 04:11:44 MDT 2012

On Fri, May 25, 2012 at 11:15 AM, Kai Blin <kai at> wrote:
> On 2012-05-25 09:30, Alexander Bokovoy wrote:
>> Let me know when you analyse changes in those commits in more detail,
>> what particularly affects your code in Samba 4 in these changes apart
>> from moving files between subsystems.
> It's the moving files between subsystems that I object to. The
> dns_hosts_file.c/dns.h code is an awful hack. dns.c/libdns.h isn't.
> They were in different subsystems for a reason, and I suspect
> dns_hosts_file.c/dns.h only ended up in libcli/dns because nobody
> bothered to find a different place for them.
Probably that's real reason here.

When I tried to move dns_hosts_file.c into libaddns, the differences
between IDL-generated and manually created structs is what caused
conflicts there. I can work on migrating dns_hosts_file.c to use
structs defined in libaddns and later move to IDL-generated structs,
step by step. This will allow to move the code to libaddns completely.

>> All other changes were to make dependencies between subsystems untangled.
> Why does linking the dns server to a hack designed to test other code
> "untangle" dependencies?
Functions in dns_hosts_file.c are used in Samba 4 in client code in
two different ways:
1. Resolver in source4/libcli/resolve/dns_ex.c always passes NULL as
dns_hosts_file argument, making that code not used.
2. lpcfg_resolve_context() conditionally adds non-NULL dns_hosts_file
handling when name resolve order in smb.conf contains 'file' and
'resolve: host file' is non-NULL.

Now, lpcfg_resolve_context() is used widely in Samba 4. So the code is
used in source4/ under conditions outlined in (2).
Samba 3 uses it similarly, always passing value of 'resolve: host file'.

Now, there are only few users of libcli/dns/libdns.h. In fact, there
are two only:
1. source4/dns_server/dns_query.c
2. utils/samba-dig.c

So clidns subsystem can be left alone, as a subsystem and not a
library at all. In addition, cli-nbt can be removed of clidns
dependency as it does not use the code neither from libdns.h nor

Would you agree to that?
/ Alexander Bokovoy

More information about the samba-technical mailing list