duplicit LDAP calls

Jeremy Allison jra at samba.org
Wed Jun 16 19:51:29 UTC 2021

On Wed, Jun 16, 2021 at 10:49:18AM +0200, Pavel Filipensky via samba-technical wrote:
>during my my learning/observation of how machine account password is
>changed via net ads changetrsutpw I have noticed that two same LDAP calls
>are done in ads_keytab_add_entry() in source3/libads/kerberos_keytab.c  :
>391 »·······my_fqdn = ads_get_dnshostname(ads, tmpctx, lp_netbios_name());
>400 »·······if (!ads_has_samaccountname(ads, tmpctx, lp_netbios_name())) {
>Both ads_get_dnshostname() and ads_has_samaccountname() call
>ads_find_machine_acct() and trigger exactly same LDAP search and get the
>same response. I guess there are more places where an unnecessary network
>call is done, but at least for this case it is easy to refactor the code to
>avoid it. Does  it makes sense to gain performance for possibly less
>structured code?

Depends on the code changes, but yes, that does seem
a useful fix !

Thanks !

More information about the samba-technical mailing list