summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Pennock <pdp@exim.org>2012-06-03 20:27:59 -0400
committerPhil Pennock <pdp@exim.org>2012-06-03 20:27:59 -0400
commitf4ee74acd38ba15c920cf59af1a3ade933c7e14f (patch)
treefe34f2acb7304b6469911b6a0c2252855a7c3f9d
parenta3fb9793861eb9c5ece5c37c08c5c519fe1e01b7 (diff)
Implement -G => "control=suppress_local_fixups"
fixes bug 1117
-rw-r--r--doc/doc-docbook/spec.xfpt15
-rw-r--r--doc/doc-txt/ChangeLog5
-rw-r--r--doc/doc-txt/NewStuff6
-rw-r--r--src/src/exim.c23
-rw-r--r--src/src/globals.c1
-rw-r--r--src/src/globals.h1
-rw-r--r--src/src/receive.c3
-rw-r--r--src/src/smtp_in.c2
8 files changed, 48 insertions, 8 deletions
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index 7652ce048..ee3193bef 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -3695,8 +3695,19 @@ if &%-f%& is also present, it overrides &"From&~"&.
.vitem &%-G%&
.oindex "&%-G%&"
-.cindex "Sendmail compatibility" "&%-G%& option ignored"
-This is a Sendmail option which is ignored by Exim.
+.cindex "submission fixups, suppressing (command-line)"
+.new
+This option is equivalent to an ACL applying:
+.code
+control = suppress_local_fixups
+.endd
+for every message received. Note that Sendmail will complain about such
+bad formatting, where Exim silently just does not fix it up. This may change
+in future.
+
+As this affects audit information, the caller must be a trusted user to use
+this option.
+.wen
.vitem &%-h%&&~<&'number'&>
.oindex "&%-h%&"
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index ea0b2a985..599c3486e 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -25,8 +25,11 @@ PP/06 Cyrus SASL: set local and remote IP;port properties for driver.
using channel bindings instead).
PP/07 Handle "exim -L <tag>" to indicate to use syslog with tag as the process
- name; added for Sendmail compatibility.
+ name; added for Sendmail compatibility; requires admin caller.
+ Handle -G as equivalent to "control = suppress_local_fixups" (we used to
+ just ignore it); requires trusted caller.
Also parse but ignore: -Ac -Am -X<logfile>
+ Bugzilla 1117.
Exim version 4.80
diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff
index 7b0da6854..7efbe6ef4 100644
--- a/doc/doc-txt/NewStuff
+++ b/doc/doc-txt/NewStuff
@@ -49,6 +49,12 @@ Version 4.81
Supported values depend upon system libraries. "exim -bI:dscp" to list the
ones Exim knows of. You can also set a raw number 0..0x3F.
+ 6. The -G command-line flag is no longer ignored; it is now equivalent to an
+ ACL setting "control = suppress_local_fixups". The -L command-line flag
+ is now accepted and forces use of syslog, with the provided tag as the
+ process name. A few other flags used by Sendmail are now accepted and
+ ignored.
+
Version 4.80
------------
diff --git a/src/src/exim.c b/src/src/exim.c
index 8eb602245..f50cc0814 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1434,6 +1434,7 @@ BOOL checking = FALSE;
BOOL count_queue = FALSE;
BOOL expansion_test = FALSE;
BOOL extract_recipients = FALSE;
+BOOL flag_G = FALSE;
BOOL flag_n = FALSE;
BOOL forced_delivery = FALSE;
BOOL f_end_dot = FALSE;
@@ -2507,11 +2508,12 @@ for (i = 1; i < argc; i++)
break;
/* -G: sendmail invocation to specify that it's a gateway submission and
- sendmail may complain about problems instead of fixing them. We might use
- it to disable submission mode fixups for command-line? Currently we just
- ignore it. */
+ sendmail may complain about problems instead of fixing them.
+ We make it equivalent to an ACL "control = suppress_local_fixups" and do
+ not at this time complain about problems. */
case 'G':
+ flag_G = TRUE;
break;
/* -h: Set the hop count for an incoming message. Exim does not currently
@@ -4055,6 +4057,21 @@ else
interface_port = check_port(interface_address);
}
+/* If the caller is trusted, then they can use -G to suppress_local_fixups. */
+if (flag_G)
+ {
+ if (trusted_caller)
+ {
+ suppress_local_fixups = suppress_local_fixups_default = TRUE;
+ DEBUG(D_acl) debug_printf("suppress_local_fixups forced on by -G\n");
+ }
+ else
+ {
+ fprintf(stderr, "exim: permission denied (-G requires a trusted user)\n");
+ return EXIT_FAILURE;
+ }
+ }
+
/* If an SMTP message is being received check to see if the standard input is a
TCP/IP socket. If it is, we assume that Exim was called from inetd if the
caller is root or the Exim user, or if the port is a privileged one. Otherwise,
diff --git a/src/src/globals.c b/src/src/globals.c
index d5cb6c15f..fa7416ed7 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1187,6 +1187,7 @@ uschar *submission_domain = NULL;
BOOL submission_mode = FALSE;
uschar *submission_name = NULL;
BOOL suppress_local_fixups = FALSE;
+BOOL suppress_local_fixups_default = FALSE;
BOOL synchronous_delivery = FALSE;
BOOL syslog_duplication = TRUE;
int syslog_facility = LOG_MAIL;
diff --git a/src/src/globals.h b/src/src/globals.h
index c61158e6d..98b9a1950 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -771,6 +771,7 @@ extern uschar *submission_domain; /* Domain for submission mode */
extern BOOL submission_mode; /* Can be forced from ACL */
extern uschar *submission_name; /* User name set from ACL */
extern BOOL suppress_local_fixups; /* Can be forced from ACL */
+extern BOOL suppress_local_fixups_default; /* former is reset to this; override with -G */
extern BOOL synchronous_delivery; /* TRUE if -odi is set */
extern BOOL syslog_duplication; /* FALSE => no duplicate logging */
extern int syslog_facility; /* As defined by Syslog.h */
diff --git a/src/src/receive.c b/src/src/receive.c
index 378bb8f3a..2c1b38499 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -1206,7 +1206,8 @@ Either a non-null list of recipients, or the extract flag will be true, or
both. The flag sender_local is true for locally generated messages. The flag
submission_mode is true if an ACL has obeyed "control = submission". The flag
suppress_local_fixups is true if an ACL has obeyed "control =
-suppress_local_fixups". The flag smtp_input is true if the message is to be
+suppress_local_fixups" or -G was passed on the command-line.
+The flag smtp_input is true if the message is to be
handled using SMTP conventions about termination and lines starting with dots.
For non-SMTP messages, dot_ends is true for dot-terminated messages.
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 2b5cc26d3..9e7f04b85 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -1032,7 +1032,7 @@ fake_response = OK; /* Can be set by ACL */
no_mbox_unspool = FALSE; /* Can be set by ACL */
#endif
submission_mode = FALSE; /* Can be set by ACL */
-suppress_local_fixups = FALSE; /* Can be set by ACL */
+suppress_local_fixups = suppress_local_fixups_default; /* Can be set by ACL */
active_local_from_check = local_from_check; /* Can be set by ACL */
active_local_sender_retain = local_sender_retain; /* Can be set by ACL */
sender_address = NULL;