Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 postfix (3.5.25-0+deb11u1~sbp110+1) stable-email-dev; urgency=medium
 .
   * Stanford bullseye build.
Author: Lonlone Lee <lonlone@debuild.stanford.edu>

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2024-07-02

--- postfix-3.5.25.orig/src/smtp/Makefile.in
+++ postfix-3.5.25/src/smtp/Makefile.in
@@ -2,11 +2,11 @@ SHELL	= /bin/sh
 SRCS	= smtp.c smtp_connect.c smtp_proto.c smtp_chat.c smtp_session.c \
 	smtp_addr.c smtp_trouble.c smtp_state.c smtp_rcpt.c smtp_tls_policy.c \
 	smtp_sasl_proto.c smtp_sasl_glue.c smtp_reuse.c smtp_map11.c \
-	smtp_sasl_auth_cache.c smtp_key.c smtp_misc.c
+	smtp_sasl_auth_cache.c smtp_key.c smtp_misc.c smtp_unalias.c
 OBJS	= smtp.o smtp_connect.o smtp_proto.o smtp_chat.o smtp_session.o \
 	smtp_addr.o smtp_trouble.o smtp_state.o smtp_rcpt.o smtp_tls_policy.o \
 	smtp_sasl_proto.o smtp_sasl_glue.o smtp_reuse.o smtp_map11.o \
-	smtp_sasl_auth_cache.o smtp_key.o smtp_misc.o
+	smtp_sasl_auth_cache.o smtp_key.o smtp_misc.o smtp_unalias.o
 HDRS	= smtp.h smtp_sasl.h smtp_addr.h smtp_reuse.h smtp_sasl_auth_cache.h
 TESTSRC	= 
 DEFS	= -I. -I$(INC_DIR) -D$(SYSTYPE)
--- postfix-3.5.25.orig/src/smtp/smtp_misc.c
+++ postfix-3.5.25/src/smtp/smtp_misc.c
@@ -70,6 +70,7 @@
 void    smtp_rewrite_generic_internal(VSTRING *dst, const char *src)
 {
     vstring_strcpy(dst, src);
+    smtp_unalias_addr(dst, src); \
     if (*src && smtp_generic_maps)
 	smtp_map11_internal(dst, smtp_generic_maps,
 			    smtp_ext_prop_mask & EXT_PROP_GENERIC);
--- postfix-3.5.25.orig/src/smtp/smtp_unalias.c
+++ postfix-3.5.25/src/smtp/smtp_unalias.c
@@ -86,7 +86,7 @@ const char *smtp_unalias_name(const char
     if ((result = htable_find(cache, name)) == 0) {
 	fqdn = vstring_alloc(10);
 	if (dns_lookup_l(name, smtp_unalias_flags, (DNS_RR **) 0, fqdn,
-			     (VSTRING *) 0, DNS_REQ_FLAG_NONE, T_MX, T_A,
+			     (VSTRING *) 0, DNS_REQ_FLAG_STOP_OK, T_MX, T_A,
 #ifdef HAS_IPV6
 			     T_AAAA,
 #endif
