- if ((result == CMD_SUCCESS) && (ServerInstance->IsValidModuleCommand(command, pcnt, user)))
- {
- /* Safe, we know its non-null because IsValidModuleCommand returned true */
- command_t* thiscmd = ServerInstance->Parser->GetHandler(command);
- // this bit of code cleverly routes all module commands
- // to all remote severs *automatically* so that modules
- // can just handle commands locally, without having
- // to have any special provision in place for remote
- // commands and linking protocols.
- std::deque<std::string> params;
- params.clear();
- int n_translate = thiscmd->translation.size();
- TranslateType translate_to;
+ if ((result == CMD_SUCCESS) && (ServerInstance->IsValidModuleCommand(command, parameters.size(), user)))
+ {
+ /* Safe, we know its non-null because IsValidModuleCommand returned true */
+ Command* thiscmd = ServerInstance->Parser->GetHandler(command);
+
+ Module* srcmodule = ServerInstance->Modules->Find(thiscmd->source);
+
+ if (srcmodule && !(srcmodule->GetVersion().Flags & VF_COMMON)) {
+ ServerInstance->Logs->Log("m_spanningtree",ERROR,"Routed command %s from non-VF_COMMON module %s",
+ command.c_str(), thiscmd->source.c_str());
+ return;
+ }
+
+ // this bit of code cleverly routes all module commands
+ // to all remote severs *automatically* so that modules
+ // can just handle commands locally, without having
+ // to have any special provision in place for remote
+ // commands and linking protocols.
+ parameterlist params;
+ params.clear();
+ unsigned int n_translate = thiscmd->translation.size();
+ TranslateType translate_to;
+
+ /* To make sure that parameters with spaces, or empty
+ * parameters, etc, are always sent properly, *always*
+ * prefix the last parameter with a :. This also removes
+ * an extra strchr() */
+ for (unsigned int j = 0; j < parameters.size(); j++)
+ {
+ std::string target;