void open_datagram() { ACCESS_CHECK(previous_object() <- LIB_CONN); ACCESS_CHECK(previous_object()->query_user() == this_object()); call_limited("limited_open_datagram"); }
void receive_datagram(string packet) { ACCESS_CHECK(previous_object() <- LIB_CONN); ACCESS_CHECK(previous_object()->query_user() == this_object()); call_limited("limited_receive_datagram", packet); }
void logout(int quit) { ACCESS_CHECK(previous_object() <- LIB_CONN); ACCESS_CHECK(previous_object()->query_user() == this_object()); call_limited("limited_logout", quit); }
void init() { if( !previous_object() || !userp(previous_object()) ) return; call_out( "fire_wound", 3,previous_object()); }
varargs string gateway(mixed args){ string pass_hash, who, password, ip; string ret = ""; int max_tries = 3; int no_user = 0; if(ENABLE_CREWEB){ ip = previous_object()->GetIp(); if(!args || !stringp(args)) args = "123456789101112"; if(sscanf(args,"%s&%s",who, password) != 2){ ret = "<br>"; } else { who = lower_case(who); if(!strsrch(who,"username="******"username="******"",1); if(!strsrch(password,"password="******"password="******"",1); if(!ret && !user_exists(who)){ no_user = 1; } else { if(!Tries) Tries = ([]); if(!Tries[ip]) Tries[ip] = 0; if(no_user) pass_hash = alpha_crypt(32); else pass_hash = PLAYERS_D->GetPlayerData(who,"Password"); if(pass_hash != crypt(password, pass_hash)){ Tries[ip]++; ret = "Fail! Tries left: "+(max_tries - Tries[ip])+"<br>"; if(Tries[ip] >= max_tries){ previous_object()->eventBlockIp(); Tries[ip] = 0; } } else { string shibboleth = alpha_crypt(32); string packet=who+"."+shibboleth; WEB_SESSIONS_D->StartSession(ip,who,shibboleth); ret = "Login successful<br>"; Tries[ip] = 0; ret += "<meta http-equiv=\"Set-Cookie\" content=\"creweb="+packet+";path=/\">"; ret += "<META http-equiv=\"refresh\" content=\"1;URL=creweb.html\">"; return ret; } } } ret += "Log in to CreWeb using your mud username and mud password.<br><br>"; ret += "<FORM ACTION=\"login.html\" METHOD=POST>"; ret += "username: <INPUT TYPE=TEXT NAME=\"username\" MAXLENGTH=32><BR>"; ret += "password: <INPUT TYPE=PASSWORD NAME=\"password\" MAXLENGTH=32>"; ret += "<P><INPUT TYPE=SUBMIT VALUE=\"submit\">"; ret += "</FORM>"; ret += "<br>"; } else {
object get_proxy(string user) { object proxy; int firstchar; string creator; ACCESS_CHECK(PRIVILEGED() || INTERFACE()); creator = DRIVER->creator(previous_program()); CHECKARG(user && user != "" && STRINGD->is_valid_username(user), 1, "get_proxy"); check_security(user, creator); proxy = new_object("~/lwo/proxy", user); /* only the object who requested a proxy is allowed to use it */ proxy->set_client(previous_object()); if (audit) { INITD->message("User access proxy being issued to " + creator + " for " + user + ", assigned to " + object_name(previous_object())); } return proxy; }
int message_done() { ACCESS_CHECK(previous_object() <- LIB_CONN); ACCESS_CHECK(previous_object()->query_user() == this_object()); return call_limited("limited_message_done"); }
int login(string str) { ACCESS_CHECK(previous_object() <- LIB_CONN); ACCESS_CHECK(previous_object()->query_user() == this_object()); return call_limited("limited_login", str); }
int receive_message(string str) { ACCESS_CHECK(previous_object() <- LIB_CONN); ACCESS_CHECK(previous_object()->query_user() == this_object()); return call_limited("limited_receive_message", str); }
void init() { ::init(); if( !previous_object() || !userp(previous_object()) || wizardp(previous_object()) ) return; call_out( "death_stage", 3, previous_object(), 0 ); }
player_died() { looser=previous_object()->query_name(); loos=previous_object(); remove_call_out("duel_end"); remove_call_out("duel_end"); remove_call_out("duel_end"); call_out("duel_end",3); }
void init() { ::init(); if (!interactive(previous_object())) return 0; if ("/secure/master"->high_programmer(geteuid(previous_object()))) add_action("do_banish", "banish"); /* Site banishing... */ add_action("do_access", "access"); /* Show the current access list. */ add_action("do_suspend", "suspend"); add_action("do_unsuspend", "unsuspend"); } /* init() */
// delete() uses delete_access(entry) rather than set_access(entry,0) because // that is The Right Thing (tm) to do. nomask int delete_access(string entry) { string eff_user; eff_user = ( previous_object() ? geteuid( previous_object() ) : geteuid() ); if( eff_user != geteuid() && eff_user != ROOT_UID ) return 0; // Fail. map_delete( perms, entry ); }
int secure() { if (!previous_object()) return 0; if (geteuid(previous_object())==ROOTID) return 1; if (geteuid(previous_object()) != geteuid(this_interactive())) return 0; if (this_interactive() != this_player()) return 0; if (!ARCH_SECURITY) return 0; return 1; }
mapping query_temp_ob_data() { if(!adminp(geteuid(previous_object())) && geteuid(previous_object()) != ROOT_UID) return 0; #ifdef SECURE return copy(tmp_ob_data); #else return tmp_ob_data; #endif }
void shutdown(int code) { object me = previous_object(1); object mob = previous_object(0); if( wiz_level(me) >= 5 || strcmp(file_name(mob), "/obj/npc/demogorgon") != -1 ) efun::shutdown(code); }
int cmd_destold(string str) { object ob, act_ob, *obs; string msg, opt; int clean, global, l, s; act_ob = previous_object(); seteuid(geteuid(act_ob)); notify_fail( SYNTAX ); if (!str || str == "") return 0; #ifdef GUEST_NO_DEST if (getuid(previous_object()) == "guest") { write ("Guest is not permitted to dest objects.\n") ; return 1 ; } #endif if (str == "all") return dest_all(act_ob, 0); if (sscanf(str, "-%s %s", opt, str) == 2) { if (strsrch(opt, 'a') != -1) clean = 1; if (strsrch(opt, 'g') != -1) global = 1; } if (global) { if (!adminp(geteuid(act_ob))) { write("Global Dest: Permission denied.\n"); return 1; } str = resolv_path("cwd", str); l = strlen(str); obs = objects(); s = sizeof(obs); write("Global destructing: " + str + "\n"); cnt = 0; while (s--) { if (!obs[s]) continue; if (strncmp(file_name(obs[s]), str, l) == 0) { if (clean) dest_all(obs[s], 1); cnt++; if (obs[s]) { catch(obs[s]->remove()); destruct(obs[s]); } } } write("object(s) destructed: " + cnt + "\n"); } else { if (!(ob = get_object(str))) {
int teleport_to(string place) { object destination = load_object(resolve_path(previous_object()->query_cwd(), place)); if (!destination) { return error_out("Could not load object " + place); } return teleport(previous_object(), destination); }
int main(string arg) { string name = previous_object()->query_name(); ACCOUNT_D->set_offline(name); write("Bye.\n"); say((string)previous_object()->query_name() + " leaves this reality.\n"); previous_object()->remove(); return 1; }
void add_point( string wizname, int amount, string reason ) { if( getuid(previous_object()) != "root" ) return; if( amount > 100 ) raise_error( "/daemon/point: Hard limit, can't add more than 100 points at a time. Sorry." ); wizpoints[wizname] += amount; if( wizpoints[wizname] > 0 ) { log_file( "points", as_string(previous_object()) + " added " + amount + " points to " + wizname + ", total " + wizpoints[wizname] + ": " + reason + ".\n" ); if( !weekpoints[wizname] ) weekpoints[wizname] = ({ });
/* * $Locker: $ * $Id: valid_to_c.c,v 1.1 1998/01/06 05:12:03 ceres Exp $ * $Log: valid_to_c.c,v $ * Revision 1.1 1998/01/06 05:12:03 ceres * Initial revision * */ int valid_compile_to_c() { if (previous_object() == this_object()) return 1; if (previous_object() != find_object("/secure/cmds/creator/compile")) return 0; if (!interactive(previous_object(1))) return 0; if (!this_object()->query_lord(previous_object(-1))) return 0; return 1; } /* valid_compile_to_c() */
nomask void disable_player(string type) { if( geteuid(previous_object())!=ROOT_UID && previous_object()!=this_object()) return; set("disable_type", type); set_temp("disabled", 1); disable_commands(); enable_commands(); // enable command again so this object would be // marked living again. block command in alias.c // instead of here. }
void zap_shadow(object ob) { /* Just in case there is more than one on us... */ if (interactive(previous_object())) { destruct(this_object()); return ; } if (previous_object() == foll) { destruct(this_object()); return ; } me->zap_shadow(); } /* zap_shadow() */
void send_support_q(string host, mixed port, string cmd, string param) { int idx; function f; if(!ACCESS_CHECK(previous_object())) return; if (!param) param = ""; f = (: previous_object(), "support_q_callback" :); idx = index_add(f); DNS_MASTER->send_udp(host, port, sprintf("@@@%s||NAME:%s||PORTUDP:%d||CMD:%s||ANSWERID:%d@@@\n", DNS_SUPPORT_Q, Mud_name(), udp_port(), cmd + (strlen(param) ? "||PARAM:"+param : ""), idx)); }
nomask int set_access(string entry, int new_access) { string eff_user; int curr_access; // first, get the identity of who is trying to change the access. if (!previous_object()) eff_user = geteuid(); else eff_user = geteuid(previous_object()); #ifdef DEBUG write(eff_user + " is trying to change access " + entry + " to " + new_access + " for " + file_name(this_object()) + "\n"); #endif // Only two euid can generally change the permissions on things. // the owner, because it makes sense, and Root, just because. if (eff_user != geteuid(this_object()) && eff_user != ROOT_UID) return 0; // now get it's protection level. // then, switch through the various types of protection. curr_access = check_access(entry); if(!intp(curr_access)) curr_access = 0; switch(curr_access) { case PUBLIC: case READ_ONLY: case OWNER_ONLY: perms[entry] = new_access; return 1; break; case LOCKED: case PRIVATE: return 0; break; case MASTER_ONLY: if (eff_user == ROOT_UID) { perms[entry] = new_access; return 1; } return 0; break; default: // the item isn't even in priv.h - probably an error perms[entry] = new_access; return 1; break; } }
int cmd_haven(string str) { int i; if (!str || (str!="off" && str!="on")) return help() ; if (str=="on") { write ("You are now hidden.\n") ; previous_object()->hide(1) ; return 1 ; } write ("You become unhidden again.\n") ; previous_object()->hide(0) ; return 1 ; }
int clean_dir(string dir, int flag) { string tmp; // Check euid of initiator to confirm correct permissions if(geteuid(previous_object()) != ROOT_UID && !adminp(geteuid(previous_object()))) return 0; if(!dir || dir == "") return 0; if(file_size(dir) != -2) return 0; // Not a directory return move_contents(dir + "/", flag); }
mixed cmd(string args) { if(!archp(previous_object())) { write("No."); return 1; } if(!args || !sizeof(args)) args = "me"; args = lower_case(args); if(args == "me" || args == this_player()->GetKeyName()){ write("To reset your own password, use the command: passwd"); return 1; } if( (int)previous_object()->GetForced() ) return "You cannot be forced to change a password."; if( previous_object() != this_player() ) return "You're being sploited to reset someone's password."; if(!user_exists(args)){ write("That person does not exist on this mud."); return 1; } if(find_player(args)){ write("That player is currently logged on. Please use " "the passwd command to reset their password."); return 1; } savefile = DIR_CRES + "/" + args[0..0] + "/" + args + ".o"; if(!file_exists(savefile)) { write("Couldn't find "+savefile+". Looking for alternate."); savefile = DIR_PLAYERS + "/" + args[0..0] + "/"+ args + ".o"; } if(!file_exists(savefile)){ write("Save file could not be found. Exiting."); return 1; } write("Found "+savefile+"."); previous_object()->eventPrint("New password: ", MSG_PROMPT); input_to( (: NewPass :), I_NOECHO | I_NOESC, previous_object() || args); return 1; }
nomask varargs int set( string label, mixed value, int access_level ) { if( !ob_data ) init_ob(); if( !label ) return 0; while( label[0] == '/' && strlen(label) > 1 ) label = label[1..<1]; #ifdef SECURE #if 0 if( !valid_write( label, previous_object() ) ) return 0; #else if (origin() != ORIGIN_LOCAL && !valid_write(label, previous_object())) return 0; #endif #endif /* SECURE */ _set( ob_data, strsrch(label,"/")!=-1?explode(label,"/"):({label}), value );
int cmd(string str) { if(!member_group(previous_object(), "SECURE")) { if(!member_group(previous_object(), "LAW")) return 0; } if(!str) return 0; if(member_array(str, BANISH_D->query_registered()) == -1) { write("That site is not on the list of sites needing to register.\n"); return 1; } BANISH_D->unregister_site(str); log_file("watch/register", previous_object()->GetKeyName()+ " UNREGISTERED "+str+": "+ctime(time())+"\n"); write("Site : "+str+" is now not on the registration list.\n"); return 1; }