Implement the -am argument to allow choosing an AUTH method. For now only PLAIN and LOGIN are supported, but others can be added easily in the future. AUTH PLAIN required adding a new variant of encode_base64() capable of handling NUL characters in the input string; the old function is now a wrapper for the newer one. function old new delta encode_n_base64 - 236 +236 sendmail_main 1199 1380 +181 packed_usage 32873 32877 +4 encode_base64 242 36 -206 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/1 up/down: 421/-206) Total: 215 bytes Signed-off-by: Raffaello D. Di Napoli <rafdev@dinapo.li> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
39 lines
1.0 KiB
C
39 lines
1.0 KiB
C
/* vi: set sw=4 ts=4: */
|
|
/*
|
|
* helper routines
|
|
*
|
|
* Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
|
|
*
|
|
* Licensed under GPLv2, see file LICENSE in this source tree.
|
|
*/
|
|
|
|
struct globals {
|
|
pid_t helper_pid;
|
|
unsigned timeout;
|
|
unsigned verbose;
|
|
unsigned opts;
|
|
char *user;
|
|
char *pass;
|
|
FILE *fp0; // initial stdin
|
|
char *opt_charset;
|
|
};
|
|
|
|
#define G (*ptr_to_globals)
|
|
#define timeout (G.timeout )
|
|
#define verbose (G.verbose )
|
|
#define opts (G.opts )
|
|
#define INIT_G() do { \
|
|
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
|
|
G.opt_charset = (char *)CONFIG_FEATURE_MIME_CHARSET; \
|
|
} while (0)
|
|
|
|
//char FAST_FUNC *parse_url(char *url, char **user, char **pass);
|
|
|
|
void launch_helper(const char **argv) FAST_FUNC;
|
|
void get_cred_or_die(int fd) FAST_FUNC;
|
|
|
|
char *send_mail_command(const char *fmt, const char *param) FAST_FUNC;
|
|
|
|
void encode_base64(char *fname, const char *text, const char *eol) FAST_FUNC;
|
|
void encode_n_base64(char *fname, const char *text, size_t size, const char *eol) FAST_FUNC;
|