Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

services.h File Reference

Services master header file. More...

#include "config.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include <ctype.h>
#include <time.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include "options.h"
#include "parse.h"
#include "struct.h"

Go to the source code of this file.

Defines

#define FREE(x)   do { free(x) ; (x) = NULL; } while (0)
#define assert(x)   (!(x) ? fatalSvsError(__FILE__, __LINE__, #x) : 0)
 DEBUG: Terminate if x is false with a fatal error.

#define MAX(x, y)   (((x) > (y)) ? (x) : (y))
 Macro that returns the highest value provided.

#define MIN(x, y)   ( ( (x) < (y) ) ? (x) : (y) )
 Macro that returns the lower value provided.

#define strncpyzt(s_dest, s_src, s_size)
 Copy N bytes from source to target string but ensure (NUL) termination.

#define FATAL_ERROR   66
#define FALSE   0
 Not true.

#define TRUE   !(FALSE)
 Not false.

#define net_read(a, b, c)   read((a), (b), (c))
 Temporary hack.

#define net_write(a, b, c)   write((a), (b), (c))
 Temporary hack.

#define NUMSERVS   7
#define MAXEVENTS   4096
#define GLOBOPS_ON_RAW
#define VERSION_NUM   VERSION
 Version number string for services.

#define VERSION_QUOTE   ("When you wake up you're all weak, throwing your life away")
 Version quote string.

#define VERSION_STRING   (PACKAGE "-" VERSION_NUM "")
 Complete version string.

#define LOGCHAN   "#services"
 Channel for log output.

#define DEBUGCHAN   "#services-debug"
 Channel for debug output.

#define NETWORK_CHANNELS   "#sorcery:" LOGCHAN ":" DEBUGCHAN ":"
 List of network channels.

#define A_AKILL   0x01
 Autokill typeflag.

#define A_IGNORE   0x02
 Services ignore typeflag.

#define A_AHURT   0x04
 Autohurt typeflag.

#define CLONE_KILLFLAG   0x01
 Clone trigger kill flag.

#define CLONE_IGNOREFLAG   0x02
 Clone trigger ignore flag.

#define CLONE_PERMTRIGGER   0x04
 Clone trigger perm flag.

#define CLONE_OK   0x08
 Clone alert has been cleared.

#define CLONE_ALERT   0x10
 Has set off a clone alert.

#define str_cmp   strcasecmp

Functions

void flushLogs (char *)
 Flush services logs.

void expireChans (char *)
void expireNicks (char *)
 This function handles timed NickServ expiration runs, deletes non-held nicknames that have not been used for their maximum inactivity period before expiration.

void sshutdown (int)
 Shuts down services.

void checkTusers (char *)
 Check total number of users.

void readConf (void)
 Reads the services configuration file.

void addUser (char *, char *, char *, char *, char *)
int ConnectToServer (char *, int)
 Used at services startup to connect to its uplink.

void sSend (char *,...) __attribute__((format(printf
void logDump (FILE *, char *,...) __attribute__((format(printf
void breakLine (char *)
void handler (int)
 Signal handler.

char * xorit (char *)
 Encrypt a password string.

void sendInfoReply (UserList *)
int cancel_timer (int)
 Cancels a timer event.

int timer (long, void(*func)(char *), void *)
 Schedules a timer.

void timeralarm (void)
 Check for expired timers.

void dumptimer (char *from)
 Reports the list of timers.

void sync_cfg (char *)
 Periodic synchronizations (saves) of various databases.

void AppendBuffer (char **, const char *)
void SetDynBuffer (char **, const char *)
void breakString (int, char *, char *args[256], char)
int match (const char *, const char *)
 Matches a string against the specified pattern for wildcards \ as allowed done by IRC clients/servers.

void strtolower (char *)
 Lowercases a NUL-terminated string in place.

void doTfunc (char *)
char * sfgets (char *, int, FILE *)
int check_match (char *)
int exp_match (char *, char *)
void parse_str (char **, int, int, char *, size_t)
 Merge a vector of strings into one string across delimeters.

void mask (char *, char *, int, char *)
 This function is used by the NickServ ADDMASK command.

void tzapply (char *)
int split_userhost (const char *input_host, MaskData *data)
 Splits a string into a supplied mask structure.

void free_mask (MaskData *)
 Frees a mask structure.

MaskDatamake_mask (void)
 Allocates a mask structure.

void * oalloc (size_t)
 Clean and allocate a memory area.

char * genHostMask (char *)
 Returns the masked version of a host.

char * flagstring (int flags, const char *bits[])
 Report the names of bits set.

int flagbit (char *, const char *bits[])
char * str_dup (const char *)
 Allocates and returns a copy of the supplied string.

unsigned char * toBase64 (const unsigned char *stream, size_t left)
unsigned char * fromBase64 (const char *cStr, int *len)
void listAkills (char *from, char type)
 Handles an AutoKill/AutoHurt/Ignore/... list request.

int addakill (long length, char *mask, char *by, char type, char *reason)
 Addakill adds an item to an OperServ autokill/ignore/autohurt/other list.

int removeAkill (char *from, char *mask)
 Handles a user attempting to remove an akill.

int removeAkillType (char *from, char *mask, int type, int restrict)
 Handles a user attempting to remove an OperServ banlist item.

void saveakills (void)
 Saves the akill database.

void loadakills (void)
 Load the akill/kline databases.

int isAKilled (char *, char *, char *)
 Returns TRUE if a user is akilled.

char * checkAndSetAKill (char *nick, char *user, char *host)
int isAHurt (char *, char *, char *)
 Returns TRUE if a user is autohurt.

int isIgnored (char *, char *, char *)
 Returns TRUE if a user is ignored.

void timed_akill_queue (char *)
 Sends out services kline queue e-mail messages when the time arrives for them to be sent.

void autoremoveakill (char *mask)
 Handles automatic removal of expired akills by OperServ.

void queueakill (char *, char *, char *, char *, time_t, int, int, int)
 Adds information about an autokill to the body of the kline queue that is periodically mailed to the AKILLMAILTO address.

const char * aktype_str (int type, int which)
 Returns a string indicating which type of OperServ banlist item we have.

void dlogInit (void)
 Initialize debug logging at bootup.

void dlogEntry (char *,...)
 Store a log entry in the debug-log stack.

void dlogDump (FILE *)
 Services crash or request, dump debug log entries to file.

void motd (char *)
 Print the services message of the day.

void help (char *, char *, char **, int)
 Handle a user's help request.

void flush_help_cache (void)
 Flush out the help cache.

help_cachecheck_help_cache (char *)
 Check if a help item is in the cache if so return it, else return NULL.

int fatalSvsError (const char *fName, int lineNo, const char *cErr)
int isPasswordAcceptable (const char *password, char *reason)
 Is a password acceptable?


Variables

char myname [255]
 Name of services.

char mypass [33]
 Password of services' N-line.

char hostname [255]
 Hostname of services' uplink.

int port
 IRC Port of services' uplink.

int server
 File descriptor of services' connection with the uplink.

Service services [NUMSERVS]
 Array of services and their data... see above for Service struct.

database db
 Database files.

u_long totalusers
 Total online users.

u_long mostusers
 Maximum concurrent users.

u_long mostnicks
 Number of registered nicknames.

u_long mostchans
 Number of registered channels.

u_long mostmemos
 Number of memos ??

u_long counterOldCSFmt
 Counter of number of ChanServ commands interpreted by the old hack.

long startup
 Time services started (now or first time).

long firstup
 Time services started (now or first time).

char * OperServ
 Services nickname constants.

char * NickServ
 Services nickname constants.

char * ChanServ
 Services nickname constants.

char * MemoServ
 Services nickname constants.

char * InfoServ
 Services nickname constants.

char * GameServ
 Services nickname constants.

char coreBuffer [IRCBUF]
 Used for printing core messages.

u_int AccessLimit
 Limits set in services.conf.

u_int OpLimit
 Limits set in services.conf.

u_int AkickLimit
 Limits set in services.conf.

u_int ChanLimit
 Limits set in services.conf.

u_int NickLimit
 Limits set in services.conf.

time_t CTime
 Current time (UTC), keep this in mind...

time_t nextNsync
 Times (UTC) of next syncs.

time_t nextCsync
 Times (UTC) of next syncs.

time_t nextMsync
 Times (UTC) of next syncs.


Detailed Description

Services master header file.

This header includes indirectly some system-related files and declares global constants and other entities used throughout all of services.

Author:
Chip Norkus

Max Byrd

Greg Poma

James Hess

Id
services.h,v 1.1.1.1 2003/07/04 02:56:27 Mysid Exp

Definition in file services.h.


Define Documentation

#define A_AKILL   0x01
 

Autokill typeflag.

Send copyright notices.. define or undef

Definition at line 205 of file services.h.

Referenced by addakill(), aktype_str(), applyAkill(), checkAkillAllUsers(), isAKilled(), loadakills(), os_akill(), IpcType::queryObjMessage(), removeAkill(), and removeAkillType().

#define CLONE_PERMTRIGGER   0x04
 

Clone trigger perm flag.

Bug:
purpose of CLONE_PERMTRIGGER???

Definition at line 221 of file services.h.

#define FATAL_ERROR   66
 

This is for the benefit of bigbrother, so it will know when to not attempt to restart services. What is 'bigbrother'???

Definition at line 127 of file services.h.

#define GLOBOPS_ON_RAW
 

Send a globops when SRAs use /os raw

Definition at line 179 of file services.h.

#define MAX x,
 )     (((x) > (y)) ? (x) : (y))
 

Macro that returns the highest value provided.

Parameters:
x an integer
y an integer

Definition at line 97 of file services.h.

Referenced by main(), and setIdentify().

#define MAXEVENTS   4096
 

maximum events running in timer system at once...

Definition at line 174 of file services.h.

#define MIN x,
 )     ( ( (x) < (y) ) ? (x) : (y) )
 

Macro that returns the lower value provided.

Parameters:
x an integer
y an integer

Definition at line 106 of file services.h.

Referenced by ranstring().

#define net_read a,
b,
 )     read((a), (b), (c))
 

Temporary hack.

Bug:
This is a temporary hack... Don't leave this in place long! [XXX Skan]

Definition at line 143 of file services.h.

Referenced by main().

#define NUMSERVS   7
 

The number of services entries present -- this MUST be right or services WILL have lots of problems

Definition at line 152 of file services.h.

Referenced by parseLine().

#define str_cmp   strcasecmp
 

Shortcut for case-insensitive comparison

Definition at line 431 of file services.h.

Referenced by IpcType::alterObjMessage(), IpcType::alterRegNickMessage(), and IpcType::authObjMessage().

#define strncpyzt s_dest,
s_src,
s_size   ) 
 

Value:

do {                                    \
    strncpy((s_dest), (s_src), (s_size));               \
    (s_dest)[(s_size) - 1] = '\0';                  \
} while(0)
Copy N bytes from source to target string but ensure (NUL) termination.

Parameters:
s_dest Target character array
s_src Source character array
s_size Number bytes to copy

Definition at line 116 of file services.h.

Referenced by addakill(), addGhost(), addUserToChan(), banKick(), breakLine(), checkAkillAllUsers(), cs_set_mlock(), getMiscChanOp(), is_postnews(), loadakills(), IpcType::makeMessage(), NickSeeUser(), parseFprint(), parseLine(), readChanData(), readInfoData(), readMemoData(), readNickData(), IpcType::ReadPackets(), readTriggerData(), regnick_ugethost(), sendToChanServ(), setChanMode(), setChanTopic(), SetUserNickHostReal(), and xorit().


Function Documentation

int addakill long  length,
char *  mask,
char *  by,
char  type,
char *  reason
 

Addakill adds an item to an OperServ autokill/ignore/autohurt/other list.

Returns:
0 if successful, -1 if failed
Parameters:
length Duration (in seconds) to leave item in the list, 0 for permanent
mask This is the mask to be affected by the entry
by This is the nickname of the user that was responsible for creating the entry (OperServ for automatic)
type This is the entry type (A_AKILL, A_AHURT, A_IGNORE)
reason This is the reason the entry needs to be set
Precondition:
Length is an integer between 0 and INT_MAX. Mask is a pointer to a valid NUL-terminated character array. By is a pointer to a valid, NUL-terminated character array that holds a valid IRC nickname. Type is one of the A_xx constants for autokills as defined in operserv.h (ex: A_AKILL). Reason is a pointer to a valid, non-zero, NUL-terminated character array.
Postcondition:
An autokill record is added. One or more users might have been killed or autohurt. One or more nickname structures may have been removed from the online users list and their memory freed.

Definition at line 449 of file akill.c.

References A_AHURT, A_AKILL, aktype_str(), autoremoveakill(), checkAkillAllUsers(), firstBanItem, mask(), myname, akill::next, oalloc(), OperServ, akill::prev, queueakill(), sSend(), strncpyzt, timer(), and top_akill_stamp.

void addUser char *  nick,
char *  user,
char *  host,
char *  name,
char *  mode
 

Add a new user, be that ChanServ or a nick in holding. in the 'mode' variable you can specify +iogsw or any other ircd compatible modes.

Used at services startup

Definition at line 153 of file server.c.

References myname, and sSend().

Referenced by addGhost(), main(), make_clone(), and parseLine().

const char* aktype_str int  type,
int  which
 

Returns a string indicating which type of OperServ banlist item we have.

Parameters:
type Represents the type of list item (such as A_AKILL)
which Indicates which string to print, '0' is the standard form such as 'autokill', '1' is the capitalized form such as 'Autokill', and '2' is the past-tense verb form such as 'autokilled'. No other value for which is allowed.
Returns a string representing the type of list item

Definition at line 577 of file akill.c.

References A_AHURT, A_AKILL, and A_IGNORE.

Referenced by addakill(), queueakill(), removeAkill(), and removeAkillType().

void AppendBuffer char **  buf,
const char *  add
 

Precondition:
From points to a valid NUL-terminated character array, and add is a reference to a character array to be changed.
Postcondition:
*Buf area is reallocated to contain its present state plus the string specified as 'add'

Definition at line 744 of file stuff.c.

References oalloc().

Referenced by dbReadString().

void autoremoveakill char *  mask  ) 
 

Handles automatic removal of expired akills by OperServ.

Parameters:
mask Mask to be removed
Warning: this function calls free() on the mask passed

Definition at line 857 of file akill.c.

void breakLine char *  tmpbuffer  ) 
 

Break up a string of data into seperate pieces and parse those. (parseLine())

Bug:
"I'm not sure but this function could be done better(?) if someone wants to improve it..."

Definition at line 182 of file server.c.

References FALSE, MAX_IRC_LINE_LEN, oldData, OperServ, parseLine(), sSend(), sshutdown(), strncpyzt, and TRUE.

Referenced by main().

int cancel_timer int  tid  ) 
 

Cancels a timer event.

Parameters:
tid Identifier of the timer to cancel
Destroys a timer prematurely, preventing the timed event from firing later

Definition at line 200 of file timer.c.

References firstTimerItem, and t_chain::next.

Referenced by removeAkill(), and removeAkillType().

help_cache* check_help_cache char *  filename  ) 
 

Check if a help item is in the cache if so return it, else return NULL.

Parameters:
filename What help topic filename to look for, already force to lower case.

Definition at line 237 of file help.c.

References firsthelpcache, helpcache_t::name, and helpcache_t::next.

Referenced by help().

void checkTusers char *   ) 
 

Check total number of users.

Checks the total number of users to see if a change to the network PLUS-L-CHANNEL mode is necessary to take into account a new maximum number of concurrent connections.

Definition at line 122 of file signal.c.

References checkTusers(), mostusers, OperServ, sSend(), and timer().

Referenced by checkTusers(), and parseLine().

int ConnectToServer char *  hostname,
int  portnum
 

Used at services startup to connect to its uplink.

Parameters:
hostname Hostname of uplink
IRC port Returns a file descriptor of a connected socket if successful.

Definition at line 60 of file server.c.

References corelog, flushLogs(), logDump(), and sshutdown().

Referenced by main().

void dumptimer char *  from  ) 
 

Reports the list of timers.

Parameters:
from Nickname that timer list is to be sent to
Causes services to transmit the status of the timer list to the specified nickname.

This is part of the debug command /OPERSERV TIMERS

Definition at line 268 of file timer.c.

References firstTimerItem, t_table::func, t_chain::next, OperServ, and sSend().

void expireChans char *  arg  ) 
 

Channel Expirations

Definition at line 2503 of file chanserv.c.

References CBANISH, ChanServ, CHOLD, delRegChan(), expireChans(), firstRegChan, getChanData(), SLogfile::log(), mostchans, chanlist_struct::reg, saveChanData(), sSend(), and timer().

Referenced by expireChans(), and parseLine().

void expireNicks char *  dummy  ) 
 

This function handles timed NickServ expiration runs, deletes non-held nicknames that have not been used for their maximum inactivity period before expiration.

<

Bug:
FIX ME

Definition at line 2122 of file nickserv.c.

References CTime, mostnicks, NBANISH, and NHOLD.

Referenced by parseLine().

int flagbit char *  name,
const char *  bits[]
 

Parameters:
Get the bit flag number from the name and array of flag names
name Name of the flag to get the bit number of
bits Array of bit names (in bit order)

Definition at line 467 of file stuff.c.

char * flagstring int  flags,
const char *  bits[]
 

Report the names of bits set.

Parameters:
flags Mask of bits from which the names of those set is to be reported
bits Array of strings that represent the names of bits (in order)
The bitmask is converted into a string indicating which flags are present in the string.

Definition at line 441 of file stuff.c.

void flushLogs char *   ) 
 

Flush services logs.

Performs a 'flush' on the log files resulting in any new services log messages being written to disk

Definition at line 103 of file signal.c.

Referenced by flushLogs().

void free_mask MaskData  ) 
 

Frees a mask structure.

Parameters:
mask Mask structure to free

Definition at line 646 of file stuff.c.

References mask().

unsigned char* fromBase64 const char *  cStr,
int *  len
 

Decode from base64 - whole lot easier to decode than to encode

Parameters:
cStr Memory area to read character data from
Precondition:
Stream points to a valid NUL-terminated character array of the ASCII character set that is a valid base-64 encoding of binary data
Returns:
A number of octets binary data as decoded from the input. Allocated from the heap, caller must free.

Definition at line 144 of file passwd.c.

References assert, and oalloc().

Referenced by readChanData(), and readNickData().

char * genHostMask char *  host  ) 
 

Returns the masked version of a host.

Parameters:
host Name of the host to mask

Definition at line 521 of file stuff.c.

References FALSE, tokenEncode(), and TRUE.

Referenced by addUserToChan(), getMiscChanOp(), IpcType::queryRegNickMessage(), and regnick_ugethost().

void handler int  sig  ) 
 

Signal handler.

Bug:
XXXMLG probably not QUITE right

Definition at line 216 of file signal.c.

References coreBuffer, corelog, dlogDump(), logDump(), sSend(), sshutdown(), and timed_akill_queue().

Referenced by main().

void help char *  to,
char *  service,
char **  args,
int  numargs
 

Handle a user's help request.

Parameters:
to User requesting help
service Which service is help being requested of
args args[] array specifying help data to retrieve
numargs Number of arguments in array

Definition at line 101 of file help.c.

References check_help_cache(), helpcache_t::first, firsthelpcache, lasthelpcache, helpline_t::line, helpcache_t::name, helpcache_t::next, helpline_t::next, oalloc(), parse_str(), and sSend().

Referenced by gs_help(), and is_help().

int isAHurt char *  nick,
char *  user,
char *  host
 

Returns TRUE if a user is autohurt.

Parameters:
nick The user's nickname
user The users's username
host The user's hostname
Precondition:
Nick, user, and host each point to separate NUL-terminated character arrays. Respectively, a valid nickname, a valid username, and a valid IRC hostname.

Definition at line 303 of file akill.c.

References A_AHURT, firstBanItem, match(), and akill::next.

Referenced by parseLine().

int isAKilled char *  nick,
char *  user,
char *  host
 

Returns TRUE if a user is akilled.

Parameters:
nick The user's nickname
user The users's username
host The user's hostname
Precondition:
Nick, user, and host each point to separate, valid NUL-terminated character arrays. Nick is a valid IRC nickname, user is a valid IRC username, and host is a valid IRC hostname.

Definition at line 179 of file akill.c.

References A_AKILL, firstBanItem, match(), and akill::next.

Referenced by changeNick().

int isIgnored char *  nick,
char *  user,
char *  host
 

Returns TRUE if a user is ignored.

Parameters:
nick The user's nickname
user The users's username
host The user's hostname
Precondition:
Nick, user, and host each point to separate NUL-terminated character arrays. Respectively, a valid nickname, a valid username, and a valid IRC hostname.

Definition at line 327 of file akill.c.

References A_IGNORE, firstBanItem, match(), and akill::next.

Referenced by parseLine().

int isPasswordAcceptable const char *  password,
char *  reason
 

Is a password acceptable?

This procedure tests whether a password is acceptable or not in terms of technical devices that _need_ to have the password fit into certain ranges.

Definition at line 464 of file passwd.c.

void listAkills char *  from,
char  type
 

Handles an AutoKill/AutoHurt/Ignore/... list request.

Parameters:
from Oper requesting list
type Type of list requested (ie: A_AKILL)
Precondition:
From points to a valid NUL-terminated character array bearing the nickname of an online IRC oper. Type is one of the akill type constants (ex: A_AKILL, A_IGNORE, A_AHURT);

Definition at line 129 of file akill.c.

References firstBanItem, mask(), akill::next, OperServ, and sSend().

void mask char *  user,
char *  host,
int  type,
char *  where
 

This function is used by the NickServ ADDMASK command.

Parameters:
user Username field
host Hostname field
type Prefix username in result with a *? (1 or 0)
The mask function is used to generate a pattern that matches the supplied usermask information at the user@*.domain.com level.

Definition at line 355 of file stuff.c.

Referenced by addAccessMask(), addakill(), autoremoveakill(), banKick(), delAccessMask(), free_mask(), GetCrule(), listAkills(), loadakills(), make_mask(), match(), ns_addmask(), queueakill(), removeAkill(), and removeAkillType().

int match const char *  mask,
const char *  string
 

Matches a string against the specified pattern for wildcards \ as allowed done by IRC clients/servers.

Parameters:
mask Pattern to match against
string String to match

Compare if a given string (name) matches the given mask.

A wildcard match can be made, '*' matches any number of characters and '?' matches any single character.

Additionally, wildcards can be escaped with a preceding \.

return 0, if match 1, if no match

Bug:
match() comes from ircd, it is GPL'ed and services can't be \ distributed while it remains.

Definition at line 129 of file stuff.c.

References mask().

Referenced by addUserToChan(), checkAccess(), checkAkillAllUsers(), do_chanop_list(), GetCruleMatch(), getMiscChanOp(), isAHurt(), isAKilled(), isIgnored(), isQlined(), and UpdateCrule().

void motd char *  to  ) 
 

Print the services message of the day.

Parameters:
to Nick to send the MOTD to
Precondition:
To points to a valid NUL-terminated character array containing the nickname of a user for IRC messages containing the services motd to be sent to.

Definition at line 61 of file help.c.

References mostchans, mostnicks, mostusers, myname, and sSend().

Referenced by parseLine().

void* oalloc size_t  size  ) 
 

Clean and allocate a memory area.

Parameters:
size How many bytes of memory are to be allocated
Allocate n bytes of memory, check that is was properly allocated and clean it. This function is like calloc(), but will shut down services cleanly if it fails to allocate

Definition at line 404 of file stuff.c.

References sshutdown().

Referenced by addakill(), addClone(), addGhost(), addNewUser(), addOpData(), addRegNick(), addUserClone(), addUserToChan(), AppendBuffer(), banKick(), changeNick(), changeNickOnAllChans(), detect_mass(), dlogInit(), fromBase64(), help(), is_postnews(), loadakills(), make_mask(), make_palert(), MakeChannelTrigger(), IpcType::makeMessage(), NewCrule(), IpcType::pollAndHandle(), readChanData(), readInfoData(), readMemoData(), readNickData(), setChanMode(), SetDynBuffer(), setIdentify(), str_dup(), strn_dup(), timer(), and toBase64().

void parse_str char **  args,
int  argc,
int  startarg,
char *  workingstring,
size_t  sz
 

Merge a vector of strings into one string across delimeters.

Parameters:
args Source vector
argc Number of arguments in vector
startarg First item from vector to parse
sz Size of the working buffer Buffer of size IRCBUF to fill parsed buffer into
Takes an array of strings and fills a third single string with their contents, each string separated by a space.

this function is the reverse of the original breakString

Definition at line 318 of file stuff.c.

Referenced by adCheck(), addNewUser(), help(), is_postnews(), and setChanTopic().

void queueakill char *  mask,
char *  setby,
char *  length,
char *  reason,
time_t  time,
int  type,
int  id,
int  added
 

Adds information about an autokill to the body of the kline queue that is periodically mailed to the AKILLMAILTO address.

Parameters:
mask This is the mask of the item to be queued
length This is a string representing the duration
setby This is a string representing the nickname who created the item
reason This is a string representing the reason the entry was created
time This is the time at which the list entry was added (UTC)
type This is the type of entry (A_AKILL, for example)
added If TRUE, then an entry has been added. If FALSE, then an entry has been removed.

Definition at line 536 of file akill.c.

References EmailString::add(), aktype_str(), EmailMessage::body, kline_email, kline_email_nitems, mask(), ops_email, and ops_email_nitems.

Referenced by addakill(), removeAkill(), and removeAkillType().

void readConf void   ) 
 

Reads the services configuration file.

void loadAKills(void); void saveAKills(void);

Definition at line 72 of file conf.c.

References AccessLimit, addOpData(), AkickLimit, ChanLimit, delOpData(), getRegNickData(), ipcPort, myname, mypass, NHOLD, NickLimit, OAKILL, OCBANDEL, OCLONE, OIGNORE, OLIST, ONBANDEL, OPFLAG_DEFAULT, OpLimit, ORAKILL, OREMROOT, OROOT, OSERVOP, OSETFLAG, and sshutdown().

Referenced by main().

int removeAkill char *  from,
char *  mask
 

Handles a user attempting to remove an akill.

Returns:
0 if successful, -1 if failed
Parameters:
from Nicname attempting to remove akill
mask Mask that removal of is attempted
Bug:
This looks ugly

Definition at line 682 of file akill.c.

References A_AHURT, A_AKILL, aktype_str(), cancel_timer(), firstBanItem, getNickData(), mask(), myname, akill::next, OAKILL, OperServ, opFlagged(), queueakill(), and sSend().

Referenced by autoremoveakill().

int removeAkillType char *  from,
char *  mask,
int  type,
int  restrict
 

Handles a user attempting to remove an OperServ banlist item.

Returns:
0 if successful, -1 if failed
Parameters:
from Nicname attempting to remove akill
mask Mask that removal of is attempted
type Type of entry removal is being attempted of (such as A_AKILL)
restrict [UNUSED]
Bug:
You say "If OperServ is removing the kill", but you just strcmp() != 0'ed against OperServ... what's the deal? Oh yeah.. you cancel too, bad comment?

Definition at line 771 of file akill.c.

References A_AHURT, A_AKILL, aktype_str(), cancel_timer(), firstBanItem, getNickData(), mask(), myname, akill::next, OAKILL, OperServ, opFlagged(), queueakill(), and sSend().

void saveakills void   ) 
 

Saves the akill database.

Note that ignores, autohurts, ... are saved as well

Definition at line 867 of file akill.c.

References firstBanItem, akill::next, and saveKlineQueue().

Referenced by sshutdown().

void sendInfoReply UserList nick  ) 
 

Respond to an /INFO message

Parameters:
nick Pointer to online user item

Definition at line 605 of file server.c.

References myname, _userlist::nick, services_info, and sSend().

Referenced by parseLine().

void SetDynBuffer char **  buf,
const char *  newStr
 

Precondition:
From points to a valid NUL-terminated character array, and add is a reference to a character array to be changed.
Postcondition:
*Buf area is reallocated to contain the string specified as 'new'

Definition at line 774 of file stuff.c.

References oalloc().

Referenced by IpcType::authObjMessage(), IpcType::authSysMessage(), freeRegNickListRec(), freeUserListRec(), IpcType::makeMessage(), NickSeeUser(), ns_addmask(), readNickData(), and SetUserNickHostReal().

int split_userhost const char *  input_host,
MaskData data
 

Splits a string into a supplied mask structure.

Parameters:
input_host String to split
data Mask structure to fill and allocate members of

Definition at line 664 of file stuff.c.

References corelog, mask_structure::host, logDump(), mask_structure::nick, str_dup(), strn_dup(), and mask_structure::user.

void sshutdown int  type  ) 
 

Shuts down services.

Parameters:
type specifies type of shutdown (fatal error, normal exit, etc)

Bug:
XXXMLG This needs to be done better... I suggest #defines for the various things we want this function to do (save data, send message, etc) and then use something like: sshutdown(SHUTDOWN_SAVE | SHUTDOWN_MSG, "This is the message");

Definition at line 165 of file signal.c.

References saveakills(), saveInfoData(), saveMemoData(), saveNickData(), sSend(), syncChanData(), timed_akill_queue(), VERSION_NUM, and writeServicesTotals().

Referenced by breakLine(), ConnectToServer(), handler(), main(), oalloc(), parseLine(), readChanData(), readConf(), readInfoData(), readMemoData(), readNickData(), sSend(), and unexpected_eof().

char* str_dup const char *  input  ) 
 

Allocates and returns a copy of the supplied string.

Parameters:
input String to duplicate

Definition at line 597 of file stuff.c.

References oalloc().

Referenced by IpcType::authObjMessage(), IpcType::authSysMessage(), dbWriteString(), is_sendinfo(), MakeChannelTrigger(), and split_userhost().

int timer long  seconds,
void(*  func)(char *),
void *  args
 

Schedules a timer.

Parameters:
seconds How long (in seconds) to wait before executing the function
func A pointer to the function to execute of type void (*)(char *)
args This string is passed to the function when it is executed
This function creates and adds a timer structure to the list saying that the specified function should be executed.

Warning:
The function called by timer is expected to free the string passed to it. This is irregular memory management, however, so the free of that string should be clearly marked so that it can be removed in the future, when this behavior may change. Functions called should also take that change probability into consideration.

Definition at line 125 of file timer.c.

References firstTimerItem, myname, t_chain::next, oalloc(), t_chain::prev, t_chain::run, sSend(), and t_chain::tid.

Referenced by addakill(), addNewUser(), addUserToChan(), annoyNickThief(), changeNick(), checkAkillAllUsers(), checkTusers(), expireChans(), flushLogs(), killide(), loadakills(), main(), parseLine(), sync_cfg(), timed_advert_maint(), and timed_akill_queue().

void timeralarm void   ) 
 

Check for expired timers.

Checks for timers that are expired, runs the specified function on those timers and removes them from the timer list.

Side Effects:
inherits side-effects from any function placed on a timer

Definition at line 236 of file timer.c.

References t_chain::args, firstTimerItem, t_chain::func, t_chain::next, t_chain::prev, and t_chain::run.

Referenced by main().

unsigned char* toBase64 const unsigned char *  stream,
size_t  left
 

Encode in base64 - finally got this working, I hope. -Mysid

Parameters:
stream Memory area to read character data from
left Size of the memory area in bytes
Precondition:
Stream points to a valid (data-octet-bearing) character array of size 'left' or higher.
Returns:
A base64-encoded version of binary data read from `stream' up to `left' octets. The version returned will have been allocated from the heap. Freeing it is the caller's responsibility.

Definition at line 42 of file passwd.c.

References assert, and oalloc().

Referenced by PrintPass(), saveChanData(), and saveNickData().

char * xorit char *  tocrypt  ) 
 

Encrypt a password string.

Parameters:
tocrypt String to encrypt in place
Code passwords before writing them to services' database - this measure allows roots to examine the structure of the services database and search for corruption without having passwords that they don't need or want to see shown to them.

Definition at line 286 of file stuff.c.

References strncpyzt.

Referenced by readChanData(), readNickData(), saveChanData(), and saveNickData().


Generated at Sat Oct 25 20:56:12 2003 for Services using Doxygen.
Services Copyr. 1996-2001 Chip Norkus, Max Byrd, Greg Poma, Michael Graff, James Hess, Dafydd James. All rights reserved See LICENSE for licensing information.