Beispiel #1
0
void _open(mixed * tls) {
   if (SITEBAN_D->is_banned(query_ip_number(this_object()))) {
      /* site is banned */
      LOG_D->write_log("logins", ctime(time()) + "\t" + 
         query_ip_number(this_object()) + "\t" + "Banned Site\n");
      send_message("\nYour site is under an access restriction.\n" +
	 "Please email " + ADMIN_EMAIL + " about access from your site.\n");
      destruct_object(this_object());
   }
   send_message("Welcome to " + MUD_NAME + ".\n");
   send_message("Running " + LIB_NAME + " " + LIB_VERSION + " on " +
      status()[ST_VERSION] + ".\n");
   send_message("\n");
   send_message(TELNET_D->query_banner());
   send_message("\nEnter your name (or 'who' for a list of players): ");
   send_message(1);

   timeout_handle = call_out("login_timeout", 600);
   player = clone_object(PLAYER_OB);
   player->set_user(this_object());
   player->initialize_cmd_path();
   player->initialize_alias();
   player->set_long("A boring player without a description.");
   LOG_D->write_log("logins", ctime(time()) + "\t" + 
      query_ip_number(this_object()) + "\t" + "opening connection\n");
   player->input_to_object(this_object(), "input_name");
}
Beispiel #2
0
int CheckIp(){
    int ips = 0;
    string tmp_ip;
    if(!SAME_IP_MAX) return 1;
    tmp_ip = query_ip_number();
    if(telopt_user && telopt_user != my_ip) tmp_ip = telopt_user;
    if(!ip_permitted) ip_permitted = ({});
Beispiel #3
0
string query_ident(object who)
{
  string name, ipno, id;
  mixed info;
  if(!interactive(who)) return 0;
  name = (string)who->query_real_name();
  ipno = query_ip_number(who);

  if(stringp(info=ident_info[id=name+"@"+ipno])) return info;

  if(info + RETRY_TIME < time() && requests[id] < MAX_RETRIES)
  {
    reqno++;
    info=reqno +" "+query_ip_port(who)+" "+ipno;
    if((info=socket_write(sd, info, IDENTSERVER)) < 0)
    {
      _syslog("identd: socket_write failed: " + info);
      return 0;
    }

    ident_info[id]=time();
    requests[id]++;
    requests[reqno]=id;
  }
  return 0;
}
Beispiel #4
0
void quit(void) {
   string str;

   player->save_me();
   LAST_D->add_entry(user_name, 0);
   USER_D->user_offline(user_name, this_object());
   if (query_ip_number(this_object())) {
      LOG_D->write_log("logins", ctime(time()) + "\t" + 
         query_ip_number(this_object()) +
	 "\t" + this_object()->query_name() + " quits\n");
   } else {
      LOG_D->write_log("logins", ctime(time()) + "\t" +
	 "\t\t" + this_object()->query_name() + " LD quits\n");
   }

   player->destruct();
   destruct_object(this_object());
}
Beispiel #5
0
onConnect() {
	PT(("ircgate serving into "+query_ip_number()+"\n"))
	// login procedure may vary with different flavors of ircd,
	// that's why we keep it entirely here
	emit("PASS "+ IRCGATE_LOCAL +" TS\r\n"
	     "SERVER " IRCGATE_NAME " 1 " SERVER_VERSION
		     " :psyced.org http://about.psyc.eu/gateway\r\n"
	     "LUSERS\r\n");
// myself as pseudo subserver? needs extra hub config on ircd.
//	     "SERVER " SERVER_HOST " 2 " SERVER_VERSION
//		     " :psyced.org http://about.psyc.eu/gateway\r\n"
}
Beispiel #6
0
static void _close(mixed * tls, int ld) {
   string ip;

   ip = query_ip_number(this_object());
   if (!ip) {
      ip = "<NO IP>";
   }
   if (ld == 0) {
      player->set_linkdead(1);
      LOG_D->write_log("logins", ctime(time()) + "\t" + ip +
	 "\t\t" + this_object()->query_name() + " disconnects\n");
   } else {
      if (player) {
	 destruct_object(player);
      }
   }
}
Beispiel #7
0
main(string str) {
   if( !str && this_player()->query_level() >= WIZLEVEL ) {
      object who;
      string buf = "~CTITCurrently Connected Players:~CDEF";
      foreach (who: users()) {
         buf += "\n~CBRT"+pad(who->query_cap_name(),15,0);
         buf += " ~CDEF"+pad(query_ip_number(who),15,2);
#ifdef __TLS__
		 buf += tls_query_connection_state(who) > 0 ? "~CTITSSL " : "    ";
#endif
#ifdef __MCCP__
		 buf += query_mccp(who) ? "~CLABMCCP " : "     ";
#endif
		 buf += who->query_env_var("Tmsp") ? "~CBRTMSP " : "    ";
		 buf +="~CDEF(~CBRT"+query_ip_name(who)+"~CDEF)";
      }
      msg(buf);
      return 1;
   }
Beispiel #8
0
void read_call_back(int sock,string s,string peer)
{
  int req, port;
  string msg, full_data, id, who, ip, data;
  object player;

#ifdef DEBUG
  tell_room(environment(),"Identd got: "+s+" from "+peer+".\n");
#endif
  if(peer != IDENTSERVER) return;

  if(sscanf(s,"%d %d%*s:%s:%*s:%s", req, port, msg, full_data) == 6)
  {
    if(sscanf(lower_case(msg),"%*serror%*s"))
      return;
    
    sscanf(full_data,"%s\r",full_data);
    sscanf(full_data,"%s\n",full_data);
    sscanf(full_data," %s",full_data);
    sscanf(data=full_data,"%s,",data);
    sscanf(data,"%s ",data);
    if(data[0]=='[' && data[-1]==']')
    {
      data="[]";
    }

    id=requests[req];
    if(!id) return;
    sscanf(id,"%s@%s",who,ip);
    player=find_player(who);
    if(!player) return;
    if(query_ip_number(player) != ip) return;
    if(query_ip_port(player) != port+"") return;

    ident_info[id]=data;
    requests=m_delete(requests,id);
    requests=m_delete(requests,req);
    player->set_ident(full_data);
    tell_room(environment(),"The identdaemon finds out that "+capitalize(who)+" is called "+full_data+".\n");
  }
}
Beispiel #9
0
/*
 * Function name: enter_game
 * Description  : This function is called from the login object and enables
 *                the player to connect. It takes care of the necessary
 *                initialization before the player is allowed to file his
 *                request.
 */
void
enter_game()
{
    string data;
    int bl;

    set_screen_width(80);

    bl = SECURITY->check_newplayer(query_ip_number(this_object()));
    if (bl == 0)
    {
	write_socket("Your site isn't blocked. Log in as usual.\n");

	destruct();
	return;
    }
    else if (bl == 1)
    {
	write_socket("Your site has been banned, not just simply blocked.\n" +
	    "No one will be admitted from your site.\n");

	destruct();
	return;
    }

    data = read_file(APPLICATION_INFO);
    if (!strlen(data))
    {
	write_socket("Panic! Couldn't read: " + APPLICATION_INFO + ".\n");

	destruct();
	return;
    }

    info = explode(data, "##");

    enable_commands();
    write_info();
}
Beispiel #10
0
int do_pulsar(string str) 
{
  object ob, temp;
  int changed;
  changed = 1;

  if (!stringp(str) || ((str != "boton") && (str != "botón")))
  {
    notify_fail("¿Pulsar qué? Quizá quieras 'pulsar botón'.\n");
    return 0;
  }

  tell_object(this_player(), "Pulsas el botón rojo.\n");
  tell_room(environment(this_object()), this_player()->query_cap_name() +
    " pulsa el botón rojo.\n", this_player());

  while (changed) 
  {
    changed = 0;
    ob = first_inventory(environment(this_object()));

    while (ob) 
    {
      if (ob != this_object() && !query_ip_number(ob)) 
      {
        changed = 1;
        temp = ob;
      }
    
      ob = next_inventory(ob);
    
      if (temp) 
      {
        temp->dest_me();
      }
    }
  }
  return 1;
}
Beispiel #11
0
string finger_all(int showage)
{
	object *ob;
	string msg;
	int i;

	ob = sort_array(users(),"sort_user",this_object());
	msg = "";
	for(i=0; i<sizeof(ob); i++) {
		if( this_player() && !this_player()->visible(ob[i]) ) continue;
		if( showage)
		msg = sprintf("%s%-10s  %-8s  %-15s (%s) %s\n",
			msg, ob[i]->query("name"), ob[i]->query("id"),
			age_string( (int)ob[i]->query("mud_age")), 
			query_ip_number(ob[i]),query_ip_name(ob[i]) );
		else
                msg = sprintf("%s%-20s  %-20s   \n",
                        msg, ob[i]->query("name"), ob[i]->query("id"),
                        );

	}
	return msg;
}
Beispiel #12
0
static void
receive_hname(const char *addr, int lport, int rport,
	      const char *ip_name, const char *rname)
{
    int i;
    struct interactive *ip;

    if (addr == NULL || rname == NULL)
	return;

    for (i = 0; i < MAX_PLAYERS; i++)
    {
	ip = all_players[i];
	if (ip == NULL)
	    continue;

        if (!strcmp(addr, query_ip_number(ip->ob)))
        {
            if (strlen(ip_name)) 
            {
                if (ip->host_name)
                    free(ip->host_name);

                ip->host_name = xalloc(strlen(ip_name) + 1);
                strcpy(ip->host_name, ip_name);
            }

            if (ip->lport == lport && atoi(query_port_number(ip->ob)) == rport && strlen(rname))
            {
                if (ip->rname != NULL)
                    free(ip->rname);
                ip->rname = xalloc(strlen(rname) + 1);
                strcpy(ip->rname, rname);
            }
        }
    }
}
Beispiel #13
0
void do_tests() {
    ASSERT(query_ip_number(this_object()) == 0);
    if (this_player())
    ASSERT(stringp(query_ip_number(this_player())));
}
Beispiel #14
0
int really_quit()
{
  object *ob, money;
  object frog, frog2;
  int i;
  int secure;
  string aux;

  aux = "";
  secure = 0;

  // quit_destination added by neverbot, 03/09  
  while (environment(this_object()) &&
        (aux = environment(this_object())->query_quit_destination()) && 
        (secure < 10))
  {
    if (load_object(aux))
      this_object()->move(aux);
    secure++;
  }
  
  if (secure != 0) 
  {
    tell_object(this_object(), "En tu localización previa no es posible salir, "+
        "has sido movido a la más cercana (vuelve a intentarlo aquí si aún "+
        "deseas desconectar).\n");
    this_object()->do_look();
    this_object()->save_me();
    return 1;
  }

  traverse_timed_properties();
  last_log_on = time();
  
  this_object()->adjust_online_time(time() - ontime);

  // This should send the time the player was on to an object which keeps
  // track of total hours played (non-immortal) Anirudh - March 17, 1996
  // if (!this_object()->query_coder())
    TIMEKEEPER->add_time(time() - ontime);

  if (this_object()->query_name() != DEF_NAME)
  {
    if (this_object()->query_property(GUEST_PROP))
      log_file("enter", sprintf("Exit  : %-15s %s (guest) [%s]\n",
                                name, ctime(time(),4),
                                query_ip_number(this_object())+" ("+query_ip_name(this_object())+")"));
    else
      log_file("enter", sprintf("Exit  : %-15s %s [%s]\n",
                                name, ctime(time(),4), 
                                query_ip_number(this_object())+" ("+query_ip_name(this_object())+")"));
  }

  // TODO editor
  // catch(editor_check_do_quit());

  // TODO social
  // if (query_race_ob())
  //   catch(query_race_ob()->player_quit(this_object()));
  // if (query_guild_ob())
  //   catch(query_guild_ob()->player_quit(this_object()));
  // if (query_class_ob())
  //   catch(query_class_ob()->player_quit(this_object()));
  // if (query_deity_ob())
  //   catch(query_deity_ob()->player_quit(this_object()));
  // if (query_group_ob())
  //   catch(query_group_ob()->player_quit(this_object()));
  // if (query_race_group_ob())
  //   catch(query_race_group_ob()->player_quit(this_object()));
  // if (query_job_ob())
  //   catch(query_job_ob()->player_quit(this_object()));
  // if (query_city_ob())
  //   catch(query_city_ob()->player_quit(this_object()));

  // curses_quit();

  // Antes del save_me, movemos todos los objetos que no vamos a grabar a
  // la room del jugador
  if (environment(this_object()))
  {
    ob = deep_inventory(this_object());
    for(i = 0; i < sizeof(ob); i++)
    {
      if (ob[i]->query_no_save_object())
      {
        ob[i]->move(environment(this_object()));
        tell_object(this_object(), "Dejas tu "+ob[i]->short()+".\n");
      }
    }
  }
Beispiel #15
0
/*
 * Function name: write_info
 * Description  : This function will display the next line of the application
 *                process to the player and input the next line. If the
 *                player is done, the message will be inserted in the
 *                application board.
 */
void
write_info()
{
    string *part, epz, whom, ip, in;
    object ob;

    remove_alarm(time_out_alarm);

    if (pos >= sizeof(info))
    {
	catch(LOAD_ERR(APPLICATION_BOARD_LOC));
	ob = present("application board", find_object(APPLICATION_BOARD_LOC));

	if (!objectp(ob))
	{
	    write_socket("\nThe application could not be saved. Please try " +
		"again at a later date when the bug has been found and " +
		"fixed. If you know someone with access to the game, ask " +
		"him or to mention the problem to the administration.\n");
	}
	else
	{
	    whom = query_ip_ident(this_object());
	    whom = strlen(whom) > 0 ? whom : "Unknown";
	    in = query_ip_name(this_object());
	    ip = query_ip_number(this_object());
	    whom += "@" + (in == ip ? in : in + " (" + ip + ")");
	    ob->new_msg(whom);
	    result = "Application from " + whom +
		" at " + ctime(time()) + "\n" + result + "\n";
	    ob->done_editing(result);
	    write_socket("\nYour application has been filed.\n");
	}

	destruct();
	return;
    }

    part = explode(info[pos++], "&&");

    write_socket(part[2] + "\nApplication entry> ");

    if ((epz = explode(part[0], "\n")[0]) == "")
    {
	epz = explode(part[0], "\n")[1];
    }

    if (epz == "m")
    {
	time_out_alarm = set_alarm(MULTI_TIME_OUT, 0.0, time_out);
	result += explode(part[1], "\n")[1];
	input_to(get_mline);
    }
    else if (epz == "-")
    {
	time_out_alarm = set_alarm(SINGLE_TIME_OUT, 0.0, time_out);
	input_to(get_nline);
    }
    else
    {
	time_out_alarm = set_alarm(SINGLE_TIME_OUT, 0.0, time_out);
	result += explode(part[1], "\n")[1];
	input_to(get_sline);
    }
}
Beispiel #16
0
int cmd_give(string str) {
   object ob, to;
   string what, who, type;
   int i, amount;
    int dummy;
//    object *inv;
   
    if (!stringp(str)) return help();
    dummy = total_light(this_player());
    if(dummy < -6) {
      write("It is too dark.\n");
      return 1;
    }
    if (sscanf(str,"%s to %s", what, who) != 2) {
        return help();
    }
    if(who == "me" || who == "myself") {
        who = this_player()->query_name();
    }
    to = present(who, environment(this_player()));
    if (!to) {
      notify_fail("Give "+what+" to who?\n");
      return 0;
    }
    ob = present(what, this_player());
    if (ob)
    if (ob->give(what))
        return 1;
    if (!ob) {
        ob = parse_objects(this_player(), what);
    }
    if(!ob) 
    {
 
        if(sscanf(what, "%d %s coin", amount, type) !=2) 
        {
            return notify_fail("You must have an object to give it away!\n");
        }
          // wiz fixed this, you were able to give 0 coins to people
        if (amount<1) 
        {
            return notify_fail("Please enter a valid amount.\n");
        }
        
        if(amount > (int)this_player()->query_money(type)) 
        {
            return notify_fail("You don't have that much!\n");
        }
        
        if(query_ip_number(this_player()) == query_ip_number(to) && 
                this_player()->query_name() != to->query_name() ) 
        {         
                CHAT_D->do_raw_chat("system", "Multi <system> Exchange of money between "+this_player()->query_name()+" and "+to->query_name());
                seteuid("Log");
                log_file("multiplay", "Exchange of money ("+amount+" "+type+") between "+this_player()->query_name()+" and "+to->query_name()+" from "+query_ip_number(this_player())+". (give)\n");
                seteuid(getuid());
        }
           
        this_player()->add_money(type, -amount);
        to->add_money(type, amount);
        if (to->is_monster()) {
          to->remove_property("gave_money");
          to->set_property("gave_money", 1);
        }
        write("You give " + amount + " " + type + " coins to " +
            to->query_cap_name() + ".\n");
        message("no_wrap",this_player()->query_cap_name()+ " gives some money to " 
            + to->query_cap_name() + ".\n", environment(this_player()),({ this_player(), to }));
            tell_object(to, this_player()->query_cap_name() +
            " gives you " + amount + " " + type + " coins.\n");
        return 1;
    }