[exim-cvs] Implement -G => "control=suppress_local_fixups"

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Implement -G => "control=suppress_local_fixups"
Gitweb: http://git.exim.org/exim.git/commitdiff/f4ee74acd38ba15c920cf59af1a3ade933c7e14f
Commit:     f4ee74acd38ba15c920cf59af1a3ade933c7e14f
Parent:     a3fb9793861eb9c5ece5c37c08c5c519fe1e01b7
Author:     Phil Pennock <pdp@???>
AuthorDate: Sun Jun 3 20:27:59 2012 -0400
Committer:  Phil Pennock <pdp@???>
CommitDate: Sun Jun 3 20:27:59 2012 -0400


    Implement -G => "control=suppress_local_fixups"


    fixes bug 1117
---
 doc/doc-docbook/spec.xfpt |   15 +++++++++++++--
 doc/doc-txt/ChangeLog     |    5 ++++-
 doc/doc-txt/NewStuff      |    6 ++++++
 src/src/exim.c            |   23 ++++++++++++++++++++---
 src/src/globals.c         |    1 +
 src/src/globals.h         |    1 +
 src/src/receive.c         |    3 ++-
 src/src/smtp_in.c         |    2 +-
 8 files changed, 48 insertions(+), 8 deletions(-)


diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index 7652ce0..ee3193b 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 ea0b2a9..599c348 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 7b0da68..7efbe6e 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 8eb6022..f50cc08 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 d5cb6c1..fa7416e 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 c61158e..98b9a19 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 378bb8f..2c1b384 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 2b5cc26..9e7f04b 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;