diff options
-rw-r--r-- | mailutils/sendmail.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c index 2fbceaad2..7a4afb835 100644 --- a/mailutils/sendmail.c +++ b/mailutils/sendmail.c | |||
@@ -250,10 +250,8 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) | |||
250 | OPT_S = 1 << 6, // specify connection string | 250 | OPT_S = 1 << 6, // specify connection string |
251 | OPT_a = 1 << 7, // authentication tokens | 251 | OPT_a = 1 << 7, // authentication tokens |
252 | OPT_v = 1 << 8, // verbosity | 252 | OPT_v = 1 << 8, // verbosity |
253 | //--- from -am | 253 | //--- for -amMETHOD |
254 | OPT_am_mask = 3 << 14, // AUTH method | 254 | OPT_am_plain = 1 << 9, // AUTH PLAIN |
255 | OPT_am_login = 0 << 14, // AUTH LOGIN (default) | ||
256 | OPT_am_plain = 1 << 14, // AUTH PLAIN | ||
257 | }; | 255 | }; |
258 | 256 | ||
259 | // init global variables | 257 | // init global variables |
@@ -293,9 +291,11 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) | |||
293 | if ('p' == a[0]) | 291 | if ('p' == a[0]) |
294 | G.pass = xstrdup(a+1); | 292 | G.pass = xstrdup(a+1); |
295 | if ('m' == a[0]) { | 293 | if ('m' == a[0]) { |
296 | if (strcasecmp("plain", a+1) == 0) | 294 | if ((a[1] | 0x20) == 'p') // PLAIN |
297 | opts |= OPT_am_plain; | 295 | opts |= OPT_am_plain; |
298 | else if (strcasecmp("login", a+1) != 0) | 296 | else if ((a[1] | 0x20) == 'l') // LOGIN |
297 | ; /* do nothing (this is the default) */ | ||
298 | else | ||
299 | bb_error_msg_and_die("unsupported AUTH method %s", a+1); | 299 | bb_error_msg_and_die("unsupported AUTH method %s", a+1); |
300 | } | 300 | } |
301 | } | 301 | } |
@@ -357,10 +357,10 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) | |||
357 | 357 | ||
358 | // perform authentication | 358 | // perform authentication |
359 | if (opts & OPT_a) { | 359 | if (opts & OPT_a) { |
360 | // we must read credentials unless they are given via -a[up] options | 360 | // read credentials unless they are given via -a[up] options |
361 | if (!G.user || !G.pass) | 361 | if (!G.user || !G.pass) |
362 | get_cred_or_die(4); | 362 | get_cred_or_die(4); |
363 | if ((opts & OPT_am_mask) == OPT_am_plain) { | 363 | if (opts & OPT_am_plain) { |
364 | char *plain_auth; | 364 | char *plain_auth; |
365 | size_t user_len, pass_len; | 365 | size_t user_len, pass_len; |
366 | user_len = strlen(G.user); | 366 | user_len = strlen(G.user); |
@@ -373,7 +373,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) | |||
373 | plain_auth[1 + user_len] = '\0'; | 373 | plain_auth[1 + user_len] = '\0'; |
374 | printbuf_base64(plain_auth, 1 + user_len + 1 + pass_len); | 374 | printbuf_base64(plain_auth, 1 + user_len + 1 + pass_len); |
375 | free(plain_auth); | 375 | free(plain_auth); |
376 | } else if ((opts & OPT_am_mask) == OPT_am_login) { | 376 | } else { |
377 | smtp_check("AUTH LOGIN", 334); | 377 | smtp_check("AUTH LOGIN", 334); |
378 | printstr_base64(G.user); | 378 | printstr_base64(G.user); |
379 | smtp_check("", 334); | 379 | smtp_check("", 334); |