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.
Showing
1 changed file
with
11 additions
and
13 deletions
... | @@ -352,19 +352,9 @@ read_mts_profile () | ... | @@ -352,19 +352,9 @@ read_mts_profile () |
352 | rc = mu_property_sget_value (mts_profile, "localdomain", &p); | 352 | rc = mu_property_sget_value (mts_profile, "localdomain", &p); |
353 | if (rc == 0) | 353 | if (rc == 0) |
354 | { | 354 | { |
355 | char *newdomain; | 355 | hostname = mu_realloc (hostname, strlen (hostname) + 1 + strlen (p) + 1); |
356 | 356 | strcat (hostname, "."); | |
357 | newdomain = mu_alloc (strlen (hostname) + 1 + strlen (p) + 1); | 357 | strcat (hostname, p); |
358 | strcpy (newdomain, hostname); | ||
359 | strcat (newdomain, "."); | ||
360 | strcat (newdomain, p); | ||
361 | rc = mu_set_user_email_domain (newdomain); | ||
362 | free (newdomain); | ||
363 | if (rc) | ||
364 | { | ||
365 | mu_error (_("cannot set user mail domain: %s"), mu_strerror (rc)); | ||
366 | exit (1); | ||
367 | } | ||
368 | } | 358 | } |
369 | else if (rc != MU_ERR_NOENT) | 359 | else if (rc != MU_ERR_NOENT) |
370 | { | 360 | { |
... | @@ -372,6 +362,14 @@ read_mts_profile () | ... | @@ -372,6 +362,14 @@ read_mts_profile () |
372 | "localdomain", rc); | 362 | "localdomain", rc); |
373 | exit (1); | 363 | exit (1); |
374 | } | 364 | } |
365 | |||
366 | rc = mu_set_user_email_domain (hostname); | ||
367 | free (hostname); | ||
368 | if (rc) | ||
369 | { | ||
370 | mu_error (_("cannot set user mail domain: %s"), mu_strerror (rc)); | ||
371 | exit (1); | ||
372 | } | ||
375 | 373 | ||
376 | rc = mu_property_sget_value (mts_profile, "username", &p); | 374 | rc = mu_property_sget_value (mts_profile, "username", &p); |
377 | if (rc == 0) | 375 | if (rc == 0) | ... | ... |
-
Please register or sign in to post a comment