#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <stdint.h>
#include "users.h"
#include "channels.h"
#include "modules.h"
#define F4(x, y, z) (y ^ (x | ~z))
#define MD5STEP(f,w,x,y,z,in,s) (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
-typedef unsigned long word32;
+typedef uint32_t word32; /* NOT unsigned long. We don't support 16 bit platforms, anyway. */
typedef unsigned char byte;
struct xMD5Context {
Server *Srv;
std::string prefix;
- int key1;
- int key2;
- int key3;
- int key4;
+ word32 key1;
+ word32 key2;
+ word32 key3;
+ word32 key4;
void byteSwap(word32 *buf, unsigned words)
{
return Version(1,0,0,1,VF_STATIC|VF_VENDOR);
}
- virtual void OnRehash(std::string parameter)
+ virtual void OnRehash(const std::string ¶meter)
{
ConfigReader* Conf = new ConfigReader();
key1 = key2 = key3 = key4 = 0;
this->GenHash(dest->host,ra);
std::string b = "";
in_addr testaddr;
- if (!inet_aton(dest->host,&testaddr))
+ std::string hostcloak = prefix + "-" + std::string(ra) + a;
+ /* Fix by brain - if the cloaked host is > the max length of a host (64 bytes
+ * according to the DNS RFC) then tough titty, they get cloaked as an IP.
+ * Their ISP shouldnt go to town on subdomains, or they shouldnt have a kiddie
+ * vhost.
+ */
+ if ((!inet_aton(dest->host,&testaddr)) && (hostcloak.length() < 64))
{
// if they have a hostname, make something appropriate
- b = prefix + "-" + std::string(ra) + a;
+ b = hostcloak;
}
else
{