extern uschar *event_raise(uschar *, const uschar *, uschar *);
extern void msg_event_raise(const uschar *, const address_item *);
#endif
+extern const uschar * exim_errstr(int);
extern void exim_exit(int);
extern void exim_nullstd(void);
extern void exim_setugid(uid_t, gid_t, BOOL, uschar *);
static uschar *file_path = US"";
-
+/* These should be kept in-step with the private delivery error
+number definitions in macros.h */
+
+static const uschar * exim_errstrings[] = {
+ US"",
+ US"unknown error",
+ US"user slash",
+ US"exist race",
+ US"not regular",
+ US"not directory",
+ US"bad ugid",
+ US"bad mode",
+ US"inode changed",
+ US"lock failed",
+ US"bad address2",
+ US"forbid pipe",
+ US"forbid file",
+ US"forbid reply",
+ US"missing pipe",
+ US"missing file",
+ US"missing reply",
+ US"bad redirect",
+ US"smtp closed",
+ US"smtp format",
+ US"spool format",
+ US"not absolute",
+ US"Exim-imposed quota",
+ US"held",
+ US"Delivery filter process failure",
+ US"Delivery add/remove header failure",
+ US"Delivery write incomplete error",
+ US"Some expansion failed",
+ US"Failed to get gid",
+ US"Failed to get uid",
+ US"Unset or non-existent transport",
+ US"MBX length mismatch",
+ US"Lookup failed routing or in smtp tpt",
+ US"Can't match format in appendfile",
+ US"Creation outside home in appendfile",
+ US"Can't check a list; lookup defer",
+ US"DNS lookup defer",
+ US"Failed to start TLS session",
+ US"Mandatory TLS session not started",
+ US"Failed to chown a file",
+ US"Failed to create a pipe",
+ US"When verifying",
+ US"When required by client",
+ US"Used internally in smtp transport",
+ US"RCPT gave 4xx error",
+ US"MAIL gave 4xx error",
+ US"DATA gave 4xx error",
+ US"Negotiation failed for proxy configured host",
+ US"Authenticator 'other' failure",
+ US"target not supporting SMTPUTF8",
+ US"",
+
+ US"Not time for routing",
+ US"Not time for local delivery",
+ US"Not time for any remote host",
+ US"Local-only delivery",
+ US"Domain in queue_domains",
+ US"Transport concurrency limit",
+};
+
+
+/************************************************/
+const uschar *
+exim_errstr(int err)
+{
+return errno < 0 ? exim_errstrings[-err] : CUS strerror(err);
+}
/*************************************************
* Write to syslog *
#define LOGGING(opt) BIT_TEST(log_selector, log_selector_size, Li_##opt)
/* Private error numbers for delivery failures, set negative so as not
-to conflict with system errno values. */
+to conflict with system errno values. Take care to maintain the string
+table exim_errstrings[] in log.c */
#define ERRNO_UNKNOWNERROR (-1)
#define ERRNO_USERSLASH (-2)
#define ERRNO_QUEUE_DOMAIN (-55) /* Domain in queue_domains */
#define ERRNO_TRETRY (-56) /* Transport concurrency limit */
+
+
/* Special actions to take after failure or deferment. */
enum {
*q = '\0';
/* Chomp raw header. The final newline must not be added to the signature. */
-q--;
-while (q > sig->rawsig_no_b_val && (*q == '\r' || *q == '\n'))
- *q = '\0'; q--; /*XXX questionable code layout; possible bug */
+while (--q > sig->rawsig_no_b_val && (*q == '\r' || *q == '\n'))
+ *q = '\0';
DEBUG(D_acl)
{
error_block eblock;
eblock.next = NULL;
eblock.text1 = text1;
+ eblock.text2 = US"";
if (!moan_to_sender(errcode, &eblock, hptr, f, FALSE))
error_rc = EXIT_FAILURE;
}
-else fprintf(stderr, "exim: %s%s\n", text2, text1); /* Sic */
+else
+ fprintf(stderr, "exim: %s%s\n", text2, text1); /* Sic */
(void)fclose(f);
exim_exit(error_rc);
}
{
if (verify != v_none) goto ROUTED;
addr->message = string_sprintf("error in %s router: no host(s) specified "
- "for domain %s", rblock->name, domain);
+ "for domain %s", rblock->name, addr->domain);
log_write(0, LOG_MAIN, "%s", addr->message);
return DEFER;
}
}
else
{
- log_write(0, LOG_MAIN, "%s %s", message, strerror(addr->basic_errno));
- deliver_msglog("%s %s %s\n", tod_stamp(tod_log), message,
- strerror(addr->basic_errno));
+ const uschar * s = exim_errstr(addr->basic_errno);
+ log_write(0, LOG_MAIN, "%s %s", message, s);
+ deliver_msglog("%s %s %s\n", tod_stamp(tod_log), message, s);
}
}
static void
msglog_line(host_item * host, uschar * message)
{
- deliver_msglog("%s H=%s [%s] %s\n", tod_stamp(tod_log),
- host->name, host->address, message);
+deliver_msglog("%s H=%s [%s] %s\n", tod_stamp(tod_log),
+ host->name, host->address, message);
}
LOG: MAIN
- error in r1 router: no host(s) specified for domain *
+ error in r1 router: no host(s) specified for domain test.ex
-userx@test.ex cannot be resolved at this time: error in r1 router: no host(s) specified for domain *
+userx@test.ex cannot be resolved at this time: error in r1 router: no host(s) specified for domain test.ex
userx@test.ex cannot be resolved at this time: lookup failed for all hosts in r1 router: host_find_failed=ignore host_all_ignored=defer
userx@test.ex cannot be resolved at this time: lookup failed for all hosts in r1 router: host_find_failed=ignore host_all_ignored=defer
userx@test.ex