#include <stdint.h>
+static const char sasl_usercloak_desc[] =
+ "Insert the SASL account name into certain iline spoofed hosts";
+
static void check_new_user(void *data);
mapi_hfn_list_av1 sasl_usercloak_hfnlist[] = {
- { "new_local_user", (hookfn) check_new_user },
+ { "new_local_user", check_new_user },
{ NULL, NULL }
};
-DECLARE_MODULE_AV1(sasl_usercloak, NULL, NULL, NULL, NULL,
- sasl_usercloak_hfnlist, "$Revision: 3526 $");
-
unsigned int fnv_hash_string(char *str)
{
static void
check_new_user(void *vdata)
{
- struct Client *source_p = (void *)vdata;
+ struct Client *source_p = vdata;
if (!IsIPSpoof(source_p))
return;
if (EmptyString(source_p->user->suser))
return;
- char *accountpart = strstr(source_p->orighost, "account");
- if (!accountpart)
+ char *accountpart = strstr(source_p->orighost, "/account");
+ if (!accountpart || accountpart[8] != '\0')
return;
+ accountpart += 1;
+
char buf[HOSTLEN];
memset(buf, 0, sizeof(buf));
char *dst = buf;
return;
}
- char c = ToLower(*src);
+ char c = tolower(*src);
if (IsHostChar(c))
*dst++ = c;
unsigned int hashval = fnv_hash_string(source_p->user->suser);
hashval %= 100000000; // eight digits only please.
- snprintf(dst, 9, "%08ud", hashval);
+ snprintf(dst, 9, "%08u", hashval);
}
/* just in case */
notify_banned_client(source_p, aconf, K_LINED);
}
}
+
+DECLARE_MODULE_AV2(sasl_usercloak, NULL, NULL, NULL, NULL, sasl_usercloak_hfnlist, NULL, NULL, sasl_usercloak_desc);