Anope IRC Services

Anope Support => 2.0.x/1.9.x Support => Topic started by: Daggett on October 22, 2013, 04:15:22 AM

Title: XMLRPC change password or register
Post by: Daggett on October 22, 2013, 04:15:22 AM
Hey! I'm trying to register users with nickserv over XMLRPC (I currently have a system by using curl & Webpanel) or more importantly, be able to change user passwords via xmlrpc or by curl with webpanel. Anyone have any insight? Thanks!
Title: Re: XMLRPC change password or register
Post by: Adam on October 22, 2013, 04:19:50 AM
By 'XMLRPC' are you referring to m_xmlrpc, or actually to just curl+webpanel? It doesn't look like users can change their passwords in the web panel currently, you could do it via m_xmlrpc by executing /ns set password 'from' the user.
Title: Re: XMLRPC change password or register
Post by: Daggett on October 22, 2013, 04:22:19 AM
I was wondering if it was possible to accomplish changing passwords with either method. Thanks! Also, I was wondering if it was possible to register users via xmlrpc (my workaround currently is to use curl & the webpanel).
Title: Re: XMLRPC change password or register
Post by: Adam on October 22, 2013, 04:24:33 AM
I'm pretty sure you can just:

Code: [Select]
$anopexmlrpc = new AnopeXMLRPC("http://127.0.0.1:8080/xmlrpc");
$anopexmlrpc->DoCommand("NickServ", "user", "REGISTER password email");
Title: Re: XMLRPC change password or register
Post by: Daggett on October 22, 2013, 04:41:50 AM
Tried out your code, I'm sure it will work great, but I can seem to find out why it refuses to execute.

Code: [Select]
PHP Warning:  file_get_contents(http://192.168.1.6:8080/xmlrpc): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
I have m_httpd, m_xmlrpc, m_xmlrpc_main, and m_webcpanel all loaded into my config, but I cannot get it to work. I've looked on the forums and couldn't find any relevant answers. Any insight as to what I might be doing wrong? And yes, http://192.168.1.6:8080 is the server and port anope is listening on.
Title: Re: XMLRPC change password or register
Post by: Adam on October 22, 2013, 04:46:52 AM
/os modinfo m_xmlrpc
Title: Re: XMLRPC change password or register
Post by: Daggett on October 22, 2013, 04:50:02 AM
Code: [Select]
OperServ PRIVMSG #spooty-admin ADMIN: Daggett used MODINFO on m_xmlrpc
OperServ NOTICE Module: m_xmlrpc Version: 1.9.9 (gc0dea5e) Author: Anope Loaded: Oct 21 22:32:51 2013 Central Daylight Time (16 minutes ago)
Title: Re: XMLRPC change password or register
Post by: Adam on October 22, 2013, 04:55:54 AM
Hmm not sure. Unload and reload it? If m_httpd gets reloaded at any time it invalidates m_xmlrpc (and really any other module that adds web pages). If that doesn't work start services with -support and pastebin the logs.
Title: Re: XMLRPC change password or register
Post by: Daggett on October 23, 2013, 02:40:16 AM
Reloading m_xmlrpc did no good. Here are the logs: http://pastebin.com/xbN6wGVf
Title: Re: XMLRPC change password or register
Post by: Adam on October 23, 2013, 07:21:00 AM
The fact that the log says "Serving page /xmlrpc to 192.168.1.7" means that the "page" was found and is being served, not sure why you're still seeing a 404.
Title: Re: XMLRPC change password or register
Post by: Daggett on October 24, 2013, 05:23:00 AM
Hmm.  What php extensions need to be enabled? I already enabled xmlrpc in php.ini and I am using the php file found in the docs on github.
Title: Re: XMLRPC change password or register
Post by: Adam on October 24, 2013, 05:33:22 AM
Hm I went back to read your previous paste but it has been removed, did you run the query while services were in debug mode? If it successfully hit the page you will see the XML parse printing out several messages as it parses the message.

I think PHP would tell you if you didn't have the right extensions. Try running the script from CLI? Can also echo $xmlquery and see just what it's sending.
Title: Re: XMLRPC change password or register
Post by: Daggett on October 26, 2013, 01:25:07 AM
Hey! Sorry here is the log again: http://pastebin.com/miVbJPKU

I didn't find any output regarding XML output.

EDIT: To clarify, I did execute the php page while services were in debug mode.
Title: Re: XMLRPC change password or register
Post by: Adam on October 28, 2013, 12:40:43 AM
Looks like this is a bug in 1.9.9, I've fixed it in https://github.com/anope/anope/commit/fe31b0a666fbae7b34b749fd08a08293a454ce45.patch and confirmed its working again:

$ php xmlrpc.php
Array
(
    [result] => Success
    [return] => Nickname Adam2 registered.

)
$

with:

Code: [Select]
print_r($anopexmlrpc->DoCommand('NickServ', 'Adam2', 'REGISTER qwerty adam@example.com'));


Note the &#xA is an escaped new line (\n).
Title: Re: XMLRPC change password or register
Post by: Daggett on October 28, 2013, 03:27:29 AM
Cool. I'll compile it with these changes soon and let you know how it goes. Thanks!

And congratulations on your 300th post Adam!