[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 107/282: smtp: Simplify the MAIL command and avoid a duplication
From: |
gnunet |
Subject: |
[gnurl] 107/282: smtp: Simplify the MAIL command and avoid a duplication of send strings |
Date: |
Wed, 01 Apr 2020 14:29:32 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 0b8651d48bb70605ef2b0b6563e5becd09104ea6
Author: Steve Holme <address@hidden>
AuthorDate: Sun Feb 9 15:50:57 2020 +0000
smtp: Simplify the MAIL command and avoid a duplication of send strings
This avoids the duplication of strings when the optional AUTH and SIZE
parameters are required. It also assists with the modifications that
are part of #4892.
Closes #4903
---
lib/smtp.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/lib/smtp.c b/lib/smtp.c
index 764a1b75e..7bcff0ce7 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -584,18 +584,13 @@ static CURLcode smtp_perform_mail(struct connectdata
*conn)
}
/* Send the MAIL command */
- if(!auth && !size)
- result = Curl_pp_sendf(&conn->proto.smtpc.pp,
- "MAIL FROM:%s", from);
- else if(auth && !size)
- result = Curl_pp_sendf(&conn->proto.smtpc.pp,
- "MAIL FROM:%s AUTH=%s", from, auth);
- else if(auth && size)
- result = Curl_pp_sendf(&conn->proto.smtpc.pp,
- "MAIL FROM:%s AUTH=%s SIZE=%s", from, auth, size);
- else
- result = Curl_pp_sendf(&conn->proto.smtpc.pp,
- "MAIL FROM:%s SIZE=%s", from, size);
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp,
+ "MAIL FROM:%s%s%s%s%s",
+ from, /* Mandatory */
+ auth ? " AUTH=" : "", /* Optional (on AUTH support) */
+ auth ? auth : "",
+ size ? " SIZE=" : "", /* Optional (on SIZE support) */
+ size ? size : "");
free(from);
free(auth);
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 95/282: contrithanks: Use the most recent tag by default, (continued)
- [gnurl] 95/282: contrithanks: Use the most recent tag by default, gnunet, 2020/04/01
- [gnurl] 101/282: checksrc.bat: Fix not being able to run script from the main curl directory, gnunet, 2020/04/01
- [gnurl] 103/282: github: Instructions to post "uname -a" on Unix systems in issues, gnunet, 2020/04/01
- [gnurl] 94/282: scripts: use last set tag if none given, gnunet, 2020/04/01
- [gnurl] 98/282: ftp: remove superfluous checking for crlf in user or pwd, gnunet, 2020/04/01
- [gnurl] 105/282: url: Include the failure reason when curl_win32_idn_to_ascii() fails, gnunet, 2020/04/01
- [gnurl] 100/282: digest: Do not quote algorithm in HTTP authorisation, gnunet, 2020/04/01
- [gnurl] 106/282: altsvc: keep a copy of the file name to survive handle reset, gnunet, 2020/04/01
- [gnurl] 112/282: multi: fix outdated comment, gnunet, 2020/04/01
- [gnurl] 113/282: strerror: Increase STRERROR_LEN 128 -> 256, gnunet, 2020/04/01
- [gnurl] 107/282: smtp: Simplify the MAIL command and avoid a duplication of send strings,
gnunet <=
- [gnurl] 111/282: easy: remove dead code, gnunet, 2020/04/01
- [gnurl] 108/282: RELEASE-NOTES: synced, gnunet, 2020/04/01
- [gnurl] 120/282: CURLINFO_COOKIELIST.3: Fix example, gnunet, 2020/04/01
- [gnurl] 121/282: ftp: convert 'sock_accepted' to a plain boolean, gnunet, 2020/04/01
- [gnurl] 116/282: tool_home: Fix the copyright year being out of date, gnunet, 2020/04/01
- [gnurl] 114/282: strerror.h: Copyright year out of date, gnunet, 2020/04/01
- [gnurl] 115/282: tool_homedir: Change GetEnv() to use libcurl's curl_getenv(), gnunet, 2020/04/01
- [gnurl] 118/282: TODO: CURLOPT_SSL_CTX_FUNCTION for LDAPS, gnunet, 2020/04/01
- [gnurl] 126/282: rename: a new file for Curl_rename(), gnunet, 2020/04/01
- [gnurl] 124/282: RELEASE-NOTES: synced, gnunet, 2020/04/01