#include "copyright.h"
#include "autoconf.h"
#include "config.h"
#include "externs.h"
#include "attrs.h"
#include "command.h"
#include "interface.h"
Include dependency graph for conf.cpp:
Go to the source code of this file.
Data Structures | |
struct | confparm |
struct | DECODEIPV4 |
Typedefs | |
typedef confparm | CONF |
Functions | |
void | cf_init (void) |
void | cf_log_notfound (dbref player, char *cmd, const char *thingname, char *thing) |
void DCL_CDECL | cf_log_syntax (dbref player, char *cmd, const char *fmt,...) |
static int | cf_status_from_succfail (dbref player, char *cmd, int success, int failure) |
static | CF_HAND (cf_int_array) |
static | CF_HAND (cf_int) |
static | CF_HAND (cf_dbref) |
static | CF_HAND (cf_seconds) |
static | CF_HAND (cf_bool) |
static | CF_HAND (cf_option) |
static | CF_HAND (cf_string) |
static | CF_HAND (cf_string_dyn) |
static | CF_HAND (cf_alias) |
static | CF_HAND (cf_flagalias) |
static | CF_HAND (cf_poweralias) |
CF_HAND (cf_modify_bits) | |
static | CF_HAND (cf_set_flags) |
static | CF_HAND (cf_badname) |
static bool | DecodeN (int nType, size_t len, const char *p, in_addr_t *pu32) |
static bool | MakeCanonicalIPv4 (const char *str, in_addr_t *pnIP) |
static bool | isValidSubnetMask (in_addr_t ulMask) |
static | CF_HAND (cf_site) |
static int | add_helpfile (dbref player, char *cmd, char *str, bool bRaw) |
static | CF_HAND (cf_helpfile) |
static | CF_HAND (cf_raw_helpfile) |
static | CF_HAND (cf_hook) |
static | CF_HAND (cf_include) |
CF_HAND (cf_cf_access) | |
int | cf_set (char *cp, char *ap, dbref player) |
void | ValidateConfigurationDbrefs (void) |
void | do_admin (dbref executor, dbref caller, dbref enactor, int extra, int nargs, char *kw, char *value) |
int | cf_read (void) |
void | list_cf_access (dbref player) |
void | cf_display (dbref player, char *param_name, char *buff, char **bufc) |
void | cf_list (dbref player, char *buff, char **bufc) |
Variables | |
CONFDATA | mudconf |
STATEDATA | mudstate |
static NAMETAB | bool_names [] |
static NAMETAB | hook_names [] |
static CONF | conftable [] |
struct { | |
char ** pFilename | |
char * pSuffix | |
} | DefaultSuffixes [] |
static int add_helpfile | ( | dbref | player, | |
char * | cmd, | |||
char * | str, | |||
bool | bRaw | |||
) | [static] |
Definition at line 1435 of file conf.cpp.
References statedata::aHelpDesc, HELP_DESC::bEval, CA_PUBLIC, CMDENT_ONE_ARG::callseq, cf_log_syntax(), CMDENT_ONE_ARG::cmdname, statedata::command_htab, HELP_DESC::CommandName, CS_ONE_ARG, do_help(), CMDENT_ONE_ARG::extra, CMDENT_ONE_ARG::handler, hashaddLEN(), hashdeleteLEN(), CMDENT_ONE_ARG::hookmask, HELP_DESC::ht, ISOUTOFMEMORY, MEMALLOC, MEMFREE, statedata::mHelpDesc, mudstate, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), statedata::nHelpDesc, HELP_DESC::pBaseFilename, CMDENT_ONE_ARG::perms, SBUF_SIZE, StringClone(), CMDENT_ONE_ARG::switches, and tprintf().
Referenced by CF_HAND().
01436 { 01437 // Parse the two arguments. 01438 // 01439 MUX_STRTOK_STATE tts; 01440 mux_strtok_src(&tts, str); 01441 mux_strtok_ctl(&tts, " \t\n\r"); 01442 01443 char *pCmdName = mux_strtok_parse(&tts); 01444 char *pBase = mux_strtok_parse(&tts); 01445 if (pBase == NULL) 01446 { 01447 cf_log_syntax(player, cmd, "Missing path for helpfile %s", pCmdName); 01448 return -1; 01449 } 01450 if ( pCmdName[0] == '_' 01451 && pCmdName[1] == '_') 01452 { 01453 cf_log_syntax(player, cmd, 01454 "Helpfile %s would conflict with the use of @addcommand.", 01455 pCmdName); 01456 return -1; 01457 } 01458 if (SBUF_SIZE <= strlen(pBase)) 01459 { 01460 cf_log_syntax(player, cmd, "Helpfile '%s' filename too long", pBase); 01461 return -1; 01462 } 01463 01464 // Allocate an empty place in the table of help file hashes. 01465 // 01466 if (mudstate.aHelpDesc == NULL) 01467 { 01468 mudstate.mHelpDesc = 4; 01469 mudstate.nHelpDesc = 0; 01470 mudstate.aHelpDesc = (HELP_DESC *)MEMALLOC(sizeof(HELP_DESC) 01471 *mudstate.mHelpDesc); 01472 ISOUTOFMEMORY(mudstate.aHelpDesc); 01473 } 01474 else if (mudstate.mHelpDesc <= mudstate.nHelpDesc) 01475 { 01476 int newsize = mudstate.mHelpDesc + 4; 01477 HELP_DESC *q = (HELP_DESC *)MEMALLOC(sizeof(HELP_DESC)*newsize); 01478 ISOUTOFMEMORY(q); 01479 memset(q, 0, sizeof(HELP_DESC)*newsize); 01480 memcpy(q, mudstate.aHelpDesc, sizeof(HELP_DESC)*mudstate.mHelpDesc); 01481 MEMFREE(mudstate.aHelpDesc); 01482 mudstate.aHelpDesc = q; 01483 mudstate.mHelpDesc = newsize; 01484 } 01485 01486 // Build HELP_DESC 01487 // 01488 HELP_DESC *pDesc = mudstate.aHelpDesc + mudstate.nHelpDesc; 01489 pDesc->CommandName = StringClone(pCmdName); 01490 pDesc->ht = NULL; 01491 pDesc->pBaseFilename = StringClone(pBase); 01492 pDesc->bEval = !bRaw; 01493 01494 // Build up Command Entry. 01495 // 01496 CMDENT_ONE_ARG *cmdp = (CMDENT_ONE_ARG *)MEMALLOC(sizeof(CMDENT_ONE_ARG)); 01497 ISOUTOFMEMORY(cmdp); 01498 01499 cmdp->callseq = CS_ONE_ARG; 01500 cmdp->cmdname = StringClone(pCmdName); 01501 cmdp->extra = mudstate.nHelpDesc; 01502 cmdp->handler = do_help; 01503 cmdp->hookmask = 0; 01504 cmdp->perms = CA_PUBLIC; 01505 cmdp->switches = NULL; 01506 01507 // TODO: If a command is deleted with one or both of the two 01508 // hashdeleteLEN() calls below, what guarantee do we have that parts of 01509 // the command weren't dynamically allocated. This might leak memory. 01510 // 01511 char *p = cmdp->cmdname; 01512 hashdeleteLEN(p, strlen(p), &mudstate.command_htab); 01513 hashaddLEN(p, strlen(p), cmdp, &mudstate.command_htab); 01514 01515 p = tprintf("__%s", cmdp->cmdname); 01516 hashdeleteLEN(p, strlen(p), &mudstate.command_htab); 01517 hashaddLEN(p, strlen(p), cmdp, &mudstate.command_htab); 01518 01519 mudstate.nHelpDesc++; 01520 01521 return 0; 01522 }
void cf_display | ( | dbref | player, | |
char * | param_name, | |||
char * | buff, | |||
char ** | bufc | |||
) |
Definition at line 2174 of file conf.cpp.
References check_access(), conftable, confparm::interpreter, confparm::loc, mux_stricmp(), confparm::pname, confparm::rperms, safe_chr, and safe_ltoa().
Referenced by FUNCTION().
02175 { 02176 CONF *tp; 02177 02178 for (tp = conftable; tp->pname; tp++) 02179 { 02180 if (!mux_stricmp(tp->pname, param_name)) 02181 { 02182 if (check_access(player, tp->rperms)) 02183 { 02184 if (tp->interpreter == cf_int) 02185 { 02186 safe_ltoa(*(tp->loc), buff, bufc); 02187 return; 02188 } 02189 else if (tp->interpreter == cf_dbref) 02190 { 02191 safe_chr('#', buff, bufc); 02192 safe_ltoa(*(tp->loc), buff, bufc); 02193 return; 02194 } 02195 else if (tp->interpreter == cf_bool) 02196 { 02197 bool *pb = (bool *)tp->loc; 02198 safe_bool(*pb, buff, bufc); 02199 return; 02200 } 02201 else if (tp->interpreter == cf_string) 02202 { 02203 safe_str((char *)tp->loc, buff, bufc); 02204 return; 02205 } 02206 else if (tp->interpreter == cf_string_dyn) 02207 { 02208 safe_str(*(char **)tp->loc, buff, bufc); 02209 return; 02210 } 02211 else if (tp->interpreter == cf_int_array) 02212 { 02213 IntArray *pia = (IntArray *)(tp->loc); 02214 ITL itl; 02215 ItemToList_Init(&itl, buff, bufc); 02216 for (int i = 0; i < pia->n; i++) 02217 { 02218 if (!ItemToList_AddInteger(&itl, pia->pi[i])) 02219 { 02220 break; 02221 } 02222 } 02223 ItemToList_Final(&itl); 02224 return; 02225 } 02226 else if (tp->interpreter == cf_seconds) 02227 { 02228 CLinearTimeDelta *pltd = (CLinearTimeDelta *)(tp->loc); 02229 safe_str(pltd->ReturnSecondsString(7), buff, bufc); 02230 return; 02231 } 02232 } 02233 safe_noperm(buff, bufc); 02234 return; 02235 } 02236 } 02237 safe_nomatch(buff, bufc); 02238 }
CF_HAND | ( | cf_cf_access | ) |
Definition at line 1940 of file conf.cpp.
01941 { 01942 UNUSED_PARAMETER(vp); 01943 01944 CONF *tp; 01945 char *ap; 01946 01947 for (ap = str; *ap && !mux_isspace(*ap); ap++) 01948 { 01949 ; // Nothing 01950 } 01951 if (*ap) 01952 { 01953 *ap++ = '\0'; 01954 } 01955 01956 for (tp = conftable; tp->pname; tp++) 01957 { 01958 if (!strcmp(tp->pname, str)) 01959 { 01960 // Cannot modify parameters set CA_STATIC. 01961 // 01962 if ( tp->flags & CA_STATIC 01963 && !mudstate.bReadingConfiguration) 01964 { 01965 notify(player, NOPERM_MESSAGE); 01966 STARTLOG(LOG_CONFIGMODS, "CFG", "PERM"); 01967 log_name(player); 01968 log_text(" tried to change access to static param: "); 01969 log_text(tp->pname); 01970 ENDLOG; 01971 return -1; 01972 } 01973 return cf_modify_bits(&tp->flags, ap, pExtra, nExtra, player, cmd); 01974 } 01975 } 01976 cf_log_notfound(player, cmd, "Config directive", str); 01977 return -1; 01978 }
static CF_HAND | ( | cf_include | ) | [static] |
Definition at line 1620 of file conf.cpp.
References alloc_lbuf, statedata::bReadingConfiguration, cf_log_notfound(), cf_set(), DebugTotalFiles, free_lbuf, LBUF_SIZE, mudstate, mux_isdigit, mux_isspace, and UNUSED_PARAMETER.
01621 { 01622 UNUSED_PARAMETER(vp); 01623 UNUSED_PARAMETER(pExtra); 01624 UNUSED_PARAMETER(nExtra); 01625 01626 if (!mudstate.bReadingConfiguration) 01627 { 01628 return -1; 01629 } 01630 01631 FILE *fp = fopen(str, "rb"); 01632 if (fp == NULL) 01633 { 01634 cf_log_notfound(player, cmd, "Config file", str); 01635 return -1; 01636 } 01637 DebugTotalFiles++; 01638 01639 char *buf = alloc_lbuf("cf_include"); 01640 fgets(buf, LBUF_SIZE, fp); 01641 while (!feof(fp)) 01642 { 01643 char *zp = buf; 01644 01645 // Remove comments. Anything after the '#' is a comment except if it 01646 // matches: whitespace + '#' + digit. 01647 // 01648 while (*zp != '\0') 01649 { 01650 if ( *zp == '#' 01651 && ( zp <= buf 01652 || !mux_isspace(zp[-1]) 01653 || !mux_isdigit(zp[1]))) 01654 { 01655 // Found a comment. 01656 // 01657 *zp = '\0'; 01658 } 01659 else 01660 { 01661 zp++; 01662 } 01663 } 01664 01665 // Trim trailing spaces. 01666 // 01667 while ( buf < zp 01668 && mux_isspace(zp[-1])) 01669 { 01670 *(--zp) = '\0'; 01671 } 01672 01673 // Process line. 01674 // 01675 char *cp = buf; 01676 01677 // Trim leading spaces. 01678 // 01679 while (mux_isspace(*cp)) 01680 { 01681 cp++; 01682 } 01683 01684 // Skip over command. 01685 // 01686 char *ap; 01687 for (ap = cp; *ap && !mux_isspace(*ap); ap++) 01688 { 01689 ; // Nothing. 01690 } 01691 01692 // Terminate command. 01693 // 01694 if (*ap) 01695 { 01696 *ap++ = '\0'; 01697 } 01698 01699 // Skip spaces between command and argument. 01700 // 01701 while (mux_isspace(*ap)) 01702 { 01703 ap++; 01704 } 01705 01706 if (*cp) 01707 { 01708 cf_set(cp, ap, player); 01709 } 01710 fgets(buf, LBUF_SIZE, fp); 01711 } 01712 free_lbuf(buf); 01713 if (fclose(fp) == 0) 01714 { 01715 DebugTotalFiles--; 01716 } 01717 return 0; 01718 }
static CF_HAND | ( | cf_hook | ) | [static] |
Definition at line 1558 of file conf.cpp.
References statedata::command_htab, GOD, hashfindLEN(), hook_names, CMDENT::hookmask, mudstate, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), search_nametab(), and UNUSED_PARAMETER.
01559 { 01560 UNUSED_PARAMETER(pExtra); 01561 UNUSED_PARAMETER(nExtra); 01562 UNUSED_PARAMETER(player); 01563 UNUSED_PARAMETER(cmd); 01564 01565 char *hookcmd, *hookptr, playbuff[201]; 01566 int hookflg; 01567 CMDENT *cmdp; 01568 01569 int retval = -1; 01570 memset(playbuff, '\0', sizeof(playbuff)); 01571 strncpy(playbuff, str, 200); 01572 MUX_STRTOK_STATE tts; 01573 mux_strtok_src(&tts, playbuff); 01574 mux_strtok_ctl(&tts, " \t"); 01575 hookcmd = mux_strtok_parse(&tts); 01576 if (hookcmd != NULL) 01577 { 01578 cmdp = (CMDENT *)hashfindLEN(hookcmd, strlen(hookcmd), &mudstate.command_htab); 01579 } 01580 else 01581 { 01582 return retval; 01583 } 01584 if (!cmdp) 01585 { 01586 return retval; 01587 } 01588 01589 *vp = cmdp->hookmask; 01590 strncpy(playbuff, str, 200); 01591 hookptr = mux_strtok_parse(&tts); 01592 while (hookptr != NULL) 01593 { 01594 if ( hookptr[0] == '!' 01595 && hookptr[1] != '\0') 01596 { 01597 if (search_nametab(GOD, hook_names, hookptr+1, &hookflg)) 01598 { 01599 retval = 0; 01600 *vp = *vp & ~hookflg; 01601 } 01602 } 01603 else 01604 { 01605 if (search_nametab(GOD, hook_names, hookptr, &hookflg)) 01606 { 01607 retval = 0; 01608 *vp = *vp | hookflg; 01609 } 01610 } 01611 hookptr = mux_strtok_parse(&tts); 01612 } 01613 cmdp->hookmask = *vp; 01614 return retval; 01615 }
static CF_HAND | ( | cf_raw_helpfile | ) | [static] |
Definition at line 1533 of file conf.cpp.
References add_helpfile(), and UNUSED_PARAMETER.
01534 { 01535 UNUSED_PARAMETER(vp); 01536 UNUSED_PARAMETER(pExtra); 01537 UNUSED_PARAMETER(nExtra); 01538 01539 return add_helpfile(player, cmd, str, true); 01540 }
static CF_HAND | ( | cf_helpfile | ) | [static] |
Definition at line 1524 of file conf.cpp.
References add_helpfile(), and UNUSED_PARAMETER.
01525 { 01526 UNUSED_PARAMETER(vp); 01527 UNUSED_PARAMETER(pExtra); 01528 UNUSED_PARAMETER(nExtra); 01529 01530 return add_helpfile(player, cmd, str, false); 01531 }
static CF_HAND | ( | cf_site | ) | [static] |
Definition at line 1302 of file conf.cpp.
References site_data::address, statedata::bReadingConfiguration, cf_log_syntax(), site_data::flag, is_integer(), ISOUTOFMEMORY, isValidSubnetMask(), MakeCanonicalIPv4(), site_data::mask, MEMALLOC, mudstate, mux_atol(), mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), site_data::next, and UNUSED_PARAMETER.
01303 { 01304 UNUSED_PARAMETER(pExtra); 01305 01306 SITE **ppv = (SITE **)vp; 01307 struct in_addr addr_num, mask_num; 01308 in_addr_t ulMask, ulNetBits; 01309 01310 char *addr_txt; 01311 char *mask_txt = strchr(str, '/'); 01312 if (!mask_txt) 01313 { 01314 // Standard IP range and netmask notation. 01315 // 01316 MUX_STRTOK_STATE tts; 01317 mux_strtok_src(&tts, str); 01318 mux_strtok_ctl(&tts, " \t=,"); 01319 addr_txt = mux_strtok_parse(&tts); 01320 mask_txt = NULL; 01321 if (addr_txt) 01322 { 01323 mask_txt = mux_strtok_parse(&tts); 01324 } 01325 if (!addr_txt || !*addr_txt || !mask_txt || !*mask_txt) 01326 { 01327 cf_log_syntax(player, cmd, "Missing host address or mask.", ""); 01328 return -1; 01329 } 01330 if ( !MakeCanonicalIPv4(mask_txt, &ulNetBits) 01331 || !isValidSubnetMask(ulMask = ntohl(ulNetBits))) 01332 { 01333 cf_log_syntax(player, cmd, "Malformed mask address: %s", mask_txt); 01334 return -1; 01335 } 01336 mask_num.s_addr = ulNetBits; 01337 } 01338 else 01339 { 01340 // RFC 1517, 1518, 1519, 1520: CIDR IP prefix notation 01341 // 01342 addr_txt = str; 01343 *mask_txt++ = '\0'; 01344 if (!is_integer(mask_txt, NULL)) 01345 { 01346 cf_log_syntax(player, cmd, "Mask field (%s) in CIDR IP prefix is not numeric.", mask_txt); 01347 return -1; 01348 } 01349 int mask_bits = mux_atol(mask_txt); 01350 if ( mask_bits < 0 01351 || 32 < mask_bits) 01352 { 01353 cf_log_syntax(player, cmd, "Mask bits (%d) in CIDR IP prefix out of range.", mask_bits); 01354 return -1; 01355 } 01356 else 01357 { 01358 // << [0,31] works. << 32 is problematic on some systems. 01359 // 01360 ulMask = 0; 01361 if (mask_bits > 0) 01362 { 01363 ulMask = (0xFFFFFFFFUL << (32 - mask_bits)) & 0xFFFFFFFFUL; 01364 } 01365 mask_num.s_addr = htonl(ulMask); 01366 } 01367 } 01368 if (!MakeCanonicalIPv4(addr_txt, &ulNetBits)) 01369 { 01370 cf_log_syntax(player, cmd, "Malformed host address: %s", addr_txt); 01371 return -1; 01372 } 01373 addr_num.s_addr = ulNetBits; 01374 in_addr_t ulAddr = ntohl(addr_num.s_addr); 01375 01376 if (ulAddr & ~ulMask) 01377 { 01378 // The given subnet address contains 'one' bits which are outside 01379 // the given subnet mask. If we don't clear these bits, they will 01380 // interfere with the subnet tests in site_check. The subnet spec 01381 // would be defunct and useless. 01382 // 01383 cf_log_syntax(player, cmd, "Non-zero host address bits outside the subnet mask (fixed): %s %s", addr_txt, mask_txt); 01384 ulAddr &= ulMask; 01385 addr_num.s_addr = htonl(ulAddr); 01386 } 01387 01388 SITE *head = *ppv; 01389 01390 // Parse the access entry and allocate space for it. 01391 // 01392 SITE *site = (SITE *)MEMALLOC(sizeof(SITE)); 01393 ISOUTOFMEMORY(site); 01394 01395 // Initialize the site entry. 01396 // 01397 site->address.s_addr = addr_num.s_addr; 01398 site->mask.s_addr = mask_num.s_addr; 01399 site->flag = nExtra; 01400 site->next = NULL; 01401 01402 // Link in the entry. Link it at the start if not initializing, at the 01403 // end if initializing. This is so that entries in the config file are 01404 // processed as you would think they would be, while entries made while 01405 // running are processed first. 01406 // 01407 if (mudstate.bReadingConfiguration) 01408 { 01409 if (head == NULL) 01410 { 01411 *ppv = site; 01412 } 01413 else 01414 { 01415 SITE *last; 01416 for (last = head; last->next; last = last->next) 01417 { 01418 // Nothing 01419 } 01420 last->next = site; 01421 } 01422 } 01423 else 01424 { 01425 site->next = head; 01426 *ppv = site; 01427 } 01428 return 0; 01429 }
static CF_HAND | ( | cf_badname | ) | [static] |
Definition at line 1033 of file conf.cpp.
References badname_add(), badname_remove(), and UNUSED_PARAMETER.
01034 { 01035 UNUSED_PARAMETER(vp); 01036 UNUSED_PARAMETER(pExtra); 01037 UNUSED_PARAMETER(player); 01038 UNUSED_PARAMETER(cmd); 01039 01040 if (nExtra) 01041 { 01042 badname_remove(str); 01043 } 01044 else 01045 { 01046 badname_add(str); 01047 } 01048 return 0; 01049 }
static CF_HAND | ( | cf_set_flags | ) | [static] |
Definition at line 955 of file conf.cpp.
References flag_name_entry::bPositive, cf_log_notfound(), flag_name_entry::fbe, FLAG_WORD1, FLAG_WORD3, flag_bit_entry::flagflag, statedata::flags_htab, flag_bit_entry::flagvalue, hashfindLEN(), MakeCanonicalFlagName(), mudstate, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), and UNUSED_PARAMETER.
00956 { 00957 UNUSED_PARAMETER(pExtra); 00958 UNUSED_PARAMETER(nExtra); 00959 00960 int success, failure; 00961 00962 // Walk through the tokens. 00963 // 00964 success = failure = 0; 00965 MUX_STRTOK_STATE tts; 00966 mux_strtok_src(&tts, str); 00967 mux_strtok_ctl(&tts, " \t"); 00968 char *sp = mux_strtok_parse(&tts); 00969 FLAGSET *fset = (FLAGSET *) vp; 00970 00971 while (sp != NULL) 00972 { 00973 // Canonical Flag Name. 00974 // 00975 int nName; 00976 bool bValid; 00977 char *pName = MakeCanonicalFlagName(sp, &nName, &bValid); 00978 FLAGNAMEENT *fp = NULL; 00979 if (bValid) 00980 { 00981 fp = (FLAGNAMEENT *)hashfindLEN(pName, nName, &mudstate.flags_htab); 00982 } 00983 if (fp != NULL) 00984 { 00985 // Set the appropriate bit. 00986 // 00987 if (success == 0) 00988 { 00989 for (int i = FLAG_WORD1; i <= FLAG_WORD3; i++) 00990 { 00991 (*fset).word[i] = 0; 00992 } 00993 } 00994 FLAGBITENT *fbe = fp->fbe; 00995 if (fp->bPositive) 00996 { 00997 (*fset).word[fbe->flagflag] |= fbe->flagvalue; 00998 } 00999 else 01000 { 01001 (*fset).word[fbe->flagflag] &= ~(fbe->flagvalue); 01002 } 01003 success++; 01004 } 01005 else 01006 { 01007 cf_log_notfound(player, cmd, "Entry", sp); 01008 failure++; 01009 } 01010 01011 // Get the next token 01012 // 01013 sp = mux_strtok_parse(&tts); 01014 } 01015 if ((success == 0) && (failure == 0)) 01016 { 01017 for (int i = FLAG_WORD1; i <= FLAG_WORD3; i++) 01018 { 01019 (*fset).word[i] = 0; 01020 } 01021 return 0; 01022 } 01023 if (success > 0) 01024 { 01025 return ((failure == 0) ? 0 : 1); 01026 } 01027 return -1; 01028 }
CF_HAND | ( | cf_modify_bits | ) |
Definition at line 862 of file conf.cpp.
References cf_log_notfound(), cf_status_from_succfail(), GOD, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), search_nametab(), and UNUSED_PARAMETER.
00863 { 00864 UNUSED_PARAMETER(nExtra); 00865 00866 int f, success, failure; 00867 bool negate; 00868 00869 // Walk through the tokens. 00870 // 00871 success = failure = 0; 00872 MUX_STRTOK_STATE tts; 00873 mux_strtok_src(&tts, str); 00874 mux_strtok_ctl(&tts, " \t"); 00875 char *sp = mux_strtok_parse(&tts); 00876 while (sp != NULL) 00877 { 00878 // Check for negation. 00879 // 00880 negate = false; 00881 if (*sp == '!') 00882 { 00883 negate = true; 00884 sp++; 00885 } 00886 00887 // Set or clear the appropriate bit. 00888 // 00889 if (search_nametab(GOD, (NAMETAB *)pExtra, sp, &f)) 00890 { 00891 if (negate) 00892 *vp &= ~f; 00893 else 00894 *vp |= f; 00895 success++; 00896 } 00897 else 00898 { 00899 cf_log_notfound(player, cmd, "Entry", sp); 00900 failure++; 00901 } 00902 00903 // Get the next token. 00904 // 00905 sp = mux_strtok_parse(&tts); 00906 } 00907 return cf_status_from_succfail(player, cmd, success, failure); 00908 }
static CF_HAND | ( | cf_poweralias | ) | [static] |
Definition at line 782 of file conf.cpp.
References cf_log_notfound(), hashaddLEN(), hashfindLEN(), MakeCanonicalFlagName(), mudstate, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), statedata::powers_htab, and UNUSED_PARAMETER.
00783 { 00784 UNUSED_PARAMETER(vp); 00785 UNUSED_PARAMETER(pExtra); 00786 UNUSED_PARAMETER(nExtra); 00787 00788 MUX_STRTOK_STATE tts; 00789 mux_strtok_src(&tts, str); 00790 mux_strtok_ctl(&tts, " \t=,"); 00791 char *alias = mux_strtok_parse(&tts); 00792 char *orig = mux_strtok_parse(&tts); 00793 00794 bool success = false; 00795 int nName; 00796 bool bValid; 00797 void *cp; 00798 char *pName = MakeCanonicalFlagName(orig, &nName, &bValid); 00799 if (bValid) 00800 { 00801 cp = hashfindLEN(pName, nName, &mudstate.powers_htab); 00802 if (cp) 00803 { 00804 pName = MakeCanonicalFlagName(alias, &nName, &bValid); 00805 if (bValid) 00806 { 00807 hashaddLEN(pName, nName, cp, &mudstate.powers_htab); 00808 success = true; 00809 } 00810 } 00811 } 00812 if (!success) 00813 { 00814 cf_log_notfound(player, cmd, "Power", orig); 00815 } 00816 return (success ? 0 : -1); 00817 }
static CF_HAND | ( | cf_flagalias | ) | [static] |
Definition at line 739 of file conf.cpp.
References cf_log_notfound(), statedata::flags_htab, hashaddLEN(), hashfindLEN(), MakeCanonicalFlagName(), mudstate, mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), and UNUSED_PARAMETER.
00740 { 00741 UNUSED_PARAMETER(vp); 00742 UNUSED_PARAMETER(pExtra); 00743 UNUSED_PARAMETER(nExtra); 00744 00745 MUX_STRTOK_STATE tts; 00746 mux_strtok_src(&tts, str); 00747 mux_strtok_ctl(&tts, " \t=,"); 00748 char *alias = mux_strtok_parse(&tts); 00749 char *orig = mux_strtok_parse(&tts); 00750 00751 bool success = false; 00752 int nName; 00753 bool bValid; 00754 void *cp; 00755 char *pName = MakeCanonicalFlagName(orig, &nName, &bValid); 00756 if (bValid) 00757 { 00758 cp = hashfindLEN(pName, nName, &mudstate.flags_htab); 00759 if (cp) 00760 { 00761 pName = MakeCanonicalFlagName(alias, &nName, &bValid); 00762 if (bValid) 00763 { 00764 if (!hashfindLEN(pName, nName, &mudstate.flags_htab)) 00765 { 00766 hashaddLEN(pName, nName, cp, &mudstate.flags_htab); 00767 success = true; 00768 } 00769 } 00770 } 00771 } 00772 if (!success) 00773 { 00774 cf_log_notfound(player, cmd, "Flag", orig); 00775 } 00776 return (success ? 0 : -1); 00777 }
static CF_HAND | ( | cf_alias | ) | [static] |
Definition at line 702 of file conf.cpp.
References cf_log_notfound(), hashaddLEN(), hashfindLEN(), mux_strlwr(), mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), mux_strupr(), and UNUSED_PARAMETER.
00703 { 00704 UNUSED_PARAMETER(pExtra); 00705 UNUSED_PARAMETER(nExtra); 00706 00707 MUX_STRTOK_STATE tts; 00708 mux_strtok_src(&tts, str); 00709 mux_strtok_ctl(&tts, " \t=,"); 00710 char *alias = mux_strtok_parse(&tts); 00711 char *orig = mux_strtok_parse(&tts); 00712 00713 if (orig) 00714 { 00715 mux_strlwr(orig); 00716 void *cp = hashfindLEN(orig, strlen(orig), (CHashTable *) vp); 00717 if (cp == NULL) 00718 { 00719 mux_strupr(orig); 00720 cp = hashfindLEN(orig, strlen(orig), (CHashTable *) vp); 00721 if (cp == NULL) 00722 { 00723 cf_log_notfound(player, cmd, "Entry", orig); 00724 return -1; 00725 } 00726 } 00727 if (!hashfindLEN(alias, strlen(alias), (CHashTable *) vp)) 00728 { 00729 hashaddLEN(alias, strlen(alias), cp, (CHashTable *) vp); 00730 } 00731 return 0; 00732 } 00733 return -1; 00734 }
static CF_HAND | ( | cf_string_dyn | ) | [static] |
Definition at line 660 of file conf.cpp.
References statedata::bReadingConfiguration, ENDLOG, Log, LOG_STARTUP, MEMFREE, mudstate, notify, STARTLOG, StringCloneLen(), CLogFile::tinyprintf(), and UNUSED_PARAMETER.
00661 { 00662 UNUSED_PARAMETER(pExtra); 00663 00664 char **ppc = (char **)vp; 00665 00666 // Allocate memory for buffer and copy string to it. If nExtra is non-zero, 00667 // then there is a size limitation as well. 00668 // 00669 int retval = 0; 00670 unsigned int nStr = strlen(str); 00671 if (nExtra && nStr >= nExtra) 00672 { 00673 nStr = nExtra - 1; 00674 if (mudstate.bReadingConfiguration) 00675 { 00676 STARTLOG(LOG_STARTUP, "CNF", "NFND"); 00677 Log.tinyprintf("%s: String truncated", cmd); 00678 ENDLOG; 00679 } 00680 else 00681 { 00682 notify(player, "String truncated"); 00683 } 00684 retval = 1; 00685 } 00686 char *confbuff = StringCloneLen(str, nStr); 00687 00688 // Free previous memory for buffer. 00689 // 00690 if (*ppc != NULL) 00691 { 00692 MEMFREE(*ppc); 00693 } 00694 *ppc = confbuff; 00695 00696 return retval; 00697 }
static CF_HAND | ( | cf_string | ) | [static] |
Definition at line 595 of file conf.cpp.
References alloc_sbuf, statedata::bReadingConfiguration, ENDLOG, free_sbuf, Log, LOG_STARTUP, confdata::mud_name, mudconf, mudstate, mux_isalnum, notify, SBUF_SIZE, CLogFile::SetPrefix(), STARTLOG, strip_ansi(), CLogFile::tinyprintf(), and UNUSED_PARAMETER.
00596 { 00597 UNUSED_PARAMETER(pExtra); 00598 00599 char *pc = (char *)vp; 00600 00601 // The following should never happen because extra is always a non-zero 00602 // constant in the config table. 00603 // 00604 if (nExtra <= 0) 00605 { 00606 return 1; 00607 } 00608 00609 // Copy the string to the buffer if it is not too big. 00610 // 00611 int retval = 0; 00612 unsigned int nStr = strlen(str); 00613 if (nStr >= nExtra) 00614 { 00615 nStr = nExtra - 1; 00616 if (mudstate.bReadingConfiguration) 00617 { 00618 STARTLOG(LOG_STARTUP, "CNF", "NFND"); 00619 Log.tinyprintf("%s: String truncated", cmd); 00620 ENDLOG; 00621 } 00622 else 00623 { 00624 notify(player, "String truncated"); 00625 } 00626 retval = 1; 00627 } 00628 memcpy(pc, str, nStr+1); 00629 pc[nStr] = '\0'; 00630 00631 if (pc == mudconf.mud_name) 00632 { 00633 // We are changing the name of the MUD. Form a prefix from the 00634 // mudname and let the logger know. 00635 // 00636 char *buff = alloc_sbuf("cf_string.prefix"); 00637 char *p = buff; 00638 char *q = strip_ansi(mudconf.mud_name); 00639 size_t nLen = 0; 00640 while ( *q 00641 && nLen < SBUF_SIZE) 00642 { 00643 if (mux_isalnum(*q)) 00644 { 00645 *p++ = *q; 00646 nLen++; 00647 } 00648 q++; 00649 } 00650 *p = '\0'; 00651 Log.SetPrefix(buff); 00652 free_sbuf(buff); 00653 } 00654 return retval; 00655 }
static CF_HAND | ( | cf_option | ) | [static] |
Definition at line 578 of file conf.cpp.
References cf_log_notfound(), GOD, search_nametab(), and UNUSED_PARAMETER.
00579 { 00580 UNUSED_PARAMETER(nExtra); 00581 00582 int i; 00583 if (!search_nametab(GOD, (NAMETAB *)pExtra, str, &i)) 00584 { 00585 cf_log_notfound(player, cmd, "Value", str); 00586 return -1; 00587 } 00588 *vp = i; 00589 return 0; 00590 }
static CF_HAND | ( | cf_bool | ) | [static] |
Definition at line 559 of file conf.cpp.
References bool_names, cf_log_notfound(), GOD, isTRUE, search_nametab(), and UNUSED_PARAMETER.
00560 { 00561 UNUSED_PARAMETER(pExtra); 00562 UNUSED_PARAMETER(nExtra); 00563 00564 int i; 00565 if (!search_nametab(GOD, bool_names, str, &i)) 00566 { 00567 cf_log_notfound(player, cmd, "Value", str); 00568 return -1; 00569 } 00570 bool *pb = (bool *)vp; 00571 *pb = isTRUE(i); 00572 return 0; 00573 }
static CF_HAND | ( | cf_seconds | ) | [static] |
Definition at line 533 of file conf.cpp.
References CLinearTimeDelta::SetSecondsString(), and UNUSED_PARAMETER.
00534 { 00535 UNUSED_PARAMETER(pExtra); 00536 UNUSED_PARAMETER(nExtra); 00537 UNUSED_PARAMETER(player); 00538 UNUSED_PARAMETER(cmd); 00539 00540 CLinearTimeDelta *pltd = (CLinearTimeDelta *)vp; 00541 pltd->SetSecondsString(str); 00542 return 0; 00543 }
static CF_HAND | ( | cf_dbref | ) | [static] |
Definition at line 507 of file conf.cpp.
References mux_atol(), mux_isspace, and UNUSED_PARAMETER.
00508 { 00509 UNUSED_PARAMETER(pExtra); 00510 UNUSED_PARAMETER(nExtra); 00511 UNUSED_PARAMETER(player); 00512 UNUSED_PARAMETER(cmd); 00513 00514 char *p = str; 00515 while (mux_isspace(*p)) 00516 { 00517 p++; 00518 } 00519 if (*p == '#') 00520 { 00521 p++; 00522 } 00523 00524 // Copy the numeric value to the parameter. 00525 // 00526 *vp = mux_atol(p); 00527 return 0; 00528 }
static CF_HAND | ( | cf_int | ) | [static] |
Definition at line 491 of file conf.cpp.
References mux_atol(), and UNUSED_PARAMETER.
00492 { 00493 UNUSED_PARAMETER(pExtra); 00494 UNUSED_PARAMETER(nExtra); 00495 UNUSED_PARAMETER(player); 00496 UNUSED_PARAMETER(cmd); 00497 00498 // Copy the numeric value to the parameter. 00499 // 00500 *vp = mux_atol(str); 00501 return 0; 00502 }
static CF_HAND | ( | cf_int_array | ) | [static] |
Definition at line 441 of file conf.cpp.
References is_integer(), ISOUTOFMEMORY, MEMALLOC, MEMFREE, mux_atol(), mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), tag_int_array::n, tag_int_array::pi, and UNUSED_PARAMETER.
00442 { 00443 UNUSED_PARAMETER(pExtra); 00444 UNUSED_PARAMETER(player); 00445 UNUSED_PARAMETER(cmd); 00446 00447 int *aPorts = (int *)MEMALLOC(nExtra*sizeof(int)); 00448 ISOUTOFMEMORY(aPorts); 00449 unsigned int nPorts = 0; 00450 00451 char *p; 00452 MUX_STRTOK_STATE tts; 00453 mux_strtok_src(&tts, str); 00454 mux_strtok_ctl(&tts, " \t\n\r"); 00455 while ((p = mux_strtok_parse(&tts)) != NULL) 00456 { 00457 int unused; 00458 if (is_integer(p, &unused)) 00459 { 00460 aPorts[nPorts++] = mux_atol(p); 00461 if (nPorts >= nExtra) 00462 { 00463 break; 00464 } 00465 } 00466 } 00467 00468 IntArray *pia = (IntArray *)vp; 00469 if (nPorts) 00470 { 00471 if (pia->pi) 00472 { 00473 MEMFREE(pia->pi); 00474 pia->pi = NULL; 00475 } 00476 pia->pi = (int *)MEMALLOC(nPorts * sizeof(int)); 00477 ISOUTOFMEMORY(pia->pi); 00478 pia->n = nPorts; 00479 for (unsigned int i = 0; i < nPorts; i++) 00480 { 00481 pia->pi[i] = aPorts[i]; 00482 } 00483 } 00484 MEMFREE(aPorts); 00485 return 0; 00486 }
void cf_init | ( | void | ) |
Definition at line 39 of file conf.cpp.
References A_USER_START, statedata::access_list, confdata::active_q_chunk, AF_ODARK, statedata::aHelpDesc, confdata::allow_guest_from_registered_site, confdata::art_rules, statedata::attr_next, confdata::autozone, statedata::badname_head, statedata::bCanRestart, statedata::bReadingConfiguration, statedata::bStackLimitReached, confdata::cache_names, confdata::cache_pages, confdata::cache_tick_period, confdata::check_interval, confdata::check_offset, confdata::clone_copy_cost, confdata::cmd_quota_incr, confdata::cmd_quota_max, confdata::compress, confdata::compress_db, confdata::comsys_db, confdata::conn_file, confdata::conn_timeout, confdata::control_flags, confdata::crashdb, confdata::crea_file, confdata::createmax, confdata::createmin, confdata::creg_file, statedata::curr_cmd, statedata::curr_enactor, statedata::curr_executor, confdata::dark_sleepers, alist::data, statedata::db_size, statedata::db_top, statedata::debug_cmd, confdata::default_home, confdata::destroy_going_now, confdata::digcost, statedata::doing_hdr, confdata::down_file, confdata::downmotd_msg, confdata::dump_interval, confdata::dump_msg, confdata::dump_offset, statedata::dumped, statedata::dumper, statedata::dumping, statedata::epoch, confdata::eval_comtitle, confdata::events_daily_hour, statedata::events_flag, confdata::ex_flags, confdata::exam_public, confdata::exit_flags, confdata::exit_quota, confdata::fascist_tport, confdata::fixed_home_msg, confdata::fixed_tel_msg, FLAG_WORD1, FLAG_WORD3, confdata::fork_dump, statedata::freelist, confdata::full_file, confdata::fullmotd_msg, statedata::func_invk_ctr, confdata::func_invk_lim, statedata::func_nest_lev, confdata::func_nest_lim, confdata::game_dir, confdata::game_pag, statedata::generation, statedata::glob_reg_len, confdata::global_error_obj, statedata::global_regs, GOD, confdata::guest_char, confdata::guest_file, confdata::guest_nuker, confdata::guest_prefix, confdata::guests_channel, confdata::guests_channel_alias, confdata::have_comsys, confdata::have_mailer, confdata::have_zones, confdata::hook_obj, confdata::idle_interval, confdata::idle_timeout, confdata::idle_wiz_dark, statedata::in_loop, confdata::indb, confdata::indent_desc, confdata::init_size, statedata::inpipe, ISOUTOFMEMORY, statedata::iter_alist, confdata::killguarantee, confdata::killmax, confdata::killmin, alist::len, confdata::linkcost, statedata::lock_nest_lev, confdata::lock_nest_lim, LOG_ALWAYS, LOG_BUGS, LOG_CONFIGMODS, LOG_DBSAVES, confdata::log_info, LOG_LOGIN, LOG_NET, confdata::log_options, LOG_PCREATES, LOG_PROBLEMS, LOG_SECURITY, LOG_SHOUTS, LOG_STARTUP, LOG_SUSPECTCMDS, LOG_TIMEUSE, LOG_WIZARD, statedata::logging, LOGOPT_LOC, LOGOPT_TIMESTAMP, confdata::machinecost, confdata::mail_db, statedata::mail_db_size, statedata::mail_db_top, confdata::mail_expiration, confdata::mail_per_hour, confdata::many_coins, statedata::markbits, confdata::markdata, confdata::master_room, confdata::match_mine, confdata::match_mine_pl, confdata::max_cache_size, confdata::max_cmdsecs, MAX_GLOBAL_REGS, confdata::max_players, MEMALLOC, statedata::mHelpDesc, confdata::min_guests, statedata::min_size, statedata::mod_al_id, statedata::mod_alist, statedata::mod_alist_len, statedata::mod_size, confdata::motd_file, confdata::motd_msg, statedata::mstat_curr, statedata::mstat_idrss, statedata::mstat_isrss, statedata::mstat_ixrss, statedata::mstat_secs, confdata::mud_name, mudconf, mudstate, tag_int_array::n, confdata::name_spaces, alist::next, statedata::nHearNest, statedata::nHelpDesc, statedata::nObjEvalNest, NOTHING, confdata::nStackLimit, statedata::nStackNest, statedata::ntfy_nest_lev, confdata::ntfy_nest_lim, confdata::number_guests, statedata::olist, confdata::one_coin, confdata::opencost, confdata::outdb, confdata::output_limit, confdata::pagecost, statedata::panicking, confdata::paranoid_alloc, confdata::parent_nest_lim, confdata::paycheck, confdata::payfind, confdata::paylimit, confdata::paystart, confdata::pcreate_per_hour, confdata::pemit_any, confdata::pemit_players, tag_int_array::pi, statedata::pipe_nest_lev, confdata::player_flags, confdata::player_listen, confdata::player_quota, confdata::ports, confdata::postdump_msg, statedata::pout, statedata::poutbufc, statedata::poutnew, statedata::poutobj, confdata::pub_flags, confdata::public_channel, confdata::public_channel_alias, confdata::pueblo_msg, confdata::queue_chunk, confdata::queuemax, confdata::quiet_look, confdata::quiet_whisper, confdata::quit_file, confdata::quotas, confdata::read_rem_desc, confdata::read_rem_name, confdata::regf_file, confdata::reset_players, confdata::restrict_home, confdata::retry_limit, ROBOT, confdata::robot_flags, confdata::robot_speak, confdata::robotcost, confdata::room_flags, confdata::room_quota, confdata::rpt_cmdsecs, confdata::run_startup, SA_DFLT, confdata::sacadjust, confdata::sacfactor, confdata::safe_unowned, confdata::safe_wipe, confdata::safer_passwords, confdata::searchcost, confdata::see_own_dark, CLinearTimeDelta::SetSeconds(), statedata::shutdown_flag, confdata::sig_action, confdata::site_chars, confdata::site_file, confdata::space_compress, confdata::stack_limit, confdata::start_home, confdata::start_quota, confdata::start_room, confdata::status_file, StringClone(), statedata::suspect_list, confdata::sweep_dark, confdata::switch_df_all, confdata::terse_contents, confdata::terse_exits, confdata::terse_look, confdata::terse_movemsg, confdata::thing_flags, confdata::thing_quota, confdata::timeslice, confdata::toad_recipient, confdata::trace_limit, confdata::trace_topdown, statedata::train_nest_lev, confdata::uncompress, confdata::use_hostname, confdata::use_http, confdata::vattr_flags, confdata::vattr_per_hour, confdata::waitcost, statedata::wild_invk_ctr, confdata::wild_invk_lim, confdata::wizmotd_file, confdata::wizmotd_msg, flagset::word, statedata::write_protect, confdata::zone_nest_lim, and statedata::zone_nest_num.
Referenced by dbconvert(), and main().
00040 { 00041 int i; 00042 00043 mudconf.indb = StringClone("netmux.db"); 00044 mudconf.outdb = StringClone(""); 00045 mudconf.crashdb = StringClone(""); 00046 mudconf.game_dir = StringClone(""); 00047 mudconf.game_pag = StringClone(""); 00048 mudconf.mail_db = StringClone("mail.db"); 00049 mudconf.comsys_db = StringClone("comsys.db"); 00050 00051 mudconf.compress_db = false; 00052 mudconf.compress = StringClone("gzip"); 00053 mudconf.uncompress = StringClone("gzip -d"); 00054 mudconf.status_file = StringClone("shutdown.status"); 00055 mudconf.max_cache_size = 1*1024*1024; 00056 00057 mudconf.ports.n = 1; 00058 mudconf.ports.pi = (int *)MEMALLOC(sizeof(int)); 00059 ISOUTOFMEMORY(mudconf.ports.pi); 00060 mudconf.ports.pi[0] = 2860; 00061 00062 mudconf.init_size = 1000; 00063 mudconf.guest_char = -1; 00064 mudconf.guest_nuker = GOD; 00065 mudconf.number_guests = 30; 00066 mudconf.min_guests = 1; 00067 strcpy(mudconf.guest_prefix, "Guest"); 00068 mudconf.guest_file = StringClone("text/guest.txt"); 00069 mudconf.conn_file = StringClone("text/connect.txt"); 00070 mudconf.creg_file = StringClone("text/register.txt"); 00071 mudconf.regf_file = StringClone("text/create_reg.txt"); 00072 mudconf.motd_file = StringClone("text/motd.txt"); 00073 mudconf.wizmotd_file = StringClone("text/wizmotd.txt"); 00074 mudconf.quit_file = StringClone("text/quit.txt"); 00075 mudconf.down_file = StringClone("text/down.txt"); 00076 mudconf.full_file = StringClone("text/full.txt"); 00077 mudconf.site_file = StringClone("text/badsite.txt"); 00078 mudconf.crea_file = StringClone("text/newuser.txt"); 00079 mudconf.motd_msg[0] = '\0'; 00080 mudconf.wizmotd_msg[0] = '\0'; 00081 mudconf.downmotd_msg[0] = '\0'; 00082 mudconf.fullmotd_msg[0] = '\0'; 00083 mudconf.dump_msg[0] = '\0'; 00084 mudconf.postdump_msg[0] = '\0'; 00085 mudconf.fixed_home_msg[0] = '\0'; 00086 mudconf.fixed_tel_msg[0] = '\0'; 00087 strcpy(mudconf.public_channel, "Public"); 00088 strcpy(mudconf.public_channel_alias, "pub"); 00089 strcpy(mudconf.guests_channel, "Guests"); 00090 strcpy(mudconf.guests_channel_alias, "g"); 00091 strcpy(mudconf.pueblo_msg, "</xch_mudtext><img xch_mode=html>"); 00092 mudconf.art_rules = NULL; 00093 mudconf.indent_desc = false; 00094 mudconf.name_spaces = true; 00095 #ifndef WIN32 00096 mudconf.fork_dump = true; 00097 mudstate.dumping = false; 00098 mudstate.dumper = 0; 00099 mudstate.dumped = 0; 00100 mudstate.write_protect = false; 00101 #endif 00102 mudconf.restrict_home = false; 00103 mudconf.have_comsys = true; 00104 mudconf.have_mailer = true; 00105 mudconf.have_zones = true; 00106 mudconf.paranoid_alloc = false; 00107 mudconf.sig_action = SA_DFLT; 00108 mudconf.max_players = -1; 00109 mudconf.dump_interval = 3600; 00110 mudconf.check_interval = 600; 00111 mudconf.events_daily_hour = 7; 00112 mudconf.dump_offset = 0; 00113 mudconf.check_offset = 300; 00114 mudconf.idle_timeout = 3600; 00115 mudconf.conn_timeout = 120; 00116 mudconf.idle_interval = 60; 00117 mudconf.retry_limit = 3; 00118 mudconf.output_limit = 16384; 00119 mudconf.paycheck = 0; 00120 mudconf.paystart = 0; 00121 mudconf.paylimit = 10000; 00122 #ifdef REALITY_LVLS 00123 mudconf.no_levels = 0; 00124 mudconf.def_room_rx = 1; 00125 mudconf.def_room_tx = ~(RLEVEL)0; 00126 mudconf.def_player_rx = 1; 00127 mudconf.def_player_tx = 1; 00128 mudconf.def_exit_rx = 1; 00129 mudconf.def_exit_tx = 1; 00130 mudconf.def_thing_rx = 1; 00131 mudconf.def_thing_tx = 1; 00132 #endif /* REALITY_LVLS */ 00133 mudconf.start_quota = 20; 00134 mudconf.site_chars = 25; 00135 mudconf.payfind = 0; 00136 mudconf.digcost = 10; 00137 mudconf.linkcost = 1; 00138 mudconf.opencost = 1; 00139 mudconf.createmin = 10; 00140 mudconf.createmax = 505; 00141 mudconf.killmin = 10; 00142 mudconf.killmax = 100; 00143 mudconf.killguarantee = 100; 00144 mudconf.robotcost = 1000; 00145 mudconf.pagecost = 10; 00146 mudconf.searchcost = 100; 00147 mudconf.waitcost = 10; 00148 mudconf.machinecost = 64; 00149 mudconf.exit_quota = 1; 00150 mudconf.player_quota = 1; 00151 mudconf.room_quota = 1; 00152 mudconf.thing_quota = 1; 00153 mudconf.mail_expiration = 14; 00154 mudconf.queuemax = 100; 00155 mudconf.queue_chunk = 10; 00156 mudconf.active_q_chunk = 10; 00157 mudconf.sacfactor = 5; 00158 mudconf.sacadjust = -1; 00159 mudconf.trace_limit = 200; 00160 00161 mudconf.autozone = true; 00162 mudconf.use_hostname = true; 00163 mudconf.clone_copy_cost = false; 00164 mudconf.dark_sleepers = true; 00165 mudconf.ex_flags = true; 00166 mudconf.exam_public = true; 00167 mudconf.fascist_tport = false; 00168 mudconf.idle_wiz_dark = false; 00169 mudconf.match_mine = true; 00170 mudconf.match_mine_pl = true; 00171 mudconf.pemit_players = false; 00172 mudconf.pemit_any = false; 00173 mudconf.player_listen = false; 00174 mudconf.pub_flags = true; 00175 mudconf.quiet_look = true; 00176 mudconf.quiet_whisper = true; 00177 mudconf.quotas = false; 00178 mudconf.read_rem_desc = false; 00179 mudconf.read_rem_name = false; 00180 mudconf.reset_players = false; 00181 mudconf.robot_speak = true; 00182 mudconf.safe_unowned = false; 00183 mudconf.safer_passwords = false; 00184 mudconf.see_own_dark = true; 00185 mudconf.sweep_dark = false; 00186 mudconf.switch_df_all = true; 00187 mudconf.terse_contents = true; 00188 mudconf.terse_exits = true; 00189 mudconf.terse_look = true; 00190 mudconf.terse_movemsg = true; 00191 mudconf.trace_topdown = true; 00192 mudconf.use_http = false; 00193 00194 // -- ??? Running SC on a non-SC DB may cause problems. 00195 // 00196 mudconf.space_compress = true; 00197 mudconf.allow_guest_from_registered_site = true; 00198 mudconf.start_room = 0; 00199 mudconf.start_home = NOTHING; 00200 mudconf.default_home = NOTHING; 00201 mudconf.master_room = NOTHING; 00202 00203 for (i = FLAG_WORD1; i <= FLAG_WORD3; i++) 00204 { 00205 mudconf.player_flags.word[i] = 0; 00206 mudconf.room_flags.word[i] = 0; 00207 mudconf.exit_flags.word[i] = 0; 00208 mudconf.thing_flags.word[i] = 0; 00209 mudconf.robot_flags.word[i] = 0; 00210 } 00211 mudconf.robot_flags.word[FLAG_WORD1] |= ROBOT; 00212 00213 mudconf.vattr_flags = AF_ODARK; 00214 strcpy(mudconf.mud_name, "MUX"); 00215 strcpy(mudconf.one_coin, "penny"); 00216 strcpy(mudconf.many_coins, "pennies"); 00217 mudconf.timeslice.SetSeconds(1); 00218 mudconf.cmd_quota_max = 100; 00219 mudconf.cmd_quota_incr = 1; 00220 mudconf.rpt_cmdsecs.SetSeconds(120); 00221 mudconf.max_cmdsecs.SetSeconds(60); 00222 mudconf.cache_tick_period.SetSeconds(30); 00223 mudconf.control_flags = 0xffffffff; // Everything for now... 00224 mudconf.log_options = LOG_ALWAYS | LOG_BUGS | LOG_SECURITY | 00225 LOG_NET | LOG_LOGIN | LOG_DBSAVES | LOG_CONFIGMODS | 00226 LOG_SHOUTS | LOG_STARTUP | LOG_WIZARD | LOG_SUSPECTCMDS | 00227 LOG_PROBLEMS | LOG_PCREATES | LOG_TIMEUSE; 00228 mudconf.log_info = LOGOPT_TIMESTAMP | LOGOPT_LOC; 00229 mudconf.markdata[0] = 0x01; 00230 mudconf.markdata[1] = 0x02; 00231 mudconf.markdata[2] = 0x04; 00232 mudconf.markdata[3] = 0x08; 00233 mudconf.markdata[4] = 0x10; 00234 mudconf.markdata[5] = 0x20; 00235 mudconf.markdata[6] = 0x40; 00236 mudconf.markdata[7] = 0x80; 00237 mudconf.func_nest_lim = 50; 00238 mudconf.func_invk_lim = 2500; 00239 mudconf.wild_invk_lim = 100000; 00240 mudconf.ntfy_nest_lim = 20; 00241 mudconf.lock_nest_lim = 20; 00242 mudconf.parent_nest_lim = 10; 00243 mudconf.zone_nest_lim = 20; 00244 mudconf.stack_limit = 50; 00245 mudconf.cache_names = true; 00246 mudconf.toad_recipient = -1; 00247 mudconf.eval_comtitle = true; 00248 mudconf.run_startup = true; 00249 mudconf.safe_wipe = false; 00250 mudconf.destroy_going_now = false; 00251 mudconf.nStackLimit = 10000; 00252 mudconf.hook_obj = NOTHING; 00253 mudconf.global_error_obj = NOTHING; 00254 mudconf.cache_pages = 40; 00255 mudconf.mail_per_hour = 50; 00256 mudconf.vattr_per_hour = 5000; 00257 mudconf.pcreate_per_hour = 100; 00258 00259 mudstate.events_flag = 0; 00260 mudstate.bReadingConfiguration = false; 00261 mudstate.bCanRestart = false; 00262 mudstate.panicking = false; 00263 mudstate.logging = 0; 00264 mudstate.epoch = 0; 00265 mudstate.generation = 0; 00266 mudstate.curr_executor = NOTHING; 00267 mudstate.curr_enactor = NOTHING; 00268 mudstate.shutdown_flag = false; 00269 mudstate.attr_next = A_USER_START; 00270 mudstate.debug_cmd = "< init >"; 00271 mudstate.curr_cmd = "< none >"; 00272 strcpy(mudstate.doing_hdr, "Doing"); 00273 mudstate.access_list = NULL; 00274 mudstate.suspect_list = NULL; 00275 mudstate.badname_head = NULL; 00276 mudstate.mstat_ixrss[0] = 0; 00277 mudstate.mstat_ixrss[1] = 0; 00278 mudstate.mstat_idrss[0] = 0; 00279 mudstate.mstat_idrss[1] = 0; 00280 mudstate.mstat_isrss[0] = 0; 00281 mudstate.mstat_isrss[1] = 0; 00282 mudstate.mstat_secs[0] = 0; 00283 mudstate.mstat_secs[1] = 0; 00284 mudstate.mstat_curr = 0; 00285 mudstate.iter_alist.data = NULL; 00286 mudstate.iter_alist.len = 0; 00287 mudstate.iter_alist.next = NULL; 00288 mudstate.mod_alist = NULL; 00289 mudstate.mod_alist_len = 0; 00290 mudstate.mod_size = 0; 00291 mudstate.mod_al_id = NOTHING; 00292 mudstate.olist = NULL; 00293 mudstate.min_size = 0; 00294 mudstate.db_top = 0; 00295 mudstate.db_size = 0; 00296 mudstate.mail_db_top = 0; 00297 mudstate.mail_db_size = 0; 00298 mudstate.freelist = NOTHING; 00299 mudstate.markbits = NULL; 00300 mudstate.func_nest_lev = 0; 00301 mudstate.func_invk_ctr = 0; 00302 mudstate.wild_invk_ctr = 0; 00303 mudstate.ntfy_nest_lev = 0; 00304 mudstate.train_nest_lev = 0; 00305 mudstate.lock_nest_lev = 0; 00306 mudstate.zone_nest_num = 0; 00307 mudstate.pipe_nest_lev = 0; 00308 mudstate.inpipe = false; 00309 mudstate.pout = NULL; 00310 mudstate.poutnew = NULL; 00311 mudstate.poutbufc = NULL; 00312 mudstate.poutobj = NOTHING; 00313 for (i = 0; i < MAX_GLOBAL_REGS; i++) 00314 { 00315 mudstate.global_regs[i] = NULL; 00316 mudstate.glob_reg_len[i] = 0; 00317 } 00318 mudstate.nObjEvalNest = 0; 00319 mudstate.in_loop = 0; 00320 mudstate.bStackLimitReached = false; 00321 mudstate.nStackNest = 0; 00322 mudstate.nHearNest = 0; 00323 mudstate.aHelpDesc = NULL; 00324 mudstate.mHelpDesc = 0; 00325 mudstate.nHelpDesc = 0; 00326 }
void cf_list | ( | dbref | player, | |
char * | buff, | |||
char ** | bufc | |||
) |
Definition at line 2243 of file conf.cpp.
References check_access(), conftable, ItemToList_AddString(), ItemToList_Init(), confparm::pname, and confparm::rperms.
Referenced by FUNCTION().
02244 { 02245 CONF *tp; 02246 ITL itl; 02247 ItemToList_Init(&itl, buff, bufc); 02248 02249 for (tp = conftable; tp->pname; tp++) 02250 { 02251 if (check_access(player, tp->rperms)) 02252 { 02253 if (!ItemToList_AddString(&itl, tp->pname)) 02254 { 02255 break; 02256 } 02257 } 02258 } 02259 ItemToList_Final(&itl); 02260 return; 02261 }
void cf_log_notfound | ( | dbref | player, | |
char * | cmd, | |||
const char * | thingname, | |||
char * | thing | |||
) |
Definition at line 331 of file conf.cpp.
References statedata::bReadingConfiguration, ENDLOG, Log, LOG_STARTUP, mudstate, notify, STARTLOG, CLogFile::tinyprintf(), and tprintf().
Referenced by CF_HAND().
00332 { 00333 if (mudstate.bReadingConfiguration) 00334 { 00335 STARTLOG(LOG_STARTUP, "CNF", "NFND"); 00336 Log.tinyprintf("%s: %s %s not found", cmd, thingname, thing); 00337 ENDLOG; 00338 } 00339 else 00340 { 00341 notify(player, tprintf("%s %s not found", thingname, thing)); 00342 } 00343 }
void DCL_CDECL cf_log_syntax | ( | dbref | player, | |
char * | cmd, | |||
const char * | fmt, | |||
... | ||||
) |
Definition at line 348 of file conf.cpp.
References alloc_lbuf, statedata::bReadingConfiguration, ENDLOG, free_lbuf, LBUF_SIZE, LOG_STARTUP, log_text(), mudstate, mux_vsnprintf(), notify, and STARTLOG.
Referenced by add_helpfile(), and CF_HAND().
00349 { 00350 va_list ap; 00351 va_start(ap, fmt); 00352 00353 char *buf = alloc_lbuf("cf_log_syntax"); 00354 mux_vsnprintf(buf, LBUF_SIZE, fmt, ap); 00355 if (mudstate.bReadingConfiguration) 00356 { 00357 STARTLOG(LOG_STARTUP, "CNF", "SYNTX") 00358 log_text(cmd); 00359 log_text(": "); 00360 log_text(buf); 00361 ENDLOG; 00362 } 00363 else 00364 { 00365 notify(player, buf); 00366 } 00367 free_lbuf(buf); 00368 va_end(ap); 00369 }
int cf_read | ( | void | ) |
Definition at line 2118 of file conf.cpp.
References statedata::bReadingConfiguration, confdata::config_file, DefaultSuffixes, confdata::indb, ISOUTOFMEMORY, MEMALLOC, MEMFREE, mudconf, mudstate, pFilename, and pSuffix.
Referenced by main().
02119 { 02120 int retval; 02121 02122 mudstate.bReadingConfiguration = true; 02123 retval = cf_include(NULL, mudconf.config_file, (void *)0, 0, 0, "init"); 02124 mudstate.bReadingConfiguration = false; 02125 02126 // Fill in missing DB file names. 02127 // 02128 unsigned int nInDB = strlen(mudconf.indb); 02129 for (int i = 0; DefaultSuffixes[i].pFilename; i++) 02130 { 02131 char **p = DefaultSuffixes[i].pFilename; 02132 if (**p == '\0') 02133 { 02134 // The filename is an empty string so we should construct 02135 // a default filename. 02136 // 02137 char *pSuffix = DefaultSuffixes[i].pSuffix; 02138 int nSuffix = strlen(pSuffix); 02139 char *buff = (char *)MEMALLOC(nInDB + nSuffix + 1); 02140 ISOUTOFMEMORY(buff); 02141 memcpy(buff, mudconf.indb, nInDB); 02142 memcpy(buff + nInDB, pSuffix, nSuffix+1); 02143 MEMFREE(*p); 02144 *p = buff; 02145 } 02146 } 02147 return retval; 02148 }
int cf_set | ( | char * | cp, | |
char * | ap, | |||
dbref | player | |||
) |
Definition at line 1983 of file conf.cpp.
References alloc_lbuf, statedata::bReadingConfiguration, check_access(), conftable, confparm::flags, mudstate, NOPERM_MESSAGE, notify, and confparm::pname.
Referenced by CF_HAND(), and do_admin().
01984 { 01985 CONF *tp; 01986 int i; 01987 char *buff = 0; 01988 01989 // Search the config parameter table for the command. If we find 01990 // it, call the handler to parse the argument. 01991 // 01992 for (tp = conftable; tp->pname; tp++) 01993 { 01994 if (!strcmp(tp->pname, cp)) 01995 { 01996 if ( !mudstate.bReadingConfiguration 01997 && !check_access(player, tp->flags)) 01998 { 01999 notify(player, NOPERM_MESSAGE); 02000 return -1; 02001 } 02002 if (!mudstate.bReadingConfiguration) 02003 { 02004 buff = alloc_lbuf("cf_set"); 02005 strcpy(buff, ap); 02006 } 02007 i = tp->interpreter(tp->loc, ap, tp->pExtra, tp->nExtra, player, cp); 02008 if (!mudstate.bReadingConfiguration) 02009 { 02010 STARTLOG(LOG_CONFIGMODS, "CFG", "UPDAT"); 02011 log_name(player); 02012 log_text(" entered config directive: "); 02013 log_text(cp); 02014 log_text(" with args '"); 02015 log_text(buff); 02016 log_text("'. Status: "); 02017 switch (i) 02018 { 02019 case 0: 02020 log_text("Success."); 02021 break; 02022 02023 case 1: 02024 log_text("Partial success."); 02025 break; 02026 02027 case -1: 02028 log_text("Failure."); 02029 break; 02030 02031 default: 02032 log_text("Strange."); 02033 } 02034 ENDLOG; 02035 free_lbuf(buff); 02036 } 02037 return i; 02038 } 02039 } 02040 02041 // Config directive not found. Complain about it. 02042 // 02043 cf_log_notfound(player, "Set", "Config directive", cp); 02044 return -1; 02045 }
static int cf_status_from_succfail | ( | dbref | player, | |
char * | cmd, | |||
int | success, | |||
int | failure | |||
) | [static] |
Definition at line 374 of file conf.cpp.
References alloc_lbuf, statedata::bReadingConfiguration, ENDLOG, free_lbuf, LOG_STARTUP, log_text(), mudstate, notify, and STARTLOG.
Referenced by CF_HAND().
00375 { 00376 char *buff; 00377 00378 // If any successes, return SUCCESS(0) if no failures or 00379 // PARTIAL_SUCCESS(1) if any failures. 00380 // 00381 if (success > 0) 00382 return ((failure == 0) ? 0 : 1); 00383 00384 // No successes. If no failures indicate nothing done. Always return 00385 // FAILURE(-1) 00386 // 00387 if (failure == 0) 00388 { 00389 if (mudstate.bReadingConfiguration) 00390 { 00391 STARTLOG(LOG_STARTUP, "CNF", "NDATA") 00392 buff = alloc_lbuf("cf_status_from_succfail.LOG"); 00393 sprintf(buff, "%s: Nothing to set", cmd); 00394 log_text(buff); 00395 free_lbuf(buff); 00396 ENDLOG 00397 } 00398 else 00399 { 00400 notify(player, "Nothing to set"); 00401 } 00402 } 00403 return -1; 00404 }
static bool DecodeN | ( | int | nType, | |
size_t | len, | |||
const char * | p, | |||
in_addr_t * | pu32 | |||
) | [static] |
Definition at line 1060 of file conf.cpp.
References mux_tolower, and DECODEIPV4::nShift.
Referenced by MakeCanonicalIPv4().
01061 { 01062 static DECODEIPV4 DecodeIPv4Table[4] = 01063 { 01064 { 8, 255UL, 3, 3, 2 }, 01065 { 16, 65535UL, 6, 5, 4 }, 01066 { 24, 16777215UL, 8, 8, 6 }, 01067 { 32, 4294967295UL, 11, 10, 8 } 01068 }; 01069 01070 *pu32 = (*pu32 << DecodeIPv4Table[nType].nShift) & 0xFFFFFFFFUL; 01071 if (len == 0) 01072 { 01073 return false; 01074 } 01075 in_addr_t ul = 0; 01076 in_addr_t ul2; 01077 if ( len >= 3 01078 && p[0] == '0' 01079 && mux_tolower(p[1]) == 'x') 01080 { 01081 // Hexadecimal Path 01082 // 01083 // Skip the leading zeros. 01084 // 01085 p += 2; 01086 len -= 2; 01087 while (*p == '0' && len) 01088 { 01089 p++; 01090 len--; 01091 } 01092 if (len > DecodeIPv4Table[nType].maxHexLen) 01093 { 01094 return false; 01095 } 01096 while (len) 01097 { 01098 unsigned char ch = mux_tolower(*p); 01099 ul2 = ul; 01100 ul = (ul << 4) & 0xFFFFFFFFUL; 01101 if (ul < ul2) 01102 { 01103 // Overflow 01104 // 01105 return false; 01106 } 01107 if ('0' <= ch && ch <= '9') 01108 { 01109 ul |= ch - '0'; 01110 } 01111 else if ('a' <= ch && ch <= 'f') 01112 { 01113 ul |= ch - 'a'; 01114 } 01115 else 01116 { 01117 return false; 01118 } 01119 p++; 01120 len--; 01121 } 01122 } 01123 else if (len >= 1 && p[0] == '0') 01124 { 01125 // Octal Path 01126 // 01127 // Skip the leading zeros. 01128 // 01129 p++; 01130 len--; 01131 while (*p == '0' && len) 01132 { 01133 p++; 01134 len--; 01135 } 01136 if (len > DecodeIPv4Table[nType].maxOctLen) 01137 { 01138 return false; 01139 } 01140 while (len) 01141 { 01142 unsigned char ch = *p; 01143 ul2 = ul; 01144 ul = (ul << 3) & 0xFFFFFFFFUL; 01145 if (ul < ul2) 01146 { 01147 // Overflow 01148 // 01149 return false; 01150 } 01151 if ('0' <= ch && ch <= '7') 01152 { 01153 ul |= ch - '0'; 01154 } 01155 else 01156 { 01157 return false; 01158 } 01159 p++; 01160 len--; 01161 } 01162 } 01163 else 01164 { 01165 // Decimal Path 01166 // 01167 if (len > DecodeIPv4Table[nType].maxDecLen) 01168 { 01169 return false; 01170 } 01171 while (len) 01172 { 01173 unsigned char ch = *p; 01174 ul2 = ul; 01175 ul = (ul * 10) & 0xFFFFFFFFUL; 01176 if (ul < ul2) 01177 { 01178 // Overflow 01179 // 01180 return false; 01181 } 01182 ul2 = ul; 01183 if ('0' <= ch && ch <= '9') 01184 { 01185 ul += ch - '0'; 01186 } 01187 else 01188 { 01189 return false; 01190 } 01191 if (ul < ul2) 01192 { 01193 // Overflow 01194 // 01195 return false; 01196 } 01197 p++; 01198 len--; 01199 } 01200 } 01201 if (ul > DecodeIPv4Table[nType].maxValue) 01202 { 01203 return false; 01204 } 01205 *pu32 |= ul; 01206 return true; 01207 }
void do_admin | ( | dbref | executor, | |
dbref | caller, | |||
dbref | enactor, | |||
int | extra, | |||
int | nargs, | |||
char * | kw, | |||
char * | value | |||
) |
Definition at line 2078 of file conf.cpp.
References cf_set(), notify, Quiet, UNUSED_PARAMETER, and ValidateConfigurationDbrefs().
02087 { 02088 UNUSED_PARAMETER(caller); 02089 UNUSED_PARAMETER(enactor); 02090 UNUSED_PARAMETER(extra); 02091 UNUSED_PARAMETER(nargs); 02092 02093 int i = cf_set(kw, value, executor); 02094 if ((i >= 0) && !Quiet(executor)) 02095 { 02096 notify(executor, "Set."); 02097 } 02098 ValidateConfigurationDbrefs(); 02099 }
static bool isValidSubnetMask | ( | in_addr_t | ulMask | ) | [static] |
Definition at line 1285 of file conf.cpp.
Referenced by CF_HAND().
01286 { 01287 in_addr_t ulTest = 0xFFFFFFFFUL; 01288 for (int i = 0; i <= 32; i++) 01289 { 01290 if (ulMask == ulTest) 01291 { 01292 return true; 01293 } 01294 ulTest = (ulTest << 1) & 0xFFFFFFFFUL; 01295 } 01296 return false; 01297 }
void list_cf_access | ( | dbref | player | ) |
Definition at line 2153 of file conf.cpp.
References access_nametab, alloc_mbuf, check_access(), conftable, confparm::flags, God, listset_nametab(), and confparm::pname.
Referenced by do_list().
02154 { 02155 CONF *tp; 02156 char *buff; 02157 02158 buff = alloc_mbuf("list_cf_access"); 02159 for (tp = conftable; tp->pname; tp++) 02160 { 02161 if (God(player) || check_access(player, tp->flags)) 02162 { 02163 sprintf(buff, "%s:", tp->pname); 02164 listset_nametab(player, access_nametab, tp->flags, buff, true); 02165 } 02166 } 02167 free_mbuf(buff); 02168 }
static bool MakeCanonicalIPv4 | ( | const char * | str, | |
in_addr_t * | pnIP | |||
) | [static] |
Definition at line 1235 of file conf.cpp.
References DecodeN().
Referenced by CF_HAND().
01236 { 01237 *pnIP = 0; 01238 if (!str) 01239 { 01240 return false; 01241 } 01242 01243 // Skip leading spaces. 01244 // 01245 const char *q = str; 01246 while (*q == ' ') 01247 { 01248 q++; 01249 } 01250 01251 const char *p = strchr(q, '.'); 01252 int n = 0; 01253 while (p) 01254 { 01255 // Decode 01256 // 01257 n++; 01258 if (n > 3) 01259 { 01260 return false; 01261 } 01262 if (!DecodeN(0, p-q, q, pnIP)) 01263 { 01264 return false; 01265 } 01266 q = p + 1; 01267 p = strchr(q, '.'); 01268 } 01269 01270 // Decode last element. 01271 // 01272 size_t len = strlen(q); 01273 if (!DecodeN(3-n, len, q, pnIP)) 01274 { 01275 return false; 01276 } 01277 *pnIP = htonl(*pnIP); 01278 return true; 01279 }
void ValidateConfigurationDbrefs | ( | void | ) |
Definition at line 2049 of file conf.cpp.
References statedata::db_top, confdata::default_home, confdata::guest_char, confdata::guest_nuker, confdata::master_room, mudconf, mudstate, NOTHING, confdata::start_home, and confdata::start_room.
Referenced by do_admin(), and main().
02050 { 02051 static dbref *Table[] = 02052 { 02053 &mudconf.default_home, 02054 &mudconf.guest_char, 02055 &mudconf.guest_nuker, 02056 &mudconf.master_room, 02057 &mudconf.start_home, 02058 &mudconf.start_room, 02059 0 02060 }; 02061 02062 for (int i = 0; Table[i]; i++) 02063 { 02064 if (*Table[i] != NOTHING) 02065 { 02066 if (*Table[i] < 0 || mudstate.db_top <= *Table[i]) 02067 { 02068 *Table[i] = NOTHING; 02069 } 02070 } 02071 } 02072 }
NAMETAB bool_names[] [static] |
Definition at line 1723 of file conf.cpp.
Referenced by cf_display(), CF_HAND(), cf_list(), cf_set(), and list_cf_access().
struct { ... } DefaultSuffixes[] [static] |
Referenced by cf_read().
NAMETAB hook_names[] [static] |
Initial value:
{ {"after", 3, 0, HOOK_AFTER}, {"before", 3, 0, HOOK_BEFORE}, {"fail", 3, 0, HOOK_AFAIL}, {"ignore", 3, 0, HOOK_IGNORE}, {"igswitch", 3, 0, HOOK_IGSWITCH}, {"permit", 3, 0, HOOK_PERMIT}, {NULL, 0, 0, 0} }
Definition at line 1547 of file conf.cpp.
Referenced by CF_HAND().
Definition at line 33 of file conf.cpp.
Referenced by CGuests::AddToGuestChannel(), AddToPublicChannel(), announce_connect(), announce_disconnect(), anum_extend(), bCanReadAttr(), BuildChannelMessage(), CallBack_HaltQueue(), CallBack_NotifySemaphoreDrainOrAll(), can_see(), canpayfees(), CF_HAND(), cf_init(), cf_read(), check_command(), check_connect(), check_dead_refs(), check_events(), check_floating(), check_idle(), check_mail_expiration(), check_zone_handler(), chown_all(), CGuests::CleanUp(), CLI_CallBack(), connect_player(), count_quota(), CGuests::Create(), create_obj(), db_grow(), db_read(), default_home(), desc_reload(), destroy_obj(), destroyable(), CGuests::DestroyGuestChar(), dispatch_CacheTick(), dispatch_CheckEvents(), dispatch_DatabaseDump(), dispatch_FreeListReconstruction(), dispatch_IdleCheck(), do_addcom(), do_allcom(), do_apply_marked(), do_backup(), do_cemit(), do_chanlist(), do_channelwho(), do_chboot(), do_chopen(), do_chown(), do_chzone(), do_clearcom(), do_clone(), do_comlist(), do_command(), do_comtitle(), do_delcom(), do_destroy(), do_destroychannel(), do_editchannel(), do_entrances(), do_examine(), do_find(), do_global(), do_kill(), do_list(), do_logged_out_internal(), do_look(), do_mail(), do_mail_stats(), do_malias(), do_markall(), do_motd(), do_move(), do_pcreate(), do_pemit_single(), do_postpend(), do_prepend(), do_processcom(), do_quota(), do_restart(), do_score(), do_search(), do_shutdown(), do_sweep(), do_switch(), do_teleport(), do_teleport_single(), do_toad(), do_unlink(), do_verb(), do_wipe(), dump_database(), dump_database_internal(), dump_info(), dump_users(), eval_boolexp(), exam_wildattrs(), fh_going_bit(), filter_handler(), fork_and_dump(), FUNCTION(), get_slave_result(), get_stats(), give_money(), halt_que(), higcheck(), hook_fail(), init_timer(), initializesock(), link_exit(), list_costs(), list_df_flags(), list_options(), CGuests::ListAll(), load_game(), load_restart_db(), log_name(), log_name_and_loc(), look_contents(), look_in(), look_simple(), main(), CGuests::MakeGuestChar(), match_master_exit(), mkattr(), Moniker(), move_object(), move_via_exit(), move_via_teleport(), mux_exec(), new_connection(), notify_check(), ok_password(), open_exit(), page_check(), parse_connect(), parse_to(), parse_to_cleanup(), pool_alloc(), pool_alloc_lbuf(), pool_free(), pool_free_lbuf(), process_cmdent(), process_command(), process_enter_loc(), process_leave_loc(), process_preload(), PureName(), queue_write_LEN(), QueueMax(), quick_wild(), ReleaseAllResources(), report_timecheck(), CScheduler::RunTasks(), s_Moniker(), s_Name(), scan_zone(), setup_que(), SetupGlobalThrottle(), SetupThrottle(), show_a_desc(), sighandler(), sp_ok(), start_home(), start_log(), CGuests::StartUp(), string_compare(), sweep_check(), Task_ProcessCommand(), Task_RunQueueEntry(), tcache_add(), CHashFile::Tick(), TrimCache(), trimmed_site(), u_comp(), update_quotas(), ValidateConfigurationDbrefs(), ValidatePlayerName(), wait_que(), where_room(), and wild1().
Definition at line 34 of file conf.cpp.
Referenced by add_comsys(), add_helpfile(), add_player_name(), al_add(), al_delete(), al_fetch(), al_store(), announce_connect(), announce_disconnect(), anum_extend(), MailList::AppendItem(), AssertionFailed(), atr_add(), atr_clr(), atr_free(), atr_head(), atr_match(), atr_match1(), atr_pop(), atr_push(), atr_str(), badname_add(), badname_check(), badname_list(), badname_remove(), bCanReadAttr(), bind_and_queue(), build_version(), cache_del(), cache_get(), cache_put(), CF_HAND(), cf_init(), cf_log_notfound(), cf_log_syntax(), cf_read(), cf_set(), cf_status_from_succfail(), check_access(), check_command(), check_connect(), check_dead_refs(), check_events(), check_filter(), check_floating(), check_panicking(), check_zone_handler(), CLI_CallBack(), commands_no_arg_add(), commands_one_arg_add(), commands_one_arg_cmdarg_add(), commands_two_arg_add(), commands_two_arg_argv_add(), commands_two_arg_argv_cmdarg_add(), commands_two_arg_cmdarg_add(), Commer(), create_obj(), db_free(), db_grow(), db_read(), db_write(), db_write_object(), dbclean_CheckANHtoAT(), dbclean_CheckATtoANH(), dbclean_RemoveStaleAttributeNames(), dbclean_RenumberAttributes(), decode_power(), del_comsys(), delete_player_name(), desc_addhash(), desc_delhash(), destroy_bad_obj(), destroy_obj(), did_it(), dispatch_CacheTick(), dispatch_CanRestart(), dispatch_CheckEvents(), dispatch_DatabaseDump(), dispatch_FreeListReconstruction(), dispatch_IdleCheck(), do_addcommand(), do_backup(), do_chanlist(), do_channelnuke(), do_command(), do_createchannel(), do_dbck(), do_dbclean(), do_delcommand(), do_destroychannel(), do_doing(), do_dolist(), do_dump(), do_flag(), do_force(), do_function(), do_hook(), do_icmd(), do_if(), do_listchannels(), do_listcommands(), do_logged_out_internal(), do_mail_debug(), do_prog(), do_quitprog(), do_restart(), do_shutdown(), do_stats(), do_switch(), do_timewarp(), do_train(), do_version(), do_wait(), dump_database(), dump_database_internal(), dump_info(), dump_mail(), dump_restart_db(), dump_users(), end_log(), eval_boolexp(), exit_displayable(), exit_visible(), failconn(), filter_handler(), find_flag(), find_power(), find_wild_attrs(), MailList::FirstItem(), flag_rename(), fork_and_dump(), FUNCTION(), function_add(), functions_add(), fwdlist_ck(), fwdlist_clr(), fwdlist_get(), fwdlist_load(), fwdlist_set(), GetProcessorUsage(), handle_prog(), Hearer(), help_helper(), help_write(), helpindex_clean(), helpindex_load(), helpindex_read(), init_attrtab(), init_cmdtab(), init_dbfile(), init_flagtab(), init_logout_cmdtab(), init_powertab(), init_timer(), init_version(), initializesock(), CHashFile::Insert(), iter_value(), list_check(), list_hashstats(), list_options(), list_process(), list_siteinfo(), list_vattrs(), load_comsystem(), load_restart_db(), log_name(), log_perror(), look_atrs(), look_atrs1(), lookup_player(), mail_db_grow(), main(), make_freelist(), MessageAdd(), mux_exec(), new_connection(), notify_check(), ok_password(), olist_add(), olist_first(), olist_next(), olist_pop(), olist_push(), OutOfMemory(), parse_attrib_wild(), parse_boolexp(), parse_boolexp_L(), parse_range(), Pennies(), pool_alloc(), pool_alloc_lbuf(), pool_err(), pool_free(), pool_free_lbuf(), process_cmdent(), process_command(), process_input(), process_output(), QueueMax(), quick_wild(), raw_notify(), raw_notify_html(), raw_notify_newline(), CHashPage::ReadPage(), real_regmatch(), MailList::RemoveAll(), MailList::RemoveItem(), report(), report_timecheck(), ReportMatchedTopics(), ReportTopic(), restore_global_regs(), room_list(), s_Pennies(), save_and_clear_global_regs(), save_comsystem(), save_global_regs(), search_perform(), select_channel(), SetupGlobalThrottle(), shovechars(), shutdownsock(), sighandler(), CMuxAlarm::Sleep(), start_log(), string_compare(), sweep_check(), CHashFile::Sync(), Task_RunQueueEntry(), ThrottlePlayerCreate(), TrimCache(), u_comp(), unparse_boolexp1(), ValidateConfigurationDbrefs(), ValidateHelpFileIndex(), ValidatePlayerName(), vattr_alloc_LEN(), vattr_define_LEN(), vattr_delete_LEN(), vattr_find_LEN(), vattr_first(), vattr_next(), vattr_rename_LEN(), wild(), wild1(), wild_match(), CHashFile::WriteDirectory(), and CHashPage::WritePage().