code had grown into a monster and needed to be replaced.
trivial-rewrite/transport.c.
+20021121
+
+ Bugfix: garbage in "user@garbage"@domain address forms may
+ cause the SMTP or LMTP client to terminate with a fatal
+ error exit because garbage/tcp is not an existing service.
+ This cannot be abused to cause the SMTP or LMTP client to
+ send data into unauthorized ports. Files: *qmgr/qmgr_message.c,
+ trivial-rewrite/resolve.c.
+
Open problems:
Low: revise other local delivery agent duplicate filters.
* Patches change the patchlevel and the release date. Snapshots change the
* release date only, unless they include the same bugfix as a patch release.
*/
-#define MAIL_RELEASE_DATE "20021115"
+#define MAIL_RELEASE_DATE "20021124"
#define VAR_MAIL_VERSION "mail_version"
-#define DEF_MAIL_VERSION "1.1.11-" MAIL_RELEASE_DATE
+#define DEF_MAIL_VERSION "1.1.12-" MAIL_RELEASE_DATE
extern char *var_mail_version;
/*
/* After address resolution the recipient localpart contains further
/* routing information, so the resolved next-hop destination is not
/* the final destination.
+/* .IP RESOLVE_FLAG_ERROR
+/* The address resolved to something that has invalid syntax.
/* DIAGNOSTICS
/* Warnings: communication failure. Fatal error: mail system is down.
/* SEE ALSO
#define RESOLVE_FLAG_FINAL (1<<0) /* final delivery */
#define RESOLVE_FLAG_ROUTED (1<<1) /* routed destination */
+#define RESOLVE_FLAG_ERROR (1<<2) /* bad destination */
typedef struct RESOLVE_REPLY {
VSTRING *transport;
*/
if (var_sender_routing == 0) {
resolve_clnt_query(recipient->address, &reply);
+ if (reply.flags & RESOLVE_FLAG_ERROR) {
+ qmgr_bounce_recipient(message, recipient,
+ "bad address syntax: \"%s\"",
+ recipient->address);
+ continue;
+ }
} else {
resolve_clnt_query(message->sender, &reply);
+ if (reply.flags & RESOLVE_FLAG_ERROR) {
+ qmgr_bounce_recipient(message, recipient,
+ "bad address syntax: \"%s\"",
+ message->sender);
+ continue;
+ }
vstring_strcpy(reply.recipient, recipient->address);
}
if (message->filter_xport) {
postalias.o: ../../include/readlline.h
postalias.o: ../../include/stringops.h
postalias.o: ../../include/split_at.h
-postalias.o: ../../include/get_hostname.h
postalias.o: ../../include/vstring_vstream.h
postalias.o: ../../include/set_eugid.h
postalias.o: ../../include/tok822.h
*/
if (var_sender_routing == 0) {
resolve_clnt_query(recipient->address, &reply);
+ if (reply.flags & RESOLVE_FLAG_ERROR) {
+ qmgr_bounce_recipient(message, recipient,
+ "bad address syntax: \"%s\"",
+ recipient->address);
+ continue;
+ }
} else {
resolve_clnt_query(message->sender, &reply);
+ if (reply.flags & RESOLVE_FLAG_ERROR) {
+ qmgr_bounce_recipient(message, recipient,
+ "bad address syntax: \"%s\"",
+ message->sender);
+ continue;
+ }
vstring_strcpy(reply.recipient, recipient->address);
}
if (message->filter_xport) {
resolve.o: ../../include/vstream.h
resolve.o: ../../include/vstring_vstream.h
resolve.o: ../../include/split_at.h
+resolve.o: ../../include/valid_hostname.h
resolve.o: ../../include/mail_params.h
resolve.o: ../../include/mail_proto.h
resolve.o: ../../include/iostuff.h
#include <vstream.h>
#include <vstring_vstream.h>
#include <split_at.h>
+#include <valid_hostname.h>
/* Global library. */
vstring_strcpy(nexthop, destination);
else if (*var_relayhost)
vstring_strcpy(nexthop, var_relayhost);
- else
+ else {
tok822_internalize(nexthop, domain->next, TOK822_STR_DEFL);
+ if (STR(nexthop)[strspn(STR(nexthop), "[]0123456789.")] != 0
+ && valid_hostname(STR(nexthop), DONT_GRIPE) == 0)
+ *flags |= RESOLVE_FLAG_ERROR;
+ }
if (*STR(channel) == 0)
msg_fatal("null transport is not allowed: %s = %s",
VAR_DEF_TRANSPORT, var_def_transport);