This is patch03 to PennMUSH 1.7.7. After applying this patch, you will have version 1.7.7p3 To apply this patch, save it to a file in your top-level MUSH directory, and do the following: patch -p1 < 1.7.7-patch03 make install If you use GNU patch 2.2, you probably want the above to be 'patch -b -p1', not just 'patch -p1'. Unix (or cygwin) users need not worry about failed hunks in src/switchinc.c, hdrs/switches.h, hdrs/cmds.h, or hdrs/funs.h. These files are automatically rebuilt on compile. Then @shutdown and restart your MUSH. - Alan/Javelin In this patch: Commands: * @sitelock/check tells you which rule, if any, would match. Fixes: * The objdata hashtable routines had a serious bug that could cause crashes. Prereq: 1.7.7p2 *** 1_7_7.81/Patchlevel Tue, 24 Dec 2002 15:20:25 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.4 600) --- 1_7_7.84(w)/Patchlevel Wed, 25 Dec 2002 14:13:35 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.4 600) *************** *** 1,2 **** Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p2 --- 1,2 ---- Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p3 *** 1_7_7.81/CHANGES Tue, 24 Dec 2002 15:20:25 -0600 dunemush (pennmush/g/23_CHANGES 1.24 600) --- 1_7_7.84(w)/CHANGES Wed, 25 Dec 2002 14:13:14 -0600 dunemush (pennmush/g/23_CHANGES 1.25 600) *************** *** 18,23 **** --- 18,32 ---- ========================================================================== + Version 1.7.7 patchlevel 3 December 25, 2002 + + Commands: + * @sitelock/check tells you which rule, if any, would match. + Fixes: + * The objdata hashtable routines had a serious bug that could + cause crashes. + + Version 1.7.7 patchlevel 2 December 22, 2002 Major Changes: *** 1_7_7.81/game/txt/hlp/pennvers.hlp Tue, 24 Dec 2002 15:20:25 -0600 dunemush (pennmush/12_pennvers.h 1.169.1.42.1.3.1.2.2.2.1.1.1.3.1.1.1.5.1.4.1.1.1.1.1.1.1.1.1.5.1.1.1.3.1.1.1.3.1.1.1.54.1.10.1.2.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.7.1.1.1.1.1.2.1.1.1.6 600) --- 1_7_7.84(w)/game/txt/hlp/pennvers.hlp Wed, 25 Dec 2002 14:13:52 -0600 dunemush (pennmush/12_pennvers.h 1.169.1.42.1.3.1.2.2.2.1.1.1.3.1.1.1.5.1.4.1.1.1.1.1.1.1.1.1.5.1.1.1.3.1.1.1.3.1.1.1.54.1.10.1.2.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.7.1.1.1.1.1.2.1.1.1.7 600) *************** *** 1,5 **** & changes ! & 1.7.7p2 This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions can probably be gotten via 'help '. 'help credits' --- 1,5 ---- & changes ! & 1.7.7p3 This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions can probably be gotten via 'help '. 'help credits' *************** *** 11,16 **** --- 11,26 ---- A list of the patchlevels associated with each release can be read in 'help patchlevels'. + Version 1.7.7 patchlevel 3 December 25, 2002 + + Commands: + * @sitelock/check tells you which rule, if any, would match. + Fixes: + * The objdata hashtable routines had a serious bug that could + cause crashes. + + + & 1.7.7p2 Version 1.7.7 patchlevel 2 December 22, 2002 Major Changes: *************** *** 5875,5881 **** For information on a specific patchlevel of one of the versions listed, type 'help p'. For example, 'help 1.7.2p3' ! 1.7.7: 0, 1, 2 1.7.6: 0, 1, 2, 3 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, --- 5885,5891 ---- For information on a specific patchlevel of one of the versions listed, type 'help p'. For example, 'help 1.7.2p3' ! 1.7.7: 0, 1, 2, 3 1.7.6: 0, 1, 2, 3 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, *** 1_7_7.81/game/txt/hlp/penncmd.hlp Tue, 17 Dec 2002 16:03:37 -0600 dunemush (pennmush/18_penncmd.hl 1.2.1.1.1.47.1.1.1.1.1.3.1.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.10.1.1.1.1.1.2 600) --- 1_7_7.84(w)/game/txt/hlp/penncmd.hlp Wed, 25 Dec 2002 02:21:21 -0600 dunemush (pennmush/18_penncmd.hl 1.2.1.1.1.47.1.1.1.1.1.3.1.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.10.1.1.1.1.1.3 600) *************** *** 2675,2680 **** --- 2675,2681 ---- @sitelock/name @sitelock = [,] @sitelock[/] + @sitelock/check @sitelock/remove The @sitelock command adds rules to the access.cnf file, controlling *************** *** 2683,2689 **** @sitelock without arguments lists all sites in access.cnf. Rules are processed in the order listed, and the first matching ! rule is applied. @sitelock/name adds a name to the list of banned player names. Use ! to remove a name from the list. --- 2684,2691 ---- @sitelock without arguments lists all sites in access.cnf. Rules are processed in the order listed, and the first matching ! rule is applied. @sitelock/check tells you which rule will match ! for a given . @sitelock/name adds a name to the list of banned player names. Use ! to remove a name from the list. *** 1_7_7.81/src/wiz.c Sun, 22 Dec 2002 01:19:31 -0600 dunemush (pennmush/b/23_wiz.c 1.44.1.1.1.1.1.2.1.7.1.1.1.1.1.1.1.1.1.1.1.8.1.2.2.2.1.2.1.1.1.1.1.1.1.2.1.2 660) --- 1_7_7.84(w)/src/wiz.c Wed, 25 Dec 2002 14:14:50 -0600 dunemush (pennmush/b/23_wiz.c 1.44.1.1.1.1.1.2.1.7.1.1.1.1.1.1.1.1.1.1.1.8.1.2.2.2.1.2.1.1.1.1.1.1.1.2.1.3 660) *************** *** 1620,1626 **** const char *opts; const char *who; int type; ! /* 0 = registration, 1 = siteban, 2 = names */ { FILE *fp, *fptmp; char buffer[80]; --- 1620,1626 ---- const char *opts; const char *who; int type; ! /* 0 = registration, 1 = siteban, 2 = names, 3 = remove, 4 = check */ { FILE *fp, *fptmp; char buffer[80]; *************** *** 1685,1690 **** --- 1685,1705 ---- notify_format(player, T("Site %s locked"), site); do_log(LT_WIZ, player, NOTHING, "*** SITELOCK *** %s", site); break; + case 4:{ + struct access *ap; + char tbuf[BUFFER_LEN], *bp; + int rulenum; + if (!site || !*site) { + do_list_access(player); + return; + } + ap = site_check_access(site, AMBIGUOUS, &rulenum); + bp = tbuf; + format_access(ap, rulenum, AMBIGUOUS, tbuf, &bp); + *bp = '\0'; + notify(player, tbuf); + break; + } case 3:{ int n; n = remove_access_sitelock(site); *** 1_7_7.81/src/extchat.c Sun, 22 Dec 2002 01:05:36 -0600 dunemush (pennmush/c/23_extchat.c 1.1.1.1.1.1.1.1.1.2.1.1.1.3.1.1.1.5.1.1.1.1.1.5.1.2.1.3.1.3.1.1.1.4.1.2.1.6.1.2.1.1.2.4.2.9.1.2.1.2.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.2.1.1.2.1.1.4 660) --- 1_7_7.84(w)/src/extchat.c Wed, 25 Dec 2002 14:14:48 -0600 dunemush (pennmush/c/23_extchat.c 1.1.1.1.1.1.1.1.1.2.1.1.1.3.1.1.1.5.1.1.1.1.1.5.1.2.1.3.1.3.1.1.1.4.1.2.1.6.1.2.1.1.2.4.2.9.1.2.1.2.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.2.1.1.2.1.1.4 660) *************** *** 397,403 **** return; tmp->chan = *ch; /* If there's no channels on the list, or if the first channel is already ! * alphabetically greater, user should be the first entry on the list */ /* No channels? */ if (!Chanlist(who)) { tmp->next = NULL; --- 397,403 ---- return; tmp->chan = *ch; /* If there's no channels on the list, or if the first channel is already ! * alphabetically greater, chan should be the first entry on the list */ /* No channels? */ if (!Chanlist(who)) { tmp->next = NULL; *************** *** 414,420 **** /* Don't add the same channel twice! */ free_chanlist(tmp); } else { ! /* Otherwise, find which user this user should be inserted after */ for (; p->next && (strcasecoll(ChanName(p->next->chan), ChanName(*ch)) < 0); --- 414,420 ---- /* Don't add the same channel twice! */ free_chanlist(tmp); } else { ! /* Otherwise, find which channel this channel should be inserted after */ for (; p->next && (strcasecoll(ChanName(p->next->chan), ChanName(*ch)) < 0); *** 1_7_7.81/src/db.c Tue, 24 Dec 2002 15:49:43 -0600 dunemush (pennmush/c/25_db.c 1.26.1.1.1.1.1.10 660) --- 1_7_7.84(w)/src/db.c Wed, 25 Dec 2002 14:14:48 -0600 dunemush (pennmush/c/25_db.c 1.26.1.1.1.1.1.10 660) *************** *** 1370,1375 **** --- 1370,1376 ---- void * set_objdata(dbref thing, const char *keybase, void *data) { + hashdelete(tprintf("%s_#%d", keybase, thing), &htab_objdata); if (data) { if (hashadd(tprintf("%s_#%d", keybase, thing), data, &htab_objdata) < 0) return NULL; *************** *** 1377,1387 **** char *newkey = strdup(keybase); hashadd(keybase, (void *) &newkey, &htab_objdata_keys); } - return data; - } else { - hashdelete(tprintf("%s_#%d", keybase, thing), &htab_objdata); - return NULL; } } void * --- 1378,1385 ---- char *newkey = strdup(keybase); hashadd(keybase, (void *) &newkey, &htab_objdata_keys); } } + return data; } void * *** 1_7_7.81/src/command.c Tue, 24 Dec 2002 15:20:25 -0600 dunemush (pennmush/c/36_command.c 1.56.1.1.1.1.1.1.1.2.1.1.1.1.1.5.1.2.1.1.1.1.1.2.1.3.1.10.1.1.2.3 660) --- 1_7_7.84(w)/src/command.c Wed, 25 Dec 2002 14:14:48 -0600 dunemush (pennmush/c/36_command.c 1.56.1.1.1.1.1.1.1.2.1.1.1.1.1.5.1.2.1.1.1.1.1.2.1.3.1.10.1.1.2.4 660) *************** *** 235,241 **** 0}, {"@SHUTDOWN", "PANIC REBOOT PARANOID", cmd_shutdown, CMD_T_ANY, WIZARD, 0, 0}, ! {"@SITELOCK", "BAN REGISTER REMOVE NAME", cmd_sitelock, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_ARGS, WIZARD, 0, 0}, {"@STATS", "TABLES", cmd_stats, CMD_T_ANY, 0, 0, 0}, --- 235,241 ---- 0}, {"@SHUTDOWN", "PANIC REBOOT PARANOID", cmd_shutdown, CMD_T_ANY, WIZARD, 0, 0}, ! {"@SITELOCK", "BAN CHECK REGISTER REMOVE NAME", cmd_sitelock, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_ARGS, WIZARD, 0, 0}, {"@STATS", "TABLES", cmd_stats, CMD_T_ANY, 0, 0, 0}, *** 1_7_7.81/src/cmds.c Sat, 07 Dec 2002 16:26:26 -0600 dunemush (pennmush/c/37_cmds.c 1.33.1.1.1.2.1.2.2.3.1.1.1.2.1.1.1.3.1.8.1.1.2.2.1.2 660) --- 1_7_7.84(w)/src/cmds.c Wed, 25 Dec 2002 14:14:48 -0600 dunemush (pennmush/c/37_cmds.c 1.33.1.1.1.2.1.2.2.3.1.1.1.2.1.1.1.3.1.8.1.1.2.2.1.3 660) *************** *** 818,823 **** --- 818,825 ---- do_sitelock(player, arg_left, NULL, NULL, 2); else if (SW_ISSET(sw, SWITCH_REMOVE)) do_sitelock(player, arg_left, NULL, NULL, 3); + else if (SW_ISSET(sw, SWITCH_CHECK)) + do_sitelock(player, arg_left, NULL, NULL, 4); else do_sitelock(player, arg_left, args_right[1], args_right[2], 0); } *** 1_7_7.81/src/access.c Sat, 30 Nov 2002 15:49:22 -0600 dunemush (pennmush/c/43_access.c 1.11.1.2.1.4 660) --- 1_7_7.84(w)/src/access.c Wed, 25 Dec 2002 14:14:48 -0600 dunemush (pennmush/c/43_access.c 1.11.1.2.1.6 660) *************** *** 81,95 **** #include "flags.h" #include "confmagic.h" - /* A linked list data structure to hold the access info */ - struct access { - char host[BUFFER_LEN]; - char comment[BUFFER_LEN]; - dbref who; - int can; - int cant; - struct access *next; - }; typedef struct a_acsflag acsflag; --- 81,86 ---- *************** *** 368,373 **** --- 359,439 ---- return 1; } + /* Like above, but returns the details of the first-matching rule */ + struct access * + site_check_access(const char *hname, dbref who, int *rulenum) + { + struct access *ap; + char *p; + + *rulenum = 0; + if (!hname || !*hname) + return 0; + + if ((p = strchr(hname, '@'))) + p++; + + for (ap = access_top; ap; ap = ap->next) { + (*rulenum)++; + if (!(ap->can & ACS_SITELOCK) + && ((ap->can & ACS_REGEXP) + ? (regexp_match_case(ap->host, hname, 0) + || (p && regexp_match_case(ap->host, p, 0))) + : (quick_wild(ap->host, hname) + || (p && quick_wild(ap->host, p)))) + && (ap->who == AMBIGUOUS || ap->who == who)) { + /* Got one */ + return ap; + } + } + return NULL; + } + + int + format_access(struct access *ap, int rulenum, + dbref who __attribute__ ((__unused__)), char *buff, char **bp) + { + if (ap) { + safe_format(buff, bp, T("Matched line %d: %s %s"), rulenum, ap->host, + (ap->can & ACS_REGEXP) ? "(regexp)" : ""); + safe_chr('\n', buff, bp); + safe_format(buff, bp, T("Comment: %s"), ap->comment); + safe_chr('\n', buff, bp); + safe_str(T("Connections allowed by: "), buff, bp); + if (ap->cant & ACS_CONNECT) + safe_str(T("No one"), buff, bp); + else if (ap->cant & ACS_ADMIN) + safe_str(T("All but admin"), buff, bp); + else if (ap->cant & ACS_WIZARD) + safe_str(T("All but wizards"), buff, bp); + else if (ap->cant & ACS_GOD) + safe_str(T("All but God"), buff, bp); + else + safe_str(T("All"), buff, bp); + safe_chr('\n', buff, bp); + if (ap->cant & ACS_GUEST) + safe_str(T("Guest connections are NOT allowed"), buff, bp); + else + safe_str(T("Guest connections are allowed"), buff, bp); + safe_chr('\n', buff, bp); + if (ap->cant & ACS_CREATE) + safe_str(T("Creation is NOT allowed"), buff, bp); + else + safe_str(T("Creation is allowed"), buff, bp); + safe_chr('\n', buff, bp); + if (ap->can & ACS_REGISTER) + safe_str(T("Email registration is allowed"), buff, bp); + if (ap->can & ACS_SUSPECT) + safe_str(T("Players connecting are set SUSPECT"), buff, bp); + if (ap->can & ACS_DENY_SILENT) + safe_str(T("Denied connections are not logged"), buff, bp); + } else { + safe_str(T("No matching access rule"), buff, bp); + } + return 0; + } + + /* Add an entry to the linked list after the @sitelock entry. * If there is no @sitelock entry, add one to the end of the list * and then add the entry. *************** *** 473,481 **** --- 539,549 ---- struct access *ap; acsflag *c; char flaglist[BUFFER_LEN]; + int rulenum = 0; char *bp; for (ap = access_top; ap; ap = ap->next) { + rulenum++; if (ap->can != ACS_SITELOCK) { bp = flaglist; for (c = acslist; c->name; c++) { *************** *** 493,500 **** } *bp = '\0'; notify_format(player, ! "SITE: %-20s DBREF: %-6s FLAGS:%s", ap->host, ! unparse_dbref(ap->who), flaglist); notify_format(player, " COMMENT: %s", ap->comment); } else { notify(player, --- 561,568 ---- } *bp = '\0'; notify_format(player, ! "%3d SITE: %-20s DBREF: %-6s FLAGS:%s", rulenum, ! ap->host, unparse_dbref(ap->who), flaglist); notify_format(player, " COMMENT: %s", ap->comment); } else { notify(player, *** 1_7_7.81/hdrs/version.h Tue, 24 Dec 2002 15:20:25 -0600 dunemush (pennmush/c/47_version.h 1.32.1.2.1.7.1.9.1.1.1.17.1.5 660) --- 1_7_7.84(w)/hdrs/version.h Wed, 25 Dec 2002 14:14:51 -0600 dunemush (pennmush/c/47_version.h 1.32.1.2.1.7.1.9.1.1.1.17.1.5 660) *************** *** 1,2 **** ! #define VERSION "PennMUSH version 1.7.7 patchlevel 2 [12/22/2002]" ! #define SHORTVN "PennMUSH 1.7.7p2" --- 1,2 ---- ! #define VERSION "PennMUSH version 1.7.7 patchlevel 3 [12/25/2002]" ! #define SHORTVN "PennMUSH 1.7.7p3" *** 1_7_7.81/hdrs/extchat.h Sun, 22 Dec 2002 01:05:36 -0600 dunemush (pennmush/d/17_extchat.h 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.3.1.1.1.1.2.1 660) --- 1_7_7.84(w)/hdrs/extchat.h Wed, 25 Dec 2002 14:14:51 -0600 dunemush (pennmush/d/17_extchat.h 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.3.1.1.1.1.2.1 660) *************** *** 91,98 **** struct chanlist *next; }; ! #define Chanlist(x) get_objdata(x, "CHANNELS") ! #define s_Chanlist(x, y) set_objdata(x, "CHANNELS", y) /* Channel type flags and macros */ #define CHANNEL_PLAYER 0x1 /* Players may join */ --- 91,98 ---- struct chanlist *next; }; ! #define Chanlist(x) ((struct chanlist *)get_objdata(x, "CHANNELS")) ! #define s_Chanlist(x, y) set_objdata(x, "CHANNELS", (void *)y) /* Channel type flags and macros */ #define CHANNEL_PLAYER 0x1 /* Players may join */ *** 1_7_7.81/hdrs/access.h Tue, 09 Apr 2002 11:29:01 -0500 dunemush (pennmush/d/28_access.h 1.5.1.2 660) --- 1_7_7.84(w)/hdrs/access.h Wed, 25 Dec 2002 14:14:50 -0600 dunemush (pennmush/d/28_access.h 1.5.1.3 660) *************** *** 1,6 **** --- 1,17 ---- #ifndef __ACCESS_H #define __ACCESS_H + /* A linked list data structure to hold the access info */ + struct access { + char host[BUFFER_LEN]; + char comment[BUFFER_LEN]; + dbref who; + int can; + int cant; + struct access *next; + }; + + /* These flags are can/can't - a site may or may not be allowed to do them */ #define ACS_CONNECT 0x1 /* Connect to non-guests */ #define ACS_CREATE 0x2 /* Create new players */ *************** *** 33,38 **** --- 44,53 ---- int read_access_file(void); void write_access_file(void); int site_can_access(const char *hname, int flag, dbref who); + struct access *site_check_access(const char *hname, dbref who, int *rulenum); + int format_access(struct access *ap, int rulenum, + dbref who + __attribute__ ((__unused__)), char *buff, char **bp); int add_access_sitelock(dbref player, const char *host, dbref who, int can, int cant); int remove_access_sitelock(const char *pattern);