int safeputprop(dbref obj, dbref perms, char *buf, char *val) { char *ptr; if (!buf) return 0; while (*buf == PROPDIR_DELIMITER) buf++; if (!*buf) return 0; if (tp_db_readonly) return 0; /* disallow CR's and :'s in prop names. */ for (ptr = buf; *ptr; ptr++) if (*ptr == '\r' || *ptr == PROP_DELIMITER) return 0; if (!Archperms(perms)) { if (Prop_Hidden(buf)) return 0; } if (!Wizperms(perms)) { if (Prop_SeeOnly(buf)) return 0; } if (!val) { remove_property(obj, buf); } else { add_property(obj, buf, val, 0); } return 1; }
const char * safegetprop_strict(dbref player, dbref what, dbref perms, const char *inbuf) { const char *ptr; char bbuf[BUFFER_LEN]; char vl[32]; if (!inbuf) { notify_nolisten(player, "PropFetch: Propname required.", 1); return NULL; } while (*inbuf == PROPDIR_DELIMITER) inbuf++; if (!*inbuf) { notify_nolisten(player, "PropFetch: Propname required.", 1); return NULL; } strcpy(bbuf, inbuf); if (!Archperms(perms)) { if (Prop_Hidden(bbuf)) { notify_nolisten(player, "PropFetch: Permission denied.", 1); return NULL; } if (Prop_Private(bbuf) && OWNER(perms) != OWNER(what)) { notify_nolisten(player, "PropFetch: Permission denied.", 1); return NULL; } } ptr = get_property_class(what, bbuf); if (!ptr) { int i; i = get_property_value(what, bbuf); if (!i) { dbref dd; dd = get_property_dbref(what, bbuf); if (dd == NOTHING) { *vl = '\0'; ptr = vl; return ptr; } else { sprintf(vl, "#%d", dd); ptr = vl; } } else { sprintf(vl, "%d", i); ptr = vl; } } #ifdef COMPRESS ptr = uncompress(ptr); #endif return ptr; }
const char * mfn_force(MFUNARGS) { char *nxt, *ptr; dbref obj = mesg_dbref_raw(player, what, perms, argv[0]); if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME) ABORT_MPI("FORCE","Failed match. (1)"); if (obj == PERMDENIED) ABORT_MPI("FORCE","Permission denied. (1)"); if (Typeof(obj) != TYPE_THING && Typeof(obj) != TYPE_PLAYER) ABORT_MPI("FORCE","Bad object reference. (1)"); if (!*argv[1]) ABORT_MPI("FORCE","Null command string. (2)"); if (!tp_zombies && !Archperms(perms)) ABORT_MPI("FORCE",NOPERM_MESG); if (!Archperms(perms)) { const char *ptr = RNAME(obj); char objname[BUFFER_LEN], *ptr2; dbref loc = getloc(obj); if (Typeof(obj) == TYPE_THING) { if (FLAGS(obj) & DARK) ABORT_MPI("FORCE","Cannot force a dark puppet"); if ((FLAGS(OWNER(obj)) & ZOMBIE)) ABORT_MPI("FORCE",NOPERM_MESG); if (loc != NOTHING && (FLAGS(loc) & ZOMBIE) && Typeof(loc) == TYPE_ROOM) ABORT_MPI("FORCE","Cannot force a Puppet in a no-puppets room"); for (ptr2 = objname; *ptr && !isspace(*ptr);) *(ptr2++) = *(ptr++); *ptr2 = '\0'; if (lookup_player(objname) != NOTHING) ABORT_MPI("FORCE","Cannot force a thing named after a player"); } if (!(FLAGS(obj) & XFORCIBLE)) { ABORT_MPI("FORCE",NOPERM_MESG); } if (!test_lock_false_default(perms, obj, "@/flk")) { ABORT_MPI("FORCE",NOPERM_MESG); } } if (Man(obj) && !TMan(perms)) ABORT_MPI("FORCE","You can't force " NAMEMAN); if (!controls(OWNER(perms),obj)) ABORT_MPI("FORCE",NOPERM_MESG); if ((WLevel(OWNER(perms)) < WLevel(obj)) || (WLevel(perms) < WLevel(obj)) ) ABORT_MPI("FORCE",NOPERM_MESG); if (force_level) ABORT_MPI("FORCE","You can't force recursively"); strcpy(buf, argv[1]); ptr = buf; do { nxt = index(ptr, '\r'); if (nxt) *nxt++ = '\0'; force_level++; if (*ptr) process_command(obj, ptr, 0); force_level--; ptr = nxt; } while (ptr); *buf = '\0'; return ""; }