srvx-commits Mailing List for srvx IRC Services (Page 84)
Brought to you by:
entrope
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(80) |
Sep
(51) |
Oct
(94) |
Nov
(132) |
Dec
(85) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(163) |
Feb
(96) |
Mar
(70) |
Apr
(182) |
May
(173) |
Jun
(73) |
Jul
(101) |
Aug
(101) |
Sep
(71) |
Oct
(76) |
Nov
(58) |
Dec
(60) |
| 2003 |
Jan
(61) |
Feb
(14) |
Mar
(3) |
Apr
|
May
(7) |
Jun
(22) |
Jul
(81) |
Aug
(41) |
Sep
(34) |
Oct
(41) |
Nov
(16) |
Dec
(28) |
| 2004 |
Jan
(7) |
Feb
|
Mar
(3) |
Apr
(15) |
May
(11) |
Jun
(1) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
| 2005 |
Jan
(13) |
Feb
(6) |
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(2) |
Feb
(3) |
Mar
(4) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2025 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Miles P. <pet...@us...> - 2001-08-21 04:49:23
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv19708
Modified Files:
Tag: rel-1_0
chanserv.c
Log Message:
dont crash if the channel param isnt actually registered in toys (oops :)
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.161.2.78
retrieving revision 1.161.2.79
diff -C2 -r1.161.2.78 -r1.161.2.79
*** chanserv.c 2001/08/19 00:43:58 1.161.2.78
--- chanserv.c 2001/08/21 04:49:19 1.161.2.79
***************
*** 4281,4285 ****
(void)argc; (void)argv;
! if (channel && channel->channel_info->options[optToys] == 'd') {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
--- 4281,4285 ----
(void)argc; (void)argv;
! if (channel && channel->channel_info && channel->channel_info->options[optToys] == 'd') {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
***************
*** 4306,4310 ****
(void)argc; (void)argv;
! if (channel && channel->channel_info->options[optToys] == 'd' && !IsPrivileged(user)) {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
--- 4306,4310 ----
(void)argc; (void)argv;
! if (channel && channel->channel_info && channel->channel_info->options[optToys] == 'd' && !IsPrivileged(user)) {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
***************
*** 4331,4335 ****
(void)argc; (void)argv;
! if (channel && channel->channel_info->options[optToys] == 'd') {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
--- 4331,4335 ----
(void)argc; (void)argv;
! if (channel && channel->channel_info && channel->channel_info->options[optToys] == 'd') {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
***************
*** 4367,4371 ****
/* since the switch() statement only affects users on the userlist
we've got to stop before it even gets there. */
! if (channel && channel->channel_info->options[optToys] == 'd') {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
--- 4367,4371 ----
/* since the switch() statement only affects users on the userlist
we've got to stop before it even gets there. */
! if (channel && channel->channel_info && channel->channel_info->options[optToys] == 'd') {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
***************
*** 4373,4377 ****
resp = chanserv_conf.eightball->list[accum % chanserv_conf.eightball->used];
! if (channel && !argv[-1] && GetChannelUser(channel->channel_info, user->handle_info)) {
char *response;
response = alloca(strlen(user->nick)+strlen(resp)+5);
--- 4373,4377 ----
resp = chanserv_conf.eightball->list[accum % chanserv_conf.eightball->used];
! if (channel->channel_info && !argv[-1] && GetChannelUser(channel->channel_info, user->handle_info)) {
char *response;
response = alloca(strlen(user->nick)+strlen(resp)+5);
***************
*** 4395,4399 ****
sides = atoi(argv[1]);
! if (channel && channel->channel_info->options[optToys] == 'd') {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
--- 4395,4399 ----
sides = atoi(argv[1]);
! if (channel && channel->channel_info && channel->channel_info->options[optToys] == 'd') {
chanserv_notice(user, CSMSG_TOYS_DISABLED, channel->name);
return 1;
|
|
From: Miles P. <pet...@us...> - 2001-08-21 01:47:58
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv12530
Modified Files:
Tag: rel-1_0
opserv.c
Log Message:
use the correct timezone in stats max..
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.187.2.48
retrieving revision 1.187.2.49
diff -C2 -r1.187.2.48 -r1.187.2.49
*** opserv.c 2001/08/18 02:24:13 1.187.2.48
--- opserv.c 2001/08/21 01:27:32 1.187.2.49
***************
*** 1512,1516 ****
cmd_stats_max(struct userNode *user)
{
! opserv_notice(user, OSMSG_MAX_CLIENTS, max_clients, asctime(gmtime(&max_clients_time)));
}
--- 1512,1516 ----
cmd_stats_max(struct userNode *user)
{
! opserv_notice(user, OSMSG_MAX_CLIENTS, max_clients, asctime(localtime(&max_clients_time)));
}
|
|
From: Entrope <en...@us...> - 2001-08-20 21:50:18
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv30916/src
Modified Files:
Tag: rel-1_0
chanserv.help
Log Message:
fix documentation for !ACCESS, since it doesn't accept a *Handle argument
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.10.2.21
retrieving revision 1.10.2.22
diff -C2 -r1.10.2.21 -r1.10.2.22
*** chanserv.help 2001/08/18 00:55:03 1.10.2.21
--- chanserv.help 2001/08/20 21:50:14 1.10.2.22
***************
*** 89,96 ****
);
"ACCESS" ("$bACCESS$b",
! "/msg $C ACCESS <#channel> [nick|*handle]",
"${command/ACCESS/access}",
! "Reports various pieces of information about a channel user, including channel and network access level, and the user's info line. If no nick or handle is provided, $C returns your own information.",
! "You may use *Handle instead of Nick as the name argument; the * makes $C use the name of a handle directly (useful if the user is not online).",
"$uSee Also:$u users");
"ADDBAN" ("$bADDBAN$b",
--- 89,95 ----
);
"ACCESS" ("$bACCESS$b",
! "/msg $C ACCESS <#channel> nick",
"${command/ACCESS/access}",
! "Reports various pieces of information about a channel user, including channel and network access level, and the user's info line. If no nick is provided, $C returns your own information.",
"$uSee Also:$u users");
"ADDBAN" ("$bADDBAN$b",
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32442/src
Modified Files:
uplink.c tools.h tools.c timeq.c sockcheck.h sockcheck.c
recdb.c proto_ircu_p10.c proto_bahamut.c proto.h opserv.help
opserv.c nickserv.help nickserv.h nickserv.c nickserv-not.help
modules.c messages.h main.c helpfile.h helpfile.c hash.h
hash.c global.c gline.h gline.c config.h.in compat.h compat.c
common.h chanserv.help chanserv.h chanserv.c alias.h alias.c
Makefile.am
Log Message:
merge more 1.0 branch changes onto trunk
Index: uplink.c
===================================================================
RCS file: /cvsroot/srvx/services/src/uplink.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** uplink.c 2001/08/10 05:08:16 1.8
--- uplink.c 2001/08/19 03:06:09 1.9
***************
*** 2,5 ****
--- 2,6 ----
#include <errno.h>
#include <netdb.h>
+ #include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
***************
*** 27,30 ****
--- 28,32 ----
enum uplink_state state;
int tries;
+ int max_tries;
long flags;
***************
*** 48,51 ****
--- 50,54 ----
struct uplink_manager cManager;
unsigned int lines_processed;
+ int max_cycles;
static char replay_line[MAXLEN+80];
***************
*** 76,79 ****
--- 79,84 ----
cManager.enabled += enabled;
+ str = database_get_data(rd->d.object, "max_tries", RECDB_QSTRING);
+ uplink->max_tries = str ? atoi(str) : 3;
uplink->flags = enabled ? 0 : UPLINK_UNAVAILABLE;
uplink->state = DISCONNECTED;
***************
*** 129,132 ****
--- 134,140 ----
oldUplinks = cManager.uplinks;
+ rd = conf_get_node("server/max_cycles");
+ max_cycles = rd ? atoi(rd->d.qstring) : 30;
+
rd = conf_get_node("uplinks");
if (!rd || rd->type != RECDB_OBJECT) {
***************
*** 185,190 ****
cManager.cycles++;
! /* TODO: Make this limit of 30 cycles configurable. */
! if (cManager.cycles > 30) {
log(MAIN_LOG, LOG_ERROR, "Maximum uplink list cycles exceeded; giving up.\n");
exit(1);
--- 193,197 ----
cManager.cycles++;
! if (cManager.cycles > max_cycles) {
log(MAIN_LOG, LOG_ERROR, "Maximum uplink list cycles exceeded; giving up.\n");
exit(1);
***************
*** 319,324 ****
irc_introduce(uplink->password);
} else {
! /* TODO: Make this limit of 3 tries per uplink configurable. */
! if (uplink->tries > 3) {
/* This is a bad uplink, move on. */
uplink->flags |= UPLINK_UNAVAILABLE;
--- 326,330 ----
irc_introduce(uplink->password);
} else {
! if (uplink->tries > uplink->max_tries) {
/* This is a bad uplink, move on. */
uplink->flags |= UPLINK_UNAVAILABLE;
Index: tools.h
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** tools.h 2001/08/19 01:28:39 1.10
--- tools.h 2001/08/19 03:06:09 1.11
***************
*** 46,53 ****
int mmatch(const char *glob, const char *newglob);
int match_ircglob(const char *text, const char *glob);
int is_ircmask(const unsigned char *text);
int is_gline(const unsigned char *text);
! char* generate_hostmask(struct userNode *user, int strict, int wildnick);
unsigned long ParseInterval(const unsigned char *interval);
unsigned long ParseVolume(const unsigned char *volume);
--- 46,62 ----
int mmatch(const char *glob, const char *newglob);
int match_ircglob(const char *text, const char *glob);
+ int user_matches_glob(struct userNode *user, const char *glob, int include_nick);
int is_ircmask(const unsigned char *text);
int is_gline(const unsigned char *text);
!
! /* The "default" for generate_hostmask is to have all of these options off. */
! #define GENMASK_STRICT 1
! #define GENMASK_USENICK 2
! #define GENMASK_OMITNICK 4 /* Hurray for Kevin! */
! #define GENMASK_BYIP 8
! #define GENMASK_SRVXMASK 16
! char *generate_hostmask(struct userNode *user, int options);
!
unsigned long ParseInterval(const unsigned char *interval);
unsigned long ParseVolume(const unsigned char *volume);
***************
*** 73,81 ****
DECLARE_LIST(string_buffer, char);
void string_buffer_append_string(struct string_buffer *buf, const char *tail);
- int string_buffer_sprintf(struct string_buffer *buf, const char *format, va_list al);
void string_buffer_replace(struct string_buffer *buf, unsigned int from, unsigned int len, const char *repl);
int make_chanmode(struct chanNode *chan, char *out, int len);
int make_usermode(struct userNode *user, char *out, int len);
#endif /* ifdef _TOOLS_H_ */
--- 82,91 ----
DECLARE_LIST(string_buffer, char);
void string_buffer_append_string(struct string_buffer *buf, const char *tail);
void string_buffer_replace(struct string_buffer *buf, unsigned int from, unsigned int len, const char *repl);
int make_chanmode(struct chanNode *chan, char *out, int len);
int make_usermode(struct userNode *user, char *out, int len);
+
+ char *intoa(unsigned long addr);
#endif /* ifdef _TOOLS_H_ */
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -r1.90 -r1.91
*** tools.c 2001/08/19 01:28:39 1.90
--- tools.c 2001/08/19 03:06:09 1.91
***************
*** 44,49 ****
--- 44,56 ----
#include <sys/socket.h>
#endif
+ #ifdef HAVE_NETINET_IN_H
+ #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
+ #endif
#include "hash.h"
+ #include "log.h"
#include "policer.h"
#include "recdb.h"
***************
*** 86,91 ****
static unsigned char channel_inverse_modes[256];
- static int
-
void
mod_usermode(struct userNode *user, const char *mode_change) {
--- 93,96 ----
***************
*** 133,137 ****
make_usermode(struct userNode *user, char *out, int len)
{
!
}
--- 138,142 ----
make_usermode(struct userNode *user, char *out, int len)
{
! /* TODO */
}
***************
*** 389,414 ****
}
- void
- fix_glob(char *dest, const char *src)
- {
- unsigned int i, j, star_p, q_cnt;
- i = j = 0;
- while (1) {
- star_p = q_cnt = 0;
- do {
- if (src[i] == '*') star_p = 1;
- else if (src[i] == '?') q_cnt++;
- else break;
- i++;
- } while (1);
- while (q_cnt) { dest[j++] = '?'; q_cnt--; }
- if (star_p) dest[j++] = '*';
- if (!(dest[j++] = src[i++])) break;
- }
- }
-
int
! inner_ircglob(const char *text, const char *glob)
{
while (1) {
switch (*glob) {
--- 394,401 ----
}
int
! match_ircglob(const char *text, const char *glob)
{
+ unsigned int star_p, q_cnt;
while (1) {
switch (*glob) {
***************
*** 416,440 ****
return !*text;
case '*':
! /* if this is the last glob character, it will match any text */
! if (!glob[1]) return 1;
! /* fix_glob guarantees that we'll never see *?, so we don't
! * need logic for that -- we know that the next character is
! * a normal character. So just look for the right character.
! */
! for (; *text; text++) {
! if ((tolower(*text) == tolower(glob[1]))
! && (inner_ircglob(text, glob+1))) {
! return 1;
}
}
! return 0;
! case '?':
! if (!*text) return 0;
! text++; glob++; break;
default:
if (!*text) return 0;
while (*text && *glob && *glob != '*' && *glob != '?') {
! if (tolower(*text) != tolower(*glob)) return 0;
! text++; glob++;
}
}
--- 403,437 ----
return !*text;
case '*':
! case '?':
! star_p = q_cnt = 0;
! do {
! if (*glob == '*') star_p = 1;
! else if (*glob == '?') q_cnt++;
! else break;
! glob++;
! } while (1);
! while (q_cnt) { if (!*text++) return 0; q_cnt--; }
! if (star_p) {
! /* if this is the last glob character, it will match any text */
! if (!*glob) return 1;
! /* Thanks to the loop above, we know that the next
! * character is a normal character. So just look for
! * the right character.
! */
! for (; *text; text++) {
! if ((tolower(*text) == tolower(*glob))
! && match_ircglob(text+1, glob+1)) {
! return 1;
! }
}
+ return 0;
}
! /* if !star_p, fall through to normal character case,
! * first checking to see if ?s carried us to the end */
! if (!*glob && !*text) return 1;
default:
if (!*text) return 0;
while (*text && *glob && *glob != '*' && *glob != '?') {
! if (tolower(*text++) != tolower(*glob++)) return 0;
}
}
***************
*** 443,470 ****
int
! match_ircglob(const char *text, const char *glob)
{
! char *newglob = alloca(strlen(glob)+1);
! fix_glob(newglob, glob);
! return inner_ircglob(text, newglob);
! }
!
! int
! glob_valid(const char *glob, unsigned int require)
! {
! unsigned int non_wildcard = 0;
!
! while (*glob++) {
! switch (*glob) {
! case '*':
! case '?':
! break;
! default:
! non_wildcard++;
! break;
! }
}
-
- return non_wildcard > require;
}
--- 440,477 ----
int
! user_matches_glob(struct userNode *user, const char *orig_glob, int include_nick)
{
! char *glob, *marker;
! /* Make a writable copy of the glob */
! glob = alloca(strlen(orig_glob)+1);
! strcpy(glob, orig_glob);
! /* Check the nick, if it's present */
! if (include_nick) {
! if (!(marker = strchr(glob, '!'))) {
! log(MAIN_LOG, LOG_ERROR, "match_glob_user(\"%s\", \"%s\", %d) called, and glob doesn't include a '!'\n", user->nick, orig_glob, include_nick);
! return 0;
! }
! *marker = 0;
! if (!match_ircglob(user->nick, glob)) return 0;
! glob = marker + 1;
! }
! /* Check the ident */
! if (!(marker = strchr(glob, '@'))) {
! log(MAIN_LOG, LOG_ERROR, "match_glob_user(\"%s\", \"%s\", %d) called, and glob doesn't include an '@'\n", user->nick, orig_glob, include_nick);
! return 0;
! }
! *marker = 0;
! if (!match_ircglob(user->username, glob)) return 0;
! glob = marker + 1;
! /* Now check the host part */
! if (isdigit(*glob) && !glob[strspn(glob, "0123456789./*?")]) {
! /* Looks like an IP-based mask */
! unsigned char userip[20];
! sprintf(userip, "%ld.%ld.%ld.%ld", (user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255);
! return match_ircglob(userip, glob);
! } else {
! /* The host part of the mask isn't IP-based */
! return match_ircglob(user->hostname, glob);
}
}
***************
*** 512,563 ****
}
! char*
! generate_hostmask(struct userNode *user, int strict, int wildnick)
{
! char *mask = malloc(NICKLEN+USERLEN+HOSTLEN+3);
! int ofs = (user->username[0] == '~' && !strict) ? 1 : 0;
! const char *nickname = wildnick ? "*" : user->nick;
! const char *username = user->username + ofs;
! const char *hostname = user->hostname;
!
! if (strict) {
! sprintf(mask, "%s!%s@%s", nickname, username, hostname);
} else {
! int i, cnt;
!
! if (strspn(hostname, "0123456789.") == strlen(hostname)) {
! /* It's an IP address, treat it as such */
! char *lastdot = strrchr(hostname, '.');
! if (lastdot) {
! int len = lastdot + 1 - hostname;
! char *temphost = alloca(len);
! memcpy(temphost, hostname, len-1);
! temphost[len-1] = 0;
! sprintf(mask, "%s!*%s@%s.*", nickname, username, temphost);
! } else {
! /* An all-numeric IP.. this shouldn't happen */
! sprintf(mask, "%s!*%s@%s", nickname, username, hostname);
}
! return mask;
}
/* This heuristic could be made smarter. Is it worth the effort? */
! for (i=cnt=0; user->hostname[i]; i++) {
! if (user->hostname[i] == '.') cnt++;
! }
if (cnt == 1) {
! /* only a two-level domain name */
! sprintf(mask, "%s!*%s@%s", nickname, username, hostname);
} else if (cnt == 2) {
! for (i=0; user->hostname[i] != '.'; i++) ;
! hostname = user->hostname+i+1;
! sprintf(mask, "%s!*%s@*.%s", nickname, username, hostname);
} else {
! for (cnt=3, i--; cnt; i--) {
! if (user->hostname[i] == '.') cnt--;
}
! hostname = user->hostname+i+2;
! sprintf(mask, "%s!*%s@*.%s", nickname, username, hostname);
}
}
return mask;
}
--- 519,601 ----
}
! char *
! generate_hostmask(struct userNode *user, int options)
{
! char *nickname, *username, *hostname;
! char *mask;
! int len, ii;
!
! /* figure out string parts */
! if (options & GENMASK_OMITNICK) {
! nickname = NULL;
! } else if (options & GENMASK_USENICK) {
! nickname = user->nick;
} else {
! nickname = "*";
! }
! if (options & GENMASK_STRICT) {
! username = user->username;
! } else {
! username = alloca(strlen(user->username)+2);
! username[0] = '*';
! strcpy(username+1, user->username + ((*user->username == '~')?1:0));
! }
! hostname = user->hostname;
! if (options & GENMASK_STRICT) {
! /* leave hostname as is */
! } else if ((options & GENMASK_BYIP) || !hostname[strspn(hostname, "0123456789.")]) {
! /* Should generate an IP-based hostmask. By popular acclaim, a /16
! * hostmask is used by default. */
! unsigned masked_ip, mask, masklen;
! masklen = 16;
! mask = ~0 << masklen;
! masked_ip = user->ip & mask;
! hostname = alloca(32);
! if (options & GENMASK_SRVXMASK) {
! sprintf(hostname, "%d.%d.%d.%d/%d", (masked_ip>>24)&0xFF, (masked_ip>>16)&0xFF, (masked_ip>>8)&0xFF, masked_ip&0xFF, masklen);
! } else {
! int ofs = 0;
! for (ii=0; ii<4; ii++) {
! if (masklen) {
! ofs += sprintf(hostname+ofs, "%d.", (masked_ip>>24)&0xFF);
! masklen -= 8;
! masked_ip <<= 8;
! } else {
! ofs += sprintf(hostname+ofs, "*.");
! }
}
! /* Truncate the last . */
! hostname[ofs-1] = 0;
}
+ } else {
+ int cnt;
/* This heuristic could be made smarter. Is it worth the effort? */
! for (ii=cnt=0; hostname[ii]; ii++) {
! if (hostname[ii] == '.') cnt++;
! }
if (cnt == 1) {
! /* only a two-level domain name; leave hostname */
} else if (cnt == 2) {
! for (ii=0; user->hostname[ii] != '.'; ii++) ;
! hostname = alloca(strlen(user->hostname+ii)+2);
! sprintf(hostname, "*%s", user->hostname+ii+1);
} else {
! for (cnt=3, ii--; cnt; ii--) {
! if (user->hostname[ii] == '.') cnt--;
}
! hostname = alloca(strlen(user->hostname+ii)+2);
! sprintf(hostname, "*%s", user->hostname+ii+1);
}
}
+ /* Emit hostmask */
+ len = strlen(username) + strlen(hostname) + 2;
+ if (nickname) {
+ len += strlen(nickname) + 1;
+ mask = malloc(len);
+ sprintf(mask, "%s!%s@%s", nickname, username, hostname);
+ } else {
+ mask = malloc(len);
+ sprintf(mask, "%s@%s", username, hostname);
+ }
return mask;
}
***************
*** 675,679 ****
}
if (pos != start+accum) return 0;
! } else if(*str == 0) {
break;
} else {
--- 713,717 ----
}
if (pos != start+accum) return 0;
! } else if (*str == 0) {
break;
} else {
***************
*** 788,814 ****
}
- int ban_match_user(struct userNode *user, char *ban)
- {
- int match = 0;
- char *hostmask = generate_hostmask(user, 1, 0);
- match = match_ircglob(hostmask, ban);
- free(hostmask);
-
- if(match) return 1;
-
- hostmask = alloca(16);
- sprintf(hostmask, "%d.%d.%d.%d", (int)((user->ip >> 24) & 255), (int)((user->ip >> 16) & 255), (int)((user->ip >> 8) & 255), (int)(user->ip & 255));
- return match_ircglob(hostmask, ban);
- }
-
- int ban_match_user_host(struct userNode *user, char *hostmask, char *ban)
- {
- if(match_ircglob(hostmask, ban)) return 1;
-
- hostmask = alloca(16);
- sprintf(hostmask, "%d.%d.%d.%d", (int)((user->ip >> 24) & 255), (int)((user->ip >> 16) & 255), (int)((user->ip >> 8) & 255), (int)(user->ip & 255));
- return match_ircglob(hostmask, ban);
- }
-
int
set_policer_param(const char *param, void *data, void *extra)
--- 826,829 ----
***************
*** 834,862 ****
}
- int
- string_buffer_sprintf(struct string_buffer *buf, const char *format, va_list al) {
- int ret;
- /* Normally, I'd pass NULL as the first parameter to vsnprintf.
- * But guess what? It makes FreeBSD's libc allocate a buffer that it
- * never frees! Surprise!
- * The kludge-around is to pass a non-NULL pointer instead.
- */
- if ((ret = vsnprintf((char*)&ret, 0, format, al)) <= 0) {
- /* non-C99 behavior */
- buf->size = strlen(format);
- buf->list = malloc(buf->size);
- while ((ret = vsnprintf(buf->list, buf->size, format, al)) == -1) {
- buf->size <<= 1;
- buf->list = realloc(buf->list, buf->size);
- }
- } else {
- /* C99 is nice about how vsnprintf fails */
- buf->size = ret + 1;
- buf->list = malloc(buf->size);
- ret = vsnprintf(buf->list, buf->size, format, al);
- }
- return buf->used = ret;
- }
-
void
string_buffer_replace(struct string_buffer *buf, unsigned int from, unsigned int len, const char *repl)
--- 849,852 ----
***************
*** 874,877 ****
--- 864,874 ----
memmove(buf->list+from+repl_len, buf->list+from+len, strlen(buf->list+from+len));
strcpy(buf->list+from, repl);
+ }
+
+ char *intoa(unsigned long addr) {
+ struct in_addr in;
+
+ in.s_addr = addr;
+ return inet_ntoa(in);
}
Index: timeq.c
===================================================================
RCS file: /cvsroot/srvx/services/src/timeq.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** timeq.c 2001/06/11 22:54:07 1.10
--- timeq.c 2001/08/19 03:06:09 1.11
***************
*** 25,28 ****
--- 25,62 ----
#include "common.h"
+ #if HAVE_PTHREAD_H && SOCKCHECK_USABLE /* we could have multiple threads setting glines */
+ #include <pthread.h>
+ /* Sigh. Want recursive mutexes in standard!
+ * (The timeq mutex needs to be recursive since callers frequently do timeq_add from
+ * within timeq_run() callbacks.) */
+ static pthread_mutex_t timeq_mutex = PTHREAD_MUTEX_INITIALIZER;
+ static pthread_cond_t timeq_condvar = PTHREAD_COND_INITIALIZER;
+ static pthread_t timeq_locker;
+ static int timeq_mutex_count;
+
+ static void
+ timeq_mutex_lock(void) {
+ pthread_mutex_lock(&timeq_mutex);
+ if ((timeq_mutex_count > 0) && (timeq_locker != pthread_self())) {
+ pthread_cond_wait(&timeq_condvar, &timeq_mutex);
+ }
+ timeq_locker = pthread_self();
+ timeq_mutex_count++;
+ pthread_mutex_unlock(&timeq_mutex);
+ }
+
+ static void
+ timeq_mutex_unlock(void) {
+ pthread_mutex_lock(&timeq_mutex);
+ timeq_mutex_count--;
+ if (!timeq_mutex_count) pthread_cond_signal(&timeq_condvar);
+ pthread_mutex_unlock(&timeq_mutex);
+ }
+
+ #else
+ #define timeq_mutex_lock() /*noop*/
+ #define timeq_mutex_unlock() /*noop*/
+ #endif
+
#include "heap.h"
#include "timeq.h"
***************
*** 53,57 ****
--- 87,93 ----
{
time_t time;
+ timeq_mutex_lock();
heap_peek(timeq, &time, NULL);
+ timeq_mutex_unlock();
return time;
}
***************
*** 63,67 ****
--- 99,105 ----
ent->func = func;
ent->data = data;
+ timeq_mutex_lock();
heap_insert(timeq, when, ent);
+ timeq_mutex_unlock();
}
***************
*** 73,77 ****
};
! int
timeq_del_matching(time_t key, void *data, void *extra)
{
--- 111,115 ----
};
! static int
timeq_del_matching(time_t key, void *data, void *extra)
{
***************
*** 93,97 ****
--- 131,137 ----
extra.data = data;
extra.mask = mask;
+ timeq_mutex_lock();
heap_remove_pred(timeq, timeq_del_matching, &extra);
+ timeq_mutex_unlock();
}
***************
*** 102,105 ****
--- 142,146 ----
void *d;
struct timeq_entry *ent;
+ timeq_mutex_lock();
while (1) {
heap_peek(timeq, &k, &d);
***************
*** 110,112 ****
--- 151,154 ----
free(ent);
}
+ timeq_mutex_unlock();
}
Index: sockcheck.h
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** sockcheck.h 2001/03/30 21:20:10 1.7
--- sockcheck.h 2001/08/19 03:06:09 1.8
***************
*** 29,32 ****
--- 29,33 ----
unsigned int pending_ip_count;
unsigned int test_count;
+ unsigned int cached_ip_count;
};
Index: sockcheck.c
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -r1.59 -r1.60
*** sockcheck.c 2001/08/01 22:14:35 1.59
--- sockcheck.c 2001/08/19 03:06:09 1.60
***************
*** 57,68 ****
#include "conf.h"
#include "dict.h"
#include "log.h"
#include "recdb.h"
- #include "tools.h"
#include "sockcheck.h"
static int disable_sockcheck;
! #if defined(HAVE_POLL) && defined(HAVE_PTHREAD) && !defined(__CYGWIN__)
#if !defined(SOCKCHECK_DEBUG)
--- 57,70 ----
#include "conf.h"
#include "dict.h"
+ #include "gline.h"
#include "log.h"
#include "recdb.h"
#include "sockcheck.h"
+ #include "tools.h"
+ #include "uplink.h"
static int disable_sockcheck;
! #if SOCKCHECK_USABLE
#if !defined(SOCKCHECK_DEBUG)
***************
*** 91,94 ****
--- 93,99 ----
} *sockcheck_cache_info;
+ DECLARE_LIST(sci_list, sockcheck_cache_info);
+ DEFINE_LIST(sci_list, sockcheck_cache_info);
+
/* And here's the list of hostnames that need to be started on.
* This is primarily used by the worker thread, although the main
***************
*** 129,132 ****
--- 134,138 ----
unsigned short port;
unsigned short timeout;
+ unsigned short reps;
enum sockcheck_decision type;
const char *template;
***************
*** 146,149 ****
--- 152,156 ----
sockcheck_cache_info addr;
unsigned int test_index;
+ unsigned short test_rep;
struct sockcheck_state *state;
unsigned int send_size, send_used, send_pos;
***************
*** 168,173 ****
static unsigned int sockcheck_num_sockets;
static struct pollfd *poll_list;
! static struct sockcheck_client *client_list;
static struct timeval tv_now;
static unsigned int proxies_detected, checked_ip_count;
--- 175,181 ----
static unsigned int sockcheck_num_sockets;
static struct pollfd *poll_list;
! static struct sockcheck_client **client_list;
static struct timeval tv_now;
+ static time_t last_clean;
static unsigned int proxies_detected, checked_ip_count;
***************
*** 220,224 ****
strcpy(target+2, sci->hostname);
log(PC_LOG, LOG_INFO, "Issuing gline for client at IP %08lx hostname %s: %s\n", sci->addr, sci->hostname, sci->reason);
! irc_gline(target, 3600, sci->reason);
}
--- 228,232 ----
strcpy(target+2, sci->hostname);
log(PC_LOG, LOG_INFO, "Issuing gline for client at IP %08lx hostname %s: %s\n", sci->addr, sci->hostname, sci->reason);
! gline_add("ProxyCheck", target, 3600, sci->reason, 1);
}
***************
*** 266,269 ****
--- 274,285 ----
{
int res;
+ sockcheck_cache_info sci;
+
+ if ((sci = dict_find(checked_ip_dict, name, NULL))) {
+ if ((sci->decision == PENDING) || (sci->decision == CHECKING)) {
+ return -1;
+ }
+ }
+
if (pthread_mutex_lock(&checked_ip_mutex)) {
/* lock failure; this usually means coding error */
***************
*** 348,353 ****
/* TODO: consider allowing non-NULL p_expansion with non-zero p_exp_length,
! * to avoid the malloc() impact. if it's important for speed.
! */
static void
expand_var(const struct sockcheck_client *client, unsigned char var, unsigned char **p_expansion, unsigned int *p_exp_length)
--- 364,368 ----
/* TODO: consider allowing non-NULL p_expansion with non-zero p_exp_length,
! * to avoid the malloc() impact. If it's important for speed. */
static void
expand_var(const struct sockcheck_client *client, unsigned char var, unsigned char **p_expansion, unsigned int *p_exp_length)
***************
*** 364,369 ****
/* expand variable */
switch (var) {
case 'i':
! exp4 = htonl(client->addr->addr);
exp_length = sizeof(exp4);
expansion = (unsigned char*)&exp4;
--- 379,388 ----
/* expand variable */
switch (var) {
+ case 'c':
+ expansion = client->addr->hostname;
+ exp_length = strlen(expansion);
+ break;
case 'i':
! exp4 = client->addr->addr;
exp_length = sizeof(exp4);
expansion = (unsigned char*)&exp4;
***************
*** 374,381 ****
expansion = (unsigned char*)&exp2;
break;
- case 'u':
- expansion = self->uplink->name;
- exp_length = strlen(expansion);
- break;
default:
expansion = "";
--- 393,396 ----
***************
*** 400,405 ****
client->writing = 1;
client->send_used = 0;
- client->send_size = strlen(template) >> 1;
- client->send = malloc(client->send_size);
while (*template) {
unsigned char *target;
--- 415,418 ----
***************
*** 421,425 ****
--- 434,440 ----
unsigned int exp_length;
expand_var(client, template[1], &expansion, &exp_length);
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Expanded var %c for client %s to \"%s\" (len %d, pos %d)\n", template[1], client->addr->hostname, expansion, exp_length, client->send_used);
+ #endif
if (client->send_used+exp_length >= client->send_size) {
do {
***************
*** 447,456 ****
client->read_pos = 0;
client->read_used = 0;
- client->read_timeout.tv_sec = tv_now.tv_sec + client->state->timeout / 1000;
- client->read_timeout.tv_usec = tv_now.tv_usec + (client->state->timeout % 1000) * 1000;
- if (client->read_timeout.tv_usec > 1000000) {
- client->read_timeout.tv_sec++;
- client->read_timeout.tv_usec -= 1000000;
- }
#if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "elaborated state: ");
--- 462,465 ----
***************
*** 465,479 ****
sockcheck_begin_test(unsigned int idx)
{
! struct sockcheck_client *client = client_list+idx;
struct pollfd *poller = poll_list+idx+1;
struct sockaddr_in sin;
int flags;
client->state = client->tests->list[client->test_index];
if (!client->state) {
! client->test_index++;
! return;
}
! poller->events = POLLIN|POLLOUT;
poller->revents = 0; /* otherwise we get confused this poll iteration.. */
if ((poller->fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
--- 474,497 ----
sockcheck_begin_test(unsigned int idx)
{
! struct sockcheck_client *client = client_list[idx];
struct pollfd *poller = poll_list+idx+1;
struct sockaddr_in sin;
int flags;
+ client->connected = 0;
client->state = client->tests->list[client->test_index];
if (!client->state) {
! client->test_index++;
! return;
}
!
! client->read_timeout.tv_sec = tv_now.tv_sec + client->state->timeout / 1000;
! client->read_timeout.tv_usec = tv_now.tv_usec + (client->state->timeout % 1000) * 1000;
! if (client->read_timeout.tv_usec > 1000000) {
! client->read_timeout.tv_sec++;
! client->read_timeout.tv_usec -= 1000000;
! }
!
! poller->events = POLLIN | POLLOUT;
poller->revents = 0; /* otherwise we get confused this poll iteration.. */
if ((poller->fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
***************
*** 498,503 ****
}
}
log(PC_LOG, LOG_INFO, "Starting proxy check on port %d (test %d) for client %s, fd %d\n", client->state->port, client->test_index, client->addr->hostname, poller->fd);
! client->connected = 0;
return;
--- 516,522 ----
}
}
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Starting proxy check on port %d (test %d) for client %s, fd %d\n", client->state->port, client->test_index, client->addr->hostname, poller->fd);
! #endif
return;
***************
*** 507,519 ****
poller->fd = -2;
client->state = NULL;
- client->test_index++;
return;
}
static int
sockcheck_worker_queue_client(unsigned int idx)
{
sockcheck_cache_info sci;
- struct sockcheck_client *client;
const char *new_addr;
--- 526,562 ----
poller->fd = -2;
client->state = NULL;
return;
}
+ static struct sockcheck_client *
+ sockcheck_alloc_client(sockcheck_cache_info sci)
+ {
+ struct sockcheck_client *client = malloc(sizeof(*client));
+ memset(client, 0, sizeof(*client));
+ client->tests = tests;
+ client->tests->refs++;
+ client->addr = sci;
+ client->send_size = 32;
+ client->send = malloc(client->send_size);
+ client->read_size = sockcheck_conf.max_read;
+ client->read = malloc(client->read_size);
+ client->resp_state = malloc(max_responses * sizeof(client->resp_state[0]));
+ return client;
+ }
+
+ static void
+ sockcheck_free_client(struct sockcheck_client *client)
+ {
+ sockcheck_list_unref(client->tests);
+ free(client->send);
+ free(client->read);
+ free(client->resp_state);
+ free(client);
+ }
+
static int
sockcheck_worker_queue_client(unsigned int idx)
{
sockcheck_cache_info sci;
const char *new_addr;
***************
*** 521,525 ****
if (idx == (unsigned)-1) idx = sockcheck_num_sockets;
if (idx == sockcheck_conf.max_sockets) return 0;
- client = client_list + idx;
new_addr = pending_ip_list->list[0];
memmove(pending_ip_list->list, pending_ip_list->list+1,
--- 564,567 ----
***************
*** 540,551 ****
}
if (!tests) return 0;
! log(PC_LOG, LOG_INFO, "Proxy-checking client at %08lx (%s) as client %d (now %d in progress)\n", sci->addr, sci->hostname, idx, sockcheck_num_sockets);
! client->tests = tests;
! client->tests->refs++;
! client->addr = sci;
! client->test_index = 0;
! client->state = NULL;
! client->send_size = 0;
! client->read_used = 0;
sockcheck_begin_test(idx);
return 1;
--- 582,590 ----
}
if (!tests) return 0;
! #if SOCKCHECK_DEBUG
! log(PC_LOG, LOG_INFO, "Proxy-checking client at %08x (%s) as client %d (now %d in progress)\n", sci->addr, sci->hostname, idx, sockcheck_num_sockets);
! #endif
! client_list[idx] = sockcheck_alloc_client(sci);
! client_list[idx]->test_rep = 0;
sockcheck_begin_test(idx);
return 1;
***************
*** 555,559 ****
sockcheck_decide(unsigned int idx, enum sockcheck_decision decision)
{
! struct sockcheck_client *client = client_list+idx;
checked_ip_count++;
--- 594,599 ----
sockcheck_decide(unsigned int idx, enum sockcheck_decision decision)
{
! struct sockcheck_client *client = client_list[idx];
! unsigned int n;
checked_ip_count++;
***************
*** 563,581 ****
if (decision == ACCEPT) {
/* do nothing */
! log(PC_LOG, LOG_INFO, "Proxy check passed for client at IP %08lx hostname %s\n", client->addr->addr, client->addr->hostname);
} else if (decision == REJECT) {
proxies_detected++;
sockcheck_issue_gline(client->addr);
! log(PC_LOG, LOG_INFO, "Proxy check failed for client at IP %08lx hostname %s (%s)\n", client->addr->addr, client->addr->hostname, client->addr->reason);
! /* don't compare idx != 0 directly, because somebody else may have
! * reordered the tests already
! */
if (client->tests->list[client->test_index] != tests->list[0]) {
struct sockcheck_list *new_tests = sockcheck_list_clone(tests);
struct sockcheck_state *new_first = client->tests->list[client->test_index];
! unsigned int n;
! for (n=client->test_index; n>0; n--) {
! new_tests->list[n] = new_tests->list[n-1];
! }
new_tests->list[0] = new_first;
sockcheck_list_unref(tests);
--- 603,622 ----
if (decision == ACCEPT) {
/* do nothing */
! #if SOCKCHECK_DEBUG
! log(PC_LOG, LOG_INFO, "Proxy check passed for client at IP %08x hostname %s\n", client->addr->addr, client->addr->hostname);
! #endif
} else if (decision == REJECT) {
proxies_detected++;
sockcheck_issue_gline(client->addr);
! #if SOCKCHECK_DEBUG
! log(PC_LOG, LOG_INFO, "Proxy check failed for client at IP %08x hostname %s (%s)\n", client->addr->addr, client->addr->hostname, client->addr->reason);
! #endif
! /* Don't compare idx != 0 directly, because somebody else may have
! * reordered the tests already. */
if (client->tests->list[client->test_index] != tests->list[0]) {
struct sockcheck_list *new_tests = sockcheck_list_clone(tests);
struct sockcheck_state *new_first = client->tests->list[client->test_index];
! for (n=0; (n<tests->used) && (tests->list[n] != new_first); n++) ;
! for (; n>0; n--) new_tests->list[n] = new_tests->list[n-1];
new_tests->list[0] = new_first;
sockcheck_list_unref(tests);
***************
*** 585,599 ****
log(PC_LOG, LOG_ERROR, "BUG: sockcheck_decide(\"%s\", %d): unrecognized decision\n", client->addr->hostname, decision);
}
- sockcheck_list_unref(client->tests);
- /* .. and clean up this instance. */
- if (client->send_size) {
- #if SOCKCHECK_DEBUG
- log(PC_LOG, LOG_INFO, "Freeing client send buffer: size %d used %d buffer %p\n", client->send_size, client->send_used, client->send);
- #endif
- client->send_size = 0;
- client->send_used = 0;
- free(client->send);
- }
- client->addr = NULL;
}
--- 626,629 ----
***************
*** 619,622 ****
--- 649,653 ----
/* read what we can from the fd */
int res;
+ unsigned int n;
res = read(fd, client->read + client->read_used, client->read_size - client->read_used);
***************
*** 632,640 ****
}
/* See if what's been read matches any of the expected responses */
while (client->read_pos < client->read_used) {
unsigned char curr, bleh;
const unsigned char *resp_state;
- unsigned int n;
curr = client->read[client->read_pos++];
--- 663,681 ----
}
+ /* Handle responses that dont require reading */
+ if (client->read_pos == client->read_used) {
+ for (n=0; n<(client->state->responses.used-1); n++) {
+ /* since we have nothing to read we will never enter the while() loop */
+ if (client->resp_state[n] && !strlen(client->resp_state[n])) {
+ log(PC_LOG, LOG_ERROR, "Choosing response %d for client %s\n", n, client->addr->hostname);
+ return n;
+ }
+ }
+ }
+
/* See if what's been read matches any of the expected responses */
while (client->read_pos < client->read_used) {
unsigned char curr, bleh;
const unsigned char *resp_state;
curr = client->read[client->read_pos++];
***************
*** 689,697 ****
--- 730,742 ----
if (client->read_used >= client->read_size) {
/* we got more data than we expected to get .. don't read any more */
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Buffer filled (unmatched) for client %s\n", client->addr->hostname);
+ #endif
return client->state->responses.used - 1;
} else if (TV_CMP(tv_now, >, client->read_timeout)) {
/* read timed out, use default handler. */
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Read timeout expired for client %s\n", client->addr->hostname);
+ #endif
return client->state->responses.used - 1;
} else {
***************
*** 705,712 ****
sockcheck_advance(unsigned int idx)
{
! struct sockcheck_client *client = client_list+idx;
struct pollfd *poller = poll_list+idx+1;
int next_state = -1;
if (!client->connected) {
if (poller->revents & POLLHUP) {
--- 750,763 ----
sockcheck_advance(unsigned int idx)
{
! struct sockcheck_client *client = client_list[idx];
struct pollfd *poller = poll_list+idx+1;
int next_state = -1;
+ if (!client->state) {
+ /* If we got here with a NULL state, connect() to the client
+ * previously failed. Advance it to the next test. */
+ goto next_test;
+ }
+
if (!client->connected) {
if (poller->revents & POLLHUP) {
***************
*** 715,724 ****
close(poller->fd);
log(PC_LOG, LOG_ERROR, "Client %s gave us a POLLHUP on fd %d\n", client->addr->hostname, poller->fd);
! if (++client->test_index == client->tests->used) {
! sockcheck_decide(idx, ACCEPT);
! return 1;
! } else {
! sockcheck_begin_test(idx);
! }
} else if (poller->revents & (POLLOUT|POLLIN)) {
int rc, arglen = sizeof(rc);
--- 766,770 ----
close(poller->fd);
log(PC_LOG, LOG_ERROR, "Client %s gave us a POLLHUP on fd %d\n", client->addr->hostname, poller->fd);
! goto next_test;
} else if (poller->revents & (POLLOUT|POLLIN)) {
int rc, arglen = sizeof(rc);
***************
*** 729,733 ****
--- 775,781 ----
case ECONNREFUSED:
case ETIMEDOUT:
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Client %s gave us errno %d (%s)\n", client->addr->hostname, rc, strerror(rc));
+ #endif
goto disconn;
case 0: break;
***************
*** 793,797 ****
#endif
client->state = ns;
! switch(ns->type) {
case CHECKING: break;
case REJECT:
--- 841,845 ----
#endif
client->state = ns;
! switch (ns->type) {
case CHECKING: break;
case REJECT:
***************
*** 801,809 ****
case ACCEPT:
close(poller->fd);
! if (++client->test_index == client->tests->used) {
sockcheck_decide(idx, ACCEPT);
return 1;
- } else {
- sockcheck_begin_test(idx);
}
break;
--- 849,861 ----
case ACCEPT:
close(poller->fd);
! next_test:
! if (++client->test_rep < client->tests->list[client->test_index]->reps) {
! sockcheck_begin_test(idx);
! } else if (++client->test_index < client->tests->used) {
! client->test_rep = 0;
! sockcheck_begin_test(idx);
! } else {
sockcheck_decide(idx, ACCEPT);
return 1;
}
break;
***************
*** 816,819 ****
--- 868,891 ----
}
+ static int
+ find_old_entries(const char *hostname, void *data, void *extra)
+ {
+ sockcheck_cache_info sci = data;
+ struct sci_list *cleaned = extra;
+
+ (void)hostname;
+ switch (sci->decision) {
+ case ACCEPT:
+ case REJECT:
+ /* Forget anything more than an hour old. */
+ if (sci->last_touched < (tv_now.tv_sec - 3600)) sci_list_append(cleaned, sci);
+ break;
+ default:
+ /* Do nothing. */
+ break;
+ }
+ return 0;
+ }
+
static void *
sockcheck_worker(void *arg)
***************
*** 821,825 ****
--- 893,900 ----
int res, timeout, err_count=0;
unsigned int n;
+ struct sci_list cleaned;
+
(void)arg;
+ sci_list_init(&cleaned);
while (1) {
timeout = sockcheck_num_sockets ? 1000 : -1;
***************
*** 827,865 ****
if (pending_ip_pipe[0] == -1) break;
if (res >= 0) {
err_count = 0;
if (poll_list[0].revents) sockcheck_read_pending();
while (sockcheck_worker_queue_client(-1)) ;
! if (gettimeofday(&tv_now, NULL) < 0) {
! log(PC_LOG, LOG_ERROR, "BUG: sockcheck_worker(): gettimeofday() returned errno %d (%s)\n", errno, strerror(errno));
! }
for (n=0; n<sockcheck_num_sockets; n++) {
! struct sockcheck_client *orig_client;
! const unsigned char **resp_state_hack;
! unsigned char *read_hack;
!
! /* Do work. If we have work left to do, continue. */
! if (sockcheck_advance(n) == 0) continue;
! /* Testing done. Decrement number of sockets in progress. */
sockcheck_num_sockets--;
! /* If we can replace the current client, continue. */
! if (sockcheck_worker_queue_client(n)) continue;
! /* If we can't do more useful work, see if we should swap things down further. */
! if (n == sockcheck_num_sockets) continue;
! /* no work to do, so swap something down */
#if SOCKCHECK_DEBUG
! log(PC_LOG, LOG_INFO, "sockcheck moving client %s (at %d) to fill hole at %d\n", client_list[sockcheck_num_sockets].addr->hostname, sockcheck_num_sockets, n);
#endif
! poll_list[n+1] = poll_list[sockcheck_num_sockets+1];
! /* Do nasty hacks since the resp_state and read pointers are
! * allocated on a per-slot basis, and shouldn't be put into
! * more than one slot.
! */
! resp_state_hack = client_list[n].resp_state;
! read_hack = client_list[n].read;
! orig_client = client_list + sockcheck_num_sockets;
! client_list[n] = *orig_client;
! orig_client->read = read_hack;
! orig_client->resp_state = resp_state_hack;
! /* And when we are done swapping, rescan this one */
n--;
}
--- 902,936 ----
if (pending_ip_pipe[0] == -1) break;
if (res >= 0) {
+ if (gettimeofday(&tv_now, NULL) < 0) {
+ log(PC_LOG, LOG_ERROR, "BUG: sockcheck_worker(): gettimeofday() returned errno %d (%s)\n", errno, strerror(errno));
+ }
+ /* This isn't done with timeq because timeq is in the wrong thread :( */
+ if (tv_now.tv_sec > (last_clean + 3600)) {
+ cleaned.used = 0;
+ dict_foreach(checked_ip_dict, find_old_entries, &cleaned);
+ for (n=0; n<cleaned.used; n++) {
+ dict_remove(checked_ip_dict, cleaned.list[n]->hostname);
+ }
+ }
+ /* Do we have any new requests or connetions? */
err_count = 0;
if (poll_list[0].revents) sockcheck_read_pending();
while (sockcheck_worker_queue_client(-1)) ;
! /* Handle existing connections */
for (n=0; n<sockcheck_num_sockets; n++) {
! /* Do work. If the client's not done, continue. */
! if (!sockcheck_advance(n)) continue;
! /* Testing done. Free client and decrement number of sockets in progress. */
sockcheck_num_sockets--;
! sockcheck_free_client(client_list[n]);
! /* Swap down the highest-numbered socket client, if necessary. */
! if (n != sockcheck_num_sockets) {
#if SOCKCHECK_DEBUG
! log(PC_LOG, LOG_INFO, "sockcheck moving client %s (at %d) to fill hole at %d\n", client_list[sockcheck_num_sockets]->addr->hostname, sockcheck_num_sockets, n);
#endif
! poll_list[n+1] = poll_list[sockcheck_num_sockets+1];
! client_list[n] = client_list[sockcheck_num_sockets];
! }
! client_list[sockcheck_num_sockets] = 0;
n--;
}
***************
*** 876,879 ****
--- 947,951 ----
}
}
+ sci_list_clean(&cleaned);
return NULL;
}
***************
*** 938,976 ****
dict_t object;
struct sockcheck_state *new_test;
! unsigned int n, found;
rd = data;
new_test = malloc(sizeof(*new_test));
new_test->template = NULL;
new_test->port = strtoul(key, &end, 0);
new_test->timeout = 5000;
new_test->type = CHECKING;
response_list_init(&new_test->responses);
! if ((*end != ':') || !(object = GET_RECORD_OBJECT(rd))) {
log(PC_LOG, LOG_ERROR, "Error: misformed sockcheck test `%s', skipping it\n", key);
free(new_test);
return 1;
}
- new_test->template = strdup(end+1);
dict_foreach(object, sockcheck_create_response, new_test);
! /* if none of the responses have template "other", create a
! * default response that goes to accept.
! */
! found = (unsigned)-1;
for (n=0; n<new_test->responses.used; n++) {
! if (!strcmp(new_test->responses.list[n]->template, "other")) {
! found = n;
! }
}
! if (found == (unsigned)-1) {
rd = alloc_record_data_qstring("accept");
sockcheck_create_response("other", rd, new_test);
free_record_data(rd);
! } else if (found != (new_test->responses.used - 1)) {
struct sockcheck_response *tmp;
/* switch the response for "other" to the end */
tmp = new_test->responses.list[new_test->responses.used - 1];
! new_test->responses.list[new_test->responses.used - 1] = new_test->responses.list[found];
! new_test->responses.list[found] = tmp;
}
--- 1010,1059 ----
dict_t object;
struct sockcheck_state *new_test;
! unsigned int n;
rd = data;
new_test = malloc(sizeof(*new_test));
new_test->template = NULL;
+ new_test->reps = 1;
new_test->port = strtoul(key, &end, 0);
new_test->timeout = 5000;
new_test->type = CHECKING;
response_list_init(&new_test->responses);
! if (!(object = GET_RECORD_OBJECT(rd))) {
log(PC_LOG, LOG_ERROR, "Error: misformed sockcheck test `%s', skipping it\n", key);
+ free(new_test);
+ return 1;
+ }
+ while (*end) {
+ switch (*end) {
+ case '*': new_test->reps = strtoul(end+1, &end, 0); break;
+ case ':': new_test->template = strdup(end+1); end += strlen(end); break;
+ default:
+ log(PC_LOG, LOG_ERROR, "Error: misformed sockcheck test `%s', skipping it\n", key);
+ free(new_test);
+ return 1;
+ }
+ }
+ if (!new_test->template) {
+ log(PC_LOG, LOG_ERROR, "Error: misformed sockcheck test `%s', skipping it\n", key);
free(new_test);
return 1;
}
dict_foreach(object, sockcheck_create_response, new_test);
! /* If none of the responses have template "other", create a
! * default response that goes to accept. */
for (n=0; n<new_test->responses.used; n++) {
! if (!strcmp(new_test->responses.list[n]->template, "other")) break;
}
! if (n == new_test->responses.used) {
rd = alloc_record_data_qstring("accept");
sockcheck_create_response("other", rd, new_test);
free_record_data(rd);
! } else if (n != (new_test->responses.used - 1)) {
struct sockcheck_response *tmp;
/* switch the response for "other" to the end */
tmp = new_test->responses.list[new_test->responses.used - 1];
! new_test->responses.list[new_test->responses.used - 1] = new_test->responses.list[n];
! new_test->responses.list[n] = tmp;
}
***************
*** 1116,1119 ****
--- 1199,1203 ----
dict_delete(checked_ip_dict);
free(pending_ip_list); /* not free_string_list because it doesn't own them */
+ free(deq_buff);
if (tests) {
for (n=0; n<tests->used; n++) {
***************
*** 1133,1141 ****
if (client_list) {
for (n=0; n<sockcheck_conf.max_sockets; n++) {
! if (client_list[n].send_size) {
! free(client_list[n].send);
! }
! free(client_list[n].read);
! free(client_list[n].resp_state);
}
free(client_list);
--- 1217,1223 ----
if (client_list) {
for (n=0; n<sockcheck_conf.max_sockets; n++) {
! if (client_list[n]) {
! sockcheck_free_client(client_list[n]);
! }
}
free(client_list);
***************
*** 1146,1150 ****
_sockcheck_init(void)
{
- unsigned int n;
int flags;
--- 1228,1231 ----
***************
*** 1169,1180 ****
sockcheck_read_tests();
if (disable_sockcheck) return;
! client_list = malloc(sockcheck_conf.max_sockets * sizeof(client_list[0]));
! for (n=0; n<sockcheck_conf.max_sockets; n++) {
! client_list[n].send_size = 32;
! client_list[n].send = malloc(client_list[n].send_size);
! client_list[n].read_size = sockcheck_conf.max_read;
! client_list[n].read = malloc(client_list[n].read_size);
! client_list[n].resp_state = malloc(max_responses * sizeof(client_list[n].resp_state[0]));
! }
if (pthread_create(&sockcheck_thread, NULL, sockcheck_worker, NULL)) {
log(PC_LOG, LOG_ERROR, "pthread_create(..., sockcheck_worker, ...) returned errno %d (%s)\n", errno, strerror(errno));
--- 1250,1255 ----
sockcheck_read_tests();
if (disable_sockcheck) return;
! client_list = calloc(sockcheck_conf.max_sockets, sizeof(client_list[0]));
! last_clean = now;
if (pthread_create(&sockcheck_thread, NULL, sockcheck_worker, NULL)) {
log(PC_LOG, LOG_ERROR, "pthread_create(..., sockcheck_worker, ...) returned errno %d (%s)\n", errno, strerror(errno));
***************
*** 1202,1205 ****
--- 1277,1281 ----
stats->pending_ip_count = pending_ip_list->used;
stats->test_count = tests ? tests->used : 0;
+ stats->cached_ip_count = dict_size(checked_ip_dict);
}
***************
*** 1221,1225 ****
}
! #endif /* defined(HAVE_POLL) && defined(HAVE_PTHREAD) */
!
!
--- 1297,1299 ----
}
! #endif
Index: recdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/recdb.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** recdb.c 2001/08/01 22:14:35 1.30
--- recdb.c 2001/08/19 03:06:09 1.31
***************
*** 38,49 ****
--- 38,52 ----
#if HAVE_GETC_UNLOCKED
+ #undef fgetc
#define fgetc(STR) getc_unlocked(STR)
#endif
#if HAVE_PUTC_UNLOCKED
+ #undef fputc
#define fputc(CHR,STR) putc_unlocked(CHR,STR)
#endif
#if HAVE_FEOF_UNLOCKED
+ #undef feof
#define feof(STR) feof_unlocked(STR)
#endif
Index: proto_ircu_p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** proto_ircu_p10.c 2001/08/19 01:28:39 1.18
--- proto_ircu_p10.c 2001/08/19 03:06:09 1.19
***************
*** 614,617 ****
--- 614,623 ----
void
+ irc_stats(struct userNode *from, struct server *target, char type)
+ {
+ putsock("%s STATS %c :%s", from->numeric, type, target->numeric);
+ }
+
+ void
irc_part(struct userNode *who, struct chanNode *what, const char *reason)
{
***************
*** 1166,1171 ****
return 1;
} else {
! struct chanNode *cn = GetChannel(argv[2]);
! struct userNode *un = GetUserX(argv[0]);
int next_arg=4, res=1, add=1, bit;
const char *mchange;
--- 1172,1177 ----
return 1;
} else {
! struct chanNode *cn;
! struct userNode *un;
int next_arg=4, res=1, add=1, bit;
const char *mchange;
***************
*** 1175,1178 ****
--- 1181,1186 ----
unsigned int orig_limit;
+ cn = GetChannel(argv[2]);
+ un = GetUserX(argv[0]);
if (!cn) {
log(MAIN_LOG, LOG_ERROR, "Unable to find channel %s whose mode is changing\n", argv[2]);
***************
*** 1303,1306 ****
--- 1311,1321 ----
}
+ static CMD_FUNC(cmd_num_gline)
+ {
+ if (argc < 7) return 0;
+ gline_add(argv[0]+1, argv[4], atoi(argv[5])-now, argv[6], 0);
+ return 1;
+ }
+
static CMD_FUNC(cmd_quit)
{
***************
*** 1464,1470 ****
if (argc != 4) return 0;
pd.user = GetUserX(argv[0]);
! /* The gag flag is never applied to userNodes it does not belong on,
! so no worries. */
! if(IsGagged(pd.user)) return 1;
pd.is_notice = 0;
pd.text = argv[3];
--- 1479,1483 ----
if (argc != 4) return 0;
pd.user = GetUserX(argv[0]);
! if (!pd.user || (IsGagged(pd.user) && !IsOper(pd.user))) return 1;
pd.is_notice = 0;
pd.text = argv[3];
***************
*** 1478,1483 ****
if (argc != 4) return 0;
pd.user = GetUserX(argv[0]);
pd.is_notice = 1;
- if (IsGagged(pd.user) && !IsOper(pd.user)) return 1;
pd.text = argv[3];
parse_foreach(argv[2], privmsg_chan_helper, NULL, privmsg_user_helper, NULL, &pd);
--- 1491,1496 ----
if (argc != 4) return 0;
pd.user = GetUserX(argv[0]);
+ if (!pd.user || (IsGagged(pd.user) && !IsOper(pd.user))) return 1;
pd.is_notice = 1;
pd.text = argv[3];
parse_foreach(argv[2], privmsg_chan_helper, NULL, privmsg_user_helper, NULL, &pd);
***************
*** 1637,1640 ****
--- 1650,1656 ----
dict_insert(irc_func_dict, "332", cmd_num_topic);
dict_insert(irc_func_dict, "333", cmd_num_topic);
+ /* "stats g" responses */
+ dict_insert(irc_func_dict, "247", cmd_num_gline);
+ dict_insert(irc_func_dict, "219", cmd_dummy); /* "End of /STATS report" */
/* other numeric responses we might get */
dict_insert(irc_func_dict, "401", cmd_dummy); /* target left network */
Index: proto_bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto_bahamut.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** proto_bahamut.c 2001/08/19 01:28:39 1.8
--- proto_bahamut.c 2001/08/19 03:06:09 1.9
***************
*** 253,257 ****
}
! putsock("%s %s %d :%s", CMD_SQUIT, srv->name, 0, message);
if (srv == self->uplink) {
--- 253,257 ----
}
! putsock("%s %s %d :%s", CMD_SQUIT, self->name, 0, message);
if (srv == self->uplink) {
***************
*** 436,439 ****
--- 436,445 ----
{
putsock("%s", what);
+ }
+
+ void
+ irc_stats(struct userNode *from, struct server *target, char type)
+ {
+ putsock(":%s STATS %c :%s", from->nick, type, target->name);
}
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** proto.h 2001/08/19 01:28:39 1.37
--- proto.h 2001/08/19 03:06:09 1.38
***************
*** 68,82 ****
#ifndef PROTO_MODENODE_MODES
! #define PROTO_MODENODE_MODES RFC1459_MODENODE_MODES
#define PROTO_MODENODE_MODE_CHARS RFC1459_MODENODE_MODE_CHARS
#endif
#ifndef PROTO_CHANNEL_MODES
! #define PROTO_CHANNEL_MODES RFC1459_CHANNEL_MODES
#define PROTO_CHANNEL_MODE_CHARS RFC1459_CHANNEL_MODE_CHARS
#endif
#ifndef PROTO_USER_MODES
! #define PROTO_USER_MODES RFC1459_USER_MODES
#define PROTO_USER_MODE_CHARS RFC1459_USER_MODE_CHARS
#endif
--- 68,82 ----
#ifndef PROTO_MODENODE_MODES
! #define PROTO_MODENODE_MODES RFC1459_MODENODE_MODES
#define PROTO_MODENODE_MODE_CHARS RFC1459_MODENODE_MODE_CHARS
#endif
#ifndef PROTO_CHANNEL_MODES
! #define PROTO_CHANNEL_MODES RFC1459_CHANNEL_MODES
#define PROTO_CHANNEL_MODE_CHARS RFC1459_CHANNEL_MODE_CHARS
#endif
#ifndef PROTO_USER_MODES
! #define PROTO_USER_MODES RFC1459_USER_MODES
#define PROTO_USER_MODE_CHARS RFC1459_USER_MODE_CHARS
#endif
***************
*** 118,121 ****
--- 118,122 ----
void irc_kill(struct userNode *from, struct userNode *target, const char *message);
void irc_raw(const char *what);
+ void irc_stats(struct userNode *from, struct server *target, char type);
/********************/
***************
*** 128,132 ****
void reg_mode_change_func(mode_change_func_t handler);
! int parse_line(unsigned char *);
/**********************/
--- 129,133 ----
void reg_mode_change_func(mode_change_func_t handler);
! int parse_line(unsigned char *line);
/**********************/
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** opserv.help 2001/07/15 14:49:25 1.28
--- opserv.help 2001/08/19 03:06:09 1.29
***************
*** 3,7 ****
"${index}");
"ACCESS" ("$bACCESS$b",
! "/msg $O ACCESS <handle>",
"Displays the access level on $b$O$b for the specified handle.",
"$uSee Also:$u none");
--- 3,7 ----
"${index}");
"ACCESS" ("$bACCESS$b",
! "/msg $O ACCESS [handle]",
"Displays the access level on $b$O$b for the specified handle.",
"$uSee Also:$u none");
***************
*** 12,16 ****
"ALERT REACTION" ("$bALERT REACTION$b",
"Valid alert actions (to be taken when an alert is hit) are:",
! " notice Send a notice to the $O alert channel",
"$uSee Also:$u addalert, delalert");
"ADDBAD" ("$bADDBAD$b",
--- 12,17 ----
"ALERT REACTION" ("$bALERT REACTION$b",
"Valid alert actions (to be taken when an alert is hit) are:",
! "$bNOTICE$b: Send a notice to the $b$O$b alert channel",
! "$bGLINE$b: Gline the user that tripped the alert",
"$uSee Also:$u addalert, delalert");
"ADDBAD" ("$bADDBAD$b",
***************
*** 58,62 ****
"$uSee Also:$u ban, unban");
"CLEARHOST" ("$bCLEARHOST$b",
! "/msg $O CLEARHOST <host>",
"Removes any data for the given host in sockcheck's proxy test result cache.",
"$uSee Also:$u hostscan");
--- 59,63 ----
"$uSee Also:$u ban, unban");
"CLEARHOST" ("$bCLEARHOST$b",
! "/msg $O CLEARHOST <host/nick>",
"Removes any data for the given host in sockcheck's proxy test result cache.",
"$uSee Also:$u hostscan");
***************
*** 145,150 ****
"$bMASK$b user@host Specifies a mask to search for.",
"$bLIMIT$b count Limits the number of matching glines.",
! "$bREASON$b mask Looks for glines with the given reason.",
! "$bISSUER$b mask Looks for glines issued by the given mask.",
"$bAFTER$b interval Looks for glines that expire more than $binterval$b in the future.");
"HELP" ("$bHELP$b",
--- 146,151 ----
"$bMASK$b user@host Specifies a mask to search for.",
"$bLIMIT$b count Limits the number of matching glines.",
! "$bREASON$b reason Looks for glines with the given reason.",
! "$bISSUER$b handle Looks for glines issued by the given handle.",
"$bAFTER$b interval Looks for glines that expire more than $binterval$b in the future.");
"HELP" ("$bHELP$b",
***************
*** 152,156 ****
"Displays help information for the specified topic or command. If no topic or command is specified, help returns basic $bhelp$b information for $b$O$b.");
"HOSTSCAN" ("$bHOSTSCAN$b",
! "/msg $O HOSTSCAN <host>",
"Adds the speicified host to the proxycheck queue. If the host is found to have a running proxy, then that host is GLINED for an hour.",
"$uSee Also:$u trace");
--- 153,157 ----
"Displays help information for the specified topic or command. If no topic or command is specified, help returns basic $bhelp$b information for $b$O$b.");
"HOSTSCAN" ("$bHOSTSCAN$b",
! "/msg $O HOSTSCAN <host/nick>",
"Adds the speicified host to the proxycheck queue. If the host is found to have a running proxy, then that host is GLINED for an hour.",
"$uSee Also:$u trace");
***************
*** 203,208 ****
" $bGLOBAL$b: Displays $b$G$b log.",
" $bPROXYCHECK$b: Displays proxycheck log.",
! "$bTEXT$b: Displays results that match the vaule of $btext$b.",
! "$bLIMIT$b: Limits results printed by $b$O$b to that of the vaule of $blimit$b.");
"LO...
[truncated message content] |
|
From: Entrope <en...@us...> - 2001-08-19 03:06:14
|
Update of /cvsroot/srvx/services
In directory usw-pr-cvs1:/tmp/cvs-serv32442
Modified Files:
configure.ac
Log Message:
merge more 1.0 branch changes onto trunk
Index: configure.ac
===================================================================
RCS file: /cvsroot/srvx/services/configure.ac,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** configure.ac 2001/07/26 14:28:05 1.4
--- configure.ac 2001/08/19 03:06:09 1.5
***************
*** 47,50 ****
--- 47,53 ----
EXTRA_DEFINE="-fno-builtin"
;;
+ *-linux*)
+ EXTRA_DEFINE="-D_GNU_SOURCE"
+ ;;
*)
EXTRA_DEFINE="-ansi"
***************
*** 91,95 ****
fi
! AC_CHECK_FUNCS(bcopy memcpy memset stricmp strcasecmp strncasecmp strdup strerror strstr strsignal localtime_r setrlimit,,)
AC_CHECK_FUNCS(poll,,AC_MSG_WARN([poll(2) is not present -- proxy checking will not work.]))
--- 94,98 ----
fi
! AC_CHECK_FUNCS(bcopy memcpy memset stricmp strcasestr strcasecmp strncasecmp strdup strerror strstr strsignal localtime_r setrlimit,,)
AC_CHECK_FUNCS(poll,,AC_MSG_WARN([poll(2) is not present -- proxy checking will not work.]))
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv20851/src
Modified Files:
tools.h tools.c proto_ircu_p10.h proto_ircu_p10.c
proto_bahamut.h proto_bahamut.c proto.h hash.h
Log Message:
start supporting different sets of user/channel modes for different protocols
Index: tools.h
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** tools.h 2001/08/12 20:47:38 1.9
--- tools.h 2001/08/19 01:28:39 1.10
***************
*** 76,78 ****
--- 76,81 ----
void string_buffer_replace(struct string_buffer *buf, unsigned int from, unsigned int len, const char *repl);
+ int make_chanmode(struct chanNode *chan, char *out, int len);
+ int make_usermode(struct userNode *user, char *out, int len);
+
#endif /* ifdef _TOOLS_H_ */
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -C2 -r1.89 -r1.90
*** tools.c 2001/08/12 20:47:38 1.89
--- tools.c 2001/08/19 01:28:39 1.90
***************
*** 53,57 ****
static oper_func_t *of_list;
! static unsigned int of_size = 0, of_used = 0;
void
--- 53,57 ----
static oper_func_t *of_list;
! static unsigned int of_size, of_used;
void
***************
*** 81,85 ****
}
! void mod_usermode(struct userNode *user, const char *mode_change) {
int add = 1;
if (!user || !mode_change || !*mode_change) return;
--- 81,93 ----
}
! static const char *user_modes = PROTO_USER_MODE_CHARS;
! static unsigned char user_inverse_modes[256];
! static const char *channel_modes = PROTO_CHANNEL_MODE_CHARS;
! static unsigned char channel_inverse_modes[256];
!
! static int
!
! void
! mod_usermode(struct userNode *user, const char *mode_change) {
int add = 1;
if (!user || !mode_change || !*mode_change) return;
***************
*** 108,112 ****
}
break;
- case 'O': do_user_mode(FLAGS_LOCOP); break;
case 'i': do_user_mode(FLAGS_INVISIBLE);
if (add) invis_clients++; else invis_clients--;
--- 116,119 ----
***************
*** 122,127 ****
}
}
! void mod_chanmode(struct chanNode *channel, const char *mode_change, const char *key, int limit)
{
int add = 1, n;
--- 129,141 ----
}
}
+
+ int
+ make_usermode(struct userNode *user, char *out, int len)
+ {
+
+ }
! void
! mod_chanmode(struct chanNode *channel, const char *mode_change, const char *key, int limit)
{
int add = 1, n;
***************
*** 179,184 ****
}
}
! int verify_chanmode(const char *modes)
{
const char *word = modes;
--- 193,205 ----
}
}
+
+ int
+ make_chanmode(struct chanMode *chan, char *out, int len)
+ {
+
+ }
! int
! verify_chanmode(const char *modes)
{
const char *word = modes;
***************
*** 187,192 ****
res = 1;
! if(!modes) return 0;
! if(!*modes) return 1;
while (*word != ' ' && *word) word++;
--- 208,213 ----
res = 1;
! if (!modes) return 0;
! if (!*modes) return 1;
while (*word != ' ' && *word) word++;
Index: proto_ircu_p10.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** proto_ircu_p10.h 2001/07/15 23:21:29 1.2
--- proto_ircu_p10.h 2001/08/19 01:28:39 1.3
***************
*** 22,33 ****
#define PROTO_IRCU_P10_H
! #define SERVER_NUMERIC_LEN 1
! #define USER_NUMERIC_LEN 2
! #define COMBO_NUMERIC_LEN (SERVER_NUMERIC_LEN+USER_NUMERIC_LEN)
! #define MAXMODEPARAMS 6
! #define MAXBANS 30
! #define USERARRAYSIZE 4096
! #define PROTO_HAS_NUMERIC 1
struct userNode_proto {
--- 22,36 ----
#define PROTO_IRCU_P10_H
! #define MAXMODEPARAMS 6
! #define MAXBANS 30
! #define USERARRAYSIZE 4096
! #define SERVER_NUMERIC_LEN 1
! #define USER_NUMERIC_LEN 2
! #define COMBO_NUMERIC_LEN (SERVER_NUMERIC_LEN+USER_NUMERIC_LEN)
!
! #define PROTO_HAS_NUMERIC 1
! #define PROTO_USER_MODES (RFC1459_USER_MODES|FLAGS_DEAF|FLAGS_SERVICE|FLAGS_GLOBAL|FLAGS_HELPER)
! #define PROTO_USER_MODE_CHARS RFC1459_USER_MODE_CHARS"dkgh"
struct userNode_proto {
Index: proto_ircu_p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** proto_ircu_p10.c 2001/08/11 17:47:43 1.17
--- proto_ircu_p10.c 2001/08/19 01:28:39 1.18
***************
*** 318,321 ****
--- 318,323 ----
int modelen = 0;
char modes[9];
+
+
if (IsOper(user)) modes[modelen++] = 'o';
if (IsInvisible(user)) modes[modelen++] = 'i';
***************
*** 1170,1173 ****
--- 1172,1177 ----
struct modeNode *mn;
chan_mode_t mode;
+ char orig_key[KEYLEN+1];
+ unsigned int orig_limit;
if (!cn) {
***************
*** 1177,1180 ****
--- 1181,1186 ----
mchange = argv[3];
mode = cn->modes;
+ strcpy(orig_key, cn->key);
+ orig_limit = cn->limit;
while (*mchange) {
switch (*mchange++) {
***************
*** 1192,1207 ****
case 'l':
if (add) {
- mode |= MODE_LIMIT;
cn->limit = atoi(argv[next_arg++]);
} else {
! mode &= ~MODE_LIMIT;
}
break;
case 'k':
if (add) {
- mode |= MODE_KEY;
safestrncpy(cn->key, argv[next_arg++], sizeof(cn->key));
} else {
! mode &= ~MODE_KEY;
}
break;
--- 1198,1211 ----
case 'l':
if (add) {
cn->limit = atoi(argv[next_arg++]);
} else {
! cn->limit = 0;
}
break;
case 'k':
if (add) {
safestrncpy(cn->key, argv[next_arg++], sizeof(cn->key));
} else {
! cn->key[0] = 0;
}
break;
***************
*** 1224,1235 ****
if (add) mn->modes |= bit;
else mn->modes &= ~bit;
! if(bit != MODE_CHANOP) break;
! if(un) call_mode_change_funcs(cn, un, add ? MODE_CHANGE_OP : MODE_CHANGE_DEOP, vic);
break;}
case 'b': {
char *ban = argv[next_arg++];
! if (add)
! {
AddChannelBan(1, &ban, cn, GetUserX(argv[0]), now, 0);
if (un) call_mode_change_funcs(cn, un, MODE_CHANGE_BAN, ban);
--- 1228,1238 ----
if (add) mn->modes |= bit;
else mn->modes &= ~bit;
! if (bit != MODE_CHANOP) break;
! if (un) call_mode_change_funcs(cn, un, add ? MODE_CHANGE_OP : MODE_CHANGE_DEOP, vic);
break;}
case 'b': {
char *ban = argv[next_arg++];
! if (add) {
AddChannelBan(1, &ban, cn, GetUserX(argv[0]), now, 0);
if (un) call_mode_change_funcs(cn, un, MODE_CHANGE_BAN, ban);
***************
*** 1240,1251 ****
}
! if(mode != cn->modes && un)
! {
cn->modes = mode;
call_mode_change_funcs(cn, un, MODE_CHANGE_MISC, NULL);
- }
- else
- {
- cn->modes = mode;
}
return res;
--- 1243,1249 ----
}
! if (un && ((mode != cn->modes) || (cn->limit != orig_limit) || (strcmp(cn->key, orig_key)))) {
cn->modes = mode;
call_mode_change_funcs(cn, un, MODE_CHANGE_MISC, NULL);
}
return res;
Index: proto_bahamut.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto_bahamut.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** proto_bahamut.h 2001/08/11 16:37:36 1.4
--- proto_bahamut.h 2001/08/19 01:28:39 1.5
***************
*** 24,33 ****
#include "dict.h"
! #define SERVER_NUMERIC_LEN 1
! #define USER_NUMERIC_LEN 2
! #define COMBO_NUMERIC_LEN (SERVER_NUMERIC_LEN+USER_NUMERIC_LEN)
! #define MAXMODEPARAMS 512
! #define MAXBANS 30
! #define USERARRAYSIZE 4096
struct userNode_proto {
--- 24,32 ----
#include "dict.h"
! #define PROTO_CHANNEL_MODES (RFC1459_CHANNEL_MODES|MODE_REGISTERED|MODE_REGONLY|MODE_NOCOLOR|MODE_OPERONLY)
! /* note the spaces in *_MODE_CHARS; they are to cover for modes that
! * Bahamut doesn't support, but exist in successive bits of the mask
! */
! #define PROTO_CHANNEL_MODE_CHARS RFC1459_CHANNEL_MODE_CHARS" rRcO"
struct userNode_proto {
Index: proto_bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto_bahamut.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** proto_bahamut.c 2001/08/11 17:47:43 1.7
--- proto_bahamut.c 2001/08/19 01:28:39 1.8
***************
*** 534,539 ****
burst_send_channel(const char *key, void *data, void *extra)
{
! (void)key; (void)data; (void)extra;
! /* TODO */
return 0;
}
--- 534,569 ----
burst_send_channel(const char *key, void *data, void *extra)
{
! struct chanNode *channel = data;
! struct modeNode *mn;
! unsigned int pos, base_len, nn;
! char burst_line[510];
!
! (void)key; (void)extra;
! base_len = snprintf(burst_line, sizeof(burst_line), ":%s SJOIN "FMT_TIME_T" %s ", self->name, channel->timestamp, channel->name);
! pos = base_len + irc_make_chanmode(channel, burst_line+base_len) - 1;
! burst_line[pos++] = ' ';
! burst_line[pos++] = ':';
! /* send the user list */
! for (nn=0; nn<channel->members.used; nn++) {
! mn = channel->members.list[nn];
! if (pos + strlen(mn->user->nick) > 505) {
! burst_line[pos-1] = 0; /* -1 to back up over the space */
! putsock("%s", burst_line);
! if (burst_line[base_len] == '+') {
! /* if this was the first line, rewrite it to have modes 0 */
! burst_line[base_len++] = '0';
! burst_line[base_len++] = ' ';
! }
! pos = base_len;
! }
! if (mn->modes & MODE_CHANOP) burst_line[pos++] = '@';
! if (mn->modes & MODE_VOICE) burst_line[pos++] = '+';
! strcpy(burst_line+pos, mn->user->nick);
! pos += strlen(mn->user->nick);
! burst_line[pos++] = ' ';
! }
! burst_line[pos-1] = 0; /* -1 to back up over the space */
! putsock("%s", burst_line);
! /* TODO: send the ban list */
return 0;
}
***************
*** 549,555 ****
/* burst local nicks */
dict_foreach(self->proto.clients, burst_send_nick, 0);
-
- /* burst channels */
- dict_foreach(channels, burst_send_channel, 0);
}
--- 579,582 ----
***************
*** 711,737 ****
}
/* Ignore argv[3] */
! /* TODO: argv[4] is uplink's idea of current time. Fake our responses appropriately. */
return 1;
}
! /* NICK <nick> <hops> <timestamp> <modes> <username> <hostname> <server> <ip> :<Clientinfo> */
static CMD_FUNC(cmd_nick)
{
struct server *uplink;
struct userNode *user;
! if (argc < 10) return 0;
! if ((user = GetUser(argv[1]))) {
! /* Nick collision - what to do? */
! log(MAIN_LOG, LOG_ERROR, "Nick collision for new user %s\n", argv[1]);
! return 0;
! }
! if (!(uplink = GetServer(argv[7]))) {
! /* Unknown server - what to do? */
! log(MAIN_LOG, LOG_ERROR, "Unknown server %s for new user %s\n", argv[7], argv[1]);
! return 0;
}
! user = AddUser(uplink, argv[1], argv[5], argv[6], argv[4], argv[9], atoi(argv[3]));
! if (user) user->ip = atoi(argv[8]);
! return 1;
}
--- 738,775 ----
}
/* Ignore argv[3] */
! /* TODO: argv[4] is uplink's idea of current time. Skew our responses appropriately. */
return 1;
}
! /* Announced by server:
! * NICK <nick> <hops> <timestamp> <modes> <username> <hostname> <server> <ip> :<Clientinfo>
! * Client nick change:
! * :<User> NICK <NewNick> :<TS>
! */
static CMD_FUNC(cmd_nick)
{
struct server *uplink;
struct userNode *user;
! if (argc == 3) {
! /* Client nick change */
! NickChange(GetUser(argv[-1]), argv[1]);
! return 1;
! } else if (argc == 10) {
! /* Announced by server */
! if ((user = GetUser(argv[1]))) {
! /* Nick collision - what to do? */
! log(MAIN_LOG, LOG_ERROR, "Nick collision for new user %s\n", argv[1]);
! return 0;
! }
! if (!(uplink = GetServer(argv[7]))) {
! /* Unknown server - what to do? */
! log(MAIN_LOG, LOG_ERROR, "Unknown server %s for new user %s\n", argv[7], argv[1]);
! return 0;
! }
! user = AddUser(uplink, argv[1], argv[5], argv[6], argv[4], argv[9], atoi(argv[3]));
! if (user) user->ip = atoi(argv[8]);
! return 1;
}
! return 0;
}
***************
*** 754,758 ****
}
if (argc != n+1) return 0;
! channel = AddChannel(argv[2], strtoul(argv[1], NULL, 0), modes, key, limit);
names = argv[n];
for (i=0; names[i]; ) {
--- 792,801 ----
}
if (argc != n+1) return 0;
! if (modes[0] != '0') {
! /* modes of "0" means a continuation line */
! channel = AddChannel(argv[2], strtoul(argv[1], NULL, 0), modes, key, limit);
! } else {
! channel = GetChannel(argv[2]);
! }
names = argv[n];
for (i=0; names[i]; ) {
***************
*** 777,780 ****
--- 820,829 ----
}
}
+ /* If this is the first line, send our user/ban list.
+ * TODO: Doing so makes ChanServ do bad things, since it tries to op itself above
+ * (in AddChannel()), which is _before_ it's "in" the channel. */
+ if (modes[0] != '0') {
+ burst_send_channel(channel->name, channel, 0);
+ }
return pass;
}
***************
*** 831,834 ****
--- 880,885 ----
struct modeNode *mn;
chan_mode_t mode;
+ char orig_key[KEYLEN+1];
+ unsigned int orig_limit;
if (!cn) {
***************
*** 838,841 ****
--- 889,894 ----
mchange = argv[2];
mode = cn->modes;
+ strcpy(orig_key, cn->key);
+ orig_limit = cn->limit;
while (*mchange) {
switch (*mchange++) {
***************
*** 853,868 ****
case 'l':
if (add) {
- mode |= MODE_LIMIT;
cn->limit = atoi(argv[next_arg++]);
} else {
! mode &= ~MODE_LIMIT;
}
break;
case 'k':
if (add) {
- mode |= MODE_KEY;
safestrncpy(cn->key, argv[next_arg++], sizeof(cn->key));
} else {
! mode &= ~MODE_KEY;
}
break;
--- 906,919 ----
case 'l':
if (add) {
cn->limit = atoi(argv[next_arg++]);
} else {
! cn->limit = 0;
}
break;
case 'k':
if (add) {
safestrncpy(cn->key, argv[next_arg++], sizeof(cn->key));
} else {
! cn->key[0] = 0;
}
break;
***************
*** 899,907 ****
}
! if (mode != cn->modes && un) {
cn->modes = mode;
call_mode_change_funcs(cn, un, MODE_CHANGE_MISC, NULL);
- } else {
- cn->modes = mode;
}
return res;
--- 950,956 ----
}
! if (un && ((mode != cn->modes) || (cn->limit != orig_limit) || (strcmp(cn->key, orig_key)))) {
cn->modes = mode;
call_mode_change_funcs(cn, un, MODE_CHANGE_MISC, NULL);
}
return res;
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** proto.h 2001/08/09 12:41:40 1.36
--- proto.h 2001/08/19 01:28:39 1.37
***************
*** 45,52 ****
#define MODE_CHANGE_BAN 0x008
- #define MAXLEN 512 /* This is used all over as a maximum string lenth - keep it large */
- #define MAXNUMPARAMS 200
#include PROTO_INCLUDE
/********************/
/* PROTOCOL SPEWING */
--- 45,85 ----
#define MODE_CHANGE_BAN 0x008
#include PROTO_INCLUDE
+ #ifndef PROTO_HAS_NUMERIC
+ #define PROTO_HAS_NUMERIC 0
+ #endif
+
+ #ifndef MAXLEN
+ #define MAXLEN 512
+ #endif
+
+ #ifndef MAXNUMPARAMS
+ #define MAXNUMPARAMS 200
+ #endif
+
+ #ifndef MAXBANS
+ #define MAXBANS 30
+ #endif
+
+ #ifndef MAXMODEPARAMS
+ #define MAXMODEPARAMS MAXNUMPARAMS
+ #endif
+
+ #ifndef PROTO_MODENODE_MODES
+ #define PROTO_MODENODE_MODES RFC1459_MODENODE_MODES
+ #define PROTO_MODENODE_MODE_CHARS RFC1459_MODENODE_MODE_CHARS
+ #endif
+
+ #ifndef PROTO_CHANNEL_MODES
+ #define PROTO_CHANNEL_MODES RFC1459_CHANNEL_MODES
+ #define PROTO_CHANNEL_MODE_CHARS RFC1459_CHANNEL_MODE_CHARS
+ #endif
+
+ #ifndef PROTO_USER_MODES
+ #define PROTO_USER_MODES RFC1459_USER_MODES
+ #define PROTO_USER_MODE_CHARS RFC1459_USER_MODE_CHARS
+ #endif
+
/********************/
/* PROTOCOL SPEWING */
***************
*** 73,77 ****
void irc_join(struct userNode *who, struct chanNode *what);
void irc_invite(struct userNode *from, struct userNode *who, struct chanNode *to);
- int irc_make_chanmode(struct chanNode *chan, char *out);
void irc_mode(struct userNode *from, struct chanNode *target, const char *modes);
void irc_kick(struct userNode *actor, struct userNode *who, struct chanNode *from, const char *msg);
--- 106,109 ----
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -r1.66 -r1.67
*** hash.h 2001/08/11 16:37:36 1.66
--- hash.h 2001/08/19 01:28:39 1.67
***************
*** 34,37 ****
--- 34,39 ----
#define MODE_CHANOP 0x0001
#define MODE_VOICE 0x0002
+ #define RFC1459_MODENODE_MODES (MODE_CHANOP|MODE_VOICE)
+ #define RFC1459_MODENODE_MODE_CHARS "ov"
/* in chanNode->modes */
***************
*** 48,69 ****
#define MODE_NOCOLOR 0x0400 /* No colored msgs to channel (Bahamut; +c) */
#define MODE_OPERONLY 0x0800 /* Only irc operators may join (Bahamut; +O) */
/* in userNode->modes */
! #define FLAGS_OPER 0x0001 /* IRC Operator +O */
! #define FLAGS_LOCOP 0x0002 /* Local Operator +o */
! #define FLAGS_INVISIBLE 0x0004 /* invisible +i */
! #define FLAGS_WALLOP 0x0008 /* receives wallops +w */
! #define FLAGS_SERVNOTICE 0x0010 /* receives server notices +s */
! #define FLAGS_DEAF 0x0020 /* deaf +d */
! #define FLAGS_SERVICE 0x0040 /* cannot be kicked, killed or deoped +k */
! #define FLAGS_GLOBAL 0x0080 /* receives global messages +g */
! #define FLAGS_HELPER 0x0100 /* (network?) helper +h */
! #define FLAGS_PERSISTENT 0x0200 /* for reserved nicks, this isn't just one-shot */
! #define FLAGS_GAGGED 0x0400 /* for gagged users */
! #define FLAGS_AWAY 0x0800 /* for away users */
#define IsOper(x) ((x)->modes & FLAGS_OPER)
#define IsService(x) ((x)->modes & FLAGS_SERVICE)
- #define IsDeaf(x) ((x)->modes & FLAGS_DEAF)
#define IsInvisible(x) ((x)->modes & FLAGS_INVISIBLE)
#define IsGlobal(x) ((x)->modes & FLAGS_GLOBAL)
--- 50,73 ----
#define MODE_NOCOLOR 0x0400 /* No colored msgs to channel (Bahamut; +c) */
#define MODE_OPERONLY 0x0800 /* Only irc operators may join (Bahamut; +O) */
+ #define RFC1459_CHANNEL_MODES (MODE_PRIVATE|MODE_SECRET|MODE_MODERATED|MODE_TOPICLIMIT|MODE_INVITEONLY|MODE_NOPRIVMSGS)
+ #define RFC1459_CHANNEL_MODE_CHARS "psmtin"
/* in userNode->modes */
! #define FLAGS_OPER 0x0001 /* IRC Operator +o */
! #define FLAGS_INVISIBLE 0x0002 /* invisible +i */
! #define FLAGS_WALLOP 0x0004 /* receives wallops +w */
! #define FLAGS_SERVNOTICE 0x0008 /* receives server notices +s */
! #define FLAGS_DEAF 0x0010 /* deaf +d */
! #define FLAGS_SERVICE 0x0020 /* cannot be kicked, killed or deoped +k */
! #define FLAGS_GLOBAL 0x0040 /* receives global messages +g */
! #define FLAGS_HELPER 0x0080 /* (network?) helper +h */
! #define FLAGS_PERSISTENT 0x0100 /* for reserved nicks, this isn't just one-shot */
! #define FLAGS_GAGGED 0x0200 /* for gagged users */
! #define FLAGS_AWAY 0x0400 /* for away users */
! #define RFC1459_USER_MODES (FLAGS_OPER|FLAGS_INVISIBLE|FLAGS_WALLOP|FLAGS_SERVNOTICE)
! #define RFC1459_USER_MODE_CHARS "oiws"
#define IsOper(x) ((x)->modes & FLAGS_OPER)
#define IsService(x) ((x)->modes & FLAGS_SERVICE)
#define IsInvisible(x) ((x)->modes & FLAGS_INVISIBLE)
#define IsGlobal(x) ((x)->modes & FLAGS_GLOBAL)
|
|
From: Entrope <en...@us...> - 2001-08-19 01:27:55
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv20701/src
Modified Files:
chanserv.c
Log Message:
handle mode changes where strlen(MODE_TARGET_USER(foo)) != 3
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -C2 -r1.178 -r1.179
*** chanserv.c 2001/08/11 17:47:43 1.178
--- chanserv.c 2001/08/19 01:27:52 1.179
***************
*** 2039,2043 ****
static CHANSERV_FUNC(cmd_down)
{
! char change[6 + (2 * COMBO_NUMERIC_LEN)];
struct modeNode *mn;
(void)argv;(void)argc;
--- 2039,2043 ----
static CHANSERV_FUNC(cmd_down)
{
! char *change;
struct modeNode *mn;
(void)argv;(void)argc;
***************
*** 2059,2062 ****
--- 2059,2063 ----
DelChannelVoice(1, &user, channel, channel->channel_info->bot, 0);
+ change = alloca(6 + 2*strlen(MODE_TARGET_USER(user)));
sprintf(change, "-ov %s %s", MODE_TARGET_USER(user), MODE_TARGET_USER(user));
irc_mode(channel->channel_info->bot, channel, change);
***************
*** 4227,4232 ****
if (!(cData = channel->channel_info)) return;
mn = GetUserMode(channel, chanserv);
! if (!mn) return;
! if (mn->modes & MODE_CHANOP) return;
AddChannelOp(1, &cData->bot, channel, cData->bot, 1);
--- 4228,4232 ----
if (!(cData = channel->channel_info)) return;
mn = GetUserMode(channel, chanserv);
! if (!mn || (mn->modes & MODE_CHANOP)) return;
AddChannelOp(1, &cData->bot, channel, cData->bot, 1);
***************
*** 4561,4569 ****
if(protect_user(victim, user, channel->channel_info))
{
! char change[7 + (2 * COMBO_NUMERIC_LEN)];
DelChannelOp(1, &user, channel, channel->channel_info->bot, 0);
AddChannelOp(1, &victim, channel, channel->channel_info->bot, 0);
sprintf(change, "+o-o %s %s", MODE_TARGET_USER(victim), MODE_TARGET_USER(user));
--- 4561,4570 ----
if(protect_user(victim, user, channel->channel_info))
{
! char *change;
DelChannelOp(1, &user, channel, channel->channel_info->bot, 0);
AddChannelOp(1, &victim, channel, channel->channel_info->bot, 0);
+ change = alloca(7+2*strlen(MODE_TARGET_USER(victim)));
sprintf(change, "+o-o %s %s", MODE_TARGET_USER(victim), MODE_TARGET_USER(user));
|
|
From: Entrope <en...@us...> - 2001-08-19 00:44:01
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv15055/src
Modified Files:
Tag: rel-1_0
chanserv.c
Log Message:
don't mark someone as present just for using a command
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.161.2.77
retrieving revision 1.161.2.78
diff -C2 -r1.161.2.77 -r1.161.2.78
*** chanserv.c 2001/08/15 03:13:40 1.161.2.77
--- chanserv.c 2001/08/19 00:43:58 1.161.2.78
***************
*** 807,811 ****
uData->seen = now;
- uData->present = 1;
}
--- 807,810 ----
|
|
From: Entrope <en...@us...> - 2001-08-19 00:40:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv14599/src
Modified Files:
Tag: rel-1_0
timeq.c
Log Message:
make a recursive mutex for protecting the timeq against modification from both threads
Index: timeq.c
===================================================================
RCS file: /cvsroot/srvx/services/src/timeq.c,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -r1.7.2.1 -r1.7.2.2
*** timeq.c 2001/03/29 00:20:52 1.7.2.1
--- timeq.c 2001/08/19 00:40:19 1.7.2.2
***************
*** 20,28 ****
#include "config.h"
- #ifdef HAVE_STDLIB_H
#include <stdlib.h>
- #endif
#include "common.h"
#include "heap.h"
#include "timeq.h"
--- 20,60 ----
#include "config.h"
#include <stdlib.h>
#include "common.h"
+ #if HAVE_PTHREAD_H && SOCKCHECK_USABLE /* we could have multiple threads setting glines */
+ #include <pthread.h>
+ /* Sigh. Want recursive mutexes in standard!
+ * (The timeq mutex needs to be recursive since callers frequently do timeq_add from
+ * within timeq_run() callbacks.) */
+ static pthread_mutex_t timeq_mutex = PTHREAD_MUTEX_INITIALIZER;
+ static pthread_cond_t timeq_condvar = PTHREAD_COND_INITIALIZER;
+ static pthread_t timeq_locker;
+ static int timeq_mutex_count;
+
+ static void
+ timeq_mutex_lock(void) {
+ pthread_mutex_lock(&timeq_mutex);
+ if ((timeq_mutex_count > 0) && (timeq_locker != pthread_self())) {
+ pthread_cond_wait(&timeq_condvar, &timeq_mutex);
+ }
+ timeq_locker = pthread_self();
+ timeq_mutex_count++;
+ pthread_mutex_unlock(&timeq_mutex);
+ }
+
+ static void
+ timeq_mutex_unlock(void) {
+ pthread_mutex_lock(&timeq_mutex);
+ timeq_mutex_count--;
+ if (!timeq_mutex_count) pthread_cond_signal(&timeq_condvar);
+ pthread_mutex_unlock(&timeq_mutex);
+ }
+
+ #else
+ #define timeq_mutex_lock() /*noop*/
+ #define timeq_mutex_unlock() /*noop*/
+ #endif
+
#include "heap.h"
#include "timeq.h"
***************
*** 39,42 ****
--- 71,75 ----
{
timeq = heap_new(int_comparator);
+ pthread_cond_signal(&timeq_condvar);
}
***************
*** 45,49 ****
--- 78,84 ----
{
void *time;
+ timeq_mutex_lock();
heap_peek(timeq, &time, 0);
+ timeq_mutex_unlock();
return TIME_T_CAST(time);
}
***************
*** 58,62 ****
--- 93,99 ----
ent->data = data;
w = (void*)TIME_T_CAST(when);
+ timeq_mutex_lock();
heap_insert(timeq, w, ent);
+ timeq_mutex_unlock();
}
***************
*** 68,72 ****
};
! int
timeq_del_matching(void *key, void *data, void *extra)
{
--- 105,109 ----
};
! static int
timeq_del_matching(void *key, void *data, void *extra)
{
***************
*** 88,92 ****
--- 125,131 ----
extra.data = data;
extra.mask = mask;
+ timeq_mutex_lock();
heap_remove_pred(timeq, timeq_del_matching, &extra);
+ timeq_mutex_unlock();
}
***************
*** 96,99 ****
--- 135,139 ----
void *k, *d;
struct timeq_entry *ent;
+ timeq_mutex_lock();
while (1) {
heap_peek(timeq, &k, &d);
***************
*** 104,106 ****
--- 144,147 ----
free(ent);
}
+ timeq_mutex_unlock();
}
|
|
From: Entrope <en...@us...> - 2001-08-19 00:39:09
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv14428/src
Modified Files:
Tag: rel-1_0
gline.c
Log Message:
correct header include order, so that glines are locked when appropriate
Index: gline.c
===================================================================
RCS file: /cvsroot/srvx/services/src/gline.c,v
retrieving revision 1.6.2.7
retrieving revision 1.6.2.8
diff -C2 -r1.6.2.7 -r1.6.2.8
*** gline.c 2001/08/16 02:38:15 1.6.2.7
--- gline.c 2001/08/19 00:39:06 1.6.2.8
***************
*** 23,26 ****
--- 23,27 ----
#include <stdlib.h>
+ #include "common.h"
#if HAVE_PTHREAD_H && SOCKCHECK_USABLE /* we could have multiple threads setting glines */
#include <pthread.h>
***************
*** 31,35 ****
#endif
- #include "common.h"
#include "heap.h"
#include "helpfile.h"
--- 32,35 ----
|
|
From: Entrope <en...@us...> - 2001-08-18 23:25:15
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4281/src
Modified Files:
Tag: rel-1_0
sockcheck.c
Log Message:
fix some memory leaks/bugs, and periodically prune checked_ip_dict
Index: sockcheck.c
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.c,v
retrieving revision 1.54.2.25
retrieving revision 1.54.2.26
diff -C2 -r1.54.2.25 -r1.54.2.26
*** sockcheck.c 2001/08/18 02:24:13 1.54.2.25
--- sockcheck.c 2001/08/18 23:25:12 1.54.2.26
***************
*** 91,94 ****
--- 91,97 ----
} *sockcheck_cache_info;
+ DECLARE_LIST(sci_list, sockcheck_cache_info);
+ DEFINE_LIST(sci_list, sockcheck_cache_info);
+
/* And here's the list of hostnames that need to be started on.
* This is primarily used by the worker thread, although the main
***************
*** 172,175 ****
--- 175,179 ----
static struct sockcheck_client **client_list;
static struct timeval tv_now;
+ static time_t last_clean;
static unsigned int proxies_detected, checked_ip_count;
***************
*** 358,363 ****
/* TODO: consider allowing non-NULL p_expansion with non-zero p_exp_length,
! * to avoid the malloc() impact. if it's important for speed.
! */
static void
expand_var(const struct sockcheck_client *client, unsigned char var, unsigned char **p_expansion, unsigned int *p_exp_length)
--- 362,366 ----
/* TODO: consider allowing non-NULL p_expansion with non-zero p_exp_length,
! * to avoid the malloc() impact. If it's important for speed. */
static void
expand_var(const struct sockcheck_client *client, unsigned char var, unsigned char **p_expansion, unsigned int *p_exp_length)
***************
*** 415,420 ****
client->writing = 1;
client->send_used = 0;
- client->send_size = strlen(template) >> 1;
- client->send = malloc(client->send_size);
while (*template) {
unsigned char *target;
--- 418,421 ----
***************
*** 550,556 ****
sockcheck_free_client(struct sockcheck_client *client)
{
! if (client->send_size) free(client->send);
free(client->read);
free(client->resp_state);
}
--- 551,559 ----
sockcheck_free_client(struct sockcheck_client *client)
{
! sockcheck_list_unref(client->tests);
! free(client->send);
free(client->read);
free(client->resp_state);
+ free(client);
}
***************
*** 595,598 ****
--- 598,602 ----
{
struct sockcheck_client *client = client_list[idx];
+ unsigned int n;
checked_ip_count++;
***************
*** 611,621 ****
log(PC_LOG, LOG_INFO, "Proxy check failed for client at IP %08x hostname %s (%s)\n", client->addr->addr, client->addr->hostname, client->addr->reason);
#endif
! /* don't compare idx != 0 directly, because somebody else may have
! * reordered the tests already
! */
if (client->tests->list[client->test_index] != tests->list[0]) {
struct sockcheck_list *new_tests = sockcheck_list_clone(tests);
struct sockcheck_state *new_first = client->tests->list[client->test_index];
! memmove(new_tests->list+1, new_tests->list, client->test_index*sizeof(new_tests->list[0]));
new_tests->list[0] = new_first;
sockcheck_list_unref(tests);
--- 615,625 ----
log(PC_LOG, LOG_INFO, "Proxy check failed for client at IP %08x hostname %s (%s)\n", client->addr->addr, client->addr->hostname, client->addr->reason);
#endif
! /* Don't compare idx != 0 directly, because somebody else may have
! * reordered the tests already. */
if (client->tests->list[client->test_index] != tests->list[0]) {
struct sockcheck_list *new_tests = sockcheck_list_clone(tests);
struct sockcheck_state *new_first = client->tests->list[client->test_index];
! for (n=0; (n<tests->used) && (tests->list[n] != new_first); n++) ;
! for (; n>0; n--) new_tests->list[n] = new_tests->list[n-1];
new_tests->list[0] = new_first;
sockcheck_list_unref(tests);
***************
*** 625,639 ****
log(PC_LOG, LOG_ERROR, "BUG: sockcheck_decide(\"%s\", %d): unrecognized decision\n", client->addr->hostname, decision);
}
- sockcheck_list_unref(client->tests);
- /* .. and clean up this instance. */
- if (client->send_size) {
- #if SOCKCHECK_DEBUG
- log(PC_LOG, LOG_INFO, "Freeing client send buffer: size %d used %d buffer %p\n", client->send_size, client->send_used, client->send);
- #endif
- client->send_size = 0;
- client->send_used = 0;
- free(client->send);
- }
- client->addr = NULL;
}
--- 629,632 ----
***************
*** 878,881 ****
--- 871,894 ----
}
+ static int
+ find_old_entries(const char *hostname, void *data, void *extra)
+ {
+ sockcheck_cache_info sci = data;
+ struct sci_list *cleaned = extra;
+
+ (void)hostname;
+ switch (sci->decision) {
+ case ACCEPT:
+ case REJECT:
+ /* Forget anything more than an hour old. */
+ if (sci->last_touched < (tv_now.tv_sec - 3600)) sci_list_append(cleaned, sci);
+ break;
+ default:
+ /* Do nothing. */
+ break;
+ }
+ return 0;
+ }
+
static void *
sockcheck_worker(void *arg)
***************
*** 883,887 ****
--- 896,903 ----
int res, timeout, err_count=0;
unsigned int n;
+ struct sci_list cleaned;
+
(void)arg;
+ sci_list_init(&cleaned);
while (1) {
timeout = sockcheck_num_sockets ? 1000 : -1;
***************
*** 889,914 ****
if (pending_ip_pipe[0] == -1) break;
if (res >= 0) {
- err_count = 0;
- if (poll_list[0].revents) sockcheck_read_pending();
if (gettimeofday(&tv_now, NULL) < 0) {
log(PC_LOG, LOG_ERROR, "BUG: sockcheck_worker(): gettimeofday() returned errno %d (%s)\n", errno, strerror(errno));
}
while (sockcheck_worker_queue_client(-1)) ;
for (n=0; n<sockcheck_num_sockets; n++) {
! /* Do work. If we have work left to do, continue. */
! if (sockcheck_advance(n) == 0) continue;
! /* Testing done. Decrement number of sockets in progress. */
sockcheck_num_sockets--;
! /* If we can replace the current client, continue. */
! if (sockcheck_worker_queue_client(n)) continue;
! /* If we can't do more useful work, see if we should swap things down further. */
! if (n == sockcheck_num_sockets) continue;
! /* no work to do, so swap something down */
#if SOCKCHECK_DEBUG
! log(PC_LOG, LOG_INFO, "sockcheck moving client %s (at %d) to fill hole at %d\n", client_list[sockcheck_num_sockets]->addr->hostname, sockcheck_num_sockets, n);
#endif
! poll_list[n+1] = poll_list[sockcheck_num_sockets+1];
! sockcheck_free_client(client_list[n]);
! client_list[n] = client_list[sockcheck_num_sockets];
n--;
}
--- 905,939 ----
if (pending_ip_pipe[0] == -1) break;
if (res >= 0) {
if (gettimeofday(&tv_now, NULL) < 0) {
log(PC_LOG, LOG_ERROR, "BUG: sockcheck_worker(): gettimeofday() returned errno %d (%s)\n", errno, strerror(errno));
}
+ /* This isn't done with timeq because timeq is in the wrong thread :( */
+ if (tv_now.tv_sec > (last_clean + 3600)) {
+ cleaned.used = 0;
+ dict_foreach(checked_ip_dict, find_old_entries, &cleaned);
+ for (n=0; n<cleaned.used; n++) {
+ dict_remove(checked_ip_dict, cleaned.list[n]->hostname);
+ }
+ }
+ /* Do we have any new requests or connetions? */
+ err_count = 0;
+ if (poll_list[0].revents) sockcheck_read_pending();
while (sockcheck_worker_queue_client(-1)) ;
+ /* Handle existing connections */
for (n=0; n<sockcheck_num_sockets; n++) {
! /* Do work. If the client's not done, continue. */
! if (!sockcheck_advance(n)) continue;
! /* Testing done. Free client and decrement number of sockets in progress. */
sockcheck_num_sockets--;
! sockcheck_free_client(client_list[n]);
! /* Swap down the highest-numbered socket client, if necessary. */
! if (n != sockcheck_num_sockets) {
#if SOCKCHECK_DEBUG
! log(PC_LOG, LOG_INFO, "sockcheck moving client %s (at %d) to fill hole at %d\n", client_list[sockcheck_num_sockets]->addr->hostname, sockcheck_num_sockets, n);
#endif
! poll_list[n+1] = poll_list[sockcheck_num_sockets+1];
! client_list[n] = client_list[sockcheck_num_sockets];
! }
! client_list[sockcheck_num_sockets] = 0;
n--;
}
***************
*** 925,928 ****
--- 950,954 ----
}
}
+ sci_list_clean(&cleaned);
return NULL;
}
***************
*** 987,991 ****
dict_t object;
struct sockcheck_state *new_test;
! unsigned int n, found;
rd = data;
--- 1013,1017 ----
dict_t object;
struct sockcheck_state *new_test;
! unsigned int n;
rd = data;
***************
*** 1018,1040 ****
}
dict_foreach(object, sockcheck_create_response, new_test);
! /* if none of the responses have template "other", create a
! * default response that goes to accept.
! */
! found = (unsigned)-1;
for (n=0; n<new_test->responses.used; n++) {
! if (!strcmp(new_test->responses.list[n]->template, "other")) {
! found = n;
! }
}
! if (found == (unsigned)-1) {
rd = alloc_record_data_qstring("accept");
sockcheck_create_response("other", rd, new_test);
free_record_data(rd);
! } else if (found != (new_test->responses.used - 1)) {
struct sockcheck_response *tmp;
/* switch the response for "other" to the end */
tmp = new_test->responses.list[new_test->responses.used - 1];
! new_test->responses.list[new_test->responses.used - 1] = new_test->responses.list[found];
! new_test->responses.list[found] = tmp;
}
--- 1044,1062 ----
}
dict_foreach(object, sockcheck_create_response, new_test);
! /* If none of the responses have template "other", create a
! * default response that goes to accept. */
for (n=0; n<new_test->responses.used; n++) {
! if (!strcmp(new_test->responses.list[n]->template, "other")) break;
}
! if (n == new_test->responses.used) {
rd = alloc_record_data_qstring("accept");
sockcheck_create_response("other", rd, new_test);
free_record_data(rd);
! } else if (n != (new_test->responses.used - 1)) {
struct sockcheck_response *tmp;
/* switch the response for "other" to the end */
tmp = new_test->responses.list[new_test->responses.used - 1];
! new_test->responses.list[new_test->responses.used - 1] = new_test->responses.list[n];
! new_test->responses.list[n] = tmp;
}
***************
*** 1180,1183 ****
--- 1202,1206 ----
dict_delete(checked_ip_dict);
free(pending_ip_list); /* not free_string_list because it doesn't own them */
+ free(deq_buff);
if (tests) {
for (n=0; n<tests->used; n++) {
***************
*** 1230,1235 ****
sockcheck_read_tests();
if (disable_sockcheck) return;
! client_list = malloc(sockcheck_conf.max_sockets * sizeof(client_list[0]));
! memset(client_list, 0, sockcheck_conf.max_sockets * sizeof(client_list[0]));
if (pthread_create(&sockcheck_thread, NULL, sockcheck_worker, NULL)) {
log(PC_LOG, LOG_ERROR, "pthread_create(..., sockcheck_worker, ...) returned errno %d (%s)\n", errno, strerror(errno));
--- 1253,1258 ----
sockcheck_read_tests();
if (disable_sockcheck) return;
! client_list = calloc(sockcheck_conf.max_sockets, sizeof(client_list[0]));
! last_clean = now;
if (pthread_create(&sockcheck_thread, NULL, sockcheck_worker, NULL)) {
log(PC_LOG, LOG_ERROR, "pthread_create(..., sockcheck_worker, ...) returned errno %d (%s)\n", errno, strerror(errno));
***************
*** 1278,1281 ****
#endif
-
-
--- 1301,1302 ----
|
|
From: Miles P. <pet...@us...> - 2001-08-18 02:24:17
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv27047
Modified Files:
Tag: rel-1_0
opserv.c sockcheck.c sockcheck.h
Log Message:
added cached_ip_count to stats struct
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.187.2.47
retrieving revision 1.187.2.48
diff -C2 -r1.187.2.47 -r1.187.2.48
*** opserv.c 2001/08/18 00:55:03 1.187.2.47
--- opserv.c 2001/08/18 02:24:13 1.187.2.48
***************
*** 185,189 ****
#define OSMSG_NO_LAST_WRITE "Last Database Write: Never"
#define OSMSG_LAST_WRITE "Last Database Write: %s Ago"
! #define OSMSG_SOCKCHECK_STATS "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 know how to detect %d kinds of proxies."
#define OSMSG_UNKNOWN_STATS "Unknown statistics type `%s'"
#define OSMSG_ADDRESS_QUEUED "`%s' is now queued to be proxy-checked."
--- 185,189 ----
#define OSMSG_NO_LAST_WRITE "Last Database Write: Never"
#define OSMSG_LAST_WRITE "Last Database Write: %s Ago"
! #define OSMSG_SOCKCHECK_STATS "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."
#define OSMSG_UNKNOWN_STATS "Unknown statistics type `%s'"
#define OSMSG_ADDRESS_QUEUED "`%s' is now queued to be proxy-checked."
***************
*** 1632,1636 ****
stats.failed_ip_count, stats.checking_ip_count,
stats.checking_ip_max, stats.pending_ip_count,
! stats.test_count);
#else
opserv_notice(user, OSMSG_MISSING_SUPPORT);
--- 1632,1636 ----
stats.failed_ip_count, stats.checking_ip_count,
stats.checking_ip_max, stats.pending_ip_count,
! stats.cached_ip_count, stats.test_count);
#else
opserv_notice(user, OSMSG_MISSING_SUPPORT);
Index: sockcheck.c
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.c,v
retrieving revision 1.54.2.24
retrieving revision 1.54.2.25
diff -C2 -r1.54.2.24 -r1.54.2.25
*** sockcheck.c 2001/08/15 03:21:38 1.54.2.24
--- sockcheck.c 2001/08/18 02:24:13 1.54.2.25
***************
*** 1257,1260 ****
--- 1257,1261 ----
stats->pending_ip_count = pending_ip_list->used;
stats->test_count = tests ? tests->used : 0;
+ stats->cached_ip_count = dict_size(checked_ip_dict);
}
Index: sockcheck.h
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.h,v
retrieving revision 1.6.4.1
retrieving revision 1.6.4.2
diff -C2 -r1.6.4.1 -r1.6.4.2
*** sockcheck.h 2001/03/29 00:20:52 1.6.4.1
--- sockcheck.h 2001/08/18 02:24:13 1.6.4.2
***************
*** 29,32 ****
--- 29,33 ----
unsigned int pending_ip_count;
unsigned int test_count;
+ unsigned int cached_ip_count;
};
|
|
From: Paul C. <zo...@us...> - 2001-08-18 00:55:06
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv12330/src
Modified Files:
Tag: rel-1_0
chanserv.help opserv.c
Log Message:
DOcument CMD_SUSPEND_OVERRIDE flag, fix a crash in OpServ's
cmd_access, and prevent srvx from crashing when the issuer of a ?trace
kill is a victim.
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.10.2.20
retrieving revision 1.10.2.21
diff -C2 -r1.10.2.20 -r1.10.2.21
*** chanserv.help 2001/08/09 12:28:39 1.10.2.20
--- chanserv.help 2001/08/18 00:55:03 1.10.2.21
***************
*** 181,184 ****
--- 181,185 ----
"$b256$b Do not log command usage (usually for read-only commands)",
"$b512$b User must be a helper",
+ "$b1024$b Command may be used in a suspended channel",
"As a side note, the bits with values 8 and 16 are not useful by themselves. For example, channels that may only be used by users on a channel's userlist usually have bits 2, 4, 8 and 16 set (flags 30). Furthermore, the flags noted as \"Locked\" above cannot be turned off; they will be re-enabled silently if you try to turn them off.");
"DELBAN" ("$bDELBAN$b",
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.187.2.46
retrieving revision 1.187.2.47
diff -C2 -r1.187.2.46 -r1.187.2.47
*** opserv.c 2001/08/16 02:39:18 1.187.2.46
--- opserv.c 2001/08/18 00:55:03 1.187.2.47
***************
*** 295,299 ****
while (0)
! typedef void (*discrim_search_func)(struct userNode *match, void *extra);
struct userNode *opserv;
--- 295,299 ----
while (0)
! typedef int (*discrim_search_func)(struct userNode *match, void *extra);
struct userNode *opserv;
***************
*** 496,500 ****
(void)channel; (void)argc;
! if (argv[1]) {
target = argv[1];
} else {
--- 496,500 ----
(void)channel; (void)argc;
! if(argc > 1) {
target = argv[1];
} else {
***************
*** 3012,3016 ****
for (n=0; n<matched.used; n++) {
! dsf(matched.list[n], data);
}
--- 3012,3020 ----
for (n=0; n<matched.used; n++) {
! if(dsf(matched.list[n], data)) {
! /* If a search function returns true, it ran into a
! problem. Stop going through the list. */
! break;
! }
}
***************
*** 3020,3042 ****
}
! static void
trace_print_func(struct userNode *match, void *extra)
{
struct discrim_and_source *das = extra;
opserv_notice(das->source, "%s!%s@%s", match->nick, match->username, match->hostname);
}
! static void
trace_count_func(struct userNode *match, void *extra)
{
(void)match;(void)extra;
}
#if defined(HAVE_POLL) && defined(HAVE_PTHREAD) && !defined(__CYGWIN__)
! static void
trace_scan_func(struct userNode *match, void *extra)
{
(void)extra;
sockcheck_queue_address(match->ip, match->hostname);
}
#endif
--- 3024,3049 ----
}
! static int
trace_print_func(struct userNode *match, void *extra)
{
struct discrim_and_source *das = extra;
opserv_notice(das->source, "%s!%s@%s", match->nick, match->username, match->hostname);
+ return 0;
}
! static int
trace_count_func(struct userNode *match, void *extra)
{
(void)match;(void)extra;
+ return 0;
}
#if defined(HAVE_POLL) && defined(HAVE_PTHREAD) && !defined(__CYGWIN__)
! static int
trace_scan_func(struct userNode *match, void *extra)
{
(void)extra;
sockcheck_queue_address(match->ip, match->hostname);
+ return 0;
}
#endif
***************
*** 3048,3062 ****
}
! static void
trace_gline_func(struct userNode *match, void *extra)
{
struct discrim_and_source *das = extra;
if (is_oper_victim(das->source, match)) opserv_block(match, das->source->handle_info->handle, das->discrim->reason);
}
! static void
trace_kill_func(struct userNode *match, void *extra)
{
struct discrim_and_source *das = extra;
if (is_oper_victim(das->source, match)) {
char *reason;
--- 3055,3085 ----
}
! static int
trace_gline_func(struct userNode *match, void *extra)
{
struct discrim_and_source *das = extra;
+
+ /* See the comment in trace_kill_func() below. */
+ if(das->source == match) {
+ return 0;
+ }
+
if (is_oper_victim(das->source, match)) opserv_block(match, das->source->handle_info->handle, das->discrim->reason);
+
+ return 0;
}
! static int
trace_kill_func(struct userNode *match, void *extra)
{
struct discrim_and_source *das = extra;
+
+ /* If the person who issues a trace kill is among its victims,
+ is_oper_vistim will dereference a pointer to a user that doesn't
+ exist anymore. We skip killing the issuing user to avoid this. */
+ if(das->source == match) {
+ return 0;
+ }
+
if (is_oper_victim(das->source, match)) {
char *reason;
***************
*** 3069,3072 ****
--- 3092,3097 ----
DelUser(match, opserv, true, reason);
}
+
+ return 0;
}
***************
*** 3084,3091 ****
}
! static void
trace_gag_func(struct userNode *match, void *extra)
{
struct discrim_and_source *das = extra;
if (is_oper_victim(das->source, match)) {
char *reason, *mask;
--- 3109,3117 ----
}
! static int
trace_gag_func(struct userNode *match, void *extra)
{
struct discrim_and_source *das = extra;
+
if (is_oper_victim(das->source, match)) {
char *reason, *mask;
***************
*** 3109,3112 ****
--- 3135,3140 ----
}
}
+
+ return 0;
}
***************
*** 3319,3323 ****
}
! void
gag_helper_func(struct userNode *match, void *extra)
{
--- 3347,3351 ----
}
! static int
gag_helper_func(struct userNode *match, void *extra)
{
***************
*** 3326,3332 ****
/* TODO: may want to create a list of hosts to protect from glines, gags
etc.. we could then test for such hosts here. */
! if(IsPrivileged(match) || IsLocal(match->numeric)) return;
match->modes |= FLAGS_GAGGED;
! return;
}
--- 3354,3360 ----
/* TODO: may want to create a list of hosts to protect from glines, gags
etc.. we could then test for such hosts here. */
! if(IsPrivileged(match) || IsLocal(match->numeric)) return 0;
match->modes |= FLAGS_GAGGED;
! return 0;
}
***************
*** 3398,3407 ****
}
! void
ungag_helper_func(struct userNode *match, void *extra)
{
(void)extra;
match->modes &= ~FLAGS_GAGGED;
! return;
}
--- 3426,3435 ----
}
! static int
ungag_helper_func(struct userNode *match, void *extra)
{
(void)extra;
match->modes &= ~FLAGS_GAGGED;
! return 0;
}
|
|
From: Entrope <en...@us...> - 2001-08-16 03:29:06
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv18263/src
Modified Files:
Tag: rel-1_0
nickserv.c
Log Message:
oops, clear FROZEN flag when somebody auths
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.138.2.42
retrieving revision 1.138.2.43
diff -C2 -r1.138.2.42 -r1.138.2.43
*** nickserv.c 2001/08/16 02:58:47 1.138.2.42
--- nickserv.c 2001/08/16 03:29:03 1.138.2.43
***************
*** 1001,1004 ****
--- 1001,1005 ----
}
+ HANDLE_CLEAR_FLAG(hi, FROZEN);
set_user_handle_info(user, hi);
nickserv_notice(user, NSMSG_AUTH_SUCCESS);
|
|
From: Entrope <en...@us...> - 2001-08-16 03:15:55
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv15164/src
Modified Files:
Tag: rel-1_0
tools.c
Log Message:
do ircu-style ip mask matching, rather than network-style ip mask matching
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.73.2.25
retrieving revision 1.73.2.26
diff -C2 -r1.73.2.25 -r1.73.2.26
*** tools.c 2001/08/14 15:31:38 1.73.2.25
--- tools.c 2001/08/16 03:15:52 1.73.2.26
***************
*** 505,514 ****
if (isdigit(*glob) && !glob[strspn(glob, "0123456789./*?")]) {
/* Looks like an IP-based mask */
! unsigned long addr, mask;
! if (!parse_ipmask(glob, &addr, &mask)) {
! log(MAIN_LOG, LOG_WARNING, "Glob \"%s\" looked like it had an IP hostmask, but parse_ipmask failed\n", glob);
! return 0;
! }
! return !((addr ^ user->ip) & mask);
} else {
/* The host part of the mask isn't IP-based */
--- 505,511 ----
if (isdigit(*glob) && !glob[strspn(glob, "0123456789./*?")]) {
/* Looks like an IP-based mask */
! unsigned char userip[20];
! sprintf(userip, "%ld.%ld.%ld.%ld", (user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255);
! return match_ircglob(userip, glob);
} else {
/* The host part of the mask isn't IP-based */
|
|
From: Entrope <en...@us...> - 2001-08-16 02:58:51
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv6703/src
Modified Files:
Tag: rel-1_0
nickserv.c
Log Message:
fix search command (mostly, set default last-registered and last-seen maxima to now)
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.138.2.41
retrieving revision 1.138.2.42
diff -C2 -r1.138.2.41 -r1.138.2.42
*** nickserv.c 2001/08/15 03:13:40 1.138.2.41
--- nickserv.c 2001/08/16 02:58:47 1.138.2.42
***************
*** 1821,1825 ****
struct nickserv_discrim {
unsigned int limit;
! unsigned int flags_on, flags_off;
time_t registered, lastseen;
const char *nickmask;
--- 1821,1825 ----
struct nickserv_discrim {
unsigned int limit;
! unsigned long flags_on, flags_off;
time_t registered, lastseen;
const char *nickmask;
***************
*** 1846,1849 ****
--- 1846,1851 ----
memset(discrim, 0, sizeof(*discrim));
discrim->limit = 50;
+ discrim->registered = now;
+ discrim->lastseen = now;
for (i=0; i<argc; i++) {
if (i == argc - 1) {
***************
*** 1897,1901 ****
|| (discrim->flags_off & hi->flags)
|| (discrim->registered < hi->registered)
! || (discrim->lastseen < hi->lastseen)
|| (discrim->handlemask && !match_ircglob(hi->handle, discrim->handlemask))) {
return 0;
--- 1899,1903 ----
|| (discrim->flags_off & hi->flags)
|| (discrim->registered < hi->registered)
! || (discrim->lastseen < (hi->users?now:hi->lastseen))
|| (discrim->handlemask && !match_ircglob(hi->handle, discrim->handlemask))) {
return 0;
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32490/src
Modified Files:
Tag: rel-1_0
messages.h opserv.c opserv.help parse.c proto.c proto.h
Log Message:
define "?stats glines" and "?gsync" commands, and parse the response from the uplink
Index: messages.h
===================================================================
RCS file: /cvsroot/srvx/services/src/messages.h,v
retrieving revision 1.15.2.5
retrieving revision 1.15.2.6
diff -C2 -r1.15.2.5 -r1.15.2.6
*** messages.h 2001/08/05 03:20:13 1.15.2.5
--- messages.h 2001/08/16 02:39:18 1.15.2.6
***************
*** 50,53 ****
--- 50,54 ----
#define MSG_NICK_UNKNOWN "User with nick $b%s$b does not exist."
#define MSG_CHANNEL_UNKNOWN "Channel with name $b%s$b does not exist."
+ #define MSG_SERVER_UNKNOWN "Server with name $b%s$b does not exist or is not linked."
#define MSG_NICKS_UNKNOWN "Some of the nicks provided are nonexistent."
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.187.2.45
retrieving revision 1.187.2.46
diff -C2 -r1.187.2.45 -r1.187.2.46
*** opserv.c 2001/08/12 23:02:29 1.187.2.45
--- opserv.c 2001/08/16 02:39:18 1.187.2.46
***************
*** 167,170 ****
--- 167,171 ----
#define OSMSG_DISABLED_LIST "Disabled commands: %s"
#define OSMSG_BADWORD_LIST "Bad words: %s"
+ #define OSMSG_GLINE_COUNT "There are %d glines active on the network."
#define OSMSG_BEGIN_LINKS "Server link info:"
#define OSMSG_LINK_INFO "Hub: %s Link: %s"
***************
*** 226,229 ****
--- 227,231 ----
#define OSMSG_NOT_IP "You must provide a valid IPv4 address."
#define OSMSG_BAD_ACTION "Unrecognized trace action '%s'."
+ #define OSMSG_GSYNC_RUNNING "Synchronizing glines from %s."
#define OSMSG_GTRACE_FORMAT "%s (by %s, expires %s): %s"
#define OSMSG_ALIAS_CREATED "Added %s alias '%s' for '%s'."
***************
*** 1477,1480 ****
--- 1479,1488 ----
static void
+ cmd_stats_glines(struct userNode *user)
+ {
+ opserv_notice(user, OSMSG_GLINE_COUNT, gline_count());
+ }
+
+ static void
trace_links(struct userNode *user, struct server *server, int allow_self)
{
***************
*** 1649,1653 ****
OPSERV_MIN_PARMS(2, false);
if (!strcasecmp(argv[1], "bad")) cmd_stats_bad(user);
! /* else if (!strcasecmp(argv[1], "glines")) cmd_stats_glines(user); */
else if (!strcasecmp(argv[1], "links")) cmd_stats_links(user);
else if (!strcasecmp(argv[1], "max")) cmd_stats_max(user);
--- 1657,1661 ----
OPSERV_MIN_PARMS(2, false);
if (!strcasecmp(argv[1], "bad")) cmd_stats_bad(user);
! else if (!strcasecmp(argv[1], "glines")) cmd_stats_glines(user);
else if (!strcasecmp(argv[1], "links")) cmd_stats_links(user);
else if (!strcasecmp(argv[1], "max")) cmd_stats_max(user);
***************
*** 3164,3167 ****
--- 3172,3193 ----
}
+ static OPSERV_FUNC(cmd_gsync)
+ {
+ struct server *src;
+ (void)channel;
+ if (argc > 1) {
+ src = GetServerH(argv[1]);
+ if (!src) {
+ opserv_notice(user, MSG_SERVER_UNKNOWN, argv[1]);
+ return 0;
+ }
+ } else {
+ src = self->uplink;
+ }
+ irc_stats(opserv, src, 'G');
+ opserv_notice(user, OSMSG_GSYNC_RUNNING, src->name);
+ return 1;
+ }
+
static void
gtrace_print_func(struct gline *gline, void *extra)
***************
*** 3858,3861 ****
--- 3884,3888 ----
opserv_define_func("TRACE GAG", NULL, 600);
opserv_define_func("TRACE KILL", NULL, 600);
+ opserv_define_func("GSYNC", cmd_gsync, 600);
opserv_define_func("GTRACE", cmd_gtrace, 100);
opserv_define_func("TIMECMD", cmd_timecmd, 1);
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.24.2.12
retrieving revision 1.24.2.13
diff -C2 -r1.24.2.12 -r1.24.2.13
*** opserv.help 2001/08/13 19:21:18 1.24.2.12
--- opserv.help 2001/08/16 02:39:18 1.24.2.13
***************
*** 286,289 ****
--- 286,290 ----
"Displays statistics about a specified subject. Subjects include:",
"$bBAD$b: Current list of bad words.",
+ "$bGLINES$b: Reports the current number of glines.",
"$bLINKS$b: Information about the link to the network.",
"$bMAX$b: The max clients seen on the network.",
Index: parse.c
===================================================================
RCS file: /cvsroot/srvx/services/src/Attic/parse.c,v
retrieving revision 1.113.2.15
retrieving revision 1.113.2.16
diff -C2 -r1.113.2.15 -r1.113.2.16
*** parse.c 2001/08/07 12:38:23 1.113.2.15
--- parse.c 2001/08/16 02:39:18 1.113.2.16
***************
*** 519,522 ****
--- 519,529 ----
}
+ static CMD_FUNC(cmd_num_gline)
+ {
+ if (argc < 7) return 0;
+ gline_add(argv[0]+1, argv[4], atoi(argv[5])-now, argv[6], 0);
+ return 1;
+ }
+
static CMD_FUNC(cmd_quit)
{
***************
*** 812,815 ****
--- 819,825 ----
dict_insert(irc_func_dict, "332", cmd_num_topic);
dict_insert(irc_func_dict, "333", cmd_num_topic);
+ /* "stats g" responses */
+ dict_insert(irc_func_dict, "247", cmd_num_gline);
+ dict_insert(irc_func_dict, "219", cmd_dummy); /* "End of /STATS report" */
/* other numeric responses we might get */
dict_insert(irc_func_dict, "401", cmd_dummy); /* target left network */
Index: proto.c
===================================================================
RCS file: /cvsroot/srvx/services/src/Attic/proto.c,v
retrieving revision 1.68.2.8
retrieving revision 1.68.2.9
diff -C2 -r1.68.2.8 -r1.68.2.9
*** proto.c 2001/08/02 03:06:30 1.68.2.8
--- proto.c 2001/08/16 02:39:18 1.68.2.9
***************
*** 650,653 ****
--- 650,659 ----
void
+ irc_stats(struct userNode *from, struct server *target, char type)
+ {
+ putsock("%s STATS %c :%s", from->numeric, type, target->numeric);
+ }
+
+ void
irc_part(struct userNode *who, struct chanNode *what, const char *reason)
{
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.24.2.3
retrieving revision 1.24.2.4
diff -C2 -r1.24.2.3 -r1.24.2.4
*** proto.h 2001/07/29 14:31:21 1.24.2.3
--- proto.h 2001/08/16 02:39:18 1.24.2.4
***************
*** 125,128 ****
--- 125,129 ----
void irc_kill(struct userNode *from, struct userNode *target, const char *message);
void irc_raw(const char *what);
+ void irc_stats(struct userNode *from, struct server *target, char type);
#endif /* !defined(PROTO_H) */
|
|
From: Entrope <en...@us...> - 2001-08-16 02:38:18
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32341/src
Modified Files:
Tag: rel-1_0
gline.c gline.h
Log Message:
create gline_count() function to return current gline count
Index: gline.c
===================================================================
RCS file: /cvsroot/srvx/services/src/gline.c,v
retrieving revision 1.6.2.6
retrieving revision 1.6.2.7
diff -C2 -r1.6.2.6 -r1.6.2.7
*** gline.c 2001/08/15 13:07:20 1.6.2.6
--- gline.c 2001/08/16 02:38:15 1.6.2.7
***************
*** 181,184 ****
--- 181,190 ----
}
+ unsigned int
+ gline_count(void)
+ {
+ return dict_size(gline_dict);
+ }
+
static int
gline_add_record(const char *key, void *data, void *extra)
Index: gline.h
===================================================================
RCS file: /cvsroot/srvx/services/src/gline.h,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -C2 -r1.2.2.3 -r1.2.2.4
*** gline.h 2001/07/14 19:59:38 1.2.2.3
--- gline.h 2001/08/16 02:38:15 1.2.2.4
***************
*** 42,45 ****
--- 42,46 ----
void gline_refresh(const char *target);
void gline_refresh_all(void);
+ unsigned int gline_count(void);
typedef void (*gline_search_func)(struct gline *gline, void *extra);
|
|
From: Entrope <en...@us...> - 2001-08-15 13:07:24
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv1496/src
Modified Files:
Tag: rel-1_0
gline.c
Log Message:
i suck :(
Index: gline.c
===================================================================
RCS file: /cvsroot/srvx/services/src/gline.c,v
retrieving revision 1.6.2.5
retrieving revision 1.6.2.6
diff -C2 -r1.6.2.5 -r1.6.2.6
*** gline.c 2001/08/15 13:05:46 1.6.2.5
--- gline.c 2001/08/15 13:07:20 1.6.2.6
***************
*** 139,143 ****
if (ent) {
heap_remove_pred(gline_heap, gline_for_p, (char*)target);
! if (ent->expires < (now + duration)) ent->expires = now + duration;
} else {
ent = malloc(sizeof(*ent));
--- 139,143 ----
if (ent) {
heap_remove_pred(gline_heap, gline_for_p, (char*)target);
! if (ent->expires < (time_t)(now + duration)) ent->expires = now + duration;
} else {
ent = malloc(sizeof(*ent));
|
|
From: Entrope <en...@us...> - 2001-08-15 13:05:49
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv1101/src
Modified Files:
Tag: rel-1_0
gline.c
Log Message:
only extend gline durations with gline_add (compliant with ircu behavior)
when free()'ing a gline, remove it from the gline_dict
Index: gline.c
===================================================================
RCS file: /cvsroot/srvx/services/src/gline.c,v
retrieving revision 1.6.2.4
retrieving revision 1.6.2.5
diff -C2 -r1.6.2.4 -r1.6.2.5
*** gline.c 2001/08/14 15:31:38 1.6.2.4
--- gline.c 2001/08/15 13:05:46 1.6.2.5
***************
*** 60,63 ****
--- 60,64 ----
free_gline(struct gline *ent)
{
+ dict_remove(gline_dict, ent->target);
free(ent->target);
free(ent->reason);
***************
*** 138,142 ****
if (ent) {
heap_remove_pred(gline_heap, gline_for_p, (char*)target);
! ent->expires = now + duration;
} else {
ent = malloc(sizeof(*ent));
--- 139,143 ----
if (ent) {
heap_remove_pred(gline_heap, gline_for_p, (char*)target);
! if (ent->expires < (now + duration)) ent->expires = now + duration;
} else {
ent = malloc(sizeof(*ent));
|
|
From: Entrope <en...@us...> - 2001-08-15 03:21:41
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv29929/src
Modified Files:
Tag: rel-1_0
sockcheck.c
Log Message:
since it's mostly debugged, disable most of the info level statements
Index: sockcheck.c
===================================================================
RCS file: /cvsroot/srvx/services/src/sockcheck.c,v
retrieving revision 1.54.2.23
retrieving revision 1.54.2.24
diff -C2 -r1.54.2.23 -r1.54.2.24
*** sockcheck.c 2001/08/14 15:31:38 1.54.2.23
--- sockcheck.c 2001/08/15 03:21:38 1.54.2.24
***************
*** 436,440 ****
--- 436,442 ----
unsigned int exp_length;
expand_var(client, template[1], &expansion, &exp_length);
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Expanded var %c for client %s to \"%s\" (len %d, pos %d)\n", template[1], client->addr->hostname, expansion, exp_length, client->send_used);
+ #endif
if (client->send_used+exp_length >= client->send_size) {
do {
***************
*** 516,520 ****
--- 518,524 ----
}
}
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Starting proxy check on port %d (test %d) for client %s, fd %d\n", client->state->port, client->test_index, client->addr->hostname, poller->fd);
+ #endif
return;
***************
*** 578,582 ****
--- 582,588 ----
}
if (!tests) return 0;
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Proxy-checking client at %08x (%s) as client %d (now %d in progress)\n", sci->addr, sci->hostname, idx, sockcheck_num_sockets);
+ #endif
client_list[idx] = sockcheck_alloc_client(sci);
client_list[idx]->test_rep = 0;
***************
*** 596,604 ****
--- 602,614 ----
if (decision == ACCEPT) {
/* do nothing */
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Proxy check passed for client at IP %08x hostname %s\n", client->addr->addr, client->addr->hostname);
+ #endif
} else if (decision == REJECT) {
proxies_detected++;
sockcheck_issue_gline(client->addr);
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Proxy check failed for client at IP %08x hostname %s (%s)\n", client->addr->addr, client->addr->hostname, client->addr->reason);
+ #endif
/* don't compare idx != 0 directly, because somebody else may have
* reordered the tests already
***************
*** 730,738 ****
--- 740,752 ----
if (client->read_used >= client->read_size) {
/* we got more data than we expected to get .. don't read any more */
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Buffer filled (unmatched) for client %s\n", client->addr->hostname);
+ #endif
return client->state->responses.used - 1;
} else if (TV_CMP(tv_now, >, client->read_timeout)) {
/* read timed out, use default handler. */
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Read timeout expired for client %s\n", client->addr->hostname);
+ #endif
return client->state->responses.used - 1;
} else {
***************
*** 771,775 ****
--- 785,791 ----
case ECONNREFUSED:
case ETIMEDOUT:
+ #if SOCKCHECK_DEBUG
log(PC_LOG, LOG_INFO, "Client %s gave us errno %d (%s)\n", client->addr->hostname, rc, strerror(rc));
+ #endif
goto disconn;
case 0: break;
|
|
From: Entrope <en...@us...> - 2001-08-15 03:13:43
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv28589/src
Modified Files:
Tag: rel-1_0
nickserv.c chanserv.c
Log Message:
typo fix for typo fix
only report someone as on vacation if their handle is frozen (sigh)
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.138.2.40
retrieving revision 1.138.2.41
diff -C2 -r1.138.2.40 -r1.138.2.41
*** nickserv.c 2001/08/14 01:19:27 1.138.2.40
--- nickserv.c 2001/08/15 03:13:40 1.138.2.41
***************
*** 762,766 ****
nickserv_notice(user, NSMSG_HANDLEINFO_INFOLINE, (hi->info[0] ? hi->info : NSMSG_NONE));
! nickserv_notice(user, NSMSG_HANDLEINFO_VACATION);
if (hi != user->handle_info) {
--- 762,766 ----
nickserv_notice(user, NSMSG_HANDLEINFO_INFOLINE, (hi->info[0] ? hi->info : NSMSG_NONE));
! if (HANDLE_FLAGGED(hi, FROZEN)) nickserv_notice(user, NSMSG_HANDLEINFO_VACATION);
if (hi != user->handle_info) {
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.161.2.76
retrieving revision 1.161.2.77
diff -C2 -r1.161.2.76 -r1.161.2.77
*** chanserv.c 2001/08/15 03:05:47 1.161.2.76
--- chanserv.c 2001/08/15 03:13:40 1.161.2.77
***************
*** 2097,2101 ****
for(cList = user->handle_info->channels; cList; cList = cList->next)
{
! if(!cList->channel->channel || IsSuspended(cList->channel) || !GetUserMode(cList->channnel->channel, user))
{
continue;
--- 2097,2101 ----
for(cList = user->handle_info->channels; cList; cList = cList->next)
{
! if(!cList->channel->channel || IsSuspended(cList->channel) || !GetUserMode(cList->channel->channel, user))
{
continue;
|
|
From: Entrope <en...@us...> - 2001-08-15 03:05:50
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv27161/src
Modified Files:
Tag: rel-1_0
chanserv.c
Log Message:
typo fix for !upall and out-of-channel fix for cmd_all
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.161.2.75
retrieving revision 1.161.2.76
diff -C2 -r1.161.2.75 -r1.161.2.76
*** chanserv.c 2001/08/15 02:47:14 1.161.2.75
--- chanserv.c 2001/08/15 03:05:47 1.161.2.76
***************
*** 2097,2101 ****
for(cList = user->handle_info->channels; cList; cList = cList->next)
{
! if(IsSuspended(cList->channel))
{
continue;
--- 2097,2101 ----
for(cList = user->handle_info->channels; cList; cList = cList->next)
{
! if(!cList->channel->channel || IsSuspended(cList->channel) || !GetUserMode(cList->channnel->channel, user))
{
continue;
***************
*** 2110,2114 ****
static CHANSERV_FUNC(cmd_upall)
{
! return cmd_all(CSFUNC_ARGS, cmd_down);
}
--- 2110,2114 ----
static CHANSERV_FUNC(cmd_upall)
{
! return cmd_all(CSFUNC_ARGS, cmd_up);
}
|
|
From: Entrope <en...@us...> - 2001-08-15 02:47:18
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv23743/src
Modified Files:
Tag: rel-1_0
chanserv.c
Log Message:
only update "seen" for channels the user is in when they quit
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.161.2.74
retrieving revision 1.161.2.75
diff -C2 -r1.161.2.74 -r1.161.2.75
*** chanserv.c 2001/08/14 21:17:12 1.161.2.74
--- chanserv.c 2001/08/15 02:47:14 1.161.2.75
***************
*** 4706,4709 ****
--- 4706,4713 ----
for(channel = user->handle_info->channels; channel; channel = channel->next)
{
+ if(!channel->channel->channel || IsSuspended(channel->channel) || !GetUserMode(channel->channel->channel, user))
+ {
+ continue;
+ }
channel->user->seen = now;
channel->user->present = 0;
|
|
From: Entrope <en...@us...> - 2001-08-14 21:17:16
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv13021/src
Modified Files:
Tag: rel-1_0
chanserv.c
Log Message:
when seeing a new channel and we're not in burst and a topic exists, set it
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.161.2.73
retrieving revision 1.161.2.74
diff -C2 -r1.161.2.73 -r1.161.2.74
*** chanserv.c 2001/08/14 01:19:27 1.161.2.73
--- chanserv.c 2001/08/14 21:17:12 1.161.2.74
***************
*** 4468,4471 ****
--- 4468,4476 ----
irc_mode(chanserv->numeric, channel, modes);
}
+
+ if (!burst && channel->channel_info->topic[0])
+ {
+ SetChannelTopic(channel, chanserv->nick, channel->channel_info->topic, 1);
+ }
}
|