#841 mod_auth_external: add support for calling scripts with arguments

Reporter Klaus
Owner Nobody
Created
Updated
Stars ★ (1)
Tags
  • Component-Community
  • Priority-Medium
  • Type-Enhancement
  • Status-Accepted
  1. Klaus on

    What steps will reproduce the problem? 1. Add e.g. `external_auth_command = "python /tmp/foo.py"` 2. Try to login What is the expected output? What do you see instead? I expect that `/tmp/foo.py` is passed as argument to `python`. Instead the complete string is called (execve[ "python /tmp/foo.py",...]). What version of the product are you using? On what operating system? Prosody 0.9.10 on Ubuntu 16.04.2 LTS Please provide any additional information below. A possible fix could be: 29a30,34 > local commands = {}; i = 1 > for c in string.gmatch(command, "%S+") do > commands[i] = c > i = i + 1 > end 61c66 < local ok, err = pty:startproc(command); --- > local ok, err = pty:startproc(unpack(commands)); 69c74,76 < pty:send(text); --- > sent = pty:send(text); > log("debug", "Sent %s bytes", sent or 0) >

  2. Klaus on

    Diff on github: https://github.com/jsxc/ejabberd-cloud-auth/commit/1c2748a5d7f9c58c3995ee7c89859797732b3c0f

  3. MattJ on

    Hi, thanks for the report and patch. Unfortunately this patch does not suffice, because simply splitting on spaces does not provide the correct result, e.g. when filenames with spaces are passed as arguments.

    Changes
    • tags Type-Enhancement Component-Community Status-Accepted
    • title mod_auth_external: script with arguments mod_auth_external: add support for calling scripts with arguments

New comment

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