srvx-commits Mailing List for srvx IRC Services (Page 9)
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: Entrope <en...@us...> - 2003-10-07 03:41:18
|
Update of /cvsroot/srvx/services/tests In directory sc8-pr-cvs1:/tmp/cvs-serv10098/tests Modified Files: test-driver.pl Log Message: show interruption point in case the script gets stopped midway Index: test-driver.pl =================================================================== RCS file: /cvsroot/srvx/services/tests/test-driver.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test-driver.pl 26 Sep 2003 22:04:12 -0000 1.3 --- test-driver.pl 7 Oct 2003 03:40:58 -0000 1.4 *************** *** 36,40 **** _start => \&drv_start, _child => sub {}, ! _stop => sub { print "\nThat's all, folks!\n"; }, _default => \&drv_default, # generic utilities or miscellaneous functions --- 36,46 ---- _start => \&drv_start, _child => sub {}, ! _stop => sub { ! my $heap = $_[HEAP]; ! print "\nThat's all, folks!"; ! print "(exiting at line $heap->{lineno}: $heap->{line})" ! if $heap->{line}; ! print "\n"; ! }, _default => \&drv_default, # generic utilities or miscellaneous functions |
From: Entrope <en...@us...> - 2003-10-05 03:27:52
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv23316/src Modified Files: modcmd.c Log Message: send "Service removed" reply before removing the service, in case you use a service to remove itself (which nukes the command pointer) Index: modcmd.c =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.c,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -r1.68 -r1.69 *** modcmd.c 26 Sep 2003 15:27:16 -0000 1.68 --- modcmd.c 5 Oct 2003 03:27:49 -0000 1.69 *************** *** 1704,1709 **** } DelUser(service->bot, NULL, 1, reason); - dict_remove(services, name); reply(MCMSG_SERVICE_REMOVED, name); return 1; } --- 1704,1709 ---- } DelUser(service->bot, NULL, 1, reason); reply(MCMSG_SERVICE_REMOVED, name); + dict_remove(services, name); return 1; } |
From: Entrope <en...@us...> - 2003-10-05 03:15:39
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv21929/src Modified Files: chanserv.c proto-p10.c sockcheck.c Log Message: formatting tweaks/cleanup Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.382 retrieving revision 1.383 diff -C2 -r1.382 -r1.383 *** chanserv.c 3 Oct 2003 02:46:42 -0000 1.382 --- chanserv.c 5 Oct 2003 03:15:29 -0000 1.383 *************** *** 1245,1251 **** if(access > USER_LEVEL_HIGHEST || access < USER_LEVEL_LOWEST) - { return NULL; - } ud = calloc(1, sizeof(*ud)); --- 1245,1249 ---- *************** *** 1259,1265 **** ud->next = channel->users; if(channel->users) - { channel->users->prev = ud; - } channel->users = ud; --- 1257,1261 ---- *************** *** 1272,1278 **** ud->u_next = ud->handle->channels; if(ud->u_next) - { ud->u_next->u_prev = ud; - } ud->handle->channels = ud; --- 1268,1272 ---- *************** *** 1285,1311 **** del_channel_user(struct userData *user, int do_gc) { ! struct chanData *channel; ! if(!user) return; ! user->channel->userCount[0]--; ! user->channel->userCount[user->access]--; userCount[0]--; userCount[user->access]--; ! if(user->prev) user->prev->next = user->next; ! else user->channel->users = user->next; ! if(user->next) user->next->prev = user->prev; ! ! if(user->u_prev) user->u_prev->u_next = user->u_next; ! else user->handle->channels = user->u_next; ! if(user->u_next) user->u_next->u_prev = user->u_prev; ! if(user->info) free(user->info); ! channel = user->channel; free(user); if(do_gc && !channel->users && !IsProtected(channel)) - { unregister_channel(channel, "lost all users."); - } } --- 1279,1307 ---- del_channel_user(struct userData *user, int do_gc) { ! struct chanData *channel = user->channel; ! channel->userCount[0]--; ! channel->userCount[user->access]--; userCount[0]--; userCount[user->access]--; ! if(user->prev) ! user->prev->next = user->next; ! else ! channel->users = user->next; ! if(user->next) ! user->next->prev = user->prev; ! ! if(user->u_prev) ! user->u_prev->u_next = user->u_next; ! else ! user->handle->channels = user->u_next; ! if(user->u_next) ! user->u_next->u_prev = user->u_prev; ! free(user->info); free(user); if(do_gc && !channel->users && !IsProtected(channel)) unregister_channel(channel, "lost all users."); } Index: proto-p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto-p10.c,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -r1.78 -r1.79 *** proto-p10.c 26 Sep 2003 15:31:50 -0000 1.78 --- proto-p10.c 5 Oct 2003 03:15:29 -0000 1.79 *************** *** 767,772 **** } else { /* this must be our uplink */ - if (argc < 8) - return 0; srv = self->uplink = AddServer(self, argv[1], atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), argv[6], argv[argc-1]); if (!srv) --- 767,770 ---- *************** *** 1216,1227 **** if (argc < 2) return 0; ! if (argv[1][0] == ':') ! user = GetUserH(argv[1]+1); ! else ! user = GetUserN(argv[1]); if (!user) { ! /* If we get a KILL for a non-local user, it could be a Ghost ! * response to a KILL we sent out earlier. So we only whine ! * if the target is local. */ if (!strncmp(argv[1], self->numeric, strlen(self->numeric))) log_module(MAIN_LOG, LOG_ERROR, "Unable to find kill victim %s", argv[1]); --- 1214,1223 ---- if (argc < 2) return 0; ! user = GetUserN(argv[1]); if (!user) { ! /* If we get a KILL for a non-existent user, it could be a ! * Ghost response to a KILL we sent out earlier. So we only ! * whine if the target is local. ! */ if (!strncmp(argv[1], self->numeric, strlen(self->numeric))) log_module(MAIN_LOG, LOG_ERROR, "Unable to find kill victim %s", argv[1]); Index: sockcheck.c =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.c,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -r1.92 -r1.93 *** sockcheck.c 2 Aug 2003 23:13:23 -0000 1.92 --- sockcheck.c 5 Oct 2003 03:15:29 -0000 1.93 *************** *** 1088,1093 **** sockcheck_new_user(struct userNode *user) { /* If they have a bum IP, or are bursting in, don't proxy-check or G-line them. */ ! if ((user->ip.s_addr == 0) || (ntohl(user->ip.s_addr) == INADDR_LOOPBACK) || user->uplink->burst) return 0; ! sockcheck_queue_address(user->ip); return 0; } --- 1088,1095 ---- sockcheck_new_user(struct userNode *user) { /* If they have a bum IP, or are bursting in, don't proxy-check or G-line them. */ ! if (user->ip.s_addr ! && (ntohl(user->ip.s_addr) != INADDR_LOOPBACK) ! && !user->uplink->burst) ! sockcheck_queue_address(user->ip); return 0; } |
From: Entrope <en...@us...> - 2003-10-05 03:13:36
|
Update of /cvsroot/srvx/services In directory sc8-pr-cvs1:/tmp/cvs-serv21717 Modified Files: srvx.conf.example Log Message: add configuration values for maxlogins feature Index: srvx.conf.example =================================================================== RCS file: /cvsroot/srvx/services/srvx.conf.example,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -r1.41 -r1.42 *** srvx.conf.example 12 Jul 2003 03:19:18 -0000 1.41 --- srvx.conf.example 5 Oct 2003 03:13:30 -0000 1.42 *************** *** 49,52 **** --- 49,56 ---- // do we warn users when someone new auths to their account? "warn_clone_auth" "1"; + // what is the default maxlogins value? + "default_maxlogins" "2"; + // what is the absolute maxlogins value? + "hard_maxlogins" "10"; // This names a file that contains easily guessed passwords. // It always contains "password", "<password>" and the user's |
From: Entrope <en...@us...> - 2003-10-05 03:12:43
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv21626/src Modified Files: nickserv.c nickserv.h opserv.c Log Message: add "/msg opserv access *" handler, similar to wasted's patch check gags on nick changes, in case somebody was silly enough to use a nick-based gag code and formatting cleanups Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.260 retrieving revision 1.261 diff -C2 -r1.260 -r1.261 *** nickserv.c 4 Oct 2003 01:35:40 -0000 1.260 --- nickserv.c 5 Oct 2003 03:12:36 -0000 1.261 *************** *** 23,27 **** #include "global.h" #include "modcmd.h" ! #include "opserv.h" /* for gag_create() */ #include "saxdb.h" #include "sendmail.h" --- 23,27 ---- #include "global.h" #include "modcmd.h" ! #include "opserv.h" /* for gag_create(), opserv_bad_channel() */ #include "saxdb.h" #include "sendmail.h" *************** *** 141,144 **** --- 141,145 ---- #define NSMSG_BAD_MAX_LOGINS "MaxLogins must be at most %d." #define NSMSG_MAX_LOGINS "Your account already has its limit of %d user(s) logged in." + #define NSMSG_SETTEE_LOGGED_IN "%s is already logged in, so you cannot do that." #define NSMSG_STAMPED_REGISTER "You have already authenticated to an account once this session; you may not register a new account." *************** *** 528,534 **** for (nn=0; nn<channel->members.used; ++nn) { mn = channel->members.list[nn]; ! if (mn->user == except) ! continue; ! if (mn->user->handle_info == handle) return mn; } --- 529,533 ---- for (nn=0; nn<channel->members.used; ++nn) { mn = channel->members.list[nn]; ! if ((mn->user != except) && (mn->user->handle_info == handle)) return mn; } *************** *** 575,578 **** --- 574,583 ---- if (user && IsLocal(user)) return 0; + /* for consistency, only allow account names that could be nicks */ + if (!is_valid_nick(handle)) + return 0; + /* disallow account names that look like bad words */ + if (opserv_bad_channel(handle)) + return 0; /* test either regex or containing all valid chars */ if (nickserv_conf.valid_handle_regex_set) { *************** *** 592,602 **** is_registerable_nick(const char *nick) { ! struct userNode *user; ! /* first, check that the nick is acceptible by the server */ ! if (!is_valid_nick(nick)) ! return 0; ! /* cant register a juped nick/service nick.. client could kill it. */ ! user = GetUserH(nick); ! if (user && IsLocal(user)) return 0; /* test either regex or as valid handle */ --- 597,602 ---- is_registerable_nick(const char *nick) { ! /* make sure it could be used as an account name */ ! if (!is_valid_handle(nick)) return 0; /* test either regex or as valid handle */ *************** *** 609,615 **** } return !err; - } else { - return is_valid_handle(nick); } } --- 609,614 ---- } return !err; } + return 1; } *************** *** 1120,1124 **** } else { string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT)); ! if (user->ip.s_addr) string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_BYIP|GENMASK_NO_HIDING|GENMASK_ANY_IDENT)); } --- 1119,1123 ---- } else { string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT)); ! if (user->ip.s_addr && user->hostname[strspn(user->hostname, "0123456789.")]) string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_BYIP|GENMASK_NO_HIDING|GENMASK_ANY_IDENT)); } *************** *** 1160,1163 **** --- 1159,1163 ---- if (!settee) { nickserv_notice(user, MSG_NICK_UNKNOWN, argv[4]); + free(mask); return 0; } *************** *** 1166,1171 **** } } else if ((settee = GetUserH(argv[3]))) { - if (settee->handle_info && !oper_outranks(user, settee->handle_info)) - return 0; mask = generate_hostmask(settee, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT); } else { --- 1166,1169 ---- *************** *** 1173,1179 **** return 0; } ! ! if (!(hi = nickserv_register(user, settee, argv[1], argv[2], 0))) return 0; string_list_append(hi->masks, mask); return 1; --- 1171,1183 ---- return 0; } ! if (settee && settee->handle_info) { ! nickserv_notice(user, NSMSG_SETTEE_LOGGED_IN, settee->nick); ! free(mask); return 0; + } + if (!(hi = nickserv_register(user, settee, argv[1], argv[2], 0))) { + free(mask); + return 0; + } string_list_append(hi->masks, mask); return 1; *************** *** 1386,1390 **** NICKSERV_MIN_PARMS(3); ! if (!(hi = get_victim_oper(user, argv[1]))) return 0; if (!is_valid_handle(argv[2])) { nickserv_notice(user, NSMSG_FAIL_RENAME, argv[1], argv[2]); --- 1390,1395 ---- NICKSERV_MIN_PARMS(3); ! if (!(hi = get_victim_oper(user, argv[1]))) ! return 0; if (!is_valid_handle(argv[2])) { nickserv_notice(user, NSMSG_FAIL_RENAME, argv[1], argv[2]); *************** *** 1888,1892 **** struct handle_info *hi; NICKSERV_MIN_PARMS(3); ! if (!(hi = get_victim_oper(user, argv[1]))) return 0; return nickserv_delmask(user, hi, argv[2]); } --- 1893,1898 ---- struct handle_info *hi; NICKSERV_MIN_PARMS(3); ! if (!(hi = get_victim_oper(user, argv[1]))) ! return 0; return nickserv_delmask(user, hi, argv[2]); } *************** *** 1912,1917 **** } flag = 1 << (pos - 1); ! if (add) added |= flag, removed &= ~flag; ! else removed |= flag, added &= ~flag; break; } --- 1918,1925 ---- } flag = 1 << (pos - 1); ! if (add) ! added |= flag, removed &= ~flag; ! else ! removed |= flag, added &= ~flag; break; } *************** *** 1929,1933 **** before = hi->flags & (HI_FLAG_SUPPORT_HELPER|HI_FLAG_NETWORK_HELPER); ! if (!nickserv_modify_handle_flags(user, nickserv, flags, &added, &removed)) return 0; hi->flags = (hi->flags | added) & ~removed; after = hi->flags & (HI_FLAG_SUPPORT_HELPER|HI_FLAG_NETWORK_HELPER); --- 1937,1942 ---- before = hi->flags & (HI_FLAG_SUPPORT_HELPER|HI_FLAG_NETWORK_HELPER); ! if (!nickserv_modify_handle_flags(user, nickserv, flags, &added, &removed)) ! return 0; hi->flags = (hi->flags | added) & ~removed; after = hi->flags & (HI_FLAG_SUPPORT_HELPER|HI_FLAG_NETWORK_HELPER); *************** *** 1938,1944 **** struct chanNode *schannel; schannel = chanserv_support_channel(); ! for (uNode = hi->users; uNode; uNode = uNode->next_authed) { ! if (GetUserMode(schannel, uNode)) break; ! } if (!uNode) HANDLE_CLEAR_FLAG(hi, HELPING); } --- 1947,1953 ---- struct chanNode *schannel; schannel = chanserv_support_channel(); ! for (uNode = hi->users; uNode; uNode = uNode->next_authed) ! if (GetUserMode(schannel, uNode)) ! break; if (!uNode) HANDLE_CLEAR_FLAG(hi, HELPING); } *************** *** 1946,1957 **** if (after && !before) { /* Add user to current helper list. */ ! for (uNode = hi->users; uNode; uNode = uNode->next_authed) { userList_append(&curr_helpers, uNode); - } } else if (!after && before) { /* Remove user from current helper list. */ ! for (uNode = hi->users; uNode; uNode = uNode->next_authed) { userList_remove(&curr_helpers, uNode); - } } --- 1955,1964 ---- if (after && !before) { /* Add user to current helper list. */ ! for (uNode = hi->users; uNode; uNode = uNode->next_authed) userList_append(&curr_helpers, uNode); } else if (!after && before) { /* Remove user from current helper list. */ ! for (uNode = hi->users; uNode; uNode = uNode->next_authed) userList_remove(&curr_helpers, uNode); } *************** *** 2021,2025 **** if (argc > 1) { if ((argv[1][0] == '*') && (argv[1][1] == 0)) { ! if (hi->infoline) free(hi->infoline); hi->infoline = NULL; } else { --- 2028,2032 ---- if (argc > 1) { if ((argv[1][0] == '*') && (argv[1][1] == 0)) { ! free(hi->infoline); hi->infoline = NULL; } else { *************** *** 2184,2190 **** unsigned long flen; ! for (i=flen=0; handle_flags[i]; i++) { ! if (hi->flags & 1 << i) flags[flen++] = handle_flags[i]; ! } flags[flen] = 0; } else { --- 2191,2197 ---- unsigned long flen; ! for (i=flen=0; handle_flags[i]; i++) ! if (hi->flags & 1 << i) ! flags[flen++] = handle_flags[i]; flags[flen] = 0; } else { *************** *** 2243,2247 **** int oper_try_set_access(struct userNode *user, struct userNode *bot, struct handle_info *target, unsigned int new_level) { ! if (!oper_has_access(user, bot, nickserv_conf.modoper_level, 0)) return 0; if ((user->handle_info->opserv_level < target->opserv_level) || ((user->handle_info->opserv_level == target->opserv_level) --- 2250,2255 ---- int oper_try_set_access(struct userNode *user, struct userNode *bot, struct handle_info *target, unsigned int new_level) { ! if (!oper_has_access(user, bot, nickserv_conf.modoper_level, 0)) ! return 0; if ((user->handle_info->opserv_level < target->opserv_level) || ((user->handle_info->opserv_level == target->opserv_level) *************** *** 2260,2264 **** return 0; } ! if (target->opserv_level == new_level) return 0; log_module(NS_LOG, LOG_INFO, "Account %s setting oper level for account %s to %d (from %d).", user->handle_info->handle, target->handle, new_level, target->opserv_level); --- 2268,2273 ---- return 0; } ! if (target->opserv_level == new_level) ! return 0; log_module(NS_LOG, LOG_INFO, "Account %s setting oper level for account %s to %d (from %d).", user->handle_info->handle, target->handle, new_level, target->opserv_level); *************** *** 2921,2924 **** --- 2930,2950 ---- } + void + nickserv_show_oper_accounts(struct userNode *user, struct svccmd *cmd) + { + struct handle_info *hi; + dict_iterator_t it; + unsigned int count; + + for (it = dict_first(nickserv_handle_dict), count = 0; it; it = iter_next(it)) { + hi = iter_data(it); + if (hi->opserv_level > 0) { + reply("%s %d", hi->handle, hi->opserv_level); + ++count; + } + } + reply(MSG_MATCH_COUNT, count); + } + static NICKSERV_FUNC(cmd_search) { *************** *** 2932,2938 **** sprintf(buf, "search %s", argv[1]); subcmd = dict_find(nickserv_service->commands, buf, NULL); ! if (!irccasecmp(argv[1], "print")) action = search_print_func; ! else if (!irccasecmp(argv[1], "count")) action = search_count_func; ! else if (!irccasecmp(argv[1], "unregister")) action = search_unregister_func; else { nickserv_notice(user, NSMSG_INVALID_ACTION, argv[1]); --- 2958,2967 ---- sprintf(buf, "search %s", argv[1]); subcmd = dict_find(nickserv_service->commands, buf, NULL); ! if (!irccasecmp(argv[1], "print")) ! action = search_print_func; ! else if (!irccasecmp(argv[1], "count")) ! action = search_count_func; ! else if (!irccasecmp(argv[1], "unregister")) ! action = search_unregister_func; else { nickserv_notice(user, NSMSG_INVALID_ACTION, argv[1]); *************** *** 2940,2961 **** } ! if (subcmd && !svccmd_can_invoke(user, nickserv, subcmd, NULL, SVCCMD_NOISY)) return 0; discrim = nickserv_discrim_create(user, argc-2, argv+2); ! if (!discrim) return 0; ! if (action == search_print_func) { nickserv_notice(user, MSG_SEARCH_RESULTS, "accounts"); ! } else if (action == search_count_func) { discrim->limit = INT_MAX; - } matches = nickserv_discrim_search(discrim, action, user); ! if (matches) { nickserv_notice(user, MSG_MATCH_COUNT, matches); ! } else { nickserv_notice(user, MSG_NO_MATCHES); - } free(discrim); --- 2969,2990 ---- } ! if (subcmd && !svccmd_can_invoke(user, nickserv, subcmd, NULL, SVCCMD_NOISY)) ! return 0; discrim = nickserv_discrim_create(user, argc-2, argv+2); ! if (!discrim) ! return 0; ! if (action == search_print_func) nickserv_notice(user, MSG_SEARCH_RESULTS, "accounts"); ! else if (action == search_count_func) discrim->limit = INT_MAX; matches = nickserv_discrim_search(discrim, action, user); ! if (matches) nickserv_notice(user, MSG_MATCH_COUNT, matches); ! else nickserv_notice(user, MSG_NO_MATCHES); free(discrim); Index: nickserv.h =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -r1.47 -r1.48 *** nickserv.h 4 Oct 2003 01:35:41 -0000 1.47 --- nickserv.h 5 Oct 2003 03:12:36 -0000 1.48 *************** *** 23,26 **** --- 23,27 ---- #include "hash.h" /* for NICKLEN, etc., and common.h */ + struct svccmd; #define NICKSERV_HANDLE_LEN NICKLEN *************** *** 120,123 **** --- 121,125 ---- int nickserv_modify_handle_flags(struct userNode *user, struct userNode *bot, const unsigned char *str, unsigned long *add, unsigned long *remove); int oper_has_access(struct userNode *user, struct userNode *bot, unsigned int min_level, unsigned int quiet); + void nickserv_show_oper_accounts(struct userNode *user, struct svccmd *cmd); /* auth_funcs are called when a user gets a new handle_info. They are Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.340 retrieving revision 1.341 diff -C2 -r1.340 -r1.341 *** opserv.c 3 Oct 2003 02:45:26 -0000 1.340 --- opserv.c 5 Oct 2003 03:12:36 -0000 1.341 *************** *** 159,163 **** #define OSMSG_HOST_IS_TRUSTED "%s (%s; set %s ago by %s; expires %s: %s)" #define OSMSG_UPTIME_STATS "Uptime: %s (%u lines processed, CPU time %.2fu/%.2fs)" - #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 $b%s$b" #define OSMSG_LINE_DUMPED "Raw line sent." --- 159,162 ---- *************** *** 340,343 **** --- 339,343 ---- static unsigned int opserv_discrim_search(discrim_t discrim, discrim_search_func dsf, void *data); [...1020 lines suppressed...] policer_params_set(pp, "size", "200"); policer_params_set(pp, "drain-rate", "3"); ! if ((child = database_get_data(conf_node, KEY_NEW_USER_POLICER, RECDB_OBJECT))) { dict_foreach(child, set_policer_param, pp); - } } --- 3898,3909 ---- } ! if (opserv_conf.new_user_policer.params) pp = opserv_conf.new_user_policer.params; ! else pp = opserv_conf.new_user_policer.params = policer_params_new(); policer_params_set(pp, "size", "200"); policer_params_set(pp, "drain-rate", "3"); ! if ((child = database_get_data(conf_node, KEY_NEW_USER_POLICER, RECDB_OBJECT))) dict_foreach(child, set_policer_param, pp); } |
From: Entrope <en...@us...> - 2003-10-04 01:36:31
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv15755/src Modified Files: nickserv.help.m4 Log Message: document MAXLOGINS option for accounts Index: nickserv.help.m4 =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.help.m4,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** nickserv.help.m4 18 Aug 2003 21:48:21 -0000 1.18 --- nickserv.help.m4 4 Oct 2003 01:36:26 -0000 1.19 *************** *** 215,218 **** --- 215,219 ---- "$bTABLEWIDTH$b: Sets the width for wrapping table-formatted text. (Use 0 for the default.)", "$bWIDTH$b: The width you want srvx to wrap text it sends you. (Use 0 for the default.)", + "$bMAXLOGINS$b: The number of users that can log into your account at once. (Use 0 for the default.)", "$bset$b with no arguments returns your current settings.", ifdef({/services/nickserv/disable_nicks}, |
From: Entrope <en...@us...> - 2003-10-04 01:35:47
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv15507/src Modified Files: nickserv.c nickserv.h Log Message: implement MAXLOGINS option for accounts (closes SF#774205) correctly iterate over second account's memberships when merging accounts (closes SF#797829) Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.259 retrieving revision 1.260 diff -C2 -r1.259 -r1.260 *** nickserv.c 26 Sep 2003 15:28:17 -0000 1.259 --- nickserv.c 4 Oct 2003 01:35:40 -0000 1.260 *************** *** 92,95 **** --- 92,96 ---- #define KEY_TABLE_WIDTH "table_width" #define KEY_ANNOUNCEMENTS "announcements" + #define KEY_MAXLOGINS "maxlogins" #define NSMSG_RIGHT_NOW "Right now!" *************** *** 138,141 **** --- 139,144 ---- #define NSMSG_USER_PREV_AUTH "$b%s$b is already authenticated." #define NSMSG_USER_PREV_STAMP "$b%s$b has authenticated to an account once and cannot authenticate again." + #define NSMSG_BAD_MAX_LOGINS "MaxLogins must be at most %d." + #define NSMSG_MAX_LOGINS "Your account already has its limit of %d user(s) logged in." #define NSMSG_STAMPED_REGISTER "You have already authenticated to an account once this session; you may not register a new account." *************** *** 309,312 **** --- 312,317 ---- enum reclaim_action auto_reclaim_action; unsigned long auto_reclaim_delay; + unsigned char default_maxlogins; + unsigned char hard_maxlogins; } nickserv_conf; *************** *** 1426,1432 **** static NICKSERV_FUNC(cmd_auth) { ! int pw_arg; struct handle_info *hi; const char *passwd; if (user->handle_info) { --- 1431,1438 ---- static NICKSERV_FUNC(cmd_auth) { ! int pw_arg, used, maxlogins; struct handle_info *hi; const char *passwd; + struct userNode *other; if (user->handle_info) { *************** *** 1506,1517 **** return 1; } ! if (nickserv_conf.email_required && !hi->email_addr) { nickserv_notice(user, NSMSG_PLEASE_SET_EMAIL); ! } ! if (!is_secure_password(hi->handle, passwd, NULL)) { nickserv_notice(user, NSMSG_WEAK_PASSWORD); ! } ! if (hi->passwd[0] != '$') cryptpass(passwd, hi->passwd); nickserv_notice(user, NSMSG_AUTH_SUCCESS); --- 1512,1530 ---- return 1; } + maxlogins = hi->maxlogins ? hi->maxlogins : nickserv_conf.default_maxlogins; + for (used = 0, other = hi->users; other; other = other->next_authed) { + if (++used >= maxlogins) { + reply(NSMSG_MAX_LOGINS, maxlogins); + argv[pw_arg] = "MAXLOGINS"; + return 1; + } + } ! if (nickserv_conf.email_required && !hi->email_addr) nickserv_notice(user, NSMSG_PLEASE_SET_EMAIL); ! if (!is_secure_password(hi->handle, passwd, NULL)) nickserv_notice(user, NSMSG_WEAK_PASSWORD); ! if (hi->passwd[0] != '$') ! cryptpass(passwd, hi->passwd); nickserv_notice(user, NSMSG_AUTH_SUCCESS); *************** *** 1950,1967 **** { option_func_t *opt; ! unsigned int i = 0; char *set_display[] = { ! "INFO", "WIDTH", "TABLEWIDTH", "COLOR", "PRIVMSG", "STYLE", "EMAIL", "ANNOUNCEMENTS"}; nickserv_notice(user, NSMSG_SETTING_LIST); /* Do this so options are presented in a consistent order. */ ! while(i < ArrayLength(set_display)) ! { ! if((opt = dict_find(nickserv_opt_dict, set_display[i++], NULL))) ! { opt(user, hi, override, 0, NULL); - } - } } --- 1963,1978 ---- { option_func_t *opt; ! unsigned int i; char *set_display[] = { ! "INFO", "WIDTH", "TABLEWIDTH", "COLOR", "PRIVMSG", "STYLE", ! "EMAIL", "ANNOUNCEMENTS", "MAXLOGINS" ! }; nickserv_notice(user, NSMSG_SETTING_LIST); /* Do this so options are presented in a consistent order. */ ! for (i = 0; i < ArrayLength(set_display); ++i) ! if ((opt = dict_find(nickserv_opt_dict, set_display[i], NULL))) opt(user, hi, override, 0, NULL); } *************** *** 1990,1994 **** NICKSERV_MIN_PARMS(2); ! if (!(hi = get_victim_oper(user, argv[1]))) return 0; if (argc < 3) { --- 2001,2006 ---- NICKSERV_MIN_PARMS(2); ! if (!(hi = get_victim_oper(user, argv[1]))) ! return 0; if (argc < 3) { *************** *** 2213,2216 **** --- 2225,2244 ---- } + static OPTION_FUNC(opt_maxlogins) + { + unsigned char maxlogins; + if (argc > 1) { + maxlogins = strtoul(argv[1], NULL, 0); + if ((maxlogins > nickserv_conf.hard_maxlogins) && !override) { + nickserv_notice(user, NSMSG_BAD_MAX_LOGINS, nickserv_conf.hard_maxlogins); + return 0; + } + hi->maxlogins = maxlogins; + } + maxlogins = hi->maxlogins ? hi->maxlogins : nickserv_conf.default_maxlogins; + nickserv_notice(user, NSMSG_NUM_SETTING, "MAXLOGINS:", maxlogins); + return 1; + } + int oper_try_set_access(struct userNode *user, struct userNode *bot, struct handle_info *target, unsigned int new_level) { *************** *** 2493,2496 **** --- 2521,2525 ---- saxdb_write_int(ctx, KEY_LAST_SEEN, hi->lastseen); if (hi->masks->used) saxdb_write_string_list(ctx, KEY_MASKS, hi->masks); + if (hi->maxlogins) saxdb_write_int(ctx, KEY_MAXLOGINS, hi->maxlogins); if (hi->nicks) { struct string_list *slist; *************** *** 2574,2579 **** NICKSERV_MIN_PARMS(3); ! if (!(hi_from = get_victim_oper(user, argv[1]))) return 0; ! if (!(hi_to = get_victim_oper(user, argv[2]))) return 0; if (hi_to == hi_from) { nickserv_notice(user, NSMSG_CANNOT_MERGE_SELF, hi_to->handle); --- 2603,2610 ---- NICKSERV_MIN_PARMS(3); ! if (!(hi_from = get_victim_oper(user, argv[1]))) ! return 0; ! if (!(hi_to = get_victim_oper(user, argv[2]))) ! return 0; if (hi_to == hi_from) { nickserv_notice(user, NSMSG_CANNOT_MERGE_SELF, hi_to->handle); *************** *** 2581,2585 **** } ! for (n=0; n<handle_merge_func_used; n++) handle_merge_func_list[n](user, hi_to, hi_from); /* Append "from" handle's nicks to "to" handle's nick list. */ --- 2612,2617 ---- } ! for (n=0; n<handle_merge_func_used; n++) ! handle_merge_func_list[n](user, hi_to, hi_from); /* Append "from" handle's nicks to "to" handle's nick list. */ *************** *** 2597,2607 **** for (ii=0; ii<hi_from->masks->used; ii++) { char *mask = hi_from->masks->list[ii]; ! for (jj=0; jj<hi_to->masks->used; jj++) { ! if (match_ircglobs(hi_to->masks->list[jj], mask)) break; ! } ! if (jj==hi_to->masks->used) { ! /* Nothing from the "to" handle covered this mask, so add it. */ string_list_append(hi_to->masks, strdup(mask)); - } } --- 2629,2637 ---- for (ii=0; ii<hi_from->masks->used; ii++) { char *mask = hi_from->masks->list[ii]; ! for (jj=0; jj<hi_to->masks->used; jj++) ! if (match_ircglobs(hi_to->masks->list[jj], mask)) ! break; ! if (jj==hi_to->masks->used) /* Nothing from the "to" handle covered this mask, so add it. */ string_list_append(hi_to->masks, strdup(mask)); } *************** *** 2623,2635 **** struct userData *cList2; cListNext = cList->u_next; ! for (cList2=hi_to->channels; cList2; cList2=cList2->next) { ! if (cList->channel == cList2->channel) break; ! } if (cList2 && (cList2->access >= cList->access)) { /* keep cList2 in hi_to; remove cList from hi_from */ del_channel_user(cList, 1); } else { if (cList2) { ! /* hi_from handle has higher access; remove cList2 from hi_to */ del_channel_user(cList2, 1); } --- 2653,2671 ---- struct userData *cList2; cListNext = cList->u_next; ! for (cList2=hi_to->channels; cList2; cList2=cList2->u_next) ! if (cList->channel == cList2->channel) ! break; ! log_module(NS_LOG, LOG_DEBUG, "Merging %s->%s@%s: before %p->%p->%-p, %p->%p->%p", ! hi_from->handle, hi_to->handle, cList->channel->channel->name, ! cList->u_prev, cList, cList->u_next, ! (cList2?cList2->u_prev:0), cList2, (cList2?cList2->u_next:0)); if (cList2 && (cList2->access >= cList->access)) { /* keep cList2 in hi_to; remove cList from hi_from */ + log_module(NS_LOG, LOG_DEBUG, "Deleting %p", cList); del_channel_user(cList, 1); } else { if (cList2) { ! /* remove the lower-ranking cList2 from hi_to */ ! log_module(NS_LOG, LOG_DEBUG, "Deleting %p", cList2); del_channel_user(cList2, 1); } *************** *** 2637,2660 **** cList->handle = hi_to; /* Remove from linked list for hi_from */ ! if (cList->u_prev) cList->u_prev->next = cList->u_next; ! else hi_from->channels = cList->u_next; ! if (cList->u_next) cList->u_next->u_prev = cList->u_prev; /* Add to linked list for hi_to */ cList->u_prev = NULL; - if (hi_to->channels) hi_to->channels->u_prev = cList; cList->u_next = hi_to->channels; hi_to->channels = cList; } } /* Do they get an OpServ level promotion? */ ! if (hi_from->opserv_level > hi_to->opserv_level) { hi_to->opserv_level = hi_from->opserv_level; - } /* What about last seen time? */ ! if (hi_from->lastseen > hi_to->lastseen) { hi_to->lastseen = hi_from->lastseen; - } /* Notify of success. */ --- 2673,2698 ---- cList->handle = hi_to; /* Remove from linked list for hi_from */ ! assert(!cList->u_prev); ! hi_from->channels = cList->u_next; ! if (cList->u_next) ! cList->u_next->u_prev = cList->u_prev; /* Add to linked list for hi_to */ cList->u_prev = NULL; cList->u_next = hi_to->channels; + if (hi_to->channels) + hi_to->channels->u_prev = cList; hi_to->channels = cList; + log_module(NS_LOG, LOG_DEBUG, "Now %p->%p->%p", + cList->u_prev, cList, cList->u_next); } } /* Do they get an OpServ level promotion? */ ! if (hi_from->opserv_level > hi_to->opserv_level) hi_to->opserv_level = hi_from->opserv_level; /* What about last seen time? */ ! if (hi_from->lastseen > hi_to->lastseen) hi_to->lastseen = hi_from->lastseen; /* Notify of success. */ *************** *** 2960,2963 **** --- 2998,3005 ---- masks = database_get_data(obj, KEY_MASKS, RECDB_STRING_LIST); hi->masks = masks ? string_list_copy(masks) : alloc_string_list(1); + str = database_get_data(obj, KEY_MAXLOGINS, RECDB_QSTRING); + hi->maxlogins = str ? strtoul(str, NULL, 0) : 0; + if (hi->maxlogins > nickserv_conf.hard_maxlogins) + hi->maxlogins = nickserv_conf.hard_maxlogins; str = database_get_data(obj, KEY_OPSERV_LEVEL, RECDB_QSTRING); hi->opserv_level = str ? strtoul(str, NULL, 0) : 0; *************** *** 3187,3190 **** --- 3229,3236 ---- str = database_get_data(conf_node, "warn_clone_auth", RECDB_QSTRING); nickserv_conf.warn_clone_auth = str ? !disabled_string(str) : 1; + str = database_get_data(conf_node, "default_maxlogins", RECDB_QSTRING); + nickserv_conf.default_maxlogins = str ? strtoul(str, NULL, 0) : 2; + str = database_get_data(conf_node, "hard_maxlogins", RECDB_QSTRING); + nickserv_conf.hard_maxlogins = str ? strtoul(str, NULL, 0) : 10; if (!nickserv_conf.disable_nicks) { str = database_get_data(conf_node, "reclaim_action", RECDB_QSTRING); *************** *** 3397,3402 **** free(handle_merge_func_list); free(failpw_func_list); ! if (nickserv_conf.valid_handle_regex_set) regfree(&nickserv_conf.valid_handle_regex); ! if (nickserv_conf.valid_nick_regex_set) regfree(&nickserv_conf.valid_nick_regex); } --- 3443,3450 ---- free(handle_merge_func_list); free(failpw_func_list); ! if (nickserv_conf.valid_handle_regex_set) ! regfree(&nickserv_conf.valid_handle_regex); ! if (nickserv_conf.valid_nick_regex_set) ! regfree(&nickserv_conf.valid_nick_regex); } *************** *** 3482,3485 **** --- 3530,3534 ---- dict_insert(nickserv_opt_dict, "EPITHET", opt_epithet); dict_insert(nickserv_opt_dict, "ANNOUNCEMENTS", opt_announcements); + dict_insert(nickserv_opt_dict, "MAXLOGINS", opt_maxlogins); nickserv_handle_dict = dict_new(); Index: nickserv.h =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -r1.46 -r1.47 *** nickserv.h 9 Sep 2003 16:40:29 -0000 1.46 --- nickserv.h 4 Oct 2003 01:35:41 -0000 1.47 *************** *** 85,97 **** char *infoline; unsigned long flags; - unsigned int opserv_level; - unsigned int screen_width; - unsigned int table_width; time_t registered, lastseen; char *handle; char passwd[MD5_CRYPT_LENGTH+1]; char last_quit_host[USERLEN+HOSTLEN+2]; ! char userlist_style; ! char announcements; }; --- 85,98 ---- char *infoline; unsigned long flags; time_t registered, lastseen; char *handle; char passwd[MD5_CRYPT_LENGTH+1]; char last_quit_host[USERLEN+HOSTLEN+2]; ! unsigned short opserv_level; ! unsigned short screen_width; ! unsigned short table_width; ! unsigned char userlist_style; ! unsigned char announcements; ! unsigned char maxlogins; }; |
From: Entrope <en...@us...> - 2003-10-03 02:46:46
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv29311 Modified Files: chanserv.c Log Message: Fix logic for validate_op() to be like it was before the last commit Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.381 retrieving revision 1.382 diff -C2 -r1.381 -r1.382 *** chanserv.c 26 Sep 2003 15:13:47 -0000 1.381 --- chanserv.c 3 Oct 2003 02:46:42 -0000 1.382 *************** *** 404,408 **** #define ACCESSLEN 10 ! #define CSMSG_NETRIDE_DETECTED "Netride detected - bye." #define CSMSG_KICK_REASON "Bye." #define CSMSG_KICK_EXTRA 4 --- 404,408 ---- #define ACCESSLEN 10 ! #define CSMSG_NETRIDE_DETECTED "User from far side of netsplit should have been banned - bye." #define CSMSG_KICK_REASON "Bye." #define CSMSG_KICK_EXTRA 4 *************** *** 1597,1602 **** struct userData *cs_victim; ! if((cs_victim = GetChannelUser(channel->channel_info, victim->handle_info)) ! && (cs_victim->access >= ulOp) && !check_user_level(user, channel, channel->channel_info->options[optStrictOp], 1, 0)) { --- 1597,1602 ---- struct userData *cs_victim; ! if((!(cs_victim = GetChannelUser(channel->channel_info, victim->handle_info)) ! || (cs_victim->access < ulOp)) && !check_user_level(user, channel, channel->channel_info->options[optStrictOp], 1, 0)) { |
From: Entrope <en...@us...> - 2003-10-03 02:45:31
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv29038 Modified Files: opserv.c Log Message: Clear bad_channel flag when an exemption is added or a badword is removed Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.339 retrieving revision 1.340 diff -C2 -r1.339 -r1.340 *** opserv.c 30 Sep 2003 17:47:08 -0000 1.339 --- opserv.c 3 Oct 2003 02:45:26 -0000 1.340 *************** *** 420,424 **** strcpy(buffer, "Modes: "); irc_make_chanmode(channel, buffer+strlen(buffer)); ! if (channel->bad_channel) strcat(buffer, "; bad-word channel"); opserv_notice(user, "%s", buffer); if (channel->topic_time > 1) { --- 420,425 ---- strcpy(buffer, "Modes: "); irc_make_chanmode(channel, buffer+strlen(buffer)); ! if (channel->bad_channel) ! strcat(buffer, "; bad-word channel"); opserv_notice(user, "%s", buffer); if (channel->topic_time > 1) { *************** *** 1766,1774 **** dict_find(opserv_exempt_channels, name, &found); ! if (found) return 0; ! for (found=0; found<opserv_bad_words->used; ++found) { ! if (irccasestr(name, opserv_bad_words->list[found])) return 1; ! } return 0; --- 1767,1776 ---- dict_find(opserv_exempt_channels, name, &found); ! if (found) ! return 0; ! for (found=0; found<opserv_bad_words->used; ++found) ! if (irccasestr(name, opserv_bad_words->list[found])) ! return 1; return 0; *************** *** 1952,1955 **** --- 1954,1958 ---- static OPSERV_FUNC(cmd_delbad) { + dict_iterator_t it; unsigned int nn; *************** *** 1957,1960 **** --- 1960,1969 ---- if (!irccasecmp(opserv_bad_words->list[nn], argv[1])) { string_list_delete(opserv_bad_words, nn); + for (it = dict_first(channels); it; it = iter_next(it)) { + channel = iter_data(it); + if (irccasestr(channel->name, argv[1]) + && !opserv_bad_channel(channel->name)) + channel->bad_channel = 0; + } opserv_notice(user, OSMSG_REMOVED_BAD, argv[1]); return 1; *************** *** 1977,1980 **** --- 1986,1992 ---- } dict_insert(opserv_exempt_channels, strdup(chanName), NULL); + channel = GetChannel(chanName); + if (channel) + channel->bad_channel = 0; reply(OSMSG_ADDED_EXEMPTION, chanName); return 1; |
From: Entrope <en...@us...> - 2003-10-03 02:42:32
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv28403 Modified Files: global.c Log Message: Bail early in global_message() if Global was disabled Index: global.c =================================================================== RCS file: /cvsroot/srvx/services/src/global.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -r1.59 -r1.60 *** global.c 26 Sep 2003 15:16:58 -0000 1.59 --- global.c 3 Oct 2003 02:42:27 -0000 1.60 *************** *** 344,348 **** { user = curr_helpers.list[n]; ! if (IsOper(user)) continue; notice_target(user->nick, message); } --- 344,349 ---- { user = curr_helpers.list[n]; ! if (IsOper(user)) ! continue; notice_target(user->nick, message); } *************** *** 355,369 **** struct globalMessage *message; ! if(!targets) ! { return; - } message = message_add(targets | MESSAGE_OPTION_SOURCELESS, now, 0, "", text); - if(!message) - { return; - } message_send(message); --- 356,365 ---- struct globalMessage *message; ! if(!targets || !global) return; message = message_add(targets | MESSAGE_OPTION_SOURCELESS, now, 0, "", text); if(!message) return; message_send(message); |
From: Adrian D. <sai...@us...> - 2003-09-30 17:47:14
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv17866/src Modified Files: opserv.c opserv.help Log Message: Add new trace criterion info_space Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.338 retrieving revision 1.339 diff -C2 -r1.338 -r1.339 *** opserv.c 9 Sep 2003 16:38:13 -0000 1.338 --- opserv.c 30 Sep 2003 17:47:08 -0000 1.339 *************** *** 326,330 **** unsigned int match_opers : 1, option_log : 1; unsigned int chan_req_modes : 2, chan_no_modes : 2; ! int authed : 2; time_t min_ts, max_ts; } *discrim_t; --- 326,330 ---- unsigned int match_opers : 1, option_log : 1; unsigned int chan_req_modes : 2, chan_no_modes : 2; ! int authed : 2, info_space : 2; time_t min_ts, max_ts; } *discrim_t; *************** *** 2308,2311 **** --- 2308,2312 ---- discrim->max_channels = INT_MAX; discrim->authed = -1; + discrim->info_space = -1; dupmask = strdup(hostmask); if (split_ircmask(dupmask, &discrim->mask_nick, &discrim->mask_ident, &discrim->mask_host)) { *************** *** 2781,2784 **** --- 2782,2786 ---- discrim->max_channels = INT_MAX; discrim->authed = -1; + discrim->info_space = -1; for (i=0; i<argc; i++) { *************** *** 2838,2841 **** --- 2840,2855 ---- goto fail; } + } else if (irccasecmp(argv[i], "info_space") == 0) { + /* XXX: A hack because you can't check explicitly for a space through + * any other means */ + i++; + if (true_string(argv[i])) { + discrim->info_space = 1; + } else if (false_string(argv[i])) { + discrim->info_space = 0; + } else { + opserv_notice(user, MSG_INVALID_BINARY, argv[i]); + goto fail; + } } else if (irccasecmp(argv[i], "duration") == 0) { discrim->duration = ParseInterval(argv[++i]); *************** *** 2926,2933 **** } else if (irccasecmp(argv[i], "clones") == 0) { discrim->min_clones = strtoul(argv[++i], NULL, 0); ! } else { ! opserv_notice(user, MSG_INVALID_CRITERIA, argv[i]); ! goto fail; ! } } --- 2940,2947 ---- } else if (irccasecmp(argv[i], "clones") == 0) { discrim->min_clones = strtoul(argv[++i], NULL, 0); ! } else { ! opserv_notice(user, MSG_INVALID_CRITERIA, argv[i]); ! goto fail; ! } } *************** *** 2961,2964 **** --- 2975,2980 ---- || (discrim->authed == 0 && user->handle_info) || (discrim->authed == 1 && !user->handle_info) + || (discrim->info_space == 0 && user->info[0] == ' ') + || (discrim->info_space == 1 && user->info[0] != ' ') || (discrim->mask_nick && !match_ircglob(user->nick, discrim->mask_nick)) || (discrim->mask_ident && !match_ircglob(user->ident, discrim->mask_ident)) Index: opserv.help =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.help,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -r1.65 -r1.66 *** opserv.help 3 Aug 2003 03:01:24 -0000 1.65 --- opserv.help 30 Sep 2003 17:47:09 -0000 1.66 *************** *** 83,86 **** --- 83,87 ---- "$bDURATION$b duration How long to apply a G-line or gag.", "$bCLONES$b min Ignore clients from hosts with fewer than this many connections.", + "$bINFO_SPACE$b yes/no Clients match only if their info starts with a space (' ') character.", "$bABUSE OPERS$b Force adverse actions to affect opers as well.", "$bLOG$b Record matching users in $O's log file (in addition to acting).", |
From: Entrope <en...@us...> - 2003-09-28 14:18:22
|
Update of /cvsroot/srvx/services/patches In directory sc8-pr-cvs1:/tmp/cvs-serv17973/patches Modified Files: log-pgsql.diff Log Message: remove debug statements from postgresql logging backend Index: log-pgsql.diff =================================================================== RCS file: /cvsroot/srvx/services/patches/log-pgsql.diff,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** log-pgsql.diff 26 Sep 2003 22:07:56 -0000 1.2 --- log-pgsql.diff 28 Sep 2003 14:18:04 -0000 1.3 *************** *** 5,9 **** diff -u -r1.59 Makefile.am --- src/Makefile.am 9 Sep 2003 01:56:55 -0000 1.59 ! +++ src/Makefile.am 26 Sep 2003 22:02:48 -0000 @@ -9,7 +9,7 @@ ./expnhelp < $(srcdir)/nickserv.help.m4 > $@ --- 5,9 ---- diff -u -r1.59 Makefile.am --- src/Makefile.am 9 Sep 2003 01:56:55 -0000 1.59 ! +++ src/Makefile.am 28 Sep 2003 14:16:39 -0000 @@ -9,7 +9,7 @@ ./expnhelp < $(srcdir)/nickserv.help.m4 > $@ *************** *** 21,25 **** diff -u -r1.65 log.c --- src/log.c 22 Aug 2003 00:26:21 -0000 1.65 ! +++ src/log.c 26 Sep 2003 22:02:48 -0000 @@ -22,6 +22,8 @@ #include "log.h" --- 21,25 ---- diff -u -r1.65 log.c --- src/log.c 22 Aug 2003 00:26:21 -0000 1.65 ! +++ src/log.c 28 Sep 2003 14:16:40 -0000 @@ -22,6 +22,8 @@ #include "log.h" *************** *** 31,35 **** struct logDestination; ! @@ -992,6 +994,246 @@ ldIrc_module }; --- 31,35 ---- struct logDestination; ! @@ -992,6 +994,234 @@ ldIrc_module }; *************** *** 88,96 **** + PQclear(pgres); + } - + ld->recurse_level++; + if (ld->queue.used == 1) + ld->queue.list[1] = NULL; - + log_module(MAIN_LOG, LOG_DEBUG, "pgsql_readable finished %p, next is %p", ld->queue.list[0], ld->queue.list[1]); - + ld->recurse_level--; + free(ld->queue.list[0]); + ld->queue.used--; --- 88,93 ---- *************** *** 131,137 **** +ldPgsql_reopen(struct logDestination *self_) { + struct logDest_pgsql *self = (struct logDest_pgsql*)self_; - + self->recurse_level++; - + log_module(MAIN_LOG, LOG_DEBUG, "pgsql_reopen finished resetting connection with %d queued (head %p)", self->queue.used, self->queue.list[0]); - + self->recurse_level--; + PQreset(self->conn); +} --- 128,131 ---- *************** *** 144,152 **** + PQfinish(self->conn); + ioset_close(self->fd->fd, 0); ! + self->recurse_level++; ! + for (ii = 0; ii < self->queue.used; ++ii) { ! + log_module(MAIN_LOG, LOG_DEBUG, "pgsql free()'ing leftover log %p", self->queue.list[ii]); + free(self->queue.list[ii]); - + } + self->recurse_level--; + free(self->queue.list); --- 138,143 ---- + PQfinish(self->conn); + ioset_close(self->fd->fd, 0); ! + for (ii = 0; ii < self->queue.used; ++ii) + free(self->queue.list[ii]); + self->recurse_level--; + free(self->queue.list); *************** *** 195,201 **** +static void +pgsql_insert(struct logDest_pgsql *self, char *query) { - + self->recurse_level++; - + log_module(MAIN_LOG, LOG_DEBUG, "pgsql_insert(%p, %p=\"%s\")", self, query, query); - + self->recurse_level--; + string_list_append(&self->queue, query); + if (self->queue.used == 1) --- 186,189 ---- *************** *** 278,282 **** log_init(void) { ! @@ -1003,6 +1245,7 @@ dict_insert(log_dest_types, ldFile_vtbl.type_name, &ldFile_vtbl); dict_insert(log_dest_types, ldStd_vtbl.type_name, &ldStd_vtbl); --- 266,270 ---- log_init(void) { ! @@ -1003,6 +1233,7 @@ dict_insert(log_dest_types, ldFile_vtbl.type_name, &ldFile_vtbl); dict_insert(log_dest_types, ldStd_vtbl.type_name, &ldStd_vtbl); |
From: Entrope <en...@us...> - 2003-09-26 22:08:10
|
Update of /cvsroot/srvx/services/patches In directory sc8-pr-cvs1:/tmp/cvs-serv19482/patches Modified Files: log-pgsql.diff Log Message: update patch for current code buffer queries sent to postgresql, so locked tables (e.g. vacuum) don't cause a ping timeout Index: log-pgsql.diff =================================================================== RCS file: /cvsroot/srvx/services/patches/log-pgsql.diff,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** log-pgsql.diff 1 Sep 2003 15:06:06 -0000 1.1 --- log-pgsql.diff 26 Sep 2003 22:07:56 -0000 1.2 *************** *** 2,15 **** =================================================================== RCS file: /cvsroot/srvx/services/src/Makefile.am,v ! retrieving revision 1.57 ! diff -u -r1.57 Makefile.am ! --- src/Makefile.am 13 Sep 2002 14:11:08 -0000 1.57 ! +++ src/Makefile.am 11 Jul 2003 03:22:15 -0000 ! @@ -8,9 +8,8 @@ ! nickserv.help: nickserv.help.m4 expnhelp ./expnhelp < $(srcdir)/nickserv.help.m4 > $@ ! -srvx_LIBS = @RX_LIBS@ ! EXTRA_srvx_SOURCES = proto-bahamut.c proto-common.c proto-p10.c mod-snoop.c -srvx_LDADD = @MODULE_OBJS@ +srvx_LDADD = @MODULE_OBJS@ -lpq --- 2,13 ---- =================================================================== RCS file: /cvsroot/srvx/services/src/Makefile.am,v ! retrieving revision 1.59 ! diff -u -r1.59 Makefile.am ! --- src/Makefile.am 9 Sep 2003 01:56:55 -0000 1.59 ! +++ src/Makefile.am 26 Sep 2003 22:02:48 -0000 ! @@ -9,7 +9,7 @@ ./expnhelp < $(srcdir)/nickserv.help.m4 > $@ ! EXTRA_srvx_SOURCES = proto-bahamut.c proto-common.c proto-p10.c mod-snoop.c mod-memoserv.c -srvx_LDADD = @MODULE_OBJS@ +srvx_LDADD = @MODULE_OBJS@ -lpq *************** *** 20,36 **** =================================================================== RCS file: /cvsroot/srvx/services/src/log.c,v ! retrieving revision 1.58 ! diff -u -r1.58 log.c ! --- src/log.c 11 Jul 2003 03:16:07 -0000 1.58 ! +++ src/log.c 11 Jul 2003 03:22:17 -0000 ! @@ -22,6 +22,7 @@ #include "log.h" #include "helpfile.h" #include "nickserv.h" +#include <postgresql/libpq-fe.h> struct logDestination; ! @@ -974,6 +975,178 @@ ldIrc_module }; --- 18,35 ---- =================================================================== RCS file: /cvsroot/srvx/services/src/log.c,v ! retrieving revision 1.65 ! diff -u -r1.65 log.c ! --- src/log.c 22 Aug 2003 00:26:21 -0000 1.65 ! +++ src/log.c 26 Sep 2003 22:02:48 -0000 ! @@ -22,6 +22,8 @@ #include "log.h" #include "helpfile.h" #include "nickserv.h" + +#include "ioset.h" +#include <postgresql/libpq-fe.h> struct logDestination; ! @@ -992,6 +994,246 @@ ldIrc_module }; *************** *** 40,48 **** --- 39,104 ---- +struct logDest_pgsql { + struct logDestination base; + + struct string_list queue; + PGconn *conn; + + struct io_fd *fd; + int recurse_level; +}; +static struct logDest_vtable ldPgsql_vtbl; + + +static void ldPgsql_send_next_query(struct logDest_pgsql *ld) { + + int res; + + + + res = PQsendQuery(ld->conn, ld->queue.list[0]); + + if (!res) { + + ld->recurse_level++; + + log_module(MAIN_LOG, LOG_ERROR, "Error sending query \"%s\": %s", ld->queue.list[0], PQerrorMessage(ld->conn)); + + ld->recurse_level--; + + return; + + } + + res = PQflush(ld->conn); + + if (res == EOF) { + + ld->recurse_level++; + + log_module(MAIN_LOG, LOG_ERROR, "Error flushing PgSql output: %s", PQerrorMessage(ld->conn)); + + ld->recurse_level--; + + } + +} + + + +static void ldPgsql_readable(struct io_fd *fd) { + + struct logDest_pgsql *ld = fd->data; + + PGresult *pgres; + + unsigned int ii; + + int res; + + ExecStatusType st; + + + + res = PQconsumeInput(ld->conn); + + if (!res) { + + ld->recurse_level++; + + log_module(MAIN_LOG, LOG_ERROR, "Error consuming PgSql input: %s", PQerrorMessage(ld->conn)); + + ld->recurse_level--; + + } + + if (PQisBusy(ld->conn)) + + return; + + while ((pgres = PQgetResult(ld->conn))) { + + st = PQresultStatus(pgres); + + if (st != PGRES_COMMAND_OK) { + + ld->recurse_level++; + + log_module(MAIN_LOG, LOG_ERROR, "PgSql error in \"%s\": %s", ld->queue.list[0], PQresultErrorMessage(pgres)); + + ld->recurse_level--; + + } + + PQclear(pgres); + + } + + ld->recurse_level++; + + if (ld->queue.used == 1) + + ld->queue.list[1] = NULL; + + log_module(MAIN_LOG, LOG_DEBUG, "pgsql_readable finished %p, next is %p", ld->queue.list[0], ld->queue.list[1]); + + ld->recurse_level--; + + free(ld->queue.list[0]); + + ld->queue.used--; + + for (ii = 0; ii < ld->queue.used; ++ii) + + ld->queue.list[ii] = ld->queue.list[ii+1]; + + if (ld->queue.used) + + ldPgsql_send_next_query(ld); + +} + + +static struct logDestination * +ldPgsql_open(const char *args) { *************** *** 51,61 **** + ld->base.vtbl = &ldPgsql_vtbl; + ld->conn = PQconnectdb(args); ! + ld->recurse_level = 1; + if (!ld->conn) { + log_module(MAIN_LOG, LOG_ERROR, "Unable to allocate pgsql connection"); + } else if (PQstatus(ld->conn) == CONNECTION_BAD) { + log_module(MAIN_LOG, LOG_ERROR, "Pgsql connection failed: %s", PQerrorMessage(ld->conn)); + } ! + ld->recurse_level = 0; + return &ld->base; +} --- 107,128 ---- + ld->base.vtbl = &ldPgsql_vtbl; + ld->conn = PQconnectdb(args); ! + ld->recurse_level++; + if (!ld->conn) { + log_module(MAIN_LOG, LOG_ERROR, "Unable to allocate pgsql connection"); + } else if (PQstatus(ld->conn) == CONNECTION_BAD) { + log_module(MAIN_LOG, LOG_ERROR, "Pgsql connection failed: %s", PQerrorMessage(ld->conn)); + + } else { + + int res; + + res = PQsetnonblocking(ld->conn, 1); + + if (res == -1) + + log_module(MAIN_LOG, LOG_ERROR, "Unable to make pgsql non-blocking"); + + ld->fd = ioset_add(PQsocket(ld->conn)); + + ld->fd->data = ld; + + ld->fd->connected = 1; + + ld->fd->wants_reads = 1; + + ld->fd->readable_cb = ldPgsql_readable; + + while (PQflush(ld->conn)) ; + } ! + ld->recurse_level--; + return &ld->base; +} *************** *** 64,67 **** --- 131,137 ---- +ldPgsql_reopen(struct logDestination *self_) { + struct logDest_pgsql *self = (struct logDest_pgsql*)self_; + + self->recurse_level++; + + log_module(MAIN_LOG, LOG_DEBUG, "pgsql_reopen finished resetting connection with %d queued (head %p)", self->queue.used, self->queue.list[0]); + + self->recurse_level--; + PQreset(self->conn); +} *************** *** 70,74 **** --- 140,154 ---- +ldPgsql_close(struct logDestination *self_) { + struct logDest_pgsql *self = (struct logDest_pgsql*)self_; + + unsigned int ii; + + + PQfinish(self->conn); + + ioset_close(self->fd->fd, 0); + + self->recurse_level++; + + for (ii = 0; ii < self->queue.used; ++ii) { + + log_module(MAIN_LOG, LOG_DEBUG, "pgsql free()'ing leftover log %p", self->queue.list[ii]); + + free(self->queue.list[ii]); + + } + + self->recurse_level--; + + free(self->queue.list); + free(self); +} *************** *** 115,140 **** +static void +pgsql_insert(struct logDest_pgsql *self, char *query) { - + PGresult *res; - + ExecStatusType st; - + + self->recurse_level++; ! + res = PQexec(self->conn, query); ! + if (!res) { ! + log_module(MAIN_LOG, LOG_ERROR, "PgSql error in \"%s\": %s", query, PQerrorMessage(self->conn)); ! + self->recurse_level--; ! + free(query); ! + return; ! + } ! + st = PQresultStatus(res); ! + switch (st) { ! + case PGRES_COMMAND_OK: ! + break; ! + default: ! + log_module(MAIN_LOG, LOG_ERROR, "PgSql error in \"%s\": %s", query, PQresultErrorMessage(res)); ! + break; ! + } + self->recurse_level--; ! + PQclear(res); ! + free(query); +} + --- 195,204 ---- +static void +pgsql_insert(struct logDest_pgsql *self, char *query) { + self->recurse_level++; ! + log_module(MAIN_LOG, LOG_DEBUG, "pgsql_insert(%p, %p=\"%s\")", self, query, query); + self->recurse_level--; ! + string_list_append(&self->queue, query); ! + if (self->queue.used == 1) ! + ldPgsql_send_next_query(self); +} + *************** *** 144,148 **** + struct string_buffer query; + ! + if (self->recurse_level) return; + query.size = 512; + query.list = malloc(query.size); --- 208,213 ---- + struct string_buffer query; + ! + if (self->recurse_level) ! + return; + query.size = 512; + query.list = malloc(query.size); *************** *** 151,155 **** + string_buffer_append_quoted(&query, type->name); + string_buffer_append_printf(&query, "'), %d, srvx_bot_id('", entry->slvl); ! + string_buffer_append_quoted(&query, type->bot->nick); + string_buffer_append_string(&query, "'), '"); + string_buffer_append_time(&query, entry->time); --- 216,220 ---- + string_buffer_append_quoted(&query, type->name); + string_buffer_append_printf(&query, "'), %d, srvx_bot_id('", entry->slvl); ! + string_buffer_append_quoted(&query, entry->bot->nick); + string_buffer_append_string(&query, "'), '"); + string_buffer_append_time(&query, entry->time); *************** *** 169,173 **** + struct string_buffer query; + ! + if (self->recurse_level) return; + query.size = 512; + query.list = malloc(query.size); --- 234,239 ---- + struct string_buffer query; + ! + if (self->recurse_level) ! + return; + query.size = 512; + query.list = malloc(query.size); *************** *** 186,190 **** + struct string_buffer query; + ! + if (self->recurse_level) return; + query.size = 512; + query.list = malloc(query.size); --- 252,257 ---- + struct string_buffer query; + ! + if (self->recurse_level) ! + return; + query.size = 512; + query.list = malloc(query.size); *************** *** 211,215 **** log_init(void) { ! @@ -985,6 +1158,7 @@ dict_insert(log_dest_types, ldFile_vtbl.type_name, &ldFile_vtbl); dict_insert(log_dest_types, ldStd_vtbl.type_name, &ldStd_vtbl); --- 278,282 ---- log_init(void) { ! @@ -1003,6 +1245,7 @@ dict_insert(log_dest_types, ldFile_vtbl.type_name, &ldFile_vtbl); dict_insert(log_dest_types, ldStd_vtbl.type_name, &ldStd_vtbl); *************** *** 217,220 **** + dict_insert(log_dest_types, ldPgsql_vtbl.type_name, &ldPgsql_vtbl); conf_register_reload(log_conf_read); ! log_default = log_register_type("*", NULL, NULL); reg_exit_func(cleanup_logs); --- 284,287 ---- + dict_insert(log_dest_types, ldPgsql_vtbl.type_name, &ldPgsql_vtbl); conf_register_reload(log_conf_read); ! log_default = log_register_type("*", NULL); reg_exit_func(cleanup_logs); |
From: Entrope <en...@us...> - 2003-09-26 22:04:26
|
Update of /cvsroot/srvx/services/tests In directory sc8-pr-cvs1:/tmp/cvs-serv18891/tests Modified Files: test-driver.pl Log Message: add support for a lot more events, and fix behavior for some unusual cases Index: test-driver.pl =================================================================== RCS file: /cvsroot/srvx/services/tests/test-driver.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test-driver.pl 6 May 2002 23:33:11 -0000 1.2 --- test-driver.pl 26 Sep 2003 22:04:12 -0000 1.3 *************** *** 6,10 **** # want to stop. ! require 5.6.0; use warnings; --- 6,10 ---- # want to stop. ! require 5.006; use warnings; *************** *** 36,41 **** _start => \&drv_start, _child => sub {}, ! _signal => sub {}, ! _stop => sub { print "That's all, folks!\n"; }, _default => \&drv_default, # generic utilities or miscellaneous functions --- 36,40 ---- _start => \&drv_start, _child => sub {}, ! _stop => sub { print "\nThat's all, folks!\n"; }, _default => \&drv_default, # generic utilities or miscellaneous functions *************** *** 52,55 **** --- 51,55 ---- cmd_nick => \&cmd_generic, cmd_notice => \&cmd_message, + cmd_part => \&cmd_generic, cmd_privmsg => \&cmd_message, cmd_quit => \&cmd_generic, *************** *** 63,71 **** irc_msg => \&irc_msg, # PRIVMSG to self irc_public => \&irc_public, # PRIVMSG to channel irc_join => sub {}, irc_mode => sub {}, ! irc_quit => sub {}, ! irc_connected => sub {}, irc_ping => sub {}, irc_error => \&irc_error, irc_disconnected => \&irc_disconnected, --- 63,82 ---- irc_msg => \&irc_msg, # PRIVMSG to self irc_public => \&irc_public, # PRIVMSG to channel + irc_connected => sub {}, + irc_ctcp_action => sub {}, + irc_ctcp_ping => sub {}, + irc_ctcp_time => sub {}, + irc_ctcpreply_ping => sub {}, + irc_ctcpreply_time => sub {}, + irc_invite => sub {}, irc_join => sub {}, + irc_kick => sub {}, + irc_kill => sub {}, irc_mode => sub {}, ! irc_nick => sub {}, ! irc_part => sub {}, irc_ping => sub {}, + irc_quit => sub {}, + irc_topic => sub {}, irc_error => \&irc_error, irc_disconnected => \&irc_disconnected, *************** *** 73,76 **** --- 84,88 ---- args => [@ARGV]); + $| = 1; $poe_kernel->run(); exit; *************** *** 118,121 **** --- 130,134 ---- } elsif (defined($line = <$script>)) { $heap->{lineno} = $.; + print "."; } else { # close all connections *************** *** 136,140 **** # expand any macros in the line ! $line =~ s/(?<=[^\\])%(\S+)%/$heap->{macros}->{$1} or die "Use of undefined macro $1 at $heap->{lineno}"/eg; # remove any \-escapes $line =~ s/\\(.)/$1/g; --- 149,154 ---- # expand any macros in the line ! $line =~ s/(?<=[^\\])%(\S+?)%/$heap->{macros}->{$1} ! or die "Use of undefined macro $1 at $heap->{lineno}\n"/eg; # remove any \-escapes $line =~ s/\\(.)/$1/g; *************** *** 390,394 **** delete $heap->{clients}->{$client->{name}}; } else { ! print "Got unexpected disconnect for $client->{name} (nick $client->{nick})\n"; $kernel->call($session, 'disable_client', $client); $kernel->delay_set('reconnect', $client->{throttled} ? THROTTLED_TIMEOUT : RECONNECT_TIMEOUT, $client); --- 404,412 ---- delete $heap->{clients}->{$client->{name}}; } else { ! if ($client->{disconnect_expected}) { ! delete $client->{disconnect_expected}; ! } else { ! print "Got unexpected disconnect for $client->{name} (nick $client->{nick})\n"; ! } $kernel->call($session, 'disable_client', $client); $kernel->delay_set('reconnect', $client->{throttled} ? THROTTLED_TIMEOUT : RECONNECT_TIMEOUT, $client); *************** *** 448,452 **** my ($kernel, $session, $heap, $sender, $what) = @_[KERNEL, SESSION, HEAP, SENDER, ARG0]; my $client = $heap->{sessions}->{$sender}; ! print "ERROR: From server to $client->{name}: $what\n"; $client->{throttled} = 1 if $what =~ /throttled/i; } --- 466,477 ---- my ($kernel, $session, $heap, $sender, $what) = @_[KERNEL, SESSION, HEAP, SENDER, ARG0]; my $client = $heap->{sessions}->{$sender}; ! if (@{$client->{expect}} ! and $client->{expect}->[0]->[1] =~ /error/i) { ! splice @{$client->{expect}->[0]}, 2, 1; ! unexpect($kernel, $session, $client); ! $client->{disconnect_expected} = 1; ! } else { ! print "ERROR: From server to $client->{name}: $what\n"; ! } $client->{throttled} = 1 if $what =~ /throttled/i; } |
From: Entrope <en...@us...> - 2003-09-26 15:31:54
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv4624/src Modified Files: proto-p10.c Log Message: formatting changes to make profiling more accurate remove "account" argument from AddUser; instead, merge argv[6]..argv[argc-4] into the modes string (yes, this is a kludge, but it fixes parse errors with asuka) add 404 (ERR_CANNOTSENDTOCHAN) dummy handler Index: proto-p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto-p10.c,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -r1.77 -r1.78 *** proto-p10.c 5 Sep 2003 13:42:39 -0000 1.77 --- proto-p10.c 26 Sep 2003 15:31:50 -0000 1.78 *************** *** 288,292 **** static struct dict *unbursted_channels; ! static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *account, const char *numeric, const char *userinfo, time_t timestamp, const char *realip); /* Numerics can be XYY, XYYY, or XXYYY; with X's identifying the --- 288,292 ---- static struct dict *unbursted_channels; ! static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip); [...1792 lines suppressed...] ! } /* build dict of unbursted channel names (just copy existing channels) */ unbursted_channels = dict_new(); ! for (it = dict_first(channels); it; it = iter_next(it)) { dict_insert(unbursted_channels, iter_key(it), iter_data(it)); - } } --- 2378,2388 ---- /* burst local nicks */ ! for (i=0; i<=self->num_mask; i++) ! if (self->users[i]) ! irc_user(self->users[i]); /* build dict of unbursted channel names (just copy existing channels) */ unbursted_channels = dict_new(); ! for (it = dict_first(channels); it; it = iter_next(it)) dict_insert(unbursted_channels, iter_key(it), iter_data(it)); } |
From: Entrope <en...@us...> - 2003-09-26 15:28:21
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv3906/src Modified Files: nickserv.c Log Message: formatting changes to make profiling more accurate do not free() keys in nickserv_allow_auth_dict (avoids double free hazard due to a missing strdup()) Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.258 retrieving revision 1.259 diff -C2 -r1.258 -r1.259 *** nickserv.c 9 Sep 2003 16:40:29 -0000 1.258 --- nickserv.c 26 Sep 2003 15:28:17 -0000 1.259 *************** *** 534,553 **** oper_has_access(struct userNode *user, struct userNode *bot, unsigned int min_level, unsigned int quiet) { if (!user->handle_info) { ! if (!quiet) send_message(user, bot, MSG_AUTHENTICATE); return 0; } if (!IsOper(user) && (!IsHelping(user) || min_level)) { ! if (!quiet) send_message(user, bot, NSMSG_NO_ACCESS); return 0; } if (HANDLE_FLAGGED(user->handle_info, OPER_SUSPENDED)) { ! if (!quiet) send_message(user, bot, MSG_OPER_SUSPENDED); return 0; } if (user->handle_info->opserv_level < min_level) { ! if (!quiet) send_message(user, bot, NSMSG_NO_ACCESS); return 0; } --- 534,557 ---- oper_has_access(struct userNode *user, struct userNode *bot, unsigned int min_level, unsigned int quiet) { if (!user->handle_info) { ! if (!quiet) ! send_message(user, bot, MSG_AUTHENTICATE); return 0; } if (!IsOper(user) && (!IsHelping(user) || min_level)) { ! if (!quiet) ! send_message(user, bot, NSMSG_NO_ACCESS); return 0; } if (HANDLE_FLAGGED(user->handle_info, OPER_SUSPENDED)) { ! if (!quiet) ! send_message(user, bot, MSG_OPER_SUSPENDED); return 0; } if (user->handle_info->opserv_level < min_level) { ! if (!quiet) ! send_message(user, bot, NSMSG_NO_ACCESS); return 0; } *************** *** 564,568 **** /* cant register a juped nick/service nick as handle, to prevent confusion */ user = GetUserH(handle); ! if (user && IsLocal(user)) return 0; /* test either regex or containing all valid chars */ if (nickserv_conf.valid_handle_regex_set) { --- 568,573 ---- /* cant register a juped nick/service nick as handle, to prevent confusion */ user = GetUserH(handle); ! if (user && IsLocal(user)) ! return 0; /* test either regex or containing all valid chars */ if (nickserv_conf.valid_handle_regex_set) { *************** *** 584,591 **** struct userNode *user; /* first, check that the nick is acceptible by the server */ ! if (!is_valid_nick(nick)) return 0; /* cant register a juped nick/service nick.. client could kill it. */ user = GetUserH(nick); ! if (user && IsLocal(user)) return 0; /* test either regex or as valid handle */ if (nickserv_conf.valid_nick_regex_set) { --- 589,598 ---- struct userNode *user; /* first, check that the nick is acceptible by the server */ ! if (!is_valid_nick(nick)) ! return 0; /* cant register a juped nick/service nick.. client could kill it. */ user = GetUserH(nick); ! if (user && IsLocal(user)) ! return 0; /* test either regex or as valid handle */ if (nickserv_conf.valid_nick_regex_set) { *************** *** 656,660 **** int oper_outranks(struct userNode *user, struct handle_info *hi) { ! if (user->handle_info->opserv_level > hi->opserv_level) return 1; if (user->handle_info->opserv_level == hi->opserv_level) { if ((user->handle_info->opserv_level == 1000) --- 663,668 ---- int oper_outranks(struct userNode *user, struct handle_info *hi) { ! if (user->handle_info->opserv_level > hi->opserv_level) ! return 1; if (user->handle_info->opserv_level == hi->opserv_level) { if ((user->handle_info->opserv_level == 1000) *************** *** 710,734 **** len = strlen(pass); if (len < nickserv_conf.password_min_length) { ! if (user) nickserv_notice(user, NSMSG_PASSWORD_SHORT, nickserv_conf.password_min_length); return 0; } if (!irccasecmp(pass, handle)) { ! if (user) nickserv_notice(user, NSMSG_PASSWORD_ACCOUNT); return 0; } dict_find(nickserv_conf.weak_password_dict, pass, &i); if (i) { ! if (user) nickserv_notice(user, NSMSG_PASSWORD_DICTIONARY); return 0; } for (i=0; i<len; i++) { ! if (isdigit(pass[i])) cnt_digits++; ! if (isupper(pass[i])) cnt_upper++; ! if (islower(pass[i])) cnt_lower++; } if ((cnt_lower < nickserv_conf.password_min_lower) || (cnt_upper < nickserv_conf.password_min_upper) || (cnt_digits < nickserv_conf.password_min_digits)) { ! if (user) nickserv_notice(user, NSMSG_PASSWORD_READABLE, nickserv_conf.password_min_digits, nickserv_conf.password_min_upper, nickserv_conf.password_min_lower); return 0; } --- 718,749 ---- len = strlen(pass); if (len < nickserv_conf.password_min_length) { ! if (user) ! nickserv_notice(user, NSMSG_PASSWORD_SHORT, nickserv_conf.password_min_length); return 0; } if (!irccasecmp(pass, handle)) { ! if (user) ! nickserv_notice(user, NSMSG_PASSWORD_ACCOUNT); return 0; } dict_find(nickserv_conf.weak_password_dict, pass, &i); if (i) { ! if (user) ! nickserv_notice(user, NSMSG_PASSWORD_DICTIONARY); return 0; } for (i=0; i<len; i++) { ! if (isdigit(pass[i])) ! cnt_digits++; ! if (isupper(pass[i])) ! cnt_upper++; ! if (islower(pass[i])) ! cnt_lower++; } if ((cnt_lower < nickserv_conf.password_min_lower) || (cnt_upper < nickserv_conf.password_min_upper) || (cnt_digits < nickserv_conf.password_min_digits)) { ! if (user) ! nickserv_notice(user, NSMSG_PASSWORD_READABLE, nickserv_conf.password_min_digits, nickserv_conf.password_min_upper, nickserv_conf.password_min_lower); return 0; } *************** *** 1556,1560 **** return 0; } ! dict_insert(nickserv_allow_auth_dict, strdup(target->nick), hi); nickserv_notice(user, NSMSG_AUTH_ALLOWED, target->nick, hi->handle); nickserv_notice(target, NSMSG_AUTH_ALLOWED_MSG, hi->handle, hi->handle); --- 1571,1575 ---- return 0; } ! dict_insert(nickserv_allow_auth_dict, target->nick, hi); nickserv_notice(user, NSMSG_AUTH_ALLOWED, target->nick, hi->handle); nickserv_notice(target, NSMSG_AUTH_ALLOWED_MSG, hi->handle, hi->handle); *************** *** 3376,3385 **** dict_delete(nickserv_id_dict); dict_delete(nickserv_conf.weak_password_dict); ! if (auth_func_list) free(auth_func_list); ! if (unreg_func_list) free(unreg_func_list); ! if (rf_list) free(rf_list); ! if (allowauth_func_list) free(allowauth_func_list); ! if (handle_merge_func_list) free(handle_merge_func_list); ! if (failpw_func_list) free(failpw_func_list); if (nickserv_conf.valid_handle_regex_set) regfree(&nickserv_conf.valid_handle_regex); if (nickserv_conf.valid_nick_regex_set) regfree(&nickserv_conf.valid_nick_regex); --- 3391,3400 ---- dict_delete(nickserv_id_dict); dict_delete(nickserv_conf.weak_password_dict); ! free(auth_func_list); ! free(unreg_func_list); ! free(rf_list); ! free(allowauth_func_list); ! free(handle_merge_func_list); ! free(failpw_func_list); if (nickserv_conf.valid_handle_regex_set) regfree(&nickserv_conf.valid_handle_regex); if (nickserv_conf.valid_nick_regex_set) regfree(&nickserv_conf.valid_nick_regex); *************** *** 3479,3483 **** nickserv_allow_auth_dict = dict_new(); - dict_set_free_keys(nickserv_allow_auth_dict, free); userList_init(&curr_helpers); --- 3494,3497 ---- |
From: Entrope <en...@us...> - 2003-09-26 15:27:21
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv3749/src Modified Files: modcmd.c modcmd.help Log Message: formatting changes to make profiling more accurate display current trigger when no trigger is given document "service <subcommand>" commands Index: modcmd.c =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.c,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -r1.67 -r1.68 *** modcmd.c 9 Sep 2003 01:58:30 -0000 1.67 --- modcmd.c 26 Sep 2003 15:27:16 -0000 1.68 *************** *** 96,99 **** --- 96,100 ---- #define MCMSG_SERVICE_RENAMED "Service renamed to $b%s$b." #define MCMSG_REMOVED_TRIGGER "Removed trigger from $b%s$b." + #define MCMSG_CURRENT_TRIGGER "Trigger for $b%s$b is $b%c$b." #define MCMSG_NEW_TRIGGER "Changed trigger for $b%s$b to $b%c$b." #define MCMSG_SERVICE_REMOVED "Service $b%s$b has been deleted." *************** *** 295,300 **** for (set_flags = rem_flags = 0; 1; value += end) { end = strcspn(value, ","); ! if (*value == '+') opt = 1; ! else if (*value == '-') opt = 0; else { if (user) { --- 296,303 ---- for (set_flags = rem_flags = 0; 1; value += end) { end = strcspn(value, ","); ! if (*value == '+') ! opt = 1; ! else if (*value == '-') ! opt = 0; else { if (user) { *************** *** 315,321 **** return 0; } ! if (opt) set_flags |= flag->flag, rem_flags &= ~flag->flag; ! else rem_flags |= flag->flag, set_flags &= ~flag->flag; ! if (!value[end-1]) break; } cmd->flags = (cmd->flags | set_flags) & ~rem_flags; --- 318,327 ---- return 0; } ! if (opt) ! set_flags |= flag->flag, rem_flags &= ~flag->flag; ! else ! rem_flags |= flag->flag, set_flags &= ~flag->flag; ! if (!value[end-1]) ! break; } cmd->flags = (cmd->flags | set_flags) & ~rem_flags; *************** *** 438,455 **** if (flags & MODCMD_DISABLED) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MSG_COMMAND_DISABLED, cmd->name); return 0; } if ((flags & MODCMD_REQUIRE_QUALIFIED) && !(options & SVCCMD_QUALIFIED)) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_MUST_QUALIFY, bot->nick, cmd->name, bot->nick); return 0; } if (flags & MODCMD_REQUIRE_AUTHED) { if (!user->handle_info) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MSG_AUTHENTICATE); return 0; } if (HANDLE_FLAGGED(user->handle_info, SUSPENDED)) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_ACCOUNT_SUSPENDED); return 0; } --- 444,465 ---- if (flags & MODCMD_DISABLED) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MSG_COMMAND_DISABLED, cmd->name); return 0; } if ((flags & MODCMD_REQUIRE_QUALIFIED) && !(options & SVCCMD_QUALIFIED)) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_MUST_QUALIFY, bot->nick, cmd->name, bot->nick); return 0; } if (flags & MODCMD_REQUIRE_AUTHED) { if (!user->handle_info) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MSG_AUTHENTICATE); return 0; } if (HANDLE_FLAGGED(user->handle_info, SUSPENDED)) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_ACCOUNT_SUSPENDED); return 0; } *************** *** 457,471 **** if (channel || (options & SVCCMD_NOISY)) { if ((flags & MODCMD_REQUIRE_CHANNEL) && !channel) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MSG_INVALID_CHANNEL); return 0; } if (flags & MODCMD_REQUIRE_REGCHAN) { if (!channel->channel_info) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_CHAN_NOT_REGISTERED, channel->name); return 0; } else if (IsSuspended(channel->channel_info) && !(flags & MODCMD_IGNORE_CSUSPEND)) { /* allow security-override users to always ignore channel suspensions, but flag it as a staff command */ if (!user->handle_info || !HANDLE_FLAGGED(user->handle_info, HELPING)) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_CHAN_SUSPENDED, channel->name, channel->channel_info->suspended->reason); return 0; } --- 467,484 ---- if (channel || (options & SVCCMD_NOISY)) { if ((flags & MODCMD_REQUIRE_CHANNEL) && !channel) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MSG_INVALID_CHANNEL); return 0; } if (flags & MODCMD_REQUIRE_REGCHAN) { if (!channel->channel_info) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_CHAN_NOT_REGISTERED, channel->name); return 0; } else if (IsSuspended(channel->channel_info) && !(flags & MODCMD_IGNORE_CSUSPEND)) { /* allow security-override users to always ignore channel suspensions, but flag it as a staff command */ if (!user->handle_info || !HANDLE_FLAGGED(user->handle_info, HELPING)) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_CHAN_SUSPENDED, channel->name, channel->channel_info->suspended->reason); return 0; } *************** *** 474,493 **** } if (flags & MODCMD_REQUIRE_CHANUSER) { ! if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1; if (!uData) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_NO_CHANNEL_ACCESS, channel->name); return 0; } else if (uData->access < cmd->min_channel_access) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_LOW_CHANNEL_ACCESS, channel->name); return 0; } } if ((flags & MODCMD_REQUIRE_JOINABLE) && channel) { ! if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1; if ((channel->modes & (MODE_INVITEONLY|MODE_KEY|MODE_SECRET)) && !uData && !IsService(user) && !GetUserMode(channel, user)) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_REQUIRES_JOINABLE, channel->name); return 0; } --- 487,511 ---- } if (flags & MODCMD_REQUIRE_CHANUSER) { ! if (!uData_checked) ! uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1; if (!uData) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_NO_CHANNEL_ACCESS, channel->name); return 0; } else if (uData->access < cmd->min_channel_access) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_LOW_CHANNEL_ACCESS, channel->name); return 0; } } if ((flags & MODCMD_REQUIRE_JOINABLE) && channel) { ! if (!uData_checked) ! uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1; if ((channel->modes & (MODE_INVITEONLY|MODE_KEY|MODE_SECRET)) && !uData && !IsService(user) && !GetUserMode(channel, user)) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_REQUIRES_JOINABLE, channel->name); return 0; } *************** *** 497,501 **** switch (opt) { case 'd': ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_TOYS_DISABLED, channel->name); return 0; case 'n': --- 515,520 ---- switch (opt) { case 'd': ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_TOYS_DISABLED, channel->name); return 0; case 'n': *************** *** 513,518 **** char pubcmd = channel->channel_info->options[optPubCmd]; int prohibit = 0; ! if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1; ! if (uData) { switch (pubcmd) { case 'p': prohibit = uData->access < ulPeon; break; --- 532,538 ---- char pubcmd = channel->channel_info->options[optPubCmd]; int prohibit = 0; ! if (!uData_checked) ! uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1; ! if (uData) switch (pubcmd) { case 'p': prohibit = uData->access < ulPeon; break; *************** *** 523,529 **** case 'n': prohibit = uData->access < ulHelper; break; } ! } else prohibit = 1; if (prohibit) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_PUBLIC_DENY, channel->name); return 0; } --- 543,551 ---- case 'n': prohibit = uData->access < ulHelper; break; } ! else ! prohibit = 1; if (prohibit) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_PUBLIC_DENY, channel->name); return 0; } *************** *** 536,545 **** rflags |= ACTION_STAFF; } else { ! if (options & SVCCMD_NOISY) send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name); return 0; } } if ((flags & MODCMD_REQUIRE_HELPING) && !HANDLE_FLAGGED(user->handle_info, HELPING)) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MCMSG_MUST_BE_HELPING); return 0; } --- 558,569 ---- rflags |= ACTION_STAFF; } else { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name); return 0; } } if ((flags & MODCMD_REQUIRE_HELPING) && !HANDLE_FLAGGED(user->handle_info, HELPING)) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MCMSG_MUST_BE_HELPING); return 0; } *************** *** 550,554 **** if (cmd->req_account_flags || cmd->deny_account_flags) { if (!user->handle_info) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MSG_AUTHENTICATE); return 0; } --- 574,579 ---- if (cmd->req_account_flags || cmd->deny_account_flags) { if (!user->handle_info) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MSG_AUTHENTICATE); return 0; } *************** *** 556,565 **** if ((cmd->req_account_flags & ~user->handle_info->flags) || (cmd->deny_account_flags & user->handle_info->flags)) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name); return 0; } } if ((options & SVCCMD_DEBIT) && !policer_conforms(&user->command_policer, now, cmd->weight)) { ! if (options & SVCCMD_NOISY) send_message(user, bot, MSG_COMMAND_FLOOD); return 0; } --- 581,592 ---- if ((cmd->req_account_flags & ~user->handle_info->flags) || (cmd->deny_account_flags & user->handle_info->flags)) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name); return 0; } } if ((options & SVCCMD_DEBIT) && !policer_conforms(&user->command_policer, now, cmd->weight)) { ! if (options & SVCCMD_NOISY) ! send_message(user, bot, MSG_COMMAND_FLOOD); return 0; } *************** *** 610,621 **** return 0; } ! if(ubound >= old_argc) { ubound = old_argc - 1; ! } ! if(lbound < old_argc) { ! for (jj = lbound; jj <= ubound; ) { new_argv[new_argc++] = old_argv[jj++]; - } - } } else { log_module(MAIN_LOG, LOG_ERROR, "Alias expansion: I do not know how to handle %s (%s.%s arg %d).", arg, cmd->parent->bot->nick, cmd->name, ii); --- 637,645 ---- return 0; } ! if (ubound >= old_argc) ubound = old_argc - 1; ! if (lbound < old_argc) ! for (jj = lbound; jj <= ubound; ) new_argv[new_argc++] = old_argv[jj++]; } else { log_module(MAIN_LOG, LOG_ERROR, "Alias expansion: I do not know how to handle %s (%s.%s arg %d).", arg, cmd->parent->bot->nick, cmd->name, ii); *************** *** 767,777 **** unsigned int ii; struct module *module; ! if (!topic) topic = "<index>"; for (ii = 0; ii < service->modules.used; ++ii) { module = service->modules.list[ii]; ! if (!module->helpfile) continue; ! if (dict_find(module->helpfile->db, topic, NULL)) { return send_help(user, service->bot, module->helpfile, topic); - } } send_message(user, service->bot, MSG_TOPIC_UNKNOWN); --- 791,802 ---- unsigned int ii; struct module *module; ! if (!topic) ! topic = "<index>"; for (ii = 0; ii < service->modules.used; ++ii) { module = service->modules.list[ii]; ! if (!module->helpfile) ! continue; ! if (dict_find(module->helpfile->db, topic, NULL)) return send_help(user, service->bot, module->helpfile, topic); } send_message(user, service->bot, MSG_TOPIC_UNKNOWN); *************** *** 785,791 **** unsigned char *argv[MAXNUMPARAMS]; ! if (!*text) { return 0; - } if (service->privileged) { if (!IsOper(user)) { --- 810,815 ---- unsigned char *argv[MAXNUMPARAMS]; ! if (!*text) return 0; if (service->privileged) { if (!IsOper(user)) { *************** *** 907,918 **** strtoul(argv[arg]+1, &end_num, 10); switch (end_num[0]) { ! case 0: continue; case '-': ! if (end_num[1] == 0) continue; ! else if (isdigit(end_num[1])) continue; /* else fall through to default case */ ! default: return arg; } ! } else return arg; } return arg; --- 931,947 ---- strtoul(argv[arg]+1, &end_num, 10); switch (end_num[0]) { ! case 0: ! continue; case '-': ! if (end_num[1] == 0) ! continue; ! else if (isdigit(end_num[1])) ! continue; /* else fall through to default case */ ! default: ! return arg; } ! } else ! return arg; } return arg; *************** *** 1644,1655 **** return 0; } - if (service->trigger) reg_chanmsg_func(service->trigger, NULL, NULL); if (argc < 3) { ! reply(MCMSG_REMOVED_TRIGGER, service->bot->nick); ! return 1; } - service->trigger = argv[2][0]; - reg_chanmsg_func(service->trigger, service->bot, modcmd_chanmsg); - reply(MCMSG_NEW_TRIGGER, service->bot->nick, service->trigger); return 1; } --- 1673,1689 ---- return 0; } if (argc < 3) { ! reply(MCMSG_CURRENT_TRIGGER, service->bot->nick, service->trigger); ! } else { ! if (service->trigger) ! reg_chanmsg_func(service->trigger, NULL, NULL); ! if (!irccasecmp(argv[2], "none") || !irccasecmp(argv[2], "remove")) { ! reply(MCMSG_REMOVED_TRIGGER, service->bot->nick); ! } else { ! service->trigger = argv[2][0]; ! reg_chanmsg_func(service->trigger, service->bot, modcmd_chanmsg); ! reply(MCMSG_NEW_TRIGGER, service->bot->nick, service->trigger); ! } } return 1; } *************** *** 2023,2032 **** for (ii = 0; def_binds[ii].svcname; ++ii) { sprintf(buf, "services/%s/nick", def_binds[ii].svcname); ! if (!(nick = conf_get_data(buf, RECDB_QSTRING))) continue; ! if (!(service = service_find(nick))) continue; ! if (dict_size(service->commands) > 0) continue; /* Bind the default modules for this service to it */ for (jj = 0; def_binds[ii].modnames[jj]; ++jj) { ! if (!(module = module_find(def_binds[ii].modnames[jj]))) continue; service_bind_module(service, module); } --- 2057,2070 ---- for (ii = 0; def_binds[ii].svcname; ++ii) { sprintf(buf, "services/%s/nick", def_binds[ii].svcname); ! if (!(nick = conf_get_data(buf, RECDB_QSTRING))) ! continue; ! if (!(service = service_find(nick))) ! continue; ! if (dict_size(service->commands) > 0) ! continue; /* Bind the default modules for this service to it */ for (jj = 0; def_binds[ii].modnames[jj]; ++jj) { ! if (!(module = module_find(def_binds[ii].modnames[jj]))) ! continue; service_bind_module(service, module); } *************** *** 2066,2082 **** struct module *module; ! if (!(db = parse_database("aliases.db"))) return; for (it = dict_first(db); it; it = iter_next(it)) { service = service_find(iter_key(it)); ! if (!service) continue; module = module_find(service->bot->nick); rd = iter_data(it); ! if (rd->type != RECDB_OBJECT) continue; for (it2 = dict_first(rd->d.object); it2; it2 = iter_next(it2)) { struct modcmd *command; rd2 = iter_data(it2); ! if (rd2->type != RECDB_QSTRING) continue; command = dict_find(module->commands, rd2->d.qstring, NULL); ! if (!command) continue; service_bind_modcmd(service, command, iter_key(it2)); } --- 2104,2125 ---- struct module *module; ! if (!(db = parse_database("aliases.db"))) ! return; for (it = dict_first(db); it; it = iter_next(it)) { service = service_find(iter_key(it)); ! if (!service) ! continue; module = module_find(service->bot->nick); rd = iter_data(it); ! if (rd->type != RECDB_OBJECT) ! continue; for (it2 = dict_first(rd->d.object); it2; it2 = iter_next(it2)) { struct modcmd *command; rd2 = iter_data(it2); ! if (rd2->type != RECDB_QSTRING) ! continue; command = dict_find(module->commands, rd2->d.qstring, NULL); ! if (!command) ! continue; service_bind_modcmd(service, command, iter_key(it2)); } Index: modcmd.help =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.help,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** modcmd.help 12 Jul 2003 03:48:37 -0000 1.10 --- modcmd.help 26 Sep 2003 15:27:17 -0000 1.11 *************** *** 73,74 **** --- 73,88 ---- "With a list of modules, sets the order that the service will look up non-command help entries.", "$uSee Also:$u bind, unbind"); + "service add" ("/msg $S SERVICE ADD <nick> <description>", + "Creates a new service bot.", + "$uSee Also:$u service rename, service trigger, service remove"); + "service rename" ("/msg $S SERVICE RENAME <oldnick> <newnick>", + "Renames a service bot. Currently does not support the default services.", + "$uSee Also:$u service add, service trigger, service remove"); + "service trigger" ("/msg $S SERVICE TRIGGER <nick> [remove|<trigger>]", + "Sets or clears the trigger character that the named service uses to identify in-channel messages directed at it.", + "To remove a trigger, use the word $bremove$b (or $bnone$b) as the argument. Otherwise, the first letter of the argument will be used as the new trigger.", + "If no argument is given, shows the current trigger for the service.", + "$uSee Also:$u service add, service rename, service remove"); + "service remove" ("/msg $S SERVICE REMOVE <nick> [<quit reason>]", + "Destroys a service. If a default service is named, it will be recreated when srvx restarts.", + "$uSee Also:$u service add, service rename, service trigger"); |
From: Entrope <en...@us...> - 2003-09-26 15:20:05
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv2580/src Modified Files: helpserv.help Log Message: include a command index for HelpServ bots Index: helpserv.help =================================================================== RCS file: /cvsroot/srvx/services/src/helpserv.help,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** helpserv.help 17 Feb 2003 04:55:47 -0000 1.17 --- helpserv.help 26 Sep 2003 15:19:59 -0000 1.18 *************** *** 41,44 **** --- 41,45 ---- " READHELP Re-read help file", " WRITE Write out database"); + "COMMANDS" "${index}"; "ADDTRIAL" ("$bADDTRIAL$b", *************** *** 97,101 **** "$uSee also:$u next, pickup"); "MOVE" ("$bMOVE$b", ! "/msg $O HELPSERV <bot-nick> MOVE <new-nick|#new-channel>", "Makes the HelpServ bot use a different nick or channel."); "NEXT" ("$bNEXT$b", --- 98,102 ---- "$uSee also:$u next, pickup"); "MOVE" ("$bMOVE$b", ! "/msg $O HELPSERV MOVE <bot-nick> <new-nick|#new-channel>", "Makes the HelpServ bot use a different nick or channel."); "NEXT" ("$bNEXT$b", |
From: Entrope <en...@us...> - 2003-09-26 15:18:05
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv2312/src Modified Files: helpfile.c Log Message: do not send PRIVMSG for dead users, since they will generate NOSUCHNICKs Index: helpfile.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpfile.c,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -r1.63 -r1.64 *** helpfile.c 22 Jul 2003 18:30:01 -0000 1.63 --- helpfile.c 26 Sep 2003 15:18:02 -0000 1.64 *************** *** 158,161 **** --- 158,164 ---- log_module(MAIN_LOG, LOG_ERROR, "Unable to find user with nickname %s (in vsend_message from %s).", dest, src->nick); return 0; + } else if (message_dest->dead) { + /* No point in sending to a user who is leaving. */ + return 0; } else { #ifdef WITH_PROTOCOL_P10 |
From: Entrope <en...@us...> - 2003-09-26 15:17:03
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv2120/src Modified Files: global.c hash.c helpserv.c ioset.c tools.c Log Message: formatting changes to make profiling more accurate Index: global.c =================================================================== RCS file: /cvsroot/srvx/services/src/global.c,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -r1.58 -r1.59 *** global.c 18 Aug 2003 19:36:45 -0000 1.58 --- global.c 26 Sep 2003 15:16:58 -0000 1.59 *************** *** 142,148 **** if(message->next) message->next->prev = message->prev; ! if(message->from) free(message->from); ! if(message->message) free(message->message); ! free(message); } --- 142,147 ---- if(message->next) message->next->prev = message->prev; ! free(message->from); ! free(message->message); free(message); } *************** *** 525,529 **** if(message->flags & mask) { ! if (obstreperize && !count) send_target_message(0, user->nick, global, "$b------------- MESSAGE(S) OF THE DAY --------------$b"); notice_target(user->nick, message); count++; --- 524,529 ---- if(message->flags & mask) { ! if (obstreperize && !count) ! send_target_message(0, user->nick, global, "$b------------- MESSAGE(S) OF THE DAY --------------$b"); notice_target(user->nick, message); count++; *************** *** 532,536 **** message = message->next; } ! if (obstreperize && count) send_target_message(0, user->nick, global, "$b---------- END OF MESSAGE(S) OF THE DAY ----------$b"); return count; } --- 532,537 ---- message = message->next; } ! if (obstreperize && count) ! send_target_message(0, user->nick, global, "$b---------- END OF MESSAGE(S) OF THE DAY ----------$b"); return count; } *************** *** 574,579 **** global_process_user(struct userNode *user) { ! if(IsLocal(user) || self->uplink->burst || user->uplink->burst) return 0; ! /* TODO: policers for global motd/memos may be useful. */ send_messages(user, MESSAGE_RECIPIENT_LUSERS, 1); --- 575,580 ---- global_process_user(struct userNode *user) { ! if(IsLocal(user) || self->uplink->burst || user->uplink->burst) ! return 0; send_messages(user, MESSAGE_RECIPIENT_LUSERS, 1); Index: hash.c =================================================================== RCS file: /cvsroot/srvx/services/src/hash.c,v retrieving revision 1.180 retrieving revision 1.181 diff -C2 -r1.180 -r1.181 *** hash.c 1 Sep 2003 14:44:16 -0000 1.180 --- hash.c 26 Sep 2003 15:16:58 -0000 1.181 *************** *** 171,175 **** /* don't do anything if there's no change */ old_nick = user->nick; ! if (!strncmp(new_nick, old_nick, NICKLEN)) return; /* remove old entry from clients dictionary */ --- 171,176 ---- /* don't do anything if there's no change */ old_nick = user->nick; ! if (!strncmp(new_nick, old_nick, NICKLEN)) ! return; /* remove old entry from clients dictionary */ *************** *** 189,199 **** * place because that is slightly more useful. */ ! for (nn=0; nn<ncf2_used; nn++) { ncf2_list[nn](user, old_nick); - } user->timestamp = now; ! if (IsLocal(user) && !no_announce) { irc_nick(user, old_nick); - } free(old_nick); } --- 190,198 ---- * place because that is slightly more useful. */ ! for (nn=0; nn<ncf2_used; nn++) ncf2_list[nn](user, old_nick); user->timestamp = now; ! if (IsLocal(user) && !no_announce) irc_nick(user, old_nick); free(old_nick); } *************** *** 225,232 **** P10 Protocol violation if (user->modes & FLAGS_STAMPED) here. */ ! if(account_func) ! { account_func(user, stamp); - } #ifdef WITH_PROTOCOL_P10 --- 224,229 ---- P10 Protocol violation if (user->modes & FLAGS_STAMPED) here. */ ! if (account_func) account_func(user, stamp); #ifdef WITH_PROTOCOL_P10 *************** *** 242,246 **** /* The P10 protocol says we can't stamp users who already have a stamp. */ ! if(IsStamped(user)) return; #endif --- 239,244 ---- /* The P10 protocol says we can't stamp users who already have a stamp. */ ! if (IsStamped(user)) ! return; #endif *************** *** 381,389 **** /* if it's a new or updated channel, make callbacks */ ! if (rel_age > 0) { ! for (nn=0; nn<ncf_used; nn++) { ncf_list[nn](cNode); - } - } /* go through list of bans and add each one */ --- 379,385 ---- /* if it's a new or updated channel, make callbacks */ ! if (rel_age > 0) ! for (nn=0; nn<ncf_used; nn++) ncf_list[nn](cNode); /* go through list of bans and add each one */ *************** *** 391,396 **** for (nn=0; banlist[nn];) { char *ban = banlist+nn; ! while (banlist[nn] != ' ' && banlist[nn]) nn++; ! while (banlist[nn] == ' ') banlist[nn++] = 0; AddChannelBan(1, (const char **)&ban, cNode, NULL, now, 0); } --- 387,394 ---- for (nn=0; banlist[nn];) { char *ban = banlist+nn; ! while (banlist[nn] != ' ' && banlist[nn]) ! nn++; ! while (banlist[nn] == ' ') ! banlist[nn++] = 0; AddChannelBan(1, (const char **)&ban, cNode, NULL, now, 0); } *************** *** 457,461 **** mNode = GetUserMode(channel, user); ! if (mNode) return mNode; /* already in channel */ mNode = malloc(sizeof(*mNode)); --- 455,460 ---- mNode = GetUserMode(channel, user); ! if (mNode) ! return mNode; mNode = malloc(sizeof(*mNode)); *************** *** 510,517 **** { unsigned int i; ! for (i=0; i<pf_used; i++) { ! if (pf_list[i] == handler) break; ! } ! if (i == pf_used) return; memmove(pf_list+i, pf_list+i+1, (pf_used-i-1)*sizeof(pf_list[0])); pf_used--; --- 509,517 ---- { unsigned int i; ! for (i=0; i<pf_used; i++) ! if (pf_list[i] == handler) ! break; ! if (i == pf_used) ! return; memmove(pf_list+i, pf_list+i+1, (pf_used-i-1)*sizeof(pf_list[0])); pf_used--; *************** *** 527,534 **** UnlockChannel(struct chanNode *channel) { ! if (!channel->locks) return; ! if (!--channel->locks && !channel->members.used) { DelChannel(channel); - } } --- 527,534 ---- UnlockChannel(struct chanNode *channel) { ! if (!channel->locks) ! return; ! if (!--channel->locks && !channel->members.used) DelChannel(channel); } *************** *** 548,552 **** * In this case, we get no usermode, and should not try to free it. */ ! if (!mNode) return; /* remove modeNode from channel and user */ --- 548,553 ---- * In this case, we get no usermode, and should not try to free it. */ ! if (!mNode) ! return; /* remove modeNode from channel and user */ *************** *** 555,563 **** free(mNode); ! for (n=0; n<pf_used; n++) pf_list[n](user, channel, reason); ! if (!deleting && !channel->members.used && !channel->locks) { DelChannel(channel); - } } --- 556,564 ---- free(mNode); ! for (n=0; n<pf_used; n++) ! pf_list[n](user, channel, reason); ! if (!deleting && !channel->members.used && !channel->locks) DelChannel(channel); } *************** *** 565,573 **** KickChannelUser(struct userNode* target, struct chanNode* channel, struct userNode *kicker, const char *why) { ! if (!target || !channel || IsService(target) || !GetUserMode(channel, target)) return; /* don't remove them from the channel, since the server will send a PART */ irc_kick(kicker, target, channel, why); ! if(IsLocal(target)) { /* NULL reason because we don't want a PART message to be --- 566,575 ---- KickChannelUser(struct userNode* target, struct chanNode* channel, struct userNode *kicker, const char *why) { ! if (!target || !channel || IsService(target) || !GetUserMode(channel, target)) ! return; /* don't remove them from the channel, since the server will send a PART */ irc_kick(kicker, target, channel, why); ! if (IsLocal(target)) { /* NULL reason because we don't want a PART message to be *************** *** 601,620 **** struct modeNode *mn; ! if (!victim || !channel || IsService(victim) || !GetUserMode(channel, victim)) return; /* Update the kicker's idle time (kicker may be null if it was a server) */ ! if (kicker && (mn = GetUserMode(channel, kicker))) { mn->idle_since = now; - } ! for (n=0; n<kf_used; n++) { kf_list[n](kicker, victim, channel); - } DelChannelUser(victim, channel, 0, 0); ! if (IsLocal(victim)) { irc_part(victim, channel, NULL); - } } --- 603,620 ---- struct modeNode *mn; ! if (!victim || !channel || IsService(victim) || !GetUserMode(channel, victim)) ! return; /* Update the kicker's idle time (kicker may be null if it was a server) */ ! if (kicker && (mn = GetUserMode(channel, kicker))) mn->idle_since = now; ! for (n=0; n<kf_used; n++) kf_list[n](kicker, victim, channel); DelChannelUser(victim, channel, 0, 0); ! if (IsLocal(victim)) irc_part(victim, channel, NULL); } *************** *** 710,720 **** unsigned int n; ! for(n = 0; n < channel->banlist.used; n++) ! { ! if(match_ircglobs(channel->banlist.list[n]->ban, ban)) ! { return 1; - } - } return 0; } --- 710,716 ---- unsigned int n; ! for (n = 0; n < channel->banlist.used; n++) ! if (match_ircglobs(channel->banlist.list[n]->ban, ban)) return 1; return 0; } *************** *** 729,733 **** for (n=0; n<num; n++) { ! if (channel->banlist.used >= MAXBANS) break; /* We check for bans that are a superset (or match) of an --- 725,730 ---- for (n=0; n<num; n++) { ! if (channel->banlist.used >= MAXBANS) ! break; /* We check for bans that are a superset (or match) of an *************** *** 740,744 **** for (i = 0; i < channel->banlist.used; i++) { if (match_ircglobs(banset[n], bans[i]->ban)) { ! if (!remove) remove = alloc_string_list(2); string_list_append(remove, strdup(bans[i]->ban)); } --- 737,742 ---- for (i = 0; i < channel->banlist.used; i++) { if (match_ircglobs(banset[n], bans[i]->ban)) { ! if (!remove) ! remove = alloc_string_list(2); string_list_append(remove, strdup(bans[i]->ban)); } *************** *** 761,765 **** free_string_list(remove); } ! if (announce) chan_apply_bans(who, channel, "+b", n, banset); } --- 759,764 ---- free_string_list(remove); } ! if (announce) ! chan_apply_bans(who, channel, "+b", n, banset); } *************** *** 769,773 **** unsigned int n, m; ! if (announce) chan_apply_bans(who, channel, "-b", num, banset); for (n=0; n<num; n++) { for (m=0; m<channel->banlist.used; m++) { --- 768,773 ---- unsigned int n, m; ! if (announce) ! chan_apply_bans(who, channel, "-b", num, banset); for (n=0; n<num; n++) { for (m=0; m<channel->banlist.used; m++) { *************** *** 790,796 **** /* We need to announce before we op people so that we use the * right source numeric if a service is op'ing itself. */ ! if (announce) chan_apply_mode(who, channel, "+o", num, newops); for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, newops[n]))) continue; mn->modes |= MODE_CHANOP; } --- 790,798 ---- /* We need to announce before we op people so that we use the * right source numeric if a service is op'ing itself. */ ! if (announce) ! chan_apply_mode(who, channel, "+o", num, newops); for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, newops[n]))) ! continue; mn->modes |= MODE_CHANOP; } *************** *** 805,811 **** /* We need to announce before we deop people so that we use the * right source numeric if a service is deop'ing itself. */ ! if (announce) chan_apply_mode(who, channel, "-o", num, exops); for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, exops[n]))) continue; mn->modes &= ~MODE_CHANOP; } --- 807,815 ---- /* We need to announce before we deop people so that we use the * right source numeric if a service is deop'ing itself. */ ! if (announce) ! chan_apply_mode(who, channel, "-o", num, exops); for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, exops[n]))) ! continue; mn->modes &= ~MODE_CHANOP; } *************** *** 819,826 **** for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, newv[n]))) continue; mn->modes |= MODE_VOICE; } ! if (announce) chan_apply_mode(who, channel, "+v", num, newv); } --- 823,832 ---- for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, newv[n]))) ! continue; mn->modes |= MODE_VOICE; } ! if (announce) ! chan_apply_mode(who, channel, "+v", num, newv); } *************** *** 832,839 **** for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, exv[n]))) continue; mn->modes &= ~MODE_VOICE; } ! if (announce) chan_apply_mode(who, channel, "-v", num, exv); } --- 838,847 ---- for (n=0; n<num; n++) { ! if (!(mn = GetUserMode(channel, exv[n]))) ! continue; mn->modes &= ~MODE_VOICE; } ! if (announce) ! chan_apply_mode(who, channel, "-v", num, exv); } *************** *** 871,877 **** /* Update the setter's idle time */ ! if ((mn = GetUserMode(channel, user))) { mn->idle_since = now; - } } --- 879,884 ---- /* Update the setter's idle time */ ! if ((mn = GetUserMode(channel, user))) mn->idle_since = now; } *************** *** 881,889 **** irc_topic(user, channel, topic); } else { ! for (n=0; n<tf_used; n++) { ! if (tf_list[n](user, channel, old_topic)) { break; - } - } } } --- 888,894 ---- irc_topic(user, channel, topic); } else { ! for (n=0; n<tf_used; n++) ! if (tf_list[n](user, channel, old_topic)) break; } } Index: helpserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpserv.c,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -r1.81 -r1.82 *** helpserv.c 10 Sep 2003 12:23:41 -0000 1.81 --- helpserv.c 26 Sep 2003 15:16:58 -0000 1.82 *************** *** 577,581 **** enum helpserv_level nn; for (nn=HlNone; nn<=HlOper; nn++) { ! if (!irccasecmp(msg, helpserv_level_names[nn])) return nn; } log_module(HS_LOG, LOG_ERROR, "helpserv_str2level received invalid level %s.", msg); --- 577,582 ---- enum helpserv_level nn; for (nn=HlNone; nn<=HlOper; nn++) { ! if (!irccasecmp(msg, helpserv_level_names[nn])) ! return nn; [...1668 lines suppressed...] ! helpserv_notify(req->helper, HSMSG_NOTIFY_REQ_DROP, req->id, "*", req->handle->handle, "their account has been unregistered and no online users were authenticated to it"); sprintf(buf, "%lu", req->id); *************** *** 4094,4099 **** dict_delete(helpserv_users_byhand_dict); ! if (reqlog_ctx) saxdb_close_context(reqlog_ctx); ! if (reqlog_f) fclose(reqlog_f); } --- 4156,4163 ---- dict_delete(helpserv_users_byhand_dict); ! if (reqlog_ctx) ! saxdb_close_context(reqlog_ctx); ! if (reqlog_f) ! fclose(reqlog_f); } Index: ioset.c =================================================================== RCS file: /cvsroot/srvx/services/src/ioset.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** ioset.c 1 Sep 2003 14:45:07 -0000 1.17 --- ioset.c 26 Sep 2003 15:16:58 -0000 1.18 *************** *** 86,90 **** int get_avail = ioq_get_avail(ioq); memcpy(new_buf, ioq->buf + ioq->get, get_avail); ! if (ioq->put < ioq->get) memcpy(new_buf + get_avail, ioq->buf, ioq->put); free(ioq->buf); ioq->put = ioq_used(ioq); --- 86,91 ---- int get_avail = ioq_get_avail(ioq); memcpy(new_buf, ioq->buf + ioq->get, get_avail); ! if (ioq->put < ioq->get) ! memcpy(new_buf + get_avail, ioq->buf, ioq->put); free(ioq->buf); ioq->put = ioq_used(ioq); *************** *** 110,114 **** } res = calloc(1, sizeof(*res)); ! if (!res) return 0; res->fd = fd; ioq_init(&res->send, 1024); --- 111,116 ---- } res = calloc(1, sizeof(*res)); ! if (!res) ! return 0; res->fd = fd; ioq_init(&res->send, 1024); *************** *** 180,184 **** } } ! if (connect_cb) connect_cb(io_fd, ((res < 0) ? errno : 0)); return io_fd; } --- 182,187 ---- } } ! if (connect_cb) ! connect_cb(io_fd, ((res < 0) ? errno : 0)); return io_fd; } *************** *** 326,332 **** gettimeofday(&now, NULL); if (select_timeout) { ! log_module(DEBUG_LOG, LOG_INFO, "%s, at %u.%06u:%s (timeout %u.%06u)", msg, now.tv_sec, now.tv_usec, buf, select_timeout->tv_sec, select_timeout->tv_usec); } else { ! log_module(DEBUG_LOG, LOG_INFO, "%s, at %u.%06u:%s (no timeout)", msg, now.tv_sec, now.tv_usec, buf); } } --- 329,335 ---- gettimeofday(&now, NULL); if (select_timeout) { ! log_module(MAIN_LOG, LOG_DEBUG, "%s, at "FMT_TIME_T".%06ld:%s (timeout "FMT_TIME_T".%06ld)", msg, now.tv_sec, now.tv_usec, buf, select_timeout->tv_sec, select_timeout->tv_usec); } else { ! log_module(MAIN_LOG, LOG_DEBUG, "%s, at "FMT_TIME_T".%06ld:%s (no timeout)", msg, now.tv_sec, now.tv_usec, buf); } } Index: tools.c =================================================================== RCS file: /cvsroot/srvx/services/src/tools.c,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -r1.126 -r1.127 *** tools.c 18 Aug 2003 19:36:47 -0000 1.126 --- tools.c 26 Sep 2003 15:16:58 -0000 1.127 *************** *** 84,88 **** int irccasecmp(const unsigned char *stra, const unsigned char *strb) { ! while (*stra && (irc_tolower[*stra] == irc_tolower[*strb])) stra++, strb++; return irc_tolower[*stra] - irc_tolower[*strb]; } --- 84,89 ---- int irccasecmp(const unsigned char *stra, const unsigned char *strb) { ! while (*stra && (irc_tolower[*stra] == irc_tolower[*strb])) ! stra++, strb++; return irc_tolower[*stra] - irc_tolower[*strb]; } *************** *** 91,95 **** ircncasecmp(const unsigned char *stra, const unsigned char *strb, unsigned int len) { len--; ! while (*stra && (irc_tolower[*stra] == irc_tolower[*strb]) && len) stra++, strb++, len--; return irc_tolower[*stra] - irc_tolower[*strb]; } --- 92,97 ---- ircncasecmp(const unsigned char *stra, const unsigned char *strb, unsigned int len) { len--; ! while (*stra && (irc_tolower[*stra] == irc_tolower[*strb]) && len) ! stra++, strb++, len--; return irc_tolower[*stra] - irc_tolower[*strb]; } *************** *** 98,105 **** irccasestr(const unsigned char *haystack, const unsigned char *needle) { unsigned int hay_len = strlen(haystack), needle_len = strlen(needle), pos; ! if (hay_len < needle_len) return NULL; for (pos=0; pos<hay_len+1-needle_len; ++pos) { if ((irc_tolower[haystack[pos]] == irc_tolower[*needle]) ! && !ircncasecmp(haystack+pos, needle, needle_len)) return haystack+pos; } return NULL; --- 100,109 ---- irccasestr(const unsigned char *haystack, const unsigned char *needle) { unsigned int hay_len = strlen(haystack), needle_len = strlen(needle), pos; ! if (hay_len < needle_len) ! return NULL; for (pos=0; pos<hay_len+1-needle_len; ++pos) { if ((irc_tolower[haystack[pos]] == irc_tolower[*needle]) ! && !ircncasecmp(haystack+pos, needle, needle_len)) ! return haystack+pos; } return NULL; *************** *** 118,124 **** break; } ! if (!*line) break; argv[argc++] = line; ! if (argc >= argv_size) break; while (*line != ' ' && *line) line++; } --- 122,130 ---- break; } ! if (!*line) ! break; argv[argc++] = line; ! if (argc >= argv_size) ! break; while (*line != ' ' && *line) line++; } |
From: Entrope <en...@us...> - 2003-09-26 15:14:02
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv32608/src Modified Files: gline.c Log Message: formatting changes to make profiling more accurate Index: gline.c =================================================================== RCS file: /cvsroot/srvx/services/src/gline.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** gline.c 22 Jul 2003 16:33:44 -0000 1.35 --- gline.c 26 Sep 2003 15:13:59 -0000 1.36 *************** *** 87,91 **** heap_peek(gline_heap, 0, &wraa); stopped = ((struct gline*)wraa)->expires; ! if (stopped > now) break; heap_pop(gline_heap); free_gline(wraa); --- 87,92 ---- heap_peek(gline_heap, 0, &wraa); stopped = ((struct gline*)wraa)->expires; ! if (stopped > now) ! break; heap_pop(gline_heap); free_gline(wraa); *************** *** 116,120 **** announce = 1; #endif ! if (announce) irc_ungline(target); return res; } --- 117,122 ---- announce = 1; #endif ! if (announce) ! irc_ungline(target); return res; } *************** *** 132,136 **** 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)); --- 134,139 ---- 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)); *************** *** 147,151 **** timeq_add(ent->expires, gline_expire, 0); } ! if (announce) irc_gline(NULL, ent); return ent; } --- 150,155 ---- timeq_add(ent->expires, gline_expire, 0); } ! if (announce) ! irc_gline(NULL, ent); return ent; } *************** *** 201,205 **** issuer = "<unknown>"; } ! if (expiration > now) gline_add(issuer, key, expiration - now, reason, issued, 0); return 0; } --- 205,210 ---- issuer = "<unknown>"; } ! if (expiration > now) ! gline_add(issuer, key, expiration - now, reason, issued, 0); return 0; } |
From: Entrope <en...@us...> - 2003-09-26 15:13:54
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv32572/src Modified Files: chanserv.c Log Message: formatting changes to make profiling more accurate get rid of constant "arg" variable in cmd_note Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.380 retrieving revision 1.381 diff -C2 -r1.380 -r1.381 *** chanserv.c 9 Sep 2003 16:40:28 -0000 1.380 --- chanserv.c 26 Sep 2003 15:13:47 -0000 1.381 *************** *** 594,598 **** struct userData *uData, **head; ! if(!channel || !handle) return NULL; if(override && HANDLE_FLAGGED(handle, HELPING) --- 594,599 ---- struct userData *uData, **head; ! if(!channel || !handle) ! return NULL; if(override && HANDLE_FLAGGED(handle, HELPING) *************** *** 616,622 **** uData->next = helperList; if(helperList) - { helperList->prev = uData; - } helperList = uData; } --- 617,621 ---- *************** *** 627,633 **** { for(uData = channel->users; uData; uData = uData->next) ! { ! if((uData->handle == handle) && (allow_suspended || !IsUserSuspended(uData))) break; ! } head = &(channel->users); --- 626,631 ---- { for(uData = channel->users; uData; uData = uData->next) ! if((uData->handle == handle) && (allow_suspended || !IsUserSuspended(uData))) ! break; head = &(channel->users); *************** *** 637,642 **** { /* Shuffle the user to the head of whatever list he was in. */ ! if(uData->next) uData->next->prev = uData->prev; ! if(uData->prev) uData->prev->next = uData->next; uData->prev = NULL; --- 635,642 ---- { /* Shuffle the user to the head of whatever list he was in. */ ! if(uData->next) ! uData->next->prev = uData->prev; ! if(uData->prev) ! uData->prev->next = uData->next; uData->prev = NULL; *************** *** 644,650 **** if(*head) - { (**head).prev = uData; - } *head = uData; } --- 644,648 ---- *************** *** 684,688 **** struct userData *uData; ! if(!channel->channel_info || IsSuspended(channel->channel_info)) return; uData = GetTrueChannelAccess(channel->channel_info, handle); --- 682,687 ---- struct userData *uData; ! if(!channel->channel_info || IsSuspended(channel->channel_info)) ! return; uData = GetTrueChannelAccess(channel->channel_info, handle); *************** *** 713,720 **** /* Bail early if channel is inactive or doesn't restrict CTCPs, or sender is a service */ ! if(!channel->channel_info || IsSuspended(channel->channel_info)) return; ! if(channel->channel_info->options[optCTCPUsers] == 'a') return; ! if(IsService(user)) return; ! if(!ircncasecmp(text, "ACTION ", 7)) return; /* Figure out the minimum level needed to CTCP the channel */ switch(channel->channel_info->options[optCTCPUsers]) { --- 712,721 ---- /* Bail early if channel is inactive or doesn't restrict CTCPs, or sender is a service */ ! if(!channel->channel_info ! || IsSuspended(channel->channel_info) ! || (channel->channel_info->options[optCTCPUsers] == 'a') ! || IsService(user) ! || !ircncasecmp(text, "ACTION ", 7)) ! return; /* Figure out the minimum level needed to CTCP the channel */ switch(channel->channel_info->options[optCTCPUsers]) { *************** *** 728,732 **** /* Exit if they're allowed to CTCP the channel. */ uData = GetChannelUser(channel->channel_info, user->handle_info); ! if(uData && (uData->access >= minlvl)) return; /* We need to enforce against them; do so. */ eflags = 0; --- 729,734 ---- /* Exit if they're allowed to CTCP the channel. */ uData = GetChannelUser(channel->channel_info, user->handle_info); ! if(uData && (uData->access >= minlvl)) ! return; /* We need to enforce against them; do so. */ eflags = 0; *************** *** 734,738 **** argv[1] = user->nick; argc = 2; ! if(GetUserMode(channel, user)) eflags |= ACTION_KICK; switch(channel->channel_info->options[optCTCPReaction]) { default: case 'k': /* just do the kick */ break; --- 736,741 ---- argv[1] = user->nick; argc = 2; ! if(GetUserMode(channel, user)) ! eflags |= ACTION_KICK; switch(channel->channel_info->options[optCTCPReaction]) { default: case 'k': /* just do the kick */ break; *************** *** 768,774 **** struct note_type *ntype = data; ! if(--ntype->refs > 0) { return; - } free(ntype); } --- 771,776 ---- struct note_type *ntype = data; ! if(--ntype->refs > 0) return; free(ntype); } *************** *** 778,784 **** { struct chanData *cData; ! for (cData = channelList; cData; cData = cData->next) { dict_remove(cData->notes, ntype->name); - } } --- 780,785 ---- { struct chanData *cData; ! for (cData = channelList; cData; cData = cData->next) dict_remove(cData->notes, ntype->name); } *************** *** 792,798 **** for (cData = channelList; cData; cData = cData->next) { note = dict_find(cData->notes, ntype->name, NULL); ! if (!note) { continue; - } if (strlen(note->note) > ntype->max_length) { dict_remove2(cData->notes, ntype->name, 1); --- 793,798 ---- for (cData = channelList; cData; cData = cData->next) { note = dict_find(cData->notes, ntype->name, NULL); ! if (!note) continue; if (strlen(note->note) > ntype->max_length) { dict_remove2(cData->notes, ntype->name, 1); *************** *** 1317,1321 **** struct banData *bd; ! if(!mask) return NULL; bd = malloc(sizeof(struct banData)); --- 1317,1322 ---- struct banData *bd; ! if(!mask) ! return NULL; bd = malloc(sizeof(struct banData)); *************** *** 1327,1331 **** safestrncpy(bd->mask, mask, sizeof(bd->mask)); ! if(owner) safestrncpy(bd->owner, owner, sizeof(bd->owner)); bd->reason = reason ? strdup(reason) : NULL; --- 1328,1333 ---- safestrncpy(bd->mask, mask, sizeof(bd->mask)); ! if(owner) ! safestrncpy(bd->owner, owner, sizeof(bd->owner)); bd->reason = reason ? strdup(reason) : NULL; *************** *** 1516,1528 **** /* See if the channel can be expired. */ ! if((now - channel->visited) <= chanserv_conf.channel_expire_delay) continue; ! if(IsProtected(channel)) continue; /* Make sure there are no high-ranking users still in the channel. */ for(user=channel->users; user; user=user->next) ! { ! if(user->present && (user->access >= ulMaster)) break; ! } ! if(user) continue; /* Unregister the channel */ --- 1518,1531 ---- /* See if the channel can be expired. */ ! if(((now - channel->visited) <= chanserv_conf.channel_expire_delay) ! || IsProtected(channel)) ! continue; /* Make sure there are no high-ranking users still in the channel. */ for(user=channel->users; user; user=user->next) ! if(user->present && (user->access >= ulMaster)) ! break; ! if(user) ! continue; /* Unregister the channel */ *************** *** 1576,1584 **** { case 'l': ! if(cs_victim->access > cs_aggressor->access) return 1; break; case 'a': case 'e': ! if(cs_victim->access >= cs_aggressor->access) return 1; break; } --- 1579,1589 ---- { case 'l': ! if(cs_victim->access > cs_aggressor->access) ! return 1; break; case 'a': case 'e': ! if(cs_victim->access >= cs_aggressor->access) ! return 1; break; } *************** *** 1593,1598 **** if((cs_victim = GetChannelUser(channel->channel_info, victim->handle_info)) ! && (cs_victim->access >= ulOp)) return 1; ! if(!check_user_level(user, channel, channel->channel_info->options[optStrictOp], 1, 0)) { chanserv_notice(user, CSMSG_OPBY_LOCKED); --- 1598,1603 ---- if((cs_victim = GetChannelUser(channel->channel_info, victim->handle_info)) ! && (cs_victim->access >= ulOp) ! && !check_user_level(user, channel, channel->channel_info->options[optStrictOp], 1, 0)) { chanserv_notice(user, CSMSG_OPBY_LOCKED); *************** *** 1608,1612 **** struct userData *uData; ! if(!check_user_level(user, channel, channel->channel_info->options[optAutoOp], 0, 0)) return 0; uData = GetChannelAccess(channel->channel_info, user->handle_info); /* uData may be NULL if optAutoOp is "all" */ --- 1613,1618 ---- struct userData *uData; ! if(!check_user_level(user, channel, channel->channel_info->options[optAutoOp], 0, 0)) ! return 0; uData = GetChannelAccess(channel->channel_info, user->handle_info); /* uData may be NULL if optAutoOp is "all" */ *************** *** 1664,1675 **** if(handle) { ! if((dnr = dict_find(handle_dnrs, handle->handle, NULL))) return dnr; } if(chan_name) { ! if((dnr = dict_find(plain_dnrs, chan_name, NULL))) return dnr; for(it = dict_first(mask_dnrs); it; it = iter_next(it)) { ! if(match_ircglob(chan_name, iter_key(it))) return iter_data(it); } } --- 1670,1684 ---- if(handle) { ! if((dnr = dict_find(handle_dnrs, handle->handle, NULL))) ! return dnr; } if(chan_name) { ! if((dnr = dict_find(plain_dnrs, chan_name, NULL))) ! return dnr; for(it = dict_first(mask_dnrs); it; it = iter_next(it)) { ! if(match_ircglob(chan_name, iter_key(it))) ! return iter_data(it); } } *************** *** 1800,1804 **** for(owned=0, cList=hi->channels; cList; cList=cList->u_next) { ! if(cList->access == ulOwner) owned++; } return owned; --- 1809,1814 ---- for(owned=0, cList=hi->channels; cList; cList=cList->u_next) { ! if(cList->access == ulOwner) ! owned++; } return owned; *************** *** 2674,2678 **** } ! if(!strcmp(argv[1], "bans")) { cmd_trim_bans(user, channel, duration); --- 2684,2688 ---- } ! if(!irccasecmp(argv[1], "bans")) { cmd_trim_bans(user, channel, duration); *************** *** 2680,2684 **** } ! if(!strcmp(argv[1], "users")) { cmd_trim_users(user, channel, ulNone, duration); --- 2690,2694 ---- } ! if(!irccasecmp(argv[1], "users")) { cmd_trim_users(user, channel, ulNone, duration); *************** *** 4518,4523 **** { case NOTE_SET_CHANNEL_ACCESS: ! if(!user->handle_info) return 0; ! if(!(uData = GetChannelUser(channel->channel_info, user->handle_info))) return 0; return uData->access >= ntype->set_access.min_ulevel; case NOTE_SET_CHANNEL_SETTER: --- 4528,4535 ---- { case NOTE_SET_CHANNEL_ACCESS: ! if(!user->handle_info) ! return 0; ! if(!(uData = GetChannelUser(channel->channel_info, user->handle_info))) ! return 0; return uData->access >= ntype->set_access.min_ulevel; case NOTE_SET_CHANNEL_SETTER: *************** *** 4532,4536 **** struct note *note; struct note_type *ntype; - unsigned int arg = 1; cData = channel->channel_info; --- 4544,4547 ---- *************** *** 4542,4546 **** /* If no arguments, show all visible notes for the channel. */ ! if(argc <= arg) { dict_iterator_t it; --- 4553,4557 ---- /* If no arguments, show all visible notes for the channel. */ ! if(argc < 2) { dict_iterator_t it; *************** *** 4550,4569 **** { note = iter_data(it); ! if(!note_type_visible_to_user(cData, note->type, user)) continue; ! if(!count++) chanserv_notice(user, CSMSG_NOTELIST_HEADER, channel->name); chanserv_notice(user, CSMSG_NOTE_FORMAT, iter_key(it), note->setter, note->note); } ! if(count) chanserv_notice(user, CSMSG_NOTELIST_END, channel->name); ! else chanserv_notice(user, CSMSG_NOTELIST_EMPTY, channel->name); } /* If one argument, show the named note. */ ! else if(argc == arg+1) { ! if((note = dict_find(cData->notes, argv[arg], NULL)) && note_type_visible_to_user(cData, note->type, user)) { chanserv_notice(user, CSMSG_NOTE_FORMAT, note->type->name, note->setter, note->note); } ! else if((ntype = dict_find(note_types, argv[arg], NULL)) && note_type_visible_to_user(NULL, ntype, user)) { --- 4561,4584 ---- { note = iter_data(it); ! if(!note_type_visible_to_user(cData, note->type, user)) ! continue; ! if(!count++) ! chanserv_notice(user, CSMSG_NOTELIST_HEADER, channel->name); chanserv_notice(user, CSMSG_NOTE_FORMAT, iter_key(it), note->setter, note->note); } ! if(count) ! chanserv_notice(user, CSMSG_NOTELIST_END, channel->name); ! else ! chanserv_notice(user, CSMSG_NOTELIST_EMPTY, channel->name); } /* If one argument, show the named note. */ ! else if(argc == 2) { ! if((note = dict_find(cData->notes, argv[1], NULL)) && note_type_visible_to_user(cData, note->type, user)) { chanserv_notice(user, CSMSG_NOTE_FORMAT, note->type->name, note->setter, note->note); } ! else if((ntype = dict_find(note_types, argv[1], NULL)) && note_type_visible_to_user(NULL, ntype, user)) { *************** *** 4573,4577 **** else { ! chanserv_notice(user, CSMSG_BAD_NOTE_TYPE, argv[arg]); return 0; } --- 4588,4592 ---- else { ! chanserv_notice(user, CSMSG_BAD_NOTE_TYPE, argv[1]); return 0; } *************** *** 4581,4593 **** { char *note_text; ! ntype = dict_find(note_types, argv[arg], NULL); if(!ntype) { ! chanserv_notice(user, CSMSG_BAD_NOTE_TYPE, argv[arg]); return 0; } else if(note_type_settable_by_user(channel, ntype, user)) { ! note_text = unsplit_string(argv+arg+1, argc-arg-1, NULL); chanserv_add_channel_note(cData, ntype, user->handle_info->handle, note_text); chanserv_notice(user, CSMSG_NOTE_SET, ntype->name, channel->name); --- 4596,4608 ---- { char *note_text; ! ntype = dict_find(note_types, argv[1], NULL); if(!ntype) { ! chanserv_notice(user, CSMSG_BAD_NOTE_TYPE, argv[1]); return 0; } else if(note_type_settable_by_user(channel, ntype, user)) { ! note_text = unsplit_string(argv+2, argc-2, NULL); chanserv_add_channel_note(cData, ntype, user->handle_info->handle, note_text); chanserv_notice(user, CSMSG_NOTE_SET, ntype->name, channel->name); |
From: Entrope <en...@us...> - 2003-09-10 12:23:50
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv13966/src Modified Files: helpserv.c Log Message: do not crash when we receive a privmsg from a local user Index: helpserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpserv.c,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -r1.80 -r1.81 *** helpserv.c 9 Sep 2003 16:40:29 -0000 1.80 --- helpserv.c 10 Sep 2003 12:23:41 -0000 1.81 *************** *** 932,937 **** const int from_opserv = 0; /* for helpserv_notice */ ! /* Ignore things consisting of empty lines */ ! if (!*text) return; hs = dict_find(helpserv_bots_dict, target->nick, NULL); --- 932,938 ---- const int from_opserv = 0; /* for helpserv_notice */ ! /* Ignore things consisting of empty lines or from ourselves */ ! if (!*text || IsLocal(user)) ! return; hs = dict_find(helpserv_bots_dict, target->nick, NULL); |
From: Entrope <en...@us...> - 2003-09-09 16:40:35
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv24777/src Modified Files: chanserv.c helpserv.c messages.h mod-memoserv.c nickserv.c nickserv.h Log Message: convert handle_info->handle from char[] to char* slightly related code reorganization to improve coverage testing Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.379 retrieving revision 1.380 diff -C2 -r1.379 -r1.380 *** chanserv.c 22 Aug 2003 04:07:51 -0000 1.379 --- chanserv.c 9 Sep 2003 16:40:28 -0000 1.380 *************** *** 841,845 **** struct note_type *ntype; unsigned int arg = 1, existed = 0, max_length; - extern char *accessNames[]; if ((ntype = dict_find(note_types, argv[1], NULL))) { --- 841,844 ---- *************** *** 853,866 **** ntype->set_access.min_opserv = strtoul(argv[arg], NULL, 0); } else if (!irccasecmp(argv[arg], "channel")) { ! enum userLevel ulvl; ! arg++; ! ntype->set_access_type = NOTE_SET_CHANNEL_ACCESS; ! for (ulvl = ulPeon; ulvl < ulHelper; ulvl++) { ! if (!(irccasecmp(argv[arg], accessNames[ulvl]))) break; ! } ! if (ulvl == ulHelper) { send_message(user, cmd->parent->bot, CSMSG_INVALID_ACCESS, argv[arg]); goto fail; } ntype->set_access.min_ulevel = ulvl; } else if (!irccasecmp(argv[arg], "setter")) { --- 852,861 ---- ntype->set_access.min_opserv = strtoul(argv[arg], NULL, 0); } else if (!irccasecmp(argv[arg], "channel")) { ! enum userLevel ulvl = user_level_from_name(argv[++arg]); ! if (ulvl == ulNone) { send_message(user, cmd->parent->bot, CSMSG_INVALID_ACCESS, argv[arg]); goto fail; } + ntype->set_access_type = NOTE_SET_CHANNEL_ACCESS; ntype->set_access.min_ulevel = ulvl; } else if (!irccasecmp(argv[arg], "setter")) { *************** *** 1111,1115 **** off = channel->channel_info->mode_off; ! if((on & (channel->modes ^ on)) || (channel->modes & off)) { return 1; --- 1106,1110 ---- off = channel->channel_info->mode_off; ! if((on & ~channel->modes) || (channel->modes & off)) { return 1; *************** *** 1356,1368 **** del_channel_ban(struct banData *ban) { - if(!ban) return; - ban->channel->banCount--; banCount--; ! if(ban->prev) ban->prev->next = ban->next; ! else ban->channel->bans = ban->next; ! if(ban->next) ban->next->prev = ban->prev; if(ban->expires) --- 1351,1370 ---- del_channel_ban(struct banData *ban) { ban->channel->banCount--; banCount--; ! if(ban->prev) ! { ! ban->prev->next = ban->next; ! } ! else ! { ! ban->channel->bans = ban->next; ! } ! if(ban->next) ! { ! ban->next->prev = ban->prev; ! } if(ban->expires) *************** *** 1371,1375 **** } ! if(ban->reason) free(ban->reason); free(ban); --- 1373,1380 ---- } ! if(ban->reason) ! { ! free(ban->reason); ! } free(ban); *************** *** 1393,1397 **** bd->expires = 0; del_channel_ban(bd); - return; } --- 1398,1401 ---- *************** *** 1487,1491 **** if(channel->notes) dict_delete(channel->notes); sprintf(msgbuf, "%s %s", channel->channel->name, reason); ! if(!IsSuspended(channel)) DelChannelUser(chanserv, channel->channel, msgbuf, 0); global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, msgbuf); free(channel); --- 1491,1498 ---- if(channel->notes) dict_delete(channel->notes); sprintf(msgbuf, "%s %s", channel->channel->name, reason); ! if(!IsSuspended(channel)) ! { ! DelChannelUser(chanserv, channel->channel, msgbuf, 0); ! } global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, msgbuf); free(channel); *************** *** 1760,1781 **** static CHANSERV_FUNC(cmd_allowregister) { ! const char *chan_name = NULL; ! int arg = 1; - if(argc > 1) - { - chan_name = argv[1]; - arg = 2; - } - else if(channel) - { - chan_name = channel->name; - } - if(!chan_name) - { - chanserv_notice(user, MSG_MISSING_PARAMS, argv[0]); - CHANSERV_SYNTAX(); - return 0; - } if((chan_name[0] == '*') && dict_find(handle_dnrs, chan_name+1, NULL)) { --- 1767,1772 ---- static CHANSERV_FUNC(cmd_allowregister) { ! const char *chan_name = argv[1]; if((chan_name[0] == '*') && dict_find(handle_dnrs, chan_name+1, NULL)) { *************** *** 2012,2016 **** struct modeNode *mn; struct userData *uData; - int new_channel = 0, force = 0; char reason[MAXLEN]; struct do_not_register *dnr; --- 2003,2006 ---- *************** *** 2024,2077 **** } ! force = (argc > 2) && !irccasecmp(argv[2], "force") && IsHelping(user); ! if((target = GetChannel(argv[1]))) { ! ! if(!force && (dnr = chanserv_is_dnr(target->name, NULL))) ! { ! if(IsHelping(user)) ! { ! chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason); ! } ! else ! { ! chanserv_notice(user, CSMSG_DNR_CHANNEL_MOVE, argv[1]); ! } ! return 0; ! } } - else - { - if(!IsCSChannelName(argv[1])) - { - chanserv_notice(user, MSG_NOT_CHANNEL_NAME); - return 0; - } ! if(opserv_bad_channel(argv[1])) ! { ! chanserv_notice(user, CSMSG_ILLEGAL_CHANNEL, argv[1]); ! return 0; ! } ! if (!force) { ! for(uData = channel->channel_info->users; uData; uData = uData->next) ! { ! if((uData->access == ulOwner) && (dnr = chanserv_is_dnr(NULL, uData->handle))) ! { ! if(IsHelping(user)) ! { ! chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason); ! } ! else ! { ! chanserv_notice(user, CSMSG_DNR_CHANNEL_MOVE, argv[1]); ! } ! return 0; ! } ! } ! ! if((dnr = chanserv_is_dnr(argv[1], NULL))) { if(IsHelping(user)) --- 2014,2034 ---- } ! if(!IsCSChannelName(argv[1])) { ! chanserv_notice(user, MSG_NOT_CHANNEL_NAME); ! return 0; } ! if(opserv_bad_channel(argv[1])) ! { ! chanserv_notice(user, CSMSG_ILLEGAL_CHANNEL, argv[1]); ! return 0; ! } ! if (!IsHelping(user) || (argc < 3) || irccasecmp(argv[2], "force")) ! { ! for(uData = channel->channel_info->users; uData; uData = uData->next) { ! if((uData->access == ulOwner) && (dnr = chanserv_is_dnr(argv[1], uData->handle))) { if(IsHelping(user)) *************** *** 2086,2105 **** } } target = AddChannel(argv[1], now, NULL, NULL); ! AddChannelUser(chanserv, target); ! new_channel = 1; } ! ! if(target->channel_info) { chanserv_notice(user, CSMSG_ALREADY_REGGED, target->name); return 0; } ! ! if(!new_channel && (!(mn = GetUserMode(target, user)) || !(mn->modes && MODE_CHANOP)) && !IsHelping(user)) { ! chanserv_notice(user, CSMSG_MUST_BE_OPPED, target->name); ! return 0; } --- 2043,2072 ---- } } + } + if (!(target = GetChannel(argv[1]))) + { target = AddChannel(argv[1], now, NULL, NULL); ! LockChannel(target); ! if(!IsSuspended(channel->channel_info)) ! { ! AddChannelUser(chanserv, target); ! } } ! else if(target->channel_info) { chanserv_notice(user, CSMSG_ALREADY_REGGED, target->name); return 0; } ! else if((!(mn = GetUserMode(target, user)) || !(mn->modes && MODE_CHANOP)) ! && !IsHelping(user)) { ! chanserv_notice(user, CSMSG_MUST_BE_OPPED, target->name); ! return 0; ! } ! else if(!IsSuspended(channel->channel_info)) ! { ! AddChannelUser(chanserv, target); ! AddChannelOp(1, &chanserv, target, chanserv, 1); } *************** *** 2111,2120 **** channel->channel_info = NULL; - if(!IsSuspended(target->channel_info)) - { - if(!new_channel) AddChannelUser(chanserv, target); - AddChannelOp(1, &chanserv, target, chanserv, 1); - } - chanserv_notice(user, CSMSG_MOVE_SUCCESS, target->name); --- 2078,2081 ---- *************** *** 5875,5879 **** static void ! chanserv_refresh_topics(void *data) { unsigned int refresh_num = (now - self->link) / chanserv_conf.refresh_period; --- 5836,5840 ---- static void ! chanserv_refresh_topics(UNUSED_ARG(void *data)) { unsigned int refresh_num = (now - self->link) / chanserv_conf.refresh_period; *************** *** 5890,5894 **** cData->last_refresh = refresh_num; } ! timeq_add(now + chanserv_conf.refresh_period, chanserv_refresh_topics, data); } --- 5851,5855 ---- cData->last_refresh = refresh_num; } ! timeq_add(now + chanserv_conf.refresh_period, chanserv_refresh_topics, NULL); } *************** *** 6434,6438 **** } ! static void handle_rename(struct handle_info *handle, const char *new_handle) { struct do_not_register *dnr = dict_find(handle_dnrs, handle->handle, NULL); --- 6395,6399 ---- } ! static void handle_rename(struct handle_info *handle, const char *old_handle) { struct do_not_register *dnr = dict_find(handle_dnrs, handle->handle, NULL); *************** *** 6440,6445 **** if(dnr) { ! dict_remove2(handle_dnrs, handle->handle, 1); ! safestrncpy(dnr->chan_name + 1, new_handle, sizeof(dnr->chan_name) - 1); dict_insert(handle_dnrs, dnr->chan_name + 1, dnr); } --- 6401,6406 ---- if(dnr) { ! dict_remove2(handle_dnrs, old_handle, 1); ! safestrncpy(dnr->chan_name + 1, handle->handle, sizeof(dnr->chan_name) - 1); dict_insert(handle_dnrs, dnr->chan_name + 1, dnr); } *************** *** 6472,6476 **** for(cData = channelList; cData; cData = cData->next) { ! if(!IsSuspended(cData)) cData->may_opchan = 1; } } --- 6433,6440 ---- for(cData = channelList; cData; cData = cData->next) { ! if(!IsSuspended(cData)) ! { ! cData->may_opchan = 1; ! } } } Index: helpserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpserv.c,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -r1.79 -r1.80 *** helpserv.c 1 Sep 2003 14:44:52 -0000 1.79 --- helpserv.c 9 Sep 2003 16:40:29 -0000 1.80 *************** *** 3648,3653 **** /* Also update helpserv_reqs_byhand_dict upon handle rename */ ! static void handle_nickserv_rename(struct handle_info *handle, const char *new_handle) { ! char old_handle[NICKSERV_HANDLE_LEN+1]; struct helpserv_reqlist *reqlist; struct helpserv_userlist *userlist; --- 3648,3652 ---- /* Also update helpserv_reqs_byhand_dict upon handle rename */ ! static void handle_nickserv_rename(struct handle_info *handle, const char *old_handle) { struct helpserv_reqlist *reqlist; struct helpserv_userlist *userlist; *************** *** 3655,3688 **** /* First, rename the handle in the requests dict */ ! if ((reqlist = dict_find(helpserv_reqs_byhand_dict, handle->handle, NULL))) { /* Don't free the list */ ! dict_remove2(helpserv_reqs_byhand_dict, handle->handle, 1); ! ! /* new_handle may be a temporary pointer. The dict stores the key pointer. ! * Make sure it knows about the change but still points to handle->handle, ! * as handle->handle will soon store the new name. */ ! strcpy(old_handle, handle->handle); ! strcpy(handle->handle, new_handle); dict_insert(helpserv_reqs_byhand_dict, handle->handle, reqlist); - strcpy(handle->handle, old_handle); } /* Second, rename the handle in the users dict */ ! if ((userlist = dict_find(helpserv_users_byhand_dict, handle->handle, NULL))) { ! dict_remove2(helpserv_users_byhand_dict, handle->handle, 1); for (i=0; i < userlist->used; i++) { ! dict_remove2(userlist->list[i]->hs->users, handle->handle, 1); } - strcpy(old_handle, handle->handle); - strcpy(handle->handle, new_handle); - dict_insert(helpserv_users_byhand_dict, handle->handle, userlist); for (i=0; i < userlist->used; i++) { dict_insert(userlist->list[i]->hs->users, handle->handle, userlist->list[i]); } - - strcpy(handle->handle, old_handle); } --- 3654,3675 ---- /* First, rename the handle in the requests dict */ ! if ((reqlist = dict_find(helpserv_reqs_byhand_dict, old_handle, NULL))) { /* Don't free the list */ ! dict_remove2(helpserv_reqs_byhand_dict, old_handle, 1); dict_insert(helpserv_reqs_byhand_dict, handle->handle, reqlist); } /* Second, rename the handle in the users dict */ ! if ((userlist = dict_find(helpserv_users_byhand_dict, old_handle, NULL))) { ! dict_remove2(helpserv_users_byhand_dict, old_handle, 1); for (i=0; i < userlist->used; i++) { ! dict_remove2(userlist->list[i]->hs->users, old_handle, 1); } dict_insert(helpserv_users_byhand_dict, handle->handle, userlist); for (i=0; i < userlist->used; i++) { dict_insert(userlist->list[i]->hs->users, handle->handle, userlist->list[i]); } } *************** *** 3691,3695 **** struct helpserv_request *req=reqlist->list[i]; ! if (req->helper && (req->hs->notify >= NOTIFY_HANDLE)) helpserv_notify(req->helper, HSMSG_NOTIFY_HAND_RENAME, req->id, handle->handle, new_handle); } } --- 3678,3684 ---- struct helpserv_request *req=reqlist->list[i]; ! if (req->helper && (req->hs->notify >= NOTIFY_HANDLE)) { ! helpserv_notify(req->helper, HSMSG_NOTIFY_HAND_RENAME, req->id, old_handle, handle->handle); ! } } } Index: messages.h =================================================================== RCS file: /cvsroot/srvx/services/src/messages.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** messages.h 2 Aug 2003 23:13:22 -0000 1.37 --- messages.h 9 Sep 2003 16:40:29 -0000 1.38 *************** *** 82,85 **** --- 82,87 ---- #define MSG_INVALID_BINARY "$b%s$b is an invalid binary value." + #define MSG_INTERNAL_FAILURE "Your command could not be processed due to an internal failure." + #define IDENT_FORMAT "%s [%s@%s/%s]" #define IDENT_DATA(user) user->nick, user->ident, user->hostname, inet_ntoa(user->ip) Index: mod-memoserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/mod-memoserv.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** mod-memoserv.c 5 Sep 2003 13:41:26 -0000 1.6 --- mod-memoserv.c 9 Sep 2003 16:40:29 -0000 1.7 *************** *** 44,47 **** --- 44,48 ---- * "MemoServ"), and bind the commands to it: * /msg opserv bind memoserv * *memoserv.* + * /msg opserv bind memoserv set *modcmd.joiner */ *************** *** 121,129 **** { struct memo_account *ma; ! if (!hi) return NULL; ma = dict_find(memos, hi->handle, NULL); ! if (ma) return ma; ma = calloc(1, sizeof(*ma)); ! if (!ma) return ma; ma->handle = hi; ma->flags = MEMO_NOTIFY_NEW | MEMO_NOTIFY_LOGIN; --- 122,133 ---- { struct memo_account *ma; ! if (!hi) ! return NULL; ma = dict_find(memos, hi->handle, NULL); ! if (ma) ! return ma; ma = calloc(1, sizeof(*ma)); ! if (!ma) ! return ma; ma->handle = hi; ma->flags = MEMO_NOTIFY_NEW | MEMO_NOTIFY_LOGIN; *************** *** 146,155 **** struct memo_account *ma = data; ! while (ma->recvd.used) { delete_memo(ma->recvd.list[0]); ! } ! while (ma->sent.used) { delete_memo(ma->sent.list[0]); - } memoList_clean(&ma->recvd); memoList_clean(&ma->sent); --- 150,157 ---- struct memo_account *ma = data; ! while (ma->recvd.used) delete_memo(ma->recvd.list[0]); ! while (ma->sent.used) delete_memo(ma->sent.list[0]); memoList_clean(&ma->recvd); memoList_clean(&ma->sent); *************** *** 190,201 **** memo = calloc(1, sizeof(*memo)); ! if (!memo) return NULL; - memo->sent = sent; memo->recipient = recipient; - memo->sender = sender; - memo->message = strdup(message); memoList_append(&recipient->recvd, memo); memoList_append(&sender->sent, memo); memosSent++; return memo; --- 192,204 ---- memo = calloc(1, sizeof(*memo)); ! if (!memo) ! return NULL; memo->recipient = recipient; memoList_append(&recipient->recvd, memo); + memo->sender = sender; memoList_append(&sender->sent, memo); + memo->sent = sent; + memo->message = strdup(message); memosSent++; return memo; *************** *** 208,218 **** struct userData *dest; ! if (!user->handle_info) return 0; ! if (!(acct->flags & MEMO_DENY_NONCHANNEL)) return 1; ! for (dest = acct->handle->channels; dest; dest = dest->u_next) { ! if (_GetChannelUser(dest->channel, user->handle_info, 1, 0)) { return 1; - } - } send_message(user, bot, MSMSG_CANNOT_SEND, acct->handle->handle); return 0; --- 211,221 ---- struct userData *dest; ! if (!user->handle_info) ! return 0; ! if (!(acct->flags & MEMO_DENY_NONCHANNEL)) ! return 1; ! for (dest = acct->handle->channels; dest; dest = dest->u_next) ! if (_GetChannelUser(dest->channel, user->handle_info, 1, 0)) return 1; send_message(user, bot, MSMSG_CANNOT_SEND, acct->handle->handle); return 0; *************** *** 225,239 **** struct memo_account *ma, *sender; ! if (!(hi = modcmd_get_handle_info(user, argv[1]))) return 0; ! if (!(ma = memoserv_get_account(hi))) return 0; ! if (!(memoserv_can_send(cmd->parent->bot, user, ma))) return 0; ! if (!(sender = memoserv_get_account(user->handle_info))) return 0; message = unsplit_string(argv + 2, argc - 2, NULL); add_memo(now, ma, sender, message); if (ma->flags & MEMO_NOTIFY_NEW) { struct userNode *other; ! for (other = ma->handle->users; other; other = other->next_authed) { send_message(other, cmd->parent->bot, MSMSG_NEW_MESSAGE, user->nick); - } } reply(MSMSG_MEMO_SENT, ma->handle->handle); --- 228,246 ---- struct memo_account *ma, *sender; ! if (!(hi = modcmd_get_handle_info(user, argv[1]))) ! return 0; ! if (!(sender = memoserv_get_account(user->handle_info)) ! || !(ma = memoserv_get_account(hi))) { ! reply(MSG_INTERNAL_FAILURE); ! return 0; ! } ! if (!(memoserv_can_send(cmd->parent->bot, user, ma))) ! return 0; message = unsplit_string(argv + 2, argc - 2, NULL); add_memo(now, ma, sender, message); if (ma->flags & MEMO_NOTIFY_NEW) { struct userNode *other; ! for (other = ma->handle->users; other; other = other->next_authed) send_message(other, cmd->parent->bot, MSMSG_NEW_MESSAGE, user->nick); } reply(MSMSG_MEMO_SENT, ma->handle->handle); *************** *** 249,253 **** struct tm tm; ! if (!(ma = memoserv_get_account(user->handle_info))) return 0; reply(MSMSG_LIST_HEAD); for (ii = 0; (ii < ma->recvd.used) && (ii < 15); ++ii) { --- 256,261 ---- struct tm tm; ! if (!(ma = memoserv_get_account(user->handle_info))) ! return 0; reply(MSMSG_LIST_HEAD); for (ii = 0; (ii < ma->recvd.used) && (ii < 15); ++ii) { *************** *** 257,263 **** reply(MSMSG_LIST_FORMAT, ii, memo->sender->handle->handle, posted); } ! if (ii == 0) reply("$bNone.$b"); ! else if (ii == 15) reply(MSMSG_CLEAN_INBOX, ii); ! else reply(MSMSG_MEMOS_FOUND, ii); return 1; } --- 265,274 ---- reply(MSMSG_LIST_FORMAT, ii, memo->sender->handle->handle, posted); } ! if (ii == 0) ! reply("$bNone.$b"); ! else if (ii == 15) ! reply(MSMSG_CLEAN_INBOX, ii); ! else ! reply(MSMSG_MEMOS_FOUND, ii); return 1; } *************** *** 271,275 **** struct tm tm; ! if (!(ma = memoserv_get_account(user->handle_info))) return 0; memoid = atoi(argv[1]); if (memoid >= ma->recvd.used) { --- 282,287 ---- struct tm tm; ! if (!(ma = memoserv_get_account(user->handle_info))) ! return 0; memoid = atoi(argv[1]); if (memoid >= ma->recvd.used) { *************** *** 289,295 **** struct memo_account *ma; unsigned int memoid; - struct memo *memo; ! if (!(ma = memoserv_get_account(user->handle_info))) return 0; if (!irccasecmp(argv[1], "*") || !irccasecmp(argv[1], "all")) { if ((argc < 3) || irccasecmp(argv[2], "confirm")) { --- 301,307 ---- struct memo_account *ma; unsigned int memoid; ! if (!(ma = memoserv_get_account(user->handle_info))) ! return 0; if (!irccasecmp(argv[1], "*") || !irccasecmp(argv[1], "all")) { if ((argc < 3) || irccasecmp(argv[2], "confirm")) { *************** *** 297,303 **** return 0; } ! while (ma->recvd.used) { delete_memo(ma->recvd.list[0]); - } reply(MSMSG_DELETED_ALL); return 1; --- 309,314 ---- return 0; } ! while (ma->recvd.used) delete_memo(ma->recvd.list[0]); reply(MSMSG_DELETED_ALL); return 1; *************** *** 309,314 **** return 0; } ! memo = ma->recvd.list[memoid]; ! delete_memo(memo); reply(MSMSG_MEMO_DELETED, memoid); return 1; --- 320,324 ---- return 0; } ! delete_memo(ma->recvd.list[memoid]); reply(MSMSG_MEMO_DELETED, memoid); return 1; *************** *** 342,346 **** char *choice; ! if (!(ma = memoserv_get_account(user->handle_info))) return 0; if (argc > 1) { choice = argv[1]; --- 352,357 ---- char *choice; ! if (!(ma = memoserv_get_account(user->handle_info))) ! return 0; if (argc > 1) { choice = argv[1]; *************** *** 365,369 **** char *choice; ! if (!(ma = memoserv_get_account(user->handle_info))) return 0; if (argc > 1) { choice = argv[1]; --- 376,381 ---- char *choice; ! if (!(ma = memoserv_get_account(user->handle_info))) ! return 0; if (argc > 1) { choice = argv[1]; *************** *** 388,392 **** char *choice; ! if (!(ma = memoserv_get_account(user->handle_info))) return 0; if (argc > 1) { choice = argv[1]; --- 400,405 ---- char *choice; ! if (!(ma = memoserv_get_account(user->handle_info))) ! return 0; if (argc > 1) { choice = argv[1]; *************** *** 522,543 **** struct memo *memo; ! if (!(ma = memoserv_get_account(user->handle_info))) return; ! if (!(ma->flags & MEMO_NOTIFY_LOGIN)) return; for (ii = unseen = 0; ii < ma->recvd.used; ++ii) { memo = ma->recvd.list[ii]; ! if (!memo->is_read) unseen++; } ! if (ii && memoserv_conf.bot) { send_message(user, memoserv_conf.bot, MSMSG_MEMOS_INBOX, unseen, ii); - } } static void ! memoserv_rename_account(struct handle_info *hi, const char *new_handle) { struct memo_account *ma; ! if (!(ma = dict_find(memos, hi->handle, NULL))) return; ! dict_remove2(memos, hi->handle, 1); ! dict_insert(memos, new_handle, ma); } --- 535,558 ---- struct memo *memo; ! if (!(ma = memoserv_get_account(user->handle_info)) ! || !(ma->flags & MEMO_NOTIFY_LOGIN)) ! return; for (ii = unseen = 0; ii < ma->recvd.used; ++ii) { memo = ma->recvd.list[ii]; ! if (!memo->is_read) ! unseen++; } ! if (ii && memoserv_conf.bot) send_message(user, memoserv_conf.bot, MSMSG_MEMOS_INBOX, unseen, ii); } static void ! memoserv_rename_account(struct handle_info *hi, const char *old_handle) { struct memo_account *ma; ! if (!(ma = dict_find(memos, old_handle, NULL))) ! return; ! dict_remove2(memos, old_handle, 1); ! dict_insert(memos, hi->handle, ma); } *************** *** 592,596 **** str = database_get_data(conf_node, "bot", RECDB_QSTRING); ! if (str) memoserv_conf.bot = GetUserH(str); return 1; } --- 607,612 ---- str = database_get_data(conf_node, "bot", RECDB_QSTRING); ! if (str) ! memoserv_conf.bot = GetUserH(str); return 1; } Index: nickserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.c,v retrieving revision 1.257 retrieving revision 1.258 diff -C2 -r1.257 -r1.258 *** nickserv.c 22 Aug 2003 00:24:14 -0000 1.257 --- nickserv.c 9 Sep 2003 16:40:29 -0000 1.258 *************** *** 364,368 **** hi->userlist_style = HI_DEFAULT_STYLE; hi->announcements = '?'; ! safestrncpy(hi->handle, handle, sizeof(hi->handle)); safestrncpy(hi->passwd, passwd, sizeof(hi->passwd)); hi->infoline = NULL; --- 364,368 ---- hi->userlist_style = HI_DEFAULT_STYLE; hi->announcements = '?'; ! hi->handle = strdup(handle); safestrncpy(hi->passwd, passwd, sizeof(hi->passwd)); hi->infoline = NULL; *************** *** 451,455 **** free_handle_info(void *vhi) { - struct userNode *un, *next; struct handle_info *hi = vhi; --- 451,454 ---- *************** *** 462,474 **** free_string_list(hi->masks); ! for (un = hi->users; un; un = next) { ! next = un->next_authed; ! un->handle_info = NULL; ! un->next_authed = NULL; ! } ! while (hi->nicks) delete_nick(hi->nicks); ! if (hi->infoline) free(hi->infoline); ! if (hi->epithet) free(hi->epithet); if (hi->cookie) { timeq_del(hi->cookie->expires, nickserv_free_cookie, hi->cookie, 0); --- 461,470 ---- free_string_list(hi->masks); ! assert(!hi->users); ! while (hi->nicks) ! delete_nick(hi->nicks); ! free(hi->infoline); ! free(hi->epithet); if (hi->cookie) { timeq_del(hi->cookie->expires, nickserv_free_cookie, hi->cookie, 0); *************** *** 478,482 **** struct handle_info_list *hil = dict_find(nickserv_email_dict, hi->email_addr, NULL); handle_info_list_remove(hil, hi); ! if (!hil->used) dict_remove(nickserv_email_dict, hi->email_addr); } free(hi); --- 474,479 ---- struct handle_info_list *hil = dict_find(nickserv_email_dict, hi->email_addr, NULL); handle_info_list_remove(hil, hi); ! if (!hil->used) ! dict_remove(nickserv_email_dict, hi->email_addr); } free(hi); *************** *** 526,531 **** for (nn=0; nn<channel->members.used; ++nn) { mn = channel->members.list[nn]; ! if (mn->user == except) continue; ! if (mn->user->handle_info == handle) return mn; } return NULL; --- 523,530 ---- for (nn=0; nn<channel->members.used; ++nn) { mn = channel->members.list[nn]; ! if (mn->user == except) ! continue; ! if (mn->user->handle_info == handle) ! return mn; } return NULL; *************** *** 686,706 **** valid_user_for(struct userNode *user, struct handle_info *hi) { ! unsigned int i; ! int res = 0; ! if (hi->masks->used) { ! for (i=0; !res && i<hi->masks->used; i++) { ! /* Maybe it'd just be simpler to require the *! at the ! * start of the hostmask. For future thought, anyway. */ ! if (user_matches_glob(user, hi->masks->list[i], 0)) res = 1; ! } ! } else { ! /* if they have no masks, let them pass */ ! res = 1; ! } ! if (!res && (dict_find(nickserv_allow_auth_dict, user->nick, NULL) == hi)) { dict_remove(nickserv_allow_auth_dict, user->nick); ! res = 2; } ! return res; } --- 685,704 ---- valid_user_for(struct userNode *user, struct handle_info *hi) { ! unsigned int ii; ! ! /* If no hostmasks on the account, allow it. */ ! if (!hi->masks->used) ! return 1; ! /* If any hostmask matches, allow it. */ ! for (ii=0; ii<hi->masks->used; ii++) ! if (user_matches_glob(user, hi->masks->list[ii], 0)) ! return 1; ! /* If they are allowauthed to this account, allow it (removing the aa). */ ! if (dict_find(nickserv_allow_auth_dict, user->nick, NULL) == hi) { dict_remove(nickserv_allow_auth_dict, user->nick); ! return 2; } ! /* The user is not allowed to use this account. */ ! return 0; } *************** *** 783,796 **** * they re-auth to their current handle (which is silly, but users * are like that). */ ! if (user->handle_info == hi) { return; - } if (user->handle_info) { struct userNode *other; ! if (IsHelper(user)) { userList_remove(&curr_helpers, user); - } /* remove from next_authed linked list */ --- 781,792 ---- * they re-auth to their current handle (which is silly, but users * are like that). */ ! if (user->handle_info == hi) return; if (user->handle_info) { struct userNode *other; ! if (IsHelper(user)) userList_remove(&curr_helpers, user); /* remove from next_authed linked list */ *************** *** 804,808 **** } /* if nobody left on old handle, and they're not an oper, remove !god */ ! if (!user->handle_info->users && !user->handle_info->opserv_level) HANDLE_CLEAR_FLAG(user->handle_info, HELPING); /* record them as being last seen at this time */ user->handle_info->lastseen = now; --- 800,805 ---- } /* if nobody left on old handle, and they're not an oper, remove !god */ ! if (!user->handle_info->users && !user->handle_info->opserv_level) ! HANDLE_CLEAR_FLAG(user->handle_info, HELPING); /* record them as being last seen at this time */ user->handle_info->lastseen = now; *************** *** 812,817 **** old_info = user->handle_info; user->handle_info = hi; ! if (hi && !hi->users && !hi->opserv_level) HANDLE_CLEAR_FLAG(hi, HELPING); ! for (n=0; n<auth_func_used; n++) auth_func_list[n](user, old_info); if (hi) { struct nick_info *ni; --- 809,816 ---- old_info = user->handle_info; user->handle_info = hi; ! if (hi && !hi->users && !hi->opserv_level) ! HANDLE_CLEAR_FLAG(hi, HELPING); ! for (n=0; n<auth_func_used; n++) ! auth_func_list[n](user, old_info); if (hi) { struct nick_info *ni; *************** *** 827,831 **** hi->users = user; hi->lastseen = now; ! if (IsHelper(user)) userList_append(&curr_helpers, user); if (stamp) { --- 826,831 ---- hi->users = user; hi->lastseen = now; ! if (IsHelper(user)) ! userList_append(&curr_helpers, user); if (stamp) { *************** *** 852,858 **** } ! if ((ni = get_nick_info(user->nick)) && (ni->owner == hi)) { timeq_del(0, nickserv_reclaim_p, user, TIMEQ_IGNORE_WHEN); - } } else { /* We cannot clear the user's account ID, unfortunately. */ --- 852,857 ---- } ! if ((ni = get_nick_info(user->nick)) && (ni->owner == hi)) timeq_del(0, nickserv_reclaim_p, user, TIMEQ_IGNORE_WHEN); } else { /* We cannot clear the user's account ID, unfortunately. */ *************** *** 877,881 **** } ! if (!is_secure_password(handle, passwd, user)) return 0; cryptpass(passwd, crypted); --- 876,881 ---- } ! if (!is_secure_password(handle, passwd, user)) ! return 0; cryptpass(passwd, crypted); *************** *** 901,907 **** } } ! if (settee && (user != settee)) { nickserv_notice(settee, NSMSG_OREGISTER_VICTIM, user->nick, hi->handle); - } return hi; } --- 901,906 ---- } } ! if (settee && (user != settee)) nickserv_notice(settee, NSMSG_OREGISTER_VICTIM, user->nick, hi->handle); return hi; } *************** *** 1094,1124 **** password = argv[2]; argv[2] = "****"; ! if ((hi = nickserv_register(user, user, argv[1], password, no_auth))) { ! /* Add any masks they should get. */ ! if (nickserv_conf.default_hostmask) { ! string_list_append(hi->masks, strdup("*@*")); ! } else { ! string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT)); ! if (user->ip.s_addr) { ! string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_BYIP|GENMASK_NO_HIDING|GENMASK_ANY_IDENT)); ! } ! } ! /* If they're the first to register, give them level 1000. */ ! if (dict_size(nickserv_handle_dict) == 1) { ! hi->opserv_level = 1000; ! nickserv_notice(user, NSMSG_ROOT_HANDLE, argv[1]); ! } ! /* Set their email address. */ ! if (email_addr) nickserv_set_email_addr(hi, email_addr); ! /* If they need to do email verification, tell them. */ ! if (no_auth) nickserv_make_cookie(user, hi, ACTIVATION, hi->passwd); ! return 1; ! } else { ! return 0; ! } } --- 1093,1122 ---- password = argv[2]; argv[2] = "****"; ! if (!(hi = nickserv_register(user, user, argv[1], password, no_auth))) ! return 0; ! /* Add any masks they should get. */ ! if (nickserv_conf.default_hostmask) { ! string_list_append(hi->masks, strdup("*@*")); ! } else { ! string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT)); ! if (user->ip.s_addr) ! string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_BYIP|GENMASK_NO_HIDING|GENMASK_ANY_IDENT)); ! } ! /* If they're the first to register, give them level 1000. */ ! if (dict_size(nickserv_handle_dict) == 1) { ! hi->opserv_level = 1000; ! nickserv_notice(user, NSMSG_ROOT_HANDLE, argv[1]); ! } ! /* Set their email address. */ ! if (email_addr) ! nickserv_set_email_addr(hi, email_addr); ! /* If they need to do email verification, tell them. */ ! if (no_auth) ! nickserv_make_cookie(user, hi, ACTIVATION, hi->passwd); ! return 1; } *************** *** 1148,1152 **** } } else if ((settee = GetUserH(argv[3]))) { ! if (settee->handle_info && !oper_outranks(user, settee->handle_info)) return 0; mask = generate_hostmask(settee, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT); } else { --- 1146,1151 ---- } } else if ((settee = GetUserH(argv[3]))) { ! if (settee->handle_info && !oper_outranks(user, settee->handle_info)) ! return 0; mask = generate_hostmask(settee, GENMASK_OMITNICK|GENMASK_NO_HIDING|GENMASK_ANY_IDENT); } else { *************** *** 1155,1164 **** } ! if ((hi = nickserv_register(user, settee, argv[1], argv[2], 0))) { ! string_list_append(hi->masks, mask); ! return 1; ! } else { ! return 0; ! } } --- 1154,1161 ---- } ! if (!(hi = nickserv_register(user, settee, argv[1], argv[2], 0))) ! return 0; ! string_list_append(hi->masks, mask); ! return 1; } *************** *** 1193,1207 **** nickserv_notice(user, NSMSG_HANDLEINFO_INFOLINE, (hi->infoline ? hi->infoline : NSMSG_NONE)); ! if (HANDLE_FLAGGED(hi, FROZEN)) nickserv_notice(user, NSMSG_HANDLEINFO_VACATION); ! if (hi != user->handle_info) { ! if (!is_valid_oper(user, 0, 1)) return 1; ! /* Normally, since we check for is_valid_oper, we'd want to log this ! * separately. But we've already logged it above. */ ! } ! if (nickserv_conf.email_enabled) { nickserv_notice(user, NSMSG_HANDLEINFO_EMAIL_ADDR, visible_email_addr(user, hi)); - } if (hi->cookie) { --- 1190,1201 ---- nickserv_notice(user, NSMSG_HANDLEINFO_INFOLINE, (hi->infoline ? hi->infoline : NSMSG_NONE)); ! if (HANDLE_FLAGGED(hi, FROZEN)) ! nickserv_notice(user, NSMSG_HANDLEINFO_VACATION); ! if ((hi != user->handle_info) && (!is_valid_oper(user, 0, 1))) ! return 1; ! if (nickserv_conf.email_enabled) nickserv_notice(user, NSMSG_HANDLEINFO_EMAIL_ADDR, visible_email_addr(user, hi)); if (hi->cookie) { *************** *** 1221,1227 **** char flags[34]; /* 32 bits possible plus '+' and '\0' */ flags[0] = '+'; ! for (i=0, flen=1; handle_flags[i]; i++) { ! if (hi->flags & 1 << i) flags[flen++] = handle_flags[i]; ! } flags[flen] = 0; nickserv_notice(user, NSMSG_HANDLEINFO_FLAGS, flags); --- 1215,1221 ---- char flags[34]; /* 32 bits possible plus '+' and '\0' */ flags[0] = '+'; ! for (i=0, flen=1; handle_flags[i]; i++) ! if (hi->flags & 1 << i) ! flags[flen++] = handle_flags[i]; flags[flen] = 0; nickserv_notice(user, NSMSG_HANDLEINFO_FLAGS, flags); *************** *** 1236,1244 **** } ! if (hi->last_quit_host[0]) { nickserv_notice(user, NSMSG_HANDLEINFO_LAST_HOST, hi->last_quit_host); ! } else { nickserv_notice(user, NSMSG_HANDLEINFO_LAST_HOST, NSMSG_UNKNOWN); - } if (nickserv_conf.disable_nicks) { --- 1230,1237 ---- } ! if (hi->last_quit_host[0]) nickserv_notice(user, NSMSG_HANDLEINFO_LAST_HOST, hi->last_quit_host); ! else nickserv_notice(user, NSMSG_HANDLEINFO_LAST_HOST, NSMSG_UNKNOWN); if (nickserv_conf.disable_nicks) { *************** *** 1271,1275 **** herelen = strlen(hi->masks->list[i]); if (pos + herelen + 1 > ArrayLength(buff)) { ! i--; goto print_mask_buff; } memcpy(buff+pos, hi->masks->list[i], herelen); --- 1264,1269 ---- herelen = strlen(hi->masks->list[i]); if (pos + herelen + 1 > ArrayLength(buff)) { ! i--; ! goto print_mask_buff; } memcpy(buff+pos, hi->masks->list[i], herelen); *************** *** 1296,1300 **** herelen = strlen(name); if (pos + herelen + 3 > ArrayLength(buff)) { ! next = channel; goto print_chans_buff; } if (IsUserSuspended(channel)) buff[pos++] = '-'; --- 1290,1295 ---- herelen = strlen(name); if (pos + herelen + 3 > ArrayLength(buff)) { ! next = channel; ! goto print_chans_buff; } if (IsUserSuspended(channel)) buff[pos++] = '-'; *************** *** 1330,1333 **** --- 1325,1329 ---- } } + return 1; } *************** *** 1366,1369 **** --- 1362,1366 ---- { struct handle_info *hi; + char *old_handle; unsigned int nn; *************** *** 1378,1387 **** return 0; } ! for (nn=0; nn<rf_list_used; nn++) { ! rf_list[nn](hi, argv[2]); ! } ! dict_remove2(nickserv_handle_dict, hi->handle, 1); ! safestrncpy(hi->handle, argv[2], sizeof(hi->handle)); dict_insert(nickserv_handle_dict, hi->handle, hi); if (argv[1][0] == '*') { nickserv_notice(user, NSMSG_HANDLE_CHANGED, argv[1]+1, argv[2]); --- 1375,1386 ---- return 0; } ! ! dict_remove2(nickserv_handle_dict, old_handle = hi->handle, 1); ! hi->handle = strdup(argv[2]); dict_insert(nickserv_handle_dict, hi->handle, hi); + for (nn=0; nn<rf_list_used; nn++) + rf_list[nn](hi, old_handle); + free(old_handle); + if (argv[1][0] == '*') { nickserv_notice(user, NSMSG_HANDLE_CHANGED, argv[1]+1, argv[2]); *************** *** 1412,1416 **** static NICKSERV_FUNC(cmd_auth) { ! int res, pw_arg; struct handle_info *hi; const char *passwd; --- 1411,1415 ---- static NICKSERV_FUNC(cmd_auth) { ! int pw_arg; struct handle_info *hi; const char *passwd; *************** *** 1457,1462 **** } passwd = argv[pw_arg]; ! res = valid_user_for(user, hi); ! if (!res) { if (hi->email_addr && nickserv_conf.email_enabled) { reply(NSMSG_USE_AUTHCOOKIE, hi->handle, hi->handle); --- 1456,1460 ---- } passwd = argv[pw_arg]; ! if (!valid_user_for(user, hi)) { if (hi->email_addr && nickserv_conf.email_enabled) { reply(NSMSG_USE_AUTHCOOKIE, hi->handle, hi->handle); *************** *** 3471,3474 **** --- 3469,3473 ---- nickserv_handle_dict = dict_new(); + dict_set_free_keys(nickserv_handle_dict, free); dict_set_free_data(nickserv_handle_dict, free_handle_info); Index: nickserv.h =================================================================== RCS file: /cvsroot/srvx/services/src/nickserv.h,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -r1.45 -r1.46 *** nickserv.h 5 Aug 2003 01:31:16 -0000 1.45 --- nickserv.h 9 Sep 2003 16:40:29 -0000 1.46 *************** *** 89,93 **** unsigned int table_width; time_t registered, lastseen; ! char handle[NICKSERV_HANDLE_LEN+1]; char passwd[MD5_CRYPT_LENGTH+1]; char last_quit_host[USERLEN+HOSTLEN+2]; --- 89,93 ---- unsigned int table_width; time_t registered, lastseen; ! char *handle; char passwd[MD5_CRYPT_LENGTH+1]; char last_quit_host[USERLEN+HOSTLEN+2]; |
From: Entrope <en...@us...> - 2003-09-09 16:38:19
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv24304/src Modified Files: opserv.c Log Message: remove spurious call to gline_remove() Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.337 retrieving revision 1.338 diff -C2 -r1.337 -r1.338 *** opserv.c 18 Aug 2003 21:47:02 -0000 1.337 --- opserv.c 9 Sep 2003 16:38:13 -0000 1.338 *************** *** 815,819 **** return 0; } - gline_remove(argv[1], 0); gline = gline_add(user->handle_info->handle, argv[1], duration, reason, now, 1); opserv_notice(user, OSMSG_GLINE_ISSUED, gline->target); --- 815,818 ---- |