Removed safe cracker door
This commit is contained in:
parent
ced93cb072
commit
84c43b6855
@ -14,6 +14,9 @@ v0.37.01 14-Jan-2003.
|
||||
areas.
|
||||
After upgrade you may remove ~/etc/maptabs and it's contents.
|
||||
After upgrade you may remove ~/etc/bank.data.
|
||||
After upgrade you may remove ~/etc/safe.data.
|
||||
If you want, download and install the nu-door and safe-door
|
||||
packages.
|
||||
|
||||
general:
|
||||
This version may be used on production systems, but be
|
||||
@ -32,6 +35,7 @@ v0.37.01 14-Jan-2003.
|
||||
the html docs.
|
||||
The main Makefile now sets each txtfiles directory to mode 775
|
||||
to allow doors to write ansi/ascii screens.
|
||||
Removed the safe cracker door, this is now external.
|
||||
|
||||
nodelist.a:
|
||||
Added experimental support for IP nodes lookup using a default
|
||||
@ -92,6 +96,9 @@ v0.37.01 14-Jan-2003.
|
||||
Added setup for rules directory.
|
||||
Added setup for menu 221. Changed description of menu 103.
|
||||
The menu editor is machine endian independant.
|
||||
Removed setup for the safe cracker door.
|
||||
In menu 8.3 showing long option data lines, the lines were too
|
||||
long for a 80 characters display.
|
||||
|
||||
mbsebbs:
|
||||
It will now refuse to up/download OLR packets when the system
|
||||
@ -123,6 +130,7 @@ v0.37.01 14-Jan-2003.
|
||||
now only the writer or those with sysop access to the area are
|
||||
allowed to delete messages.
|
||||
Finally wrote Delete Message from the menu (menu 206).
|
||||
Removed the safe cracker door.
|
||||
|
||||
examples:
|
||||
The English and Dutch templates are updated to show the new
|
||||
|
@ -12,7 +12,7 @@
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<BLOCKQUOTE>
|
||||
<DIV align=right><h5>Last update 02-Feb-2003</h5></DIV>
|
||||
<DIV align=right><h5>Last update 23-Feb-2003</h5></DIV>
|
||||
|
||||
<DIV align=center><h1>MBSE BBS Global Menus</h1></DIV>
|
||||
<hr>
|
||||
@ -160,10 +160,6 @@
|
||||
even if the display line is empty. In that case an empty line is displayed.<br>
|
||||
<strong>Optional data:</strong> None.<br>
|
||||
<P>
|
||||
|
||||
<LI value="25"><strong>Safe cracker door:</strong> This runs the Safe Cracker
|
||||
door.<br>
|
||||
<strong>Optional data:</strong> None.<br>
|
||||
</OL>
|
||||
|
||||
<HR>
|
||||
|
@ -78,9 +78,6 @@ struct languagehdr langhdr; /* Language data */
|
||||
struct language lang;
|
||||
struct langdata ldata;
|
||||
|
||||
struct crackerhdr safehdr; /* Safe cracker structure */
|
||||
struct cracker safe;
|
||||
|
||||
struct _fidonethdr fidonethdr; /* Fidonet structure */
|
||||
struct _fidonet fidonet;
|
||||
struct domhdr domainhdr;
|
||||
|
@ -49,7 +49,7 @@ typedef enum {IGNORE, CREATE, KILL} ORPHANTYPE;
|
||||
typedef enum {SEND, RECV, BOTHDIR} NODETYPE;
|
||||
typedef enum {POTS, ISDN, NETWORK, LOCAL} LINETYPE;
|
||||
typedef enum {BROWSING, DOWNLOAD, UPLOAD, READ_POST, DOOR, SYSOPCHAT,
|
||||
FILELIST, TIMEBANK, SAFE, WHOSON, OLR} DOESTYPE;
|
||||
FILELIST, WHOSON, OLR} DOESTYPE;
|
||||
typedef enum {I_AVT0, I_ANSI, I_VT52, I_VT100, I_TTY} ITERM;
|
||||
typedef enum {I_DZA, I_ZAP, I_ZMO, I_SLK, I_KER} IPROT;
|
||||
typedef enum {E_NOISP, E_TMPISP, E_PRMISP} EMODE;
|
||||
@ -618,16 +618,15 @@ struct sysconfig {
|
||||
char xNuScreen[50]; /* Obsolete Next User Door */
|
||||
char xNuQuote[81];
|
||||
|
||||
/* Safe Cracker Door */
|
||||
int iSafeFirstDigit; /* Safe Door First Digit */
|
||||
int iSafeSecondDigit; /* Safe Door Second Digit */
|
||||
int iSafeThirdDigit; /* Safe Door Third Digit */
|
||||
int iSafeMaxTrys; /* Max trys per day */
|
||||
int iSafeMaxNumber; /* Maximum Safe Number */
|
||||
unsigned iSafeNumGen : 1; /* Use number generator */
|
||||
char sSafePrize[81]; /* Safe Prize */
|
||||
char sSafeWelcome[81]; /* Safe welcome file */
|
||||
char sSafeOpened[81]; /* Opended safe file */
|
||||
int xSafeFirstDigit;
|
||||
int xSafeSecondDigit;
|
||||
int xSafeThirdDigit;
|
||||
int xSafeMaxTrys;
|
||||
int xSafeMaxNumber;
|
||||
unsigned xSafeNumGen : 1;
|
||||
char xSafePrize[81];
|
||||
char xSafeWelcome[81];
|
||||
char xSafeOpened[81];
|
||||
|
||||
/* Sysop Paging */
|
||||
int iPageLength; /* Page Length in Seconds */
|
||||
@ -962,23 +961,6 @@ struct langdata {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Structure for Safe Cracker Door Data File (safe.data)
|
||||
*/
|
||||
struct crackerhdr {
|
||||
long hdrsize; /* Size of header */
|
||||
long recsize; /* Size of records */
|
||||
};
|
||||
|
||||
struct cracker {
|
||||
char Date[12]; /* Date used */
|
||||
char Name[36]; /* User name */
|
||||
int Trys; /* Trys today */
|
||||
unsigned Opened : 1; /* If user succeeded */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Fidonet Networks (fidonet.data)
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@ SRCS = signature.c filesub.c language.c mbtoberep.c \
|
||||
bye.c funcs.c mail.c \
|
||||
newuser.c pinfo.c timecheck.c change.c \
|
||||
exitinfo.c mball.c mbsebbs.c menu.c pop3.c lastcallers.c \
|
||||
safe.c timeout.c chat.c file.c mbchat.c mbstat.c misc.c \
|
||||
timeout.c chat.c file.c mbchat.c mbstat.c misc.c \
|
||||
offline.c user.c mbnewusr.c input.c whoson.c \
|
||||
door.c dispfile.c userlist.c timestats.c logentry.c
|
||||
HDRS = signature.h filesub.h language.h mbsebbs.h misc.h offline.h \
|
||||
@ -19,11 +19,11 @@ HDRS = signature.h filesub.h language.h mbsebbs.h misc.h offline.h \
|
||||
funcs.h mail.h mbuser.h page.h \
|
||||
change.h exitinfo.h mball.h newuser.h \
|
||||
pinfo.h chat.h file.h menu.h \
|
||||
pop3.h safe.h timecheck.h mbnewusr.h input.h whoson.h \
|
||||
pop3.h timecheck.h mbnewusr.h input.h whoson.h \
|
||||
door.h dispfile.h userlist.h timestats.h logentry.h lastcallers.h
|
||||
MBSEBBS_OBJS = signature.o bbslist.o chat.o file.o funcs.o mail.o menu.o \
|
||||
misc.o pinfo.o oneline.o page.o fsedit.o \
|
||||
bye.o change.o mbsebbs.o safe.o timeout.o user.o timecheck.o \
|
||||
bye.o change.o mbsebbs.o timeout.o user.o timecheck.o \
|
||||
exitinfo.o filesub.o lineedit.o offline.o language.o msgutil.o \
|
||||
pop3.o email.o input.o whoson.o door.o dispfile.o userlist.o timestats.o \
|
||||
logentry.o morefile.o lastcallers.o
|
||||
@ -158,10 +158,9 @@ change.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/struc
|
||||
exitinfo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h funcs.h input.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
|
||||
mball.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mbse.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbcfg.h ../lib/clcomm.h ../lib/mberrors.h mball.h
|
||||
mbsebbs.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/mberrors.h mbsebbs.h user.h dispfile.h language.h menu.h misc.h bye.h timeout.h funcs.h
|
||||
menu.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h oneline.h mail.h bbslist.h change.h chat.h file.h funcs.h input.h misc.h safe.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h signature.h
|
||||
menu.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h oneline.h mail.h bbslist.h change.h chat.h file.h funcs.h input.h misc.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h signature.h
|
||||
pop3.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h
|
||||
lastcallers.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h lastcallers.h
|
||||
safe.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h whoson.h dispfile.h input.h misc.h safe.h timeout.h language.h
|
||||
timeout.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h timeout.h funcs.h bye.h filesub.h language.h
|
||||
chat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h chat.h funcs.h input.h language.h misc.h whoson.h
|
||||
file.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "funcs.h"
|
||||
#include "input.h"
|
||||
#include "misc.h"
|
||||
#include "safe.h"
|
||||
#include "timeout.h"
|
||||
#include "menu.h"
|
||||
#include "page.h"
|
||||
@ -410,13 +409,6 @@ void DoMenu(int Type)
|
||||
/* display menuline only */
|
||||
break;
|
||||
|
||||
/* Menus 22, 23 and 24 were obsolete doors */
|
||||
|
||||
case 25:
|
||||
/* safe cracker door */
|
||||
Safe();
|
||||
break;
|
||||
|
||||
case 101:
|
||||
FileArea_List(menus.OptionalData);
|
||||
break;
|
||||
|
468
mbsebbs/safe.c
468
mbsebbs/safe.c
@ -1,468 +0,0 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* Purpose ...............: Safe Door
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
* 1971 BV IJmuiden
|
||||
* the Netherlands
|
||||
*
|
||||
* This file is part of MBSE BBS.
|
||||
*
|
||||
* This BBS is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* MBSE BBS is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../config.h"
|
||||
#include "../lib/libs.h"
|
||||
#include "../lib/memwatch.h"
|
||||
#include "../lib/mbse.h"
|
||||
#include "../lib/structs.h"
|
||||
#include "../lib/users.h"
|
||||
#include "../lib/records.h"
|
||||
#include "../lib/clcomm.h"
|
||||
#include "../lib/common.h"
|
||||
#include "whoson.h"
|
||||
#include "dispfile.h"
|
||||
#include "input.h"
|
||||
#include "misc.h"
|
||||
#include "safe.h"
|
||||
#include "timeout.h"
|
||||
#include "language.h"
|
||||
|
||||
|
||||
|
||||
FILE *pSafe;
|
||||
|
||||
int iLoop, iFirst, iSecond, iThird;
|
||||
char sFirst[4], sSecond[4], sThird[4];
|
||||
int cracked;
|
||||
int tries;
|
||||
|
||||
int getdigits(void);
|
||||
int SafeCheckUser(int);
|
||||
|
||||
|
||||
|
||||
void Safe(void)
|
||||
{
|
||||
long isize;
|
||||
int i;
|
||||
|
||||
isize = sizeof(int);
|
||||
srand(Time_Now);
|
||||
cracked = FALSE;
|
||||
tries = 0;
|
||||
|
||||
WhosDoingWhat(SAFE);
|
||||
|
||||
Syslog('+', "User starts Safe Cracker Door");
|
||||
|
||||
Enter(1);
|
||||
/* Safe Cracker Door */
|
||||
pout(WHITE, BLACK, (char *) Language(86));
|
||||
Enter(1);
|
||||
|
||||
clear();
|
||||
|
||||
DisplayFile(CFG.sSafeWelcome);
|
||||
|
||||
if (SafeCheckUser(TRUE) == TRUE)
|
||||
return;
|
||||
|
||||
/* In the safe lies */
|
||||
pout(WHITE, BLACK, (char *) Language(87));
|
||||
|
||||
fflush(stdout);
|
||||
alarm_on();
|
||||
Getone();
|
||||
|
||||
clear();
|
||||
|
||||
Enter(2);
|
||||
pout(LIGHTGREEN, BLACK, (char *) Language(88));
|
||||
Enter(2);
|
||||
|
||||
colour(LIGHTMAGENTA, BLACK);
|
||||
printf("%s", CFG.sSafePrize);
|
||||
|
||||
Enter(2);
|
||||
/* Do you want to open the safe ? [Y/n]: */
|
||||
pout(WHITE, BLACK, (char *) Language(102));
|
||||
|
||||
fflush(stdout);
|
||||
alarm_on();
|
||||
i = toupper(Getone());
|
||||
|
||||
if (i == Keystroke(102, 1)) {
|
||||
Syslog('+', "User exited Safe Cracker Door");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop until the safe is opened, maximum trys
|
||||
* exceeded or the user is tired of this door.
|
||||
*/
|
||||
while (TRUE) {
|
||||
/* Get digits, TRUE if safe cracked. */
|
||||
if (getdigits() == TRUE) {
|
||||
SafeCheckUser(FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
Enter(1);
|
||||
/* Do you want to try again ? [Y/n]: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(101));
|
||||
fflush(stdout);
|
||||
|
||||
alarm_on();
|
||||
i = toupper(Getone());
|
||||
if (i == Keystroke(101, 1)) {
|
||||
SafeCheckUser(FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (SafeCheckUser(FALSE) == TRUE)
|
||||
break;
|
||||
}
|
||||
Syslog('+', "User exited Safe Cracker Door");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Ask use for digits, returns TRUE if the safe is cracked.
|
||||
*/
|
||||
int getdigits(void)
|
||||
{
|
||||
int i;
|
||||
char temp[81];
|
||||
|
||||
colour(WHITE, BLACK);
|
||||
/* Please enter three numbers consisting from 1 to */
|
||||
printf("\n\n%s%d\n", (char *) Language(89), CFG.iSafeMaxNumber);
|
||||
/* Please enter three combinations. */
|
||||
printf("%s", (char *) Language(90));
|
||||
|
||||
while (TRUE) {
|
||||
Enter(2);
|
||||
/* 1st Digit */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(91));
|
||||
colour(LIGHTBLUE, BLACK);
|
||||
fflush(stdout);
|
||||
Getnum(sFirst, 2);
|
||||
sprintf(temp, "1st: %s", sFirst);
|
||||
if((strcmp(sFirst, "")) != 0) {
|
||||
iFirst=atoi(sFirst);
|
||||
}
|
||||
|
||||
if((iFirst > CFG.iSafeMaxNumber) || (iFirst <= 0) || (strcmp(sFirst, "") == 0)) {
|
||||
colour(WHITE, BLUE);
|
||||
/* Please try again! You must input a number greater than Zero and less than */
|
||||
printf("\n%s%d.", (char *) Language(92), CFG.iSafeMaxNumber);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
Enter(1);
|
||||
/* 2nd digit: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(93));
|
||||
colour(LIGHTBLUE, BLACK);
|
||||
fflush(stdout);
|
||||
Getnum(sSecond, 2);
|
||||
sprintf(temp, "2nd: %s", sSecond);
|
||||
if((strcmp(sSecond, "")) != 0) {
|
||||
iSecond=atoi(sSecond);
|
||||
}
|
||||
|
||||
if((iSecond > CFG.iSafeMaxNumber) || (iSecond <= 0) || (strcmp(sSecond, "") == 0)) {
|
||||
colour(WHITE, BLUE);
|
||||
/* Please try again! You must input a number greater than Zero and less than */
|
||||
printf("\n%s%d.\n", (char *) Language(92), CFG.iSafeMaxNumber);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
Enter(1);
|
||||
pout(LIGHTRED, BLACK, (char *) Language(94));
|
||||
colour(LIGHTBLUE, BLACK);
|
||||
fflush(stdout);
|
||||
Getnum(sThird, 2);
|
||||
sprintf(temp, "3rd: %s", sThird);
|
||||
if((strcmp(sThird, "")) != 0) {
|
||||
iThird=atoi(sThird);
|
||||
}
|
||||
|
||||
if((iThird > CFG.iSafeMaxNumber) || (iThird <= 0) || (strcmp(sThird, "") == 0)) {
|
||||
colour(WHITE, BLUE);
|
||||
/* Please try again! You must input a number greater than Zero and less than */
|
||||
printf("\n%s%d.\n", (char *) Language(92), CFG.iSafeMaxNumber);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
/* Left: */
|
||||
Enter(1);
|
||||
pout(LIGHTRED, BLACK, (char *) Language(95));
|
||||
poutCR(LIGHTBLUE, BLACK, sFirst);
|
||||
|
||||
/* Right: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(96));
|
||||
poutCR(LIGHTBLUE, BLACK, sSecond);
|
||||
|
||||
/* Left: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(95));
|
||||
poutCR(LIGHTBLUE, BLACK, sThird);
|
||||
|
||||
Enter(1);
|
||||
/* Attempt to open safe with this combination [Y/n]: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(97));
|
||||
fflush(stdout);
|
||||
alarm_on();
|
||||
i = toupper(Getone());
|
||||
sprintf(temp, "%c", i);
|
||||
|
||||
if ((i == Keystroke(97, 0)) || (i == 13)) {
|
||||
printf("\n\n");
|
||||
tries++;
|
||||
Syslog('+', "Attempt %d with combination %d %d %d", tries, iFirst, iSecond, iThird);
|
||||
|
||||
/* Left: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(95));
|
||||
for (iLoop = 0; iLoop < iFirst; iLoop++) {
|
||||
pout(YELLOW, BLACK, (char *)".");
|
||||
fflush(stdout);
|
||||
usleep(100000);
|
||||
}
|
||||
poutCR(LIGHTBLUE, BLACK, sFirst);
|
||||
|
||||
/* Right: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(96));
|
||||
for (iLoop = 0; iLoop < iSecond; iLoop++) {
|
||||
pout(YELLOW, BLACK, (char *)".");
|
||||
fflush(stdout);
|
||||
usleep(100000);
|
||||
}
|
||||
poutCR(LIGHTBLUE, BLACK, sSecond);
|
||||
|
||||
/* Left: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(95));
|
||||
for (iLoop = 0; iLoop < iThird; iLoop++) {
|
||||
pout(YELLOW, BLACK, (char *)".");
|
||||
fflush(stdout);
|
||||
usleep(100000);
|
||||
}
|
||||
poutCR(LIGHTBLUE, BLACK, sThird);
|
||||
|
||||
if(CFG.iSafeNumGen) {
|
||||
CFG.iSafeFirstDigit = (rand() % CFG.iSafeMaxNumber) + 1;
|
||||
CFG.iSafeSecondDigit = (rand() % CFG.iSafeMaxNumber) + 1;
|
||||
CFG.iSafeThirdDigit = (rand() % CFG.iSafeMaxNumber) + 1;
|
||||
}
|
||||
|
||||
if ((CFG.iSafeFirstDigit == iFirst) && (CFG.iSafeSecondDigit == iSecond) && (CFG.iSafeThirdDigit == iThird)) {
|
||||
|
||||
DisplayFile(CFG.sSafeOpened);
|
||||
cracked = TRUE;
|
||||
|
||||
Enter(1);
|
||||
/* You have won the following... */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(98));
|
||||
Enter(2);
|
||||
poutCR(LIGHTMAGENTA, BLACK, CFG.sSafePrize);
|
||||
Enter(1);
|
||||
|
||||
Syslog('!', "User opened Safe Cracker Door");
|
||||
|
||||
Pause();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Enter(1);
|
||||
pout(LIGHTGREEN, BLACK, (char *) Language(99));
|
||||
Enter(1);
|
||||
|
||||
if(CFG.iSafeNumGen) {
|
||||
Enter(1);
|
||||
/* The safe code was: */
|
||||
pout(LIGHTRED, BLACK, (char *) Language(100));
|
||||
Enter(2);
|
||||
colour(LIGHTRED, BLACK);
|
||||
|
||||
/* Left: */
|
||||
printf("%s%d\n", (char *) Language(95), CFG.iSafeFirstDigit);
|
||||
|
||||
/* Right */
|
||||
printf("%s%d\n", (char *) Language(96), CFG.iSafeSecondDigit);
|
||||
|
||||
/* Left */
|
||||
printf("%s%d\n", (char *) Language(95), CFG.iSafeThirdDigit);
|
||||
}
|
||||
|
||||
Enter(1);
|
||||
/* Please press key to continue */
|
||||
pout(LIGHTGREEN, BLACK, (char *) Language(87));
|
||||
alarm_on();
|
||||
getchar();
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Returns true when safe already cracked or maximum trys exceeded
|
||||
*/
|
||||
int SafeCheckUser(int init)
|
||||
{
|
||||
char *File, *Name, *Date;
|
||||
|
||||
File = calloc(PATH_MAX, sizeof(char));
|
||||
Name = calloc(50, sizeof(char));
|
||||
Date = calloc(50, sizeof(char));
|
||||
|
||||
sprintf(Name, "%s", exitinfo.sUserName);
|
||||
sprintf(Date, "%s", (char *) GetDateDMY());
|
||||
sprintf(File, "%s/etc/safe.data", getenv("MBSE_ROOT"));
|
||||
|
||||
if ((pSafe = fopen(File, "r+")) == NULL) {
|
||||
if ((pSafe = fopen(File, "w")) != NULL) {
|
||||
safehdr.hdrsize = sizeof(safehdr);
|
||||
safehdr.recsize = sizeof(safe);
|
||||
fwrite(&safehdr, sizeof(safehdr), 1, pSafe);
|
||||
sprintf(safe.Date, "%s", (char *) GetDateDMY());
|
||||
sprintf(safe.Name, "%s", Name);
|
||||
safe.Trys = 0;
|
||||
safe.Opened = FALSE;
|
||||
fwrite(&safe, sizeof(safe), 1, pSafe);
|
||||
fclose(pSafe);
|
||||
chmod(File, 0660);
|
||||
}
|
||||
} else {
|
||||
fread(&safehdr, sizeof(safehdr), 1, pSafe);
|
||||
/*
|
||||
* Check if safe already cracked
|
||||
*/
|
||||
while (fread(&safe, safehdr.recsize, 1, pSafe) == 1) {
|
||||
if (safe.Opened) {
|
||||
fclose(pSafe);
|
||||
Syslog('+', "Safe is currently LOCKED - exiting door.");
|
||||
|
||||
/* THE SAFE IS CURRENTLY LOCKED */
|
||||
poutCR(WHITE, RED, (char *) Language(103));
|
||||
Enter(1);
|
||||
colour(LIGHTRED, BLACK);
|
||||
|
||||
/* has cracked the safe. */
|
||||
printf("%s, %s\n", safe.Name, (char *) Language(104));
|
||||
|
||||
/* The safe will remain locked until the sysop rewards the user. */
|
||||
pout(LIGHTGREEN, BLACK, (char *) Language(105));
|
||||
Enter(2);
|
||||
Pause();
|
||||
free(File);
|
||||
free(Name);
|
||||
free(Date);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
fseek(pSafe, safehdr.hdrsize, SEEK_SET);
|
||||
|
||||
/*
|
||||
* Check if this user is already in the database
|
||||
*/
|
||||
while (fread(&safe, safehdr.recsize, 1, pSafe) == 1) {
|
||||
if ((strcmp(Name, safe.Name)) == 0) {
|
||||
if ((strcmp(Date, safe.Date)) != 0) {
|
||||
/*
|
||||
* User found, but last time used is not today.
|
||||
* Reset this user.
|
||||
*/
|
||||
fseek(pSafe, - safehdr.recsize, SEEK_CUR);
|
||||
sprintf(safe.Date, "%s", (char *) GetDateDMY());
|
||||
safe.Trys = 0;
|
||||
tries = 0;
|
||||
safe.Opened = FALSE;
|
||||
fwrite(&safe, safehdr.recsize, 1, pSafe);
|
||||
fclose(pSafe);
|
||||
free(File);
|
||||
free(Name);
|
||||
free(Date);
|
||||
return FALSE;
|
||||
} else {
|
||||
/*
|
||||
* User found, last time is today, check attempts
|
||||
*/
|
||||
fseek(pSafe, - safehdr.recsize, SEEK_CUR);
|
||||
if (init)
|
||||
tries = safe.Trys;
|
||||
else {
|
||||
safe.Trys = tries;
|
||||
}
|
||||
safe.Opened = cracked;
|
||||
fwrite(&safe, safehdr.recsize, 1, pSafe);
|
||||
fclose(pSafe);
|
||||
free(File);
|
||||
free(Name);
|
||||
free(Date);
|
||||
if (safe.Trys >= CFG.iSafeMaxTrys) {
|
||||
Syslog('+', "Maximum trys per day exceeded");
|
||||
Enter(2);
|
||||
/* Maximum trys per day exceeded */
|
||||
pout(WHITE, BLACK, (char *) Language(106));
|
||||
Enter(1);
|
||||
sleep(3);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* User not found, append new record
|
||||
*/
|
||||
fclose(pSafe);
|
||||
if ((pSafe = fopen(File, "a")) == NULL) {
|
||||
WriteError("Can't append to %s", File);
|
||||
free(File);
|
||||
free(Name);
|
||||
free(Date);
|
||||
return TRUE;
|
||||
}
|
||||
fseek(pSafe, 0, SEEK_END);
|
||||
memset(&safe, 0, sizeof(safe));
|
||||
sprintf(safe.Date, "%s", (char *) GetDateDMY());
|
||||
sprintf(safe.Name, "%s", Name);
|
||||
safe.Trys = 0;
|
||||
safe.Opened = FALSE;
|
||||
tries = 0;
|
||||
fwrite(&safe, sizeof(safe), 1, pSafe);
|
||||
fclose(pSafe);
|
||||
Syslog('+', "Append new safe.data record");
|
||||
}
|
||||
|
||||
free(File);
|
||||
free(Name);
|
||||
free(Date);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
/* safe.h */
|
||||
|
||||
#ifndef _SAFE_H
|
||||
#define _SAFE_H
|
||||
|
||||
|
||||
void Safe(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -238,14 +238,6 @@ void WhosDoingWhat(int iStatus)
|
||||
case FILELIST: strcpy(temp, "List Files");
|
||||
break;
|
||||
|
||||
case TIMEBANK: strcpy(temp, "Time Bank");
|
||||
LC_Door = TRUE;
|
||||
break;
|
||||
|
||||
case SAFE: strcpy(temp, "Safe Cracker");
|
||||
LC_Door = TRUE;
|
||||
break;
|
||||
|
||||
case WHOSON: strcpy(temp, "View Whoson List");
|
||||
break;
|
||||
|
||||
|
@ -9,19 +9,19 @@ SRCS = grlist.c m_domain.c m_fgroup.c m_lang.c m_marea.c m_new.c \
|
||||
m_limits.c m_menu.c m_ngroup.c m_service.c m_tty.c mutil.c m_archive.c \
|
||||
m_fdb.c m_global.c m_magic.c m_mgroup.c m_node.c m_task.c m_users.c \
|
||||
screen.c m_bbs.c m_ff.c m_hatch.c m_mail.c m_modem.c m_ol.c m_tic.c \
|
||||
m_virus.c stlist.c m_bbslist.c m_safe.c m_route.c
|
||||
m_virus.c stlist.c m_bbslist.c m_route.c
|
||||
HDRS = grlist.h m_domain.h m_fgroup.h m_lang.h m_marea.h m_new.h m_protocol.h \
|
||||
m_ticarea.h mutil.h ledit.h m_farea.h m_fido.h m_limits.h m_menu.h \
|
||||
m_ngroup.h m_service.h m_tty.h screen.h m_archive.h m_fdb.h m_global.h \
|
||||
m_magic.h m_mgroup.h m_node.h m_task.h m_users.h stlist.h m_bbs.h m_ff.h \
|
||||
m_hatch.h m_mail.h m_modem.h m_ol.h m_tic.h m_virus.h m_bbslist.h m_safe.h \
|
||||
m_hatch.h m_mail.h m_modem.h m_ol.h m_tic.h m_virus.h m_bbslist.h \
|
||||
m_route.h
|
||||
OBJS = grlist.o m_domain.o m_fgroup.o m_lang.o m_marea.o m_new.o m_protocol.o \
|
||||
m_ticarea.o mbsetup.o ledit.o m_farea.o m_fido.o m_limits.o m_menu.o \
|
||||
m_ngroup.o m_service.o m_tty.o mutil.o m_archive.o m_fdb.o m_global.o \
|
||||
m_magic.o m_mgroup.o m_node.o m_task.o m_users.o screen.o m_bbs.o m_ff.o \
|
||||
m_hatch.o m_mail.o m_modem.o m_ol.o m_tic.o m_virus.o stlist.o m_bbslist.o \
|
||||
m_safe.o m_route.o
|
||||
m_route.o
|
||||
LIBS += ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a ../lib/libdbase.a
|
||||
OTHER = Makefile
|
||||
|
||||
@ -80,7 +80,7 @@ m_marea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/u
|
||||
m_new.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h grlist.h m_new.h m_lang.h m_marea.h m_ngroup.h
|
||||
m_protocol.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_protocol.h
|
||||
m_ticarea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h grlist.h m_global.h m_node.h m_fgroup.h m_farea.h m_archive.h m_ticarea.h
|
||||
mbsetup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h ledit.h m_global.h m_bbs.h m_farea.h m_fgroup.h m_mail.h m_mgroup.h m_hatch.h m_tic.h m_ticarea.h m_magic.h m_fido.h m_lang.h m_archive.h m_virus.h m_tty.h m_limits.h m_users.h m_node.h m_fdb.h m_new.h m_ol.h m_bbslist.h m_safe.h m_protocol.h m_ff.h m_modem.h m_marea.h m_ngroup.h m_service.h m_domain.h m_task.h m_route.h
|
||||
mbsetup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h ledit.h m_global.h m_bbs.h m_farea.h m_fgroup.h m_mail.h m_mgroup.h m_hatch.h m_tic.h m_ticarea.h m_magic.h m_fido.h m_lang.h m_archive.h m_virus.h m_tty.h m_limits.h m_users.h m_node.h m_fdb.h m_new.h m_ol.h m_bbslist.h m_protocol.h m_ff.h m_modem.h m_marea.h m_ngroup.h m_service.h m_domain.h m_task.h m_route.h
|
||||
ledit.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h screen.h mutil.h ledit.h
|
||||
m_farea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_fgroup.h m_archive.h m_farea.h m_fgroup.h m_ngroup.h
|
||||
m_fido.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_fido.h
|
||||
@ -99,7 +99,7 @@ m_node.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
|
||||
m_task.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_task.h
|
||||
m_users.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_lang.h m_global.h m_archive.h m_protocol.h m_users.h
|
||||
screen.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/ansi.h ../lib/common.h ../lib/clcomm.h screen.h
|
||||
m_bbs.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h screen.h mutil.h ledit.h m_lang.h m_protocol.h m_ol.h m_fgroup.h m_farea.h m_menu.h m_safe.h m_bbs.h m_bbslist.h m_limits.h
|
||||
m_bbs.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h screen.h mutil.h ledit.h m_lang.h m_protocol.h m_ol.h m_fgroup.h m_farea.h m_menu.h m_bbs.h m_bbslist.h m_limits.h
|
||||
m_ff.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h screen.h mutil.h ledit.h stlist.h m_global.h m_ff.h m_lang.h m_marea.h
|
||||
m_hatch.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_fgroup.h m_ticarea.h m_hatch.h
|
||||
m_mail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h screen.h mutil.h ledit.h m_global.h m_marea.h m_mgroup.h m_mail.h
|
||||
@ -109,6 +109,5 @@ m_tic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/com
|
||||
m_virus.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_virus.h
|
||||
stlist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h stlist.h
|
||||
m_bbslist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_bbslist.h
|
||||
m_safe.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_safe.h
|
||||
m_route.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h grlist.h m_node.h m_route.h
|
||||
# End of generated dependencies
|
||||
|
@ -2087,8 +2087,6 @@ char *getmenutype(int val)
|
||||
case 20: return (char *)"Display .A?? file with Enter";
|
||||
case 21: return (char *)"Display Text Only";
|
||||
|
||||
case 25: return (char *)"Safe cracker door";
|
||||
|
||||
case 101: return (char *)"Select new file area";
|
||||
case 102: return (char *)"List files in current area";
|
||||
case 103: return (char *)"View file contents";
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "m_fgroup.h"
|
||||
#include "m_farea.h"
|
||||
#include "m_menu.h"
|
||||
#include "m_safe.h"
|
||||
#include "m_bbs.h"
|
||||
#include "m_bbslist.h"
|
||||
#include "m_limits.h"
|
||||
@ -64,9 +63,8 @@ void bbs_menu(void)
|
||||
mvprintw(11, 6, "5. Edit Transfer Protocols");
|
||||
mvprintw(12, 6, "6. Edit BBS List Data");
|
||||
mvprintw(13, 6, "7. Edit Oneliners");
|
||||
mvprintw(14, 6, "8. Edit Safecracker Data");
|
||||
|
||||
switch(select_menu(8)) {
|
||||
switch(select_menu(7)) {
|
||||
case 0: return;
|
||||
|
||||
case 1: EditLimits();
|
||||
@ -89,9 +87,6 @@ void bbs_menu(void)
|
||||
|
||||
case 7: ol_menu();
|
||||
break;
|
||||
|
||||
case 8: EditSafe();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -545,55 +545,11 @@ void e_colors(void)
|
||||
|
||||
|
||||
|
||||
void e_safe_door(void)
|
||||
{
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 2, "1.9 EDIT SAFE DOOR");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 2, "1. Digit 1");
|
||||
mvprintw( 8, 2, "2. Digit 2");
|
||||
mvprintw( 9, 2, "3. Digit 3");
|
||||
mvprintw(10, 2, "4. Max trys");
|
||||
mvprintw(11, 2, "5. Max numb");
|
||||
mvprintw(12, 2, "6. Num gen");
|
||||
mvprintw(13, 2, "7. Prize");
|
||||
mvprintw(14, 2, "8. Welcome");
|
||||
mvprintw(15, 2, "9. Opened");
|
||||
for (;;) {
|
||||
set_color(WHITE, BLACK);
|
||||
show_int( 7,16, CFG.iSafeFirstDigit);
|
||||
show_int( 8,16, CFG.iSafeSecondDigit);
|
||||
show_int( 9,16, CFG.iSafeThirdDigit);
|
||||
show_int(10,16, CFG.iSafeMaxTrys);
|
||||
show_int(11,16, CFG.iSafeMaxNumber);
|
||||
show_bool(12,16, CFG.iSafeNumGen);
|
||||
show_str(13,16,64, CFG.sSafePrize);
|
||||
show_str(14,16,64, CFG.sSafeWelcome);
|
||||
show_str(15,16,64, CFG.sSafeOpened);
|
||||
|
||||
switch(select_menu(9)) {
|
||||
case 0: return;
|
||||
case 1: E_INT( 7,16, CFG.iSafeFirstDigit, "Enter ^first^ digit of the safe")
|
||||
case 2: E_INT( 8,16, CFG.iSafeSecondDigit, "Enter ^second^ digit of the safe")
|
||||
case 3: E_INT( 9,16, CFG.iSafeThirdDigit, "Enter ^third^ digit of the safe")
|
||||
case 4: E_INT( 10,16, CFG.iSafeMaxTrys, "Maximum ^trys^ per day")
|
||||
case 5: E_INT( 11,16, CFG.iSafeMaxNumber, "^Maximum number^ of each digit")
|
||||
case 6: E_BOOL(12,16, CFG.iSafeNumGen, "^Automatic^ number generation")
|
||||
case 7: E_STR( 13,16,64, CFG.sSafePrize, "The ^prize^ the user wins when he opens the safe")
|
||||
case 8: E_STR( 14,16,64, CFG.sSafeWelcome, "The ^welcome^ screen for the safe door")
|
||||
case 9: E_STR( 15,16,64, CFG.sSafeOpened, "The file to display when the safe is ^opened^")
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
void e_paging(void)
|
||||
{
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 2, "1.10 EDIT SYSOP PAGING");
|
||||
mvprintw( 5, 2, "1.9 EDIT SYSOP PAGING");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 2, "1. Ext. Chat");
|
||||
mvprintw( 8, 2, "2. Chat Device");
|
||||
@ -697,7 +653,7 @@ void e_flags(int Users)
|
||||
if (Users)
|
||||
mvprintw( 5, 6, "1.6 EDIT USER FLAG DESCRIPTIONS");
|
||||
else
|
||||
mvprintw( 5, 6, "1.18 EDIT MANAGER FLAG DESCRIPTIONS");
|
||||
mvprintw( 5, 6, "1.17 EDIT MANAGER FLAG DESCRIPTIONS");
|
||||
|
||||
set_color(CYAN, BLACK);
|
||||
for (i = 0; i < 32; i++) {
|
||||
@ -767,7 +723,7 @@ void e_ticconf(void)
|
||||
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 6, "1.11 EDIT FILEECHO PROCESSING");
|
||||
mvprintw( 5, 6, "1.10 EDIT FILEECHO PROCESSING");
|
||||
set_color(CYAN, BLACK);
|
||||
|
||||
mvprintw( 7, 2, "1. Keep days");
|
||||
@ -859,7 +815,7 @@ void s_fidomailcfg(void)
|
||||
{
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 5, "1.12 EDIT FIDONET MAIL AND ECHOMAIL PROCESSING");
|
||||
mvprintw( 5, 5, "1.11 EDIT FIDONET MAIL AND ECHOMAIL PROCESSING");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 2, "1. Badboard");
|
||||
mvprintw( 8, 2, "2. Dupeboard");
|
||||
@ -967,7 +923,7 @@ void s_intmailcfg(void)
|
||||
{
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 5, "1.13 EDIT INTERNET MAIL AND NEWS PROCESSING");
|
||||
mvprintw( 5, 5, "1.12 EDIT INTERNET MAIL AND NEWS PROCESSING");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 2, "1. POP3 node");
|
||||
mvprintw( 8, 2, "2. SMTP node");
|
||||
@ -1036,7 +992,7 @@ void e_uucp(void)
|
||||
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 6, "1.13 EDIT UUCP GATEWAY");
|
||||
mvprintw( 5, 6, "1.12 EDIT UUCP GATEWAY");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 6, "1. Zone");
|
||||
mvprintw( 8, 6, "2. Net");
|
||||
@ -1090,7 +1046,7 @@ void e_intmailcfg(void)
|
||||
case 6: E_STR( 12,16,15, CFG.nntpuser, "The ^Username^ for the NNTP server if needed.")
|
||||
case 7: E_STR( 13,16,15, CFG.nntppass, "The ^Password^ for the NNTP server if needed.")
|
||||
case 8: E_INT( 14,16, CFG.nntpdupes, "The number of ^dupes^ to store in the news articles dupes database.")
|
||||
case 9: tmp = PickAka((char *)"1.15.9", FALSE);
|
||||
case 9: tmp = PickAka((char *)"1.13.9", FALSE);
|
||||
if (tmp != -1)
|
||||
CFG.EmailFidoAka = CFG.aka[tmp];
|
||||
s_intmailcfg();
|
||||
@ -1120,7 +1076,7 @@ void s_newfiles(void)
|
||||
{
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 2, "1.14 ALLFILES & NEWFILES LISTINGS");
|
||||
mvprintw( 5, 2, "1.13 ALLFILES & NEWFILES LISTINGS");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 2, "1. New days");
|
||||
mvprintw( 8, 2, "2. Security");
|
||||
@ -1143,7 +1099,7 @@ void e_newfiles(void)
|
||||
switch(select_menu(3)) {
|
||||
case 0: return;
|
||||
case 1: E_INT(7,16, CFG.newdays, "Add files younger than this in newfiles report.")
|
||||
case 2: E_SEC(8,16, CFG.security, "1.16 NEWFILES REPORTS SECURITY", s_newfiles)
|
||||
case 2: E_SEC(8,16, CFG.security, "1.13 NEWFILES REPORTS SECURITY", s_newfiles)
|
||||
case 3: temp = CFG.new_groups;
|
||||
temp = edit_int( 9, 16, temp, (char *)"The maximum of ^newfiles^ groups in the newfiles database");
|
||||
if (temp < CountNewfiles()) {
|
||||
@ -1311,7 +1267,7 @@ void s_mailer(void)
|
||||
{
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 2, "1.15 EDIT MAILER SETTINGS");
|
||||
mvprintw( 5, 2, "1.14 EDIT MAILER SETTINGS");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 2, "1. Mailer logl.");
|
||||
mvprintw( 8, 2, "2. Default phone");
|
||||
@ -1346,7 +1302,7 @@ void e_trans(int start)
|
||||
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 6, "1.15 EDIT PHONE TRANSLATION");
|
||||
mvprintw( 5, 6, "1.14 EDIT PHONE TRANSLATION");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 12, "String to match String to replace");
|
||||
for (i = 0; i < 10; i++) {
|
||||
@ -1398,7 +1354,7 @@ void e_mailer(void)
|
||||
|
||||
switch(select_menu(23)) {
|
||||
case 0: return;
|
||||
case 1: E_LOGL(CFG.cico_loglevel, "1.15.1", s_mailer)
|
||||
case 1: E_LOGL(CFG.cico_loglevel, "1.14.1", s_mailer)
|
||||
case 2: E_STR( 8,23,20,CFG.Phone, "The mailer default ^phone number^ for this system")
|
||||
case 3: E_STR( 9,23,30,CFG.Flags, "The mailer ^TCP/IP capability flags^ for this system")
|
||||
case 4: E_INT( 10,23, CFG.Speed, "The mailer ^default linespeed^ for this system")
|
||||
@ -1434,7 +1390,7 @@ void e_ftpd(void)
|
||||
{
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 2, "1.16 EDIT FTPD SETTINGS");
|
||||
mvprintw( 5, 2, "1.15 EDIT FTPD SETTINGS");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 2, "1. Upload pth");
|
||||
mvprintw( 8, 2, "2. Banner msg");
|
||||
@ -1510,7 +1466,7 @@ void e_html(void)
|
||||
{
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 2, "1.17 EDIT HTML SETTINGS");
|
||||
mvprintw( 5, 2, "1.16 EDIT HTML SETTINGS");
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 2, "1. Docs root");
|
||||
mvprintw( 8, 2, "2. Link to ftp");
|
||||
@ -1628,19 +1584,18 @@ void global_menu(void)
|
||||
mvprintw(12, 6, "6. Edit User flag Descriptions");
|
||||
mvprintw(13, 6, "7. Edit New Users defaults");
|
||||
mvprintw(14, 6, "8. Edit Text Colors");
|
||||
mvprintw(15, 6, "9. Edit Safe Door");
|
||||
mvprintw(16, 6, "10. Edit Sysop Paging");
|
||||
mvprintw(15, 6, "9. Edit Sysop Paging");
|
||||
|
||||
mvprintw( 7,46, "11. Edit Files Processing");
|
||||
mvprintw( 8,46, "12. Edit Fidonet Mail/Echomail");
|
||||
mvprintw( 9,46, "13. Edit Internet Mail/News");
|
||||
mvprintw(10,46, "14. Edit All-/Newfiles lists");
|
||||
mvprintw(11,46, "15. Edit Mailer global setup");
|
||||
mvprintw(12,46, "16. Edit Ftp daemon setup");
|
||||
mvprintw(13,46, "17. Edit HTML pages setup");
|
||||
mvprintw(14,46, "18. Edit Mgr flag descriptions");
|
||||
mvprintw( 7,46, "10. Edit Files Processing");
|
||||
mvprintw( 8,46, "11. Edit Fidonet Mail/Echomail");
|
||||
mvprintw( 9,46, "12. Edit Internet Mail/News");
|
||||
mvprintw(10,46, "13. Edit All-/Newfiles lists");
|
||||
mvprintw(11,46, "14. Edit Mailer global setup");
|
||||
mvprintw(12,46, "15. Edit Ftp daemon setup");
|
||||
mvprintw(13,46, "16. Edit HTML pages setup");
|
||||
mvprintw(14,46, "17. Edit Mgr flag descriptions");
|
||||
|
||||
switch(select_menu(18)) {
|
||||
switch(select_menu(17)) {
|
||||
case 0:
|
||||
crc1 = 0xffffffff;
|
||||
crc1 = upd_crc32((char *)&CFG, crc1, sizeof(CFG));
|
||||
@ -1677,33 +1632,30 @@ void global_menu(void)
|
||||
e_colors();
|
||||
break;
|
||||
case 9:
|
||||
e_safe_door();
|
||||
break;
|
||||
case 10:
|
||||
e_paging();
|
||||
break;
|
||||
case 11:
|
||||
case 10:
|
||||
e_ticconf();
|
||||
break;
|
||||
case 12:
|
||||
case 11:
|
||||
e_fidomailcfg();
|
||||
break;
|
||||
case 13:
|
||||
case 12:
|
||||
e_intmailcfg();
|
||||
break;
|
||||
case 14:
|
||||
case 13:
|
||||
e_newfiles();
|
||||
break;
|
||||
case 15:
|
||||
case 14:
|
||||
e_mailer();
|
||||
break;
|
||||
case 16:
|
||||
case 15:
|
||||
e_ftpd();
|
||||
break;
|
||||
case 17:
|
||||
case 16:
|
||||
e_html();
|
||||
break;
|
||||
case 18:
|
||||
case 17:
|
||||
e_flags(FALSE);
|
||||
break;
|
||||
}
|
||||
@ -1927,20 +1879,8 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " File description %s on %s\n", get_color(CFG.FiledescF), get_color(CFG.FiledescB));
|
||||
fprintf(fp, " Message input %s on %s\n", get_color(CFG.MsgInputColourF), get_color(CFG.MsgInputColourB));
|
||||
|
||||
addtoc(fp, toc, 1, 10, page, (char *)"Safecracker door");
|
||||
|
||||
fprintf(fp, " Digit nr 1 %d\n", CFG.iSafeFirstDigit);
|
||||
fprintf(fp, " Digit nr 2 %d\n", CFG.iSafeSecondDigit);
|
||||
fprintf(fp, " Digit nr 3 %d\n", CFG.iSafeThirdDigit);
|
||||
fprintf(fp, " Maximum tries %d\n", CFG.iSafeMaxTrys);
|
||||
fprintf(fp, " Maximum number %d\n", CFG.iSafeMaxNumber);
|
||||
fprintf(fp, " Show generator %s\n", getboolean(CFG.iSafeNumGen));
|
||||
fprintf(fp, " Prize %s\n", CFG.sSafePrize);
|
||||
fprintf(fp, " Safe welcome %s\n", CFG.sSafeWelcome);
|
||||
fprintf(fp, " Safe opened file %s\n", CFG.sSafeOpened);
|
||||
|
||||
page = newpage(fp, page);
|
||||
addtoc(fp, toc, 1, 11, page, (char *)"Sysop paging");
|
||||
addtoc(fp, toc, 1, 10, page, (char *)"Sysop paging");
|
||||
|
||||
fprintf(fp, " Ext. Chat program %s\n", CFG.sExternalChat);
|
||||
fprintf(fp, " Chat device %s\n", CFG.sChatDevice);
|
||||
@ -1964,7 +1904,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " Friday %s %s\n", CFG.cStartTime[5], CFG.cStopTime[5]);
|
||||
fprintf(fp, " Saterday %s %s\n", CFG.cStartTime[6], CFG.cStopTime[6]);
|
||||
|
||||
addtoc(fp, toc, 1, 12, page, (char *)"Fileecho processing");
|
||||
addtoc(fp, toc, 1, 11, page, (char *)"Fileecho processing");
|
||||
|
||||
fprintf(fp, " Keep days on hold %d\n", CFG.tic_days);
|
||||
fprintf(fp, " Hatch password %s\n", CFG.hatchpasswd);
|
||||
@ -1983,7 +1923,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " FileMgr: pause %s\n", getboolean(CFG.ct_Pause));
|
||||
|
||||
page = newpage(fp, page);
|
||||
addtoc(fp, toc, 1, 13, page, (char *)"Fidonet Mail and Echomail processing");
|
||||
addtoc(fp, toc, 1, 12, page, (char *)"Fidonet Mail and Echomail processing");
|
||||
|
||||
fprintf(fp, " Max .pkt size %d Kb.\n", CFG.maxpktsize);
|
||||
fprintf(fp, " Max archive size %d Kb.\n", CFG.maxarcsize);
|
||||
@ -2003,7 +1943,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " AreaMgr: passwd %s\n", getboolean(CFG.ca_Passwd));
|
||||
fprintf(fp, " AreaMgr: pause %s\n", getboolean(CFG.ca_Pause));
|
||||
|
||||
addtoc(fp, toc, 1, 14, page, (char *)"Internet Mail and News processing");
|
||||
addtoc(fp, toc, 1, 13, page, (char *)"Internet Mail and News processing");
|
||||
|
||||
fprintf(fp, " Split messages at %d KBytes\n", CFG.new_split);
|
||||
fprintf(fp, " Force split at %d KBytes\n", CFG.new_force);
|
||||
@ -2029,14 +1969,14 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " Allow control msgs %s\n", getboolean(CFG.allowcontrol));
|
||||
fprintf(fp, " Don't regate msgs %s\n", getboolean(CFG.dontregate));
|
||||
|
||||
addtoc(fp, toc, 1, 15, page, (char *)"Newfile reports");
|
||||
addtoc(fp, toc, 1, 14, page, (char *)"Newfile reports");
|
||||
|
||||
fprintf(fp, " New files days %d\n", CFG.newdays);
|
||||
fprintf(fp, " Highest sec. level %s\n", get_secstr(CFG.security));
|
||||
fprintf(fp, " Max. newfile grps %ld\n", CFG.new_groups);
|
||||
|
||||
page = newpage(fp, page);
|
||||
addtoc(fp, toc, 1, 16, page, (char *)"Mailer setup");
|
||||
addtoc(fp, toc, 1, 15, page, (char *)"Mailer setup");
|
||||
|
||||
p = getloglevel(CFG.cico_loglevel);
|
||||
fprintf(fp, " Mailer loglevel %s\n", p);
|
||||
@ -2063,7 +2003,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " Translate %-20s %s\n", CFG.phonetrans[i].match, CFG.phonetrans[i].repl);
|
||||
|
||||
page = newpage(fp, page);
|
||||
addtoc(fp, toc, 1, 17, page, (char *)"FTP server setup");
|
||||
addtoc(fp, toc, 1, 16, page, (char *)"FTP server setup");
|
||||
|
||||
fprintf(fp, " Connections limit %d\n", CFG.ftp_limit);
|
||||
fprintf(fp, " Login fails %d\n", CFG.ftp_loginfails);
|
||||
@ -2083,7 +2023,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " Path filter %s\n", CFG.ftp_pth_filter);
|
||||
fprintf(fp, " Path message %s\n", CFG.ftp_pth_message);
|
||||
|
||||
addtoc(fp, toc, 1, 18, page, (char *)"WWW server setup");
|
||||
addtoc(fp, toc, 1, 17, page, (char *)"WWW server setup");
|
||||
|
||||
fprintf(fp, " HTML root %s\n", CFG.www_root);
|
||||
fprintf(fp, " Link to FTP base %s\n", CFG.www_link2ftp);
|
||||
@ -2094,7 +2034,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " File per webpage %d\n", CFG.www_files_page);
|
||||
|
||||
page = newpage(fp, page);
|
||||
addtoc(fp, toc, 1,19, page, (char *)"Manager flag descriptions");
|
||||
addtoc(fp, toc, 1,18, page, (char *)"Manager flag descriptions");
|
||||
fprintf(fp, " 1 1 2 2 3 3\n");
|
||||
fprintf(fp, " 1 5 0 5 0 5 0 2\n");
|
||||
fprintf(fp, " --------------------------------\n");
|
||||
|
@ -136,13 +136,13 @@ void Show_A_Menu(void)
|
||||
S_COL(15,16, "Normal display color", le_int(menus.ForeGnd), le_int(menus.BackGnd))
|
||||
S_COL(16,16, "Bright display color", le_int(menus.HiForeGnd), le_int(menus.HiBackGnd))
|
||||
set_color(WHITE, BLACK);
|
||||
show_bool(17,16, menus.AutoExec);
|
||||
show_bool(17,16, le_int(menus.AutoExec));
|
||||
if (le_int(menus.MenuType) == 7) {
|
||||
show_bool(13,58, menus.NoDoorsys);
|
||||
show_bool(14,58, menus.Y2Kdoorsys);
|
||||
show_bool(15,58, menus.Comport);
|
||||
show_bool(16,58, menus.NoSuid);
|
||||
show_bool(17,58, menus.NoPrompt);
|
||||
show_bool(13,58, le_int(menus.NoDoorsys));
|
||||
show_bool(14,58, le_int(menus.Y2Kdoorsys));
|
||||
show_bool(15,58, le_int(menus.Comport));
|
||||
show_bool(16,58, le_int(menus.NoSuid));
|
||||
show_bool(17,58, le_int(menus.NoPrompt));
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ int GetMenuType(void)
|
||||
mvprintw(12, 6, "6. BBS List menus");
|
||||
|
||||
switch (select_menu(6)) {
|
||||
case 1: return GetSubmenu(1, 25);
|
||||
case 1: return GetSubmenu(1, 21);
|
||||
case 2: return GetSubmenu(101, 19);
|
||||
case 3: return GetSubmenu(201, 21);
|
||||
case 4: return GetSubmenu(301, 19);
|
||||
@ -254,25 +254,38 @@ void Edit_A_Menu(void)
|
||||
menus.HiBackGnd = le_int(bg);
|
||||
Show_A_Menu();
|
||||
break;
|
||||
case 10:E_BOOL(17,16, menus.AutoExec, "Is this an ^Autoexecute^ menu item")
|
||||
case 10:temp = le_int(menus.AutoExec);
|
||||
temp = edit_bool(17,16, temp, (char *)"Is this an ^Autoexecute^ menu item");
|
||||
menus.AutoExec = le_int(temp);
|
||||
break;
|
||||
case 11:if (le_int(menus.MenuType) == 7) {
|
||||
E_BOOL(13,58, menus.NoDoorsys, "Suppress writing ^door.sys^ dropfile")
|
||||
temp = le_int(menus.NoDoorsys);
|
||||
temp = edit_bool(13,58, temp, (char *)"Suppress writing ^door.sys^ dropfile");
|
||||
menus.NoDoorsys = le_int(temp);
|
||||
} else
|
||||
break;
|
||||
case 12:if (le_int(menus.MenuType) == 7) {
|
||||
E_BOOL(14,58, menus.Y2Kdoorsys, "Create ^door.sys^ with 4 digit yearnumbers")
|
||||
temp = le_int(menus.Y2Kdoorsys);
|
||||
temp = edit_bool(14,58, temp, (char *)"Create ^door.sys^ with 4 digit yearnumbers");
|
||||
menus.Y2Kdoorsys = le_int(temp);
|
||||
} else
|
||||
break;
|
||||
case 13:if (le_int(menus.MenuType) == 7) {
|
||||
E_BOOL(15,58, menus.Comport, "Write real ^COM port^ in door.sys for Vmodem patch")
|
||||
temp = le_int(menus.Comport);
|
||||
temp = edit_bool(15,58, temp, (char *)"Write real ^COM port^ in door.sys for Vmodem patch");
|
||||
menus.Comport = le_int(temp);
|
||||
} else
|
||||
break;
|
||||
case 14:if (le_int(menus.MenuType) == 7) {
|
||||
E_BOOL(16,58, menus.NoSuid, "Run the door as ^real user (nosuid)^")
|
||||
temp = le_int(menus.NoSuid);
|
||||
temp = edit_bool(16,58, temp, (char *)"Run the door as ^real user (nosuid)^");
|
||||
menus.NoSuid = le_int(temp);
|
||||
} else
|
||||
break;
|
||||
case 15:if (le_int(menus.MenuType) == 7) {
|
||||
E_BOOL(17,58, menus.NoPrompt, "^Don't display prompt^ when door is finished")
|
||||
temp = le_int(menus.NoPrompt);
|
||||
temp = edit_bool(17,58, temp, (char *)"^Don't display prompt^ when door is finished");
|
||||
menus.NoPrompt = le_int(temp);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
@ -326,7 +339,7 @@ void EditMenu(char *Name)
|
||||
if (menus.MenuKey[0] || menus.AutoExec) {
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw(y, 5, "%3d. ", o + i);
|
||||
if (menus.AutoExec) {
|
||||
if (le_int(menus.AutoExec)) {
|
||||
set_color(LIGHTRED, BLACK);
|
||||
mvprintw(y, 10, "a");
|
||||
set_color(CYAN, BLACK);
|
||||
@ -334,10 +347,12 @@ void EditMenu(char *Name)
|
||||
mvprintw(y, 10, "%1s", menus.MenuKey);
|
||||
}
|
||||
if (le_int(menus.MenuType) == 999 ) {
|
||||
mvprintw(y, 12, "%-29s %5d %s", menus.TypeDesc, le_int(menus.MenuSecurity.level), menus.Display);
|
||||
sprintf(temp, "%-29s %5d %s", menus.TypeDesc, le_int(menus.MenuSecurity.level), menus.Display);
|
||||
} else {
|
||||
mvprintw(y, 12, "%-29s %5d %s", menus.TypeDesc, le_int(menus.MenuSecurity.level), menus.OptionalData);
|
||||
sprintf(temp, "%-29s %5d %s", menus.TypeDesc, le_int(menus.MenuSecurity.level), menus.OptionalData);
|
||||
}
|
||||
temp[68] = '\0';
|
||||
mvprintw(y, 12, temp);
|
||||
} else {
|
||||
set_color(LIGHTBLUE, BLACK);
|
||||
mvprintw(y, 5, "%3d.", o + i);
|
||||
@ -588,7 +603,7 @@ int bbs_menu_doc(FILE *fp, FILE *toc, int page)
|
||||
while (fread(&menus, sizeof(menus), 1, mn) == 1) {
|
||||
if (menus.MenuKey[0])
|
||||
fprintf(fp, " Menu select %s\n", menus.MenuKey);
|
||||
if (menus.AutoExec)
|
||||
if (le_int(menus.AutoExec))
|
||||
fprintf(fp, " Menu select Autoexec\n");
|
||||
fprintf(fp, " Type %d %s\n", le_int(menus.MenuType), menus.TypeDesc);
|
||||
fprintf(fp, " Opt. data %s\n", menus.OptionalData);
|
||||
@ -601,11 +616,11 @@ int bbs_menu_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " Hi-colors %s on %s\n",
|
||||
get_color(le_int(menus.HiForeGnd)), get_color(le_int(menus.HiBackGnd)));
|
||||
if (le_int(menus.MenuType) == 7) {
|
||||
fprintf(fp, " No door.sys %s\n", getboolean(menus.NoDoorsys));
|
||||
fprintf(fp, " Y2K door.sys %s\n", getboolean(menus.Y2Kdoorsys));
|
||||
fprintf(fp, " Use COM port %s\n", getboolean(menus.Comport));
|
||||
fprintf(fp, " No setuid %s\n", getboolean(menus.NoSuid));
|
||||
fprintf(fp, " No Prompt %s\n", getboolean(menus.NoPrompt));
|
||||
fprintf(fp, " No door.sys %s\n", getboolean(le_int(menus.NoDoorsys)));
|
||||
fprintf(fp, " Y2K door.sys %s\n", getboolean(le_int(menus.Y2Kdoorsys)));
|
||||
fprintf(fp, " Use COM port %s\n", getboolean(le_int(menus.Comport)));
|
||||
fprintf(fp, " No setuid %s\n", getboolean(le_int(menus.NoSuid)));
|
||||
fprintf(fp, " No Prompt %s\n", getboolean(le_int(menus.NoPrompt)));
|
||||
}
|
||||
fprintf(fp, "\n\n");
|
||||
j++;
|
||||
|
349
mbsetup/m_safe.c
349
mbsetup/m_safe.c
@ -1,349 +0,0 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
* Purpose ...............: Setup Safecracker Data
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
* 1971 BV IJmuiden
|
||||
* the Netherlands
|
||||
*
|
||||
* This file is part of MBSE safe.
|
||||
*
|
||||
* This safe is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* MB safe is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MB safe; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../config.h"
|
||||
#include "../lib/libs.h"
|
||||
#include "../lib/memwatch.h"
|
||||
#include "../lib/structs.h"
|
||||
#include "../lib/users.h"
|
||||
#include "../lib/records.h"
|
||||
#include "../lib/common.h"
|
||||
#include "../lib/clcomm.h"
|
||||
#include "screen.h"
|
||||
#include "mutil.h"
|
||||
#include "ledit.h"
|
||||
#include "m_global.h"
|
||||
#include "m_safe.h"
|
||||
|
||||
|
||||
|
||||
int SafeUpdated = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Count nr of safecracker records in the database.
|
||||
* Creates the database if it doesn't exist.
|
||||
*/
|
||||
int CountSafe(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[PATH_MAX];
|
||||
int count;
|
||||
|
||||
sprintf(ffile, "%s/etc/safe.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "created new %s", ffile);
|
||||
safehdr.hdrsize = sizeof(safehdr);
|
||||
safehdr.recsize = sizeof(safe);
|
||||
fwrite(&safehdr, sizeof(safehdr), 1, fil);
|
||||
fclose(fil);
|
||||
chmod(ffile, 0660);
|
||||
return 0;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
fread(&safehdr, sizeof(safehdr), 1, fil);
|
||||
|
||||
while (fread(&safe, safehdr.recsize, 1, fil) == 1) {
|
||||
count++;
|
||||
}
|
||||
fclose(fil);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Open database for editing. The datafile is copied, if the format
|
||||
* is changed it will be converted on the fly. All editing must be
|
||||
* done on the copied file.
|
||||
*/
|
||||
int OpenSafe(void);
|
||||
int OpenSafe(void)
|
||||
{
|
||||
FILE *fin, *fout;
|
||||
char fnin[PATH_MAX], fnout[PATH_MAX];
|
||||
long oldsize;
|
||||
|
||||
sprintf(fnin, "%s/etc/safe.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fnout, "%s/etc/safe.temp", getenv("MBSE_ROOT"));
|
||||
if ((fin = fopen(fnin, "r")) != NULL) {
|
||||
if ((fout = fopen(fnout, "w")) != NULL) {
|
||||
fread(&safehdr, sizeof(safehdr), 1, fin);
|
||||
/*
|
||||
* In case we are automaic upgrading the data format
|
||||
* we save the old format. If it is changed, the
|
||||
* database must always be updated.
|
||||
*/
|
||||
oldsize = safehdr.recsize;
|
||||
if (oldsize != sizeof(safe)) {
|
||||
SafeUpdated = 1;
|
||||
Syslog('+', "Upgraded %s, format changed", fnin);
|
||||
} else
|
||||
SafeUpdated = 0;
|
||||
safehdr.hdrsize = sizeof(safehdr);
|
||||
safehdr.recsize = sizeof(safe);
|
||||
fwrite(&safehdr, sizeof(safehdr), 1, fout);
|
||||
|
||||
/*
|
||||
* The datarecord is filled with zero's before each
|
||||
* read, so if the format changed, the new fields
|
||||
* will be empty.
|
||||
*/
|
||||
memset(&safe, 0, sizeof(safe));
|
||||
while (fread(&safe, oldsize, 1, fin) == 1) {
|
||||
fwrite(&safe, sizeof(safe), 1, fout);
|
||||
memset(&safe, 0, sizeof(safe));
|
||||
}
|
||||
|
||||
fclose(fin);
|
||||
fclose(fout);
|
||||
return 0;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CloseSafe(int);
|
||||
void CloseSafe(int force)
|
||||
{
|
||||
char fin[PATH_MAX], fout[PATH_MAX];
|
||||
|
||||
sprintf(fin, "%s/etc/safe.data", getenv("MBSE_ROOT"));
|
||||
sprintf(fout,"%s/etc/safe.temp", getenv("MBSE_ROOT"));
|
||||
|
||||
if (SafeUpdated == 1) {
|
||||
if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
|
||||
working(1, 0, 0);
|
||||
if ((rename(fout, fin)) == 0)
|
||||
unlink(fout);
|
||||
chmod(fin, 0660);
|
||||
Syslog('+', "Updated \"safe.data\"");
|
||||
return;
|
||||
}
|
||||
}
|
||||
chmod(fin, 0660);
|
||||
working(1, 0, 0);
|
||||
unlink(fout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Edit one record, return -1 if there are errors, 0 if ok.
|
||||
*/
|
||||
int EditSafeRec(int Area)
|
||||
{
|
||||
FILE *fil;
|
||||
char mfile[PATH_MAX];
|
||||
long offset;
|
||||
int j, Open;
|
||||
unsigned long crc, crc1;
|
||||
|
||||
clr_index();
|
||||
working(1, 0, 0);
|
||||
IsDoing("Edit Safe");
|
||||
|
||||
sprintf(mfile, "%s/etc/safe.temp", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(mfile, "r")) == NULL) {
|
||||
working(2, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
offset = sizeof(safehdr) + ((Area -1) * sizeof(safe));
|
||||
if (fseek(fil, offset, 0) != 0) {
|
||||
working(2, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fread(&safe, sizeof(safe), 1, fil);
|
||||
fclose(fil);
|
||||
crc = 0xffffffff;
|
||||
crc = upd_crc32((char *)&safe, crc, sizeof(safe));
|
||||
working(0, 0, 0);
|
||||
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 5, "8.8 EDIT safe");
|
||||
set_color(CYAN, BLACK);
|
||||
|
||||
mvprintw( 7, 5, "1. Name");
|
||||
mvprintw( 8, 5, "2. Date");
|
||||
mvprintw( 9, 5, "3. Tries");
|
||||
mvprintw(10, 5, "4. Opended");
|
||||
|
||||
for (;;) {
|
||||
set_color(WHITE, BLACK);
|
||||
show_str( 7,17,35, safe.Name);
|
||||
show_str( 8,17,10, safe.Date);
|
||||
show_int( 9,17, safe.Trys);
|
||||
show_bool(10,17, safe.Opened);
|
||||
|
||||
j = select_menu(4);
|
||||
switch(j) {
|
||||
case 0: crc1 = 0xffffffff;
|
||||
crc1 = upd_crc32((char *)&safe, crc1, sizeof(safe));
|
||||
if (crc != crc1) {
|
||||
if (yes_no((char *)"Record is changed, save") == 1) {
|
||||
working(1, 0, 0);
|
||||
if ((fil = fopen(mfile, "r+")) == NULL) {
|
||||
working(2, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
fseek(fil, offset, 0);
|
||||
fwrite(&safe, sizeof(safe), 1, fil);
|
||||
fclose(fil);
|
||||
SafeUpdated = 1;
|
||||
working(1, 0, 0);
|
||||
working(0, 0, 0);
|
||||
}
|
||||
}
|
||||
IsDoing("Browsing Menu");
|
||||
return 0;
|
||||
case 1: E_STR( 7,17,35, safe.Name, "The Safecrackers ^Username^")
|
||||
case 2: E_STR( 8,17,10, safe.Date, "The ^last date^ attempt to open the safe (DD-MM-YYYY)")
|
||||
case 3: E_INT( 9,17, safe.Trys, "The ^number of tries^ for today to open the safe")
|
||||
case 4: Open = edit_bool(10,17, safe.Opened, (char *)"Set or reset the safe ^cracked^ status");
|
||||
if (safe.Opened && !Open) {
|
||||
safe.Opened = FALSE;
|
||||
safe.Trys = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EditSafe(void)
|
||||
{
|
||||
int records, i, x, y, o;
|
||||
char pick[12];
|
||||
FILE *fil;
|
||||
char temp[PATH_MAX];
|
||||
long offset;
|
||||
|
||||
clr_index();
|
||||
working(1, 0, 0);
|
||||
IsDoing("Browsing Menu");
|
||||
if (config_read() == -1) {
|
||||
working(2, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
records = CountSafe();
|
||||
if (records == -1) {
|
||||
working(2, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (OpenSafe() == -1) {
|
||||
working(2, 0, 0);
|
||||
return;
|
||||
}
|
||||
working(0, 0, 0);
|
||||
o = 0;
|
||||
|
||||
for (;;) {
|
||||
clr_index();
|
||||
set_color(WHITE, BLACK);
|
||||
mvprintw( 5, 5, "8.8 SAFE CRACKER SETUP");
|
||||
set_color(CYAN, BLACK);
|
||||
if (records != 0) {
|
||||
sprintf(temp, "%s/etc/safe.temp", getenv("MBSE_ROOT"));
|
||||
working(1, 0, 0);
|
||||
if ((fil = fopen(temp, "r")) != NULL) {
|
||||
fread(&safehdr, sizeof(safehdr), 1, fil);
|
||||
x = 2;
|
||||
y = 7;
|
||||
set_color(CYAN, BLACK);
|
||||
for (i = 1; i <= 20; i++) {
|
||||
if (i == 11) {
|
||||
x = 42;
|
||||
y = 7;
|
||||
}
|
||||
if ((o + i) <= records) {
|
||||
offset = sizeof(safehdr) + (((o + i) - 1) * safehdr.recsize);
|
||||
fseek(fil, offset, 0);
|
||||
fread(&safe, safehdr.recsize, 1, fil);
|
||||
if (safe.Opened)
|
||||
set_color(LIGHTRED, BLACK);
|
||||
else
|
||||
set_color(CYAN, BLACK);
|
||||
sprintf(temp, "%3d. %-32s", o + i, safe.Name);
|
||||
temp[38] = '\0';
|
||||
mvprintw(y, x, temp);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
fclose(fil);
|
||||
}
|
||||
}
|
||||
working(0, 0, 0);
|
||||
strcpy(pick, select_pick(records,20));
|
||||
|
||||
if (strncmp(pick, "-", 1) == 0) {
|
||||
CloseSafe(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strncmp(pick, "N", 1) == 0)
|
||||
if ((o + 20) < records)
|
||||
o = o + 20;
|
||||
|
||||
if (strncmp(pick, "P", 1) == 0)
|
||||
if ((o - 20) >= 0)
|
||||
o = o - 20;
|
||||
|
||||
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
|
||||
EditSafeRec(atoi(pick));
|
||||
o = ((atoi(pick) - 1) / 20) * 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void InitSafe(void)
|
||||
{
|
||||
CountSafe();
|
||||
OpenSafe();
|
||||
CloseSafe(TRUE);
|
||||
}
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _SAFE_H
|
||||
#define _SAFE_H
|
||||
|
||||
|
||||
int CountSafe(void);
|
||||
void EditSafe(void);
|
||||
void InitSafe(void);
|
||||
|
||||
#endif
|
||||
|
@ -62,7 +62,6 @@
|
||||
#include "m_new.h"
|
||||
#include "m_ol.h"
|
||||
#include "m_bbslist.h"
|
||||
#include "m_safe.h"
|
||||
#include "m_protocol.h"
|
||||
#include "m_ff.h"
|
||||
#include "m_modem.h"
|
||||
@ -386,7 +385,6 @@ void initdatabases(void)
|
||||
InitNodes();
|
||||
InitOneline();
|
||||
InitBBSlist();
|
||||
InitSafe();
|
||||
InitProtocol();
|
||||
InitService();
|
||||
InitTicarea();
|
||||
|
@ -250,19 +250,6 @@ void load_maincfg(void)
|
||||
CFG.MsgInputColourF = CYAN;
|
||||
CFG.MsgInputColourB = BLACK;
|
||||
|
||||
/*
|
||||
* Safe Door
|
||||
*/
|
||||
CFG.iSafeFirstDigit = 1;
|
||||
CFG.iSafeSecondDigit = 2;
|
||||
CFG.iSafeThirdDigit = 3;
|
||||
CFG.iSafeMaxTrys = 4;
|
||||
CFG.iSafeMaxNumber = 20;
|
||||
CFG.iSafeNumGen = FALSE;
|
||||
strcpy(CFG.sSafePrize, "Free access for a year!");
|
||||
sprintf(CFG.sSafeWelcome, "safewel");
|
||||
sprintf(CFG.sSafeOpened, "safeopen");
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
|
Reference in New Issue
Block a user