net ads dns register can appear to succeed when it failed ...

Michael Adam obnox at samba.org
Sat May 14 21:54:32 UTC 2016


On 2016-05-14 at 11:31 -0700, Richard Sharpe wrote:
> Hi folks,
> 
> There are so many mysteries in life.
> 
> One of them is that net ads dns register can appear to succeed while
> it actually failed. If ads_dns_lookup_ns did not fail but also
> returned zero name servers, it currently looks like
> net_update_dns_internal succeeds.
> 
> Below is a patch to fix that.

Hi Richard,

This looks reasonable in general.

But could you omit the comment? It is imho the perfect
example of a superfluous/redundant commment. :-)

One more remark: The addition of d_printf(...) in the
ns_count == 0 case seems a little arbitrary. I'd say
either add such a print in the failure case as well
or omit it in both cases..

And could you please provide the patch as a git-format patch?

Cheers - Michael

> diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
> index 2c2df8b..f815376 100644
> --- a/source3/utils/net_ads.c
> +++ b/source3/utils/net_ads.c
> @@ -1209,6 +1209,13 @@ static NTSTATUS net_update_dns_internal(struct
> net_context *c,
>                 if ( !NT_STATUS_IS_OK(status) || (ns_count == 0)) {
>                         DEBUG(3,("net_update_dns_internal: Failed to
> find name server for the %s "
>                          "realm\n", ads->config.realm));
> +                       /*
> +                        * If there are no name servers, lets make it an error
> +                        */
> +                       if (ns_count == 0) {
> +                               status = NT_STATUS_UNSUCCESSFUL;
> +                               d_printf(_("No name servers found\n"));
> +                       }
>                         goto done;
>                 }
> 
> 
> 
> -- 
> Regards,
> Richard Sharpe
> (何以解憂?唯有杜康。--曹操)
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160514/9536d4e8/signature.sig>


More information about the samba-technical mailing list