<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="">> +/* make sure the hostname is not "localhost" */<br>
> +static bool is_localhost(const char *hostname) {<br>
> +        char *hostend;<br>
> +<br>
> +        assert(hostname);<br>
> +<br>
> +        hostend = strchr(hostname, '.');<br>
> +        if (hostend)<br>
> +                return strneq(hostname, "localhost", (hostend - hostname));<br>
> +        else<br>
> +                return streq(hostname, "localhost");<br>
> +}<br>
<br>
</div>We have a similar check in pam_systemd, and in hostnamed. I'd prefer if<br>
we could unify that and stick it in src/shared/util.[ch]. I am not<br>
convinced though that check for all names with the "localhost."<br>
prefix. That appears too broad to me. I'd really just check for<br>
"localhost" and "localhost.localdomain", where the former is what<br>
everybody uses, and the latter a redhatism...<br>
<br></blockquote><div><br></div><div>I think in practice localhost and localhost.localdomain should cover it but there is a</div><div>recent RFC 6761 that says this (sec 6.3):</div><div><br></div><div><pre class="" style="font-size:1em;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0)">
   The domain "localhost." and any names falling within ".localhost."
   are special in the following ways:</pre></div><div><br></div><div>... all ways in which localhost is special follows ...</div><div><br></div><div>Not sure how much weight this RFC carries and this patch does not follow it</div>
<div>exactly as it should also be checking for <a href="http://somehost.localhost.abc.com">somehost.localhost.abc.com</a></div><div><br></div><div>It seemed to me that <a href="http://localhost.mydomain.com">localhost.mydomain.com</a> should really refer to your localhost so</div>
<div>that is why I put the check in for that (and also to not special case localdomain).</div></div></div></div>