Sendmail+Fetchmail updated
Denys Vlasenko
vda.linux at googlemail.com
Fri Feb 8 18:24:20 UTC 2008
On Monday 04 February 2008 19:53, dronnikov at gmail.com wrote:
> Hello!
>
> Attached is hardly rewritten sendmail applet.
> It is now combined with new simple fetchmail applet
> which can pull remote mailboxes to the local Maildir.
>
> Sendmail supports both simple MAIL FROM and AUTH LOGIN authentication types.
> Fetchmail supports both USER/PASS and APOP authentication types.
>
> Still objsizes says sendmail.o is just about 3000 octets!
>
> Please, do test it and provide me with some feedback.
if ('s' == argv[0][0]) {
And if argv[0] == "/bin/sendmail"? Use applet_name instead.
// save initial stdin
xdup2(STDIN_FILENO, INITIAL_STDIN_FILENO);
// -f must be specified
// -t may be multiple
opt_complementary = "-1:f:t::";
options = "C:w:U:P:X" "t:f:ns:c:";
// FETCHMAIL
} else {
opt_after_connect = NULL;
opt_complementary = "=1:P";
options = "C:w:U:P:X" "tz";
}
unsigned opts = ...
In busybox we try to not mix declarations with statements.
Move "unsigned opts" above "if".
static void uuencode(char *fname, const char *text)
{
enum {
SRC_BUF_SIZE = 45, /* This *MUST* be a multiple of 3 */
DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3),
};
#define src_buf text
int fd;
#define len fd
char dst_buf[DST_BUF_SIZE + 1];
if (fname) {
fd = INITIAL_STDIN_FILENO;
if (NOT_LONE_DASH(fname))
fd = xopen(fname, O_RDONLY);
src_buf = bb_common_bufsiz1;
} else if (text) {
len = strlen(text);
} else
return;
"else return" seems to never trigger (you never call uuencode(NULL, NULL)).
Close fds, free strings regardless of FEATURE_CLEAN_UP
if you are in a loop or function -
theoretically you can have hundreds of attachments etc.
xopen(".lock", O_CREAT | O_WRONLY | O_TRUNC | O_EXCL)
Why? maildir format is (supposed to be) lock free?
nmsg = atoi(buf+4);
Unsafe. xatou(), xatoi_u() or bb_strtou()?
> Denys, please consider applying.
Applying with some changes. Please take a look, especially
at "loop thru messages" part.
--
vda
More information about the busybox
mailing list