From e5903596a0f6b078f5854ca591963e21c7f7328a Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 10 May 2019 15:18:56 +0100 Subject: [PATCH 1/1] 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 05f2545bc..a204b3784 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 1952d91a4..1aa32b269 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]: 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/]: 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 617c267a3..89ac87f94 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 6f01d9aae..dedc73d23 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 527865b62..a15ecdd5d 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 + normal@test.ex + +### alternate q + 0m sss 10HmaY-0005vi-00 + alternate@test.ex + 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 -- 2.30.2