Commit f9a486e8 f9a486e8ff07e3f35e250d366e748c7f5e712c13 by Sergey Poznyakoff

Bugfixes.

* libproto/mailer/smtp.c (_smtp_set_rcpt): Assign rcpt_to a copy of the
recipient address.
* mail/util.c (util_header_expand): Make sure exp is always initialized.
* mh/send.c (main): Process mtstailor before checking input files, so
its settings affect creation of additional headers and adresses. In
particular, this allows for setting the sender address in mtstailor.
1 parent 4066c947
...@@ -338,7 +338,9 @@ _smtp_set_rcpt (struct _smtp_mailer *smp, mu_message_t msg, mu_address_t to) ...@@ -338,7 +338,9 @@ _smtp_set_rcpt (struct _smtp_mailer *smp, mu_message_t msg, mu_address_t to)
338 ("mu_mailer_send_message(): explicit to not valid")); 338 ("mu_mailer_send_message(): explicit to not valid"));
339 return status; 339 return status;
340 } 340 }
341 smp->rcpt_to = to; 341 smp->rcpt_to = mu_address_dup (to);
342 if (!smp->rcpt_to)
343 return ENOMEM;
342 344
343 if (status) 345 if (status)
344 return status; 346 return status;
......
...@@ -949,7 +949,9 @@ util_header_expand (mu_header_t *phdr) ...@@ -949,7 +949,9 @@ util_header_expand (mu_header_t *phdr)
949 if (mailvar_get (NULL, "inplacealiases", 949 if (mailvar_get (NULL, "inplacealiases",
950 mailvar_type_boolean, 0)) 950 mailvar_type_boolean, 0))
951 exp = alias_expand (p); 951 exp = alias_expand (p);
952 rc = mu_address_create (&new_addr, exp ? exp : p); 952 else
953 exp = p;
954 rc = mu_address_create (&new_addr, p);
953 if (rc) 955 if (rc)
954 { 956 {
955 errcnt++; 957 errcnt++;
......
...@@ -772,7 +772,9 @@ main (int argc, char **argv) ...@@ -772,7 +772,9 @@ main (int argc, char **argv)
772 opt_handler, NULL, &index); 772 opt_handler, NULL, &index);
773 773
774 mh_read_aliases (); 774 mh_read_aliases ();
775 775 /* Process the mtstailor file */
776 read_mts_profile ();
777
776 argc -= index; 778 argc -= index;
777 argv += index; 779 argv += index;
778 780
...@@ -823,10 +825,7 @@ main (int argc, char **argv) ...@@ -823,10 +825,7 @@ main (int argc, char **argv)
823 return 1; 825 return 1;
824 } 826 }
825 827
826 /* Process the mtstailor file and detach from the console if 828 /* Detach from the console if required */
827 required */
828 read_mts_profile ();
829
830 if (background && daemon (0, 0) < 0) 829 if (background && daemon (0, 0) < 0)
831 { 830 {
832 mu_error (_("cannot switch to background: %s"), mu_strerror (errno)); 831 mu_error (_("cannot switch to background: %s"), mu_strerror (errno));
......