[srvx-commits] CVS: services/src sockcheck.c,1.77,1.78
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-09-05 14:50:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv31077/src
Modified Files:
sockcheck.c
Log Message:
add support for "?stats proxycheck <ip>"
Index: sockcheck.c
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -r1.77 -r1.78
*** sockcheck.c 18 Aug 2002 16:04:33 -0000 1.77
--- sockcheck.c 5 Sep 2002 14:50:18 -0000 1.78
***************
*** 252,265 ****
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 */
0,10,11,12,13,14,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 96 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 112 */
!
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 160 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 176 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 192 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 208 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 224 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 240 */
};
--- 252,256 ----
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 */
0,10,11,12,13,14,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 96 */
! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 112 */
};
***************
*** 1043,1050 ****
static MODCMD_FUNC(cmd_stats_proxycheck)
{
! (void)argv;
! send_message(user, cmd->parent->bot, "Since booting, I have checked %d clients for illicit proxies, and detected %d proxy hosts.\nI am currently checking %d clients (out of %d max) and have a backlog of %d more to start on.\nI currently have %d hosts cached.\nI know how to detect %d kinds of proxies.",
! checked_ip_count, proxies_detected, sockcheck_num_clients, sockcheck_conf.max_clients, pending_sci_list.used, dict_size(checked_ip_dict), (tests ? tests->used : 0));
! return 0;
}
--- 1034,1059 ----
static MODCMD_FUNC(cmd_stats_proxycheck)
{
! if (argc > 1) {
! const char *hostname = argv[1];
! char elapse_buf[INTERVALLEN], msg[MAXLEN];
! sockcheck_cache_info sci = dict_find(checked_ip_dict, hostname, NULL);
! if (!sci) {
! send_message(user, cmd->parent->bot, "No proxycheck records exist for IP %s.", hostname);
! return 0;
! }
! intervalString(elapse_buf, now - sci->last_touched);
! switch (sci->decision) {
! case CHECKING: snprintf(msg, sizeof(msg), "still checking"); break;
! case ACCEPT: snprintf(msg, sizeof(msg), "accepted"); break;
! case REJECT: snprintf(msg, sizeof(msg), "rejected: %s", sci->reason); break;
! default: snprintf(msg, sizeof(msg), "unknown decision value %d", sci->decision); break;
! }
! send_message(user, cmd->parent->bot, "IP %s proxycheck state: last touched %s ago, %s", sci->hostname, elapse_buf, msg);
! return 1;
! } else {
! send_message(user, cmd->parent->bot, "Since booting, I have checked %d clients for illicit proxies, and detected %d proxy hosts.\nI am currently checking %d clients (out of %d max) and have a backlog of %d more to start on.\nI currently have %d hosts cached.\nI know how to detect %d kinds of proxies.",
! checked_ip_count, proxies_detected, sockcheck_num_clients, sockcheck_conf.max_clients, pending_sci_list.used, dict_size(checked_ip_dict), (tests ? tests->used : 0));
! return 1;
! }
}
|