Hi All,
Busybox 1.12.2 sendmail has port 25 hardcoded and does not parse the port
specified in the -H option. The attached patch adds parsing the port from the
-H option (if specified); otherwise, defaults to port 25.
Also, sendmail was using the data from the -f option when checking the 250
response. I believe this should be the server specified in the -H option.
Regards,
...doug
diff -uraN busybox-1.12.2.orig/networking/sendmail.c busybox-1.12.2/networking/sendmail.c
--- busybox-1.12.2.orig/networking/sendmail.c 2008-09-28 13:04:11.000000000 -0500
+++ busybox-1.12.2/networking/sendmail.c 2009-01-05 21:42:01.000000000 -0600
@@ -256,7 +256,7 @@
#endif
// NB: parse_url can modify url[] (despite const), but only if '@' is there
-static const char *parse_url(const char *url, const char **user, const char **pass)
+static const char *parse_url(const char *url, const char **user, const char **pass, int *port)
{
// parse [user[:pa...@]host
// return host
@@ -272,6 +272,12 @@
*pass = s;
}
}
+
+ s = strchr(url, ':');
+ if (s) {
+ *s++ = '\0';
+ *port = atoi(s);
+ }
return url;
}
@@ -307,6 +313,7 @@
};
const char *options;
int opts;
+ int port = 25;
// init global variables
INIT_G();
@@ -345,7 +352,7 @@
// fetch username and password, if any
// NB: parse_url modifies opt_connect[] ONLY if '@' is there.
// Thus "127.0.0.1" won't be modified, an is ok that it is RO.
- opt_connect = parse_url(opt_connect, &opt_user, &opt_pass);
+ opt_connect = parse_url(opt_connect, &opt_user, &opt_pass, &port);
// bb_error_msg("H[%s] U[%s] P[%s]", opt_connect, opt_user, opt_pass);
// username must be defined!
@@ -361,7 +368,7 @@
// no SSL ordered? ->
} else {
// ... make plain connect
- int fd = create_and_connect_stream_or_die(opt_connect, 25);
+ int fd = create_and_connect_stream_or_die(opt_connect, port);
// make ourselves a simple IO filter
// from now we know nothing about network :)
xmove_fd(fd, STDIN_FILENO);
@@ -399,8 +406,8 @@
}
// we should start with modern EHLO
- if (250 != smtp_checkp("EHLO %s", sane(opt_from), -1)) {
- smtp_checkp("HELO %s", opt_from, 250);
+ if (250 != smtp_checkp("EHLO %s", sane(opt_connect), -1)) {
+ smtp_checkp("HELO %s", opt_connect, 250);
}
// set sender
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox