unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] lib: use 'localhost' rather than fqdn for default mail address.
Date: Thu, 09 Sep 2021 23:09:41 +0300	[thread overview]
Message-ID: <m21r5x7bp6.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <20210909125103.215302-1-david@tethera.net>

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

      reply	other threads:[~2021-09-09 20:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05 22:35 Is default email address in notmuch setup / lib useful? David Bremner
2021-09-06 17:14 ` Alexander Adolf
2021-09-06 20:39   ` Tomi Ollila
2021-09-07  1:26     ` David Bremner
2021-09-07  7:57       ` Tomi Ollila
2021-09-09 12:51         ` [PATCH] lib: use 'localhost' rather than fqdn for default mail address David Bremner
2021-09-09 20:09           ` Tomi Ollila [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21r5x7bp6.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).