#include "services.h"
#include "language.h"
Go to the source code of this file.
Data Structures | |
| struct | arc4_stream |
Defines | |
| #define | issp(c) ((c) == 32) |
Functions | |
| void | add_entropy_userkeys (void) |
| void | binary_to_hex (unsigned char *bin, char *hex, int length) |
| char ** | buildStringList (char *src, int *number) |
| void | doCleanBuffer (char *str) |
| int | dotime (const char *s) |
| int | doValidHost (const char *host, int type) |
| char * | duration (NickAlias *na, char *buf, int bufsize, time_t seconds) |
| void | EnforceQlinedNick (char *nick, char *killer) |
| char * | expire_left (NickAlias *na, char *buf, int len, time_t expires) |
| u_int16_t | getrandom16 (void) |
| u_int32_t | getrandom32 (void) |
| unsigned char | getrandom8 (void) |
| char * | host_resolve (char *host) |
| int | isvalidchar (const char c) |
| int | isValidHost (const char *host, int type) |
| int | match_wild (const char *pattern, const char *str) |
| int | match_wild_nocase (const char *pattern, const char *str) |
| char * | merge_args (int argc, char **argv) |
| int | myNumToken (const char *str, const char dilim) |
| char * | myStrGetOnlyToken (const char *str, const char dilim, int token_number) |
| char * | myStrGetToken (const char *str, const char dilim, int token_number) |
| char * | myStrGetTokenRemainder (const char *str, const char dilim, int token_number) |
| char * | myStrSubString (const char *src, int start, int end) |
| int | nickIsServices (char *tempnick, int bot) |
| void | ntoa (struct in_addr addr, char *ipaddr, int len) |
| int | process_numlist (const char *numstr, int *count_ret, range_callback_t callback, User *u,...) |
| void | protocol_debug (char *source, char *cmd, int argc, char **argv) |
| void | rand_init (void) |
| char * | send_token (char *token1, char *token2) |
| char * | str_signed (unsigned char *str) |
| char * | stripModePrefix (const char *str) |
| char * | stristr (char *s1, char *s2) |
| size_t | strlcat (char *dst, const char *src, size_t siz) |
| size_t | strlcpy (char *dst, const char *src, size_t siz) |
| char * | strnrepl (char *s, int32 size, const char *old, const char *new) |
| char * | strscpy (char *d, const char *s, size_t len) |
| int | tolower (char c) |
| int | toupper (char c) |
Variables | |
| arc4_stream | rs |
| #define issp | ( | c | ) | ((c) == 32) |
| void add_entropy_userkeys | ( | void | ) |
| void binary_to_hex | ( | unsigned char * | bin, | |
| char * | hex, | |||
| int | length | |||
| ) |
Simple function to convert binary data to hex. Taken from hybrid-ircd ( http://ircd-hybrid.com/ )
Definition at line 68 of file misc.c.
Referenced by md5_encrypt(), old_encrypt(), and sha1_encrypt().
| char** buildStringList | ( | char * | src, | |
| int * | number | |||
| ) |
Build a string list from a given source string. This is usually used for parsing out values from the config file, but could be used for other things. NOTE: this function uses strtok(), be aware it will break any buffer you think you have in there ;)
Definition at line 1214 of file misc.c.
References sstrdup().
| void doCleanBuffer | ( | char * | str | ) |
Clean up the buffer for extra spaces
| str | to clean up |
Definition at line 801 of file misc.c.
References issp.
Referenced by event_message_process(), and process().
| int dotime | ( | const char * | s | ) |
dotime: Return the number of seconds corresponding to the given time string. If the given string does not represent a valid time, return -1.
A time string is either a plain integer (representing a number of seconds), or an integer followed by one of these characters: "s" (seconds), "m" (minutes), "h" (hours), or "d" (days).
| s | String to convert |
Definition at line 365 of file misc.c.
Referenced by AnopeInit(), do_akill(), do_chankill(), do_exception(), do_ignoreuser(), do_nick(), do_sgline(), do_sqline(), do_szline(), do_tban(), main(), and resetDefCon().
| int doValidHost | ( | const char * | host, | |
| int | type | |||
| ) |
Validate the host shortname = ( letter / digit ) *( letter / digit / "-" ) *( letter / digit ) hostname = shortname *( "." shortname ) ip4addr = 1*3digit "." 1*3digit "." 1*3digit "." 1*3digit
| host | = string to check | |
| type | = format, 1 = ip4addr, 2 = hostname |
Ultimate3 dosnt like a non-dotted hosts at all, nor does unreal, so just dont allow them.
Definition at line 530 of file misc.c.
References HOSTMAX.
Referenced by isValidHost().
| char* duration | ( | NickAlias * | na, | |
| char * | buf, | |||
| int | bufsize, | |||
| time_t | seconds | |||
| ) |
Expresses in a string the period of time represented by a given amount of seconds (with days/hours/minutes).
| na | Nick Alias | |
| buf | buffer to store result into | |
| bufsize | Size of the buffer | |
| seconds | time in seconds |
Definition at line 403 of file misc.c.
References getstring, and snprintf().
| void EnforceQlinedNick | ( | char * | nick, | |
| char * | killer | |||
| ) |
Kill the user to enforce the sqline
| nick | to kill | |
| killer | whom is doing the killing |
Definition at line 838 of file misc.c.
References alog(), finduser(), user_::host, kill_user(), user_::nick, and user_::username.
Referenced by bahamut_cmd_bot_nick(), bahamut_cmd_nick(), charybdis_cmd_bot_nick(), charybdis_cmd_nick(), do_bot(), dreamforge_cmd_bot_nick(), dreamforge_cmd_nick(), hybrid_cmd_bot_nick(), hybrid_cmd_nick(), plexus_cmd_bot_nick(), plexus_cmd_nick(), ptlink_cmd_bot_nick(), ptlink_cmd_nick(), rageircd_cmd_bot_nick(), rageircd_cmd_nick(), ratbox_cmd_bot_nick(), ratbox_cmd_nick(), shadowircd_cmd_bot_nick(), shadowircd_cmd_nick(), solidircd_cmd_bot_nick(), solidircd_cmd_nick(), ultimate2_cmd_bot_nick(), ultimate2_cmd_nick(), ultimate3_cmd_bot_nick(), ultimate3_cmd_nick(), unreal_cmd_bot_nick(), unreal_cmd_nick(), viagra_cmd_bot_nick(), and viagra_cmd_nick().
| char* expire_left | ( | NickAlias * | na, | |
| char * | buf, | |||
| int | len, | |||
| time_t | expires | |||
| ) |
Generates a human readable string of type "expires in ..."
| na | Nick Alias | |
| buf | buffer to store result into | |
| bufsize | Size of the buffer | |
| seconds | time in seconds |
Definition at line 471 of file misc.c.
References getstring, and snprintf().
Referenced by akill_view(), sgline_view(), sqline_view(), and szline_view().
| u_int16_t getrandom16 | ( | void | ) |
Get the random numbers 16 byte deep
Definition at line 1063 of file misc.c.
References getrandom8().
Referenced by collide().
| u_int32_t getrandom32 | ( | void | ) |
Get the random numbers 32 byte deep
Definition at line 1078 of file misc.c.
References getrandom8().
| unsigned char getrandom8 | ( | void | ) |
Get the random numbers 8 byte deep
Definition at line 1044 of file misc.c.
References arc4_stream::i, arc4_stream::j, rs, and arc4_stream::s.
Referenced by getrandom16(), and getrandom32().
| char* host_resolve | ( | char * | host | ) |
| int isvalidchar | ( | const char | c | ) |
Valid character check
| c | Character to check |
Definition at line 635 of file misc.c.
Referenced by do_setall(), and myDoSet().
| int isValidHost | ( | const char * | host, | |
| int | type | |||
| ) |
Front end to doValidHost
| host | = string to check | |
| type | = format, 1 = ip4addr, 2 = hostname |
Definition at line 615 of file misc.c.
References doValidHost().
Referenced by do_bot(), do_jupe(), hs_do_request(), and myDoSet().
| int match_wild | ( | const char * | pattern, | |
| const char * | str | |||
| ) |
| int match_wild_nocase | ( | const char * | pattern, | |
| const char * | str | |||
| ) |
match_wild: Case Insenstive wild card search
| pattern | To be matched | |
| str | String in which the pattern is to be matched |
Definition at line 269 of file misc.c.
Referenced by add_akill(), add_ban(), add_sgline(), add_sqline(), add_szline(), bot_join(), check_akill(), check_chan_sqline(), check_sgline(), check_sqline(), check_szline(), do_admin(), do_akill(), do_chanlist(), do_exception(), do_list(), do_oper(), do_sgline(), do_sqline(), do_szline(), do_userlist(), find_host_exception(), find_hostip_exception(), is_excepted_mask(), is_on_access(), is_stuck(), listOut(), match_userip(), match_usermask(), sqline(), and stick_mask().
| char* merge_args | ( | int | argc, | |
| char ** | argv | |||
| ) |
merge_args: Take an argument count and argument vector and merge them into a single string in which each argument is separated by a space.
| int | Number of Args | |
| argv | Array |
Definition at line 181 of file misc.c.
References snprintf().
Referenced by anope_event_tburst(), anope_event_topic(), chan_set_modes(), do_cmode(), do_join(), do_kick(), do_part(), do_quit(), do_topic(), do_umode(), do_umode2(), and inspircd_cmd_svsmode().
| int myNumToken | ( | const char * | str, | |
| const char | dilim | |||
| ) |
Number of tokens in a string
| str | String | |
| dilim | Dilimiter |
Definition at line 1114 of file misc.c.
Referenced by anope_event_bmask().
| char* myStrGetOnlyToken | ( | const char * | str, | |
| const char | dilim, | |||
| int | token_number | |||
| ) |
Get the token only
| str | String to search in | |
| dilim | Character to search for | |
| token_number | the token number |
Definition at line 686 of file misc.c.
References myStrSubString().
Referenced by anope_event_newmask(), do_list(), do_setall(), hs_do_request(), listOut(), moduleGetConfigDirective(), and myDoSet().
| char* myStrGetToken | ( | const char * | str, | |
| const char | dilim, | |||
| int | token_number | |||
| ) |
Get the token
| str | String to search in | |
| dilim | Character to search for | |
| token_number | the token number |
Definition at line 655 of file misc.c.
References myStrSubString().
Referenced by anope_event_bmask(), anope_event_capab(), anope_event_fjoin(), anope_event_server(), anope_event_tburst(), base64dects(), capab_parse(), do_sjoin(), do_tban(), do_topic(), hs_do_activate(), hs_do_reject(), hs_do_request(), hsreq_load_db(), mLoadData(), my_cs_appendtopic(), my_cs_enforce(), my_ns_register(), my_ns_set(), myAddChanInfo(), myAddNickInfo(), myChanInfo(), and myNickInfo().
| char* myStrGetTokenRemainder | ( | const char * | str, | |
| const char | dilim, | |||
| int | token_number | |||
| ) |
Get the Remaining tokens
| str | String to search in | |
| dilim | Character to search for | |
| token_number | the token number |
Definition at line 721 of file misc.c.
References myStrSubString().
Referenced by anope_event_newmask(), anope_event_server(), capab_parse(), do_list(), do_setall(), hs_do_reject(), hs_do_request(), listOut(), moduleGetConfigDirective(), my_cs_appendtopic(), myAddChanInfo(), myAddNickInfo(), and myDoSet().
| char* myStrSubString | ( | const char * | src, | |
| int | start, | |||
| int | end | |||
| ) |
Get the string between point A and point B
| str | String to search in | |
| start | Point A | |
| end | Point B |
Definition at line 754 of file misc.c.
Referenced by myStrGetOnlyToken(), myStrGetToken(), and myStrGetTokenRemainder().
| int nickIsServices | ( | char * | tempnick, | |
| int | bot | |||
| ) |
Is the given nick a network service
| nick | to check | |
| int | Check if botserv bots |
Definition at line 858 of file misc.c.
References botlists, botinfo_::next, botinfo_::nick, s_BotServ, s_BotServAlias, s_ChanServ, s_ChanServAlias, s_DevNull, s_DevNullAlias, s_GlobalNoticer, s_GlobalNoticerAlias, s_HelpServ, s_HelpServAlias, s_HostServ, s_HostServAlias, s_MemoServ, s_MemoServAlias, s_NickServ, s_NickServAlias, s_OperServ, s_OperServAlias, ServerName, sstrdup(), and stricmp().
| void ntoa | ( | struct in_addr | addr, | |
| char * | ipaddr, | |||
| int | len | |||
| ) |
Definition at line 1201 of file misc.c.
References snprintf().
Referenced by do_nick(), and host_resolve().
| int process_numlist | ( | const char * | numstr, | |
| int * | count_ret, | |||
| range_callback_t | callback, | |||
| User * | u, | |||
| ... | ||||
| ) |
Process a string containing a number/range list in the form "n1[-n2][,n3[-n4]]...", calling a caller-specified routine for each number in the list. If the callback returns -1, stop immediately. Returns the sum of all nonnegative return values from the callback. If `count' is non-NULL, it will be set to the total number of times the callback was called.
The callback should be of type range_callback_t, which is defined as: int (*range_callback_t)(User *u, int num, va_list args)
| numstr | ||
| count_ret | ||
| callback | Call back function | |
| u | User Struct | |
| ... | various args |
Definition at line 293 of file misc.c.
References VA_COPY.
Referenced by do_access(), do_akick(), do_exception(), do_read(), and do_xop().
| void protocol_debug | ( | char * | source, | |
| char * | cmd, | |||
| int | argc, | |||
| char ** | argv | |||
| ) |
Definition at line 774 of file misc.c.
References alog(), and protocoldebug.
Referenced by process().
| void rand_init | ( | void | ) |
random init
Definition at line 978 of file misc.c.
References mysql_rand().
Referenced by init_secondary().
| char* send_token | ( | char * | token1, | |
| char * | token2 | |||
| ) |
Determine if we need to send the TOKEN
| token1 | ||
| token2 |
Definition at line 1097 of file misc.c.
References ircd, ircdcap, ircdcapab_::token, ircdvars_::token, and UseTokens.
Referenced by unreal_cmd_akill(), unreal_cmd_bot_nick(), unreal_cmd_chg_nick(), unreal_cmd_chghost(), unreal_cmd_chgident(), unreal_cmd_ctcp(), unreal_cmd_eob(), unreal_cmd_global(), unreal_cmd_global_legacy(), unreal_cmd_guest_nick(), unreal_cmd_invite(), unreal_cmd_join(), unreal_cmd_kick(), unreal_cmd_mode(), unreal_cmd_netinfo(), unreal_cmd_nick(), unreal_cmd_notice(), unreal_cmd_notice2(), unreal_cmd_notice_ops(), unreal_cmd_part(), unreal_cmd_pong(), unreal_cmd_privmsg(), unreal_cmd_privmsg2(), unreal_cmd_quit(), unreal_cmd_release_svshold(), unreal_cmd_remove_akill(), unreal_cmd_serv_notice(), unreal_cmd_serv_privmsg(), unreal_cmd_sgline(), unreal_cmd_sqline(), unreal_cmd_squit(), unreal_cmd_svid_umode(), unreal_cmd_svshold(), unreal_cmd_svsjoin(), unreal_cmd_svskill(), unreal_cmd_svsmode(), unreal_cmd_svsmode_chan(), unreal_cmd_svsnick(), unreal_cmd_svsnoop(), unreal_cmd_svso(), unreal_cmd_svspart(), unreal_cmd_svswatch(), unreal_cmd_swhois(), unreal_cmd_szline(), unreal_cmd_topic(), unreal_cmd_unsgline(), unreal_cmd_unsqline(), unreal_cmd_unszline(), and unreal_cmd_vhost_off().
| char* str_signed | ( | unsigned char * | str | ) |
Change an unsigned string to a signed string, overwriting the original string.
| input | string |
Definition at line 1172 of file misc.c.
Referenced by encode_ip().
| char* stripModePrefix | ( | const char * | str | ) |
Strip the mode prefix from the given string. Useful for using the modes stored in things like ircd->ownerset etc..
Definition at line 1191 of file misc.c.
References sstrdup().
Referenced by chan_set_correct_modes(), check_should_owner(), check_should_protect(), and check_valid_op().
| char* stristr | ( | char * | s1, | |
| char * | s2 | |||
| ) |
stristr: Search case-insensitively for string s2 within string s1, returning the first occurrence of s2 or NULL if s2 was not found.
| s1 | String 1 | |
| s2 | String 2 |
Definition at line 114 of file misc.c.
References tolower.
Referenced by botchanmsgs().
| size_t strlcat | ( | char * | dst, | |
| const char * | src, | |||
| size_t | siz | |||
| ) |
| size_t strlcpy | ( | char * | dst, | |
| const char * | src, | |||
| size_t | siz | |||
| ) |
| char* strnrepl | ( | char * | s, | |
| int32 | size, | |||
| const char * | old, | |||
| const char * | new | |||
| ) |
strnrepl: Replace occurrences of `old' with `new' in string `s'. Stop replacing if a replacement would cause the string to exceed `size' bytes (including the null terminator). Return the string.
| s | String | |
| size | size of s | |
| old | character to replace | |
| new | character to replace with |
Definition at line 145 of file misc.c.
Referenced by do_act(), lang_sanitize(), notice_help(), strftime_lang(), and unreal_cmd_sgline().
| char* strscpy | ( | char * | d, | |
| const char * | s, | |||
| size_t | len | |||
| ) |
| int tolower | ( | char | c | ) |
| int toupper | ( | char | c | ) |
| struct arc4_stream rs |
Referenced by getrandom8().
1.5.1-20070107