1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-08 01:23:12 +02:00

wow.. that's a lot of lines to do something simple @ m_vhost :D

This commit is contained in:
Bram Matthys
2015-07-25 19:10:48 +02:00
parent 4573a61518
commit b1a1c51f4e
2 changed files with 8 additions and 10 deletions
+2 -9
View File
@@ -154,16 +154,9 @@ int m_vhost(aClient *cptr, aClient *sptr, int parc, char *parv[])
/* join sent later when the host has been changed */
break;
}
if (sptr->user->virthost)
safestrdup(sptr->user->virthost, vhost->virthost);
if (vhost->virtuser)
{
MyFree(sptr->user->virthost);
sptr->user->virthost = NULL;
}
len = strlen(vhost->virthost);
length = len > HOSTLEN ? HOSTLEN : len;
sptr->user->virthost = MyMalloc(length + 1);
strlcpy(sptr->user->virthost, vhost->virthost, length + 1);
if (vhost->virtuser) {
strcpy(olduser, sptr->user->username);
strlcpy(sptr->user->username, vhost->virtuser, USERLEN);
sendto_server(cptr, 0, 0, ":%s SETIDENT %s", sptr->name,
+6 -1
View File
@@ -791,10 +791,15 @@ char text[2048];
*/
int valid_host(char *host)
{
char *p;
char *p;
if (strlen(host) > HOSTLEN)
return 0; /* too long hosts are invalid too */
for (p=host; *p; p++)
if (!isalnum(*p) && (*p != '_') && (*p != '-') && (*p != '.') && (*p != ':'))
return 0;
return 1;
}