summaryrefslogtreecommitdiff
path: root/mailutils
diff options
context:
space:
mode:
authorDenys Vlasenko2018-07-31 17:36:31 +0200
committerDenys Vlasenko2018-07-31 17:36:31 +0200
commit884ea1c172f022c362a3d99b11dbd2f2443ab786 (patch)
tree2c5048639d2a92b0a59aa748299ea0703c179a37 /mailutils
parent8d634a08c4164da3a0d93caa9de825384e59d27d (diff)
downloadbusybox-884ea1c172f022c362a3d99b11dbd2f2443ab786.zip
busybox-884ea1c172f022c362a3d99b11dbd2f2443ab786.tar.gz
sendmail: code shrink 2
function old new delta sendmail_main 1366 1335 -31 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'mailutils')
-rw-r--r--mailutils/sendmail.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index 2fbceaa..7a4afb8 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -250,10 +250,8 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
OPT_S = 1 << 6, // specify connection string
OPT_a = 1 << 7, // authentication tokens
OPT_v = 1 << 8, // verbosity
- //--- from -am
- OPT_am_mask = 3 << 14, // AUTH method
- OPT_am_login = 0 << 14, // AUTH LOGIN (default)
- OPT_am_plain = 1 << 14, // AUTH PLAIN
+ //--- for -amMETHOD
+ OPT_am_plain = 1 << 9, // AUTH PLAIN
};
// init global variables
@@ -293,9 +291,11 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
if ('p' == a[0])
G.pass = xstrdup(a+1);
if ('m' == a[0]) {
- if (strcasecmp("plain", a+1) == 0)
+ if ((a[1] | 0x20) == 'p') // PLAIN
opts |= OPT_am_plain;
- else if (strcasecmp("login", a+1) != 0)
+ else if ((a[1] | 0x20) == 'l') // LOGIN
+ ; /* do nothing (this is the default) */
+ else
bb_error_msg_and_die("unsupported AUTH method %s", a+1);
}
}
@@ -357,10 +357,10 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
// perform authentication
if (opts & OPT_a) {
- // we must read credentials unless they are given via -a[up] options
+ // read credentials unless they are given via -a[up] options
if (!G.user || !G.pass)
get_cred_or_die(4);
- if ((opts & OPT_am_mask) == OPT_am_plain) {
+ if (opts & OPT_am_plain) {
char *plain_auth;
size_t user_len, pass_len;
user_len = strlen(G.user);
@@ -373,7 +373,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
plain_auth[1 + user_len] = '\0';
printbuf_base64(plain_auth, 1 + user_len + 1 + pass_len);
free(plain_auth);
- } else if ((opts & OPT_am_mask) == OPT_am_login) {
+ } else {
smtp_check("AUTH LOGIN", 334);
printstr_base64(G.user);
smtp_check("", 334);