Exemple #1
0
	virtual void OnLoadModule(Module* mod, const std::string& name)
	{
		if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest"))
		{
			ServerInstance->Logs->Log("m_password-hash",DEBUG, "Post-load registering hasher: %s", name.c_str());
			std::string sname = HashNameRequest(this, mod).Send();
			hashers[sname.c_str()] = mod;
			names.push_back(sname);
			if (!diduseiface)
			{
				ServerInstance->Modules->UseInterface("HashRequest");
				diduseiface = true;
			}
		}
	}
Exemple #2
0
	ModuleOperHash(InspIRCd* Me)
		: Module(Me)
	{
		diduseiface = false;

		/* Read the config file first */
//		Conf = NULL;
		OnRehash(NULL);

		/* Find all modules which implement the interface 'HashRequest' */
		modulelist* ml = ServerInstance->Modules->FindInterface("HashRequest");

		/* Did we find any modules? */
		if (ml)
		{
			/* Yes, enumerate them all to find out the hashing algorithm name */
			for (modulelist::iterator m = ml->begin(); m != ml->end(); m++)
			{
				/* Make a request to it for its name, its implementing
				 * HashRequest so we know its safe to do this
				 */
				std::string name = HashNameRequest(this, *m).Send();
				/* Build a map of them */
				hashers[name.c_str()] = *m;
				names.push_back(name);
			}
			/* UseInterface doesn't do anything if there are no providers, so we'll have to call it later if a module gets loaded later on. */
			ServerInstance->Modules->UseInterface("HashRequest");
			diduseiface = true;
		}

		mycommand = new CommandMkpasswd(ServerInstance, this, hashers, names);
		ServerInstance->AddCommand(mycommand);
		Implementation eventlist[] = { I_OnPassCompare, I_OnLoadModule };
		ServerInstance->Modules->Attach(eventlist, this, 2);
	}
Exemple #3
0
	ModuleOperHash(InspIRCd* Me)
		: Module(Me)
	{

		/* Read the config file first */
		Conf = NULL;
		OnRehash(NULL,"");

		ServerInstance->UseInterface("HashRequest");

		/* Find all modules which implement the interface 'HashRequest' */
		modulelist* ml = ServerInstance->FindInterface("HashRequest");

		/* Did we find any modules? */
		if (ml)
		{
			/* Yes, enumerate them all to find out the hashing algorithm name */
			for (modulelist::iterator m = ml->begin(); m != ml->end(); m++)
			{
				/* Make a request to it for its name, its implementing
				 * HashRequest so we know its safe to do this
				 */
				std::string name = HashNameRequest(this, *m).Send();
				/* Build a map of them */
				hashers[name.c_str()] = *m;
				names.push_back(name);
			}
		}
		else
		{
			throw ModuleException("I can't find any modules loaded which implement the HashRequest interface! You probably forgot to load a hashing module such as m_md5.so or m_sha256.so.");
		}

		mycommand = new cmd_mkpasswd(ServerInstance, this, hashers, names);
		ServerInstance->AddCommand(mycommand);
	}