#1365 "host admins" should be able to use mod_announce as well as "global admins"

Reporter yc
Owner Zash
Created
Updated
Stars ★ (1)
Tags
  • Milestone-0.11
  • Priority-Medium
  • Type-Defect
  • Status-Fixed
  • Patch
  1. yc on

    What steps will reproduce the problem? 1. Set `admins = { "a@b.com" }` in global context of prosody.cfg.lua 2. Client login with a@b.com can broadcast messages to online users of b.com 3. Set `admins = { "a@b.com" }` under `VirtualHost "b.com"` 4. Client login with a@b.com can't broadcast messages What is the expected output? "host admins" should also be able to use mod_announce as well as "global admins" What do you see instead? Log shows "b.com:announce warn Non-admin 'a@b.com/Psi+' tried to send server announcement" What version of the product are you using? On what operating system? 0.11.2, on debian 9.5 Please provide any additional information below. Maybe the following changes in mod_announce.lua ? ``` - if not is_admin(stanza.attr.from) then + if not is_admin(stanza.attr.from, host) then ```

  2. Zash on

    Thanks for the report. The suggested change looks sensible, would you like to submit a patch for it?

    Changes
    • tags Status-Accepted
  3. yc on

    Hello, patch generated by 'hg diff': ``` diff -r 4498f601516d plugins/mod_announce.lua --- a/plugins/mod_announce.lua Sun May 26 15:04:16 2019 +0200 +++ b/plugins/mod_announce.lua Mon May 27 11:35:20 2019 +0800 @@ -44,7 +44,7 @@ return; -- Not an announcement end - if not is_admin(stanza.attr.from) then + if not is_admin(stanza.attr.from, host) then -- Not an admin? Not allowed! module:log("warn", "Non-admin '%s' tried to send server announcement", stanza.attr.from); return; ``` Also uploaded it here: https://send.firefox.com/download/72f48501ce4e1881/#2za-8MjekJiyATElKjfMtg

  4. Zash on

    Thanks. Committed as https://hg.prosody.im/trunk/rev/1117138fa372

    Changes
    • tags Patch Milestone-0.11 Status-Fixed
    • owner Zash

New comment

Not published. Used for spam prevention and optional update notifications.