Re: [PATCH] lib: use 'localhost' rather than fqdn for default mail address.

Subject: Re: [PATCH] lib: use 'localhost' rather than fqdn for default mail address.

Date: Thu, 09 Sep 2021 23:09:41 +0300

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Thu, Sep 09 2021, David Bremner wrote:

> As discussed in the thread starting at [1], the fully qualified domain
> name is a bit tricky to get reproducibly, might reveal information
> people prefer to keep private, and somewhat unlikely to provide
> reliable mail routing.
>
> The new approach of $current_username@localhost is better for the
> first two considerations, and probably at least as good as a test mail
> address.
>
> [1]: id:87sfyibqhj.fsf@tethera.net
> ---
>  lib/config.cc          | 17 ++---------------
>  test/T590-libconfig.sh | 10 ++++------
>  2 files changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/lib/config.cc b/lib/config.cc
> index 7ecc3c7b..408570bc 100644
> --- a/lib/config.cc
> +++ b/lib/config.cc
> @@ -543,25 +543,12 @@ _get_username_from_passwd_file (void *ctx)
>  static const char *
>  _get_email_from_passwd_file (void *ctx)
>  {
> -
> -    char hostname[256];
> -    struct hostent *hostent;
> -    const char *domainname;
>      char *email;
>  
>      char *username = _get_username_from_passwd_file (ctx);
>  
> -    gethostname (hostname, 256);
> -    hostname[255] = '\0';
> -
> -    hostent = gethostbyname (hostname);
> -    if (hostent && (domainname = strchr (hostent->h_name, '.')))
> -	domainname += 1;
> -    else
> -	domainname = "(none)";
> -
> -    email = talloc_asprintf (ctx, "%s@%s.%s",
> -			     username, hostname, domainname);
> +    email = talloc_asprintf (ctx, "%s@localhost",
> +			     username);

perhaps the above 2 lines as one:

> +    email = talloc_asprintf (ctx, "%s@localhost", username);

LGTM in any way.

Tomi
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: