Made mbsebbs non setuid, added program mbnewusr

This commit is contained in:
Michiel Broek 2001-11-10 17:14:16 +00:00
parent 785fb988fb
commit e87e7c2ab6
57 changed files with 2677 additions and 2882 deletions

View File

@ -4214,14 +4214,23 @@ v0.33.18 27-Jul-2001
v0.33.19 26-Oct-2001
upgrade:
Change the file /opt/mbse/etc/issue like the example in the
subdirectory mbtask.
Change the shell for user mbse to /opt/mbse/bin/mbnewusr
The make install fixes several permissions that are wrong for
the new style (not setuid) of mbsebbs.
general:
Made the Makefile system more simple.
lang:
Changed language prompt 71.
Changed language prompts 6 and 71.
Added language prompts 472 and 473 for FS editor.
Added language prompts 474, 475 and 476 for address entry.
Added language prompts 477 and 478 for post with user alias.
Deleted language prompts 387, 388, 389, 390
examples:
SAVE:
@ -4257,7 +4266,17 @@ v0.33.19 26-Oct-2001
Posting message with users alias is now possible.
If in menu entries "Display prompt" the fore and background
colors are set, the prompt is displayed with these colors.
If not, the prompt defaults to white on black.
If not, the prompt defaults to white on black.
Does now run as the users uid, not suid anymore. You are not
able to login with Fidonet style name anymore, only using
login. Removed IEMSI support, this has no use anymore. New
users need to register with the mbnewuser program, mbsebbs is
only for registered users. This should fix all kinds of setuid
issues with previous versions.
mbnewusr:
New program, run by user bbs. This is only to register a new
bbs user.
mbtask:
Changed to handle the External Doors flag in the lastcaller
@ -4269,3 +4288,6 @@ v0.33.19 26-Oct-2001
When lastcaller info is scrolling, the lines are first proper
erased.
mbmsg:
Corrected header in logfile for pack function.

View File

@ -35,6 +35,7 @@ install:
${CHOWN} ${OWNER}.${GROUP} ${PREFIX}/etc ; \
${CHOWN} ${OWNER}.${GROUP} ${PREFIX}/etc/maptabs ; \
fi
@chmod 0775 ${PREFIX}/etc
@if [ ! -d ${PREFIX}/doc ] ; then \
mkdir ${PREFIX}/doc ; \
${CHOWN} ${OWNER}.${GROUP} ${PREFIX}/doc ; \
@ -43,6 +44,7 @@ install:
mkdir ${PREFIX}/fdb ; \
${CHOWN} ${OWNER}.${GROUP} ${PREFIX}/fdb ; \
fi
@chmod 0775 ${PREFIX}/fdb
@if [ ! -d ${PREFIX}/log ] ; then \
mkdir ${PREFIX}/log ; \
${CHOWN} ${OWNER}.${GROUP} ${PREFIX}/log ; \

View File

@ -1,8 +1,10 @@
#!/bin/bash
#
# $Id$
#
# Basic setup script for MBSE BBS
#
# (C) Michiel Broek, v0.18 05-Aug-2001
# (C) Michiel Broek
#
# Customisation section, change the next variables to your need.
# However, all docs refer to the setup below.
@ -273,11 +275,11 @@ log "+" "[$?] chown mbse.bbs $MHOME/home"
chmod 775 $MHOME/home
log "+" "[$?] chmod 775 $MHOME/home"
if [ "$OSTYPE" = "Linux" ]; then
useradd -c "MBSE BBS Login" -d $MHOME/home/bbs -g bbs -s $MHOME/bin/mbsebbs bbs
useradd -c "MBSE BBS Login" -d $MHOME/home/bbs -g bbs -s $MHOME/bin/mbnewusr bbs
log "+" "[$?] Added user bbs"
fi
if [ "$OSTYPE" = "FreeBSD" ]; then
pw useradd bbs -c "MBSE BBS Login" -d $MHOME/home/bbs -g bbs -s $MHOME/bin/mbsebbs
pw useradd bbs -c "MBSE BBS Login" -d $MHOME/home/bbs -g bbs -s $MHOME/bin/mbnewusr
log "+" "[$?] Added user bbs"
fi
# Some systems (RedHat and Mandrake) insist on creating a users homedir.

View File

@ -3,8 +3,8 @@
2 user.c |Disconnecting user ...
3 user.c |Scanning User File ...
4 user.c YN|Did you spell your name correctly? [Y/n]
5 user.c |Name Entered:
6 user.c |This is a PRIVATE System. Type "off" to leave
5 newuser.c |You need to login again with the name:
6 user.c |This is a PRIVATE System. Type "off" to leave
7 filesub.c |Mark file number or press <Enter> to stop
8 user.c filesub.c |Password:
9 user.c |Maximum login attempts have been exceeded ...
@ -386,9 +386,9 @@
385 funcs4.c |login >
386 funcs4.c |That login name already exists, please choose another one.
387 |
388 newuser.c |Your new Unix and BBS password will be the same.
389 user.c |FATAL ERROR: You are not in the BBS users file.
390 user.c | Please run 'newuser' to create an account
388 |
389 |
390 |
391 offline.c |New
392 offline.c |Local
393 offline.c |Netmail

View File

@ -3,7 +3,7 @@
|Verbreken gebruiker ...
|Doorzoeken gebruikers bestand ...
JN|Is Uw naam juist gespeld? [J/n]
|Opgegeven naam:
|Log nu opnieuw in met de naam:
|Dit is een PRIVE Systeem. Tik "off" om eruit te gaan
|Markeer bestand nummer of toets <Enter> voor stop
|Wachtwoord:
@ -385,10 +385,10 @@ JN|Zeker weten? [J/n]:
|bv. Piet Snot, login = psnot
|login >
|Die login naam bestaat al, kies iets anders.
|FATAL: Cannot open language definition file
|Uw nieuwe Unix en BBS wachtwoord worden hetzelfde.
|FATAL ERROR: Niet gevonden in het BBS gebruikers bestand.
| Start 'newuser' om een account te maken
|
|
|
|
|Nieuw
|Lokaal
|Netmail

View File

@ -3,7 +3,7 @@
|Disconnecting user ...
|Scanning User File ...
YN|Did you spell your name correctly? [Y/n]
|Name Entered:
|You need to login again with the name:
|This is a PRIVATE System. Type "off" to leave
|Mark file number or press <Enter> to stop
|Password:
@ -385,10 +385,10 @@ YN|Are you Sure? [Y/n]:
|ie. John Doe, login = jdoe
|login >
|That login name already exists, please choose another one.
|FATAL: Cannot open language definition file
|Your new Unix and BBS password will be the same.
|FATAL ERROR: You are not in the BBS users file.
| Please run 'newuser' to create an account
|
|
|
|
|New
|Local
|Netmail

View File

@ -3,7 +3,7 @@
|Desconectando usuario ...
|Explorando ficheiro de usuarios ...
SN|¨Escribiche-lo teu nome correctamente? [S/n]
|Nome escrito:
|You need to login again with the name:
|Este un sistema PRIVADO. Teclea "off" para salir
|Teclea n£mero de ficheiro ou <Enter> para rematar :
|Password:
@ -385,10 +385,10 @@ SN|
|'Elena Nito del Bosque ' podes usar 'enitob', 'elenanb' ou 'enbosque'
|login >
|Ese nome de LOGIN xa existe. Escolle outro...
|FATAL: Non podo abrir ficheiro de idioma
|A password do teu Login ser  igual que o da BBS.
|ERROR FATAL: Non est s no ficheiro de usuarios da BBS.
| Ejecuta 'newuser' para crear un novo usuario
|
|
|
|
|New
|Local
|Netmail

View File

@ -3,7 +3,7 @@
|Scollegamento in corso ...
|Controllo User File in corso...
SN|Hai scritto il tuo nome e cognome correttamente? [S/n]
|Nome inserito:
|You need to login again with the name:
|Questo e' un sistema telematico PRIVATO. Scrivi "off" per uscire ora
|Scegli il numero del file o premi <Invio> per interrompere
|Password:
@ -385,10 +385,10 @@ SN|Sei sicuro? [S/n]:
|es. Mario Rossi, login = mrossi
|login >
|Quel login esiste gia', scegline uno leggermente diverso.
|FATAL: Non riesco a aprire il file per quella lingua
|La tua password per l' "Account Unix" e la BBS saranno identiche.
|FATAL ERROR: Non sei nel database degli utenti della BBS.
| Lancia 'newuser' per creare un account
|
|
|
|
|Nuovo
|Locale
|Netmail

View File

@ -3,7 +3,7 @@
|Desconectando usuario ...
|Explorando fichero de usuarios ...
SN|¨Has escrito correctamente tu nombre? [S/n]
|Nombre escrito:
|You need to login again with the name:
|Este es un sistema PRIVADO. Teclea "off" para salir
|Teclee n£mero de fichero o <Enter> para terminar :
|Password:
@ -385,10 +385,10 @@ SN|
|'Elena Nito del Bosque ' puedes usar 'enitob', 'elenanb' o 'enbosque'
|login >
|Ese nombre de LOGIN ya existe. Elije otro...
|FATAL: No puedo abrir fichero de idioma
|El password de su Login ser  igual que el de la BBS.
|ERROR FATAL: No est s en el fichero de usuarios de la BBS.
| Ejecuta 'newuser' para crear un nuevo usuario
|
|
|
|
|New
|Local
|Netmail

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: client.c
* $Id$
* Purpose ...............: MBSE Deamon Client
* Last modification date : 27-May-2001
*
*****************************************************************************
* Copyright (C) 1993-2000
@ -86,6 +85,8 @@ int socket_connect(char *user, char *prg, char *city)
*/
if (getuid() != geteuid()) {
chown(cpath, getuid(), getgid());
} else {
chmod(cpath, 0775);
}
/*

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbse.h
* $Id$
* Purpose ...............: Global variables for MBSE BBS
* Last modification date : 22-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -98,13 +97,11 @@ char LastLoginTime[9]; /* Last login time */
char LastCaller[36]; /* Last caller on system */
char FirstName[20]; /* Users First name */
char LastName[30]; /* Users Last name */
int LoginPrompt; /* Login prompt check - timeout */
int UserAge; /* Users age */
int grecno; /* User's Record Number in user file */
int SYSOP; /* Int to see if user is Sysop */
int iLineCount; /* Line Counter */
int iExpired; /* Check if users time ran out */
int iUnixMode; /* Using Unix Accounts */
char sUnixName[9]; /* Unix login name */
time_t Time2Go; /* Calculated time to force logout */
struct tm *l_date; /* Structure for Date */

View File

@ -623,7 +623,7 @@ struct sysconfig {
/* BBS Globals */
int max_login; /* Maximum login attempts */
unsigned NewAreas : 1; /* Notify if new msg areas */
unsigned elite_mode : 1; /* Allow new users/Private? */
unsigned xelite_mode : 1;
unsigned slow_util : 1; /* Run utils slowly */
unsigned exclude_sysop : 1; /* Exclude Sysop from lists */
unsigned xUseSysDomain : 1;

View File

@ -266,7 +266,7 @@ void DoMsgBase()
Syslog('+', "Processing all message areas");
if (do_kill) {
Syslog('-', " Total Max. Days/Killed Max. Age/Killed Area name");
Syslog('-', " Total Max. Days/Killed Max. Nr/Killed Area name");
Syslog('-', "------ ------ ------ ------ ------ ----------------------------------");
}

View File

@ -11,21 +11,28 @@ SRCS = bank.c commonio.c filesub.c language.c mbfbgen.c mbtoberep.c \
mbuseradd.c newuser.c pinfo.c rad64.c timecheck.c change.c \
exitinfo.c funcs4.c mball.c mbsebbs.c menu.c nextuser.c pop3.c \
safe.c timeout.c chat.c file.c getdef.c mbchat.c mbstat.c misc.c \
offline.c putpwent.c salt.c user.c
offline.c putpwent.c salt.c user.c mbnewusr.c input.c whoson.c \
door.c dispfile.c
HDRS = bank.h commonio.h filesub.h language.h mbsebbs.h misc.h offline.h \
putpwent.h salt.h timeout.h bbslist.h email.h fsedit.h lineedit.h \
mbstat.h msgutil.h oneline.h pwcheck.h sgetpwent.h user.h bye.h \
encrypt.h funcs.h mail.h mbuser.h myname.h page.h pwio.h shadowio.h \
xmalloc.h change.h exitinfo.h funcs4.h mball.h mbuseradd.h newuser.h \
pinfo.h rad64.h statetbl.h chat.h file.h getdef.h mbpasswd.h menu.h \
nextuser.h pop3.h safe.h timecheck.h
nextuser.h pop3.h safe.h timecheck.h mbnewusr.h input.h whoson.h \
door.h dispfile.h
MBSEBBS_OBJS = bank.o bbslist.o chat.o file.o funcs.o funcs4.o mail.o menu.o \
misc.o pinfo.o nextuser.o oneline.o page.o pwcheck.o fsedit.o \
bye.o change.o mbsebbs.o safe.o timeout.o user.o timecheck.o \
exitinfo.o filesub.o lineedit.o offline.o language.o msgutil.o \
newuser.o pop3.o email.o
pop3.o email.o input.o whoson.o door.o dispfile.o
MBSEBBS_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
../lib/libdbase.a ../lib/libmbinet.a
MBNEWUSR_OBJS = mbnewusr.o newuser.o language.o bye.o timeout.o dispfile.o oneline.o \
timecheck.o exitinfo.o input.o misc.o funcs.o funcs4.o pwcheck.o change.o \
filesub.o mail.o email.o whoson.o msgutil.o pop3.o lineedit.o fsedit.o
MBNEWUSR_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
../lib/libdbase.a ../lib/libmbinet.a
MBALL_OBJS = mball.o
MBALL_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
MBLANG_OBJS = mblang.o
@ -44,7 +51,7 @@ MBUSERADD_OBJS = mbuseradd.o
MBPASSWD_OBJS = mbpasswd.o commonio.o pwio.o shadowio.o sgetpwent.o \
xmalloc.o myname.o rad64.o salt.o getdef.o encrypt.o putpwent.o
OTHER = Makefile
TARGET = mbsebbs mball mblang mbchat mbfbgen mbstat mbtoberep mbuser mbuseradd mbpasswd
TARGET = mbsebbs mbnewusr mball mblang mbchat mbfbgen mbstat mbtoberep mbuser mbuseradd mbpasswd
#############################################################################################################
@ -60,6 +67,10 @@ mbsebbs: ${MBSEBBS_OBJS} ${MBSEBBS_LIBS}
${CC} -o mbsebbs ${MBSEBBS_OBJS} ${LIBS} ${MBSEBBS_LIBS}
strip mbsebbs
mbnewusr: ${MBNEWUSR_OBJS} ${MBNEWUSR_LIBS}
${CC} -o mbnewusr ${MBNEWUSR_OBJS} ${LIBS} ${MBNEWUSR_LIBS}
strip mbnewusr
mball: ${MBALL_OBJS} ${MBALL_LIBS}
${CC} -o mball ${MBALL_OBJS} ${LIBS} ${MBALL_LIBS}
strip mball
@ -100,7 +111,8 @@ install: all
@if [ "`id -un`" != "root" ] ; then \
echo; echo " Must be root to install!"; echo; exit 3; \
fi
${INSTALL} -s -o ${OWNER} -g ${GROUP} -m 6711 mbsebbs ${BINDIR}
${INSTALL} -s -o ${OWNER} -g ${GROUP} -m 0751 mbsebbs ${BINDIR}
${INSTALL} -s -o ${OWNER} -g ${GROUP} -m 6711 mbnewusr ${BINDIR}
${INSTALL} -s -o ${OWNER} -g ${GROUP} -m 0711 mball ${BINDIR}
${INSTALL} -s -o ${OWNER} -g ${GROUP} -m 0711 mblang ${BINDIR}
${INSTALL} -s -o ${OWNER} -g ${GROUP} -m 0711 mbchat ${BINDIR}
@ -140,55 +152,60 @@ depend:
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend
bank.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bank.h funcs4.h language.h funcs.h timeout.h timecheck.h exitinfo.h
bank.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bank.h input.h language.h dispfile.h timeout.h timecheck.h whoson.h exitinfo.h
commonio.o: ../config.h commonio.h
filesub.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h funcs.h language.h funcs4.h misc.h timeout.h exitinfo.h change.h
language.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h funcs4.h language.h
filesub.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h funcs.h language.h funcs4.h input.h misc.h timeout.h exitinfo.h change.h
language.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h language.h
mbfbgen.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h
mbtoberep.o: ../lib/libs.h ../lib/structs.h
msgutil.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h oneline.h msgutil.h
oneline.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h funcs.h funcs4.h language.h
oneline.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h funcs.h input.h language.h
pwcheck.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h pwcheck.h funcs4.h timeout.h
sgetpwent.o: ../config.h sgetpwent.h
xmalloc.o: ../config.h xmalloc.h
bbslist.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bbslist.h funcs.h funcs4.h language.h
email.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/msgtext.h ../lib/msg.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h funcs4.h email.h
bbslist.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bbslist.h funcs.h input.h language.h
email.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/msgtext.h ../lib/msg.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h
fsedit.o: fsedit.h
lineedit.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mail.h funcs4.h language.h timeout.h lineedit.h
lineedit.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mail.h input.h language.h timeout.h lineedit.h
mblang.o: ../lib/libs.h ../lib/structs.h ../lib/records.h
mbuser.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbuser.h
myname.o: ../config.h
page.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h funcs.h funcs4.h chat.h page.h timeout.h mail.h language.h
page.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h
pwio.o: ../config.h sgetpwent.h commonio.h putpwent.h pwio.h
shadowio.o: ../config.h commonio.h shadowio.h
bye.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h misc.h language.h bye.h
bye.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h dispfile.h misc.h language.h bye.h
encrypt.o: ../config.h encrypt.h
funcs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h language.h funcs4.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h mail.h email.h
mail.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h funcs4.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h
funcs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h funcs4.h language.h input.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h mail.h email.h
mail.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h whoson.h
mbpasswd.o: ../config.h encrypt.h rad64.h myname.h xmalloc.h pwio.h shadowio.h mbpasswd.h
mbuseradd.o: ../config.h mbuseradd.h
newuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs4.h pwcheck.h newuser.h language.h timeout.h change.h bye.h
pinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h funcs4.h
newuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs4.h input.h pwcheck.h newuser.h language.h timeout.h change.h bye.h dispfile.h
pinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h pinfo.h input.h
rad64.o: ../config.h rad64.h
timecheck.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h timecheck.h funcs.h funcs4.h misc.h bye.h exitinfo.h language.h
change.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h change.h funcs.h funcs4.h language.h misc.h pwcheck.h timeout.h exitinfo.h bye.h
exitinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h funcs.h funcs4.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
funcs4.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/msg.h funcs4.h misc.h timeout.h language.h
change.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h change.h dispfile.h funcs.h funcs4.h input.h language.h misc.h pwcheck.h timeout.h exitinfo.h bye.h
exitinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.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
funcs4.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/msg.h funcs4.h input.h misc.h timeout.h language.h
mball.o: ../lib/libs.h ../lib/structs.h ../lib/mbse.h ../lib/records.h ../lib/common.h ../lib/dbcfg.h ../lib/clcomm.h mball.h
mbsebbs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h mbsebbs.h user.h funcs.h funcs4.h language.h menu.h misc.h bye.h timeout.h
menu.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h mail.h bbslist.h change.h bank.h chat.h file.h funcs.h funcs4.h misc.h nextuser.h safe.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h exitinfo.h language.h offline.h email.h
nextuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/ansi.h ../lib/clcomm.h ../lib/common.h nextuser.h funcs.h funcs4.h language.h timeout.h
mbsebbs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h mbsebbs.h user.h dispfile.h funcs4.h language.h menu.h misc.h bye.h timeout.h
menu.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h mail.h bbslist.h change.h bank.h chat.h file.h funcs.h funcs4.h input.h misc.h nextuser.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
nextuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/ansi.h ../lib/clcomm.h ../lib/common.h nextuser.h funcs.h input.h language.h timeout.h
pop3.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h
safe.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h exitinfo.h funcs.h funcs4.h misc.h safe.h timeout.h language.h
safe.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.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: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h timeout.h funcs.h funcs4.h bye.h filesub.h language.h
chat.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h chat.h funcs.h funcs4.h language.h misc.h exitinfo.h
file.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h file.h funcs.h funcs4.h language.h misc.h timeout.h exitinfo.h change.h
chat.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h chat.h funcs.h input.h language.h misc.h whoson.h
file.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.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
getdef.o: ../config.h getdef.h
mbchat.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h
mbstat.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbstat.h
misc.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h funcs4.h language.h misc.h timeout.h exitinfo.h
offline.o: ../lib/libs.h ../lib/structs.h ../lib/mbse.h ../lib/records.h ../lib/bluewave.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h funcs4.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h
misc.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h funcs4.h input.h language.h misc.h timeout.h exitinfo.h
offline.o: ../lib/libs.h ../lib/structs.h ../lib/mbse.h ../lib/records.h ../lib/bluewave.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h funcs4.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h
putpwent.o: ../config.h putpwent.h
salt.o: ../config.h rad64.h getdef.h
user.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h timeout.h user.h pwcheck.h funcs.h funcs4.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h statetbl.h email.h newuser.h
user.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h timeout.h user.h pwcheck.h dispfile.h funcs4.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h statetbl.h email.h
mbnewusr.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mbnewusr.h funcs.h funcs4.h input.h language.h misc.h bye.h timeout.h newuser.h
input.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h timeout.h language.h
whoson.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h language.h exitinfo.h whoson.h
door.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h timeout.h exitinfo.h whoson.h door.h
dispfile.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h funcs4.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h dispfile.h
# End of generated dependencies

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/bank.c
* $Id$
* Purpose ...............: Time/Bytes Bank
* Last modification date : 28-Jun-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -36,11 +35,12 @@
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "bank.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "funcs.h"
#include "dispfile.h"
#include "timeout.h"
#include "timecheck.h"
#include "whoson.h"
#include "exitinfo.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/bbslist.c
* $Id$
* Purpose ...............: Handle BBS lists
* Last modification date : 28-Jun-2001
* ToDo ..................: Add use of new fields
* Verify check at logon
* Intro New BBS at logon
@ -40,7 +39,7 @@
#include "../lib/common.h"
#include "bbslist.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"

View File

@ -35,7 +35,7 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "funcs.h"
#include "dispfile.h"
#include "misc.h"
#include "language.h"
#include "bye.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/change.c
* $Id$
* Purpose ...............: Change user settings
* Last modification date : 27-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -36,8 +35,10 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "change.h"
#include "dispfile.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
#include "pwcheck.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/chat.c
* $Id$
* Purpose ...............: Sysop to user chat utility
* Last modification date : 08-Feb-1999
*
*****************************************************************************
* Copyright (C) 1997-1999
@ -37,10 +36,10 @@
#include "../lib/clcomm.h"
#include "chat.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
#include "exitinfo.h"
#include "whoson.h"

523
mbsebbs/dispfile.c Normal file
View File

@ -0,0 +1,523 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Display ANSI/ASCII textfiles
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* 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 "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/msgtext.h"
#include "../lib/msg.h"
#include "../lib/clcomm.h"
#include "funcs.h"
#include "funcs4.h"
#include "language.h"
#include "oneline.h"
#include "misc.h"
#include "timeout.h"
#include "timecheck.h"
#include "exitinfo.h"
#include "mail.h"
#include "email.h"
#include "dispfile.h"
/*
* Function returns total number of bbs users
*/
int TotalUsers(void);
int TotalUsers(void)
{
FILE *pUsrConfig;
int ch = 0;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( pUsrConfig = fopen(temp,"rb")) == NULL)
WriteError("ControlCodeK: Can't open users file %s for reading", temp);
else {
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1)
if ((!u.Deleted) && (strlen(u.sUserName) > 0))
ch++;
fclose(pUsrConfig);
}
free(temp);
return ch;
}
/*
* Function will display textfile in either ansi or ascii and
* display control codes if they exist.
* Returns Success if it can display the requested file
*/
int DisplayFile(char *filename)
{
FILE *pFileName;
long iSec = 0;
char *sFileName, *tmp, *tmp1;
char newfile[PATH_MAX];
int i, x;
sFileName = calloc(16385, sizeof(char));
tmp = calloc(PATH_MAX, sizeof(char));
tmp1 = calloc(PATH_MAX, sizeof(char));
/*
* Open the file in the following search order:
* 1 - if GraphMode -> users language .ans
* 2 - if GraphMode -> default language .ans
* 3 - users language .asc
* 4 - default language .asc
* 5 - Abort, there is no file to show.
*/
pFileName = NULL;
if (exitinfo.GraphMode) {
sprintf(newfile, "%s/%s.ans", lang.TextPath, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) {
sprintf(newfile, "%s/%s.ans", CFG.bbs_txtfiles, filename);
pFileName = fopen(newfile, "rb");
}
}
if (pFileName == NULL) {
sprintf(newfile, "%s/%s.asc", lang.TextPath, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) {
sprintf(newfile, "%s/%s.asc", CFG.bbs_txtfiles, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) {
free(sFileName);
free(tmp);
free(tmp1);
return FALSE;
}
}
}
Syslog('B', "Displayfile %s", newfile);
while (!feof(pFileName)) {
i = fread(sFileName, sizeof(char), 16384, pFileName);
for(x = 0; x < i; x++) {
switch(*(sFileName + x)) {
case '':
ControlCodeU(sFileName[++x]);
break;
case '':
ControlCodeF(sFileName[++x]);
break;
case ' ':
ControlCodeK(sFileName[++x]);
break;
case '':
fflush(stdout);
fflush(stdin);
alarm_on();
Getone();
break;
case '':
/*
* This code will allow you to specify a security level
* in front of the text, ie ^B32000^Bthis is a test^B
* will print this is a test only if you have security
* above 32000. Only one set of control chars per line.
* You cannot have multiple securitys etc
*/
x++;
strcpy(tmp1, "");
while (*(sFileName + x) != '') {
sprintf(tmp, "%c", *(sFileName + x));
strcat(tmp1, tmp);
x++;
}
x++;
iSec = atoi(tmp1);
while ((x <= i) && (*(sFileName + x) != '')) {
if (exitinfo.Security.level >= iSec)
printf("%c", *(sFileName + x));
x++;
}
break;
case '':
fflush(stdout);
sleep(1);
break;
default:
printf("%c", *(sFileName + x));
} /* switch */
} /* for */
} /* while !eof */
fclose(pFileName);
free(sFileName);
free(tmp);
free(tmp1);
return TRUE;
}
int DisplayFileEnter(char *File)
{
int rc;
rc = DisplayFile(File);
Enter(1);
/* Press ENTER to continue */
language(13, 0, 436);
fflush(stdout);
fflush(stdin);
alarm_on();
Getone();
return rc;
}
void ControlCodeF(int ch)
{
/* Update user info */
ReadExitinfo();
switch (toupper(ch)) {
case '!':
printf(exitinfo.sProtocol);
break;
case 'A':
printf("%ld", exitinfo.Uploads);
break;
case 'B':
printf("%ld", exitinfo.Downloads);
break;
case 'C':
printf("%lu", exitinfo.DownloadK);
break;
case 'D':
printf("%lu", exitinfo.UploadK);
break;
case 'E':
printf("%lu", exitinfo.DownloadK + exitinfo.UploadK);
break;
case 'F':
printf("%lu", LIMIT.DownK);
break;
case 'G':
printf("%d", exitinfo.iTransferTime);
break;
case 'H':
printf("%d", iAreaNumber);
break;
case 'I':
printf(sAreaDesc);
break;
case 'J':
printf("%u", LIMIT.DownF);
break;
case 'K':
printf("%s", LIMIT.Description);
break;
default:
printf(" ");
}
}
void ControlCodeU(int ch)
{
/*
* Update user info
*/
TimeCheck();
ReadExitinfo();
switch (toupper(ch)) {
case 'A':
printf("%s", exitinfo.sUserName);
break;
case 'B':
printf(exitinfo.sLocation);
break;
case 'C':
printf(exitinfo.sVoicePhone);
break;
case 'D':
printf(exitinfo.sDataPhone);
break;
case 'E':
printf(LastLoginDate);
break;
case 'F':
printf("%s %s", StrDateDMY(exitinfo.tFirstLoginDate), StrTimeHMS(exitinfo.tFirstLoginDate));
break;
case 'G':
printf(LastLoginTime);
break;
case 'H':
printf("%d", exitinfo.Security.level);
break;
case 'I':
printf("%d", exitinfo.iTotalCalls);
break;
case 'J':
printf("%d", exitinfo.iTimeUsed);
break;
case 'K':
printf("%d", exitinfo.iConnectTime);
break;
case 'L':
printf("%d", exitinfo.iTimeLeft);
break;
case 'M':
printf("%d", exitinfo.iScreenLen);
break;
case 'N':
printf(FirstName);
break;
case 'O':
printf(LastName);
break;
case 'Q':
printf("%s", exitinfo.ieNEWS ? (char *) Language(147) : (char *) Language(148));
break;
case 'P':
printf("%s", exitinfo.GraphMode ? (char *) Language(147) : (char *) Language(148));
break;
case 'R':
printf("%s", exitinfo.HotKeys ? (char *) Language(147) : (char *) Language(148));
break;
case 'S':
printf("%d", exitinfo.iTimeUsed + exitinfo.iTimeLeft);
break;
case 'T':
printf(exitinfo.sDateOfBirth);
break;
case 'U':
printf("%d", exitinfo.iPosted);
break;
case 'X':
printf(lang.Name);
break;
case 'Y':
printf(exitinfo.sHandle);
break;
case 'Z':
printf("%s", exitinfo.DoNotDisturb ? (char *) Language(147) : (char *) Language(148));
break;
case '1':
printf("%s", exitinfo.MailScan ? (char *) Language(147) : (char *) Language(148));
break;
case '2':
printf("%s", exitinfo.ieFILE ? (char *) Language(147) : (char *) Language(148));
break;
case '3':
printf("%s", exitinfo.FsMsged ? (char *) Language(147) : (char *) Language(148));
break;
case '4':
printf("%s", exitinfo.FSemacs ? (char *) Language(147) : (char *) Language(148));
break;
case '5':
printf(exitinfo.address[0]);
break;
case '6':
printf(exitinfo.address[1]);
break;
case '7':
printf(exitinfo.address[2]);
break;
default:
printf(" ");
}
}
void ControlCodeK(int ch)
{
FILE *pCallerLog;
char sDataFile[PATH_MAX];
lastread LR;
switch (toupper(ch)) {
case 'A':
printf("%s", (char *) GetDateDMY());
break;
case 'B':
printf("%s", (char *) GetLocalHMS());
break;
case 'C':
printf("%s", (char *) GLCdate());
break;
case 'D':
printf("%s", (char *) GLCdateyy());
break;
case 'E':
printf("%d", Speed() );
break;
case 'F':
printf("%s", LastCaller);
break;
case 'G':
printf("%d", TotalUsers());
break;
case 'H':
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
if((pCallerLog = fopen(sDataFile, "rb")) != NULL) {
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
printf("%ld", SYSINFO.SystemCalls);
fclose(pCallerLog);
}
break;
case 'I':
printf("%d", iMsgAreaNumber + 1);
break;
case 'J':
printf(sMsgAreaDesc);
break;
case 'K':
printf("%s", Oneliner_Get());
break;
case 'L':
SetMsgArea(iMsgAreaNumber);
printf("%ld", MsgBase.Total);
break;
case 'M':
LR.UserID = grecno;
if (Msg_Open(sMsgAreaBase)) {
if (Msg_GetLastRead(&LR) == TRUE) {
if (LR.HighReadMsg > MsgBase.Highest)
LR.HighReadMsg = MsgBase.Highest;
printf("%ld", LR.HighReadMsg);
} else
printf("?");
Msg_Close();
}
break;
case 'N':
printf("%s", sMailbox);
break;
case 'O':
SetEmailArea(sMailbox);
printf("%ld", EmailBase.Total);
break;
case 'P':
sprintf(sDataFile, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, sMailbox);
LR.UserID = grecno;
if (Msg_Open(sDataFile)) {
if (Msg_GetLastRead(&LR) == TRUE) {
if (LR.HighReadMsg > EmailBase.Highest)
LR.HighReadMsg = EmailBase.Highest;
printf("%ld", LR.HighReadMsg);
} else
printf("?");
Msg_Close();
}
break;
default:
printf(" ");
}
}

13
mbsebbs/dispfile.h Normal file
View File

@ -0,0 +1,13 @@
/* $Id$ */
#ifndef _DISPLAYFILE_H
#define _DISPLAYFILE_H
int DisplayFile(char *); /* Display .ans/.asc textfile */
int DisplayFileEnter(char *); /* Display .ans/.asc wait for Enter */
void ControlCodeF(int); /* Check Control Codes in File */
void ControlCodeU(int); /* Check Control Codes in File */
void ControlCodeK(int); /* Check Control Codes in File */
#endif

298
mbsebbs/door.c Normal file
View File

@ -0,0 +1,298 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Run external door
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* 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 "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/common.h"
//#include "../lib/msgtext.h"
//#include "../lib/msg.h"
#include "../lib/clcomm.h"
#include "input.h"
#include "timeout.h"
#include "exitinfo.h"
#include "whoson.h"
#include "door.h"
extern time_t t_start;
extern int e_pid;
extern char **environ;
char *Gdate(time_t, int);
char *Gdate(time_t tt, int Y2K)
{
static char GLC[15];
struct tm *tm;
tm = localtime(&tt);
if (Y2K)
sprintf(GLC, "%02d-%02d-%04d", tm->tm_mon +1, tm->tm_mday, tm->tm_year + 1900);
else
sprintf(GLC, "%02d-%02d-%02d", tm->tm_mon +1, tm->tm_mday, tm->tm_year % 100);
return (GLC);
}
char *Rdate(char *, int);
char *Rdate(char *ind, int Y2K)
{
static char GLC[15];
memset(&GLC, 0, sizeof(GLC));
GLC[0] = ind[3];
GLC[1] = ind[4];
GLC[2] = '-';
GLC[3] = ind[0];
GLC[4] = ind[1];
GLC[5] = '-';
if (Y2K) {
GLC[6] = ind[6];
GLC[7] = ind[7];
GLC[8] = ind[8];
GLC[9] = ind[9];
} else {
GLC[6] = ind[8];
GLC[7] = ind[9];
}
return GLC;
}
/*
* Function will run a external program or door
*/
void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSuid)
{
char *String, *String1;
int i, rc;
char *temp1;
FILE *fp;
temp1 = calloc(PATH_MAX, sizeof(char));
String = calloc(81, sizeof(char));
WhosDoingWhat(DOOR);
if ((strstr(Program, "/N")) != NULL) {
sprintf(temp1, "%d", iNode);
strreplace(Program, (char *)"/N", temp1);
}
if ((strstr(Program, "/A")) != NULL) {
colour(3, 0);
if ((String = strstr(Program, "/T=")) != NULL) {
String1 = String + 3;
printf("\n%s", String1);
} else
printf("\nPlease enter filename: ");
fflush(stdout);
colour(CFG.InputColourF, CFG.InputColourB);
GetstrC(temp1, 80);
strreplace(Program, (char *)"/A", temp1);
for(i = 0; i < strlen(Program); i++) {
if (*(Program + i) == '\0')
break;
if (*(Program + i) == '/')
*(Program + i) = '\0';
}
}
free(String);
Syslog('+', "Door: %s", Program);
ReadExitinfo();
alarm_set((exitinfo.iTimeLeft * 60) - 10);
Altime((exitinfo.iTimeLeft * 60));
/*
* Always remove the old door.sys first.
*/
sprintf(temp1, "%s/%s/door.sys", CFG.bbs_usersdir, exitinfo.Name);
unlink(temp1);
/*
* Write door.sys in users homedirectory
*/
if (!NoDoorsys) {
if ((fp = fopen(temp1, "w+")) == NULL) {
WriteError("$Can't create %s", temp1);
} else {
if (Comport) {
fprintf(fp, "COM1:\r\n"); /* COM port */
fprintf(fp, "19200\r\n");/* Effective baudrate */
} else {
fprintf(fp, "COM0:\r\n");/* COM port */
fprintf(fp, "0\r\n"); /* Effective baudrate */
}
fprintf(fp, "8\r\n"); /* Databits */
fprintf(fp, "%d\r\n", iNode); /* Node number */
if (Comport)
fprintf(fp, "19200\r\n");/* Locked baudrate */
else
fprintf(fp, "%ld\r\n", ttyinfo.portspeed); /* Locked baudrate */
fprintf(fp, "Y\r\n"); /* Screen display */
fprintf(fp, "N\r\n"); /* Printer on */
fprintf(fp, "Y\r\n"); /* Page bell */
fprintf(fp, "Y\r\n"); /* Caller alarm */
fprintf(fp, "%s\r\n", exitinfo.sUserName);
fprintf(fp, "%s\r\n", exitinfo.sLocation);
fprintf(fp, "%s\r\n", exitinfo.sVoicePhone);
fprintf(fp, "%s\r\n", exitinfo.sDataPhone);
fprintf(fp, "%s\r\n", exitinfo.Password);
fprintf(fp, "%d\r\n", exitinfo.Security.level);
fprintf(fp, "%d\r\n", exitinfo.iTotalCalls);
fprintf(fp, "%s\r\n", Gdate(exitinfo.tLastLoginDate, Y2Kdoorsys));
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft * 60);
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft);
fprintf(fp, "GR\r\n"); /* ANSI graphics */
fprintf(fp, "%d\r\n", exitinfo.iScreenLen);
fprintf(fp, "N\r\n"); /* User mode, always N */
fprintf(fp, "\r\n"); /* Always blank */
fprintf(fp, "\r\n"); /* Always blank */
fprintf(fp, "%s\r\n", Rdate(exitinfo.sExpiryDate, Y2Kdoorsys));
fprintf(fp, "%d\r\n", grecno); /* Users recordnumber */
fprintf(fp, "%s\r\n", exitinfo.sProtocol);
fprintf(fp, "%ld\r\n", exitinfo.Uploads);
fprintf(fp, "%ld\r\n", exitinfo.Downloads);
fprintf(fp, "%ld\r\n", LIMIT.DownK);
fprintf(fp, "%ld\r\n", LIMIT.DownK);
fprintf(fp, "%s\r\n", Rdate(exitinfo.sDateOfBirth, Y2Kdoorsys));
fprintf(fp, "\r\n"); /* Path to userbase */
fprintf(fp, "\r\n"); /* Path to messagebase */
fprintf(fp, "%s\r\n", CFG.sysop_name);
fprintf(fp, "%s\r\n", exitinfo.sHandle);
fprintf(fp, "none\r\n"); /* Next event time */
fprintf(fp, "Y\r\n"); /* Error free connect. */
fprintf(fp, "N\r\n"); /* Always N */
fprintf(fp, "Y\r\n"); /* Always Y */
fprintf(fp, "7\r\n"); /* Default textcolor */
fprintf(fp, "0\r\n"); /* Always 0 */
fprintf(fp, "%s\r\n", Gdate(exitinfo.tLastLoginDate, Y2Kdoorsys));
fprintf(fp, "%s\r\n", StrTimeHM(t_start));
fprintf(fp, "%s\r\n", LastLoginTime);
fprintf(fp, "32768\r\n"); /* Always 32768 */
fprintf(fp, "%d\r\n", exitinfo.DownloadsToday);
fprintf(fp, "%ld\r\n", exitinfo.UploadK);
fprintf(fp, "%ld\r\n", exitinfo.DownloadK);
fprintf(fp, "%s\r\n", exitinfo.sComment);
fprintf(fp, "0\r\n"); /* Always 0 */
fprintf(fp, "%d\r\n\032", exitinfo.iPosted);
fclose(fp);
}
}
clear();
printf("Loading ...\n\n");
if (NoSuid)
rc = exec_nosuid(Program);
else
rc = execute((char *)"/bin/sh", (char *)"-c", Program, NULL, NULL, NULL);
Altime(0);
alarm_off();
alarm_on();
Syslog('+', "Door end, rc=%d", rc);
free(temp1);
printf("\n\n");
Pause();
}
/*
* Execute a door as real user, not suid.
*/
int exec_nosuid(char *mandato)
{
int rc, status;
pid_t pid;
if (mandato == NULL)
return 1; /* Prevent running a shell */
Syslog('+', "Execve: /bin/sh -c %s", mandato);
pid = fork();
if (pid == -1)
return 1;
if (pid == 0) {
char *argv[4];
argv[0] = (char *)"sh";
argv[1] = (char *)"-c";
argv[2] = mandato;
argv[3] = 0;
execve("/bin/sh", argv, environ);
exit(127);
}
e_pid = pid;
do {
rc = waitpid(pid, &status, 0);
e_pid = 0;
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
switch(rc) {
case -1:
WriteError("$Waitpid returned %d, status %d,%d", rc,status>>8,status&0xff);
return -1;
case 0:
return 0;
default:
if (WIFEXITED(status)) {
rc = WEXITSTATUS(status);
if (rc) {
WriteError("Exec_nosuid: returned error %d", rc);
return rc;
}
}
if (WIFSIGNALED(status)) {
rc = WTERMSIG(status);
WriteError("Wait stopped on signal %d", rc);
return rc;
}
if (rc)
WriteError("Wait stopped unknown, rc=%d", rc);
return rc;
}
return 0;
}

9
mbsebbs/door.h Normal file
View File

@ -0,0 +1,9 @@
/* $Id$ */
#ifndef _DOOR_H
#define _DOOR_H
void ExtDoor(char *, int, int, int, int); /* Run external door */
int exec_nosuid(char *); /* Execute as real user */
#endif

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/email.c
* $Id$
* Purpose ...............: Internet email
* Last modification date : 26-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -43,8 +42,9 @@
#include "mail.h"
#include "timeout.h"
#include "msgutil.h"
#include "funcs4.h"
#include "input.h"
#include "email.h"
#include "whoson.h"
extern unsigned long LastNum;

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/exitinfo.c
* $Id$
* Purpose ...............: Exitinfo functions
* Last modification date : 26-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -36,7 +35,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "oneline.h"
#include "misc.h"
@ -46,7 +45,7 @@
#include "exitinfo.h"
extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
//extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
/*
@ -139,276 +138,3 @@ void WriteExitinfo()
}
/*
* Function to display what users are currently On-Line and what they
* are busy doing
*/
void WhosOn(char *OpData)
{
FILE *pExitinfo;
DIR *Directory;
char *Heading, *Underline, *temp, *tmp, *device;
struct dirent *Dir;
int i, x;
Underline = calloc(81, sizeof(char));
Heading = calloc(81, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
tmp = calloc(PATH_MAX, sizeof(char));
WhosDoingWhat(WHOSON);
clear();
Enter(1);
colour(15, 0);
sprintf(Heading, "%s%s", (char *) Language(414), CFG.bbs_name);
Center(Heading);
x = strlen(Heading);
for(i = 0; i < x; i++)
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(12, 0);
Center(Underline);
printf("\n");
pout(10, 0, (char *) Language(415));
Enter(1);
colour(2, 0);
fLine(79);
sprintf(tmp, "%s/tmp", getenv("MBSE_ROOT"));
if ((Directory = opendir(tmp)) != NULL)
while ((Dir = readdir( Directory )) != NULL)
if((strstr(Dir->d_name, ".bbs-exitinfo.")) != NULL) {
sprintf(temp, "%s/%s", tmp, Dir->d_name);
if(( pExitinfo = fopen(temp, "rb")) != NULL) {
fread(&exitinfo, sizeof(exitinfo), 1, pExitinfo);
colour(11, 0);
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(exitinfo.sHandle, "") != 0 && *(exitinfo.sHandle) != ' '))
printf("%-30s", exitinfo.sHandle);
else
printf("%-30s", exitinfo.sUserName);
} else
printf("%-30s", exitinfo.sUserName);
colour(9, 0);
if((device = strstr(Dir->d_name, "tty")) != NULL)
printf("%-9s", device);
else
printf("%-9s", "None");
colour(15, 0);
/* Browseng */
if(exitinfo.iStatus == BROWSING)
printf("%-15s", (char *) Language(418));
/* Downloading */
else if(exitinfo.iStatus == DOWNLOAD)
printf("%-15s", (char *) Language(419));
/* Uploading */
else if(exitinfo.iStatus == UPLOAD)
printf("%-15s", (char *) Language(420));
/* Msg Section */
else if(exitinfo.iStatus == READ_POST)
printf("%-15s", (char *) Language(421));
/* External Door */
else if(exitinfo.iStatus == DOOR)
printf("%-15s", (char *) Language(422));
/* Chatting */
else if(exitinfo.iStatus == SYSOPCHAT)
printf("%-15s", (char *) Language(423));
/* Listing Files */
else if(exitinfo.iStatus == FILELIST)
printf("%-15s", (char *) Language(424));
/* Banking Door */
else if(exitinfo.iStatus == TIMEBANK)
printf("%-15s", (char *) Language(426));
/* Safe Door */
else if(exitinfo.iStatus == SAFE)
printf("%-15s", (char *) Language(427));
/* WhosOn List */
else if(exitinfo.iStatus == WHOSON)
printf("%-15s", (char *) Language(428));
/* Idle */
else
printf("%s", (char *) Language(429));
colour(12, 0);
printf("%-25s\n", exitinfo.sLocation);
fclose(pExitinfo);
}
}
closedir(Directory);
ReadExitinfo();
colour(2, 0);
fLine(79);
free(tmp);
free(temp);
free(Underline);
free(Heading);
printf("\n");
}
/*
* Function will update users file and and update exitinfo.iStatus
*/
void WhosDoingWhat(int iStatus)
{
char *temp;
temp = calloc(PATH_MAX, sizeof(char));
ReadExitinfo();
exitinfo.iStatus = iStatus;
WriteExitinfo();
switch(iStatus) {
case BROWSING:
strcpy(temp, "Browsing Menus");
break;
case DOWNLOAD:
strcpy(temp, "Downloading");
LC_Download = TRUE;
break;
case UPLOAD:
strcpy(temp, "Uploading");
LC_Upload = TRUE;
break;
case READ_POST:
strcpy(temp, "Read/post Messages");
LC_Read = TRUE;
break;
case DOOR:
strcpy(temp, "External Door");
LC_Door = TRUE;
break;
case SYSOPCHAT:
strcpy(temp, "Sysop Chat");
LC_Chat = TRUE;
break;
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;
case OLR:
strcpy(temp, "Offline Reader");
LC_Olr = TRUE;
break;
}
IsDoing(temp);
free(temp);
}
/*
* Function will allow a user to send a on-line message to another user
* It will prompt the user for the username. The message is sent thru
* mbsed, from the resonse message we can see if we succeeded.
*/
void SendOnlineMsg(char *OpData)
{
static char buf[128];
char *User, *String;
User = calloc(36, sizeof(char));
String = calloc(77, sizeof(char));
WhosOn(OpData);
/* Please enter username to send message to: */
pout(3, 0, (char *) Language(430));
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
GetstrC(User, 35);
if (!strcmp(User, "")) {
free(User);
free(String);
return;
}
/* Please enter message to send (Max 76 Characters) */
pout(10, 0, (char *)Language(433));
pout(10, 0, (char *)"\n> ");
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
GetstrC(String, 76);
if ((strcmp(String, "")) != 0) {
buf[0] = '\0';
sprintf(buf, "CSPM:3,%s,%s,%s;", strcmp(OpData, "/H") != 0 ? exitinfo.sUserName : \
strcmp(exitinfo.sHandle, "") == 0 ? exitinfo.sUserName : \
exitinfo.sHandle, User, String);
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:1,3;", 8) == 0) {
/* Sorry, there is no user on */
printf("\n%s %s\n\n", (char *) Language(431), User);
}
if (strncmp(buf, "100:1,2;", 8) == 0) {
printf("\nNo more room in users message buffer\n\n");
}
if (strncmp(buf, "100:1,1;", 8) == 0) {
colour(12, 0);
/* doesn't wish to be disturbed */
printf("\n%s %s\n", User, (char *) Language(432));
}
if (strncmp(buf, "100:0;", 6) == 0) {
printf("Message Sent!\n");
Syslog('+', "Online msg to %s: \"%s\"", User, String);
}
}
}
free(User);
free(String);
Pause();
}

View File

@ -1,13 +1,10 @@
/* $Id$ */
#ifndef _EXITINFO_H
#define _EXITINFO_H
void InitExitinfo(void); /* Create exitinfo */
void ReadExitinfo(void); /* Read Users Config in Memory */
void WriteExitinfo(void); /* Write Users config from memory */
void WhosOn(char *); /* What users are currently online */
void WhosDoingWhat(int); /* Update what user is doing */
void SendOnlineMsg(char *); /* Send On-Line Message to User */
#endif

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/file.c
* $Id$
* Purpose ...............: All the file functions.
* Last modification date : 30-Sep-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -38,11 +37,12 @@
#include "filesub.h"
#include "file.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
#include "timeout.h"
#include "exitinfo.h"
#include "whoson.h"
#include "change.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/filesub.c
* $Id$
* Purpose ...............: All the file sub functions.
* Last modification date : 30-Sep-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -39,6 +38,7 @@
#include "funcs.h"
#include "language.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "timeout.h"
#include "exitinfo.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/funcs.c
* $Id$
* Purpose ...............: Misc functions
* Last modification date : 29-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -38,22 +37,24 @@
#include "../lib/msg.h"
#include "../lib/clcomm.h"
#include "funcs.h"
#include "language.h"
#include "funcs4.h"
#include "language.h"
#include "input.h"
#include "oneline.h"
#include "misc.h"
#include "bye.h"
#include "timeout.h"
#include "timecheck.h"
#include "exitinfo.h"
//#include "whoson.h"
#include "mail.h"
#include "email.h"
extern long ActiveMsgs;
extern time_t t_start;
extern int e_pid;
extern char **environ;
//extern time_t t_start;
//extern int e_pid;
//extern char **environ;
/*
@ -231,388 +232,6 @@ void TimeStats()
char *Gdate(time_t, int);
char *Gdate(time_t tt, int Y2K)
{
static char GLC[15];
struct tm *tm;
tm = localtime(&tt);
if (Y2K)
sprintf(GLC, "%02d-%02d-%04d", tm->tm_mon +1, tm->tm_mday, tm->tm_year + 1900);
else
sprintf(GLC, "%02d-%02d-%02d", tm->tm_mon +1, tm->tm_mday, tm->tm_year % 100);
return (GLC);
}
char *Rdate(char *, int);
char *Rdate(char *ind, int Y2K)
{
static char GLC[15];
memset(&GLC, 0, sizeof(GLC));
GLC[0] = ind[3];
GLC[1] = ind[4];
GLC[2] = '-';
GLC[3] = ind[0];
GLC[4] = ind[1];
GLC[5] = '-';
if (Y2K) {
GLC[6] = ind[6];
GLC[7] = ind[7];
GLC[8] = ind[8];
GLC[9] = ind[9];
} else {
GLC[6] = ind[8];
GLC[7] = ind[9];
}
return GLC;
}
/*
* Function will run a external program or door
*/
void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSuid)
{
char *String, *String1;
int i, rc;
char *temp1;
FILE *fp;
temp1 = calloc(PATH_MAX, sizeof(char));
String = calloc(81, sizeof(char));
WhosDoingWhat(DOOR);
if ((strstr(Program, "/N")) != NULL) {
sprintf(temp1, "%d", iNode);
strreplace(Program, (char *)"/N", temp1);
}
if ((strstr(Program, "/A")) != NULL) {
colour(3, 0);
if ((String = strstr(Program, "/T=")) != NULL) {
String1 = String + 3;
printf("\n%s", String1);
} else
printf("\nPlease enter filename: ");
fflush(stdout);
colour(CFG.InputColourF, CFG.InputColourB);
GetstrC(temp1, 80);
strreplace(Program, (char *)"/A", temp1);
for(i = 0; i < strlen(Program); i++) {
if (*(Program + i) == '\0')
break;
if (*(Program + i) == '/')
*(Program + i) = '\0';
}
}
free(String);
Syslog('+', "Door: %s", Program);
ReadExitinfo();
alarm_set((exitinfo.iTimeLeft * 60) - 10);
Altime((exitinfo.iTimeLeft * 60));
/*
* Always remove the old door.sys first.
*/
sprintf(temp1, "%s/%s/door.sys", CFG.bbs_usersdir, exitinfo.Name);
unlink(temp1);
/*
* Write door.sys in users homedirectory
*/
if (!NoDoorsys) {
if ((fp = fopen(temp1, "w+")) == NULL) {
WriteError("$Can't create %s", temp1);
} else {
if (Comport) {
fprintf(fp, "COM1:\r\n"); /* COM port */
fprintf(fp, "19200\r\n");/* Effective baudrate */
} else {
fprintf(fp, "COM0:\r\n");/* COM port */
fprintf(fp, "0\r\n"); /* Effective baudrate */
}
fprintf(fp, "8\r\n"); /* Databits */
fprintf(fp, "%d\r\n", iNode); /* Node number */
if (Comport)
fprintf(fp, "19200\r\n");/* Locked baudrate */
else
fprintf(fp, "%ld\r\n", ttyinfo.portspeed); /* Locked baudrate */
fprintf(fp, "Y\r\n"); /* Screen display */
fprintf(fp, "N\r\n"); /* Printer on */
fprintf(fp, "Y\r\n"); /* Page bell */
fprintf(fp, "Y\r\n"); /* Caller alarm */
fprintf(fp, "%s\r\n", exitinfo.sUserName);
fprintf(fp, "%s\r\n", exitinfo.sLocation);
fprintf(fp, "%s\r\n", exitinfo.sVoicePhone);
fprintf(fp, "%s\r\n", exitinfo.sDataPhone);
fprintf(fp, "%s\r\n", exitinfo.Password);
fprintf(fp, "%d\r\n", exitinfo.Security.level);
fprintf(fp, "%d\r\n", exitinfo.iTotalCalls);
fprintf(fp, "%s\r\n", Gdate(exitinfo.tLastLoginDate, Y2Kdoorsys));
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft * 60);
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft);
fprintf(fp, "GR\r\n"); /* ANSI graphics */
fprintf(fp, "%d\r\n", exitinfo.iScreenLen);
fprintf(fp, "N\r\n"); /* User mode, always N */
fprintf(fp, "\r\n"); /* Always blank */
fprintf(fp, "\r\n"); /* Always blank */
fprintf(fp, "%s\r\n", Rdate(exitinfo.sExpiryDate, Y2Kdoorsys));
fprintf(fp, "%d\r\n", grecno); /* Users recordnumber */
fprintf(fp, "%s\r\n", exitinfo.sProtocol);
fprintf(fp, "%ld\r\n", exitinfo.Uploads);
fprintf(fp, "%ld\r\n", exitinfo.Downloads);
fprintf(fp, "%ld\r\n", LIMIT.DownK);
fprintf(fp, "%ld\r\n", LIMIT.DownK);
fprintf(fp, "%s\r\n", Rdate(exitinfo.sDateOfBirth, Y2Kdoorsys));
fprintf(fp, "\r\n"); /* Path to userbase */
fprintf(fp, "\r\n"); /* Path to messagebase */
fprintf(fp, "%s\r\n", CFG.sysop_name);
fprintf(fp, "%s\r\n", exitinfo.sHandle);
fprintf(fp, "none\r\n"); /* Next event time */
fprintf(fp, "Y\r\n"); /* Error free connect. */
fprintf(fp, "N\r\n"); /* Always N */
fprintf(fp, "Y\r\n"); /* Always Y */
fprintf(fp, "7\r\n"); /* Default textcolor */
fprintf(fp, "0\r\n"); /* Always 0 */
fprintf(fp, "%s\r\n", Gdate(exitinfo.tLastLoginDate, Y2Kdoorsys));
fprintf(fp, "%s\r\n", StrTimeHM(t_start));
fprintf(fp, "%s\r\n", LastLoginTime);
fprintf(fp, "32768\r\n"); /* Always 32768 */
fprintf(fp, "%d\r\n", exitinfo.DownloadsToday);
fprintf(fp, "%ld\r\n", exitinfo.UploadK);
fprintf(fp, "%ld\r\n", exitinfo.DownloadK);
fprintf(fp, "%s\r\n", exitinfo.sComment);
fprintf(fp, "0\r\n"); /* Always 0 */
fprintf(fp, "%d\r\n\032", exitinfo.iPosted);
fclose(fp);
}
}
clear();
printf("Loading ...\n\n");
if (NoSuid)
rc = exec_nosuid(Program);
else
rc = execute((char *)"/bin/sh", (char *)"-c", Program, NULL, NULL, NULL);
Altime(0);
alarm_off();
alarm_on();
Syslog('+', "Door end, rc=%d", rc);
free(temp1);
printf("\n\n");
Pause();
}
/*
* Execute a door as real user, not suid.
*/
int exec_nosuid(char *mandato)
{
int rc, status;
pid_t pid;
if (mandato == NULL)
return 1; /* Prevent running a shell */
Syslog('+', "Execve: /bin/sh -c %s", mandato);
pid = fork();
if (pid == -1)
return 1;
if (pid == 0) {
char *argv[4];
argv[0] = (char *)"sh";
argv[1] = (char *)"-c";
argv[2] = mandato;
argv[3] = 0;
execve("/bin/sh", argv, environ);
exit(127);
}
e_pid = pid;
do {
rc = waitpid(pid, &status, 0);
e_pid = 0;
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
switch(rc) {
case -1:
WriteError("$Waitpid returned %d, status %d,%d", rc,status>>8,status&0xff);
return -1;
case 0:
return 0;
default:
if (WIFEXITED(status)) {
rc = WEXITSTATUS(status);
if (rc) {
WriteError("Exec_nosuid: returned error %d", rc);
return rc;
}
}
if (WIFSIGNALED(status)) {
rc = WTERMSIG(status);
WriteError("Wait stopped on signal %d", rc);
return rc;
}
if (rc)
WriteError("Wait stopped unknown, rc=%d", rc);
return rc;
}
return 0;
}
/*
* Function will display textfile in either ansi or ascii and
* display control codes if they exist.
* Returns Success if it can display the requested file
*/
int DisplayFile(char *filename)
{
FILE *pFileName;
long iSec = 0;
char *sFileName, *tmp, *tmp1;
char newfile[PATH_MAX];
int i, x;
sFileName = calloc(16385, sizeof(char));
tmp = calloc(PATH_MAX, sizeof(char));
tmp1 = calloc(PATH_MAX, sizeof(char));
/*
* Open the file in the following search order:
* 1 - if GraphMode -> users language .ans
* 2 - if GraphMode -> default language .ans
* 3 - users language .asc
* 4 - default language .asc
* 5 - Abort, there is no file to show.
*/
pFileName = NULL;
if (exitinfo.GraphMode) {
sprintf(newfile, "%s/%s.ans", lang.TextPath, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) {
sprintf(newfile, "%s/%s.ans", CFG.bbs_txtfiles, filename);
pFileName = fopen(newfile, "rb");
}
}
if (pFileName == NULL) {
sprintf(newfile, "%s/%s.asc", lang.TextPath, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) {
sprintf(newfile, "%s/%s.asc", CFG.bbs_txtfiles, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) {
free(sFileName);
free(tmp);
free(tmp1);
return FALSE;
}
}
}
Syslog('B', "Displayfile %s", newfile);
while (!feof(pFileName)) {
i = fread(sFileName, sizeof(char), 16384, pFileName);
for(x = 0; x < i; x++) {
switch(*(sFileName + x)) {
case '':
ControlCodeU(sFileName[++x]);
break;
case '':
ControlCodeF(sFileName[++x]);
break;
case ' ':
ControlCodeK(sFileName[++x]);
break;
case '':
fflush(stdout);
fflush(stdin);
alarm_on();
Getone();
break;
case '':
/*
* This code will allow you to specify a security level
* in front of the text, ie ^B32000^Bthis is a test^B
* will print this is a test only if you have security
* above 32000. Only one set of control chars per line.
* You cannot have multiple securitys etc
*/
x++;
strcpy(tmp1, "");
while (*(sFileName + x) != '') {
sprintf(tmp, "%c", *(sFileName + x));
strcat(tmp1, tmp);
x++;
}
x++;
iSec = atoi(tmp1);
while ((x <= i) && (*(sFileName + x) != '')) {
if (exitinfo.Security.level >= iSec)
printf("%c", *(sFileName + x));
x++;
}
break;
case '':
fflush(stdout);
sleep(1);
break;
default:
printf("%c", *(sFileName + x));
} /* switch */
} /* for */
} /* while !eof */
fclose(pFileName);
free(sFileName);
free(tmp);
free(tmp1);
return TRUE;
}
int DisplayFileEnter(char *File)
{
int rc;
rc = DisplayFile(File);
Enter(1);
/* Press ENTER to continue */
language(13, 0, 436);
fflush(stdout);
fflush(stdin);
alarm_on();
Getone();
return rc;
}
int CheckFile(char *File, int iArea)
{
FILE *pFileB;
@ -646,311 +265,6 @@ int CheckFile(char *File, int iArea)
void ControlCodeF(int ch)
{
/* Update user info */
ReadExitinfo();
switch (toupper(ch)) {
case '!':
printf(exitinfo.sProtocol);
break;
case 'A':
printf("%ld", exitinfo.Uploads);
break;
case 'B':
printf("%ld", exitinfo.Downloads);
break;
case 'C':
printf("%lu", exitinfo.DownloadK);
break;
case 'D':
printf("%lu", exitinfo.UploadK);
break;
case 'E':
printf("%lu", exitinfo.DownloadK + exitinfo.UploadK);
break;
case 'F':
printf("%lu", LIMIT.DownK);
break;
case 'G':
printf("%d", exitinfo.iTransferTime);
break;
case 'H':
printf("%d", iAreaNumber);
break;
case 'I':
printf(sAreaDesc);
break;
case 'J':
printf("%u", LIMIT.DownF);
break;
case 'K':
printf("%s", LIMIT.Description);
break;
default:
printf(" ");
}
}
void ControlCodeU(int ch)
{
/*
* Update user info
*/
TimeCheck();
ReadExitinfo();
switch (toupper(ch)) {
case 'A':
printf("%s", exitinfo.sUserName);
break;
case 'B':
printf(exitinfo.sLocation);
break;
case 'C':
printf(exitinfo.sVoicePhone);
break;
case 'D':
printf(exitinfo.sDataPhone);
break;
case 'E':
printf(LastLoginDate);
break;
case 'F':
printf("%s %s", StrDateDMY(exitinfo.tFirstLoginDate), StrTimeHMS(exitinfo.tFirstLoginDate));
break;
case 'G':
printf(LastLoginTime);
break;
case 'H':
printf("%d", exitinfo.Security.level);
break;
case 'I':
printf("%d", exitinfo.iTotalCalls);
break;
case 'J':
printf("%d", exitinfo.iTimeUsed);
break;
case 'K':
printf("%d", exitinfo.iConnectTime);
break;
case 'L':
printf("%d", exitinfo.iTimeLeft);
break;
case 'M':
printf("%d", exitinfo.iScreenLen);
break;
case 'N':
printf(FirstName);
break;
case 'O':
printf(LastName);
break;
case 'Q':
printf("%s", exitinfo.ieNEWS ? (char *) Language(147) : (char *) Language(148));
break;
case 'P':
printf("%s", exitinfo.GraphMode ? (char *) Language(147) : (char *) Language(148));
break;
case 'R':
printf("%s", exitinfo.HotKeys ? (char *) Language(147) : (char *) Language(148));
break;
case 'S':
printf("%d", exitinfo.iTimeUsed + exitinfo.iTimeLeft);
break;
case 'T':
printf(exitinfo.sDateOfBirth);
break;
case 'U':
printf("%d", exitinfo.iPosted);
break;
case 'X':
printf(lang.Name);
break;
case 'Y':
printf(exitinfo.sHandle);
break;
case 'Z':
printf("%s", exitinfo.DoNotDisturb ? (char *) Language(147) : (char *) Language(148));
break;
case '1':
printf("%s", exitinfo.MailScan ? (char *) Language(147) : (char *) Language(148));
break;
case '2':
printf("%s", exitinfo.ieFILE ? (char *) Language(147) : (char *) Language(148));
break;
case '3':
printf("%s", exitinfo.FsMsged ? (char *) Language(147) : (char *) Language(148));
break;
case '4':
printf("%s", exitinfo.FSemacs ? (char *) Language(147) : (char *) Language(148));
break;
case '5':
printf(exitinfo.address[0]);
break;
case '6':
printf(exitinfo.address[1]);
break;
case '7':
printf(exitinfo.address[2]);
break;
default:
printf(" ");
}
}
void ControlCodeK(int ch)
{
FILE *pCallerLog;
char sDataFile[PATH_MAX];
lastread LR;
switch (toupper(ch)) {
case 'A':
printf("%s", (char *) GetDateDMY());
break;
case 'B':
printf("%s", (char *) GetLocalHMS());
break;
case 'C':
printf("%s", (char *) GLCdate());
break;
case 'D':
printf("%s", (char *) GLCdateyy());
break;
case 'E':
printf("%d", Speed() );
break;
case 'F':
printf("%s", LastCaller);
break;
case 'G':
printf("%d", TotalUsers());
break;
case 'H':
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
if((pCallerLog = fopen(sDataFile, "rb")) != NULL) {
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
printf("%ld", SYSINFO.SystemCalls);
fclose(pCallerLog);
}
break;
case 'I':
printf("%d", iMsgAreaNumber + 1);
break;
case 'J':
printf(sMsgAreaDesc);
break;
case 'K':
printf("%s", Oneliner_Get());
break;
case 'L':
SetMsgArea(iMsgAreaNumber);
printf("%ld", MsgBase.Total);
break;
case 'M':
LR.UserID = grecno;
if (Msg_Open(sMsgAreaBase)) {
if (Msg_GetLastRead(&LR) == TRUE) {
if (LR.HighReadMsg > MsgBase.Highest)
LR.HighReadMsg = MsgBase.Highest;
printf("%ld", LR.HighReadMsg);
} else
printf("?");
Msg_Close();
}
break;
case 'N':
printf("%s", sMailbox);
break;
case 'O':
SetEmailArea(sMailbox);
printf("%ld", EmailBase.Total);
break;
case 'P':
sprintf(sDataFile, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, sMailbox);
LR.UserID = grecno;
if (Msg_Open(sDataFile)) {
if (Msg_GetLastRead(&LR) == TRUE) {
if (LR.HighReadMsg > EmailBase.Highest)
LR.HighReadMsg = EmailBase.Highest;
printf("%ld", LR.HighReadMsg);
} else
printf("?");
Msg_Close();
}
break;
default:
printf(" ");
}
}
/*
* View a textfile.
*/
@ -1037,79 +351,4 @@ void LogEntry(char *Log)
/*
* Function will take two date strings in the following format DD-MM-YYYY and
* swap them around in the following format YYYYMMDD
* ie. 01-02-1995 will become 19950201 so that the leading Zeros are not in
* the beginning as leading Zeros will fall away if you try compare the
* two with a if statement (Millenium proof).
*/
void SwapDate(char *Date3, char *Date4)
{
char *temp2, *temp3;
temp2 = calloc(10, sizeof(char));
temp3 = calloc(10, sizeof(char));
Date1 = calloc(10, sizeof(char));
Date2 = calloc(10, sizeof(char));
temp2[0] = Date3[6];
temp2[1] = Date3[7];
temp2[2] = Date3[8];
temp2[3] = Date3[9];
temp2[4] = Date3[3];
temp2[5] = Date3[4];
temp2[6] = Date3[0];
temp2[7] = Date3[1];
temp2[8] = '\0';
temp3[0] = Date4[6];
temp3[1] = Date4[7];
temp3[2] = Date4[8];
temp3[3] = Date4[9];
temp3[4] = Date4[3];
temp3[5] = Date4[4];
temp3[6] = Date4[0];
temp3[7] = Date4[1];
temp3[8] = '\0';
strcpy(Date1, temp2);
strcpy(Date2, temp3);
free(temp2);
free(temp3);
}
/*
* Function returns total number of bbs users
*/
int TotalUsers()
{
FILE *pUsrConfig;
int ch = 0;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( pUsrConfig = fopen(temp,"rb")) == NULL)
WriteError("ControlCodeK: Can't open users file %s for reading", temp);
else {
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1)
if ((!u.Deleted) && (strlen(u.sUserName) > 0))
ch++;
fclose(pUsrConfig);
}
free(temp);
return ch;
}

View File

@ -1,4 +1,4 @@
/* funcs.h */
/* $Id$ */
#ifndef _FUNCS_H
#define _FUNCS_H
@ -6,19 +6,9 @@
int Access(securityrec, securityrec); /* Check security access */
void UserList(char *); /* Get complete users list */
void TimeStats(void); /* Get users Time Statistics */
void ExtDoor(char *, int, int, int, int); /* Run external door */
int exec_nosuid(char *); /* Execute as real user */
int DisplayFile(char *); /* Display .ans/.asc textfile */
int DisplayFileEnter(char *); /* Display .ans/.asc wait for Enter */
int CheckFile(char *, int); /* Check for Dupe file in Database */
void ControlCodeF(int); /* Check Control Codes in File */
void ControlCodeU(int); /* Check Control Codes in File */
void ControlCodeK(int); /* Check Control Codes in File */
void ViewTextFile(char *); /* View text file */
void LogEntry(char *); /* Create log entry in logfile */
void SwapDate(char *, char *); /* Swap two Date strings around */
int TotalUsers(void); /* Returns total numbers of users */
#endif

View File

@ -36,6 +36,7 @@
#include "../lib/common.h"
#include "../lib/msg.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "timeout.h"
#include "language.h"
@ -76,441 +77,6 @@ int CheckStatus()
/*
* Get a character string with cursor position
*/
void GetstrP(char *sStr, int iMaxLen, int Position)
{
unsigned char ch = 0;
int iPos = Position;
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 1");
return;
}
Setraw();
alarm_on();
while (ch != KEY_ENTER) {
fflush(stdout);
ch = Readkey();
if ((ch == KEY_BACKSPACE) || (ch == KEY_DEL) || (ch == KEY_RUBOUT)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos <= iMaxLen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a character string
*/
void GetstrC(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 6");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* get a string, don't allow spaces (for Unix accounts)
*/
void GetstrU(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 6");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
if (isalnum(ch) || (ch == '@') || (ch == '.')) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a phone number, only allow digits, + and - characters.
*/
void GetPhone(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 5");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == '+')) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a number, allow digits, spaces, minus sign, points and comma's
*/
void Getnum(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 5");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == ' ') \
|| (ch == ',') || (ch == '.')) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* This function gets the date from the user checking the length and
* putting two minus signs in the right places
*/
void GetDate(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
strcpy(sStr, "");
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 4");
return;
}
Setraw();
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0)
printf("\b \b");
else
putchar('\007');
if (iPos == 3 || iPos == 6) {
printf("\b \b");
--iPos;
}
sStr[--iPos]='\0';
}
if (ch >= '0' && ch <= '9') {
if (iPos < iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
if (iPos == 2 || iPos == 5) {
printf("-");
sprintf(sStr, "%s-", sStr);
iPos++;
}
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a string, capitalize only if set in config.
*/
void Getname(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0, iNewPos = 0;
fflush(stdout);
strcpy(sStr, "");
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 2");
return;
}
Setraw();
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if (ch > 31 && (ch < 127)) {
if (iPos < iMaxlen) {
iPos++;
if (iPos == 1 && CFG.iCapUserName)
ch = toupper(ch);
if (ch == 32) {
iNewPos = iPos;
iNewPos++;
}
if (iNewPos == iPos && CFG.iCapUserName)
ch = toupper(ch);
else
if (CFG.iCapUserName)
ch = tolower(ch);
if (iPos == 1 && CFG.iCapUserName)
ch = toupper(ch);
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a Fidonet style username, always capitalize.
*/
void GetnameNE(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0, iNewPos = 0;
fflush(stdout);
strcpy(sStr, "");
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 2");
return;
}
Setraw();
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos < iMaxlen) {
iPos++;
if (iPos == 1)
ch = toupper(ch);
if (ch == 32) {
iNewPos = iPos;
iNewPos++;
}
if (iNewPos == iPos)
ch = toupper(ch);
else
ch = tolower(ch);
if (iPos == 1)
ch = toupper(ch);
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Function will Scan Users Database for existing phone numbers. If
* found, it will write a log entry to the logfile. The user WILL NOT
@ -549,39 +115,6 @@ int TelephoneScan(char *Number, char *Name)
void Pause()
{
int i, x;
char *string;
string = malloc(81);
/* Press (Enter) to continue: */
sprintf(string, "\r%s", (char *) Language(375));
colour(CFG.CRColourF, CFG.CRColourB);
printf(string);
do {
fflush(stdout);
fflush(stdin);
alarm_on();
i = Getone();
} while ((i != '\r') && (i != '\n'));
x = strlen(string);
for(i = 0; i < x; i++)
printf("\b");
for(i = 0; i < x; i++)
printf(" ");
for(i = 0; i < x; i++)
printf("\b");
fflush(stdout);
free(string);
}
/*
* Function to check if UserName exists and returns a 0 or 1
*/

View File

@ -1,19 +1,12 @@
/* $Id$ */
#ifndef _FUNCS4_H
#define _FUNCS4_H
void UserSilent(int); /* Update users silent flag info */
int CheckStatus(void); /* Check BBS open status */
void GetstrU(char *, int); /* Get string, forbid spaces */
void GetstrP(char *, int, int); /* Get string with cursor position */
void GetstrC(char *, int); /* Get string, length, clear string */
void Getnum(char *, int); /* Get only numbers from user */
void Getname(char *, int); /* Get name & convert every 1st char to U/C */
void GetnameNE(char *, int); /* Get name & convert every 1st char to U/C */
void GetDate(char *, int); /* Get users birth date and check */
void GetPhone(char *, int); /* Get telephone number */
int TelephoneScan(char *, char *);/* Scans for Duplicate User Phone Numbers */
void Pause(void); /* Puts Pause on Screen and halts screen */
int CheckName(char *); /* Check if user name exists */
char *logdate(void); /* Returns DD-Mon HH:MM:SS */
char *NameGen(char *); /* Get and test for unix login */
@ -29,4 +22,3 @@ char *GetMonth(int); /* Returns Mmm */
#endif

510
mbsebbs/input.c Normal file
View File

@ -0,0 +1,510 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Input functions, also for some utils.
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* 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 "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "input.h"
#include "timeout.h"
#include "language.h"
/*
* Get a character string with cursor position
*/
void GetstrP(char *sStr, int iMaxLen, int Position)
{
unsigned char ch = 0;
int iPos = Position;
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 1");
return;
}
Setraw();
alarm_on();
while (ch != KEY_ENTER) {
fflush(stdout);
ch = Readkey();
if ((ch == KEY_BACKSPACE) || (ch == KEY_DEL) || (ch == KEY_RUBOUT)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos <= iMaxLen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a character string
*/
void GetstrC(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 6");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* get a string, don't allow spaces (for Unix accounts)
*/
void GetstrU(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 6");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
if (isalnum(ch) || (ch == '@') || (ch == '.')) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a phone number, only allow digits, + and - characters.
*/
void GetPhone(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 5");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == '+')) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a number, allow digits, spaces, minus sign, points and comma's
*/
void Getnum(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 5");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == ' ') \
|| (ch == ',') || (ch == '.')) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* This function gets the date from the user checking the length and
* putting two minus signs in the right places
*/
void GetDate(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
strcpy(sStr, "");
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 4");
return;
}
Setraw();
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0)
printf("\b \b");
else
putchar('\007');
if (iPos == 3 || iPos == 6) {
printf("\b \b");
--iPos;
}
sStr[--iPos]='\0';
}
if (ch >= '0' && ch <= '9') {
if (iPos < iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
if (iPos == 2 || iPos == 5) {
printf("-");
sprintf(sStr, "%s-", sStr);
iPos++;
}
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a string, capitalize only if set in config.
*/
void Getname(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0, iNewPos = 0;
fflush(stdout);
strcpy(sStr, "");
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 2");
return;
}
Setraw();
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if (ch > 31 && (ch < 127)) {
if (iPos < iMaxlen) {
iPos++;
if (iPos == 1 && CFG.iCapUserName)
ch = toupper(ch);
if (ch == 32) {
iNewPos = iPos;
iNewPos++;
}
if (iNewPos == iPos && CFG.iCapUserName)
ch = toupper(ch);
else
if (CFG.iCapUserName)
ch = tolower(ch);
if (iPos == 1 && CFG.iCapUserName)
ch = toupper(ch);
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
/*
* Get a Fidonet style username, always capitalize.
*/
void GetnameNE(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0, iNewPos = 0;
fflush(stdout);
strcpy(sStr, "");
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 2");
return;
}
Setraw();
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos < iMaxlen) {
iPos++;
if (iPos == 1)
ch = toupper(ch);
if (ch == 32) {
iNewPos = iPos;
iNewPos++;
}
if (iNewPos == iPos)
ch = toupper(ch);
else
ch = tolower(ch);
if (iPos == 1)
ch = toupper(ch);
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
void Pause()
{
int i, x;
char *string;
string = malloc(81);
/* Press (Enter) to continue: */
sprintf(string, "\r%s", (char *) Language(375));
colour(CFG.CRColourF, CFG.CRColourB);
printf(string);
do {
fflush(stdout);
fflush(stdin);
alarm_on();
i = Getone();
} while ((i != '\r') && (i != '\n'));
x = strlen(string);
for(i = 0; i < x; i++)
printf("\b");
for(i = 0; i < x; i++)
printf(" ");
for(i = 0; i < x; i++)
printf("\b");
fflush(stdout);
free(string);
}

18
mbsebbs/input.h Normal file
View File

@ -0,0 +1,18 @@
/* $Id$ */
#ifndef _INPUT_H
#define _INPUT_H
void GetstrU(char *, int); /* Get string, forbid spaces */
void GetstrP(char *, int, int); /* Get string with cursor position */
void GetstrC(char *, int); /* Get string, length, clear string */
void Getnum(char *, int); /* Get only numbers from user */
void Getname(char *, int); /* Get name & convert every 1st char to U/C */
void GetnameNE(char *, int); /* Get name & convert every 1st char to U/C */
void GetDate(char *, int); /* Get users birth date and check */
void GetPhone(char *, int); /* Get telephone number */
void Pause(void); /* Puts Pause on Screen and halts screen */
#endif

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/language.c
* $Id$
* Purpose ...............: Language functions.
* Last modification date : 28-Jun-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -35,7 +34,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"

View File

@ -1,14 +1,13 @@
/*****************************************************************************
*
* File ..................: bbs/lineedit.c
* $Id$
* Purpose ...............: Message line editor.
* Last modification date : 06-Jul-1999
*
*****************************************************************************
* Copyright (C) 1997-1999
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:2801/16
* Beekmansbos 10 Internet: mbroek@ux123.pttnwb.nl
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
@ -36,7 +35,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "mail.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "timeout.h"
#include "lineedit.h"

View File

@ -45,7 +45,7 @@
#include "../lib/msg.h"
#include "mail.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
#include "timeout.h"
@ -57,6 +57,7 @@
#include "msgutil.h"
#include "pop3.h"
#include "email.h"
#include "whoson.h"

227
mbsebbs/mbnewusr.c Normal file
View File

@ -0,0 +1,227 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: New user registration
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* 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 "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "mbnewusr.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
#include "bye.h"
#include "timeout.h"
#include "newuser.h"
extern int do_quiet; /* Logging quiet flag */
time_t t_start;
char *StartTime;
int main(int argc, char **argv)
{
char *p, *tty;
FILE *pTty;
int i;
char temp[PATH_MAX];
struct passwd *pw;
#ifdef MEMWATCH
mwInit();
#endif
printf("Loading MBSE BBS New User Registration ...\n");
pTTY = calloc(15, sizeof(char));
tty = ttyname(1);
/*
* Get MBSE_ROOT Path and load Config into Memory
*/
FindMBSE();
if (!strlen(CFG.startname)) {
printf("FATAL: No bbs startname, edit mbsetup 1.2.10\n");
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
/*
* Set uid and gid to the "mbse" user.
*/
if ((pw = getpwnam((char *)"mbse")) == NULL) {
perror("Can't find user \"mbse\" in /etc/passwd");
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
if ((setuid(pw->pw_uid) == -1) || (setgid(pw->pw_gid) == -1)) {
perror("Can't setuid() or setgid() to \"mbse\" user");
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
/*
* Set local time and statistic indexes.
*/
time(&Time_Now);
time(&t_start);
l_date = localtime(&Time_Now);
Diw = l_date->tm_wday;
Miy = l_date->tm_mon;
time(&ltime);
/*
* Initialize this client with the server. We don't know
* who is at the other end of the line, so that's what we tell.
*/
do_quiet = TRUE;
InitClient((char *)"Unknown", (char *)"mbnewusr", (char *)"Unknown", CFG.logfile, CFG.bbs_loglevel, CFG.error_log);
IsDoing("Loging in");
Syslog(' ', " ");
Syslog(' ', "MBNEWUSR v%s", VERSION);
if ((p = getenv("CONNECT")) != NULL)
Syslog('+', "CONNECT %s", p);
if ((p = getenv("CALLER_ID")) != NULL)
if (!strncmp(p, "none", 4))
Syslog('+', "CALLER %s", p);
sUnixName[0] = '\0';
/*
* Initialize
*/
InitLanguage();
if ((tty = ttyname(0)) == NULL) {
WriteError("Not at a tty");
Quick_Bye(0);
}
if (strncmp("/dev/", tty, 5) == 0)
sprintf(pTTY, "%s", tty+5);
else if (*tty == '/') {
tty = strrchr(ttyname(0), '/');
++tty;
sprintf(pTTY, "%s", tty);
}
umask(007);
/*
* Trap signals
*/
for(i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) ||
(i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
signal(i, (void (*))die);
else
signal(i, SIG_IGN);
}
/*
* Default set the terminal to ANSI mode. If your logo
* is in color, the user will see color no mather what.
*/
TermInit(1);
/*
* Now it's time to check if the bbs is open. If not, we
* log the user off.
*/
if (CheckStatus() == FALSE) {
Syslog('+', "Kicking user out, the BBS is closed");
Quick_Bye(0);
}
clear();
DisplayLogo();
colour(YELLOW, BLACK);
printf("MBSE BBS v%s (Release: %s)\n", VERSION, ReleaseDate);
colour(WHITE, BLACK);
printf("%s\n\n", COPYRIGHT);
/*
* Check if this port is available.
*/
sprintf(temp, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
iNode = 0;
if ((pTty = fopen(temp, "r")) == NULL) {
WriteError("Can't read %s", temp);
} else {
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, pTty);
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, pTty) == 1) {
iNode++;
if (strcmp(ttyinfo.tty, pTTY) == 0)
break;
}
fclose(pTty);
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
printf("No BBS on this port allowed!\n\n");
Quick_Bye(0);
}
Syslog('b', "Node number %d", iNode);
/*
* Ask whether to display Connect String
*/
if (CFG.iConnectString) {
/* Connected on port */
colour(CYAN, BLACK);
printf("%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
/* on */
printf("%s %s\n", (char *) Language(135), ctime(&ltime));
}
}
alarm_on();
Pause();
newuser();
Quick_Bye(0);
return 0;
}

10
mbsebbs/mbnewusr.h Normal file
View File

@ -0,0 +1,10 @@
/* $Id$ */
#ifndef _MBNEWUSR_H
#define _MBNEWUSR_H
#define ReleaseDate __DATE__
#endif

View File

@ -37,7 +37,7 @@
#include "../lib/msg.h"
#include "mbsebbs.h"
#include "user.h"
#include "funcs.h"
#include "dispfile.h"
#include "funcs4.h"
#include "language.h"
#include "menu.h"
@ -57,7 +57,6 @@ int main(int argc, char **argv)
char *p, *tty;
int i;
char temp[PATH_MAX];
struct passwd *pw;
#ifdef MEMWATCH
mwInit();
@ -76,31 +75,6 @@ int main(int argc, char **argv)
* Get MBSE_ROOT Path and load Config into Memory
*/
FindMBSE();
if (!strlen(CFG.startname)) {
printf("FATAL: No bbs startname, edit mbsetup 1.1.10\n");
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
/*
* Set uid and gid to the "mbse" user.
*/
if ((pw = getpwnam((char *)"mbse")) == NULL) {
perror("Can't find user \"mbse\" in /etc/passwd");
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
if ((setuid(pw->pw_uid) == -1) || (setgid(pw->pw_gid) == -1)) {
perror("Can't setuid() or setgid() to \"mbse\" user");
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
/*
* Set local time and statistic indexes.
@ -113,11 +87,10 @@ int main(int argc, char **argv)
time(&ltime);
/*
* Initialize this client with the server. We don't know
* who is at the other end of the line, so that's what we tell.
* Initialize this client with the server.
*/
do_quiet = TRUE;
InitClient((char *)"Unknown", (char *)"mbsebbs", (char *)"Unknown", CFG.logfile, CFG.bbs_loglevel, CFG.error_log);
InitClient(getenv("LOGNAME"), (char *)"mbsebbs", (char *)"Unknown", CFG.logfile, CFG.bbs_loglevel, CFG.error_log);
IsDoing("Loging in");
Syslog(' ', " ");
@ -130,13 +103,11 @@ int main(int argc, char **argv)
Syslog('+', "CALLER %s", p);
sUnixName[0] = '\0';
if (argc == 3) {
iUnixMode = TRUE;
strcpy(sUnixName, argv[2]);
} else if ((getenv("LOGNAME") != NULL) && (strcmp(getenv("LOGNAME"), CFG.startname))) {
iUnixMode = TRUE;
if (getenv("LOGNAME") != NULL) {
strcpy(sUnixName, getenv("LOGNAME"));
} else {
WriteError("No username in environment");
Quick_Bye(0);
}
/*
@ -161,7 +132,7 @@ int main(int argc, char **argv)
sprintf(pTTY, "%s", tty);
}
umask(000);
umask(007);
/*
* Trap signals

View File

@ -43,6 +43,7 @@
#include "file.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "nextuser.h"
#include "safe.h"
@ -52,10 +53,13 @@
#include "pinfo.h"
#include "bye.h"
#include "timecheck.h"
#include "exitinfo.h"
#include "whoson.h"
#include "language.h"
#include "offline.h"
#include "email.h"
#include "door.h"
#include "dispfile.h"
/*

View File

@ -36,6 +36,7 @@
#include "../lib/common.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
#include "timeout.h"

View File

@ -1,9 +1,8 @@
/*****************************************************************************
*
* File ..................: mbsebbs/newuser.c
* $Id$
* Purpose ...............: New User login under Unix, creates both
* BBS and unix accounts.
* Last modification date : 27-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -36,40 +35,42 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
//#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "pwcheck.h"
#include "newuser.h"
#include "language.h"
#include "timeout.h"
#include "change.h"
#include "bye.h"
#include "dispfile.h"
extern int do_quiet; /* No logging to the screen */
extern pid_t mypid; /* Pid of this program */
char UnixName[9]; /* Unix Name */
extern int ieLogin; /* IEMSI Login Successfull */
extern int ieRows; /* Rows on screen */
extern int ieHOT; /* Use Hotkeys */
extern char *ieHandle; /* Users Handle */
extern char *ieLocation; /* Users Location */
extern char *Passwd; /* Plain password */
int newuser(char *FullName)
int newuser()
{
FILE *pUsrConfig;
int i, x, Found, iLang, recno = 0;
int i, x, Found, iLang, recno = 0, Count = 0;
unsigned long crc;
char temp[PATH_MAX];
char temp[PATH_MAX], *FullName;
char *temp1, *temp2;
char *Phone1, *Phone2;
long offset;
struct userrec us;
int badname;
IsDoing("New user login");
Syslog('+', "Newuser registration");
clear();
DisplayFile((char *)"newuser");
iLang = Chg_Language(TRUE);
Enter(1);
@ -77,8 +78,6 @@ int newuser(char *FullName)
language(CYAN, BLACK, 37);
Enter(2);
Syslog('+', "Name entered: %s", FullName);
memset(&usrconfig, 0, sizeof(usrconfig));
memset(&exitinfo, 0, sizeof(exitinfo));
@ -86,92 +85,94 @@ int newuser(char *FullName)
temp2 = calloc(81, sizeof(char));
Phone1 = calloc(81, sizeof(char));
Phone2 = calloc(81, sizeof(char));
FullName = calloc(81, sizeof(char));
usrconfig.iLanguage = iLang;
usrconfig.FsMsged = TRUE;
do {
/* Please enter your First and Last name: */
language(CYAN, BLACK, 0);
fflush(stdout);
alarm_on();
Getname(temp, 35);
strcpy(FullName, tlcap(temp));
Syslog('+', "Name entered: %s", FullName);
/*
* Secret escape name
*/
if ((strcasecmp(temp, "off")) == 0) {
Syslog('+', "Quick \"off\" logout");
Quick_Bye(0);
}
Count++;
if (Count >= CFG.iCRLoginCount) {
Enter(1);
/* Disconnecting user ... */
language(CFG.HiliteF, CFG.HiliteB, 2);
Enter(2);
Syslog('!', "Exceeded maximum login attempts");
Quick_Bye(0);
}
/*
* Check name, duplicate names, unwanted names, single names, they all get
* the same errormessage.
*/
badname = (BadNames(temp) || (CheckName(temp) || (strchr(temp, ' ') == NULL)));
if (badname) {
language(LIGHTRED, BLACK, 386);
Enter(1);
}
} while (badname);
strcpy(FullName, tlcap(temp));
UserCity(mypid, FullName, (char *)"Unknown");
while (TRUE) {
do {
alarm_on();
Enter(1);
/* Use this name: */
language(YELLOW, BLACK, 38);
printf("%s [Y/n]? ", FullName);
fflush(stdout);
fflush(stdin);
GetstrC(temp, 80);
if ((strcasecmp(temp, "y") == 0) || (strcmp(temp, "") == 0))
sprintf(temp, "%s", FullName);
else {
do {
Syslog('+', "User chose to use a different name");
Enter(1);
/* Please enter your First and Last name: */
language(CYAN, BLACK, 0);
fflush(stdout);
alarm_on();
Getname(temp, 35);
if (CheckName(temp))
printf("\n%s\n", (char *) Language(149));
/*
* Do a check to see if name exists
*/
} while ((CheckName(temp) || strchr(temp, ' ') == NULL));
}
} while (BadNames(temp) || *(temp) == '\n');
/*
* Used to get users full name for other functions
*/
strcpy(FullName, tlcap(temp));
UserCity(mypid, FullName, (char *)"Unknown");
while (1) {
Enter(1);
/* Please enter your BBS password, this can be the same as the unix password */
printf("%s\n\n", (char *) Language(388));
/* Please enter new password : */
language(LIGHTCYAN, BLACK, 39);
fflush(stdout);
alarm_on();
Getpass(temp1);
if((x = strlen(temp1)) >= CFG.password_length) {
Enter(1);
/* Please enter password again : */
language(LIGHTCYAN, BLACK, 40);
fflush(stdout);
alarm_on();
Getpass(temp2);
if((i = strcmp(temp1,temp2)) != 0) {
Enter(2);
/* Your passwords do not match! Try again. */
language(LIGHTRED, BLACK, 41);
Enter(1);
} else {
crc = StringCRC32(tu(temp1));
break;
}
} else {
Enter(2);
/* Your password must contain at least */
language(LIGHTRED, BLACK, 42);
printf("%d ", CFG.password_length);
/* characters! Try again. */
language(WHITE, BLACK, 43);
Enter(1);
}
}
memset(Passwd, 0, 16);
sprintf(Passwd, "%s", temp2);
memset(&usrconfig.Password, 0, sizeof(usrconfig.Password));
sprintf(usrconfig.Password, "%s", temp2);
usrconfig.iPassword = crc;
Enter(1);
/* Please enter new password : */
language(LIGHTCYAN, BLACK, 39);
fflush(stdout);
alarm_on();
sprintf(UnixName, "%s", (char *) NameCreate(NameGen(FullName), FullName, temp2));
break;
Getpass(temp1);
if((x = strlen(temp1)) >= CFG.password_length) {
Enter(1);
/* Please enter password again : */
language(LIGHTCYAN, BLACK, 40);
fflush(stdout);
alarm_on();
Getpass(temp2);
if((i = strcmp(temp1,temp2)) != 0) {
Enter(2);
/* Your passwords do not match! Try again. */
language(LIGHTRED, BLACK, 41);
Enter(1);
} else {
crc = StringCRC32(tu(temp1));
break;
}
} else {
Enter(2);
/* Your password must contain at least */
language(LIGHTRED, BLACK, 42);
printf("%d ", CFG.password_length);
/* characters! Try again. */
language(WHITE, BLACK, 43);
Enter(1);
}
}
memset(&usrconfig.Password, 0, sizeof(usrconfig.Password));
sprintf(usrconfig.Password, "%s", temp2);
usrconfig.iPassword = crc;
alarm_on();
sprintf(UnixName, "%s", (char *) NameCreate(NameGen(FullName), FullName, temp2));
strcpy(usrconfig.sUserName, FullName);
strcpy(usrconfig.Name, UnixName);
Time_Now = time(NULL);
@ -259,14 +260,11 @@ int newuser(char *FullName)
if(!CFG.iDataPhone)
printf("\n");
if (ieLogin && (strlen(ieLocation) >= CFG.CityLen) && (strlen(ieLocation) < 24)) {
strcpy(usrconfig.sLocation, ieLocation);
} else {
if (CFG.iLocation) {
if (CFG.iLocation) {
while (TRUE) {
Enter(1);
/* Enter your location */
pout(YELLOW, BLACK, (char *) Language(49));
language(YELLOW, BLACK, 49);
colour(CFG.InputColourF, CFG.InputColourB);
alarm_on();
if (CFG.iCapLocation) { /* Cap Location is turn on, Capitalise first letter */
@ -288,14 +286,13 @@ int newuser(char *FullName)
break;
}
}
}
}
if (CFG.AskAddress) {
while (TRUE) {
Enter(1);
/* Your address, maximum 3 lines (only visible for the sysop): */
pout(LIGHTMAGENTA, BLACK, (char *)Language(474));
language(LIGHTMAGENTA, BLACK, 474);
Enter(1);
for (i = 0; i < 3; i++) {
colour(YELLOW, BLACK);
@ -309,7 +306,7 @@ int newuser(char *FullName)
break;
Enter(1);
/* You need to enter your address here */
pout(LIGHTRED, BLACK, (char *)Language(475));
language(LIGHTRED, BLACK, 475);
Enter(1);
}
}
@ -317,7 +314,7 @@ int newuser(char *FullName)
if (CFG.iHandle) {
Enter(1);
/* Enter a handle (Enter to Quit): */
pout(LIGHTRED, BLACK, (char *) Language(412));
language(LIGHTRED, BLACK, 412);
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
alarm_on();
@ -405,53 +402,44 @@ int newuser(char *FullName)
usrconfig.Security = CFG.newuser_access;
usrconfig.Email = CFG.GiveEmail;
if (ieLogin)
usrconfig.HotKeys = ieHOT;
else {
if (CFG.iHotkeys) {
while (TRUE) {
Enter(1);
/* Would you like hot-keyed menus [Y/n]: */
pout(LIGHTRED, BLACK, (char *) Language(62));
colour(CFG.InputColourF, CFG.InputColourB);
alarm_on();
GetstrC(temp, 8);
if (CFG.iHotkeys) {
while (TRUE) {
Enter(1);
/* Would you like hot-keyed menus [Y/n]: */
pout(LIGHTRED, BLACK, (char *) Language(62));
colour(CFG.InputColourF, CFG.InputColourB);
alarm_on();
GetstrC(temp, 8);
if ((toupper(temp[0]) == Keystroke(62, 0)) || (strcmp(temp,"") == 0)) {
usrconfig.HotKeys = TRUE;
break;
}
if (toupper(temp[0]) == Keystroke(62, 1)) {
usrconfig.HotKeys = FALSE;
break;
} else {
/* Please answer Y or N */
pout(WHITE, BLACK, (char *) Language(63));
}
if ((toupper(temp[0]) == Keystroke(62, 0)) || (strcmp(temp,"") == 0)) {
usrconfig.HotKeys = TRUE;
break;
}
} /* End of if Statement */
else
usrconfig.HotKeys = TRUE; /* Default set it to Hotkeys */
}
if (toupper(temp[0]) == Keystroke(62, 1)) {
usrconfig.HotKeys = FALSE;
break;
} else {
/* Please answer Y or N */
pout(WHITE, BLACK, (char *) Language(63));
}
}
} else
usrconfig.HotKeys = TRUE; /* Default set it to Hotkeys */
usrconfig.iTimeLeft = 20; /* Set Timeleft in users file to 20 */
Enter(1);
if (ieLogin)
usrconfig.iScreenLen = ieRows;
else {
/* Please enter your Screen Length [24]: */
pout(LIGHTMAGENTA, BLACK, (char *) Language(64));
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
alarm_on();
Getnum(temp, 3);
/* Please enter your Screen Length [24]: */
pout(LIGHTMAGENTA, BLACK, (char *) Language(64));
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
alarm_on();
Getnum(temp, 3);
if(strlen(temp) == 0)
usrconfig.iScreenLen = 24;
else
usrconfig.iScreenLen = atoi(temp);
}
if(strlen(temp) == 0)
usrconfig.iScreenLen = 24;
else
usrconfig.iScreenLen = atoi(temp);
alarm_on();
@ -505,7 +493,7 @@ int newuser(char *FullName)
/* Login Name : */
pout(LIGHTBLUE, BLACK, (char *) Language(68));
colour(CYAN, BLACK);
printf("%s (%s)\n", FullName, UnixName);
printf("%s (%s)\n", UnixName, FullName);
/* Password : */
pout(LIGHTBLUE, BLACK, (char *) Language(69));
pout(CYAN, BLACK, (char *)"<");
@ -530,15 +518,21 @@ int newuser(char *FullName)
free(Phone1);
free(Phone2);
DisplayFile((char *)"registered");
Syslog('+', "Completed new-user procedure");
/* New user registration completed. */
pout(LIGHTGREEN, BLACK, (char *) Language(71));
Enter(1);
/* You need to login again with the name: */
pout(LIGHTRED, BLACK, (char *) Language(5));
pout(YELLOW, BLACK, UnixName);
Enter(2);
alarm_on();
Pause();
alarm_off();
printf("\n");
return recno;
return 0;
}

View File

@ -2,7 +2,7 @@
#define _NEWUSER_H
int newuser(char *); /* Newuser function */
int newuser(void); /* Newuser function */
#endif

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/nextuser.c
* $Id$
* Purpose ...............: Message to next User door
* Last modification date : 28-Jun-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -38,7 +37,7 @@
#include "../lib/common.h"
#include "nextuser.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "timeout.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/offline.c
* $Id$
* Purpose ...............: Offline Reader
* Last modification date : 28-Jun-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -44,6 +43,7 @@
#include "mail.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "file.h"
#include "filesub.h"
@ -52,6 +52,7 @@
#include "msgutil.h"
#include "pop3.h"
#include "offline.h"
#include "whoson.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbsebbs/oneline.c
* $Id$
* Purpose ...............: Oneliner functions.
* Last modification date : 28-jun-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -37,7 +36,7 @@
#include "../lib/clcomm.h"
#include "oneline.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/page.c
* $Id$
* Purpose ...............: Sysop Paging
* Last modification date : 28-Jun-2001
* Todo ..................: Implement new config settings.
*
*****************************************************************************
@ -36,8 +35,8 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "funcs.h"
#include "funcs4.h"
#include "dispfile.h"
#include "input.h"
#include "chat.h"
#include "page.h"
#include "timeout.h"

View File

@ -34,7 +34,8 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "funcs4.h"
#include "pinfo.h"
#include "input.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/safe.c
* $Id$
* Purpose ...............: Safe Door
* Last modification date : 26-Sep-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -35,9 +34,9 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "exitinfo.h"
#include "funcs.h"
#include "funcs4.h"
#include "whoson.h"
#include "dispfile.h"
#include "input.h"
#include "misc.h"
#include "safe.h"
#include "timeout.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/timeout.c
* $Id$
* Purpose ...............: Inactivity timeout functions
* Last modification date : 26-Sep-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -94,11 +93,7 @@ void die(int onsig)
Syslog('+', "Last msg area %s", msgs.Name);
}
if (LoginPrompt) {
Unsetraw();
Quick_Bye(onsig);
} else
Good_Bye(onsig);
Good_Bye(onsig);
}
@ -109,11 +104,7 @@ void alarm_sig()
/* Autologout: idletime reached.*/
printf("\r\n%s\r\n", (char *) Language(410));
if (LoginPrompt)
Syslog('!', "Autologout: idletime reached at login prompt");
else
Syslog('!', "Autologout: idletime reached");
Syslog('!', "Autologout: idletime reached");
die(SIGALRM);
}

File diff suppressed because it is too large Load Diff

324
mbsebbs/whoson.c Normal file
View File

@ -0,0 +1,324 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Who's online functions
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* 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 "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
//#include "funcs.h"
#include "input.h"
#include "language.h"
//#include "oneline.h"
//#include "misc.h"
//#include "bye.h"
//#include "timeout.h"
//#include "timecheck.h"
#include "exitinfo.h"
#include "whoson.h"
extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
/*
* Function to display what users are currently On-Line and what they
* are busy doing
*/
void WhosOn(char *OpData)
{
FILE *pExitinfo;
DIR *Directory;
char *Heading, *Underline, *temp, *tmp, *device;
struct dirent *Dir;
int i, x;
Underline = calloc(81, sizeof(char));
Heading = calloc(81, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
tmp = calloc(PATH_MAX, sizeof(char));
WhosDoingWhat(WHOSON);
clear();
Enter(1);
colour(15, 0);
sprintf(Heading, "%s%s", (char *) Language(414), CFG.bbs_name);
Center(Heading);
x = strlen(Heading);
for(i = 0; i < x; i++)
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(12, 0);
Center(Underline);
printf("\n");
pout(10, 0, (char *) Language(415));
Enter(1);
colour(2, 0);
fLine(79);
sprintf(tmp, "%s/tmp", getenv("MBSE_ROOT"));
if ((Directory = opendir(tmp)) != NULL)
while ((Dir = readdir( Directory )) != NULL)
if((strstr(Dir->d_name, ".bbs-exitinfo.")) != NULL) {
sprintf(temp, "%s/%s", tmp, Dir->d_name);
if(( pExitinfo = fopen(temp, "rb")) != NULL) {
fread(&exitinfo, sizeof(exitinfo), 1, pExitinfo);
colour(11, 0);
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(exitinfo.sHandle, "") != 0 && *(exitinfo.sHandle) != ' '))
printf("%-30s", exitinfo.sHandle);
else
printf("%-30s", exitinfo.sUserName);
} else
printf("%-30s", exitinfo.sUserName);
colour(9, 0);
if((device = strstr(Dir->d_name, "tty")) != NULL)
printf("%-9s", device);
else
printf("%-9s", "None");
colour(15, 0);
/* Browseng */
if(exitinfo.iStatus == BROWSING)
printf("%-15s", (char *) Language(418));
/* Downloading */
else if(exitinfo.iStatus == DOWNLOAD)
printf("%-15s", (char *) Language(419));
/* Uploading */
else if(exitinfo.iStatus == UPLOAD)
printf("%-15s", (char *) Language(420));
/* Msg Section */
else if(exitinfo.iStatus == READ_POST)
printf("%-15s", (char *) Language(421));
/* External Door */
else if(exitinfo.iStatus == DOOR)
printf("%-15s", (char *) Language(422));
/* Chatting */
else if(exitinfo.iStatus == SYSOPCHAT)
printf("%-15s", (char *) Language(423));
/* Listing Files */
else if(exitinfo.iStatus == FILELIST)
printf("%-15s", (char *) Language(424));
/* Banking Door */
else if(exitinfo.iStatus == TIMEBANK)
printf("%-15s", (char *) Language(426));
/* Safe Door */
else if(exitinfo.iStatus == SAFE)
printf("%-15s", (char *) Language(427));
/* WhosOn List */
else if(exitinfo.iStatus == WHOSON)
printf("%-15s", (char *) Language(428));
/* Idle */
else
printf("%s", (char *) Language(429));
colour(12, 0);
printf("%-25s\n", exitinfo.sLocation);
fclose(pExitinfo);
}
}
closedir(Directory);
ReadExitinfo();
colour(2, 0);
fLine(79);
free(tmp);
free(temp);
free(Underline);
free(Heading);
printf("\n");
}
/*
* Function will update users file and and update exitinfo.iStatus
*/
void WhosDoingWhat(int iStatus)
{
char *temp;
temp = calloc(PATH_MAX, sizeof(char));
ReadExitinfo();
exitinfo.iStatus = iStatus;
WriteExitinfo();
switch(iStatus) {
case BROWSING:
strcpy(temp, "Browsing Menus");
break;
case DOWNLOAD:
strcpy(temp, "Downloading");
LC_Download = TRUE;
break;
case UPLOAD:
strcpy(temp, "Uploading");
LC_Upload = TRUE;
break;
case READ_POST:
strcpy(temp, "Read/post Messages");
LC_Read = TRUE;
break;
case DOOR:
strcpy(temp, "External Door");
LC_Door = TRUE;
break;
case SYSOPCHAT:
strcpy(temp, "Sysop Chat");
LC_Chat = TRUE;
break;
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;
case OLR:
strcpy(temp, "Offline Reader");
LC_Olr = TRUE;
break;
}
IsDoing(temp);
free(temp);
}
/*
* Function will allow a user to send a on-line message to another user
* It will prompt the user for the username. The message is sent thru
* mbsed, from the resonse message we can see if we succeeded.
*/
void SendOnlineMsg(char *OpData)
{
static char buf[128];
char *User, *String;
User = calloc(36, sizeof(char));
String = calloc(77, sizeof(char));
WhosOn(OpData);
/* Please enter username to send message to: */
pout(3, 0, (char *) Language(430));
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
GetstrC(User, 35);
if (!strcmp(User, "")) {
free(User);
free(String);
return;
}
/* Please enter message to send (Max 76 Characters) */
pout(10, 0, (char *)Language(433));
pout(10, 0, (char *)"\n> ");
colour(CFG.InputColourF, CFG.InputColourB);
fflush(stdout);
GetstrC(String, 76);
if ((strcmp(String, "")) != 0) {
buf[0] = '\0';
sprintf(buf, "CSPM:3,%s,%s,%s;", strcmp(OpData, "/H") != 0 ? exitinfo.sUserName : \
strcmp(exitinfo.sHandle, "") == 0 ? exitinfo.sUserName : \
exitinfo.sHandle, User, String);
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:1,3;", 8) == 0) {
/* Sorry, there is no user on */
printf("\n%s %s\n\n", (char *) Language(431), User);
}
if (strncmp(buf, "100:1,2;", 8) == 0) {
printf("\nNo more room in users message buffer\n\n");
}
if (strncmp(buf, "100:1,1;", 8) == 0) {
colour(12, 0);
/* doesn't wish to be disturbed */
printf("\n%s %s\n", User, (char *) Language(432));
}
if (strncmp(buf, "100:0;", 6) == 0) {
printf("Message Sent!\n");
Syslog('+', "Online msg to %s: \"%s\"", User, String);
}
}
}
free(User);
free(String);
Pause();
}

10
mbsebbs/whoson.h Normal file
View File

@ -0,0 +1,10 @@
/* $Id$ */
#ifndef _WHOSON_H
#define _WHOSON_H
void WhosOn(char *); /* What users are currently online */
void WhosDoingWhat(int); /* Update what user is doing */
void SendOnlineMsg(char *); /* Send On-Line Message to User */
#endif

View File

@ -132,7 +132,7 @@ void e_reginfo(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.1 EDIT REGISTRATION INFO");
mvprintw( 5, 6, "1.2 EDIT REGISTRATION INFO");
set_color(CYAN, BLACK);
mvprintw( 7, 6, "1. System name");
mvprintw( 8, 6, "2. Domain name");
@ -181,7 +181,7 @@ void e_filenames(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.2 EDIT GLOBAL FILENAMES");
mvprintw( 5, 6, "1.3 EDIT GLOBAL FILENAMES");
set_color(CYAN, BLACK);
mvprintw( 7, 6, "1. System logfile");
mvprintw( 8, 6, "2. Error logfile");
@ -216,7 +216,7 @@ void e_global(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 4, 6, "1.3 EDIT GLOBAL PATHS");
mvprintw( 4, 6, "1.4 EDIT GLOBAL PATHS");
set_color(CYAN, BLACK);
mvprintw( 6, 2, "1. BBS menus");
mvprintw( 7, 2, "2. Txtfiles");
@ -276,56 +276,54 @@ void b_screen(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 2, "1.4 EDIT GLOBAL SETTINGS");
mvprintw( 5, 2, "1.5 EDIT GLOBAL SETTINGS");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. Private system");
mvprintw( 8, 2, "2. Exclude Sysop");
mvprintw( 9, 2, "3. Show Connect");
mvprintw(10, 2, "4. Ask Protocols");
mvprintw(11, 2, "5. Sysop Level");
mvprintw(12, 2, "6. Password Length");
mvprintw(13, 2, "7. Passwd Character");
mvprintw(14, 2, "8. Idle timeout");
mvprintw(15, 2, "9. Login Enters");
mvprintw(16, 2, "10. Login Attempts");
mvprintw(17, 2, "11. Homedir Quota");
mvprintw( 7, 2, "1. Exclude Sysop");
mvprintw( 8, 2, "2. Show Connect");
mvprintw( 9, 2, "3. Ask Protocols");
mvprintw(10, 2, "4. Sysop Level");
mvprintw(11, 2, "5. Password Length");
mvprintw(12, 2, "6. Passwd Character");
mvprintw(13, 2, "7. Idle timeout");
mvprintw(14, 2, "8. Login Enters");
mvprintw(15, 2, "9. Login Attempts");
mvprintw(16, 2, "10. Homedir Quota");
mvprintw(17, 2, "11. Location length");
mvprintw( 7,37, "12. Location length");
mvprintw( 8,37, "13. Show new msgarea");
mvprintw( 9,37, "14. OLR Max. msgs.");
mvprintw(10,37, "15. OLR Newfile days");
mvprintw(11,37, "16. OLR Max Filereq");
mvprintw(12,37, "17. BBS Log Level");
mvprintw(13,37, "18. Utils loglevel");
mvprintw(14,37, "19. Utils slowly");
mvprintw(15,37, "20. CrashMail level");
mvprintw(16,37, "21. FileAttach level");
mvprintw(17,37, "22. Min diskspace MB");
mvprintw( 7,37, "12. Show new msgarea");
mvprintw( 8,37, "13. OLR Max. msgs.");
mvprintw( 9,37, "14. OLR Newfile days");
mvprintw(10,37, "15. OLR Max Filereq");
mvprintw(11,37, "16. BBS Log Level");
mvprintw(12,37, "17. Utils loglevel");
mvprintw(13,37, "18. Utils slowly");
mvprintw(14,37, "29. CrashMail level");
mvprintw(15,37, "20. FileAttach level");
mvprintw(16,37, "21. Min diskspace MB");
set_color(WHITE, BLACK);
show_bool( 7,24, CFG.elite_mode);
show_bool( 8,24, CFG.exclude_sysop);
show_bool( 9,24, CFG.iConnectString);
show_bool(10,24, CFG.iAskFileProtocols);
show_int( 11,24, CFG.sysop_access);
show_int( 12,24, CFG.password_length);
show_int( 13,24, CFG.iPasswd_Char);
show_int( 14,24, CFG.idleout);
show_int( 15,24, CFG.iCRLoginCount);
show_int( 16,24, CFG.max_login);
show_int( 17,24, CFG.iQuota);
show_bool( 7,24, CFG.exclude_sysop);
show_bool( 8,24, CFG.iConnectString);
show_bool( 9,24, CFG.iAskFileProtocols);
show_int( 10,24, CFG.sysop_access);
show_int( 11,24, CFG.password_length);
show_int( 12,24, CFG.iPasswd_Char);
show_int( 13,24, CFG.idleout);
show_int( 14,24, CFG.iCRLoginCount);
show_int( 15,24, CFG.max_login);
show_int( 16,24, CFG.iQuota);
show_int( 17,24, CFG.CityLen);
show_int( 7,59, CFG.CityLen);
show_bool( 8,59, CFG.NewAreas);
show_int( 9,59, CFG.OLR_MaxMsgs);
show_int( 10,59, CFG.OLR_NewFileLimit);
show_int( 11,59, CFG.OLR_MaxReq);
show_logl(12,59, CFG.bbs_loglevel);
show_logl(13,59, CFG.util_loglevel);
show_bool(14,59, CFG.slow_util);
show_int( 15,59, CFG.iCrashLevel);
show_int( 16,59, CFG.iAttachLevel);
show_int( 17,59, CFG.freespace);
show_bool( 7,59, CFG.NewAreas);
show_int( 8,59, CFG.OLR_MaxMsgs);
show_int( 9,59, CFG.OLR_NewFileLimit);
show_int( 10,59, CFG.OLR_MaxReq);
show_logl(11,59, CFG.bbs_loglevel);
show_logl(12,59, CFG.util_loglevel);
show_bool(13,59, CFG.slow_util);
show_int( 14,59, CFG.iCrashLevel);
show_int( 15,59, CFG.iAttachLevel);
show_int( 16,59, CFG.freespace);
}
@ -335,31 +333,30 @@ void e_bbsglob(void)
b_screen();
for (;;) {
switch(select_menu(22)) {
switch(select_menu(21)) {
case 0: return;
case 1: E_BOOL( 7,24, CFG.elite_mode, "^Private^ system.")
case 2: E_BOOL( 8,24, CFG.exclude_sysop, "^Exclude^ sysop from lists.")
case 3: E_BOOL( 9,24, CFG.iConnectString, "Show ^connect string^ at logon")
case 4: E_BOOL(10,24, CFG.iAskFileProtocols, "Ask ^file protocol^ before every up- download")
case 5: E_INT( 11,24, CFG.sysop_access, "Sysop ^access level^")
case 6: E_INT( 12,24, CFG.password_length, "Mimimum ^password^ length.")
case 7: E_INT( 13,24, CFG.iPasswd_Char, "Ascii number of ^password^ character")
case 8: E_INT( 14,24, CFG.idleout, "^Idle timeout^ in minutes")
case 9: E_INT( 15,24, CFG.iCRLoginCount, "Maximum ^Login Return^ count")
case 10:E_INT( 16,24, CFG.max_login, "Maximum ^Login^ attempts")
case 11:E_INT( 17,24, CFG.iQuota, "Maximum ^Quota^ in MBytes in users homedirectory");
case 1: E_BOOL( 7,24, CFG.exclude_sysop, "^Exclude^ sysop from lists.")
case 2: E_BOOL( 8,24, CFG.iConnectString, "Show ^connect string^ at logon")
case 3: E_BOOL( 9,24, CFG.iAskFileProtocols, "Ask ^file protocol^ before every up- download")
case 4: E_INT( 10,24, CFG.sysop_access, "Sysop ^access level^")
case 5: E_INT( 11,24, CFG.password_length, "Mimimum ^password^ length.")
case 6: E_INT( 12,24, CFG.iPasswd_Char, "Ascii number of ^password^ character")
case 7: E_INT( 13,24, CFG.idleout, "^Idle timeout^ in minutes")
case 8: E_INT( 14,24, CFG.iCRLoginCount, "Maximum ^Login Return^ count")
case 9: E_INT( 15,24, CFG.max_login, "Maximum ^Login^ attempts")
case 10:E_INT( 16,24, CFG.iQuota, "Maximum ^Quota^ in MBytes in users homedirectory");
case 11:E_INT( 17,24, CFG.CityLen, "Minimum ^Location name^ length (3..6)")
case 12:E_INT( 7,59, CFG.CityLen, "Minimum ^Location name^ length (3..6)")
case 13:E_BOOL( 8,59, CFG.NewAreas, "Show ^new^ or ^deleted^ message areas to the user at login.")
case 14:E_INT( 9,59, CFG.OLR_MaxMsgs, "^Maximum messages^ to pack for download (0=unlimited)")
case 15:E_INT( 10,59, CFG.OLR_NewFileLimit, "^Limit Newfiles^ listing for maximum days")
case 16:E_INT( 11,59, CFG.OLR_MaxReq, "Maximum ^Filerequests^ to honor")
case 17:E_LOGL(CFG.bbs_loglevel, "1.4.17", b_screen)
case 18:E_LOGL(CFG.util_loglevel, "1.4.18", b_screen)
case 19:E_BOOL(14,59, CFG.slow_util, "Let background utilities run ^slowly^")
case 20:E_INT( 15,59, CFG.iCrashLevel, "The user level to allow sending ^CrashMail^")
case 21:E_INT( 16,59, CFG.iAttachLevel, "The user level to allow sending ^File Attaches^")
case 22:E_INT( 17,59, CFG.freespace, "Minimum ^free diskspace^ in MBytes on filesystems")
case 12:E_BOOL( 7,59, CFG.NewAreas, "Show ^new^ or ^deleted^ message areas to the user at login.")
case 13:E_INT( 8,59, CFG.OLR_MaxMsgs, "^Maximum messages^ to pack for download (0=unlimited)")
case 14:E_INT( 9,59, CFG.OLR_NewFileLimit, "^Limit Newfiles^ listing for maximum days")
case 15:E_INT( 10,59, CFG.OLR_MaxReq, "Maximum ^Filerequests^ to honor")
case 16:E_LOGL(CFG.bbs_loglevel, "1.5.16", b_screen)
case 17:E_LOGL(CFG.util_loglevel, "1.5.17", b_screen)
case 18:E_BOOL(13,59, CFG.slow_util, "Let background utilities run ^slowly^")
case 19:E_INT( 14,59, CFG.iCrashLevel, "The user level to allow sending ^CrashMail^")
case 20:E_INT( 15,59, CFG.iAttachLevel, "The user level to allow sending ^File Attaches^")
case 21:E_INT( 16,59, CFG.freespace, "Minimum ^free diskspace^ in MBytes on filesystems")
}
};
}
@ -370,7 +367,7 @@ void s_newuser(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.5 EDIT NEW USERS DEFAULTS");
mvprintw( 5, 6, "1.7 EDIT NEW USERS DEFAULTS");
set_color(CYAN, BLACK);
mvprintw( 7, 6, "1. Access level");
mvprintw( 8, 6, "2. Cap. Username");
@ -414,7 +411,7 @@ void e_newuser(void)
switch(select_menu(14)) {
case 0: return;
case 1: E_SEC( 7,28, CFG.newuser_access, "1.6.1 NEWUSER SECURITY", s_newuser)
case 1: E_SEC( 7,28, CFG.newuser_access, "1.7.1 NEWUSER SECURITY", s_newuser)
case 2: E_BOOL( 8,28, CFG.iCapUserName, "^Capitalize^ username")
case 3: E_BOOL( 9,28, CFG.iAnsi, "Ask user if he wants ^ANSI^ colors")
case 4: E_BOOL(10,28, CFG.iSex, "Ask users ^sex^")
@ -440,7 +437,7 @@ void e_colors(void)
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.6 EDIT TEXT COLOURS");
mvprintw( 5, 6, "1.8 EDIT TEXT COLOURS");
set_color(CYAN, BLACK);
mvprintw( 7, 6, "1. Normal text");
mvprintw( 8, 6, "2. Underline");
@ -488,7 +485,7 @@ void e_nu_door(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 2, "1.7 EDIT NEXT USER DOOR");
mvprintw( 5, 2, "1.9 EDIT NEXT USER DOOR");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. Text file");
mvprintw( 8, 2, "2. Quote");
@ -511,40 +508,40 @@ void e_safe_door(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 2, "1.8 EDIT SAFE DOOR");
mvprintw( 5, 2, "1.10 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");
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,15, CFG.iSafeFirstDigit);
show_int( 8,15, CFG.iSafeSecondDigit);
show_int( 9,15, CFG.iSafeThirdDigit);
show_int(10,15, CFG.iSafeMaxTrys);
show_int(11,15, CFG.iSafeMaxNumber);
show_bool(12,15, CFG.iSafeNumGen);
show_str(13,15,64, CFG.sSafePrize);
show_str(14,15,64, CFG.sSafeWelcome);
show_str(15,15,64, CFG.sSafeOpened);
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,15, CFG.iSafeFirstDigit, "Enter ^first^ digit of the safe")
case 2: E_INT( 8,15, CFG.iSafeSecondDigit, "Enter ^second^ digit of the safe")
case 3: E_INT( 9,15, CFG.iSafeThirdDigit, "Enter ^third^ digit of the safe")
case 4: E_INT( 10,15, CFG.iSafeMaxTrys, "Maximum ^trys^ per day")
case 5: E_INT( 11,15, CFG.iSafeMaxNumber, "^Maximum number^ of each digit")
case 6: E_BOOL(12,15, CFG.iSafeNumGen, "^Automatic^ number generation")
case 7: E_STR( 13,15,64, CFG.sSafePrize, "The ^prize^ the user wins when he opens the safe")
case 8: E_STR( 14,15,64, CFG.sSafeWelcome, "The ^welcome^ screen for the safe door")
case 9: E_STR( 15,15,64, CFG.sSafeOpened, "The file to display when the safe is ^opened^")
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^")
}
};
}
@ -555,7 +552,7 @@ void e_timebank(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.9 EDIT TIME BANK");
mvprintw( 5, 6, "1.11 EDIT TIME BANK");
set_color(CYAN, BLACK);
mvprintw( 7, 6, "1. Users time balance");
mvprintw( 8, 6, "2. Max time withdraw");
@ -596,7 +593,7 @@ void e_paging(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 2, "1.10 EDIT SYSOP PAGING");
mvprintw( 5, 2, "1.12 EDIT SYSOP PAGING");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. Ext. Chat");
mvprintw( 8, 2, "2. Chat Device");
@ -697,7 +694,7 @@ void e_flags(void)
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.11 EDIT FLAG DESCRIPTIONS");
mvprintw( 5, 6, "1.6 EDIT FLAG DESCRIPTIONS");
set_color(CYAN, BLACK);
for (i = 0; i < 32; i++) {
if (i < 11)
@ -746,7 +743,7 @@ void e_ticconf(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.12 EDIT FILEECHO PROCESSING");
mvprintw( 5, 6, "1.13 EDIT FILEECHO PROCESSING");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. Keep days");
@ -829,7 +826,7 @@ void s_fidomailcfg(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 5, "1.13 EDIT FIDONET MAIL AND ECHOMAIL PROCESSING");
mvprintw( 5, 5, "1.14 EDIT FIDONET MAIL AND ECHOMAIL PROCESSING");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. Badboard");
mvprintw( 8, 2, "2. Dupeboard");
@ -910,7 +907,7 @@ void s_intmailcfg(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 5, "1.14 EDIT INTERNET MAIL AND NEWS PROCESSING");
mvprintw( 5, 5, "1.15 EDIT INTERNET MAIL AND NEWS PROCESSING");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. POP3 node");
mvprintw( 8, 2, "2. SMTP node");
@ -977,7 +974,7 @@ void e_uucp(void)
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.14 EDIT UUCP GATEWAY");
mvprintw( 5, 6, "1.15 EDIT UUCP GATEWAY");
set_color(CYAN, BLACK);
mvprintw( 7, 6, "1. Zone");
mvprintw( 8, 6, "2. Net");
@ -1031,7 +1028,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.14.8", FALSE);
case 9: tmp = PickAka((char *)"1.15.9", FALSE);
if (tmp != -1)
CFG.EmailFidoAka = CFG.aka[tmp];
s_intmailcfg();
@ -1060,7 +1057,7 @@ void s_newfiles(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 2, "1.15 ALLFILES & NEWFILES LISTINGS");
mvprintw( 5, 2, "1.16 ALLFILES & NEWFILES LISTINGS");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. Ftp base");
mvprintw( 8, 2, "2. New days");
@ -1106,7 +1103,7 @@ void e_aka(int Area)
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.16 EDIT AKA");
mvprintw( 5, 6, "1.1 EDIT AKA");
set_color(CYAN, BLACK);
mvprintw( 7, 6, "1. Zone");
mvprintw( 8, 6, "2. Net");
@ -1149,7 +1146,7 @@ void e_fidoakas(void)
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 2, "1.16 EDIT FIDONET AKA'S");
mvprintw( 5, 2, "1.1 EDIT FIDONET AKA'S");
set_color(CYAN, BLACK);
x = 2;
y = 7;
@ -1722,7 +1719,6 @@ int global_doc(FILE *fp, FILE *toc, int page)
page = newpage(fp, page);
addtoc(fp, toc, 1, 6, page, (char *)"Global settings");
fprintf(fp, " Private system %s\n", getboolean(CFG.elite_mode));
fprintf(fp, " Show new msgarea %s\n", getboolean(CFG.NewAreas));
fprintf(fp, " Exclude sysop %s\n", getboolean(CFG.exclude_sysop));
fprintf(fp, " Show connect %s\n", getboolean(CFG.iConnectString));

View File

@ -8,5 +8,6 @@
\\___)=(___/
Powered by Linux.
To start the bbs login with "bbs" without quotes.
To register as a new user, login with the name "bbs" without quotes.
Registered users need to login with their unix name (one word).

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbtask/mbtask.c
* $Id$
* Purpose ...............: MBSE BBS Task Manager
* Last modification date : 01-Nov-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -175,7 +174,6 @@ void load_maincfg(void)
*/
CFG.CityLen = 6;
CFG.max_login = 5;
CFG.elite_mode = FALSE;
CFG.exclude_sysop = TRUE;
CFG.iConnectString = FALSE;
CFG.iAskFileProtocols = FALSE;