From fba2f2d7faeecf0522eb2d4150e6ac5edbd3fdb5 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 9 Jun 2018 10:01:17 +0000 Subject: [PATCH] parse SIZE advertisement --- usr.sbin/smtpd/smtp_client.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/usr.sbin/smtpd/smtp_client.c b/usr.sbin/smtpd/smtp_client.c index 6ea6be70bf5..289ff3b2441 100644 --- a/usr.sbin/smtpd/smtp_client.c +++ b/usr.sbin/smtpd/smtp_client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_client.c,v 1.4 2018/05/24 11:01:30 eric Exp $ */ +/* $OpenBSD: smtp_client.c,v 1.5 2018/06/09 10:01:17 eric Exp $ */ /* * Copyright (c) 2018 Eric Faurot @@ -73,6 +73,7 @@ enum { #define SMTP_EXT_AUTH_PLAIN 0x08 #define SMTP_EXT_AUTH_LOGIN 0x10 #define SMTP_EXT_DSN 0x20 +#define SMTP_EXT_SIZE 0x40 struct smtp_client { void *tag; @@ -81,6 +82,7 @@ struct smtp_client { int state; int flags; int ext; + size_t ext_size; struct io *io; char *reply; @@ -645,6 +647,7 @@ smtp_client_io(struct io *io, int evt, void *arg) static int smtp_client_readline(struct smtp_client *proto) { + const char *e; size_t len; char *line, *msg, *p; int cont; @@ -702,6 +705,11 @@ smtp_client_readline(struct smtp_client *proto) proto->ext |= SMTP_EXT_PIPELINING; else if (strcmp(msg, "DSN") == 0) proto->ext |= SMTP_EXT_DSN; + else if (strncmp(msg, "SIZE ", 5) == 0) { + proto->ext_size = strtonum(msg + 5, 0, SIZE_T_MAX, &e); + if (e == NULL) + proto->ext |= SMTP_EXT_SIZE; + } } if (smtp_client_replycat(proto, line) == -1) { -- 2.20.1