From urs at tin.org Fri Jan 3 13:21:40 2025 From: urs at tin.org (Urs =?UTF-8?Q?Jan=C3=9Fen?=) Date: Fri, 03 Jan 2025 13:21:40 +0100 Subject: [tin-dev] [ANNOUNCE] tin 2.6.4 released References: Message-ID: In Urs Jan?en wrote: > Just pushed the x-mas release with the following notable changes: This fixes the fallback to user at host when mail_address is unset (and no from is set via attributes). === modified file 'src/header.c' --- old/src/header.c 2024-12-15 14:03:16 +0000 +++ new/src/header.c 2025-01-03 07:32:02 +0000 @@ -288,16 +288,14 @@ { const char *fromhost = domain_name; - if (thisgrp && thisgrp->attribute->from && *thisgrp->attribute->from) { + if (thisgrp && thisgrp->attribute->from && *thisgrp->attribute->from && strchr(*thisgrp->attribute->from, '@')) strcpy(from_name, *thisgrp->attribute->from); - return; - } - - sprintf(from_name, ((strpbrk(get_full_name(), "!()<>@,;:\\\".[]")) ? "\"%s\" <%s@%s>" : "%s <%s@%s>"), BlankIfNull(get_full_name()), userid, BlankIfNull(fromhost)); + else + sprintf(from_name, ((strpbrk(get_full_name(), "!()<>@,;:\\\".[]")) ? "\"%s\" <%s@%s>" : "%s <%s@%s>"), BlankIfNull(get_full_name()), userid, BlankIfNull(fromhost)); #ifdef DEBUG if (debug & DEBUG_MISC) - error_message(2, "FROM=[%s] USER=[%s] HOST=[%s] NAME=[%s]", from_name, userid, domain_name, BlankIfNull(get_full_name())); + error_message(2, "FROM=[%s] USER=[%s] HOST=[%s] NAME=[%s]", from_name, userid, BlankIfNull(fromhost), BlankIfNull(get_full_name())); #endif /* DEBUG */ } === modified file 'src/pgp.c' --- old/src/pgp.c 2024-11-25 19:56:05 +0000 +++ new/src/pgp.c 2025-01-03 03:28:54 +0000 @@ -264,7 +264,7 @@ /* * is valid only when signing and a local address exists */ - if (CURR_GROUP.attribute->from != NULL && *CURR_GROUP.attribute->from) + if (CURR_GROUP.attribute->from != NULL && *CURR_GROUP.attribute->from && strchr(*CURR_GROUP.attribute->from, '@')) strip_name(*CURR_GROUP.attribute->from, mailfrom); switch (what) { @@ -305,7 +305,7 @@ char cmd[LEN], buf[LEN]; char keyfile[PATH_LEN], tmp[PATH_LEN]; - if (CURR_GROUP.attribute->from != NULL && *CURR_GROUP.attribute->from && **CURR_GROUP.attribute->from) + if (CURR_GROUP.attribute->from != NULL && *CURR_GROUP.attribute->from && strchr(*CURR_GROUP.attribute->from, '@')) strip_name(*CURR_GROUP.attribute->from, buf); else /* FIXME: avoid hardcoded length */ snprintf(buf, sizeof(buf), "%.*s@%.765s", LOGIN_NAME_MAX - 1, userid, BlankIfNull(get_host_name())); === modified file 'src/post.c' --- old/src/post.c 2024-12-22 17:30:48 +0000 +++ new/src/post.c 2025-01-03 12:19:25 +0000 @@ -2899,13 +2899,13 @@ # endif /* HAVE_CHMOD */ #endif /* HAVE_FCHMOD */ - get_from_name(from_name, group); #ifdef FORGERY if ((tmp2 = make_path_header())) { msg_add_header("Path", tmp2); free(tmp2); } #endif /* FORGERY */ + get_from_name(from_name, group); msg_add_header("From", from_name); msg_add_header("Subject", tinrc.default_post_subject); @@ -3686,14 +3686,14 @@ # endif /* HAVE_CHMOD */ #endif /* HAVE_FCHMOD */ +#ifdef FORGERY + if ((p = make_path_header())) { + msg_add_header("Path", p); + free(p); + } +#endif /* FORGERY */ group = group_find(groupname, FALSE); get_from_name(from_name, group); -#ifdef FORGERY - if ((p = make_path_header())) { - msg_add_header("Path", p); - free(p); - } -#endif /* FORGERY */ msg_add_header("From", from_name); { @@ -3903,7 +3903,7 @@ char from_buf[HEADER_LEN]; char *from_address; - if (curr_group && curr_group->attribute && curr_group->attribute->from && *curr_group->attribute->from) + if (curr_group && curr_group->attribute && curr_group->attribute->from && *curr_group->attribute->from && strchr(*curr_group->attribute->from, '@')) from_address = *curr_group->attribute->from; else /* i.e. called from select.c without any groups */ from_address = tinrc.mail_address; @@ -3913,8 +3913,7 @@ from_address = &from_buf[0]; } /* from_address is now always a valid pointer to a string */ - if (*from_address) - msg_add_header("From", from_address); + msg_add_header("From", from_address); msg_add_header("To", to); msg_add_header("Subject", subject); @@ -5434,9 +5433,9 @@ snprintf(outfile, sizeof(outfile), "%s.%ld", infile, (long) process_id); if ((fp_out = fopen(outfile, "w")) != NULL) { strcpy(from_name, "From: "); - if (tinrc.mail_address && *tinrc.mail_address) { /* FIXME: avoid hardcoded length */ + if (tinrc.mail_address && *tinrc.mail_address) /* FIXME: avoid hardcoded length */ snprintf(from_name + 6, sizeof(from_name) - 7, "%.1016s", tinrc.mail_address); - } else + else get_from_name(from_name + 6, (struct t_group *) 0); # ifdef DEBUG