On 22.8.2016 10:49, Ondrej Valousek wrote:
> I do not think this is a good patch - systematically.
> Maybe better approach is to rather use gethostbyname() than gethostname().
> My 2 cents.

Most importantly, this will work only for the simplest possible case where
host name of the client is sub-domain of AD domain.

It will break e.g. in this scenario:
AD domain = example.net.
Client's hostname = myclient.branch1.example.net.

Needles to say that it is perfectly valid to have client host name like
client.unrelated.example.org. (not the .org at the end!).

Having said that, I believe that SSSD should not try to be smarter in this
area because it cannot do better without making wrong and surprising decisions
in more complicated setups.

Petr^2 Spacek


> -----Original Message-----
> From: Joakim Tjernlund [mailto:[email protected]] 
> Sent: Monday, August 22, 2016 10:42 AM
> To: [email protected]
> Subject: [SSSD-users] Re: DDNS not working due to non FQDN hostname
> 
> On Mon, 2016-08-22 at 10:23 +0200, Jakub Hrozek wrote:
>> On Mon, Aug 22, 2016 at 08:16:36AM +0000, Ondrej Valousek wrote:
>>>
>>> Ok, so you Jakub say that /etc/hostname should rather contain FQDN right?
>>
>> No, I'm saying that gethostname()/hostname should return a FQDN. 
>> You're likely to run into all kinds of issues anyway if your system is 
>> configured with shortnames.
> 
> Seems to be different "standards", each distribution seems to have selected 
> some variant.
> I think claiming that "gethostname()/hostname should return a FQDN" is THE 
> standard will not hold, but some dists has adopted this to make life easier 
> in some areas.
> 
> I added this short patch to sssd which will at least try to do the right 
> thing:
> 
> --- sssd-1.13.1/src/providers/ad/ad_common.c.org      2016-08-21 
> 17:47:09.501079617 +0200
> +++ sssd-1.13.1/src/providers/ad/ad_common.c  2016-08-21 17:52:13.059669848 
> +0200
> @@ -397,6 +397,11 @@
>              goto done;
>          }
>          hostname[HOST_NAME_MAX] = '\0';
> +     /* If hostname is non FQDN, add ad_domain */ 
> +     if (strchr(hostname,'.') == NULL) {
> +       strncat(hostname, ".", HOST_NAME_MAX - 1);
> +       strncat(hostname, domain, HOST_NAME_MAX - 1);
> +     }
>          DEBUG(SSSDBG_CONF_SETTINGS,
>                "Setting ad_hostname to [%s].\n", hostname);
>          ret = dp_opt_set_string(opts->basic, AD_HOSTNAME, hostname);
>>
>>>
>>> I was not sure what RedHat says in terms of "best practices" here.
>>
>> This is upstream list, the fact that my address ends with .redhat.com 
>> is irrelevant.
>>
>>>
>>>
>>> But I agree the from the admin prospective, we ideally need to have 
>>> the same configuration in sssd.conf being shared by all hosts.
>>> Ondrej
_______________________________________________
sssd-users mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to