#include "class.h"
#include "common.h"
#include "hash.h"
-#include "irc_string.h"
+#include "match.h"
#include "ircd.h"
#include "numeric.h"
#include "packet.h"
static EVH check_pings;
-extern rb_bh *client_heap;
-extern rb_bh *lclient_heap;
-extern rb_bh *pclient_heap;
+static rb_bh *client_heap = NULL;
+static rb_bh *lclient_heap = NULL;
+static rb_bh *pclient_heap = NULL;
+static rb_bh *user_heap = NULL;
static rb_bh *away_heap = NULL;
-
-extern char current_uid[IDLEN];
+static char current_uid[IDLEN];
struct Dictionary *nd_dict = NULL;
client_heap = rb_bh_create(sizeof(struct Client), CLIENT_HEAP_SIZE, "client_heap");
lclient_heap = rb_bh_create(sizeof(struct LocalUser), LCLIENT_HEAP_SIZE, "lclient_heap");
pclient_heap = rb_bh_create(sizeof(struct PreClient), PCLIENT_HEAP_SIZE, "pclient_heap");
+ user_heap = rb_bh_create(sizeof(struct User), USER_HEAP_SIZE, "user_heap");
away_heap = rb_bh_create(AWAYLEN, AWAY_HEAP_SIZE, "away_heap");
rb_event_addish("check_pings", check_pings, NULL, 30);
{
client_p->from = client_p; /* 'from' of local client is self! */
- localClient = (struct LocalUser *) rb_bh_alloc(lclient_heap);
+ localClient = rb_bh_alloc(lclient_heap);
SetMyConnect(client_p);
client_p->localClient = localClient;
client_p->localClient->F = NULL;
- client_p->preClient = (struct PreClient *) rb_bh_alloc(pclient_heap);
+ client_p->preClient = rb_bh_alloc(pclient_heap);;
/* as good a place as any... */
rb_dlinkAdd(client_p, &client_p->localClient->tnode, &unknown_list);
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"No response from %s, closing link",
- get_server_name(client_p, HIDE_IP));
+ client_p->name);
ilog(L_SERVER,
"No response from %s, closing link",
log_client_name(client_p, HIDE_IP));
if(IsDead(client_p) || IsClosing(client_p))
continue;
+ /* still has DNSbls to validate against */
+ if(client_p->preClient != NULL &&
+ rb_dlink_list_length(&client_p->preClient->dnsbl_queries) > 0)
+ continue;
+
/*
* Check UNKNOWN connections - if they have been in this state
* for > 30s, close them.
{
sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) ? L_NETWIDE : L_ALL,
"No response from %s, closing link",
- get_server_name(client_p, HIDE_IP));
+ client_p->name);
ilog(L_SERVER,
"No response from %s, closing link",
log_client_name(client_p, HIDE_IP));
}
else
{
- switch (aconf->status)
- {
- case D_LINED:
- reason = d_lined;
- break;
- default:
- reason = k_lined;
- break;
- }
+ reason = aconf->status == D_LINED ? d_lined : k_lined;
}
if(ban == D_LINED && !IsPerson(client_p))
if(ConfigFileEntry.hide_spoof_ips &&
showip == SHOW_IP && IsIPSpoof(client))
showip = MASK_IP;
-#ifdef HIDE_SERVERS_IPS
if(IsAnyServer(client))
showip = MASK_IP;
-#endif
/* And finally, let's get the host information, ip or name */
switch (showip)
*/
return client->name;
}
-
-const char *
-get_server_name(struct Client *target_p, int showip)
-{
- static char nbuf[HOSTLEN * 2 + USERLEN + 5];
-
- if(target_p == NULL)
- return NULL;
-
- if(!MyConnect(target_p) || !irccmp(target_p->name, target_p->host))
- return target_p->name;
-
-#ifdef HIDE_SERVERS_IPS
- if(EmptyString(target_p->name))
- {
- rb_snprintf(nbuf, sizeof(nbuf), "[%s@255.255.255.255]",
- target_p->username);
- return nbuf;
- }
- else
- return target_p->name;
-#endif
-
- switch (showip)
- {
- case SHOW_IP:
- rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
- target_p->name, target_p->username,
- target_p->sockhost);
- break;
-
- case MASK_IP:
- rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]",
- target_p->name, target_p->username);
-
- default:
- rb_snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]",
- target_p->name, target_p->username,
- target_p->host);
- }
-
- return nbuf;
-}
/* log_client_name()
*
if(IsAnyServer(abt->client))
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Closing link to %s: %s",
- get_server_name(abt->client, HIDE_IP), abt->notice);
+ abt->client->name, abt->notice);
/* its no longer on abort list - we *must* remove
* FLAGS_CLOSING otherwise exit_client() will not run --fl
{
sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
":%s QUIT :%s", use_id(source_p), comment);
- sendto_server(client_p, NULL, NOCAPS, CAP_TS6,
- ":%s QUIT :%s", source_p->name, comment);
}
SetDead(source_p);
{
sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
":%s QUIT :%s", use_id(source_p), comment);
- sendto_server(client_p, NULL, NOCAPS, CAP_TS6,
- ":%s QUIT :%s", source_p->name, comment);
}
SetDead(source_p);
{
if(IsAnyServer(target_p))
{
-#ifndef HIDE_SERVERS_IPS
- if(source_p == NULL || IsOper(source_p))
- return 1;
-#endif
return 0;
}
else if(IsIPSpoof(target_p))
return 1;
}
-/*
- * initUser
- *
- * inputs - none
- * outputs - none
- *
- * side effects - Creates a block heap for struct Users
- *
- */
-static rb_bh *user_heap;
-void
-initUser(void)
-{
- user_heap = rb_bh_create(sizeof(struct User), USER_HEAP_SIZE, "user_heap");
- if(!user_heap)
- rb_outofmemory();
-}
-
/*
* make_user
*
{
sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) && !IsServer(client_p) ? L_NETWIDE : L_ALL,
"Server %s closed the connection",
- get_server_name(client_p, SHOW_IP));
+ client_p->name);
ilog(L_SERVER, "Server %s closed the connection",
log_client_name(client_p, SHOW_IP));