Commit 9b2c8192 9b2c81921aa7c32542db310c819586f81f0ed082 by Sergey Poznyakoff

Fix the use of localname and localdomain in ~/.mtstailor.

* mh/send.c (read_mts_profile): Fix the handling of
localname vs. localdomain.  The localname setting
used alone overrides the hostname as returned by
mu_hostname.  The value of localdomain, if set, is
appended to the hostname (eventually modified by
localname), with a "." as a separator.
1 parent 802150a1
Showing 1 changed file with 11 additions and 13 deletions
......@@ -352,19 +352,9 @@ read_mts_profile ()
rc = mu_property_sget_value (mts_profile, "localdomain", &p);
if (rc == 0)
{
char *newdomain;
newdomain = mu_alloc (strlen (hostname) + 1 + strlen (p) + 1);
strcpy (newdomain, hostname);
strcat (newdomain, ".");
strcat (newdomain, p);
rc = mu_set_user_email_domain (newdomain);
free (newdomain);
if (rc)
{
mu_error (_("cannot set user mail domain: %s"), mu_strerror (rc));
exit (1);
}
hostname = mu_realloc (hostname, strlen (hostname) + 1 + strlen (p) + 1);
strcat (hostname, ".");
strcat (hostname, p);
}
else if (rc != MU_ERR_NOENT)
{
......@@ -372,6 +362,14 @@ read_mts_profile ()
"localdomain", rc);
exit (1);
}
rc = mu_set_user_email_domain (hostname);
free (hostname);
if (rc)
{
mu_error (_("cannot set user mail domain: %s"), mu_strerror (rc));
exit (1);
}
rc = mu_property_sget_value (mts_profile, "username", &p);
if (rc == 0)
......