+2005-03-19 Michael Poole <mdpoole@troilus.org>
+
+ * include/IPcheck.h (IPcheck_connect_fail): Take a Client
+ parameter instead of irc_in_addr.
+
+ * ircd/IPcheck.c (IPcheck_connect_fail): Likewise. Assert that
+ the client has been IP-checked.
+ (IPcheck_remote_connect): Assert that the client has not yet been
+ charged for connecting.
+ (IPcheck_connect_succeeded): Assert that the client has been
+ charged for connecting.
+ (IPcheck_disconnect): Likewise.
+
+ * ircd/m_nick.c (m_nick): Pass rejected client to
+ IPcheck_connect_fail() when somebody takes the nick first.
+ (ms_nick): Likewise.
+
+ * ircd/s_serv.c (server_estab): Pass new server to
+ IPcheck_connect_fail().
+
+ * ircd/s_user.c (register_user): When rejecting a user, pass
+ the struct Client to IPcheck_connect_fail().
+
2005-03-19 Michael Poole <mdpoole@troilus.org>
* doc/example.conf (Connect): Remove a buggy comment about leaf
*/
extern void IPcheck_init(void);
extern int IPcheck_local_connect(const struct irc_in_addr *ip, time_t *next_target_out);
-extern void IPcheck_connect_fail(const struct irc_in_addr *ip);
+extern void IPcheck_connect_fail(const struct Client *cptr);
extern void IPcheck_connect_succeeded(struct Client *cptr);
extern int IPcheck_remote_connect(struct Client *cptr, int is_burst);
extern void IPcheck_disconnect(struct Client *cptr);
int IPcheck_remote_connect(struct Client *cptr, int is_burst)
{
assert(0 != cptr);
+ assert(!IsIPChecked(cptr));
return ip_registry_check_remote(cptr, is_burst);
}
* so the client's address is not penalized for the failure.
* @param[in] a Address of rejected client.
*/
-void IPcheck_connect_fail(const struct irc_in_addr *a)
+void IPcheck_connect_fail(const struct Client *cptr)
{
- ip_registry_connect_fail(a);
+ assert(IsIPChecked(cptr));
+ ip_registry_connect_fail(&cli_ip(cptr));
}
/** Handle a client that has successfully connected.
void IPcheck_connect_succeeded(struct Client *cptr)
{
assert(0 != cptr);
+ assert(IsIPChecked(cptr));
ip_registry_connect_succeeded(cptr);
}
void IPcheck_disconnect(struct Client *cptr)
{
assert(0 != cptr);
+ assert(IsIPChecked(cptr));
ip_registry_disconnect(cptr);
}
* the message below.
*/
if (IsUnknown(acptr) && MyConnect(acptr)) {
- ++ServerStats->is_ref;
- IPcheck_connect_fail(&cli_ip(acptr));
+ ServerStats->is_ref++;
+ IPcheck_connect_fail(acptr);
exit_client(cptr, acptr, &me, "Overridden by other sign on");
return set_nick_name(cptr, sptr, nick, parc, parv);
}
if (IsUnknown(acptr) && MyConnect(acptr))
{
ServerStats->is_ref++;
- IPcheck_connect_fail(&cli_ip(acptr));
+ IPcheck_connect_fail(acptr);
exit_client(cptr, acptr, &me, "Overridden by other sign on");
return set_nick_name(cptr, sptr, nick, parc, parv);
}
* XXX - if this comes from a server port, it will not have been added
* to the IP check registry, see add_connection in s_bsd.c
*/
- IPcheck_connect_fail(&cli_ip(cptr));
+ IPcheck_connect_fail(cptr);
}
det_confs_butmask(cptr, CONF_SERVER | CONF_UWORLD);
get_client_name(sptr, SHOW_IP));
}
++ServerStats->is_ref;
- IPcheck_connect_fail(&cli_ip(sptr));
+ IPcheck_connect_fail(sptr);
return exit_client(cptr, sptr, &me,
"Sorry, your connection class is full - try "
"again later or try another server");
/* Can this ever happen? */
case ACR_BAD_SOCKET:
++ServerStats->is_ref;
- IPcheck_connect_fail(&cli_ip(sptr));
+ IPcheck_connect_fail(sptr);
return exit_client(cptr, sptr, &me, "Unknown error -- Try again");
}
ircd_strncpy(user->host, cli_sockhost(sptr), HOSTLEN);