ejabberd_xmlrpc module doesn't work with auth

Hi, I have this in my config file:

  {4560, ejabberd_xmlrpc, [{maxsessions, 10}, {timeout, 5000},
                           {access_commands, [{all, all, []}]}]}

and it works with ejabberd or python XMLPRC client without auth, but when I use auth it fails with a "error -112: unknown call".

For example, python XMLRPC client:

import xmlrpclib
server_url = 'http://localhost:4560';
server = xmlrpclib.Server(server_url);
params = {}
params["user"] = "admin1"
params["host"] = "domain.com"
params["password"] = "my_pass"

without password:

print server.echothis('hola')
hola

with password:

print server.echothis(params,'hola')
...
xmlrpclib.Fault: <Fault -112: 'Error -112\nUnknown call: {call,echothis,\n                    [{struct,[{host,"domain.com"},\n                              {password,"pass"},\n                              {user,"admin1"}]},\n                     "hola"]}'>

Maybe the problem is in auth itself but when I log in to XMPP server with admin1@domain.com and pass: my_pass I can register, then it is correct, isn't it?

Anybody knows what is wrong???

Thanks in advance.
Oriol Rius

The documentation says: 5.

The documentation says:

5. Note: if ejabberd_xmlrpc has the option 'access_commands' configured, as the example
   configurations provided above, the XML-RPC must include first an
   argument providing information of a valid account.

But there is an exception: if you didn't configure any restriction in the option, then don't provide the auth arguments.

doesn't work yet

But in docu says:

In this case authentication information must be provided, but it is
enough that the account exists and the password is valid to execute
any command:
{listen, [
  {4560, ejabberd_xmlrpc, [{maxsessions, 10}, {timeout, 5000},
                           {access_commands, [{all, all, []}]}]},
  ...
]}.

although I tried to change first 'all' by 'admin1' and it has the same behaviour.

Working script for different configurations

After some testing, I found the correct script for the different settings.

Not require auth

If you configure like this:

{listen, [
  ...
  {4560, ejabberd_xmlrpc, [
  ]},
  ...
 ]}.

Then use a script like this:

import xmlrpclib
server_url = 'http://localhost:4560';
server = xmlrpclib.Server(server_url);

params = {}
params["host"] = "localhost"

print server.registered_users(params)

Requiring auth

If you configure like this:

{acl, admin, {user, "joerules", "localhost"}}.
{access, configure, [{allow, admin}]}.
{listen, [
  ...
  {4560, ejabberd_xmlrpc, [
        {access_commands, [{configure, all, []}]}
  ]},
  ...
 ]}.

Then use a script like this:

import xmlrpclib
server_url = 'http://localhost:4560';
server = xmlrpclib.Server(server_url);

params = {}
params["host"] = "localhost"

auth = {}
auth["user"] = "joerules"
auth["server"] = "localhost"
auth["password"] = "mypass123"

print server.registered_users(auth, params)
Syndicate content