[exim-cvs] Fix listing a named queue by a non-admin user. Bu…

Inizio della pagina
Delete this message
Reply to this message
Autore: Exim Git Commits Mailing List
Data:  
To: exim-cvs
Oggetto: [exim-cvs] Fix listing a named queue by a non-admin user. Bug 2398
Gitweb: https://git.exim.org/exim.git/commitdiff/e5903596a0f6b078f5854ca591963e21c7f7328a
Commit:     e5903596a0f6b078f5854ca591963e21c7f7328a
Parent:     345f272404cb1c454b7602214c76fd0ebf04d66e
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Fri May 10 15:18:56 2019 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri May 10 15:33:49 2019 +0100


    Fix listing a named queue by a non-admin user.  Bug 2398
---
 doc/doc-txt/ChangeLog        |  4 ++++
 src/src/exim.c               | 25 +++++++++++++------------
 src/src/queue.c              |  7 ++++---
 test/scripts/0000-Basic/0576 | 10 ++++++++++
 test/stdout/0576             | 12 ++++++++++++
 5 files changed, 43 insertions(+), 15 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 05f2545..a204b37 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -94,6 +94,10 @@ JH/17 OpenSSL: the default openssl_options now disables ssl_v3.
 JH/18 GnuTLS: fix $tls_out_ocsp under hosts_request_ocsp. Previously the
       verification result was not updated unless hosts_require_ocsp applied.


+JH/19 Bug 2398: fix listing of a named-queue.  Previously, even with the option
+      queue_list_requires_admin set to false, non-admin users were denied the
+      facility.
+


 Exim version 4.92
 -----------------
diff --git a/src/src/exim.c b/src/src/exim.c
index 1952d91..1aa32b2 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -3193,22 +3193,23 @@ for (i = 1; i < argc; i++)
     /* -q[f][f][l][G<name>]: Run the queue, optionally forced, optionally local
     only, optionally named, optionally starting from a given message id. */


-    if (*argrest == 0 &&
-        (i + 1 >= argc || argv[i+1][0] == '-' || mac_ismsgid(argv[i+1])))
-      {
-      queue_interval = 0;
-      if (i+1 < argc && mac_ismsgid(argv[i+1]))
-        start_queue_run_id = argv[++i];
-      if (i+1 < argc && mac_ismsgid(argv[i+1]))
-        stop_queue_run_id = argv[++i];
-      }
+    if (!(list_queue || count_queue))
+      if (*argrest == 0
+     && (i + 1 >= argc || argv[i+1][0] == '-' || mac_ismsgid(argv[i+1])))
+    {
+    queue_interval = 0;
+    if (i+1 < argc && mac_ismsgid(argv[i+1]))
+      start_queue_run_id = argv[++i];
+    if (i+1 < argc && mac_ismsgid(argv[i+1]))
+      stop_queue_run_id = argv[++i];
+    }


     /* -q[f][f][l][G<name>/]<n>: Run the queue at regular intervals, optionally
     forced, optionally local only, optionally named. */


-    else if ((queue_interval = readconf_readtime(*argrest ? argrest : argv[++i],
-                        0, FALSE)) <= 0)
-      exim_fail("exim: bad time value %s: abandoned\n", argv[i]);
+      else if ((queue_interval = readconf_readtime(*argrest ? argrest : argv[++i],
+                          0, FALSE)) <= 0)
+    exim_fail("exim: bad time value %s: abandoned\n", argv[i]);
     break;



diff --git a/src/src/queue.c b/src/src/queue.c
index 617c267..89ac87f 100644
--- a/src/src/queue.c
+++ b/src/src/queue.c
@@ -778,11 +778,12 @@ Argument:    points to the tree node
 Returns:     nothing
 */


-static void queue_list_extras(tree_node *p)
+static void
+queue_list_extras(tree_node *p)
 {
-if (p->left != NULL) queue_list_extras(p->left);
+if (p->left) queue_list_extras(p->left);
 if (!p->data.val) printf("       +D %s\n", p->name);
-if (p->right != NULL) queue_list_extras(p->right);
+if (p->right) queue_list_extras(p->right);
 }



diff --git a/test/scripts/0000-Basic/0576 b/test/scripts/0000-Basic/0576
index 6f01d9a..dedc73d 100644
--- a/test/scripts/0000-Basic/0576
+++ b/test/scripts/0000-Basic/0576
@@ -22,6 +22,13 @@ foo
 QUIT
 ****
 #
+### default q
+exim -bp
+****
+### alternate q
+exim -bp -qGalternate
+****
+#
 exim -qq
 ****
 #
@@ -63,3 +70,6 @@ QUIT
 # 
 sudo mv DIR/spool/alternate/input/* DIR/spool/input/
 exim -q
+****
+#
+no_stderr_check
diff --git a/test/stdout/0576 b/test/stdout/0576
index 527865b..a15ecdd 100644
--- a/test/stdout/0576
+++ b/test/stdout/0576
@@ -9,6 +9,14 @@
 354 Enter message, ending with "." on a line by itself
 250 OK id=10HmaY-0005vi-00
 221 the.local.host.name closing connection
+### default q
+ 0m   sss 10HmaX-0005vi-00 <CALLER@???>
+          normal@???
+
+### alternate q
+ 0m   sss 10HmaY-0005vi-00 <CALLER@???>
+          alternate@???
+
 220 the.local.host.name ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
 250 OK
 250 Accepted
@@ -21,3 +29,7 @@
 354 Enter message, ending with "." on a line by itself
 250 OK id=10HmbA-0005vi-00
 221 the.local.host.name closing connection
+
+******** SERVER ********
+### default q
+### alternate q