diff --git a/src/modules/m_server.c b/src/modules/m_server.c index bd328085c..e057f1631 100644 --- a/src/modules/m_server.c +++ b/src/modules/m_server.c @@ -336,6 +336,15 @@ skip_host_check: if ((acptr = find_server(servername, NULL))) { /* Found. Bad. Quit. */ + + if (IsMe(acptr)) + { + sendto_realops("Link %s rejected, server trying to link with my name (%s)", + get_client_name(sptr, TRUE), me.name); + sendto_one(sptr, "ERROR: Server %s exists (it's me!)", me.name); + return exit_client(sptr, sptr, sptr, "Server Exists"); + } + acptr = acptr->from; ocptr = (cptr->local->firsttime > acptr->local->firsttime) ? acptr : cptr; @@ -550,6 +559,15 @@ CMD_FUNC(m_server_remote) if ((acptr = find_server(servername, NULL))) { /* Found. Bad. Quit. */ + + if (IsMe(acptr)) + { + sendto_realops("Link %s rejected, server trying to link with my name (%s)", + get_client_name(sptr, TRUE), me.name); + sendto_one(sptr, "ERROR: Server %s exists (it's me!)", me.name); + return exit_client(sptr, sptr, sptr, "Server Exists"); + } + acptr = acptr->from; ocptr = (cptr->local->firsttime > acptr->local->firsttime) ? acptr : cptr; diff --git a/src/parse.c b/src/parse.c index 7cdfc8dc0..3bcf5d92b 100644 --- a/src/parse.c +++ b/src/parse.c @@ -97,7 +97,7 @@ aClient inline *find_server(char *name, aClient *cptr) { aClient *acptr; - if ((acptr = find_client(name, NULL)) != NULL && IsServer(acptr)) + if ((acptr = find_client(name, NULL)) != NULL && (IsServer(acptr) || IsMe(acptr))) return acptr; }