blob: 290d881a0af5f5ced18412ec676626f05b73480c (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/* +------------------------------------+
* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
* InspIRCd: (C) 2002-2011 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
*
* ---------------------------------------------------
*/
/* $ModDesc: Allows for POSIX hashing of passwords */
/* $LinkerFlags: if(!"IS_DARWIN") -lcrypt */
#include "inspircd.h"
#include "hash.h"
class ModulePosixCrypt : public Module
{
public:
void init()
{
Implementation eventlist[] = { I_OnPassCompare };
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype)
{
if (hashtype == "posix")
{
const char* res = crypt(input.c_str(), data.c_str());
if (data == std::string(res))
return MOD_RES_ALLOW;
else
return MOD_RES_DENY;
}
return MOD_RES_PASSTHRU;
}
virtual Version GetVersion()
{
return Version("Allows for hashed oper passwords",VF_VENDOR);
}
};
MODULE_INIT(ModulePosixCrypt)
|