]> dgit.raspbian.org Git - dovecot.git/commitdiff
[PATCH 3/5] lib-smtp: smtp-server - Expose smtp_server_connection_reply_immediate
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 7 May 2026 10:57:59 +0000 (10:57 +0000)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
The function already existed internally as a way to write a reply directly
to the output stream, bypassing the per-command reply queue. Make it part
of the public API so callers that need a reply on the wire before tearing
the connection down (where queued replies would otherwise be aborted) can
use it.

Gbp-Pq: Name 0003-lib-smtp-smtp-server-Expose-smtp_server_connection_r.patch

src/lib-smtp/smtp-server-private.h
src/lib-smtp/smtp-server.h

index e8cae543c392c478c4a19b0e590357740a93b92f..b3812fe9d5c34dec8a97398e76c89db04c60c6df 100644 (file)
@@ -323,9 +323,6 @@ void smtp_server_connection_reply_lines(struct smtp_server_connection *conn,
                                        unsigned int status,
                                        const char *enh_code,
                                        const char *const *text_lines);
-void smtp_server_connection_reply_immediate(
-       struct smtp_server_connection *conn, unsigned int status,
-       const char *fmt, ...) ATTR_FORMAT(3, 4);
 
 void smtp_server_connection_reset_state(struct smtp_server_connection *conn);
 void smtp_server_connection_set_state(struct smtp_server_connection *conn,
index 9f5bff51a2f18780c36fbbbeaf638d26f7b9bc93..be0c3d06bfd89d81260b381d75be8c8818ecb4bb 100644 (file)
@@ -477,6 +477,16 @@ void smtp_server_connection_set_ssl_streams(struct smtp_server_connection *conn,
 void smtp_server_connection_close(struct smtp_server_connection **_conn,
                                  const char *reason) ATTR_NULL(2);
 bool smtp_server_connection_is_closed(struct smtp_server_connection *conn);
+/* Send a reply line directly to the output stream, bypassing the per-command
+   reply queue. Useful when the caller is about to close the connection and
+   needs the reply on the wire before close/destroy aborts queued replies.
+   The formatted text must be a single line (no CR/LF); unlike
+   smtp_server_reply_add_text(), this function does not split on \n nor add
+   the SMTP continuation prefix to subsequent lines. */
+void smtp_server_connection_reply_immediate(struct smtp_server_connection *conn,
+                                           unsigned int status,
+                                           const char *fmt, ...)
+                                           ATTR_FORMAT(3, 4);
 void smtp_server_connection_terminate(struct smtp_server_connection **_conn,
                                      const char *enh_code, const char *reason)
                                      ATTR_NULL(3);