diff --git a/Changes b/Changes index c2ef58b17..59438de48 100644 --- a/Changes +++ b/Changes @@ -320,4 +320,6 @@ - Fixed a bug with /chgname with incorrect parameters to other servers - "Fixed" the /stats u bug? - Fixed +f not working (?) -- Made the Own-protection just reduce the class maxli instead of bitching.. \ No newline at end of file +- Made the Own-protection just reduce the class maxli instead of bitching.. +- Did a dirty hack on ALN problem with colliding hash (will deny linking in + wrong servers) diff --git a/src/s_serv.c b/src/s_serv.c index 563a1a314..dcc34357d 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -443,7 +443,8 @@ int m_server(cptr, sptr, parc, parv) { char *ch; int i; - char info[REALLEN + 1], *inpath, *host, *encr; + char info[REALLEN + 1], *inpath, *host, *encr, *f; + char pp[512]; aClient *acptr, *bcptr; aConfItem *aconf, *cconf; int hop, ts = 0; @@ -566,7 +567,13 @@ int m_server(cptr, sptr, parc, parv) } /* bzero(cptr->passwd, sizeof(cptr->passwd)); */ } - + f = does_servername_collide(parv[1]); + if (f) + { + ircsprintf(pp, "Servername %s collides with servername %s (similar hash). Change servername in some way (maybe change case)", + parv[1], f); + return exit_client(cptr, cptr, cptr, f); + } if ((acptr = find_name(host, NULL))) { aClient *ocptr; @@ -607,6 +614,8 @@ int m_server(cptr, sptr, parc, parv) return exit_client(cptr, cptr, cptr, "Nick as Server"); } + + if (IsServer(cptr)) { /* diff --git a/src/scache.c b/src/scache.c index 8e0236bd6..a8e912b27 100644 --- a/src/scache.c +++ b/src/scache.c @@ -125,6 +125,24 @@ char *find_server_aln(char *s) return (convert2aln(hash(s))); } + +char *does_servername_collide(char *s) +{ + int i = hash(s); + + if (scache_hash[i]) + { + if (strcmp(s, scache_hash[i]) + return scache_hash[i]; + else + return NULL; + } + else + { + return NULL; + } +} + /* * Added so s_debug could check memory usage in here -Dianora */