/* mod-sockcheck.c - insecure proxy checking
- * Copyright 2000-2004 srvx Development Team
+ * Copyright 2000-2006 srvx Development Team
*
* This file is part of srvx.
*
char addr[IRC_NTOP_MAX_SIZE + 2] = {'*', '@', '\0'};
irc_ntop(addr + 2, sizeof(addr) - 2, &sci->addr);
log_module(PC_LOG, LOG_INFO, "Issuing gline for client at %s: %s", addr + 2, sci->reason);
- gline_add("ProxyCheck", addr, sockcheck_conf.gline_duration, sci->reason, now, 1);
+ gline_add("ProxyCheck", addr, sockcheck_conf.gline_duration, sci->reason, now, now, 1);
}
static struct sockcheck_client *
log_module(PC_LOG, LOG_INFO, "Goodbye %s (%p)! I set you free!", client->addr->hostname, client);
}
verify(client);
- if (client->fd)
- ioset_close(client->fd->fd, 1);
+ ioset_close(client->fd, 1);
+ client->fd = NULL;
sockcheck_list_unref(client->tests);
free(client->read);
free(client->resp_state);
extern struct cManagerNode cManager;
const char *expansion;
unsigned int exp_length;
-#ifndef __SOLARIS__
- u_int32_t exp4;
- u_int16_t exp2;
-#else
uint32_t exp4;
uint16_t exp2;
-#endif
+
/* expand variable */
switch (var) {
case 'c':
return;
case 0: break;
}
- fd->wants_reads = 1;
if (SOCKCHECK_DEBUG) {
log_module(PC_LOG, LOG_INFO, "Connected: to %s port %d.", client->addr->hostname, client->state->port);
}
struct io_fd *io_fd;
verify(client);
- if (client->fd) {
- ioset_close(client->fd->fd, 1);
- client->fd = NULL;
- }
+ ioset_close(client->fd, 1);
+ client->fd = NULL;
do {
client->state = client->tests->list[client->test_index];
client->read_pos = 0;
client->read_used = 0;
- client->fd = io_fd = ioset_connect(sockcheck_conf.local_addr, sockcheck_conf.local_addr_len, client->addr->hostname, client->state->port, 0, client, sockcheck_connected);
+ io_fd = ioset_connect(sockcheck_conf.local_addr, sockcheck_conf.local_addr_len, client->addr->hostname, client->state->port, 0, client, sockcheck_connected);
+ client->fd = io_fd;
if (!io_fd) {
client->test_index++;
continue;
sockcheck_conf.local_addr_len = ai->ai_addrlen;
sockcheck_conf.local_addr = calloc(1, ai->ai_addrlen);
memcpy(sockcheck_conf.local_addr, ai->ai_addr, ai->ai_addrlen);
+ freeaddrinfo(ai);
} else {
sockcheck_conf.local_addr_len = 0;
sockcheck_conf.local_addr = NULL;
- log_module(PC_LOG, LOG_ERROR, "Error: Unable to get host named `%s', not checking a specific address.", str);
+ if (str)
+ log_module(PC_LOG, LOG_ERROR, "Error: Unable to get host named `%s', not checking a specific address.", str);
}
}
}