srvx-commits Mailing List for srvx IRC Services (Page 34)
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...> - 2002-08-04 01:48:43
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv31359/src
Modified Files:
opserv.c
Log Message:
make OpServ use the server-announced IP when ?hostscan'ing a user by nick (fixes bug 588887)
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.254
retrieving revision 1.255
diff -C2 -r1.254 -r1.255
*** opserv.c 3 Aug 2002 04:27:03 -0000 1.254
--- opserv.c 4 Aug 2002 01:48:39 -0000 1.255
***************
*** 173,176 ****
--- 173,177 ----
#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_SPOOFED_IP "%s has a spoofed, hidden or localnet IP."
#define OSMSG_ADDRESS_QUEUED "$b%s$b is now queued to be proxy-checked."
#define OSMSG_HOST_CLEARED "$b%s$b was cleared from the cached hosts list."
***************
*** 1692,1695 ****
--- 1693,1697 ----
unsigned int n;
unsigned long addr;
+ char hnamebuf[64];
OPSERV_MIN_PARMS(2, false);
***************
*** 1698,1703 ****
char *scanhost;
! scanhost = un ? un->hostname : (char*)argv[n];
! if (getipbyname(scanhost, &addr)) {
sockcheck_queue_address(addr);
opserv_notice(user, OSMSG_ADDRESS_QUEUED, scanhost);
--- 1700,1712 ----
char *scanhost;
! if (un) {
! if ((un->ip == 0) || (un->ip == 0x7f000001)) {
! opserv_notice(user, OSMSG_SPOOFED_IP, un->nick);
! } else {
! sprintf(hnamebuf, "%ld.%ld.%ld.%ld", (un->ip >> 24) & 255, (un->ip >> 16) & 255, (un->ip >> 8) & 255, un->ip & 255);
! sockcheck_queue_address(un->ip);
! opserv_notice(user, OSMSG_ADDRESS_QUEUED, hnamebuf);
! }
! } else if (getipbyname(scanhost, &addr)) {
sockcheck_queue_address(addr);
opserv_notice(user, OSMSG_ADDRESS_QUEUED, scanhost);
|
|
From: Entrope <en...@us...> - 2002-08-03 04:27:06
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8210/src
Modified Files:
opserv.c nickserv.c modcmd.h modcmd.c chanserv.c
Log Message:
make MCMSG_* #defines for modcmd messages
put command alias argv in struct svccmd instead of in special-purpose helper
add support for "?bind service dummy service2.*" to bind all commands from the service
.. but provide a flag to exclude commands from a bind-all
implement replacement !command/?command
make OpServ commands that should accept/require a channel do so
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.253
retrieving revision 1.254
diff -C2 -r1.253 -r1.254
*** opserv.c 1 Aug 2002 03:20:06 -0000 1.253
--- opserv.c 3 Aug 2002 04:27:03 -0000 1.254
***************
*** 2501,2509 ****
struct modcmd *
! opserv_define_func(const char *name, modcmd_func_t *func, int min_level)
{
! char buf[16];
sprintf(buf, "%d", min_level);
! return modcmd_register(opserv_module, name, func, 0, 0, "level", buf, NULL);
}
--- 2501,2519 ----
struct modcmd *
! opserv_define_func(const char *name, modcmd_func_t *func, int min_level, int reqchan)
{
! char buf[16], *flags;
sprintf(buf, "%d", min_level);
! switch (reqchan) {
! default: case 0: flags = NULL; break;
! case 1: flags = "+acceptchan"; break;
! case 2: flags = "+channel"; break;
! case 3: flags = "+channel,+acceptpluschan"; break;
! }
! if (flags) {
! return modcmd_register(opserv_module, name, func, 0, 0, "level", buf, "flags", flags, NULL);
! } else {
! return modcmd_register(opserv_module, name, func, 0, 0, "level", buf, NULL);
! }
}
***************
*** 3555,3559 ****
return 0;
}
! if (!svccmd_can_invoke(user, opserv, subcmd, channel, 0, 0)) return 0;
if (!irccasecmp(argv[1], "print")) action = trace_print_func;
else if (!irccasecmp(argv[1], "count")) action = trace_count_func;
--- 3565,3569 ----
return 0;
}
! if (!svccmd_can_invoke(user, opserv, subcmd, channel, 0)) return 0;
if (!irccasecmp(argv[1], "print")) action = trace_print_func;
else if (!irccasecmp(argv[1], "count")) action = trace_count_func;
***************
*** 4191,4195 ****
return 0;
}
! if (!svccmd_can_invoke(user, opserv, subcmd, NULL, 0, 0)) return 0;
unsplit_string(argv + 3, argc - 3);
if (opserv_add_user_alert(user, name, reaction, argv[3])) {
--- 4201,4205 ----
return 0;
}
! if (!svccmd_can_invoke(user, opserv, subcmd, channel, 0)) return 0;
unsplit_string(argv + 3, argc - 3);
if (opserv_add_user_alert(user, name, reaction, argv[3])) {
***************
*** 4371,4456 ****
memset(level_strings, 0, sizeof(level_strings));
opserv_module = module_register("OpServ", OS_LOG, OPSERV_HELPFILE_NAME, opserv_help_expand);
! opserv_define_func("ACCESS", cmd_access, 0);
! opserv_define_func("ADDALERT", cmd_addalert, 800);
! opserv_define_func("ADDALERT NOTICE", NULL, 0);
! opserv_define_func("ADDALERT GLINE", NULL, 900);
! opserv_define_func("ADDBAD", cmd_addbad, 800);
! opserv_define_func("ADDEXEMPT", cmd_addexempt, 800);
! opserv_define_func("ADDNOTE", cmd_addnote, 800);
! opserv_define_func("ADDTRUST", cmd_addtrust, 800);
! opserv_define_func("BAN", cmd_ban, 100);
! opserv_define_func("BANEMAIL", cmd_ban_email, 601);
! opserv_define_func("BLOCK", cmd_block, 100);
! opserv_define_func("CHANINFO", cmd_chaninfo, 0);
! opserv_define_func("CLEARBANS", cmd_clearbans, 300);
! opserv_define_func("CLEARHOST", cmd_clearhost, 650);
! opserv_define_func("CLEARMODES", cmd_clearmodes, 400);
! opserv_define_func("CLONE", cmd_clone, 999);
! opserv_define_func("COLLIDE", cmd_collide, 800);
! opserv_define_func("DEFPROXY", cmd_defproxy, 999);
! opserv_define_func("DELALERT", cmd_delalert, 800);
! opserv_define_func("DELBAD", cmd_delbad, 800);
! opserv_define_func("DELEXEMPT", cmd_delexempt, 800);
! opserv_define_func("DELNOTE", cmd_delnote, 800);
! opserv_define_func("DELTRUST", cmd_deltrust, 800);
! opserv_define_func("DEOP", cmd_deop, 100);
! opserv_define_func("DEOPALL", cmd_deopall, 400);
! opserv_define_func("DEVOICEALL", cmd_devoiceall, 300);
! opserv_define_func("DIE", cmd_die, 900);
! opserv_define_func("DUMP", cmd_dump, 999);
! opserv_define_func("GAG", cmd_gag, 600);
! opserv_define_func("GLINE", cmd_gline, 600);
! opserv_define_func("HELPSERV", cmd_helpserv, 800);
! opserv_define_func("HOSTSCAN", cmd_hostscan, 650);
! opserv_define_func("INVITEME", cmd_inviteme, 100);
! opserv_define_func("JOIN", cmd_join, 601);
! opserv_define_func("JUMP", cmd_jump, 900);
! opserv_define_func("JUPE", cmd_jupe, 900);
! opserv_define_func("KICK", cmd_kick, 100);
! opserv_define_func("KICKALL", cmd_kickall, 400);
! opserv_define_func("KICKBAN", cmd_kickban, 100);
! opserv_define_func("KICKBANALL", cmd_kickbanall, 450);
! opserv_define_func("LOG", cmd_log, 900);
! opserv_define_func("LOGINFO", cmd_loginfo, 0);
! opserv_define_func("MODE", cmd_mode, 100);
! opserv_define_func("MODLOG", cmd_modlog, 900);
! opserv_define_func("NICKBAN", cmd_nickban, 100);
! opserv_define_func("OP", cmd_op, 100);
! opserv_define_func("OPALL", cmd_opall, 400);
! opserv_define_func("PART", cmd_part, 601);
! opserv_define_func("QUERY", cmd_query, 0);
! opserv_define_func("RAW", cmd_raw, 999);
! opserv_define_func("RECONNECT", cmd_reconnect, 900);
! opserv_define_func("REFRESHG", cmd_refreshg, 600);
! opserv_define_func("REHASH", cmd_rehash, 900);
! opserv_define_func("REOPEN", cmd_reopen, 900);
! opserv_define_func("RESERVE", cmd_reserve, 800);
! opserv_define_func("RESTART", cmd_restart, 900);
! opserv_define_func("SET", cmd_set, 900);
! opserv_define_func("STATS", cmd_stats, 101);
! opserv_define_func("TRACE", cmd_trace, 100);
! opserv_define_func("TRACE PRINT", NULL, 0);
! opserv_define_func("TRACE COUNT", NULL, 0);
! opserv_define_func("TRACE DOMAINS", NULL, 0);
! opserv_define_func("TRACE SCAN", NULL, 650);
! opserv_define_func("TRACE GLINE", NULL, 600);
! opserv_define_func("TRACE GAG", NULL, 600);
! opserv_define_func("TRACE KILL", NULL, 600);
! opserv_define_func("CSEARCH", cmd_csearch, 100);
! opserv_define_func("GSYNC", cmd_gsync, 600);
! opserv_define_func("GTRACE", cmd_gtrace, 100);
! opserv_define_func("UNBAN", cmd_unban, 100);
! opserv_define_func("UNBANEMAIL", cmd_unban_email, 601);
! opserv_define_func("UNGAG", cmd_ungag, 600);
! opserv_define_func("UNGLINE", cmd_ungline, 600);
! opserv_define_func("UNJUPE", cmd_unjupe, 900);
! opserv_define_func("UNRESERVE", cmd_unreserve, 800);
! opserv_define_func("UNWARN", cmd_unwarn, 800);
! opserv_define_func("VERSION", cmd_version, 0);
! opserv_define_func("VOICEALL", cmd_voiceall, 300);
! opserv_define_func("WARN", cmd_warn, 800);
! opserv_define_func("WHOIS", cmd_whois, 0);
! opserv_define_func("WRITE", cmd_write, 800);
! opserv_define_func("WRITEALL", cmd_writeall, 800);
opserv_reserved_nick_dict = dict_new();
--- 4381,4466 ----
memset(level_strings, 0, sizeof(level_strings));
opserv_module = module_register("OpServ", OS_LOG, OPSERV_HELPFILE_NAME, opserv_help_expand);
! opserv_define_func("ACCESS", cmd_access, 0, 0);
! opserv_define_func("ADDALERT", cmd_addalert, 800, 0);
! opserv_define_func("ADDALERT NOTICE", NULL, 0, 0);
! opserv_define_func("ADDALERT GLINE", NULL, 900, 0);
! opserv_define_func("ADDBAD", cmd_addbad, 800, 0);
! opserv_define_func("ADDEXEMPT", cmd_addexempt, 800, 0);
! opserv_define_func("ADDNOTE", cmd_addnote, 800, 0);
! opserv_define_func("ADDTRUST", cmd_addtrust, 800, 0);
! opserv_define_func("BAN", cmd_ban, 100, 2);
! opserv_define_func("BANEMAIL", cmd_ban_email, 601, 0);
! opserv_define_func("BLOCK", cmd_block, 100, 0);
! opserv_define_func("CHANINFO", cmd_chaninfo, 0, 3);
! opserv_define_func("CLEARBANS", cmd_clearbans, 300, 2);
! opserv_define_func("CLEARHOST", cmd_clearhost, 650, 0);
! opserv_define_func("CLEARMODES", cmd_clearmodes, 400, 2);
! opserv_define_func("CLONE", cmd_clone, 999, 0);
! opserv_define_func("COLLIDE", cmd_collide, 800, 0);
! opserv_define_func("DEFPROXY", cmd_defproxy, 999, 0);
! opserv_define_func("DELALERT", cmd_delalert, 800, 0);
! opserv_define_func("DELBAD", cmd_delbad, 800, 0);
! opserv_define_func("DELEXEMPT", cmd_delexempt, 800, 0);
! opserv_define_func("DELNOTE", cmd_delnote, 800, 0);
! opserv_define_func("DELTRUST", cmd_deltrust, 800, 0);
! opserv_define_func("DEOP", cmd_deop, 100, 2);
! opserv_define_func("DEOPALL", cmd_deopall, 400, 2);
! opserv_define_func("DEVOICEALL", cmd_devoiceall, 300, 2);
! opserv_define_func("DIE", cmd_die, 900, 0);
! opserv_define_func("DUMP", cmd_dump, 999, 0);
! opserv_define_func("GAG", cmd_gag, 600, 0);
! opserv_define_func("GLINE", cmd_gline, 600, 0);
! opserv_define_func("HELPSERV", cmd_helpserv, 800, 0);
! opserv_define_func("HOSTSCAN", cmd_hostscan, 650, 0);
! opserv_define_func("INVITEME", cmd_inviteme, 100, 0);
! opserv_define_func("JOIN", cmd_join, 601, 1);
! opserv_define_func("JUMP", cmd_jump, 900, 0);
! opserv_define_func("JUPE", cmd_jupe, 900, 0);
! opserv_define_func("KICK", cmd_kick, 100, 2);
! opserv_define_func("KICKALL", cmd_kickall, 400, 2);
! opserv_define_func("KICKBAN", cmd_kickban, 100, 2);
! opserv_define_func("KICKBANALL", cmd_kickbanall, 450, 2);
! opserv_define_func("LOG", cmd_log, 900, 0);
! opserv_define_func("LOGINFO", cmd_loginfo, 0, 0);
! opserv_define_func("MODE", cmd_mode, 100, 2);
! opserv_define_func("MODLOG", cmd_modlog, 900, 0);
! opserv_define_func("NICKBAN", cmd_nickban, 100, 2);
! opserv_define_func("OP", cmd_op, 100, 2);
! opserv_define_func("OPALL", cmd_opall, 400, 2);
! opserv_define_func("PART", cmd_part, 601, 2);
! opserv_define_func("QUERY", cmd_query, 0, 0);
! opserv_define_func("RAW", cmd_raw, 999, 0);
! opserv_define_func("RECONNECT", cmd_reconnect, 900, 0);
! opserv_define_func("REFRESHG", cmd_refreshg, 600, 0);
! opserv_define_func("REHASH", cmd_rehash, 900, 0);
! opserv_define_func("REOPEN", cmd_reopen, 900, 0);
! opserv_define_func("RESERVE", cmd_reserve, 800, 0);
! opserv_define_func("RESTART", cmd_restart, 900, 0);
! opserv_define_func("SET", cmd_set, 900, 0);
! opserv_define_func("STATS", cmd_stats, 101, 0);
! opserv_define_func("TRACE", cmd_trace, 100, 0);
! opserv_define_func("TRACE PRINT", NULL, 0, 0);
! opserv_define_func("TRACE COUNT", NULL, 0, 0);
! opserv_define_func("TRACE DOMAINS", NULL, 0, 0);
! opserv_define_func("TRACE SCAN", NULL, 650, 0);
! opserv_define_func("TRACE GLINE", NULL, 600, 0);
! opserv_define_func("TRACE GAG", NULL, 600, 0);
! opserv_define_func("TRACE KILL", NULL, 600, 0);
! opserv_define_func("CSEARCH", cmd_csearch, 100, 0);
! opserv_define_func("GSYNC", cmd_gsync, 600, 0);
! opserv_define_func("GTRACE", cmd_gtrace, 100, 0);
! opserv_define_func("UNBAN", cmd_unban, 100, 2);
! opserv_define_func("UNBANEMAIL", cmd_unban_email, 601, 0);
! opserv_define_func("UNGAG", cmd_ungag, 600, 0);
! opserv_define_func("UNGLINE", cmd_ungline, 600, 0);
! opserv_define_func("UNJUPE", cmd_unjupe, 900, 0);
! opserv_define_func("UNRESERVE", cmd_unreserve, 800, 0);
! opserv_define_func("UNWARN", cmd_unwarn, 800, 0);
! opserv_define_func("VERSION", cmd_version, 0, 0);
! opserv_define_func("VOICEALL", cmd_voiceall, 300, 2);
! opserv_define_func("WARN", cmd_warn, 800, 0);
! opserv_define_func("WHOIS", cmd_whois, 0, 0);
! opserv_define_func("WRITE", cmd_write, 800, 0);
! opserv_define_func("WRITEALL", cmd_writeall, 800, 0);
opserv_reserved_nick_dict = dict_new();
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.183
retrieving revision 1.184
diff -C2 -r1.183 -r1.184
*** nickserv.c 1 Aug 2002 03:20:06 -0000 1.183
--- nickserv.c 3 Aug 2002 04:27:03 -0000 1.184
***************
*** 2734,2738 ****
}
! if (!svccmd_can_invoke(user, nickserv, subcmd, NULL, argc, 0)) {
nickserv_notice(user, NSMSG_NO_ACCESS);
return 0;
--- 2734,2738 ----
}
! if (!svccmd_can_invoke(user, nickserv, subcmd, NULL, 0)) {
nickserv_notice(user, NSMSG_NO_ACCESS);
return 0;
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** modcmd.h 31 Jul 2002 02:42:20 -0000 1.3
--- modcmd.h 3 Aug 2002 04:27:03 -0000 1.4
***************
*** 22,25 ****
--- 22,26 ----
#define MODCMDS_H
+ #include "recdb.h"
#include "helpfile.h"
#include "log.h"
***************
*** 37,59 ****
typedef MODCMD_FUNC(modcmd_func_t);
! #define MODCMD_ACCEPT_CHANNEL 0x001
! #define MODCMD_ACCEPT_PCHANNEL 0x002
! #define MODCMD_REQUIRE_AUTHED 0x004
! #define MODCMD_REQUIRE_CHANNEL 0x008
! #define MODCMD_REQUIRE_REGCHAN 0x010
! #define MODCMD_REQUIRE_CHANUSER 0x020
! #define MODCMD_NO_LOG 0x040
! #define MODCMD_TOY 0x080
! #define MODCMD_DISABLED 0x100
! #define MODCMD_REQUIRE_JOINABLE 0x200
! #define MODCMD_REQUIRE_QUALIFIED 0x0400
! #define MODCMD_KEEP_BOUND 0x0800
! #define MODCMD_REQUIRE_OPER 0x1000
! #define MODCMD_REQUIRE_NETWORK_HELPER 0x2000
! #define MODCMD_REQUIRE_SUPPORT_HELPER 0x4000
#define MODCMD_EXECUTE 1
! #define MODCMD_DROP_CHANNEL 2
! #define MODCMD_LOG_COMMAND 4
/* Modularized commands work like this:
--- 38,62 ----
typedef MODCMD_FUNC(modcmd_func_t);
! /* Miscellaneous flags controlling a command */
! #define MODCMD_DISABLED 0x0001
! #define MODCMD_NO_LOG 0x0002
! #define MODCMD_KEEP_BOUND 0x0004
! #define MODCMD_ACCEPT_CHANNEL 0x0008
! #define MODCMD_ACCEPT_PCHANNEL 0x0010
! #define MODCMD_NO_DEFAULT_BIND 0x0020
! /* Requirement (access control) flags */
! #define MODCMD_REQUIRE_AUTHED 0x001000
! #define MODCMD_REQUIRE_CHANNEL 0x002000
! #define MODCMD_REQUIRE_REGCHAN 0x004000
! #define MODCMD_REQUIRE_CHANUSER 0x008000
! #define MODCMD_REQUIRE_JOINABLE 0x010000
! #define MODCMD_REQUIRE_QUALIFIED 0x020000
! #define MODCMD_REQUIRE_OPER 0x040000
! #define MODCMD_REQUIRE_NETWORK_HELPER 0x080000
! #define MODCMD_REQUIRE_SUPPORT_HELPER 0x100000
! #define MODCMD_REQUIRE_STAFF (MODCMD_REQUIRE_OPER|MODCMD_REQUIRE_NETWORK_HELPER|MODCMD_REQUIRE_SUPPORT_HELPER)
#define MODCMD_EXECUTE 1
! #define MODCMD_LOG_COMMAND 2
/* Modularized commands work like this:
***************
*** 92,105 ****
struct svccmd {
char *name;
! struct service *parent;
! struct modcmd *command;
! void *extra; /* for the command function's use */
! struct svccmd *template; /* where we look for permissions */
! float weight;
! unsigned long req_account_flags, deny_account_flags;
unsigned int flags;
unsigned int min_opserv_level;
unsigned int min_channel_access;
- unsigned int uses; /* how many times was this command used? */
};
--- 95,109 ----
struct svccmd {
char *name;
! struct service *parent; /* where is this command bound? */
! struct modcmd *command; /* what is the implementation? */
! struct string_list alias; /* if it's a complicated binding, what is the expansion? */
! struct svccmd *template; /* where we look for permissions? */
! unsigned int uses; /* how many times was this command used? */
! float weight; /* how much should it count against the command policer? */
unsigned int flags;
+ unsigned long req_account_flags;
+ unsigned long deny_account_flags;
unsigned int min_opserv_level;
unsigned int min_channel_access;
};
***************
*** 156,160 ****
* return non-zero. If they cannot, tell them why not and return 0.
*/
! int svccmd_can_invoke(struct userNode *user, struct userNode *bot, struct svccmd *cmd, struct chanNode *channel, unsigned int argc, unsigned int server_qualified);
/* Initialize the module command subsystem. */
--- 160,164 ----
* return non-zero. If they cannot, tell them why not and return 0.
*/
! int svccmd_can_invoke(struct userNode *user, struct userNode *bot, struct svccmd *cmd, struct chanNode *channel, unsigned int server_qualified);
/* Initialize the module command subsystem. */
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** modcmd.c 1 Aug 2002 03:16:10 -0000 1.6
--- modcmd.c 3 Aug 2002 04:27:03 -0000 1.7
***************
*** 19,25 ****
*/
#include "chanserv.h"
#include "conf.h"
! #include "modcmd.h"
#include "recdb.h"
--- 19,26 ----
*/
[...1304 lines suppressed...]
return svccmd;
--- 1261,1270 ----
return NULL;
}
! svccmd->command = svccmd->template->command;
! if (argc > 1) {
! svccmd->alias.used = svccmd->alias.size = argc;
! svccmd->alias.list = calloc(svccmd->alias.size, sizeof(svccmd->alias.list[0]));
! for (nn=0; nn<argc; nn++) svccmd->alias.list[nn] = strdup(argv[nn]);
! }
dict_insert(service->commands, svccmd->name, svccmd);
return svccmd;
***************
*** 1210,1213 ****
--- 1351,1355 ----
service_make_alias(service, "delop", "deluser", "op", "$1", NULL);
service_make_alias(service, "delpeon", "deluser", "peon", "$1", NULL);
+ service_make_alias(service, "command", "*modcmd.command", NULL);
}
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.257
retrieving revision 1.258
diff -C2 -r1.257 -r1.258
*** chanserv.c 3 Aug 2002 02:37:43 -0000 1.257
--- chanserv.c 3 Aug 2002 04:27:03 -0000 1.258
***************
*** 78,82 ****
/* Command data */
#define KEY_WEIGHT "weight"
- #define KEY_ACCESS "access"
#define KEY_FLAGS "flags"
--- 78,81 ----
***************
*** 344,358 ****
#define CSMSG_NO_LAST_WRITE "$bLast Database Write: $bNever"
#define CSMSG_LAST_WRITE "$bLast Database Write: $b%s ago"
-
- /* Command information */
- #define CSMSG_COMMAND_INFO "Command Information for $b%s$b:"
- #define CSMSG_COMMAND_NO_DISABLE "You may not disable the $b%s$b command."
- #define CSMSG_COMMAND_ACCESS "$bAccess Restrictions: $b%s"
- #define CSMSG_COMMAND_WEIGHT "$bWeight: $b%.1f"
- #define CSMSG_COMMAND_FLAGS "$bFlags: $b%li"
- #define CSMSG_COMMAND_USES "$bUses: $b%d"
- #define CSMSG_COMMAND_ALIASES "$bAliases: $b%s"
-
- #define CSMSG_COMMAND_IS_ALIAS "%s is an alias for $b%s$b."
/* Staff list */
--- 343,346 ----
|
|
From: Entrope <en...@us...> - 2002-08-03 02:37:46
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv23236/src
Modified Files:
chanserv.c
Log Message:
remove extra space from CSMSG_TRIMMED_BANS (thanks for noticing, Geenius)
change !say and !emote to be allow non-channel targets
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.256
retrieving revision 1.257
diff -C2 -r1.256 -r1.257
*** chanserv.c 1 Aug 2002 03:20:05 -0000 1.256
--- chanserv.c 3 Aug 2002 02:37:43 -0000 1.257
***************
*** 199,203 ****
#define CSMSG_BAN_EXTENDED "Extended ban for $b%s$b expires in %s."
#define CSMSG_BAN_REMOVED "Matching ban(s) for $b%s$b removed."
! #define CSMSG_TRIMMED_BANS "Trimmed $b%d bans$b from the %s ban list that were inactive for at least %s."
#define CSMSG_REDUNDANT_BAN "$b%s$b is already banned in %s."
#define CSMSG_INVALID_DURATION "Timed bans must last for $b%s$b %s."
--- 199,203 ----
#define CSMSG_BAN_EXTENDED "Extended ban for $b%s$b expires in %s."
#define CSMSG_BAN_REMOVED "Matching ban(s) for $b%s$b removed."
! #define CSMSG_TRIMMED_BANS "Trimmed $b%d bans$b from the %s ban list that were inactive for at least %s."
#define CSMSG_REDUNDANT_BAN "$b%s$b is already banned in %s."
#define CSMSG_INVALID_DURATION "Timed bans must last for $b%s$b %s."
***************
*** 4507,4517 ****
static CHANSERV_FUNC(cmd_say)
{
! (void)user;
!
! REQUIRE_PARAMS(2);
!
! unsplit_string(argv + 1, argc - 1);
! send_channel_message(channel, chanserv, "%s", argv[1]);
!
return 1;
}
--- 4507,4521 ----
static CHANSERV_FUNC(cmd_say)
{
! assert(argc >= 2); (void)user;
! if (channel) {
! unsplit_string(argv + 1, argc - 1);
! send_channel_message(channel, cmd->parent->bot, "%s", argv[1]);
! } else if (GetUserH(argv[1])) {
! unsplit_string(argv + 2, argc - 2);
! send_target_message(1, argv[1], cmd->parent->bot, "%s", argv[2]);
! } else {
! send_message(user, cmd->parent->bot, "You must specify the name of a channel or user.");
! return 0;
! }
return 1;
}
***************
*** 4519,4530 ****
static CHANSERV_FUNC(cmd_emote)
{
! (void)user;
!
! REQUIRE_PARAMS(2);
!
! /* CTCP is so annoying. */
! unsplit_string(argv + 1, argc - 1);
! send_channel_message(channel, chanserv, "\001ACTION %s\001", argv[1]);
!
return 1;
}
--- 4523,4538 ----
static CHANSERV_FUNC(cmd_emote)
{
! assert(argc >= 2); (void)user;
! if (channel) {
! /* CTCP is so annoying. */
! unsplit_string(argv + 1, argc - 1);
! send_channel_message(channel, cmd->parent->bot, "\001ACTION %s\001", argv[1]);
! } else if (GetUserH(argv[1])) {
! unsplit_string(argv + 2, argc - 2);
! send_target_message(1, argv[1], cmd->parent->bot, "\001ACTION %s\001", argv[2]);
! } else {
! send_message(user, cmd->parent->bot, "You must specify the name of a channel or user.");
! return 0;
! }
return 1;
}
***************
*** 7054,7059 ****
DEFINE_COMMAND(version, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(say, 2, MODCMD_REQUIRE_CHANNEL, "flags", "+oper", NULL);
! DEFINE_COMMAND(emote, 2, MODCMD_REQUIRE_CHANNEL, "flags", "+oper", NULL);
DEFINE_COMMAND(expire, 1, 0, "flags", "+oper", NULL);
DEFINE_COMMAND(write, 1, MODCMD_REQUIRE_AUTHED, "flags", "+oper", NULL);
--- 7062,7067 ----
DEFINE_COMMAND(version, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(say, 2, 0, "flags", "+oper,+acceptchan", NULL);
! DEFINE_COMMAND(emote, 2, 0, "flags", "+oper,+acceptchan", NULL);
DEFINE_COMMAND(expire, 1, 0, "flags", "+oper", NULL);
DEFINE_COMMAND(write, 1, MODCMD_REQUIRE_AUTHED, "flags", "+oper", NULL);
***************
*** 7062,7071 ****
DEFINE_COMMAND(unvisited, 1, 0, "account_flags", "+g", "flags", "+nolog", NULL);
! DEFINE_COMMAND(unf, 1, 0, "flags", "+nolog,+toy", NULL);
! DEFINE_COMMAND(ping, 1, 0, "flags", "+nolog,+toy", NULL);
! DEFINE_COMMAND(wut, 1, 0, "flags", "+nolog,+toy", NULL);
! DEFINE_COMMAND(8ball, 1, 0, "flags", "+nolog,+toy", NULL);
! DEFINE_COMMAND(d, 1, 0, "flags", "+nolog,+toy", NULL);
! DEFINE_COMMAND(huggle, 1, 0, "flags", "+nolog,+toy", NULL);
set_func_dict = dict_new();
--- 7070,7079 ----
DEFINE_COMMAND(unvisited, 1, 0, "account_flags", "+g", "flags", "+nolog", NULL);
! DEFINE_COMMAND(unf, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(ping, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(wut, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(8ball, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(d, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(huggle, 1, 0, "flags", "+nolog", NULL);
set_func_dict = dict_new();
|
|
From: Entrope <en...@us...> - 2002-08-03 02:26:21
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv21154/src Modified Files: compat.h recdb.c Log Message: move #include <setjmp.h> into compat.h for uniformity Index: compat.h =================================================================== RCS file: /cvsroot/srvx/services/src/compat.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** compat.h 31 Jul 2002 02:37:37 -0000 1.9 --- compat.h 3 Aug 2002 02:26:18 -0000 1.10 *************** *** 13,16 **** --- 13,17 ---- #include <errno.h> #include <limits.h> + #include <setjmp.h> #include <signal.h> #include <stdarg.h> Index: recdb.c =================================================================== RCS file: /cvsroot/srvx/services/src/recdb.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** recdb.c 30 Jul 2002 02:15:11 -0000 1.39 --- recdb.c 3 Aug 2002 02:26:18 -0000 1.40 *************** *** 22,27 **** #include "log.h" - #include <setjmp.h> - /* file format (grammar in Backus-Naur Form): * --- 22,25 ---- |
|
From: Zoot <zo...@us...> - 2002-08-02 00:41:19
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21650/src
Modified Files:
proto-bahamut.c
Log Message:
Fix a compile warning in the Bahamut protocol support and process ping messages in the same way the P10 code does for consistency.
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** proto-bahamut.c 8 Jul 2002 15:45:32 -0000 1.7
--- proto-bahamut.c 2 Aug 2002 00:41:16 -0000 1.8
***************
*** 120,123 ****
--- 120,128 ----
}
+ if (!is_valid_nick(nick)) {
+ log(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): invalid nickname detected.\n", uplink, nick);
+ return NULL;
+ }
+
if (strlen(nick) > nicklen) {
log(MAIN_LOG, LOG_ERROR, "AddUser(%p, %s, ...): nick too long (detected max is %d)\n", uplink, nick, nicklen);
***************
*** 659,665 ****
static CMD_FUNC(cmd_ping)
{
! (void)origin;
! if (argc < 2) return 0;
! irc_pong(argv[1]);
timeq_del(0, timed_send_ping, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
timeq_del(0, timed_ping_timeout, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
--- 664,669 ----
static CMD_FUNC(cmd_ping)
{
! (void)argv;(void)argc;
! irc_pong(origin);
timeq_del(0, timed_send_ping, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
timeq_del(0, timed_ping_timeout, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
|
|
From: Zoot <zo...@us...> - 2002-08-02 00:15:33
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv15778/src
Modified Files:
proto-p10.c
Log Message:
Handle pings from the uplink (and other servers) properly.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** proto-p10.c 8 Jul 2002 15:19:30 -0000 1.6
--- proto-p10.c 2 Aug 2002 00:15:25 -0000 1.7
***************
*** 685,691 ****
static CMD_FUNC(cmd_ping)
{
! if (argc < 3) return 0;
! (void)origin;
! irc_pong(argv[2]);
timeq_del(0, timed_send_ping, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
timeq_del(0, timed_ping_timeout, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
--- 685,690 ----
static CMD_FUNC(cmd_ping)
{
! (void)argc;(void)argv;
! irc_pong(origin);
timeq_del(0, timed_send_ping, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
timeq_del(0, timed_ping_timeout, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
|
|
From: Entrope <en...@us...> - 2002-08-01 03:20:09
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv3535/src
Modified Files:
chanserv.c global.c nickserv.c opserv.c
Log Message:
make services use simpler/smarter svccmd_send_help() instead of svccmd_send_help_2()
fix !register to only require one argument (in case an existing channel is named)
allow a reason to be specified for ?part
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.255
retrieving revision 1.256
diff -C2 -r1.255 -r1.256
*** chanserv.c 1 Aug 2002 01:23:51 -0000 1.255
--- chanserv.c 1 Aug 2002 03:20:05 -0000 1.256
***************
*** 419,423 ****
#define CHANSERV_FUNC(NAME) MODCMD_FUNC(NAME)
! #define CHANSERV_SYNTAX() svccmd_send_help_2(user, chanserv, chanserv_service, argv[0])
#define REQUIRE_PARAMS(N) if(argc < N) { \
chanserv_notice(user, MSG_MISSING_PARAMS, argv[0]); \
--- 419,423 ----
#define CHANSERV_FUNC(NAME) MODCMD_FUNC(NAME)
! #define CHANSERV_SYNTAX() svccmd_send_help(user, chanserv, cmd)
#define REQUIRE_PARAMS(N) if(argc < N) { \
chanserv_notice(user, MSG_MISSING_PARAMS, argv[0]); \
***************
*** 2376,2380 ****
static int
! cmd_mdel_user(struct userNode *user, struct chanNode *channel, enum userLevel access, unsigned int argc, unsigned char *argv[])
{
struct userData *actor, *uData, *next;
--- 2376,2380 ----
static int
! cmd_mdel_user(struct userNode *user, struct chanNode *channel, enum userLevel access, unsigned int argc, unsigned char *argv[], struct svccmd *cmd)
{
struct userData *actor, *uData, *next;
***************
*** 2412,2436 ****
static CHANSERV_FUNC(cmd_mdelowner)
{
! return cmd_mdel_user(user, channel, ulOwner, argc, argv);
}
static CHANSERV_FUNC(cmd_mdelcoowner)
{
! return cmd_mdel_user(user, channel, ulCoowner, argc, argv);
}
static CHANSERV_FUNC(cmd_mdelmaster)
{
! return cmd_mdel_user(user, channel, ulMaster, argc, argv);
}
static CHANSERV_FUNC(cmd_mdelop)
{
! return cmd_mdel_user(user, channel, ulOp, argc, argv);
}
static CHANSERV_FUNC(cmd_mdelpeon)
{
! return cmd_mdel_user(user, channel, ulPeon, argc, argv);
}
--- 2412,2436 ----
static CHANSERV_FUNC(cmd_mdelowner)
{
! return cmd_mdel_user(user, channel, ulOwner, argc, argv, cmd);
}
static CHANSERV_FUNC(cmd_mdelcoowner)
{
! return cmd_mdel_user(user, channel, ulCoowner, argc, argv, cmd);
}
static CHANSERV_FUNC(cmd_mdelmaster)
{
! return cmd_mdel_user(user, channel, ulMaster, argc, argv, cmd);
}
static CHANSERV_FUNC(cmd_mdelop)
{
! return cmd_mdel_user(user, channel, ulOp, argc, argv, cmd);
}
static CHANSERV_FUNC(cmd_mdelpeon)
{
! return cmd_mdel_user(user, channel, ulPeon, argc, argv, cmd);
}
***************
*** 6977,6981 ****
chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);
DEFINE_COMMAND(god, 1, MODCMD_REQUIRE_AUTHED, "flags", "+oper,+networkhelper", NULL);
! DEFINE_COMMAND(register, 2, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", "flags", "+acceptchan", NULL);
DEFINE_COMMAND(noregister, 2, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", NULL);
DEFINE_COMMAND(noregisters, 2, MODCMD_REQUIRE_AUTHED, "template", "noregister", NULL);
--- 6977,6981 ----
chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);
DEFINE_COMMAND(god, 1, MODCMD_REQUIRE_AUTHED, "flags", "+oper,+networkhelper", NULL);
! DEFINE_COMMAND(register, 1, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", "flags", "+acceptchan", NULL);
DEFINE_COMMAND(noregister, 2, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", NULL);
DEFINE_COMMAND(noregisters, 2, MODCMD_REQUIRE_AUTHED, "template", "noregister", NULL);
Index: global.c
===================================================================
RCS file: /cvsroot/srvx/services/src/global.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** global.c 30 Jul 2002 02:15:11 -0000 1.46
--- global.c 1 Aug 2002 03:20:06 -0000 1.47
***************
*** 71,75 ****
#define GMSG_MESSAGE_FORMAT recipients, from, posted
! #define GLOBAL_SYNTAX() svccmd_send_help_2(user, global, global_service, argv[0])
#define GLOBAL_FUNC(NAME) MODCMD_FUNC(NAME)
--- 71,75 ----
#define GMSG_MESSAGE_FORMAT recipients, from, posted
! #define GLOBAL_SYNTAX() svccmd_send_help(user, global, cmd)
#define GLOBAL_FUNC(NAME) MODCMD_FUNC(NAME)
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -C2 -r1.182 -r1.183
*** nickserv.c 31 Jul 2002 02:41:50 -0000 1.182
--- nickserv.c 1 Aug 2002 03:20:06 -0000 1.183
***************
*** 232,236 ****
DEFINE_LIST(handle_info_list, struct handle_info*);
! #define NICKSERV_SYNTAX() svccmd_send_help_2(nickserv, user, nickserv_service, argv[0])
#define NICKSERV_MIN_PARMS(N) do { \
(void)argv; \
--- 232,236 ----
DEFINE_LIST(handle_info_list, struct handle_info*);
! #define NICKSERV_SYNTAX() svccmd_send_help(user, nickserv, cmd)
#define NICKSERV_MIN_PARMS(N) do { \
(void)argv; \
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.252
retrieving revision 1.253
diff -C2 -r1.252 -r1.253
*** opserv.c 1 Aug 2002 00:00:39 -0000 1.252
--- opserv.c 1 Aug 2002 03:20:06 -0000 1.253
***************
*** 275,279 ****
#define OPSERV_FUNC(NAME) MODCMD_FUNC(NAME)
! #define OPSERV_SYNTAX() svccmd_send_help_2(opserv, user, opserv_service, argv[0])
#define OPSERV_NEED_CHANNEL() do { if (!channel) { \
opserv_notice(user, MSG_INVALID_CHANNEL); \
--- 275,279 ----
#define OPSERV_FUNC(NAME) MODCMD_FUNC(NAME)
! #define OPSERV_SYNTAX() svccmd_send_help(user, opserv, cmd)
#define OPSERV_NEED_CHANNEL() do { if (!channel) { \
opserv_notice(user, MSG_INVALID_CHANNEL); \
***************
*** 569,573 ****
unsigned int count, n;
! OPSERV_NEED_CHANNEL(); (void)argc;
for (count=n=0; n<channel->banlist.used; n++) {
list[count++] = channel->banlist.list[n]->ban;
--- 569,573 ----
unsigned int count, n;
! OPSERV_NEED_CHANNEL(); (void)argc; (void)argv;
for (count=n=0; n<channel->banlist.used; n++) {
list[count++] = channel->banlist.list[n]->ban;
***************
*** 588,592 ****
char buffer[400];
! OPSERV_NEED_CHANNEL(); (void)argc;
if (irc_make_chanmode(channel, buffer)) {
channel->modes = 0;
--- 588,592 ----
char buffer[400];
! OPSERV_NEED_CHANNEL(); (void)argc; (void)argv;
if (irc_make_chanmode(channel, buffer)) {
channel->modes = 0;
***************
*** 632,636 ****
unsigned int count, n;
! OPSERV_NEED_CHANNEL(); (void)argc;
for (count=n=0; n<channel->members.used; n++) {
mn = channel->members.list[n];
--- 632,636 ----
unsigned int count, n;
! OPSERV_NEED_CHANNEL(); (void)argc; (void)argv;
for (count=n=0; n<channel->members.used; n++) {
mn = channel->members.list[n];
***************
*** 1128,1134 ****
static OPSERV_FUNC(cmd_part)
{
! OPSERV_NEED_CHANNEL(); (void)argc;
opserv_notice(user, OSMSG_LEAVING, channel->name);
! DelChannelUser(opserv, channel, "Leaving.", 0);
return 1;
}
--- 1128,1141 ----
static OPSERV_FUNC(cmd_part)
{
! char *reason;
! OPSERV_NEED_CHANNEL();
! if (argc < 2) {
! reason = "Leaving.";
! } else {
! unsplit_string(argv+1, argc-1);
! reason = argv[1];
! }
opserv_notice(user, OSMSG_LEAVING, channel->name);
! DelChannelUser(opserv, channel, reason, 0);
return 1;
}
|
|
From: Entrope <en...@us...> - 2002-08-01 03:16:13
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv2908/src
Modified Files:
modcmd.c
Log Message:
fix some more command aliasing bugs
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** modcmd.c 31 Jul 2002 03:42:12 -0000 1.5
--- modcmd.c 1 Aug 2002 03:16:10 -0000 1.6
***************
*** 562,566 ****
return svccmd_send_help(user, bot, cmd);
} else {
! /* TODO: fall back to a default helpfile (or module helpfile) instead */
send_message(user, bot, MSG_TOPIC_UNKNOWN);
return 0;
--- 562,566 ----
return svccmd_send_help(user, bot, cmd);
} else {
! /* TODO: try to send from the default helpfile (or default module's helpfile) instead */
send_message(user, bot, MSG_TOPIC_UNKNOWN);
return 0;
***************
*** 1032,1036 ****
static void
! modcmd_db_load_service(struct service *service, const char *cmdname, dict_t obj) {
struct svccmd *svccmd;
struct module *module;
--- 1032,1036 ----
static void
! modcmd_db_load_command(struct service *service, const char *cmdname, dict_t obj) {
struct svccmd *svccmd;
struct module *module;
***************
*** 1086,1090 ****
expn = calloc(1, sizeof(*expn) + (slist->used-1)*sizeof(expn->argv[0]));
! expn->base = svccmd;
for (nn=0; nn<slist->used; ++nn) expn->argv[nn] = strdup(slist->list[nn]);
expn->argc = nn;
--- 1086,1090 ----
expn = calloc(1, sizeof(*expn) + (slist->used-1)*sizeof(expn->argv[0]));
! expn->base = modcmd->defaults;
for (nn=0; nn<slist->used; ++nn) expn->argv[nn] = strdup(slist->list[nn]);
expn->argc = nn;
***************
*** 1158,1162 ****
continue;
}
! modcmd_db_load_service(service, iter_key(it2), rd2->d.object);
}
}
--- 1158,1162 ----
continue;
}
! modcmd_db_load_command(service, iter_key(it2), rd2->d.object);
}
}
|
|
From: Zoot <zo...@us...> - 2002-08-01 01:23:55
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv13667/src
Modified Files:
chanserv.c
Log Message:
Split ChanServ's noregister command into two; one to add noregisters and another to search them.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.254
retrieving revision 1.255
diff -C2 -r1.254 -r1.255
*** chanserv.c 31 Jul 2002 02:36:55 -0000 1.254
--- chanserv.c 1 Aug 2002 01:23:51 -0000 1.255
***************
*** 131,136 ****
/* Do-not-register channels */
#define CSMSG_DNR_INFO "$b%s$b is do-not-register (by $b%s$b): %s"
- #define CSMSG_END_DNR_LIST "End of do-not-register list."
#define CSMSG_DNR_CHANNEL "Only network staff may register $b%s$b."
#define CSMSG_DNR_CHANNEL_MOVE "Only network staff may move $b%s$b."
--- 131,136 ----
/* Do-not-register channels */
+ #define CSMSG_NOT_DNR "$b%s$b is not a valid channel name or *handle."
#define CSMSG_DNR_INFO "$b%s$b is do-not-register (by $b%s$b): %s"
#define CSMSG_DNR_CHANNEL "Only network staff may register $b%s$b."
#define CSMSG_DNR_CHANNEL_MOVE "Only network staff may move $b%s$b."
***************
*** 1504,1545 ****
static CHANSERV_FUNC(cmd_noregister)
{
! const char *chan_name = NULL;
unsigned int arg = 1;
- struct do_not_register *dnr;
! if(channel)
{
! if((argc > 1) && (argv[1][0] == '*')) {
! chan_name = argv[1];
! arg = 2;
! } else {
! chan_name = channel->name;
! }
}
! else if(argc > 1)
{
! if(!IsCSChannelName(argv[1]) && (argv[1][0] != '*'))
! {
! chanserv_notice(user, MSG_NOT_CHANNEL_NAME);
! return 0;
! }
! chan_name = argv[1];
! arg = 2;
}
! if(chan_name && (arg < argc))
{
! unsplit_string(argv+arg, argc-arg);
! if((argv[arg][0] == '*') && !get_handle_info(argv[arg]+1))
! {
! chanserv_notice(user, MSG_HANDLE_UNKNOWN, argv[arg]+1);
! }
! else
! {
! chanserv_add_dnr(chan_name, user->handle_info->handle, argv[arg]);
! chanserv_notice(user, CSMSG_NOREGISTER_CHANNEL, chan_name);
! }
}
! else if(chan_name && (dnr = chanserv_is_dnr(chan_name, 0)))
{
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
--- 1504,1546 ----
static CHANSERV_FUNC(cmd_noregister)
{
! const char *target = NULL;
unsigned int arg = 1;
! if(IsCSChannelName(argv[1]) || (*argv[1] == '*'))
{
! REQUIRE_PARAMS(3);
!
! target = argv[1];
! arg = 2;
}
! else if(channel)
{
! target = channel->name;
! }
! else
! {
! chanserv_notice(user, CSMSG_NOT_DNR, argv[1]);
! return 0;
}
! unsplit_string(argv + arg, argc - arg);
! if((*target == '*') && !get_handle_info(target + 1))
{
! chanserv_notice(user, MSG_HANDLE_UNKNOWN, target + 1);
! return 0;
}
!
! chanserv_add_dnr(target, user->handle_info->handle, argv[arg]);
! chanserv_notice(user, CSMSG_NOREGISTER_CHANNEL, target);
!
! return 1;
! }
!
! static CHANSERV_FUNC(cmd_noregisters)
! {
! struct do_not_register *dnr;
! (void)argc;
!
! if((dnr = chanserv_is_dnr(argv[1], 0)))
{
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
***************
*** 1547,1568 ****
else
{
dict_iterator_t it;
for (it = dict_first(handle_dnrs); it; it = iter_next(it))
{
dnr = iter_data(it);
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
}
for (it = dict_first(plain_dnrs); it; it = iter_next(it))
{
dnr = iter_data(it);
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
}
for (it = dict_first(mask_dnrs); it; it = iter_next(it))
{
dnr = iter_data(it);
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
}
- chanserv_notice(user, CSMSG_END_DNR_LIST);
}
--- 1548,1594 ----
else
{
+ unsigned int matches = 0;
dict_iterator_t it;
+ chanserv_notice(user, MSG_SEARCH_RESULTS, "do-not-registers");
for (it = dict_first(handle_dnrs); it; it = iter_next(it))
{
+ if(!match_ircglob(iter_key(it), argv[1]))
+ {
+ continue;
+ }
dnr = iter_data(it);
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
+ matches++;
}
for (it = dict_first(plain_dnrs); it; it = iter_next(it))
{
+ if(!match_ircglob(iter_key(it), argv[1]))
+ {
+ continue;
+ }
dnr = iter_data(it);
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
+ matches++;
}
for (it = dict_first(mask_dnrs); it; it = iter_next(it))
{
+ if(!match_ircglobs(argv[1], iter_key(it)))
+ {
+ continue;
+ }
dnr = iter_data(it);
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
+ matches++;
+ }
+
+ if(matches)
+ {
+ chanserv_notice(user, MSG_MATCH_COUNT, matches);
+ }
+ else
+ {
+ chanserv_notice(user, MSG_NO_MATCHES);
}
}
***************
*** 6952,6956 ****
DEFINE_COMMAND(god, 1, MODCMD_REQUIRE_AUTHED, "flags", "+oper,+networkhelper", NULL);
DEFINE_COMMAND(register, 2, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", "flags", "+acceptchan", NULL);
! DEFINE_COMMAND(noregister, 3, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", NULL);
DEFINE_COMMAND(allowregister, 2, 0, "template", "noregister", NULL);
DEFINE_COMMAND(move, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "template", "register", NULL);
--- 6978,6983 ----
DEFINE_COMMAND(god, 1, MODCMD_REQUIRE_AUTHED, "flags", "+oper,+networkhelper", NULL);
DEFINE_COMMAND(register, 2, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", "flags", "+acceptchan", NULL);
! DEFINE_COMMAND(noregister, 2, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", NULL);
! DEFINE_COMMAND(noregisters, 2, MODCMD_REQUIRE_AUTHED, "template", "noregister", NULL);
DEFINE_COMMAND(allowregister, 2, 0, "template", "noregister", NULL);
DEFINE_COMMAND(move, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "template", "register", NULL);
|
|
From: Zoot <zo...@us...> - 2002-08-01 00:01:04
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv26830/src
Modified Files:
Tag: rel-1_1-branch
opserv.c
Log Message:
Properly check for valid channel names in trace.
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.235.2.5
retrieving revision 1.235.2.6
diff -C2 -r1.235.2.5 -r1.235.2.6
*** opserv.c 26 Jul 2002 04:08:43 -0000 1.235.2.5
--- opserv.c 1 Aug 2002 00:00:50 -0000 1.235.2.6
***************
*** 3516,3520 ****
discrim->chan_req_modes |= MODE_CHANOP;
break;
! case '0':
opserv_notice(user, MSG_NOT_CHANNEL_NAME);
goto fail;
--- 3516,3520 ----
discrim->chan_req_modes |= MODE_CHANOP;
break;
! case '\0':
opserv_notice(user, MSG_NOT_CHANNEL_NAME);
goto fail;
|
|
From: Zoot <zo...@us...> - 2002-08-01 00:00:43
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv26848/src
Modified Files:
opserv.c
Log Message:
Properly check for valid channel names in trace.
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.251
retrieving revision 1.252
diff -C2 -r1.251 -r1.252
*** opserv.c 30 Jul 2002 19:38:56 -0000 1.251
--- opserv.c 1 Aug 2002 00:00:39 -0000 1.252
***************
*** 3203,3207 ****
discrim->chan_req_modes |= MODE_CHANOP;
break;
! case '0':
opserv_notice(user, MSG_NOT_CHANNEL_NAME);
goto fail;
--- 3203,3207 ----
discrim->chan_req_modes |= MODE_CHANOP;
break;
! case '\0':
opserv_notice(user, MSG_NOT_CHANNEL_NAME);
goto fail;
|
|
From: Entrope <en...@us...> - 2002-07-31 03:42:15
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv2422/src
Modified Files:
modcmd.c
Log Message:
fix return value when argc < min_argc
fix infinite recursion when expanding an alias
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** modcmd.c 31 Jul 2002 02:40:15 -0000 1.4
--- modcmd.c 31 Jul 2002 03:42:12 -0000 1.5
***************
*** 34,38 ****
struct alias_expansion {
! struct modcmd *base;
unsigned int argc;
unsigned char *argv[1]; /* may secretly be longer than 1 element */
--- 34,38 ----
struct alias_expansion {
! struct svccmd *base;
unsigned int argc;
unsigned char *argv[1]; /* may secretly be longer than 1 element */
***************
*** 318,331 ****
if (!base_cmd) return 0;
- if (base_cmd->command->min_argc > argc) {
- send_message(user, bot, MSG_MISSING_PARAMS, base_cmd->name);
- goto refuse;
- }
memset(&cmd, 0, sizeof(cmd));
cmd.name = base_cmd->name;
cmd.flags = base_cmd->command->flags;
! for(cmd2 = base_cmd; cmd2; cmd2 = cmd2->template)
! {
cmd.flags |= cmd2->flags;
cmd.req_account_flags |= cmd2->req_account_flags;
--- 318,326 ----
if (!base_cmd) return 0;
memset(&cmd, 0, sizeof(cmd));
cmd.name = base_cmd->name;
cmd.flags = base_cmd->command->flags;
! for (cmd2 = base_cmd; cmd2; cmd2 = cmd2->template) {
cmd.flags |= cmd2->flags;
cmd.req_account_flags |= cmd2->req_account_flags;
***************
*** 345,348 ****
--- 340,347 ----
if (cmd.flags & (MODCMD_REQUIRE_NETWORK_HELPER|MODCMD_REQUIRE_SUPPORT_HELPER)) cmd.flags |= MODCMD_REQUIRE_AUTHED;
+ if (base_cmd->command->min_argc > argc) {
+ send_message(user, bot, MSG_MISSING_PARAMS, base_cmd->name);
+ goto refuse;
+ }
if (cmd.min_opserv_level > 0) {
if (!oper_has_access(user, bot, cmd.min_opserv_level, 0)) goto refuse;
***************
*** 559,568 ****
int
svccmd_send_help_2(struct userNode *user, struct userNode *bot, struct service *service, const char *topic) {
! struct svccmd *cmd = dict_find(service->commands, topic, NULL);
! if (!cmd) {
send_message(user, bot, MSG_TOPIC_UNKNOWN);
return 0;
}
- return svccmd_send_help(user, bot, cmd);
}
--- 558,569 ----
int
svccmd_send_help_2(struct userNode *user, struct userNode *bot, struct service *service, const char *topic) {
! struct svccmd *cmd;
! if ((cmd = dict_find(service->commands, topic, NULL))) {
! return svccmd_send_help(user, bot, cmd);
! } else {
! /* TODO: fall back to a default helpfile (or module helpfile) instead */
send_message(user, bot, MSG_TOPIC_UNKNOWN);
return 0;
}
}
***************
*** 723,736 ****
}
}
! return svccmd_invoke_real(user, cmd->parent, cmd, channel, new_argc, new_argv, 0);
}
static MODCMD_FUNC(cmd_bind) {
struct service *service;
- struct module *module;
- struct modcmd *basecmd;
struct svccmd *template, *newcmd;
! char *svcname, *newname, *cmdname, *sep;
! char buf[MAXLEN];
assert(argc > 3);
--- 724,734 ----
}
}
! return svccmd_invoke_real(user, cmd->parent, exp->base, channel, new_argc, new_argv, 0);
}
static MODCMD_FUNC(cmd_bind) {
struct service *service;
struct svccmd *template, *newcmd;
! char *svcname, *newname, *cmdname;
assert(argc > 3);
***************
*** 744,777 ****
}
! if ((basecmd = dict_find(service->commands, newname, NULL))) {
send_message(user, cmd->parent->bot, "%s already has a command bound as %s", service->bot->nick, newname);
return 0;
}
- if ((sep = strchr(cmdname, '.'))) {
- memcpy(buf, cmdname, sep-cmdname);
- buf[sep-cmdname] = 0;
- if (!(module = module_find(buf))) {
- send_message(user, cmd->parent->bot, MSG_MODULE_UNKNOWN, buf);
- return 0;
- }
- if (!(basecmd = dict_find(module->commands, sep+1, NULL))) {
- send_message(user, cmd->parent->bot, "Unknown command name %s (in module %s)", sep+1, module->name);
- return 0;
- }
- template = basecmd->defaults;
- } else {
- if (!(template = dict_find(service->commands, cmdname, NULL))) {
- send_message(user, cmd->parent->bot, "%s has nothing bound as command %s", service->bot->nick, cmdname);
- return 0;
- }
- basecmd = template->command;
- }
-
newcmd = calloc(1, sizeof(*newcmd));
newcmd->name = strdup(newname);
newcmd->parent = service;
! newcmd->command = basecmd;
newcmd->template = template;
if (argc > 4) {
--- 742,761 ----
}
! if ((newcmd = dict_find(service->commands, newname, NULL))) {
send_message(user, cmd->parent->bot, "%s already has a command bound as %s", service->bot->nick, newname);
return 0;
}
newcmd = calloc(1, sizeof(*newcmd));
newcmd->name = strdup(newname);
newcmd->parent = service;
! if (!(template = svccmd_resolve_name(newcmd, cmdname))) {
! send_message(user, cmd->parent->bot, "Unknown command name %s (relative to service %s)", cmdname, service->bot->nick);
! free(newcmd->name);
! free(newcmd);
! return 0;
! }
newcmd->template = template;
+ newcmd->command = template->command;
if (argc > 4) {
***************
*** 788,792 ****
}
exp = calloc(1, sizeof(*exp)+(argc-4)*sizeof(exp->argv[0]));
! exp->base = basecmd;
exp->argc = argc - 3;
newcmd->command = expand_alias_command;
--- 772,776 ----
}
exp = calloc(1, sizeof(*exp)+(argc-4)*sizeof(exp->argv[0]));
! exp->base = template;
exp->argc = argc - 3;
newcmd->command = expand_alias_command;
***************
*** 845,849 ****
}
dict_insert(obj, "aliased", alloc_record_data_string_list(slist));
! modcmd = expn->base;
} else {
modcmd = cmd->command;
--- 829,833 ----
}
dict_insert(obj, "aliased", alloc_record_data_string_list(slist));
! modcmd = expn->base->command;
} else {
modcmd = cmd->command;
***************
*** 889,893 ****
}
if (cmd->template != modcmd->defaults) {
! if (cmd->template->parent) {
sprintf(buf, "%s.%s", cmd->template->parent->bot->nick, cmd->template->name);
} else {
--- 873,879 ----
}
if (cmd->template != modcmd->defaults) {
! if (cmd->template->parent == cmd->parent) {
! sprintf(buf, "%s", cmd->template->name);
! } else if (cmd->template->parent) {
sprintf(buf, "%s.%s", cmd->template->parent->bot->nick, cmd->template->name);
} else {
***************
*** 1100,1104 ****
expn = calloc(1, sizeof(*expn) + (slist->used-1)*sizeof(expn->argv[0]));
! expn->base = svccmd->command;
for (nn=0; nn<slist->used; ++nn) expn->argv[nn] = strdup(slist->list[nn]);
expn->argc = nn;
--- 1086,1090 ----
expn = calloc(1, sizeof(*expn) + (slist->used-1)*sizeof(expn->argv[0]));
! expn->base = svccmd;
for (nn=0; nn<slist->used; ++nn) expn->argv[nn] = strdup(slist->list[nn]);
expn->argc = nn;
***************
*** 1137,1141 ****
}
svccmd->extra = expn = calloc(1, sizeof(*expn) + (argc-1)*sizeof(expn->argv[0]));
! expn->base = svccmd->template->command;
expn->argc = argc;
for (nn=0; nn<argc; nn++) expn->argv[nn] = strdup(argv[nn]);
--- 1123,1127 ----
}
svccmd->extra = expn = calloc(1, sizeof(*expn) + (argc-1)*sizeof(expn->argv[0]));
! expn->base = svccmd->template;
expn->argc = argc;
for (nn=0; nn<argc; nn++) expn->argv[nn] = strdup(argv[nn]);
|
|
From: Entrope <en...@us...> - 2002-07-31 02:42:22
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv22097/src Modified Files: modcmd.h Log Message: correct comment about command access checking Index: modcmd.h =================================================================== RCS file: /cvsroot/srvx/services/src/modcmd.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** modcmd.h 31 Jul 2002 02:40:15 -0000 1.2 --- modcmd.h 31 Jul 2002 02:42:20 -0000 1.3 *************** *** 77,82 **** * When checking to see if a user may invoke a command, the "template" * chain is followed, and the user must meet all the requirements ! * before the command is executed. [This is not how it should be; ! * staff access should be any-of instead of all-of.] */ --- 77,83 ---- * When checking to see if a user may invoke a command, the "template" * chain is followed, and the user must meet all the requirements ! * before the command is executed. As an exception, for the "staff" ! * permission checks (oper/network helper/support helper), any one is ! * sufficient to permit the command usage. */ |
|
From: Entrope <en...@us...> - 2002-07-31 02:41:53
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21959/src
Modified Files:
nickserv.c
Log Message:
mark auth as a MODCMD_KEEP_BOUND command
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -C2 -r1.181 -r1.182
*** nickserv.c 30 Jul 2002 02:15:11 -0000 1.181
--- nickserv.c 31 Jul 2002 02:41:50 -0000 1.182
***************
*** 3165,3169 ****
nickserv_module = module_register("NickServ", NS_LOG, "nickserv.help", nickserv_help_expand);
! nickserv_define_func("AUTH", cmd_auth, -1, 0, 1);
nickserv_define_func("ALLOWAUTH", cmd_allowauth, 0, 1, 0);
nickserv_define_func("REGISTER", cmd_register, -1, 0, 1);
--- 3165,3169 ----
nickserv_module = module_register("NickServ", NS_LOG, "nickserv.help", nickserv_help_expand);
! modcmd_register(nickserv_module, "AUTH", cmd_auth, 2, MODCMD_KEEP_BOUND, "flags", "+qualified", NULL);
nickserv_define_func("ALLOWAUTH", cmd_allowauth, 0, 1, 0);
nickserv_define_func("REGISTER", cmd_register, -1, 0, 1);
|
|
From: Entrope <en...@us...> - 2002-07-31 02:40:18
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21633/src
Modified Files:
modcmd.c modcmd.h
Log Message:
add new MODCMD_KEEP_BOUND flag, to prevent a command from being totally unbound
when registering module commands, imply some default flags based on required flags
in svccmd_can_invoke:
force some prerequisites for the CHANUSER and HELPER tests
fix flag tests
implement missing tests (JOINABLE, OPER, *_HELPER)
make ?unbind remove the *correct* command
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** modcmd.c 30 Jul 2002 21:04:35 -0000 1.3
--- modcmd.c 31 Jul 2002 02:40:15 -0000 1.4
***************
*** 59,62 ****
--- 59,63 ----
{ "disabled", MODCMD_DISABLED },
{ "joinable", MODCMD_REQUIRE_JOINABLE },
+ { "keepbound", MODCMD_KEEP_BOUND },
{ "nolog", MODCMD_NO_LOG },
{ "networkhelper", MODCMD_REQUIRE_NETWORK_HELPER },
***************
*** 159,162 ****
--- 160,169 ----
newcmd->defaults->command = newcmd;
dict_insert(module->commands, newcmd->name, newcmd);
+ if (newcmd->flags & (MODCMD_REQUIRE_REGCHAN|MODCMD_REQUIRE_CHANNEL|MODCMD_REQUIRE_CHANUSER|MODCMD_REQUIRE_JOINABLE)) {
+ newcmd->defaults->flags |= MODCMD_ACCEPT_CHANNEL;
+ }
+ if (newcmd->flags & (MODCMD_REQUIRE_CHANUSER|MODCMD_REQUIRE_NETWORK_HELPER|MODCMD_REQUIRE_SUPPORT_HELPER)) {
+ newcmd->defaults->flags |= MODCMD_REQUIRE_AUTHED;
+ }
va_start(args, flags);
while ((param = va_arg(args, const char*))) {
***************
*** 305,309 ****
* having the permission check vary based on the command itself,
* or having a more generic rule system. */
- unsigned int flags = base_cmd->command->flags | base_cmd->flags;
unsigned int res = (MODCMD_EXECUTE|MODCMD_LOG_COMMAND);
unsigned int uData_checked = 0;
--- 312,315 ----
***************
*** 317,333 ****
}
! memcpy(&cmd, base_cmd, sizeof(*base_cmd));
! for(cmd2 = base_cmd->template; cmd2; cmd2 = cmd2->template)
{
cmd.flags |= cmd2->flags;
cmd.req_account_flags |= cmd2->req_account_flags;
cmd.deny_account_flags |= cmd2->deny_account_flags;
! if(cmd2->min_opserv_level > cmd.min_opserv_level) {
cmd.min_opserv_level = cmd2->min_opserv_level;
}
! if(cmd2->min_channel_access > cmd.min_channel_access) {
cmd.min_channel_access = cmd2->min_channel_access;
}
}
if (cmd.min_opserv_level > 0) {
--- 323,347 ----
}
! memset(&cmd, 0, sizeof(cmd));
! cmd.name = base_cmd->name;
! cmd.flags = base_cmd->command->flags;
! for(cmd2 = base_cmd; cmd2; cmd2 = cmd2->template)
{
cmd.flags |= cmd2->flags;
cmd.req_account_flags |= cmd2->req_account_flags;
cmd.deny_account_flags |= cmd2->deny_account_flags;
! if (cmd2->min_opserv_level > cmd.min_opserv_level) {
cmd.min_opserv_level = cmd2->min_opserv_level;
}
! if (cmd2->min_channel_access > cmd.min_channel_access) {
cmd.min_channel_access = cmd2->min_channel_access;
}
+ if (cmd2->weight > cmd.weight) {
+ cmd.weight = cmd2->weight;
+ }
}
+ if (cmd.min_channel_access > ulNone) cmd.flags |= MODCMD_REQUIRE_CHANUSER;
+ if (cmd.flags & MODCMD_REQUIRE_CHANUSER) cmd.flags |= MODCMD_REQUIRE_REGCHAN | MODCMD_REQUIRE_AUTHED;
+ if (cmd.flags & (MODCMD_REQUIRE_NETWORK_HELPER|MODCMD_REQUIRE_SUPPORT_HELPER)) cmd.flags |= MODCMD_REQUIRE_AUTHED;
if (cmd.min_opserv_level > 0) {
***************
*** 346,368 ****
}
}
- if (cmd.min_channel_access > ulNone) flags |= MODCMD_REQUIRE_CHANUSER;
! if (flags & MODCMD_DISABLED) {
send_message(user, bot, MSG_COMMAND_DISABLED, cmd.name);
goto refuse;
}
! if ((flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
send_message(user, bot, "You $bMUST$b \"/msg $S@$s %s\" (not just $S) for that command.", cmd.name);
goto refuse;
}
! if ((flags & MODCMD_REQUIRE_AUTHED) && !user->handle_info) {
send_message(user, bot, MSG_AUTHENTICATE);
goto refuse;
}
! if ((flags & MODCMD_REQUIRE_CHANNEL) && !channel) {
send_message(user, bot, MSG_INVALID_CHANNEL);
goto refuse;
}
! if (flags & MODCMD_REQUIRE_REGCHAN) {
if (!channel) {
/* XXX: could maybe figure out better way to handle this case */
--- 360,381 ----
}
}
! if (cmd.flags & MODCMD_DISABLED) {
send_message(user, bot, MSG_COMMAND_DISABLED, cmd.name);
goto refuse;
}
! if ((cmd.flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
send_message(user, bot, "You $bMUST$b \"/msg $S@$s %s\" (not just $S) for that command.", cmd.name);
goto refuse;
}
! if ((cmd.flags & MODCMD_REQUIRE_AUTHED) && !user->handle_info) {
send_message(user, bot, MSG_AUTHENTICATE);
goto refuse;
}
! if ((cmd.flags & MODCMD_REQUIRE_CHANNEL) && !channel) {
send_message(user, bot, MSG_INVALID_CHANNEL);
goto refuse;
}
! if (cmd.flags & MODCMD_REQUIRE_REGCHAN) {
if (!channel) {
/* XXX: could maybe figure out better way to handle this case */
***************
*** 376,380 ****
}
}
! if (flags & MODCMD_REQUIRE_CHANUSER) {
if (!channel) goto refuse;
if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
--- 389,393 ----
}
}
! if (cmd.flags & MODCMD_REQUIRE_CHANUSER) {
if (!channel) goto refuse;
if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
***************
*** 387,393 ****
}
}
postaccess:
! if (flags & MODCMD_NO_LOG) res &= ~MODCMD_LOG_COMMAND;
return res;
--- 400,427 ----
}
}
+ if (cmd.flags & MODCMD_REQUIRE_JOINABLE) {
+ if (!channel) goto refuse;
+ if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
+ if ((channel->modes & (MODE_INVITEONLY|MODE_KEY))
+ && (!channel->channel_info || !uData)
+ && !IsService(user)
+ && !GetUserMode(channel, user)) {
+ send_message(user, bot, "You must be in $b%s$b (or on its userlist) to use the $b%s$b command.", channel->name, cmd.name);
+ goto refuse;
+ }
+ }
+ if (cmd.flags & (MODCMD_REQUIRE_OPER|MODCMD_REQUIRE_NETWORK_HELPER|MODCMD_REQUIRE_SUPPORT_HELPER)) {
+ if (((cmd.flags & MODCMD_REQUIRE_OPER) && IsOper(user))
+ || ((cmd.flags & MODCMD_REQUIRE_NETWORK_HELPER) && IsNetworkHelper(user))
+ || ((cmd.flags & MODCMD_REQUIRE_SUPPORT_HELPER) && IsSupportHelper(user))) {
+ /* allow it */
+ } else {
+ send_message(user, bot, MSG_COMMAND_PRIVILEGED, base_cmd->name);
+ goto refuse;
+ }
+ }
postaccess:
! if (cmd.flags & MODCMD_NO_LOG) res &= ~MODCMD_LOG_COMMAND;
return res;
***************
*** 786,794 ****
return 0;
}
! if ((bound->command == expand_alias_command) && (bound->command->bind_count == 1)) {
! send_message(user, cmd->parent->bot, "It wouldn't be very much fun to unbind the last bind command, now would it?");
return 0;
}
! dict_remove(service->commands, cmd->name);
send_message(user, cmd->parent->bot, "Unbound command %s from service %s", cmdname, service->bot->nick);
return 1;
--- 820,828 ----
return 0;
}
! if ((bound->command->flags & MODCMD_KEEP_BOUND) && (bound->command->bind_count == 1)) {
! send_message(user, cmd->parent->bot, "It wouldn't be very much fun to unbind the last %s command, now would it?", bound->command->name);
return 0;
}
! dict_remove(service->commands, bound->name);
send_message(user, cmd->parent->bot, "Unbound command %s from service %s", cmdname, service->bot->nick);
return 1;
***************
*** 1002,1009 ****
modcmd_module = module_register("modcmd", MAIN_LOG, "modcmd.help", NULL);
! bind_command = modcmd_register(modcmd_module, "bind", cmd_bind, 4, 0, "access", "800", NULL);
expand_alias_command = modcmd_register(modcmd_module, "expand alias", cmd_expand_alias, 0, 0, NULL);
help_command = modcmd_register(modcmd_module, "help", cmd_help, 1, 0, NULL);
! modcmd_register(modcmd_module, "modcmd", cmd_modcmd, 4, 0, "access", "999", NULL);
modcmd_register(modcmd_module, "readhelp", cmd_readhelp, 2, 0, "access", "650", NULL);
modcmd_register(modcmd_module, "timecmd", cmd_timecmd, 2, 0, "access", "1", NULL);
--- 1036,1043 ----
modcmd_module = module_register("modcmd", MAIN_LOG, "modcmd.help", NULL);
! bind_command = modcmd_register(modcmd_module, "bind", cmd_bind, 4, MODCMD_KEEP_BOUND, "access", "800", NULL);
expand_alias_command = modcmd_register(modcmd_module, "expand alias", cmd_expand_alias, 0, 0, NULL);
help_command = modcmd_register(modcmd_module, "help", cmd_help, 1, 0, NULL);
! modcmd_register(modcmd_module, "modcmd", cmd_modcmd, 4, MODCMD_KEEP_BOUND, "access", "999", NULL);
modcmd_register(modcmd_module, "readhelp", cmd_readhelp, 2, 0, "access", "650", NULL);
modcmd_register(modcmd_module, "timecmd", cmd_timecmd, 2, 0, "access", "1", NULL);
***************
*** 1227,1230 ****
--- 1261,1265 ----
}
ptempl->cmd->template = svccmd;
+ free(ptempl->base);
free(ptempl);
}
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** modcmd.h 30 Jul 2002 02:15:11 -0000 1.1
--- modcmd.h 31 Jul 2002 02:40:15 -0000 1.2
***************
*** 48,51 ****
--- 48,52 ----
#define MODCMD_REQUIRE_JOINABLE 0x200
#define MODCMD_REQUIRE_QUALIFIED 0x0400
+ #define MODCMD_KEEP_BOUND 0x0800
#define MODCMD_REQUIRE_OPER 0x1000
#define MODCMD_REQUIRE_NETWORK_HELPER 0x2000
***************
*** 74,78 ****
* need "extra" data.
*
! * When checking to see if a user may invoke a command,
*/
--- 75,82 ----
* need "extra" data.
*
! * When checking to see if a user may invoke a command, the "template"
! * chain is followed, and the user must meet all the requirements
! * before the command is executed. [This is not how it should be;
! * staff access should be any-of instead of all-of.]
*/
***************
*** 126,131 ****
struct modcmd *modcmd_register(struct module *module, const char *name, modcmd_func_t func, unsigned int min_argc, unsigned int flags, ...);
! /* Register a command-providing module.
! * clog is where to log commands without the MODCMD_NO_LOG flag.
*/
struct module *module_register(const char *name, enum log_type clog, const char *helpfile_name, expand_func_t expand_help);
--- 130,135 ----
struct modcmd *modcmd_register(struct module *module, const char *name, modcmd_func_t func, unsigned int min_argc, unsigned int flags, ...);
! /* Register a command-providing module. clog is where to log loggable
! * commands (those without the MODCMD_NO_LOG flag and which succeed).
*/
struct module *module_register(const char *name, enum log_type clog, const char *helpfile_name, expand_func_t expand_help);
***************
*** 156,160 ****
void modcmd_init(void);
/* Finalize the command mappings, read aliases, etc. Do this after
! * all other services and modules have registered their commands. */
void modcmd_finalize(void);
--- 160,165 ----
void modcmd_init(void);
/* Finalize the command mappings, read aliases, etc. Do this after
! * all other modules have registered their commands.
! */
void modcmd_finalize(void);
|
|
From: Entrope <en...@us...> - 2002-07-31 02:37:40
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv21171/src Modified Files: compat.h Log Message: #include <signal.h>, which was lost in the #include rearrangement Index: compat.h =================================================================== RCS file: /cvsroot/srvx/services/src/compat.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** compat.h 30 Jul 2002 02:15:11 -0000 1.8 --- compat.h 31 Jul 2002 02:37:37 -0000 1.9 *************** *** 13,16 **** --- 13,17 ---- #include <errno.h> #include <limits.h> + #include <signal.h> #include <stdarg.h> #include <stddef.h> |
|
From: Entrope <en...@us...> - 2002-07-31 02:36:59
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21040/src
Modified Files:
chanserv.c
Log Message:
correct command flags for several commands (they should be all correct now)
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.253
retrieving revision 1.254
diff -C2 -r1.253 -r1.254
*** chanserv.c 31 Jul 2002 01:53:00 -0000 1.253
--- chanserv.c 31 Jul 2002 02:36:55 -0000 1.254
***************
*** 6950,6963 ****
chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);
! DEFINE_COMMAND(god, 1, 0, "flags", "+oper,+networkhelper,+supporthelper", NULL);
! DEFINE_COMMAND(register, 2, 0, "account_flags", "+g", NULL);
! DEFINE_COMMAND(noregister, 3, 0, "account_flags", "+g", NULL);
DEFINE_COMMAND(allowregister, 2, 0, "template", "noregister", NULL);
! DEFINE_COMMAND(move, 2, MODCMD_REQUIRE_REGCHAN, "template", "register", NULL);
! DEFINE_COMMAND(csuspend, 2, MODCMD_REQUIRE_REGCHAN, "account_flags", "+g", NULL);
! DEFINE_COMMAND(cunsuspend, 2, 0, "template", "csuspend", NULL);
! DEFINE_COMMAND(unregister, 1, 0, "access", "owner", NULL);
! DEFINE_COMMAND(merge, 2, 0, "access", "owner", NULL);
DEFINE_COMMAND(adduser, 3, MODCMD_REQUIRE_CHANUSER, "access", "master", NULL);
--- 6950,6963 ----
chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);
! DEFINE_COMMAND(god, 1, MODCMD_REQUIRE_AUTHED, "flags", "+oper,+networkhelper", NULL);
! DEFINE_COMMAND(register, 2, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", "flags", "+acceptchan", NULL);
! DEFINE_COMMAND(noregister, 3, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", NULL);
DEFINE_COMMAND(allowregister, 2, 0, "template", "noregister", NULL);
! DEFINE_COMMAND(move, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "template", "register", NULL);
! DEFINE_COMMAND(csuspend, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "account_flags", "+g", NULL);
! DEFINE_COMMAND(cunsuspend, 2, MODCMD_REQUIRE_AUTHED, "template", "csuspend", NULL);
! DEFINE_COMMAND(unregister, 1, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "access", "owner", NULL);
! DEFINE_COMMAND(merge, 2, MODCMD_REQUIRE_AUTHED, "access", "owner", NULL);
DEFINE_COMMAND(adduser, 3, MODCMD_REQUIRE_CHANUSER, "access", "master", NULL);
***************
*** 6993,6998 ****
DEFINE_COMMAND(topic, 1, MODCMD_REQUIRE_REGCHAN, "template", "op", NULL);
DEFINE_COMMAND(mode, 1, MODCMD_REQUIRE_REGCHAN, "template", "op", NULL);
! DEFINE_COMMAND(invite, 1, 0, "access", "peon", NULL);
! DEFINE_COMMAND(set, 1, MODCMD_REQUIRE_REGCHAN, "access", "op", NULL);
DEFINE_COMMAND(setinfo, 1, MODCMD_REQUIRE_CHANUSER, "flags", "+nolog", NULL);
--- 6993,6998 ----
DEFINE_COMMAND(topic, 1, MODCMD_REQUIRE_REGCHAN, "template", "op", NULL);
DEFINE_COMMAND(mode, 1, MODCMD_REQUIRE_REGCHAN, "template", "op", NULL);
! DEFINE_COMMAND(invite, 1, MODCMD_REQUIRE_CHANUSER, "access", "peon", NULL);
! DEFINE_COMMAND(set, 1, MODCMD_REQUIRE_CHANUSER, "access", "op", NULL);
DEFINE_COMMAND(setinfo, 1, MODCMD_REQUIRE_CHANUSER, "flags", "+nolog", NULL);
***************
*** 7030,7034 ****
DEFINE_COMMAND(emote, 2, MODCMD_REQUIRE_CHANNEL, "flags", "+oper", NULL);
DEFINE_COMMAND(expire, 1, 0, "flags", "+oper", NULL);
! DEFINE_COMMAND(write, 1, 0, "flags", "+oper", NULL);
DEFINE_COMMAND(last, 1, 0, "account_flags", "+g", "flags", "+nolog", NULL);
DEFINE_COMMAND(search, 3, 0, "account_flags", "+g", "flags", "+nolog", NULL);
--- 7030,7034 ----
DEFINE_COMMAND(emote, 2, MODCMD_REQUIRE_CHANNEL, "flags", "+oper", NULL);
DEFINE_COMMAND(expire, 1, 0, "flags", "+oper", NULL);
! DEFINE_COMMAND(write, 1, MODCMD_REQUIRE_AUTHED, "flags", "+oper", NULL);
DEFINE_COMMAND(last, 1, 0, "account_flags", "+g", "flags", "+nolog", NULL);
DEFINE_COMMAND(search, 3, 0, "account_flags", "+g", "flags", "+nolog", NULL);
|
|
From: Entrope <en...@us...> - 2002-07-31 02:35:00
|
Update of /cvsroot/srvx/services
In directory usw-pr-cvs1:/tmp/cvs-serv20675
Modified Files:
srvx.conf.example
Log Message:
remove (and explain why) the require_qualified option in nickserv's conf
Index: srvx.conf.example
===================================================================
RCS file: /cvsroot/srvx/services/srvx.conf.example,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** srvx.conf.example 25 Jul 2002 17:40:11 -0000 1.21
--- srvx.conf.example 31 Jul 2002 02:34:57 -0000 1.22
***************
*** 81,87 ****
// how long until an account with no access to any channels expires?
"nochan_account_expire_delay" "14d";
! // require PRIVMSG Nic...@se... AUTH whatever?
! // (applies to any NickServ command using passwords; default 1)
! "require_qualified" "1";
// If somebody keeps guessing passwords incorrectly, do we gag them?
"autogag_enabled" "1";
--- 81,88 ----
// how long until an account with no access to any channels expires?
"nochan_account_expire_delay" "14d";
! // NOTE: there used to be a "require_qualified" option
! // here, applying to any NickServ command that uses passwords.
! // This is now integrated into the modcmd command authorization
! // and dispatch mechanism. "/msg OpServ help modcmd" for details.
// If somebody keeps guessing passwords incorrectly, do we gag them?
"autogag_enabled" "1";
|
|
From: Entrope <en...@us...> - 2002-07-31 02:34:29
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv20587 Modified Files: autogen.sh Log Message: warn if somebody is victimized by brain damaged CVS defaults Index: autogen.sh =================================================================== RCS file: /cvsroot/srvx/services/autogen.sh,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** autogen.sh 21 May 2002 03:42:34 -0000 1.11 --- autogen.sh 31 Jul 2002 02:34:26 -0000 1.12 *************** *** 5,6 **** --- 5,16 ---- automake -a --gnu Makefile rx/Makefile src/Makefile autoconf + if [ -d ./src/srvx ] ; then + echo "WARNING: It looks like you still have the obsolete src/srvx directory." + echo "Since we try to compile the binary into that place, this will break the" + echo "compile. This is probably because you did not \"cvs update\" properly" + echo "(i.e. with the -P flag). Since you almost always want to do \"cvs update -P\"," + echo "we suggest you add a line similar to \"update -P\" to your ~/.cvsrc file." + echo "For example:" + echo " echo update -P >> ~/.cvsrc" + echo "At the very least, \"rm -r src/srvx\" before you try to compile." + fi |
|
From: Zoot <zo...@us...> - 2002-07-31 01:53:03
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv10800/src
Modified Files:
chanserv.c
Log Message:
Track handle DNRs across handle renames.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.252
retrieving revision 1.253
diff -C2 -r1.252 -r1.253
*** chanserv.c 30 Jul 2002 02:15:11 -0000 1.252
--- chanserv.c 31 Jul 2002 01:53:00 -0000 1.253
***************
*** 6062,6065 ****
--- 6062,6077 ----
}
+ static void handle_rename(struct handle_info *handle, const char *new_handle)
+ {
+ struct do_not_register *dnr = dict_find(handle_dnrs, handle->handle, NULL);
+
+ if(dnr)
+ {
+ dict_remove2(handle_dnrs, handle->handle, 1);
+ strcpy(dnr->chan_name + 1, new_handle);
+ dict_insert(handle_dnrs, dnr->chan_name + 1, dnr);
+ }
+ }
+
static void
handle_unreg(struct userNode *user, struct handle_info *handle)
***************
*** 6916,6920 ****
conf_register_reload(chanserv_conf_read);
- reg_auth_func(handle_auth);
reg_server_link_func(handle_server_link);
--- 6928,6931 ----
***************
*** 6926,6929 ****
--- 6937,6942 ----
reg_mode_change_func(handle_mode);
+ reg_auth_func(handle_auth);
+ reg_handle_rename_func(handle_rename);
reg_unreg_func(handle_unreg);
|
|
From: Zoot <zo...@us...> - 2002-07-30 21:04:38
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24452/src
Modified Files:
modcmd.c
Log Message:
Merge command permissions with those up the template chain, rather than checking them recursively. This fixes a bug that caused error messages to be reported multiple times.
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** modcmd.c 30 Jul 2002 19:26:46 -0000 1.2
--- modcmd.c 30 Jul 2002 21:04:35 -0000 1.3
***************
*** 301,327 ****
int
! svccmd_can_invoke(struct userNode *user, struct userNode *bot, struct svccmd *cmd, struct chanNode *channel, unsigned int argc, unsigned int server_qualified) {
/* This is kind of a lame hack, but it is actually simpler than
* having the permission check vary based on the command itself,
* or having a more generic rule system. */
! unsigned int flags = cmd->command->flags | cmd->flags;
unsigned int res = (MODCMD_EXECUTE|MODCMD_LOG_COMMAND);
unsigned int uData_checked = 0;
struct userData *uData = NULL;
! if (!cmd) return 0;
! if (cmd->command->min_argc > argc) {
! send_message(user, bot, MSG_MISSING_PARAMS, cmd->name);
goto refuse;
}
! if (cmd->template) {
! res = svccmd_can_invoke(user, bot, cmd->template, channel, argc, server_qualified);
! flags = cmd->command->flags;
! goto flagcheck;
}
! if (cmd->min_opserv_level > 0) {
! if (!oper_has_access(user, bot, cmd->min_opserv_level, 0)) goto refuse;
}
! if (cmd->req_account_flags || cmd->deny_account_flags) {
if (!user->handle_info) {
send_message(user, bot, MSG_AUTHENTICATE);
--- 301,338 ----
int
! svccmd_can_invoke(struct userNode *user, struct userNode *bot, struct svccmd *base_cmd, struct chanNode *channel, unsigned int argc, unsigned int server_qualified) {
/* This is kind of a lame hack, but it is actually simpler than
* having the permission check vary based on the command itself,
* or having a more generic rule system. */
! unsigned int flags = base_cmd->command->flags | base_cmd->flags;
unsigned int res = (MODCMD_EXECUTE|MODCMD_LOG_COMMAND);
unsigned int uData_checked = 0;
struct userData *uData = NULL;
+ struct svccmd cmd, *cmd2;
! if (!base_cmd) return 0;
! if (base_cmd->command->min_argc > argc) {
! send_message(user, bot, MSG_MISSING_PARAMS, base_cmd->name);
goto refuse;
}
!
! memcpy(&cmd, base_cmd, sizeof(*base_cmd));
! for(cmd2 = base_cmd->template; cmd2; cmd2 = cmd2->template)
! {
! cmd.flags |= cmd2->flags;
! cmd.req_account_flags |= cmd2->req_account_flags;
! cmd.deny_account_flags |= cmd2->deny_account_flags;
! if(cmd2->min_opserv_level > cmd.min_opserv_level) {
! cmd.min_opserv_level = cmd2->min_opserv_level;
! }
! if(cmd2->min_channel_access > cmd.min_channel_access) {
! cmd.min_channel_access = cmd2->min_channel_access;
! }
}
!
! if (cmd.min_opserv_level > 0) {
! if (!oper_has_access(user, bot, cmd.min_opserv_level, 0)) goto refuse;
}
! if (cmd.req_account_flags || cmd.deny_account_flags) {
if (!user->handle_info) {
send_message(user, bot, MSG_AUTHENTICATE);
***************
*** 329,347 ****
}
/* Do we want separate or different messages here? */
! if ((cmd->req_account_flags & ~user->handle_info->flags)
! || (cmd->deny_account_flags & user->handle_info->flags)) {
! send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name);
goto refuse;
}
}
! if (cmd->min_channel_access > ulNone) flags |= MODCMD_REQUIRE_CHANUSER;
- flagcheck:
if (flags & MODCMD_DISABLED) {
! send_message(user, bot, MSG_COMMAND_DISABLED, cmd->name);
goto refuse;
}
if ((flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
! send_message(user, bot, "You $bMUST$b \"/msg $S@$s %s\" (not just $S) for that command.", cmd->name);
goto refuse;
}
--- 340,357 ----
}
/* Do we want separate or different messages here? */
! if ((cmd.req_account_flags & ~user->handle_info->flags)
! || (cmd.deny_account_flags & user->handle_info->flags)) {
! send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd.name);
goto refuse;
}
}
! if (cmd.min_channel_access > ulNone) flags |= MODCMD_REQUIRE_CHANUSER;
if (flags & MODCMD_DISABLED) {
! send_message(user, bot, MSG_COMMAND_DISABLED, cmd.name);
goto refuse;
}
if ((flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
! send_message(user, bot, "You $bMUST$b \"/msg $S@$s %s\" (not just $S) for that command.", cmd.name);
goto refuse;
}
***************
*** 372,376 ****
send_message(user, bot, "You lack access to $b%s$b.", channel->name);
goto refuse;
! } else if (uData->access < cmd->min_channel_access) {
send_message(user, bot, "You lack sufficient access to $b%s$b to use this command.", channel->name);
goto refuse;
--- 382,386 ----
send_message(user, bot, "You lack access to $b%s$b.", channel->name);
goto refuse;
! } else if (uData->access < cmd.min_channel_access) {
send_message(user, bot, "You lack sufficient access to $b%s$b to use this command.", channel->name);
goto refuse;
|
|
From: Zoot <zo...@us...> - 2002-07-30 19:39:01
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24837/src
Modified Files:
opserv.c
Log Message:
Fix my last commit: 'privileged', not 'is_privileged'.
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.250
retrieving revision 1.251
diff -C2 -r1.250 -r1.251
*** opserv.c 30 Jul 2002 19:36:48 -0000 1.250
--- opserv.c 30 Jul 2002 19:38:56 -0000 1.251
***************
*** 4462,4466 ****
opserv_db_read();
opserv_service = service_register(opserv, opserv_conf.trigger_char);
! opserv_service->is_privileged = 1;
if (opserv_conf.db_backup_frequency) {
--- 4462,4466 ----
opserv_db_read();
opserv_service = service_register(opserv, opserv_conf.trigger_char);
! opserv_service->privileged = 1;
if (opserv_conf.db_backup_frequency) {
|
|
From: Zoot <zo...@us...> - 2002-07-30 19:36:52
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24201/src
Modified Files:
opserv.c
Log Message:
Make OperServ a privileged service.
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.249
retrieving revision 1.250
diff -C2 -r1.249 -r1.250
*** opserv.c 30 Jul 2002 02:15:11 -0000 1.249
--- opserv.c 30 Jul 2002 19:36:48 -0000 1.250
***************
*** 4462,4465 ****
--- 4462,4466 ----
opserv_db_read();
opserv_service = service_register(opserv, opserv_conf.trigger_char);
+ opserv_service->is_privileged = 1;
if (opserv_conf.db_backup_frequency) {
|
|
From: Entrope <en...@us...> - 2002-07-30 19:26:50
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv20513/src
Modified Files:
modcmd.c
Log Message:
add ?modcmd command to configure commands at run-time
return correct value from svccmd_can_invoke()
remove spurious assignment to pos in svccmd_send_help()
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** modcmd.c 30 Jul 2002 02:15:11 -0000 1.1
--- modcmd.c 30 Jul 2002 19:26:46 -0000 1.2
***************
*** 380,384 ****
postaccess:
if (flags & MODCMD_NO_LOG) res &= ~MODCMD_LOG_COMMAND;
! return 1;
refuse:
--- 380,384 ----
postaccess:
if (flags & MODCMD_NO_LOG) res &= ~MODCMD_LOG_COMMAND;
! return res;
refuse:
***************
*** 500,504 ****
expn = cmd->extra;
- pos = strlen(display);
for (arg = pos = 0; arg < expn->argc; ++arg) {
len = strlen(expn->argv[arg]);
--- 500,503 ----
***************
*** 952,955 ****
--- 951,971 ----
}
+ static MODCMD_FUNC(cmd_modcmd) {
+ struct svccmd *svccmd;
+ unsigned int arg, changed=0;
+
+ assert(argc >= 4);
+ /* TODO: must be able to specify command name like "trace\ gline" */
+ if (!(svccmd = svccmd_resolve_name(cmd, argv[1]))) {
+ send_message(user, cmd->parent->bot, "Unknown/unresolvable command name %s", argv[1]);
+ return 0;
+ }
+ for (arg = 2; arg+2 < argc; arg += 2) {
+ if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) changed = 1;
+ }
+ /* TODO: either show new values for svccmd options or report success as things are changed */
+ return changed;
+ }
+
void
modcmd_nick_change(struct userNode *user, const char *new_nick) {
***************
*** 979,982 ****
--- 995,999 ----
expand_alias_command = modcmd_register(modcmd_module, "expand alias", cmd_expand_alias, 0, 0, NULL);
help_command = modcmd_register(modcmd_module, "help", cmd_help, 1, 0, NULL);
+ modcmd_register(modcmd_module, "modcmd", cmd_modcmd, 4, 0, "access", "999", NULL);
modcmd_register(modcmd_module, "readhelp", cmd_readhelp, 2, 0, "access", "650", NULL);
modcmd_register(modcmd_module, "timecmd", cmd_timecmd, 2, 0, "access", "1", NULL);
|
|
From: Adrian D. <sai...@us...> - 2002-07-30 18:27:37
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv22950
Modified Files:
Tag: rel-1_1-branch
chanserv.c
Log Message:
Fix /msg chanserv ping
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.232.2.6
retrieving revision 1.232.2.7
diff -C2 -r1.232.2.6 -r1.232.2.7
*** chanserv.c 28 Jul 2002 20:34:13 -0000 1.232.2.6
--- chanserv.c 30 Jul 2002 18:12:13 -0000 1.232.2.7
***************
*** 6077,6081 ****
else
{
! irc_privmsg(chanserv->numeric, channel->name, CSMSG_PING_RESPONSE);
}
return 1;
--- 6077,6081 ----
else
{
! chanserv_notice(user, CSMSG_PING_RESPONSE);
}
return 1;
|