void do_unbless(int descr, dbref player, const char *what, const char *propname) { dbref victim; struct match_data md; char buf[BUFFER_LEN]; int cnt; if (!Wizard(player) || Typeof(player) != TYPE_PLAYER) { notify(player, "Only Wizard players may use this command."); return; } if (!propname || !*propname) { notify(player, "Usage is @unbless object=propname."); return; } /* get victim */ init_match(descr, player, what, NOTYPE, &md); match_everything(&md); if ((victim = noisy_match_result(&md)) == NOTHING) { return; } if (!Wizard(OWNER(player))) { notify(player, "Permission denied. (You're not a wizard)"); return; } cnt = blessprops_wildcard(player, victim, "", propname, 0); snprintf(buf, sizeof(buf), "%d propert%s unblessed.", cnt, (cnt == 1)? "y" : "ies"); notify(player, buf); }
/** Is a name a valid player name when applied by player to thing? * Player names must be valid object names, but also not forbidden (unless * the player is a wizard). They are * subject to a different length limit, and subject to more stringent * restrictions on valid characters. Finally, it can't be the same as * an existing player name or alias unless it's one of theirs. * \param name name to check. * \param player player for permission checks. * \param thing player who will get the name. * \retval 1 name is valid for players. * \retval 0 name is not valid for players. */ int ok_player_name(const char *name, dbref player, dbref thing) { const char *scan, *good; dbref lookup; if (!ok_name(name, 0) || strlen(name) > (size_t) PLAYER_NAME_LIMIT) return 0; good = (PLAYER_NAME_SPACES || Wizard(player) ? " `$_-.,'" : "`$_-.,'"); /* Make sure that the name contains legal characters only */ for (scan = name; scan && *scan; scan++) { if (isalnum(*scan)) continue; if (!strchr(good, *scan)) return 0; } lookup = lookup_player(name); /* A player may only change to a forbidden name if they're already using that name. */ if (forbidden_name(name)) { if (!((GoodObject(player) && Wizard(player)) || (GoodObject(thing) && lookup == thing))) { return 0; } } return ((lookup == NOTHING) || (lookup == thing)); }
/** Actually change the ownership of something, and fix bits. * \param player the enactor. * \param thing object to change ownership of. * \param newowner new owner for thing. * \param preserve if 1, preserve privileges and don't halt. */ void chown_object(dbref player, dbref thing, dbref newowner, int preserve) { (void) undestroy(player, thing); if (God(player)) { Owner(thing) = newowner; } else { Owner(thing) = Owner(newowner); } /* Don't allow circular zones */ Zone(thing) = NOTHING; if (GoodObject(Zone(newowner))) { dbref tmp; int ok_to_zone = 1; int zone_depth = MAX_ZONES; for (tmp = Zone(Zone(newowner)); GoodObject(tmp); tmp = Zone(tmp)) { if (tmp == thing) { notify(player, T("Circular zone broken.")); ok_to_zone = 0; break; } if (tmp == Zone(tmp)) /* Ran into an object zoned to itself */ break; zone_depth--; if (!zone_depth) { ok_to_zone = 0; notify(player, T("Overly deep zone chain broken.")); break; } } if (ok_to_zone) Zone(thing) = Zone(newowner); } clear_flag_internal(thing, "CHOWN_OK"); if (!preserve || !Wizard(player)) { clear_flag_internal(thing, "WIZARD"); clear_flag_internal(thing, "ROYALTY"); clear_flag_internal(thing, "TRUST"); set_flag_internal(thing, "HALT"); destroy_flag_bitmask("POWER", Powers(thing)); Powers(thing) = new_flag_bitmask("POWER"); do_halt(thing, "", thing); } else { if (preserve == 1 && (newowner != player) && Wizard(thing) && !Wizard(newowner)) { notify_format(player, T("Warning: WIZ flag reset on #%d because " "@CHOWN/PRESERVE is to a non-WIZ flagged third-party."), thing); clear_flag_internal(thing, "WIZARD"); } if (!null_flagmask("POWER", Powers(thing)) || Wizard(thing) || Royalty(thing) || Inherit(thing)) notify_format(player, T("Warning: @CHOWN/PRESERVE on an object (#%d) " "with WIZ, ROY, INHERIT, or @power privileges."), thing); } }
static void process_leave_loc(dbref thing, dbref dest, dbref cause, int canhear, int hush) { dbref loc; int quiet, pattr, oattr, aattr; loc = Location(thing); if((loc == NOTHING) || (loc == dest)) return; if(dest == HOME) dest = Home(thing); /* * Run the LEAVE attributes in the current room if we meet any of * * * * * * * following criteria: * - The current room has wizard privs. * * - * * * Neither the current room nor the moving object are dark. * * - The * * * moving object can hear and does not hav wizard * privs. * EXCEPT * if * * we were called with the HUSH_LEAVE key. */ quiet = (!(Wizard(loc) || (!Dark(thing) && !Dark(loc)) || (canhear && !(Wizard(thing) && Dark (thing))))) || (hush & HUSH_LEAVE); oattr = quiet ? 0 : A_OLEAVE; aattr = quiet ? 0 : A_ALEAVE; pattr = (!mudconf.terse_movemsg && Terse(thing)) ? 0 : A_LEAVE; did_it(thing, loc, pattr, NULL, oattr, NULL, aattr, (char **) NULL, 0); /* * Do OXENTER for receiving room */ if((dest != NOTHING) && !quiet) did_it(thing, dest, 0, NULL, A_OXENTER, NULL, 0, (char **) NULL, 0); /* * Display the 'has left' message if we meet any of the following * * * * * * * criteria: * - Neither the current room nor the moving * object are * * * dark. * - The object can hear and is not a dark * wizard. */ if(!quiet) if((!Dark(thing) && !Dark(loc)) || (canhear && !(Wizard(thing) && Dark(thing)))) { notify_except2(loc, thing, thing, cause, tprintf("%s has left.", Name(thing))); } }
/* * --------------------------------------------------------------------------- * * process_enter_loc: Generate messages and actions resulting from entering * * a place. */ static void process_enter_loc(dbref thing, dbref src, dbref cause, int canhear, int hush) { dbref loc; int quiet, pattr, oattr, aattr; loc = Location(thing); if((loc == NOTHING) || (loc == src)) return; /* * Run the ENTER attributes in the current room if we meet any of * * * * * * * following criteria: * - The current room has wizard privs. * * - * * * Neither the current room nor the moving object are dark. * * - The * * * moving object can hear and does not hav wizard * privs. * EXCEPT * if * * we were called with the HUSH_ENTER key. */ quiet = (!(Wizard(loc) || (!Dark(thing) && !Dark(loc)) || (canhear && !(Wizard(thing) && Dark (thing))))) || (hush & HUSH_ENTER); oattr = quiet ? 0 : A_OENTER; aattr = quiet ? 0 : A_AENTER; pattr = (!mudconf.terse_movemsg && Terse(thing)) ? 0 : A_ENTER; did_it(thing, loc, pattr, NULL, oattr, NULL, aattr, (char **) NULL, 0); /* * Do OXLEAVE for sending room */ if((src != NOTHING) && !quiet) did_it(thing, src, 0, NULL, A_OXLEAVE, NULL, 0, (char **) NULL, 0); /* * Display the 'has arrived' message if we meet all of the following * * * * * criteria: * - The moving object can hear. * - The object * is * * not * a dark wizard. */ if(!quiet && canhear && !(Dark(thing) && Wizard(thing))) { notify_except2(loc, thing, thing, cause, tprintf("%s has arrived.", Name(thing))); } }
int fh_dark_bit( dbref target, dbref player, FLAG flag, int fflags, int reset ) { if( !reset && isPlayer( target ) && !( ( target == player ) && Can_Hide( player ) ) && ( !Wizard( player ) && !God( player ) ) ) { return 0; } return ( fh_any( target, player, flag, fflags, reset ) ); }
int has_power(dbref player, dbref it, char *powername) { POWERENT *fp; POWER fv; fp = find_power(it, powername); if (fp == NULL) { return 0; } if (fp->powerpower & POWER_EXT) { fv = Powers2(it); } else { fv = Powers(it); } if (fv & fp->powervalue) { if ((fp->listperm & CA_WIZARD) && !Wizard(player)) { return 0; } if ((fp->listperm & CA_GOD) && !God(player)) { return 0; } return 1; } return 0; }
char *flag_description( dbref player, dbref target ) { char *buff, *bp; FLAGENT *fp; int otype; FLAG fv; /* * Allocate the return buffer */ otype = Typeof( target ); bp = buff = alloc_mbuf( "flag_description" ); /* * Store the header strings and object type */ safe_mb_str( ( char * ) "Type: ", buff, &bp ); safe_mb_str( ( char * ) object_types[otype].name, buff, &bp ); safe_mb_str( ( char * ) " Flags:", buff, &bp ); if( object_types[otype].perm != CA_PUBLIC ) { return buff; } /* * Store the type-invariant flags */ for( fp = gen_flags; fp->flagname; fp++ ) { if( fp->flagflag & FLAG_WORD3 ) { fv = Flags3( target ); } else if( fp->flagflag & FLAG_WORD2 ) { fv = Flags2( target ); } else { fv = Flags( target ); } if( fv & fp->flagvalue ) { if( ( fp->listperm & CA_WIZARD ) && !Wizard( player ) ) { continue; } if( ( fp->listperm & CA_GOD ) && !God( player ) ) { continue; } /* * don't show CONNECT on dark wizards to mortals */ if( isPlayer( target ) && isConnFlag( fp ) && Can_Hide( target ) && Hidden( target ) && !See_Hidden( player ) ) { continue; } safe_mb_chr( ' ', buff, &bp ); safe_mb_str( ( char * ) fp->flagname, buff, &bp ); } } return buff; }
void do_whisper(int descr, dbref player, const char *arg1, const char *arg2) { dbref who; char buf[BUFFER_LEN]; struct match_data md; init_match(descr, player, arg1, TYPE_PLAYER, &md); match_neighbor(&md); match_me(&md); if (Wizard(player) && Typeof(player) == TYPE_PLAYER) { match_absolute(&md); match_player(&md); } switch (who = match_result(&md)) { case NOTHING: notify(player, "Whisper to whom?"); break; case AMBIGUOUS: notify(player, "I don't know who you mean!"); break; default: snprintf(buf, sizeof(buf), "%s whispers, \"%s\"", NAME(player), arg2); if (!notify_from(player, who, buf)) { snprintf(buf, sizeof(buf), "%s is not connected.", NAME(who)); notify(player, buf); break; } snprintf(buf, sizeof(buf), "You whisper, \"%s\" to %s.", arg2, NAME(who)); notify(player, buf); break; } }
/** Is a alias a valid player alias-list for thing? * It must be a semicolon-separated list of valid player names * with no more than than MAX_ALIASES names, if the player isn't * a wizard. * \param alias list to check. * \param player player for permission checks. * \param thing player who is being aliased. * \return One of the OPAE_* constants defined in hdrs/attrib.h */ enum opa_error ok_player_alias(const char *alias, dbref player, dbref thing) { char tbuf1[BUFFER_LEN], *s, *sp; int cnt = 0; if (!alias || !*alias) return OPAE_NULL; strncpy(tbuf1, alias, BUFFER_LEN - 1); tbuf1[BUFFER_LEN - 1] = '\0'; s = trim_space_sep(tbuf1, ALIAS_DELIMITER); while (s) { sp = split_token(&s, ALIAS_DELIMITER); while (sp && *sp && *sp == ' ') sp++; if (!sp || !*sp) return OPAE_NULL; /* No null aliases */ if (!ok_player_name(sp, player, thing)) return OPAE_INVALID; cnt++; } if (Wizard(player)) return OPAE_SUCCESS; if (cnt > MAX_ALIASES) return OPAE_TOOMANY; return OPAE_SUCCESS; }
void do_dump(dbref player, const char *newfile) { char buf[BUFFER_LEN]; if (Wizard(player)) { #ifndef DISKBASE if (global_dumper_pid != 0) { notify(player, "Sorry, there is already a dump currently in progress."); return; } #endif if (*newfile #ifdef GOD_PRIV && God(player) #endif /* GOD_PRIV */ ) { if (dumpfile) free((void *) dumpfile); dumpfile = alloc_string(newfile); snprintf(buf, sizeof(buf), "Dumping to file %s...", dumpfile); } else { snprintf(buf, sizeof(buf), "Dumping..."); } notify(player, buf); dump_db_now(); } else { notify(player, "Sorry, you are in a no dumping zone."); } }
void do_motd(dbref player, char *text) { time_t lt; char buf[BUFFER_LEN]; if (!*text || !Wizard(OWNER(player))) { spit_file(player, tp_file_motd); return; } if (!strcasecmp(text, "clear")) { unlink(tp_file_motd); log2file(tp_file_motd, "%s %s", "- - - - - - - - - - - - - - - - - - -", "- - - - - - - - - - - - - - - - - - -"); notify(player, "MOTD cleared."); return; } lt = time(NULL); strftime(buf, sizeof(buf), "%a %b %d %T %Z %Y", localtime(<)); log2file(tp_file_motd, "%s", buf); add_motd_text_fmt(text); log2file(tp_file_motd, "%s %s", "- - - - - - - - - - - - - - - - - - -", "- - - - - - - - - - - - - - - - - - -"); notify(player, "MOTD updated."); }
void do_newpassword(dbref player, const char *name, const char *password) { dbref victim; char buf[BUFFER_LEN]; if (!Wizard(player) || Typeof(player) != TYPE_PLAYER) { notify(player, "Only a Wizard player can newpassword someone."); return; } else if ((victim = lookup_player(name)) == NOTHING) { notify(player, "No such player."); } else if (*password != '\0' && !ok_password(password)) { /* Wiz can set null passwords, but not bad passwords */ notify(player, "Bad password"); #ifdef GOD_PRIV } else if (God(victim)) { notify(player, "You can't change God's password!"); return; } else { if (TrueWizard(victim) && !God(player)) { notify(player, "Only God can change a wizard's password."); return; } #else /* GOD_PRIV */ } else {
void display_flagtab(dbref player) { UTF8 *buf, *bp; FLAGNAMEENT *fp; bp = buf = alloc_lbuf("display_flagtab"); safe_str(T("Flags:"), buf, &bp); for (fp = gen_flag_names; fp->flagname; fp++) { FLAGBITENT *fbe = fp->fbe; if ( ( (fbe->listperm & CA_WIZARD) && !Wizard(player)) || ( (fbe->listperm & CA_GOD) && !God(player))) { continue; } safe_chr(' ', buf, &bp); safe_str(fp->flagname, buf, &bp); if (fbe->flaglett != ' ') { safe_chr('(', buf, &bp); if (!fp->bPositive) { safe_chr('!', buf, &bp); } safe_chr(fbe->flaglett, buf, &bp); safe_chr(')', buf, &bp); } } *bp = '\0'; notify(player, buf); free_lbuf(buf); }
void do_bless(int descr, dbref player, const char *what, const char *propname) { dbref victim; struct match_data md; char buf[BUFFER_LEN]; int cnt; if (force_level) { notify(player, "Can't @force an @bless."); return; } if (!Wizard(player) || Typeof(player) != TYPE_PLAYER) { notify(player, "Only Wizard players may use this command."); return; } if (!propname || !*propname) { notify(player, "Usage is @bless object=propname."); return; } /* get victim */ init_match(descr, player, what, NOTYPE, &md); match_everything(&md); if ((victim = noisy_match_result(&md)) == NOTHING) { return; } #ifdef GOD_PRIV if(tp_strict_god_priv && !God(player) && God(OWNER(victim))) { notify(player, "Only God may touch God's stuff."); return; } #endif if (!Wizard(OWNER(player))) { notify(player, "Permission denied. (you're not a wizard)"); return; } cnt = blessprops_wildcard(player, victim, "", propname, 1); snprintf(buf, sizeof(buf), "%d propert%s blessed.", cnt, (cnt == 1)? "y" : "ies"); notify(player, buf); }
/** Can a player control a thing? * The control rules are, in order: * Only God controls God. * Wizards control everything else. * Nothing else controls a wizard, and only royalty control royalty. * Mistrusted objects control only themselves. * Objects with the same owner control each other, unless the * target object is TRUST and the would-be controller isn't. * If ZMOs allow control, and you pass the ZMO, you control. * If the owner is a Zone Master, and you pass the ZM, you control. * If you pass the control lock, you control. * Otherwise, no dice. * \param who object attempting to control. * \param what object to be controlled. * \retval 1 who controls what. * \retval 0 who doesn't control what. */ int controls(dbref who, dbref what) { boolexp c; if (!GoodObject(what)) return 0; if (Guest(who)) return 0; if (what == who) return 1; if (God(what)) return 0; if (Wizard(who)) return 1; if (Wizard(what) || (Hasprivs(what) && !Hasprivs(who))) return 0; if (Mistrust(who)) return 0; if (Owns(who, what) && (!Inheritable(what) || Inheritable(who))) return 1; if (Inheritable(what) || IsPlayer(what)) return 0; if (!ZONE_CONTROL_ZMP && (Zone(what) != NOTHING) && eval_lock(who, Zone(what), Zone_Lock)) return 1; if (ZMaster(Owner(what)) && !IsPlayer(what) && eval_lock(who, Owner(what), Zone_Lock)) return 1; c = getlock_noparent(what, Control_Lock); if (c != TRUE_BOOLEXP) { if (eval_boolexp(who, c, what, NULL)) return 1; } return 0; }
int ph_wiz(dbref target, dbref player, POWER power, int fpowers, int reset) { if (!Wizard(player) & !God(player)) { return 0; } return (ph_any(target, player, power, fpowers, reset)); }
int ph_restrict_player(dbref target, dbref player, POWER power, int fpowers, int reset) { if (isPlayer(target) && !Wizard(player) && !God(player)) { return 0; } return (ph_any(target, player, power, fpowers, reset)); }
static bool fh_wiz(dbref target, dbref player, FLAG flag, int fflags, bool reset) { if (!Wizard(player)) { return false; } return (fh_any(target, player, flag, fflags, reset)); }
int blessprops_wildcard(dbref player, dbref thing, const char *dir, const char *wild, int blessp) { char propname[BUFFER_LEN]; char wld[BUFFER_LEN]; char buf[BUFFER_LEN]; char buf2[BUFFER_LEN]; char *ptr, *wldcrd = wld; PropPtr propadr, pptr; int i, cnt = 0; int recurse = 0; #ifdef GOD_PRIV if(tp_strict_god_priv && !God(player) && God(OWNER(thing))) { notify(player,"Only God may touch what is God's."); return 0; } #endif strcpyn(wld, sizeof(wld), wild); i = strlen(wld); if (i && wld[i - 1] == PROPDIR_DELIMITER) strcatn(wld, sizeof(wld), "*"); for (wldcrd = wld; *wldcrd == PROPDIR_DELIMITER; wldcrd++) ; if (!strcmp(wldcrd, "**")) recurse = 1; for (ptr = wldcrd; *ptr && *ptr != PROPDIR_DELIMITER; ptr++) ; if (*ptr) *ptr++ = '\0'; propadr = first_prop(thing, (char *) dir, &pptr, propname, sizeof(propname)); while (propadr) { if (equalstr(wldcrd, propname)) { snprintf(buf, sizeof(buf), "%s%c%s", dir, PROPDIR_DELIMITER, propname); if (!Prop_System(buf) && ((!Prop_Hidden(buf) && !(PropFlags(propadr) & PROP_SYSPERMS)) || Wizard(OWNER(player)))) { if (!*ptr || recurse) { cnt++; if (blessp) { set_property_flags(thing, buf, PROP_BLESSED); snprintf(buf2, sizeof(buf2), "Blessed %s", buf); } else { clear_property_flags(thing, buf, PROP_BLESSED); snprintf(buf2, sizeof(buf2), "Unblessed %s", buf); } notify(player, buf2); } if (recurse) ptr = "**"; cnt += blessprops_wildcard(player, thing, buf, ptr, blessp); } } propadr = next_prop(pptr, propadr, propname, sizeof(propname)); } return cnt; }
/* determines if a player can set a flag based on permission level * 0 indicates they can, 1 indicates they cannot. Only checks flagset2. */ bool restricted2(dbref player, dbref thing, object_flag_type flag) { switch (flag) { case F2GUEST: return (!Mage(OWNER(player))); break; case F2LOGWALL: return (!Arch(OWNER(player))); case F2HIDDEN: /* HIDDEN is now also EXTPERMS for programs */ if (Typeof(thing) == TYPE_PROGRAM) { return !controls(player, thing); } else { if (Typeof(thing) == TYPE_PLAYER) return (!Arch(OWNER(player)) && !(POWERS(player) & POW_HIDE)); else return 1; } case F2ANTIPROTECT: if (Typeof(thing) == TYPE_PLAYER) return (!Boy(OWNER(player))); else return 1; #ifdef CONTROLS_SUPPORT case F2CONTROLS: /* only by W4. Not even by things they own. */ if (Typeof(thing) == TYPE_PLAYER) return (!Boy(player)); if (Typeof(thing) == TYPE_PROGRAM) return (!Wizard(player)); /* anything else, if I truly control it. */ return !truecontrols(player, thing); break; #endif case F2MOBILE: return !(MLevel(OWNER(player)) >= tp_userflag_mlev); break; case F2SUSPECT: return (!Wizard(OWNER(player))); default: return 0; break; } }
/** Wizard command to check all objects. * \verbatim * This implements @wcheck/all. * \endverbatim * \param player the enactor. */ void do_wcheck_all(dbref player) { if (!Wizard(player)) { notify(player, T("You'd better check your wizbit first.")); return; } notify(player, T("Running database topology warning checks")); run_topology(); notify(player, T("Warning checks complete.")); }
/* Clone an object. The new object is owned by the cloning player */ static dbref clone_object(dbref player, dbref thing, const char *newname, int preserve) { dbref clone; clone = new_object(); Owner(clone) = Owner(player); Name(clone) = NULL; if (newname && *newname) set_name(clone, newname); else set_name(clone, Name(thing)); s_Pennies(clone, Pennies(thing)); AttrCount(clone) = 0; List(clone) = NULL; Locks(clone) = NULL; clone_locks(player, thing, clone); Zone(clone) = Zone(thing); Parent(clone) = Parent(thing); Flags(clone) = clone_flag_bitmask("FLAG", Flags(thing)); if (!preserve) { clear_flag_internal(clone, "WIZARD"); clear_flag_internal(clone, "ROYALTY"); Warnings(clone) = 0; /* zap warnings */ Powers(clone) = new_flag_bitmask("POWER"); /* zap powers */ } else { Powers(clone) = clone_flag_bitmask("POWER", Powers(thing)); Warnings(clone) = Warnings(thing); if (Wizard(clone) || Royalty(clone) || Warnings(clone) || !null_flagmask("POWER", Powers(clone))) notify(player, T ("Warning: @CLONE/PRESERVE on an object with WIZ, ROY, @powers, or @warnings.")); } /* We give the clone the same modification time that its * other clone has, but update the creation time */ ModTime(clone) = ModTime(thing); CreTime(clone) = mudtime; Type(clone) = Type(thing); Contents(clone) = Location(clone) = Next(clone) = NOTHING; if (IsRoom(thing)) Exits(clone) = NOTHING; else Home(clone) = Home(thing); atr_cpy(clone, thing); queue_event(player, "OBJECT`CREATE", "%s,%s", unparse_objid(clone), unparse_objid(thing)); return clone; }
void do_restart(dbref player) { if (Wizard(player) && Typeof(player) == TYPE_PLAYER) { log_status("SHUTDOWN & RESTART: by %s", unparse_object(player, player)); shutdown_flag = 1; restart_flag = 1; } else { notify(player, "Your delusions of grandeur have been duly noted."); log_status("ILLEGAL RESTART: tried by %s", unparse_object(player, player)); } }
void do_shutdown(dbref player) { if (Wizard(player)) { log_status("SHUTDOWN: by %s", unparse_object(player, player)); shutdown_flag = 1; restart_flag = 0; } else { notify(player, "Your delusions of grandeur have been duly noted."); log_status("ILLEGAL SHUTDOWN: tried by %s", unparse_object(player, player)); } }
static bool fh_dark_bit(dbref target, dbref player, FLAG flag, int fflags, bool reset) { if ( !reset && isPlayer(target) && !( (target == player) && Can_Hide(player)) && !Wizard(player)) { return false; } return (fh_any(target, player, flag, fflags, reset)); }
/** Decide if a host can access someway. * \param hname a host or user+host pattern. * \param flag the access type we're testing. * \param who the player attempting access. * \retval 1 access permitted. * \retval 0 access denied. * \verbatim * Given a hostname and a flag decide if the host can do it. * Here's how it works: * We run the linked list and take the first match. * (If the hostname is user@host, we try to match both user@host * and just host to each line in the file.) * If we make a match, and the line tells us whether the site can/can't * do the action, we're done. * Otherwise, we assume that the host can do any toggleable option * (can create, connect, guest), and don't have any special * flags (can't register, isn't suspect) * \endverbatim */ bool site_can_access(const char *hname, uint32_t flag, dbref who) { struct access *ap; acsflag *c; const char *p; if (!hname || !*hname) return 0; if ((p = strchr(hname, '@'))) p++; for (ap = access_top; ap; ap = ap->next) { if (ap->can & ACS_SITELOCK) continue; if ((ap->can & ACS_REGEXP) ? (qcomp_regexp_match(ap->re, hname) || (p && qcomp_regexp_match(ap->re, p))) : (quick_wild(ap->host, hname) || (p && quick_wild(ap->host, p))) && (ap->who == AMBIGUOUS || ap->who == who)) { /* Got one */ if (flag & ACS_CONNECT) { if ((ap->cant & ACS_GOD) && God(who)) /* God can't connect from here */ return 0; else if ((ap->cant & ACS_WIZARD) && Wizard(who)) /* Wiz can't connect from here */ return 0; else if ((ap->cant & ACS_ADMIN) && Hasprivs(who)) /* Wiz and roy can't connect from here */ return 0; } if (ap->cant && ((ap->cant & flag) == flag)) return 0; if (ap->can && (ap->can & flag)) return 1; /* Hmm. We don't know if we can or not, so continue */ break; } } /* Flag was neither set nor unset. If the flag was a toggle, * then the host can do it. If not, the host can't */ for (c = acslist; c->name; c++) { if (flag & c->flag) return c->toggle ? 1 : 0; } /* Should never reach here, but just in case */ return 1; }
void destroy_guest(dbref guest) { if(!Wizard(mudconf.guest_nuker) || !Good_obj(mudconf.guest_nuker)) mudconf.guest_nuker = 1; if(!Guest(guest)) return; toast_player(guest); atr_add_raw(guest, A_DESTROYER, tprintf("%d", mudconf.guest_nuker)); destroy_player(guest); destroy_obj(mudconf.guest_nuker, guest); }
void do_delta(dbref player) { if (Wizard(player)) { #ifdef DELTADUMPS notify(player, "Dumping deltas..."); delta_dump_now(); #else notify(player, "Sorry, this server was compiled without DELTADUMPS."); #endif } else { notify(player, "Sorry, you are in a no dumping zone."); } }
static int chown_ok(dbref player, dbref thing, dbref newowner, NEW_PE_INFO *pe_info) { /* Can't touch garbage */ if (IsGarbage(thing)) return 0; /* Wizards can do it all */ if (Wizard(player)) return 1; /* In order for non-wiz player to @chown thing to newowner, * player must control newowner or newowner must be a Zone Master * and player must pass its zone lock. * * In addition, one of the following must apply: * 1. player owns thing, or * 2. player controls Owner(thing), newowner is a zone master, * and Owner(thing) passes newowner's zone-lock, or * 3. thing is CHOWN_OK, and player holds thing if it's an object. * * The third condition is syntactic sugar to handle the situation * where Joe owns Box, an ordinary object, and Tool, an inherit object, * and ZMP, a Zone Master Player, is zone-locked to =tool. * In this case, if Joe doesn't pass ZMP's lock, we don't want * Joe to be able to @fo Tool=@chown Box=ZMP */ /* Does player control newowner, or is newowner a Zone Master and player * passes the lock? */ if (!(controls(player, newowner) || (ZMaster(newowner) && eval_lock_with(player, newowner, Zone_Lock, pe_info)))) return 0; /* Target player is legitimate. Does player control the object? */ if (Owns(player, thing)) return 1; if (controls(player, Owner(thing)) && ZMaster(newowner) && eval_lock_with(Owner(thing), newowner, Zone_Lock, pe_info)) return 1; if ((!IsThing(thing) || (Location(thing) == player)) && ChownOk(thing) && eval_lock_with(player, thing, Chown_Lock, pe_info)) return 1; return 0; }