MT#59962 XMLRPC2DI: first allocate `XmlRpcServer`

When handling `XMLRPC2DIServer` allocation,
first make sure to have the `XmlRpcServer`
and then do rest of processing (e.g.: `di_export`,
`di_method`, `registerMethods()` etc.)

Otherwise can lead to seg.faults when appealing
to objects via still non-allocated `XmlRpcServer`
object.

Change-Id: Id3395ce3e0d6f2de76ed8caa1a786a6e139a851b
mr13.3.1
Donat Zenichev 10 months ago
parent 9214f5ca9d
commit f8f5726ffd

@ -363,18 +363,6 @@ XMLRPC2DIServer::XMLRPC2DIServer(unsigned int port,
INFO("XMLRPC Server: enabled builtin method 'get_cpslimit'\n");
INFO("XMLRPC Server: enabled builtin method 'set_cpslimit'\n");
// export all methods via 'di' function?
if (di_export) {
// register method 'di'
di_method = new XMLRPC2DIServerDIMethod(s);
}
vector<string> export_ifaces = explode(direct_export, ";");
for(vector<string>::iterator it=export_ifaces.begin();
it != export_ifaces.end(); it++) {
registerMethods(*it);
}
if (multithreaded) {
/* default 5 */
@ -391,6 +379,18 @@ XMLRPC2DIServer::XMLRPC2DIServer(unsigned int port,
s = new XmlRpcServer();
}
// export all methods via 'di' function?
if (di_export) {
// register method 'di'
di_method = new XMLRPC2DIServerDIMethod(s);
}
vector<string> export_ifaces = explode(direct_export, ";");
for(vector<string>::iterator it=export_ifaces.begin();
it != export_ifaces.end(); it++) {
registerMethods(*it);
}
INFO("Initialized XMLRPC2DIServer with: \n");
INFO(" IP = %s port = %u\n",
bind_ip.empty()?"ANY":bind_ip.c_str(), port);

Loading…
Cancel
Save