On Monday 02 March 2009 07:08:13 pm Vladimir Dronnikov wrote:
> Hi!
>
> >
> > Is it possible to use port 465? Port 25 sometimes is blocked by ISPs.
> >
>
> The port here is processed by openssl. I think nothing makes 465 unusable...
I meant "can you give me a working example?"
I am trying to document the usage of -H in the help text,
as it currently does not exist. C code is not a documentation,
you yourself do not read your mail client's source in order to
start using it, don't you?
> >> You'll be prompted for password, or you can pass you credentials (two
> >> lines file: username, password) to fd 4 like:
> >
> > Why username/password is passed through fd 4? I don't see where that
> > happens.
> > Is it a openssl's feature? I tried to google for that but so far failed.
>
> It is read by sendmail by:
> get_cred_or_die(4);
>
> The rationale is to keep sendmail session fully automatable, without
> user interaction.
So it happens here:
while (250 != smtp_checkp("MAIL FROM:<%s>", opt_from, code)) {
// MAIL FROM failed -> authentication needed
if (334 == smtp_check("AUTH LOGIN", -1)) {
// we must read credentials
get_cred_or_die(4);
Why do you use fd #4? Why not at least #3? Is it already taken by something?
And here we have some buggy code with misleading comments:
void FAST_FUNC get_cred_or_die(int fd)
{
// either from TTY
if (isatty(fd)) {
G.user = xstrdup(bb_ask_stdin("User: "));
G.pass = xstrdup(bb_ask_stdin("Password: "));
// or from STDIN
} else {
FILE *fp = fdopen(fd, "r");
G.user = xmalloc_fgetline(fp);
G.pass = xmalloc_fgetline(fp);
fclose(fp);
}
if (!G.user || !*G.user || !G.pass || !*G.pass)
bb_error_msg_and_die("no username or password");
}
I am going to fix it up like this:
void FAST_FUNC get_cred_or_die(int fd)
{
if (isatty(fd)) {
G.user = xstrdup(bb_ask(fd, /* timeout: */ 0, "User: "));
G.pass = xstrdup(bb_ask(fd, /* timeout: */ 0, "Password: "));
} else {
G.user = xmalloc_reads(fd, /* pfx: */ NULL, /* maxsize: */
NULL);
G.pass = xmalloc_reads(fd, /* pfx: */ NULL, /* maxsize: */
NULL);
}
if (!G.user || !*G.user || !G.pass)
bb_error_msg_and_die("no username or password");
}
Let me know if you spot any problems.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox