Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
sendmail: add -bv flag
To:
op@openbsd.org
Cc:
OpenBSD tech <tech@openbsd.org>
Date:
Mon, 03 Feb 2025 23:13:11 +0100

Download raw body.

Thread
Omar,

I'd like to add -bv flags to sendmail wrapper which is well known as a way
to validata email address.

Right now I need it to add a custom email to calendar(1), but it can be
quite useful by its own.

What do think?

Index: usr.sbin/smtpd/enqueue.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/smtpd/enqueue.c,v
diff -u -p -r1.126 enqueue.c
--- usr.sbin/smtpd/enqueue.c	21 Nov 2024 13:26:25 -0000	1.126
+++ usr.sbin/smtpd/enqueue.c	3 Feb 2025 12:41:22 -0000
@@ -172,7 +172,7 @@ qp_encoded_write(FILE *fp, char *buf)
 int
 enqueue(int argc, char *argv[], FILE *ofp)
 {
-	int			 i, ch, tflag = 0;
+	int			 i, ch, tflag = 0, validate_rcpt = 0;
 	char			*fake_from = NULL, *buf = NULL;
 	struct passwd		*pw;
 	FILE			*fp = NULL, *fout;
@@ -220,10 +220,13 @@ enqueue(int argc, char *argv[], FILE *of
 		case 'V':
 			msg.dsn_envid = optarg;
 			break;
+		case 'b':
+			if (optarg[0] == 'v')
+				validate_rcpt = 1;
+			break;
 		/* all remaining: ignored, sendmail compat */
 		case 'A':
 		case 'B':
-		case 'b':
 		case 'E':
 		case 'e':
 		case 'i':
@@ -340,6 +343,9 @@ enqueue(int argc, char *argv[], FILE *of
 		if (!get_responses(fout, 1))
 			goto fail;
 	}
+
+	if (validate_rcpt)
+		exit(EX_OK);
 
 	if (!send_line(fout, verbose, "DATA\r\n"))
 		goto fail;


-- 
wbr, Kirill