aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-09-09 09:51:03 -0300
committerDavid Bremner <david@tethera.net>2021-09-10 08:17:06 -0300
commit060ff57642fc74f320761586e244151c04e63755 (patch)
tree98d7aa47a4da33904723d6c8085d1d042122cc1d /lib
parent63b7837e0d99cb37e518af20896987830435ada1 (diff)
lib: use 'localhost' rather than fqdn for default mail address.
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
Diffstat (limited to 'lib')
-rw-r--r--lib/config.cc16
1 files changed, 1 insertions, 15 deletions
diff --git a/lib/config.cc b/lib/config.cc
index 7ecc3c7b..8775b00a 100644
--- a/lib/config.cc
+++ b/lib/config.cc
@@ -543,25 +543,11 @@ _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);
talloc_free (username);
return email;