Example #1
0
std::string compact_str(const std::string s, const unsigned tabs, const unsigned tamline)
{std::string res,buf;
 unsigned tam,t,l,f;

	tam=(unsigned)s.length();
	res="\n";
	for (f=0; f<tabs; f++) res+="\t";
	res+="CompactStr(";
	number_to_string(tam,buf);
	res+=buf;
	res+=")";
	t=0;
	while (t<tam)
	{
		buf=s.substr(t,tamline);
		l=(unsigned)buf.length();
		if (l>0)
		{
			res+="\n";
			for (f=0; f<tabs+1; f++) res+="\t";
			for (unsigned g=0; g<l; g++) res+=character_to_hexstring(buf[g]);
			t+=l;
		}
		else t=tam;
	}
	res+="\n";
	for (f=0; f<tabs; f++) res+="\t";
	res+="EndCompactStr";
	return(res);
}
Example #2
0
  std::u32string value::to_source() const
  {
    switch (m_type)
    {
      case type::boolean:
        return m_value_boolean ? U"true" : U"false";

      case type::number:
        return number_to_string(*m_value_number);

      case type::vector:
        return vector_to_source(*m_value_vector);

      case type::string:
        return string_to_source(*m_value_string);

      case type::quote:
        return m_value_quote->to_source();

      case type::month:
        return month_to_string(m_value_month);

      case type::weekday:
        return weekday_to_string(m_value_weekday);

      case type::date:
        return date_to_string(*m_value_date);

      case type::time:
        return time_to_string(*m_value_time);
    }

    return U"";
  }
Example #3
0
std::string compact_data(void *d, unsigned tam, const unsigned tabs, const unsigned tamline)
{std::string res,buf;
 unsigned t,l,f;

	if (d==0) tam=0;
	res="\n";
	for (f=0; f<tabs; f++) res+="\t";
	res+="CompactData(";
	number_to_string(tam,buf);
	res+=buf;
	res+=")";
	t=0;
	while (t<tam)
	{
		l=tamline;
		if (t+l>tam) l=tam-t;
		if (l>0)
		{
			res+="\n";
			for (f=0; f<tabs+1; f++) res+="\t";
			for (unsigned g=0; g<l; g++) res+=byte_to_hexstring(((char *)d)[t+g]);
			t+=l;
		}
		else t=tam;
	}
	res+="\n";
	for (f=0; f<tabs; f++) res+="\t";
	res+="EndCompactData";
	return(res);
}
Example #4
0
/* Make up a new column name. Check for not already in workspace.
 */
void
workspace_column_name_new( Workspace *ws, char *name )
{
	do {
		number_to_string( ws->next++, name );
	} while( workspace_column_find( ws, name ) );
}
Example #5
0
    void share_callback(RemoteStorageFileShareResult_t * result, bool fail)
    {
        if (result && (result->m_eResult != k_EResultOK || fail)) {
            error = "Error: " + number_to_string(result->m_eResult);
            call_fail();
            return;
        }

        if (!(flags & SET_PREVIEW)) {
            preview_callback(NULL, false);
            return;
        }

        chowstring data;
        if (!read_file(preview.c_str(), data)) {
            error = "File not found";
            call_fail();
            return;
        }
        SteamRemoteStorage()->FileWrite(preview_cloud_file.c_str(),
                                        data.data(), data.size());
        SteamAPICall_t call_handle;
        call_handle = SteamRemoteStorage()->FileShare(
            preview_cloud_file.c_str());
        preview_call.Set(call_handle, this, &UploadCallback::preview_callback);
    }
Example #6
0
File: host.c Project: Red54/axtu
const char *
pretty_print_address (const ip_address *addr)
{
  switch (addr->type) 
    {
    case IPV4_ADDRESS:
      return inet_ntoa (ADDRESS_IPV4_IN_ADDR (addr));
#ifdef ENABLE_IPV6
    case IPV6_ADDRESS:
      {
        static char buf[128];
	inet_ntop (AF_INET6, &ADDRESS_IPV6_IN6_ADDR (addr), buf, sizeof (buf));
#if 0
#ifdef HAVE_SOCKADDR_IN6_SCOPE_ID
	{
	  /* append "%SCOPE_ID" for all ?non-global? addresses */
	  char *p = buf + strlen (buf);
	  *p++ = '%';
	  number_to_string (p, ADDRESS_IPV6_SCOPE (addr));
	}
#endif
#endif
        buf[sizeof (buf) - 1] = '\0';
        return buf;
      }
#endif
    }
  abort ();
}
Example #7
0
 void set_preview(const chowstring & value)
 {
     if (value.empty())
         return;
     flags |= SET_PREVIEW;
     preview = value;
     preview_cloud_file = "preview" + number_to_string((uint64_t)current_id)
                          + "." + get_path_ext(preview);
 }
Example #8
0
    void new_callback(RemoteStoragePublishFileResult_t * result, bool fail)
    {
        if (result->m_eResult != k_EResultOK || fail) {
            error = "Error: " + number_to_string(result->m_eResult);
            call_fail();
            return;
        }

        call_done();
    }
Example #9
0
int main(int argc, char **argv) {
	NUMBER num1, num2, num3;
	char arg1[512], arg2[512];

	fprintf(stderr, "Enter two numbers to add: ");
	fscanf(stdin, "%s %s", arg1, arg2);
	num1 = number_from_string(arg1);
	num2 = number_from_string(arg2);
	num3 = number_add(num1, num2);
	fprintf(stderr, "(%s) + (%s) = %s\n", arg1, arg2, number_to_string(&num3));
	fprintf(stderr, "Enter two numbers to subtract: ");
	fscanf(stdin, "%s %s", arg1, arg2);
	num1 = number_from_string(arg1);
	num2 = number_from_string(arg2);
	num3 = number_subtract(num1, num2);
	fprintf(stderr, "(%s) - (%s) = %s\n", arg1, arg2, number_to_string(&num3));

	return 0;
}
Example #10
0
static void ns_cmd_staff(sourceinfo_t *si, int parc, char *parv[])
{
	char *target = parv[0];
	char *action = parv[1];
	myuser_t *mu;

	if (!target || !action)
	{
		command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "STAFF");
		command_fail(si, fault_needmoreparams, _("Usage: STAFF <account> <ON|OFF>"));
		return;
	}

	if (!(mu = myuser_find_ext(target)))
	{
		command_fail(si, fault_nosuch_target, _("\2%s\2 is not registered."), target);
		return;
	}

	if (!strcasecmp(action, "ON"))
	{
		if (metadata_find(mu, "private:staff:setter"))
		{
			command_fail(si, fault_badparams, _("\2%s\2 is already a member of staff."), entity(mu)->name);
			return;
		}

		metadata_add(mu, "private:staff:setter", get_oper_name(si));
		metadata_add(mu, "private:staff:timestamp", number_to_string(CURRTIME));

		wallops("%s set the STAFF option for the account \2%s\2.", get_oper_name(si), entity(mu)->name);
		logcommand(si, CMDLOG_ADMIN, "STAFF:ON: \2%s\2", entity(mu)->name);
		command_success_nodata(si, _("\2%s\2 is now a member of staff."), entity(mu)->name);
	}
	else if (!strcasecmp(action, "OFF"))
	{
		if (!metadata_find(mu, "private:staff:setter"))
		{
			command_fail(si, fault_badparams, _("\2%s\2 is not a member of staff."), entity(mu)->name);
			return;
		}

		metadata_delete(mu, "private:staff:setter");
		metadata_delete(mu, "private:staff:timestamp");

		wallops("%s removed the STAFF option on the account \2%s\2.", get_oper_name(si), entity(mu)->name);
		logcommand(si, CMDLOG_ADMIN, "STAFF:OFF: \2%s\2", entity(mu)->name);
		command_success_nodata(si, _("\2%s\2 is no longer a member of staff."), entity(mu)->name);
	}
	else
	{
		command_fail(si, fault_needmoreparams, STR_INVALID_PARAMS, "STAFF");
		command_fail(si, fault_needmoreparams, _("Usage: STAFF <account> <ON|OFF>"));
	}
}
Example #11
0
std::string float_to_string(float myFloat, int precision)
{
	char buf[30] ;
	std::string format = string("%f") ;

	if (precision>0)
		format = format + "." + number_to_string(precision) ;

	sprintf(buf, format.c_str(), myFloat) ;
	return std::string(buf) ;
}
Example #12
0
    void on_create_callback(CreateItemResult_t * result, bool fail)
    {
        if (result->m_eResult != k_EResultOK || fail) {
            uploading = false;
            error = "Error: " + number_to_string(result->m_eResult);
            call_fail();
            return;
        }

        has_id = true;
        current_id = result->m_nPublishedFileId;
        start();
    }
Example #13
0
TString *cell_toString(Cell *c)
{
    assert(c->type != cNothing);
    TString *r = string_newString();

    switch (c->type) {
        case cAddress:
            r = cell_toString(c->address);
            break;
        case cArray:
        {
            size_t x;
            r = string_appendCString(r, "[");
            for (x = 0; x < c->array->size; x++) {
                if (r->length > 1) {
                    r = string_appendCString(r, ", ");
                }
                if (c->array->data[x].type == cString) {
                    r = string_appendCString(r, "\"");
                    TString *v = cell_toString(&c->array->data[x]);
                    r = string_appendString(r, v);
                    r = string_appendCString(r, "\"");
                    string_freeString(v);
                } else {
                    TString *v = cell_toString(&c->array->data[x]);
                    r = string_appendString(r, v);
                    string_freeString(v);
                }
            }
            r = string_appendCString(r, "]");
            break;
        }
        case cBoolean:
            r = string_appendCString(r, (c->boolean ? "TRUE" : "FALSE"));
            break;
        case cDictionary:
            break;
        case cNumber:
            r = string_appendCString(r, number_to_string(c->number));
            break;
        case cPointer:
            break;
        case cString:
            r = string_fromString(c->string);
            break;
        default:
            fatal_error("Unhandled cell type: %d", c->type);
            break;
    }
    return r;
}
int main()
{

  char numberstring[MAX_NUMBER_STRING_SIZE] = "AZ-238.0";
  int32_t number = 0;
  string_to_number(&(numberstring[2]), number);
  std::cout << "String to number: " << numberstring << " " << number << std::endl;

  char numberstring2[MAX_NUMBER_STRING_SIZE];
  int32_t number2 = -35000;
  number_to_string(number2, numberstring2);
  std::cout << "Number to string: " << number2 << " " << numberstring2 << std::endl;

}
Example #15
0
static void gs_cmd_set_joinflags(sourceinfo_t *si, int parc, char *parv[])
{
	mygroup_t *mg;
	char *joinflags = parv[1];
	unsigned int flags = 0;

	if (!(mg = mygroup_find(parv[0])))
	{
		command_fail(si, fault_nosuch_target, _("Group \2%s\2 does not exist."), parv[0]);
		return;
	}

	if (!groupacs_sourceinfo_has_flag(mg, si, GA_SET))
	{
		command_fail(si, fault_noprivs, STR_NOT_AUTHORIZED);
		return;
	}

	if (!joinflags || !strcasecmp("OFF", joinflags) || !strcasecmp("NONE", joinflags))
	{
		/* not in a namespace to allow more natural use of SET PROPERTY.
		 * they may be able to introduce spaces, though. c'est la vie.
		 */
		if (metadata_find(mg, "joinflags"))
		{
			metadata_delete(mg, "joinflags");
			logcommand(si, CMDLOG_SET, "SET:JOINFLAGS:NONE: \2%s\2", entity(mg)->name);
			command_success_nodata(si, _("The group-specific join flags for \2%s\2 have been cleared."), parv[0]);
			return;
		}

		command_fail(si, fault_nochange, _("Join flags for \2%s\2 were not set."), parv[0]);
		return;
	}

	if (!strncasecmp(joinflags, "-", 1))
	{
		command_fail(si, fault_badparams, _("You can't set join flags to be removed."));
		return;
	}

	flags = gs_flags_parser(joinflags, 0, flags);

	/* we'll overwrite any existing metadata */
	metadata_add(mg, "joinflags", number_to_string(flags));

	logcommand(si, CMDLOG_SET, "SET:JOINFLAGS: \2%s\2 \2%s\2", entity(mg)->name, joinflags);
	command_success_nodata(si, _("The join flags of \2%s\2 have been set to \2%s\2."), parv[0], joinflags);
}
Example #16
0
inline void save_assarray(AssociateArray & array, T & stream, int method)
{
    stream.write(ARRAY_MAGIC, sizeof(ARRAY_MAGIC)-1);

    ArrayMap::iterator it;
    for (it = array.map->begin(); it != array.map->end(); it++) {
        AssociateArrayItem & item = it->second;
        std::string key = it->first;
        encode_method(key, method);
        std::string string = item.string;
        encode_method(string, method);
        std::string value = number_to_string(item.value);
        encode_method(value, method);

        int len = key.size() + string.size() + value.size();
        stream.write_string(number_to_string(len));
        stream.write_int8(' ');
        stream.write_string(key);
        stream.write_int8('\x00');
        stream.write_string(string);
        stream.write_int8('\x00');
        stream.write_string(value);
    }
}
Example #17
0
//draw "number" as "pos"
void draw_number(int32_t number, uint8_t pos, uint8_t length)
{
  uint8_t i;
  number_to_string(number);
  
  memset(&lcd_numbers_data,10,8);
  for (i=0;i<length;i++)
  {
    if (string[i] == 0x2d){lcd_numbers_data[i+pos] = 11;}//minus
    else if (string[i] == 'u'){lcd_numbers_data[i+pos] = 12;}//u
    else if ((string[i] == 0) || (string[i] == 10)) {lcd_numbers_data[i+pos] = 10;}//zero
    else  lcd_numbers_data[i+pos] = (uint8_t)string[i]-48;
  }
  //snumber_to_buffer(number,&lcd_numbers_data[pos]);
}
Example #18
0
//==============================================================================
void USB_Device::string_descriptor_ascii(uint8_t index, String &data)
{
	check_open();

	uint8_t raw_data[256];
	int result = libusb_get_string_descriptor_ascii(handle_, index, raw_data,
			sizeof(raw_data));
	if (result < 0)
		on_error("Failed to get string descriptor " + number_to_string(index),
				(libusb_error)result);

	data.assign(raw_data, raw_data + result);

	raw_data[result] = '\0';
	log_info("usb, get string descriptor %u, data: %s", index, raw_data);
}
Example #19
0
static void make_forbid(sourceinfo_t *si, const char *account, const char *reason)
{
	myuser_t *mu;
	mynick_t *mn = NULL;
	user_t *u;

	if (!nicksvs.no_nick_ownership && IsDigit(*account))
	{
		command_fail(si, fault_badparams, "For security reasons, you can't forbid a UID.");
		return;
	}

	if (strchr(account, ' ') || strchr(account, '\n') || strchr(account, '\r') || account[0] == '=' || account[0] == '#' || account[0] == '@' || account[0] == '+' || account[0] == '%' || account[0] == '!' || strchr(account, ','))
	{
		command_fail(si, fault_badparams, "The account name \2%s\2 is invalid.", account);
		return;
	}

	/* make sure it isn't registered already */
	if (nicksvs.no_nick_ownership ? myuser_find(account) != NULL : mynick_find(account) != NULL)
	{
		command_fail(si, fault_alreadyexists, "\2%s\2 is already registered.", account);
		return;
	}

	mu = myuser_add(account, "*", FORBID_EMAIL, MU_CRYPTPASS | MU_ENFORCE | MU_HOLD | MU_NOBURSTLOGIN);
	mu->registered = CURRTIME;
	mu->lastlogin = CURRTIME;
	metadata_add(mu, "private:freeze:freezer", get_oper_name(si));
	metadata_add(mu, "private:freeze:reason", reason);
	metadata_add(mu, "private:freeze:timestamp", number_to_string(CURRTIME));
	if (!nicksvs.no_nick_ownership)
	{
		mn = mynick_add(mu, entity(mu)->name);
		mn->registered = CURRTIME;
		mn->lastseen = CURRTIME;
		u = user_find_named(entity(mu)->name);
		if (u != NULL)
		{
			notice(si->service->nick, u->nick,
					_("The nick \2%s\2 is now forbidden."),
					entity(mu)->name);
			hook_call_nick_enforce((&(hook_nick_enforce_t){ .u = u, .mn = mn }));
Example #20
0
void GameManager::set_frame(int index)
{
    ignore_controls = false;

#ifdef CHOWDREN_IS_DEMO
    idle_timer = 0.0;
    idle_timer_started = false;
#endif

#ifndef CHOWDREN_SAMPLES_OVER_FRAMES
    media.stop_samples();
#endif

    if (frame->index != -1)
        frame->on_end();

    if (index == -2) {
        platform_begin_draw();
        media.stop_samples();
        Render::clear(Color(0, 0, 0, 255));
        platform_swap_buffers();
#ifdef CHOWDREN_IS_DEMO
        reset_timer = 0.0;
#endif
        index = 0;
        // reset_global_data();
        reset_globals();
    }

    std::cout << "Setting frame: " << index << std::endl;

#ifdef CHOWDREN_USER_PROFILER
    std::string logline = "Setting frame: " + number_to_string(index) + "\n";
    user_log.write(&logline[0], logline.size());
#endif

    frame->set_index(index);

    std::cout << "Frame set" << std::endl;
}
Example #21
0
    void preview_callback(RemoteStorageFileShareResult_t * result, bool fail)
    {
        if (result && (result->m_eResult != k_EResultOK || fail)) {
            error = "Error: " + number_to_string(result->m_eResult);
            call_fail();
            return;
        }

        if (has_id) {
            do_update();
            return;
        }

        ERemoteStoragePublishedFileVisibility vis =
            (ERemoteStoragePublishedFileVisibility)visibility;
        SteamAPICall_t call_handle;
        call_handle = SteamRemoteStorage()->PublishWorkshopFile(
            cloud_file.c_str(), preview_cloud_file.c_str(), appid,
            title.c_str(), description.c_str(), vis, &steam_tags,
            k_EWorkshopFileTypeCommunity);
        new_call.Set(call_handle, this, &UploadCallback::new_callback);
    }
Example #22
0
int send_string_stdin(void)
{
    char *theNumber = NULL;     //  Used for strtok
    char line[256];
    double decimalResult = 0;
    int pCount = 0;

    while( fgets(line, 256, stdin) != NULL )
    {
        /*
         * We'll use strtok to tokenize the string, number by number, using the
         * space character as a delimiter
         */
        theNumber = strtok(line, " ");
        while( theNumber != NULL )
        {
            /*  If the user wants slightly prettier output */
            if( lineSpacing == 1 && pCount > 0 && textMode == 0)
            {
                printf("\n");
            }

            if( textMode == 1 )
                number_to_string( theNumber );

            else
            {
                decimalResult = binary_to_decimal( theNumber );
                string_printer( &decimalResult );
            }

            theNumber = strtok(NULL, " ");  //  Re-run strtok, grab next number

            ++pCount;
        }
    }

    return(0);
}
crack_index network_crack_http(const string target_ip,const unsigned int target_port,dictionary crack_dictionary,const string crack_express,const string crack_term) {
    string resolve_string(crack_express);
    split_result split;
    crack_index result;

    unsigned int username_point=find_string(resolve_string,"%username%");
    if (-1==username_point) {
        dictionary crack_dictionary_;
        resolve_dictionary_add_username(crack_dictionary_,"");
        resolve_dictionary_add_password(crack_dictionary_,
            resolve_dictionary_get_password_list(crack_dictionary,
                resolve_dictionary_get_user_list(crack_dictionary)[0]));
        crack_dictionary=crack_dictionary_;
    }
    unsigned int password_point=find_string(resolve_string,"%password%");
    if (-1==password_point) {
        dictionary crack_dictionary_;
        username_list name_list;
        name_list=resolve_dictionary_get_user_list(crack_dictionary);
        crack_dictionary=crack_dictionary_;
        for (dictionary::const_iterator username_iterator=crack_dictionary.begin();
                                        username_iterator!=crack_dictionary.end();
                                        ++username_iterator)
            resolve_dictionary_add_username(crack_dictionary,username_iterator->first);
        resolve_dictionary_add_password(crack_dictionary,"");
    }
    unsigned int length_point=find_string(resolve_string,"%length%");

    unsigned int handle=scan_tcp_connect(target_ip.c_str(),target_port);
    if (-1!=handle) {
        for (dictionary::const_iterator username_iterator=crack_dictionary.begin();
                                        username_iterator!=crack_dictionary.end();
                                        ++username_iterator) {
            for (password_list::const_iterator password_iterator=username_iterator->second.begin();
                                               password_iterator!=username_iterator->second.end();
                                               ++password_iterator) {
                string packet(resolve_string);
                if (-1!=username_point)
                    replace_string(packet,"%username%",username_iterator->first);
                if (-1!=password_point)
                    replace_string(packet,"%password%",*password_iterator);
                packet=resolve_express(packet);
                if (-1!=length_point) {
                    string http_body;
                    split_result result_body(split_string(packet,"\r\n\r\n"));
                    if (!result_body.second.empty()) {
                        unsigned int length=result_body.second.length()-4;
                        replace_string(packet,"%length%",number_to_string(length));
                    }
                }
CRACK:
                scan_tcp_send(handle,packet.c_str(),packet.length());
                char recv_buffer[NETWORK_CRACK_RECV_BUFFER_LENGTH]={0};
                unsigned int recv_length=scan_tcp_recv(handle,recv_buffer,NETWORK_CRACK_RECV_BUFFER_LENGTH);
                if (-1!=recv_length && recv_length) {
                    if (-1!=find_string(recv_buffer,crack_term)) {
                        result.first=username_iterator->first;
                        result.second=*password_iterator;
                        scan_tcp_disconnect(handle);
                        return result;
                    }
                } else {
                    scan_tcp_disconnect(handle);
                    Sleep(50);
                    handle=scan_tcp_connect(target_ip.c_str(),target_port);
                    Sleep(50);
                    goto CRACK;
                }
            }
        }
        scan_tcp_disconnect(handle);
    }
    return result;
}
Example #24
0
static void ns_cmd_sendpass(sourceinfo_t *si, int parc, char *parv[])
{
	myuser_t *mu;
	char *name = parv[0];
	char *newpass = NULL;
	char *key;
	metadata_t *md;
	enum specialoperation op = op_none;
	bool ismarked = false;
	char cmdtext[NICKLEN + 20];
	hook_user_needforce_t needforce_hdata;

	if (!name)
	{
		command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "SENDPASS");
		command_fail(si, fault_needmoreparams, _("Syntax: SENDPASS <account>"));
		return;
	}

	if (parc > 1)
	{
		if (!strcasecmp(parv[1], "FORCE"))
			op = op_force;
		else if (!strcasecmp(parv[1], "CLEAR"))
			op = op_clear;
		else
		{
			command_fail(si, fault_badparams, STR_INVALID_PARAMS, "SENDPASS");
			command_fail(si, fault_badparams, _("Syntax: SENDPASS <account> [FORCE|CLEAR]"));
			return;
		}
	}

	if (!(mu = myuser_find_by_nick(name)))
	{
		command_fail(si, fault_nosuch_target, _("\2%s\2 is not registered."), name);
		return;
	}

	if (is_soper(mu) && !has_priv(si, PRIV_ADMIN))
	{
		logcommand(si, CMDLOG_ADMIN, "failed SENDPASS \2%s\2 (is SOPER)", name);
		command_fail(si, fault_badparams, _("\2%s\2 belongs to a services operator; you need %s privilege to send the password."), name, PRIV_ADMIN);
		return;
	}

	if (mu->flags & MU_WAITAUTH)
	{
		command_fail(si, fault_badparams, _("\2%s\2 is not verified."), entity(mu)->name);
		return;
	}

	if ((md = metadata_find(mu, "private:mark:setter")))
	{
		ismarked = true;
		if (op == op_none)
		{
			logcommand(si, CMDLOG_ADMIN, "failed SENDPASS \2%s\2 (marked by \2%s\2)", entity(mu)->name, md->value);
			command_fail(si, fault_badparams, _("This operation cannot be performed on %s, because the account has been marked by %s."), entity(mu)->name, md->value);
			if (has_priv(si, PRIV_MARK))
			{
				snprintf(cmdtext, sizeof cmdtext, "SENDPASS %s FORCE", entity(mu)->name);
				command_fail(si, fault_badparams, _("Use %s to override this restriction."), cmdtext);
			}
			return;
		}
		else if (!has_priv(si, PRIV_MARK))
		{
			logcommand(si, CMDLOG_ADMIN, "failed SENDPASS \2%s\2 (marked by \2%s\2)", entity(mu)->name, md->value);
			command_fail(si, fault_noprivs, STR_NO_PRIVILEGE, PRIV_MARK);
			return;
		}
	}

	needforce_hdata.si = si;
	needforce_hdata.mu = mu;
	needforce_hdata.allowed = 1;

	hook_call_user_needforce(&needforce_hdata);

	if (!needforce_hdata.allowed)
	{
		ismarked = true;
		if (op == op_none)
		{
			logcommand(si, CMDLOG_ADMIN, "failed SENDPASS \2%s\2 (marked)", entity(mu)->name);
			command_fail(si, fault_badparams, _("This operation cannot be performed on %s, because the account has been marked."), entity(mu)->name);
			if (has_priv(si, PRIV_MARK))
			{
				snprintf(cmdtext, sizeof cmdtext, "SENDPASS %s FORCE", entity(mu)->name);
				command_fail(si, fault_badparams, _("Use %s to override this restriction."), cmdtext);
			}
			return;
		}
		else if (!has_priv(si, PRIV_MARK))
		{
			logcommand(si, CMDLOG_ADMIN, "failed SENDPASS \2%s\2 (marked)", entity(mu)->name);
			command_fail(si, fault_noprivs, STR_NO_PRIVILEGE, PRIV_MARK);
			return;
		}
	}

	if (op == op_clear)
	{
		if (metadata_find(mu, "private:setpass:key"))
		{
			metadata_delete(mu, "private:setpass:key");
			metadata_delete(mu, "private:sendpass:sender");
			metadata_delete(mu, "private:sendpass:timestamp");
			logcommand(si, CMDLOG_ADMIN, "SENDPASS:CLEAR: \2%s\2", entity(mu)->name);
			command_success_nodata(si, _("The password change key for \2%s\2 has been cleared."), entity(mu)->name);
		}
		else
			command_fail(si, fault_nochange, _("\2%s\2 did not have a password change key outstanding."), entity(mu)->name);
		return;
	}

	if (MOWGLI_LIST_LENGTH(&mu->logins) > 0)
	{
		command_fail(si, fault_noprivs, _("This operation cannot be performed on %s, because someone is logged in to it."), entity(mu)->name);
		return;
	}

	if (metadata_find(mu, "private:freeze:freezer"))
	{
		command_fail(si, fault_noprivs, _("%s has been frozen by the %s administration."), entity(mu)->name, me.netname);
		return;
	}

	if (command_find(si->service->commands, "SETPASS"))
	{
		if (metadata_find(mu, "private:setpass:key"))
		{
			command_fail(si, fault_alreadyexists, _("\2%s\2 already has a password change key outstanding."), entity(mu)->name);
			command_fail(si, fault_alreadyexists, _("Use SENDPASS %s CLEAR to clear it so that a new one can be sent."), entity(mu)->name);
			return;
		}

		if (ismarked)
		{
			wallops("%s sent the password for the \2MARKED\2 account %s.", get_oper_name(si), entity(mu)->name);
			if (md)
				command_success_nodata(si, _("Overriding MARK placed by %s on the account %s."), md->value, entity(mu)->name);
			else
				command_success_nodata(si, _("Overriding MARK on the account %s."), entity(mu)->name);
		}
		logcommand(si, CMDLOG_ADMIN, "SENDPASS: \2%s\2 (change key)", name);

		key = random_string(12);
		metadata_add(mu, "private:sendpass:sender", get_oper_name(si));
		metadata_add(mu, "private:sendpass:timestamp", number_to_string(time(NULL)));

		if (!sendemail(si->su != NULL ? si->su : si->service->me, mu, EMAIL_SETPASS, mu->email, key))
		{
			command_fail(si, fault_emailfail, _("Email send failed."));
			free(key);
			return;
		}

		metadata_add(mu, "private:setpass:key", crypt_string(key, gen_salt()));
		free(key);

		command_success_nodata(si, _("The password change key for \2%s\2 has been sent to \2%s\2."), entity(mu)->name, mu->email);
	}
	else {
		if (ismarked)
		{
			wallops("%s sent the password for the \2MARKED\2 account %s.", get_oper_name(si), entity(mu)->name);
			if (md)
				command_success_nodata(si, _("Overriding MARK placed by %s on the account %s."), md->value, entity(mu)->name);
			else
				command_success_nodata(si, _("Overriding MARK on the account %s."), entity(mu)->name);
		}
		logcommand(si, CMDLOG_ADMIN, "SENDPASS: \2%s\2", name);

		newpass = random_string(12);
		metadata_add(mu, "private:sendpass:sender", get_oper_name(si));
		metadata_add(mu, "private:sendpass:timestamp", number_to_string(time(NULL)));

		if (!sendemail(si->su != NULL ? si->su : si->service->me, mu, EMAIL_SENDPASS, mu->email, newpass))
		{
			command_fail(si, fault_emailfail, _("Email send failed."));
			free(newpass);
			return;
		}

		set_password(mu, newpass);
		free(newpass);

		command_success_nodata(si, _("The password for \2%s\2 has been sent to \2%s\2."), entity(mu)->name, mu->email);

		if (mu->flags & MU_NOPASSWORD)
		{
			mu->flags &= ~MU_NOPASSWORD;
			command_success_nodata(si, _("The \2%s\2 flag has been removed for account \2%s\2."), "NOPASSWORD", entity(mu)->name);
		}
	}
}
Example #25
0
static void
ns_cmd_sendpass(struct sourceinfo *si, int parc, char *parv[])
{
	struct myuser *mu;
	char *name = parv[0];
	char *key;
	enum specialoperation op = op_none;
	bool ismarked = false;

	if (!name)
	{
		command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "SENDPASS");
		command_fail(si, fault_needmoreparams, _("Syntax: SENDPASS <account>"));
		return;
	}

	if (parc > 1)
	{
		if (!has_priv(si, PRIV_USER_SENDPASS))
		{
			command_fail(si, fault_noprivs, STR_NOT_AUTHORIZED);
			return;
		}
		else if (!strcasecmp(parv[1], "FORCE"))
			op = op_force;
		else if (!strcasecmp(parv[1], "CLEAR"))
			op = op_clear;
		else
		{
			command_fail(si, fault_badparams, STR_INVALID_PARAMS, "SENDPASS");
			command_fail(si, fault_badparams, _("Syntax: SENDPASS <account> [FORCE|CLEAR]"));
			return;
		}
	}

	if (!(mu = myuser_find_by_nick(name)))
	{
		command_fail(si, fault_nosuch_target, STR_IS_NOT_REGISTERED, name);
		return;
	}

	if (mu->flags & MU_WAITAUTH)
	{
		command_fail(si, fault_badparams, _("\2%s\2 is not verified."), entity(mu)->name);
		return;
	}

	if (metadata_find(mu, "private:mark:setter"))
	{
		ismarked = true;
		// don't want to disclose this, so just go ahead...
	}

	if (op == op_clear)
	{
		if (metadata_find(mu, "private:setpass:key"))
		{
			logcommand(si, CMDLOG_ADMIN, "SENDPASS:CLEAR: \2%s\2", entity(mu)->name);
			metadata_delete(mu, "private:setpass:key");
			metadata_delete(mu, "private:sendpass:sender");
			metadata_delete(mu, "private:sendpass:timestamp");
			command_success_nodata(si, _("The password change key for \2%s\2 has been cleared."), entity(mu)->name);
		}
		else
			command_fail(si, fault_nochange, _("\2%s\2 did not have a password change key outstanding."), entity(mu)->name);
		return;
	}

	if (MOWGLI_LIST_LENGTH(&mu->logins) > 0)
	{
		if (si->smu == mu)
			command_fail(si, fault_already_authed, _("You are logged in and can change your password using the SET PASSWORD command."));
		else
			command_fail(si, fault_noprivs, _("This operation cannot be performed on %s, because someone is logged in to it."), entity(mu)->name);
		return;
	}

	if (metadata_find(mu, "private:freeze:freezer"))
	{
		command_fail(si, fault_noprivs, _("%s has been frozen by the %s administration."), entity(mu)->name, me.netname);
		return;
	}

	if (metadata_find(mu, "private:setpass:key"))
	{
		command_fail(si, fault_alreadyexists, _("\2%s\2 already has a password change key outstanding."), entity(mu)->name);
		if (has_priv(si, PRIV_USER_SENDPASS))
			command_fail(si, fault_alreadyexists, _("Use SENDPASS %s CLEAR to clear it so that a new one can be sent."), entity(mu)->name);
		return;
	}

	key = random_string(12);

	const char *const hash = crypt_password(key);

	if (!hash)
	{
		command_fail(si, fault_internalerror, _("Hash generation for password change key failed."));
		sfree(key);
		return;
	}
	if (sendemail(si->su != NULL ? si->su : si->service->me, mu, EMAIL_SETPASS, mu->email, key))
	{
		if (ismarked)
			wallops("%s sent the password for the \2MARKED\2 account %s.", get_oper_name(si), entity(mu)->name);
		logcommand(si, CMDLOG_ADMIN, "SENDPASS: \2%s\2 (change key)", name);
		metadata_add(mu, "private:sendpass:sender", get_oper_name(si));
		metadata_add(mu, "private:sendpass:timestamp", number_to_string(time(NULL)));
		metadata_add(mu, "private:setpass:key", hash);
		command_success_nodata(si, _("The password change key for \2%s\2 has been sent to the corresponding email address."), entity(mu)->name);
	}
	else
		command_fail(si, fault_emailfail, _("Email send failed."));
	sfree(key);
}
Example #26
0
/* SET EMAIL <new address> */
static void ns_cmd_set_email(sourceinfo_t *si, int parc, char *parv[])
{
	char *email = parv[0];
	metadata_t *md;

	if (!email)
	{
		command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "EMAIL");
		command_fail(si, fault_needmoreparams, _("Syntax: SET EMAIL <new e-mail>"));
		return;
	}

	if (si->smu->flags & MU_WAITAUTH)
	{
		command_fail(si, fault_noprivs, _("Please verify your original registration before changing your e-mail address."));
		return;
	}

	if (!strcasecmp(si->smu->email, email))
	{
		md = metadata_find(si->smu, "private:verify:emailchg:newemail");
		if (md != NULL)
		{
			command_success_nodata(si, _("The email address change to \2%s\2 has been cancelled."), md->value);
			metadata_delete(si->smu, "private:verify:emailchg:key");
			metadata_delete(si->smu, "private:verify:emailchg:newemail");
			metadata_delete(si->smu, "private:verify:emailchg:timestamp");
		}
		else
			command_fail(si, fault_nochange, _("The email address for account \2%s\2 is already set to \2%s\2."), entity(si->smu)->name, si->smu->email);
		return;
	}

	if (!validemail(email))
	{
		command_fail(si, fault_badparams, _("\2%s\2 is not a valid email address."), email);
		return;
	}

	if (me.auth == AUTH_EMAIL)
	{
		unsigned long key = makekey();

		metadata_add(si->smu, "private:verify:emailchg:key", number_to_string(key));
		metadata_add(si->smu, "private:verify:emailchg:newemail", email);
		metadata_add(si->smu, "private:verify:emailchg:timestamp", number_to_string(CURRTIME));

		if (!sendemail(si->su != NULL ? si->su : si->service->me, EMAIL_SETEMAIL, si->smu, number_to_string(key)))
		{
			command_fail(si, fault_emailfail, _("Sending email failed, sorry! Your email address is unchanged."));
			metadata_delete(si->smu, "private:verify:emailchg:key");
			metadata_delete(si->smu, "private:verify:emailchg:newemail");
			metadata_delete(si->smu, "private:verify:emailchg:timestamp");
			return;
		}

		logcommand(si, CMDLOG_SET, "SET:EMAIL: \2%s\2 (\2%s\2 -> \2%s\2) (awaiting verification)", entity(si->smu)->name, si->smu->email, email);
		command_success_nodata(si, _("An email containing email changing instructions has been sent to \2%s\2."), email);
		command_success_nodata(si, _("Your email address will not be changed until you follow these instructions."));

		return;
	}

	myuser_set_email(si->smu, email);

	logcommand(si, CMDLOG_SET, "SET:EMAIL: \2%s\2 (\2%s\2 -> \2%s\2)", entity(si->smu)->name, si->smu->email, email);
	command_success_nodata(si, _("The email address for account \2%s\2 has been changed to \2%s\2."), entity(si->smu)->name, si->smu->email);
}
Example #27
0
void PreferencesFrame::set_formatted_integer_dynamic_value(int param, int value)
{
	Glib::ustring v = number_to_string(value) ;
	(*dynamic_values)[param] = v ;
}
Example #28
0
static void ns_cmd_restrict(sourceinfo_t *si, int parc, char *parv[])
{
	char *target = parv[0];
	char *action = parv[1];
	char *info = parv[2];
	myuser_t *mu;
	myuser_name_t *mun;

	if (!target || !action)
	{
		command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "RESTRICT");
		command_fail(si, fault_needmoreparams, _("Usage: RESTRICT <target> <ON|OFF> [note]"));
		return;
	}

	if (!(mu = myuser_find_ext(target)))
	{
		mun = myuser_name_find(target);
		if (mun != NULL && !strcasecmp(action, "OFF"))
		{
			object_unref(mun);
			wallops("%s unrestricted the name \2%s\2.", get_oper_name(si), target);
			logcommand(si, CMDLOG_ADMIN, "RESTRICT:OFF: \2%s\2", target);
			command_success_nodata(si, _("\2%s\2 is now unrestricted."), target);
			return;
		}
		command_fail(si, fault_nosuch_target, _("\2%s\2 is not registered."), target);
		return;
	}

	if (!strcasecmp(action, "ON"))
	{
		if (!info)
		{
			command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "RESTRICT");
			command_fail(si, fault_needmoreparams, _("Usage: RESTRICT <target> ON <note>"));
			return;
		}

		if (metadata_find(mu, "private:restrict:setter"))
		{
			command_fail(si, fault_badparams, _("\2%s\2 is already restricted."), entity(mu)->name);
			return;
		}

		metadata_add(mu, "private:restrict:setter", get_oper_name(si));
		metadata_add(mu, "private:restrict:reason", info);
		metadata_add(mu, "private:restrict:timestamp", number_to_string(time(NULL)));

		wallops("%s restricted the account \2%s\2.", get_oper_name(si), entity(mu)->name);
		logcommand(si, CMDLOG_ADMIN, "RESTRICT:ON: \2%s\2 (reason: \2%s\2)", entity(mu)->name, info);
		command_success_nodata(si, _("\2%s\2 is now restricted."), entity(mu)->name);
	}
	else if (!strcasecmp(action, "OFF"))
	{
		if (!metadata_find(mu, "private:restrict:setter"))
		{
			command_fail(si, fault_badparams, _("\2%s\2 is not restricted."), entity(mu)->name);
			return;
		}

		metadata_delete(mu, "private:restrict:setter");
		metadata_delete(mu, "private:restrict:reason");
		metadata_delete(mu, "private:restrict:timestamp");

		wallops("%s unrestricted the account \2%s\2.", get_oper_name(si), entity(mu)->name);
		logcommand(si, CMDLOG_ADMIN, "RESTRICT:OFF: \2%s\2", entity(mu)->name);
		command_success_nodata(si, _("\2%s\2 is now unrestricted."), entity(mu)->name);
	}
	else
	{
		command_fail(si, fault_needmoreparams, STR_INVALID_PARAMS, "RESTRICT");
		command_fail(si, fault_needmoreparams, _("Usage: RESTRICT <target> <ON|OFF> [note]"));
	}
}
Example #29
0
static void ns_cmd_register(sourceinfo_t *si, int parc, char *parv[])
{
	myuser_t *mu;
	mynick_t *mn = NULL;
	mowgli_node_t *n;
	const char *account;
	const char *pass;
	const char *email;
	char lau[BUFSIZE], lao[BUFSIZE];
	hook_user_register_check_t hdata;
	hook_user_req_t req;

	if (si->smu)
	{
		command_fail(si, fault_already_authed, _("You are already logged in as \2%s\2."), entity(si->smu)->name);
		if (si->su != NULL && !mynick_find(si->su->nick) &&
				command_find(si->service->commands, "GROUP"))
			command_fail(si, fault_already_authed, _("Use %s to register %s to your account."), "GROUP", si->su->nick);
		return;
	}

	if (nicksvs.no_nick_ownership || si->su == NULL)
		account = parv[0], pass = parv[1], email = parv[2];
	else
		account = si->su->nick, pass = parv[0], email = parv[1];

	if (!account || !pass || !email)
	{
		command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "REGISTER");
		if (nicksvs.no_nick_ownership || si->su == NULL)
			command_fail(si, fault_needmoreparams, _("Syntax: REGISTER <account> <password> <email>"));
		else
			command_fail(si, fault_needmoreparams, _("Syntax: REGISTER <password> <email>"));
		return;
	}

	if (strlen(pass) >= PASSLEN)
	{
		command_fail(si, fault_badparams, STR_INVALID_PARAMS, "REGISTER");
		command_fail(si, fault_badparams, _("Registration passwords may not be longer than \2%d\2 characters."), PASSLEN - 1);
		return;
	}

	if (!nicksvs.no_nick_ownership && si->su == NULL && user_find_named(account))
	{
		command_fail(si, fault_noprivs, _("A user matching this account is already on IRC."));
		return;
	}

	if (!nicksvs.no_nick_ownership && IsDigit(*account))
	{
		command_fail(si, fault_badparams, _("For security reasons, you can't register your UID."));
		command_fail(si, fault_badparams, _("Please change to a real nickname, and try again."));
		return;
	}

	if (nicksvs.no_nick_ownership || si->su == NULL)
	{
		if (strchr(account, ' ') || strchr(account, '\n') || strchr(account, '\r') || account[0] == '=' || account[0] == '#' || account[0] == '@' || account[0] == '+' || account[0] == '%' || account[0] == '!' || strchr(account, ','))
		{
			command_fail(si, fault_badparams, _("The account name \2%s\2 is invalid."), account);
			return;
		}
	}

	if (strlen(account) >= NICKLEN)
	{
		command_fail(si, fault_badparams, _("The account name \2%s\2 is invalid."), account);
		return;
	}

	if ((si->su != NULL && !strcasecmp(pass, si->su->nick)) || !strcasecmp(pass, account))
	{
		command_fail(si, fault_badparams, _("You cannot use your nickname as a password."));
		if (nicksvs.no_nick_ownership || si->su == NULL)
			command_fail(si, fault_needmoreparams, _("Syntax: REGISTER <account> <password> <email>"));
		else
			command_fail(si, fault_needmoreparams, _("Syntax: REGISTER <password> <email>"));
		return;
	}

	/* make sure it isn't registered already */
	if (nicksvs.no_nick_ownership ? myuser_find(account) != NULL : mynick_find(account) != NULL)
	{
		command_fail(si, fault_alreadyexists, _("\2%s\2 is already registered."), account);
		return;
	}

	if ((unsigned int)(CURRTIME - ratelimit_firsttime) > config_options.ratelimit_period)
		ratelimit_count = 0, ratelimit_firsttime = CURRTIME;

	/* Still do flood priv checking because the user may be in the ircop operclass */
	if (ratelimit_count > config_options.ratelimit_uses && !has_priv(si, PRIV_FLOOD))
	{
		command_fail(si, fault_toomany, _("The system is currently too busy to process your registration, please try again later."));
		slog(LG_INFO, "NICKSERV:REGISTER:THROTTLED: \2%s\2 by \2%s\2", account, si->su != NULL ? si->su->nick : get_source_name(si));
		return;
	}

	hdata.si = si;
	hdata.account = account;
	hdata.email = email;
	hdata.password = pass;
	hdata.approved = 0;
	hook_call_user_can_register(&hdata);
	if (hdata.approved != 0)
		return;
	if (!nicksvs.no_nick_ownership)
	{
		hook_call_nick_can_register(&hdata);
		if (hdata.approved != 0)
			return;
	}

	if (!validemail(email))
	{
		command_fail(si, fault_badparams, _("\2%s\2 is not a valid email address."), email);
		return;
	}

	if (!email_within_limits(email))
	{
		command_fail(si, fault_toomany, _("\2%s\2 has too many accounts registered."), email);
		return;
	}

	mu = myuser_add(account, auth_module_loaded ? "*" : pass, email, config_options.defuflags | MU_NOBURSTLOGIN | (auth_module_loaded ? MU_CRYPTPASS : 0));
	mu->registered = CURRTIME;
	mu->lastlogin = CURRTIME;
	if (!nicksvs.no_nick_ownership)
	{
		mn = mynick_add(mu, entity(mu)->name);
		mn->registered = CURRTIME;
		mn->lastseen = CURRTIME;
	}
	if (config_options.ratelimit_uses && config_options.ratelimit_period)
		ratelimit_count++;

	if (auth_module_loaded)
	{
		if (!verify_password(mu, pass))
		{
			command_fail(si, fault_authfail, _("Invalid password for \2%s\2."), entity(mu)->name);
			bad_password(si, mu);
			object_unref(mu);
			return;
		}
	}

	if (me.auth == AUTH_EMAIL)
	{
		char *key = random_string(12);
		mu->flags |= MU_WAITAUTH;

		metadata_add(mu, "private:verify:register:key", key);
		metadata_add(mu, "private:verify:register:timestamp", number_to_string(time(NULL)));

		if (!sendemail(si->su != NULL ? si->su : si->service->me, mu, EMAIL_REGISTER, mu->email, key))
		{
			command_fail(si, fault_emailfail, _("Sending email failed, sorry! Registration aborted."));
			object_unref(mu);
			free(key);
			return;
		}

		command_success_nodata(si, _("An email containing nickname activation instructions has been sent to \2%s\2."), mu->email);
		command_success_nodata(si, _("If you do not complete registration within one day, your nickname will expire."));

		free(key);
	}

	if (si->su != NULL)
	{
		si->su->myuser = mu;
		n = mowgli_node_create();
		mowgli_node_add(si->su, n, &mu->logins);

		if (!(mu->flags & MU_WAITAUTH))
			/* only grant ircd registered status if it's verified */
			ircd_on_login(si->su, mu, NULL);
	}

	command_add_flood(si, FLOOD_MODERATE);

	if (!nicksvs.no_nick_ownership && si->su != NULL)
		logcommand(si, CMDLOG_REGISTER, "REGISTER: \2%s\2 to \2%s\2", account, email);
	else
		logcommand(si, CMDLOG_REGISTER, "REGISTER: \2%s\2 to \2%s\2 by \2%s\2", account, email, si->su != NULL ? si->su->nick : get_source_name(si));

	if (is_soper(mu))
	{
		wallops("%s registered the nick \2%s\2 and gained services operator privileges.", get_oper_name(si), entity(mu)->name);
		logcommand(si, CMDLOG_ADMIN, "SOPER: \2%s\2 as \2%s\2", get_oper_name(si), entity(mu)->name);
	}

	command_success_nodata(si, _("\2%s\2 is now registered to \2%s\2, with the password \2%s\2."), entity(mu)->name, mu->email, pass);
	hook_call_user_register(mu);

	if (si->su != NULL)
	{
		snprintf(lau, BUFSIZE, "%s@%s", si->su->user, si->su->vhost);
		metadata_add(mu, "private:host:vhost", lau);

		snprintf(lao, BUFSIZE, "%s@%s", si->su->user, si->su->host);
		metadata_add(mu, "private:host:actual", lao);
	}

	if (!(mu->flags & MU_WAITAUTH))
	{
		req.si = si;
		req.mu = mu;
		req.mn = mn;
		hook_call_user_verify_register(&req);
	}
}
string resolve_express_function(const string express) {
    if (!resolve_express_is_function(express)) return "";

    split_result split(split_string(express,"|"));
    string function(split.first),next_function(split.second);
    left_move_string(next_function,1);
    string result;

    while (!function.empty()) {
        if (!resolve_express_is_function(function)) return function;

        split=split_string(function,"(");
        string function_name(upper_string(split.first)),function_arg(separate_string(function,"(",")"));

        if (function_rnd==function_name) {
            function_arg=separate_string(function_arg,"[","]");
            string down,up;
            split=split_string(function_arg,"-");
            if (1<count_string(function_arg,"-")) {
                left_move_string(split.second,1);
                if (resolve_express_is_function(split.second)) {
                    down=split.first;
                    up=split.second;
                    left_move_string(up,1);
                } else {
                    split=split_string(function_arg,")");
                    down=split.first;
                    down+=")";
                    left_move_string(split.second,1);
                    split=split_string(split.second,"-");
                    left_move_string(split.second,1);
                    up=split.second;
                }
            } else {
                down=split.first;
                up=split.second;
                left_move_string(up,1);
            }

            if (down.empty() || up.empty())
                return "";

            if (resolve_express_is_function(down))
                down=resolve_express_function(down);
            if (resolve_express_is_function(up))
                up=resolve_express_function(up);

            long down_=string_to_number(down),up_=string_to_number(up);
            long rnd=ramdon(down_,up_);
            result+=number_to_string(rnd);
        } else if (function_time==function_name) {
        } else if (function_base64==function_name) {
            if (!resolve_express_is_function(function_arg)) {
                return base64_encode(function_arg.c_str(),function_arg.length());
            } else {
                string encode_string(resolve_express_function(function_arg));
                return base64_encode(encode_string.c_str(),encode_string.length());
            }
        } else if (function_len==function_name) {
            unsigned int length=function_arg.length();
            return number_to_string(length);
        }
        split=split_string(next_function,",");
        function=split.first;
        next_function=split.second;
        left_move_string(next_function,1);
    }
    return result;
}