Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8261/src
Modified Files:
modcmd.c
Log Message:
don't allow opers to adjust commands that are above their level
fix "command *module.cmdname" crash
fix a memory leak
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** modcmd.c 29 Oct 2002 04:31:29 -0000 1.36
--- modcmd.c 31 Oct 2002 03:40:08 -0000 1.37
***************
*** 29,32 ****
--- 29,33 ----
#define MCMSG_BAD_OPSERV_LEVEL "Invalid $O access level %s."
#define MCMSG_BAD_CHANSERV_LEVEL "Invalid $C access level %s."
+ #define MCMSG_LEVEL_TOO_LOW "You cannot set the access requirements for %s (your level is too low.)"
#define MCMSG_LEVEL_TOO_HIGH "You cannot set the access requirements to %s (that is too high)."
#define MCMSG_UNKNOWN_COMMAND "Unknown command name %s (as template for %s in service %s)."
***************
*** 322,325 ****
--- 323,330 ----
return 0;
}
+ if (user && (!user->handle_info || (cmd->min_opserv_level > user->handle_info->opserv_level))) {
+ send_message(user, bot, MCMSG_LEVEL_TOO_LOW, cmd->name);
+ return 0;
+ }
if (user && (!user->handle_info || (newval > user->handle_info->opserv_level))) {
send_message(user, bot, MCMSG_LEVEL_TOO_HIGH, value);
***************
*** 1127,1132 ****
return 0;
}
! other = dict_find(svccmd->parent->commands, svccmd->command->name, NULL);
! if (other && !other->alias.used && (other->command == svccmd->command)) {
pos = snprintf(buf, sizeof(buf), "%s", other->name);
} else {
--- 1132,1139 ----
return 0;
}
! if (svccmd->parent
! && (other = dict_find(svccmd->parent->commands, svccmd->command->name, NULL))
! && !other->alias.used
! && (other->command == svccmd->command)) {
pos = snprintf(buf, sizeof(buf), "%s", other->name);
} else {
***************
*** 1358,1362 ****
tbl.length = dict_size(mod->commands) + 1;
tbl.width = 3;
! tbl.flags = TABLE_NO_FREE | TABLE_PAD_LEFT;
tbl.contents = calloc(tbl.length, sizeof(tbl.contents[0]));
tbl.contents[0] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
--- 1365,1369 ----
tbl.length = dict_size(mod->commands) + 1;
tbl.width = 3;
! tbl.flags = TABLE_PAD_LEFT;
tbl.contents = calloc(tbl.length, sizeof(tbl.contents[0]));
tbl.contents[0] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
|