From e87e7c2ab687b5c035300b6ea99f71b3b39389a1 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 10 Nov 2001 17:14:16 +0000 Subject: [PATCH] Made mbsebbs non setuid, added program mbnewusr --- ChangeLog | 26 +- Makefile | 2 + SETUP.sh | 8 +- lang/Language.xref | 10 +- lang/dutch.txt | 10 +- lang/english.txt | 10 +- lang/galego.txt | 10 +- lang/italian.txt | 10 +- lang/spanish.txt | 10 +- lib/client.c | 5 +- lib/mbse.h | 5 +- lib/structs.h | 2 +- mbfido/mbmsg.c | 2 +- mbsebbs/Makefile | 77 +-- mbsebbs/bank.c | 8 +- mbsebbs/bbslist.c | 5 +- mbsebbs/bye.c | 2 +- mbsebbs/change.c | 5 +- mbsebbs/chat.c | 7 +- mbsebbs/dispfile.c | 523 +++++++++++++++++++ mbsebbs/dispfile.h | 13 + mbsebbs/door.c | 298 +++++++++++ mbsebbs/door.h | 9 + mbsebbs/email.c | 6 +- mbsebbs/exitinfo.c | 280 +---------- mbsebbs/exitinfo.h | 7 +- mbsebbs/file.c | 6 +- mbsebbs/filesub.c | 4 +- mbsebbs/funcs.c | 775 +--------------------------- mbsebbs/funcs.h | 12 +- mbsebbs/funcs4.c | 469 +---------------- mbsebbs/funcs4.h | 12 +- mbsebbs/input.c | 510 +++++++++++++++++++ mbsebbs/input.h | 18 + mbsebbs/language.c | 5 +- mbsebbs/lineedit.c | 11 +- mbsebbs/mail.c | 3 +- mbsebbs/mbnewusr.c | 227 +++++++++ mbsebbs/mbnewusr.h | 10 + mbsebbs/mbsebbs.c | 45 +- mbsebbs/menu.c | 6 +- mbsebbs/misc.c | 1 + mbsebbs/newuser.c | 276 +++++----- mbsebbs/newuser.h | 2 +- mbsebbs/nextuser.c | 5 +- mbsebbs/offline.c | 5 +- mbsebbs/oneline.c | 5 +- mbsebbs/page.c | 7 +- mbsebbs/pinfo.c | 3 +- mbsebbs/safe.c | 9 +- mbsebbs/timeout.c | 15 +- mbsebbs/user.c | 1201 +++++++++++--------------------------------- mbsebbs/whoson.c | 324 ++++++++++++ mbsebbs/whoson.h | 10 + mbsetup/m_global.c | 226 ++++----- mbtask/issue | 3 +- mbtask/mbtask.c | 4 +- 57 files changed, 2677 insertions(+), 2882 deletions(-) create mode 100644 mbsebbs/dispfile.c create mode 100644 mbsebbs/dispfile.h create mode 100644 mbsebbs/door.c create mode 100644 mbsebbs/door.h create mode 100644 mbsebbs/input.c create mode 100644 mbsebbs/input.h create mode 100644 mbsebbs/mbnewusr.c create mode 100644 mbsebbs/mbnewusr.h create mode 100644 mbsebbs/whoson.c create mode 100644 mbsebbs/whoson.h diff --git a/ChangeLog b/ChangeLog index f0a830f2..f3508652 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. + diff --git a/Makefile b/Makefile index ecc56191..bccdce97 100644 --- a/Makefile +++ b/Makefile @@ -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 ; \ diff --git a/SETUP.sh b/SETUP.sh index 9d6134d3..0c7c7530 100644 --- a/SETUP.sh +++ b/SETUP.sh @@ -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. diff --git a/lang/Language.xref b/lang/Language.xref index af64832d..ee36819f 100644 --- a/lang/Language.xref +++ b/lang/Language.xref @@ -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 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 diff --git a/lang/dutch.txt b/lang/dutch.txt index a4997c0a..0ee2dc8e 100644 --- a/lang/dutch.txt +++ b/lang/dutch.txt @@ -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 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 diff --git a/lang/english.txt b/lang/english.txt index 5da47454..10de1dc6 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -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 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 diff --git a/lang/galego.txt b/lang/galego.txt index 343057bc..553075ae 100644 --- a/lang/galego.txt +++ b/lang/galego.txt @@ -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 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 diff --git a/lang/italian.txt b/lang/italian.txt index fc62befd..93a0bd49 100644 --- a/lang/italian.txt +++ b/lang/italian.txt @@ -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 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 diff --git a/lang/spanish.txt b/lang/spanish.txt index 08a0e43b..cea15fae 100644 --- a/lang/spanish.txt +++ b/lang/spanish.txt @@ -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 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 diff --git a/lib/client.c b/lib/client.c index ed63d50a..3fac67fb 100644 --- a/lib/client.c +++ b/lib/client.c @@ -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); } /* diff --git a/lib/mbse.h b/lib/mbse.h index 8ebe705c..e687a39c 100644 --- a/lib/mbse.h +++ b/lib/mbse.h @@ -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 */ diff --git a/lib/structs.h b/lib/structs.h index 4880de5a..8f84761a 100644 --- a/lib/structs.h +++ b/lib/structs.h @@ -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; diff --git a/mbfido/mbmsg.c b/mbfido/mbmsg.c index 869fb54c..60b1c256 100644 --- a/mbfido/mbmsg.c +++ b/mbfido/mbmsg.c @@ -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('-', "------ ------ ------ ------ ------ ----------------------------------"); } diff --git a/mbsebbs/Makefile b/mbsebbs/Makefile index 1446af91..17914341 100644 --- a/mbsebbs/Makefile +++ b/mbsebbs/Makefile @@ -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 diff --git a/mbsebbs/bank.c b/mbsebbs/bank.c index 75913214..5c963af9 100644 --- a/mbsebbs/bank.c +++ b/mbsebbs/bank.c @@ -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" diff --git a/mbsebbs/bbslist.c b/mbsebbs/bbslist.c index aaf27517..0c444ec0 100644 --- a/mbsebbs/bbslist.c +++ b/mbsebbs/bbslist.c @@ -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" diff --git a/mbsebbs/bye.c b/mbsebbs/bye.c index 22f8ea19..3ad48b85 100644 --- a/mbsebbs/bye.c +++ b/mbsebbs/bye.c @@ -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" diff --git a/mbsebbs/change.c b/mbsebbs/change.c index c4d2b583..b32371b3 100644 --- a/mbsebbs/change.c +++ b/mbsebbs/change.c @@ -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" diff --git a/mbsebbs/chat.c b/mbsebbs/chat.c index 1f359d28..122efb24 100644 --- a/mbsebbs/chat.c +++ b/mbsebbs/chat.c @@ -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" diff --git a/mbsebbs/dispfile.c b/mbsebbs/dispfile.c new file mode 100644 index 00000000..4c05b4ca --- /dev/null +++ b/mbsebbs/dispfile.c @@ -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(" "); + + } +} + + diff --git a/mbsebbs/dispfile.h b/mbsebbs/dispfile.h new file mode 100644 index 00000000..6f985282 --- /dev/null +++ b/mbsebbs/dispfile.h @@ -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 diff --git a/mbsebbs/door.c b/mbsebbs/door.c new file mode 100644 index 00000000..45d16d75 --- /dev/null +++ b/mbsebbs/door.c @@ -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; +} + + diff --git a/mbsebbs/door.h b/mbsebbs/door.h new file mode 100644 index 00000000..6b7047cd --- /dev/null +++ b/mbsebbs/door.h @@ -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 diff --git a/mbsebbs/email.c b/mbsebbs/email.c index 626c1ef3..76813a6f 100644 --- a/mbsebbs/email.c +++ b/mbsebbs/email.c @@ -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; diff --git a/mbsebbs/exitinfo.c b/mbsebbs/exitinfo.c index 6cfd1f3b..c441dcf1 100644 --- a/mbsebbs/exitinfo.c +++ b/mbsebbs/exitinfo.c @@ -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(); -} - - diff --git a/mbsebbs/exitinfo.h b/mbsebbs/exitinfo.h index a4269031..8f5126d6 100644 --- a/mbsebbs/exitinfo.h +++ b/mbsebbs/exitinfo.h @@ -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 - diff --git a/mbsebbs/file.c b/mbsebbs/file.c index 025ae290..ada419c5 100644 --- a/mbsebbs/file.c +++ b/mbsebbs/file.c @@ -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" diff --git a/mbsebbs/filesub.c b/mbsebbs/filesub.c index 7cfcad63..d394c660 100644 --- a/mbsebbs/filesub.c +++ b/mbsebbs/filesub.c @@ -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" diff --git a/mbsebbs/funcs.c b/mbsebbs/funcs.c index 20fd6c68..325e1c29 100644 --- a/mbsebbs/funcs.c +++ b/mbsebbs/funcs.c @@ -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; -} - - diff --git a/mbsebbs/funcs.h b/mbsebbs/funcs.h index e6fea4a8..4e5b74f0 100644 --- a/mbsebbs/funcs.h +++ b/mbsebbs/funcs.h @@ -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 - diff --git a/mbsebbs/funcs4.c b/mbsebbs/funcs4.c index b747fbb8..80406b94 100644 --- a/mbsebbs/funcs4.c +++ b/mbsebbs/funcs4.c @@ -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 */ diff --git a/mbsebbs/funcs4.h b/mbsebbs/funcs4.h index 92f568d3..54f5d646 100644 --- a/mbsebbs/funcs4.h +++ b/mbsebbs/funcs4.h @@ -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 - diff --git a/mbsebbs/input.c b/mbsebbs/input.c new file mode 100644 index 00000000..353ed46a --- /dev/null +++ b/mbsebbs/input.c @@ -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); +} + + diff --git a/mbsebbs/input.h b/mbsebbs/input.h new file mode 100644 index 00000000..2386a67c --- /dev/null +++ b/mbsebbs/input.h @@ -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 diff --git a/mbsebbs/language.c b/mbsebbs/language.c index 4dcf50a3..480c9bdd 100644 --- a/mbsebbs/language.c +++ b/mbsebbs/language.c @@ -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" diff --git a/mbsebbs/lineedit.c b/mbsebbs/lineedit.c index c52d6ac7..94a1307f 100644 --- a/mbsebbs/lineedit.c +++ b/mbsebbs/lineedit.c @@ -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" diff --git a/mbsebbs/mail.c b/mbsebbs/mail.c index 656609d4..d48a1dec 100644 --- a/mbsebbs/mail.c +++ b/mbsebbs/mail.c @@ -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" diff --git a/mbsebbs/mbnewusr.c b/mbsebbs/mbnewusr.c new file mode 100644 index 00000000..edc04c10 --- /dev/null +++ b/mbsebbs/mbnewusr.c @@ -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(<ime); + + /* + * 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(<ime)); + } + } + + alarm_on(); + Pause(); + + newuser(); + Quick_Bye(0); + return 0; +} + + diff --git a/mbsebbs/mbnewusr.h b/mbsebbs/mbnewusr.h new file mode 100644 index 00000000..24dd5b25 --- /dev/null +++ b/mbsebbs/mbnewusr.h @@ -0,0 +1,10 @@ +/* $Id$ */ + +#ifndef _MBNEWUSR_H +#define _MBNEWUSR_H + +#define ReleaseDate __DATE__ + + +#endif + diff --git a/mbsebbs/mbsebbs.c b/mbsebbs/mbsebbs.c index 5d6f5711..f84800b8 100644 --- a/mbsebbs/mbsebbs.c +++ b/mbsebbs/mbsebbs.c @@ -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(<ime); /* - * 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 diff --git a/mbsebbs/menu.c b/mbsebbs/menu.c index 4a33b4d8..ae7b0662 100644 --- a/mbsebbs/menu.c +++ b/mbsebbs/menu.c @@ -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" + /* diff --git a/mbsebbs/misc.c b/mbsebbs/misc.c index 25f6668a..447c1031 100644 --- a/mbsebbs/misc.c +++ b/mbsebbs/misc.c @@ -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" diff --git a/mbsebbs/newuser.c b/mbsebbs/newuser.c index f4eb042c..73513619 100644 --- a/mbsebbs/newuser.c +++ b/mbsebbs/newuser.c @@ -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; } diff --git a/mbsebbs/newuser.h b/mbsebbs/newuser.h index 36b2cbe8..4b0e9b98 100644 --- a/mbsebbs/newuser.h +++ b/mbsebbs/newuser.h @@ -2,7 +2,7 @@ #define _NEWUSER_H -int newuser(char *); /* Newuser function */ +int newuser(void); /* Newuser function */ #endif diff --git a/mbsebbs/nextuser.c b/mbsebbs/nextuser.c index 2b189dab..93f7ea89 100644 --- a/mbsebbs/nextuser.c +++ b/mbsebbs/nextuser.c @@ -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" diff --git a/mbsebbs/offline.c b/mbsebbs/offline.c index 6d1581e1..e1159d2b 100644 --- a/mbsebbs/offline.c +++ b/mbsebbs/offline.c @@ -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" diff --git a/mbsebbs/oneline.c b/mbsebbs/oneline.c index 149c41e1..2f51569a 100644 --- a/mbsebbs/oneline.c +++ b/mbsebbs/oneline.c @@ -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" diff --git a/mbsebbs/page.c b/mbsebbs/page.c index a4e53250..acda5500 100644 --- a/mbsebbs/page.c +++ b/mbsebbs/page.c @@ -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" diff --git a/mbsebbs/pinfo.c b/mbsebbs/pinfo.c index 0d1cb2f1..a2953c5e 100644 --- a/mbsebbs/pinfo.c +++ b/mbsebbs/pinfo.c @@ -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" diff --git a/mbsebbs/safe.c b/mbsebbs/safe.c index 18f63383..d51bdb4c 100644 --- a/mbsebbs/safe.c +++ b/mbsebbs/safe.c @@ -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" diff --git a/mbsebbs/timeout.c b/mbsebbs/timeout.c index 50e214c0..49414e91 100644 --- a/mbsebbs/timeout.c +++ b/mbsebbs/timeout.c @@ -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); } diff --git a/mbsebbs/user.c b/mbsebbs/user.c index b85b81eb..44afcd4f 100644 --- a/mbsebbs/user.c +++ b/mbsebbs/user.c @@ -39,8 +39,9 @@ #include "timeout.h" #include "user.h" #include "pwcheck.h" -#include "funcs.h" +#include "dispfile.h" #include "funcs4.h" +#include "input.h" #include "misc.h" #include "bye.h" #include "file.h" @@ -52,7 +53,7 @@ #include "offline.h" #include "statetbl.h" #include "email.h" -#include "newuser.h" + extern int sock; @@ -60,530 +61,65 @@ extern pid_t mypid; char *StartTime; -/* Non global function prototypes */ - -char *AskLogin(void); -static int rxemsi(void); +/* + * Non global function prototypes + */ +void SwapDate(char *, char *); /* Swap two Date strings around */ char *Passwd = NULL; -int iMaxLogin = 1; -char *ieUserName = NULL; -char *ieHandle = NULL; -char *ieLocation = NULL; -char *ieVoicePhone = NULL; -char *ieDataPhone = NULL; -long iePassword = 0; -char *ieBirthDate = NULL; -char *ieTerminal = NULL; -int ieRows = 0; -int ieCols = 0; -int ieNulls = 0; -int ieDZA = FALSE; -int ieZAP = FALSE; -int ieZMO = FALSE; -int ieSLK = FALSE; -int ieKER = FALSE; -int ieCHT = FALSE; -int ieMNU = FALSE; -int ieTAB = FALSE; -int ieASCII8 = FALSE; -int ieNEWS = FALSE; -int ieMAIL = FALSE; -int ieFILE = FALSE; -int ieHOT = FALSE; -int ieCLR = FALSE; -int ieHUSH = FALSE; -int ieMORE = FALSE; -int ieFSED = FALSE; -int ieXPRS = FALSE; -char *ieSoftware = NULL; -int ieLogin = FALSE; /* - * Ask for BBS Login name (Firstname Lastname) and try to - * establish an IEMSI session if the client supports it. + * 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). */ -char *AskLogin(void); -char *AskLogin(void) +void SwapDate(char *Date3, char *Date4) { - char temp[36]; - int Count = 0, rc = 0; - static char GetName[36]; + char *temp2, *temp3; - do { - /* - * if after the first time IEMSI failed rc will not be - * zero anymore so we don't check for IEMSI logon anymore. - */ - if (rc == 0) { - rc = rxemsi(); - if (rc) - Syslog('+', "rxemsi rc=%d", rc); - } - if (rc) { - /* - * IEMSI Aborted or other errors, so prompt user. - * Note that if the user didn't had an IEMSI client, - * rc is still 0, the name is entered in the rxemsi - * function. - */ - /* Please enter your First and Last name: */ - language(7, 0, 0); - fflush(stdout); - alarm_on(); - Getname(GetName, 35); - } else { - sprintf(GetName, "%s", ieUserName); - } + temp2 = calloc(10, sizeof(char)); + temp3 = calloc(10, sizeof(char)); + Date1 = calloc(10, sizeof(char)); + Date2 = calloc(10, sizeof(char)); - if ((strcmp(GetName,"")) == 0) { - Count++; + 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'; - if (Count >= CFG.iCRLoginCount) { - Enter(1); - /* Disconnecting user ... */ - language(CFG.HiliteF, CFG.HiliteB, 2); - Enter(2); - Syslog('!', "Exceeded maximum login attempts"); - free(Passwd); - Quick_Bye(0); - } - } - } while (strcmp(GetName, "") == 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(temp, GetName); + strcpy(Date1, temp2); + strcpy(Date2, temp3); - /* - * Secret escape name - */ - if ((strcasecmp(temp, "off")) == 0) { - Syslog('+', "Quick \"off\" logout"); - free(Passwd); - Quick_Bye(0); - } - - /* - * Check for singlename - */ - if ((strchr(GetName,' ') == NULL && !CFG.iOneName)) { - Syslog('+', "Did not enter a full name"); - - Count = -1; - while (TRUE) { - do { - Count++; - if (Count >= CFG.iCRLoginCount) { - Enter(1); - /* Disconnecting user ... */ - language(CFG.HiliteF, CFG.HiliteB, 2); - Enter(2); - Syslog('!', "Exceeded maximum login attempts"); - free(Passwd); - Quick_Bye(0); - } - - /* Please enter your Last name: */ - language(LIGHTGRAY, BLACK, 1); - fflush(stdout); - alarm_on(); - Getname(temp, 34 - strlen(GetName)); - } while ((strcmp(temp, "")) == 0); - - if((strcmp(temp,"")) != 0) { - strcat(GetName," "); - strcat(GetName,temp); - break; - } - } - } - - alarm_off(); - return GetName; + free(temp2); + free(temp3); } -/* - * The next function is "borrowed" from Eugene M. Crossers ifcico. - */ -char *sel_brace(char *); -char *sel_brace(char *s) -{ - static char *save; - char *p, *q; - int i; - - if (s == NULL) - s = save; - for (; *s && (*s != '{'); s++); - if (*s == '\0') { - save = s; - return NULL; - } else - s++; - - for (p = s, q = s; *p; p++) - switch(*p) { - case '}': if (*(p+1) == '}') - *q++ = *p++; - else { - *q = '\0'; - save = p+1; - goto exit; - } - break; - - case '\\': if (*(p+1) == '\\') - *q++ = *p++; - else { - sscanf(p+1, "%02x", &i); - *q++ = i; - p+=2; - } - break; - - default: *q++ = *p; - break; - } -exit: - return s; -} - - - -int scanemsiici(char *); -int scanemsiici(char *buf) -{ - char *p, *q; - - ieUserName = xstrcpy(sel_brace(buf)); - Syslog('i', "Username : %s", MBSE_SS(ieUserName)); - ieHandle = xstrcpy(sel_brace(NULL)); - Syslog('i', "Handle : %s", MBSE_SS(ieHandle)); - ieLocation = xstrcpy(sel_brace(NULL)); - Syslog('i', "Location : %s", MBSE_SS(ieLocation)); - ieVoicePhone = xstrcpy(sel_brace(NULL)); - Syslog('i', "Voice Phone : %s", MBSE_SS(ieVoicePhone)); - ieDataPhone = xstrcpy(sel_brace(NULL)); - Syslog('i', "Data Phone : %s", MBSE_SS(ieDataPhone)); - p = sel_brace(NULL); - memset(Passwd, 0, 16); - if (strlen(p) < 16) - sprintf(Passwd, "%s", p); - iePassword = StringCRC32(tu(p)); - Syslog('i', "Password : %s (%ld)", p, iePassword); - ieBirthDate = xstrcpy(sel_brace(NULL)); - Syslog('i', "Birthdate : %s", MBSE_SS(ieBirthDate)); - p = sel_brace(NULL); - ieTerminal = strtok(p, ","); - ieRows = atoi(strtok(NULL, ",")); - ieCols = atoi(strtok(NULL, ",")); - ieNulls = atoi(strtok(NULL, ",")); - Syslog('i', "Terminal : %s (%d x %d) [%d]", ieTerminal, ieRows, ieCols, ieNulls); - - p = sel_brace(NULL); - Syslog('i', "Protocols : %s", MBSE_SS(p)); - for (q = strtok(p, ","); q; q = strtok(NULL, ",")) { - if (strcasecmp(q, "DZA") == 0) - ieDZA = TRUE; - else if (strcasecmp(q, "ZAP") == 0) - ieZAP = TRUE; - else if (strcasecmp(q, "ZMO") == 0) - ieZMO = TRUE; - else if (strcasecmp(q, "SLK") == 0) - ieSLK = TRUE; - else if (strcasecmp(q, "KER") == 0) - ieKER = TRUE; - else - Syslog('+', "Unrecognized IEMSI Protocol \"%s\"", q); - } - - p = sel_brace(NULL); - Syslog('i', "Capabilities: %s", MBSE_SS(p)); - for (q = strtok(p, ","); q; q = strtok(NULL, ",")) { - if (strcasecmp(q, "CHT") == 0) - ieCHT = TRUE; - else if (strcasecmp(q, "TAB") == 0) - ieTAB = TRUE; - else if (strcasecmp(q, "MNU") == 0) - ieMNU = TRUE; - else if (strcasecmp(q, "ASCII8") == 0) - ieASCII8 = TRUE; - else - Syslog('+', "Unrecognized IEMSI Capability \"%s\"", q); - } - - p = sel_brace(NULL); - Syslog('i', "Requests : %s", MBSE_SS(p)); - for (q = strtok(p, ","); q; q = strtok(NULL, ",")) { - if (strcasecmp(q, "NEWS") == 0) - ieNEWS = TRUE; - else if (strcasecmp(q, "MAIL") == 0) - ieMAIL = TRUE; - else if (strcasecmp(q, "FILE") == 0) - ieFILE = TRUE; - else if (strcasecmp(q, "HOT") == 0) - ieHOT = TRUE; - else if (strcasecmp(q, "CLR") == 0) - ieCLR = TRUE; - else if (strcasecmp(q, "HUSH") == 0) - ieHUSH = TRUE; - else if (strcasecmp(q, "MORE") == 0) - ieMORE = TRUE; - else if (strcasecmp(q, "FSED") == 0) - ieFSED = TRUE; - else if (strcasecmp(q, "XPRS") == 0) - ieXPRS = TRUE; - else - Syslog('+', "Unrecognized IEMSI Request \"%s\"", q); - } - - ieSoftware = xstrcpy(sel_brace(NULL)); - Syslog('i', "Software : %s", MBSE_SS(ieSoftware)); - - return 0; -} - - - -char *mkiemsiisi(void); -char *mkiemsiisi(void) -{ - char *p, cbuf[16]; - time_t tt; - - p = xstrcpy((char *)"EMSI_ISI0000{MBSE BBS,"); - p = xstrcat(p, (char *)VERSION); - p = xstrcat(p, (char *)",Linux}{"); - p = xstrcat(p, CFG.bbs_name); - p = xstrcat(p, (char *)"}{"); - p = xstrcat(p, CFG.location); - p = xstrcat(p, (char *)"}{"); - p = xstrcat(p, CFG.sysop_name); - p = xstrcat(p, (char *)"}{"); - (void)time(&tt); - sprintf(cbuf, "%08lX", mktime(localtime(&tt))); - p = xstrcat(p, cbuf); - p = xstrcat(p, (char *)"}{"); - p = xstrcat(p, CFG.comment); - p = xstrcat(p, (char *)"}{0}{}"); - sprintf(cbuf, "%04X", (unsigned int)strlen(p+12)); - memcpy(p+8, cbuf, 4); - - Syslog('i', "Prepared \"%s\"", p); - return p; -} - - - -SM_DECL(rxemsi, (char *)"rxemsi") -SM_STATES - prompt, - getpkt, - chkpkt, - chkici, - sendnak, - sendisi, - human -SM_NAMES - (char *)"prompt", - (char *)"getpkt", - (char *)"chkpkt", - (char *)"chkici", - (char *)"sendnak", - (char *)"sendisi", - (char *)"human" -SM_EDECL - int len, iemsi, newpos, tries = 0; - char *p, *buf = NULL; - unsigned char c = 0; - unsigned short lcrc, rcrc; - unsigned long llcrc, lrcrc; - - buf = calloc(2048, sizeof(char)); - -SM_START(prompt) - -SM_STATE(prompt) - Syslog('I', "SM: prompt"); - - /* - * Issue EMSI_IRQ and overwrite it with the prompt. - */ - printf("**EMSI_IRQ8E08\r \r"); - /* Please enter your First and Last name: */ - language(7, 0, 0); - fflush(stdout); - tries = 0; - SM_PROCEED(getpkt); - -SM_STATE(getpkt) - Syslog('I', "SM: getpkt"); - - fflush(stdin); - if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) { - WriteError("$Can't open /dev/tty"); - SM_ERROR; - } - Setraw(); - len = 0; - iemsi = FALSE; - newpos = 0; - buf[0] = '\0'; - alarm_on(); - - while(TRUE) { - c = Readkey(); - - Syslog('I', "c=%s len=%d iemsi=%d", printablec(c), len, iemsi); - - if ((len == 0) && (c == '*')) { - iemsi = TRUE; - } else { - if (((c == 8) || (c == KEY_DEL) || (c == 127)) && (len > 0)) { - printf("\b \b"); - fflush(stdout); - buf[--len] = '\0'; - } - - if (c > 31 && c < 127) { - if ((len == 0) && (CFG.iCapUserName)) - c = toupper(c); - - if (c == 32) { - newpos = len; - newpos++; - } - - if (!iemsi) { - if (newpos == len && CFG.iCapUserName) - c = toupper(c); - else { - if (CFG.iCapUserName) - c = tolower(c); - } - printf("%c", c); - fflush(stdout); - } - buf[len] = c; - len++; - } - } - - if ((c == '\r') || (!iemsi && (len == 35)) || (iemsi && (len == 2047))) { - buf[len] = '\0'; - break; - } - } - - Unsetraw(); - close(ttyfd); - Syslog('I', "Buf \"%s\"", printable(buf,0)); - - if (strncasecmp(buf, "EMSI_", 5)) { - SM_PROCEED(human); - } else { - SM_PROCEED(chkpkt); - } - -SM_STATE(chkpkt) - Syslog('I', "SM: chkpkt"); - if (strncasecmp(buf, "EMSI_ICI", 8) == 0) { - SM_PROCEED(chkici) - } - lcrc = crc16xmodem(buf, 8); - sscanf(buf+8, "%04hx", &rcrc); - if (lcrc != rcrc) { - Syslog('+', "Got IEMSI packet \"%s\" with bad crc: %04x/%04x", printable(buf, 0), lcrc, rcrc); - SM_PROCEED(sendnak); - } - if (strncasecmp(buf, "EMSI_HBT", 8) == 0) { - tries = 0; - SM_PROCEED(getpkt); - } else if (strncasecmp(buf, "EMSI_IIR61E2", 12) == 0) { - Syslog('+', "IEMSI Interrupt Request received"); - SM_ERROR; - } else if (strncasecmp(buf, "EMSI_ACKA490", 12) == 0) { - Syslog('+', "Established IEMSI session"); - ieLogin = TRUE; - /* - * Clearup the part of the users screen where some IEMSI - * codes may be hanging around - */ - fflush(stdin); - printf("\r \r"); - fflush(stdout); - SM_SUCCESS; - } else if (strncasecmp(buf, "EMSI_NAKEEC3", 12) == 0) { - Syslog('+', "IEMSI NAK received"); - SM_PROCEED(getpkt); - } else { - Syslog('I', "rxemsi ignores packet \"%s\"", buf); - SM_PROCEED(getpkt); - } - -SM_STATE(chkici) - Syslog('I', "SM: chkici"); - sscanf(buf+8, "%04x", &len); - if (len != (strlen(buf) - 20)) { - Syslog('+', "Bad EMSI_ICI length: %d/%d", len, strlen(buf)-20); - SM_PROCEED(sendnak); - } - sscanf(buf+strlen(buf)-8, "%08lx", &lrcrc); - *(buf+strlen(buf)-8) = '\0'; - llcrc = crc32ccitt(buf, strlen(buf)); - if (llcrc != lrcrc) { - Syslog('+', "Got EMSI_ICI packet \"%s\" with bad crc: %08x/%08x", printable(buf, 0), llcrc, lrcrc); - SM_PROCEED(sendnak); - } - if (scanemsiici(buf+12) == 0) { - SM_PROCEED(sendisi); - } else { - WriteError("Could not parse EMSI_ICI packet \"%s\"", buf); - SM_ERROR; - } - -SM_STATE(sendnak) - Syslog('I', "SM: sendnak"); - if (++tries > 9) { - Syslog('+', "too many tries getting EMSI_ICI"); - SM_ERROR; - } - printf((char *)"**EMSI_IRQ8E08\r"); - if (tries > 1) - printf((char *)"**EMSI_NAKEEC3\r"); - fflush(stdout); - SM_PROCEED(getpkt); - -SM_STATE(sendisi) - Syslog('I', "SM: sendisi"); - p = mkiemsiisi(); - printf("**%s%08lX\r", p, crc32ccitt(p, strlen(p))); - fflush(stdout); - free(p); - SM_PROCEED(getpkt); - -SM_STATE(human) - printf("\n"); - fflush(stdout); - ieUserName = xstrcpy(buf); - Syslog('+', "Human caller (%s)", MBSE_SS(ieUserName)); - SM_SUCCESS; - -SM_END - free(buf); - -SM_RETURN - - - void user() { FILE *pUsrConfig, *pLimits; - int i, x, z; + int i, x; int FoundName = FALSE, iFoundLimit = FALSE; register int recno; int lrecno = 0; @@ -605,36 +141,28 @@ void user() recno=0; - LoginPrompt = TRUE; + + Syslog('+', "Unixmode login: %s", sUnixName); + if ((pw = getpwnam(sUnixName))) + strcpy(sGetName, pw->pw_gecos); /* - * If not in unix mode ask for login + * If there are more fields in the passwd gecos field + * then only get the first field. */ - if (!iUnixMode) { - strcpy(sGetName, AskLogin()); - } else { - Syslog('+', "Unixmode login: %s", sUnixName); - if ((pw = getpwnam(sUnixName))) - strcpy(sGetName, pw->pw_gecos); + if (strchr(sGetName, ',') != NULL) + strcpy(sGetName, strtok(sGetName, ",")); - /* - * If there are more fields in the passwd gecos field - * then only get the first field. - */ - if (strchr(sGetName, ',') != NULL) - strcpy(sGetName, strtok(sGetName, ",")); - - if (!(CheckName(sGetName))) { - printf("Unknown username: %s\n", sGetName); - /* FATAL ERROR: You are not in the BBS users file.*/ - printf("%s\n", (char *) Language(389)); - /* Please run 'newuser' to create an account */ - printf("%s\n", (char *) Language(390)); - Syslog('?', "FATAL: Could not find user in BBS users file."); - Syslog('?', " and system is using unix accounts\n"); - free(Passwd); - ExitClient(0); - } + if (!(CheckName(sGetName))) { + printf("Unknown username: %s\n", sGetName); + /* FATAL ERROR: You are not in the BBS users file.*/ + printf("%s\n", (char *) Language(389)); + /* Please run 'newuser' to create an account */ + printf("%s\n", (char *) Language(390)); + Syslog('?', "FATAL: Could not find user in BBS users file."); + Syslog('?', " and system is using unix accounts\n"); + free(Passwd); + ExitClient(0); } if (CFG.iCapUserName || SYSOP) @@ -660,15 +188,11 @@ void user() Syslog('+', "%s On-Line at %s", UserName, ttyinfo.comment); - if ((strlen(sGetName)) < 2) - user(); - /* * Check some essential files, create them if they don't exist. */ ChkFiles(); - sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); if ((pUsrConfig = fopen(temp,"r+b")) == NULL) { /* @@ -715,27 +239,13 @@ void user() fflush(stdin); i = toupper(Getone()); if (i == Keystroke(4, 0) || i == '\r') { - if (!CFG.elite_mode) { /* * Here we run newuser. */ Syslog('+', "Creating user ..."); - recno = newuser(UserName); - IsNew = TRUE; - } else { - if (!DisplayFile((char *)"private")) { - /* If FALSE display hard coded message */ - Enter(1); - /* This is a PRIVATE System, Type "off" to leave */ - language(LIGHTRED, BLACK, 6); - Enter(2); - } - - Syslog('!', "NewUser tried to login to \"Private System\""); - free(Passwd); +// recno = newuser(UserName); Quick_Bye(0); - } - + IsNew = TRUE; } else { Enter(1); Syslog('+', "User spelt his/her name incorrectly"); @@ -765,6 +275,12 @@ void user() grecno = recno; + /* + * Is this a new user? + */ + if (usrconfig.iTotalCalls == 0) + IsNew = TRUE; + offset = usrconfighdr.hdrsize + (recno * usrconfighdr.recsize); if (fseek(pUsrConfig, offset, 0) != 0) { printf("Can't move pointer there."); @@ -776,101 +292,13 @@ void user() fread(&usrconfig, usrconfighdr.recsize, 1, pUsrConfig); TermInit(usrconfig.GraphMode); sGetPassword = malloc(Max_passlen+1); - - /* - * If UnixMode is False, else let crc = iPassword to bypass the - * passwd - */ - if (!iUnixMode && !IsNew) { - /* - * Check for a blank or expired password, they do exist - * after upgrading from RA 2.xx due to a bug in RA (or feature) - */ - if (usrconfig.iPassword == 0) { - Syslog('!', "User has blank password, asking new"); - z = 0; - while (TRUE) { - Enter(1); - /* Your password is expired, enter password: */ - language(LIGHTGRAY, BLACK, 435); - fflush(stdout); - alarm_on(); - Getpass(temp); - if ((x = strlen(temp)) >= CFG.password_length) { - Enter(1); - /* Please enter password again: */ - language(LIGHTGRAY, BLACK, 40); - fflush(stdout); - alarm_on(); - Getpass(temp1); - if ((i = strcmp(temp, temp1)) != 0) { - Enter(2); - /* Passwords do not match */ - language(LIGHTRED, BLACK, 41); - Enter(1); - } else { - memset(&usrconfig.Password, 0, sizeof(usrconfig.Password)); - sprintf(usrconfig.Password, "%s", temp); - memset(Passwd, 0, 16); - sprintf(Passwd, "%s", temp); - crc = StringCRC32(tu(temp)); - usrconfig.iPassword = crc; - break; - } - } else { - z++; - if (z == CFG.iCRLoginCount) { - Syslog('!', "User did not enter new password"); - Enter(1); - language(CFG.HiliteF, CFG.HiliteB, 2); - Enter(2); - free(Passwd); - Quick_Bye(0); - } - - Enter(2); - /* Your password must contain at least */ - language(LIGHTRED, BLACK, 42); - printf("%d ", CFG.password_length); - /* characters! Try again */ - language(LIGHTRED, BLACK, 43); - Enter(1); - } - } - } else { - if ((ieLogin) && (iePassword == usrconfig.iPassword)) { - crc = iePassword; - } else { - /* Pasword: */ - language(LIGHTGRAY, BLACK, 8); - fflush(stdout); - alarm_on(); - Getpass(sGetPassword); - /* - * Password is CRC32 of uppercase string - */ - memset(Passwd, 0, 16); - sprintf(Passwd, "%s", sGetPassword); - memset(&usrconfig.Password, 0, sizeof(usrconfig.Password)); - sprintf(usrconfig.Password, "%s", sGetPassword); - crc = StringCRC32(tu(sGetPassword)); - } - } - } else { - crc = usrconfig.iPassword; - sprintf(Passwd, "%s", usrconfig.Password); - } + crc = usrconfig.iPassword; + sprintf(Passwd, "%s", usrconfig.Password); IsDoing("Just Logged In"); - /* - * If password already OK, give pause prompt so the bbs logo - * will stay on the users screen. - */ - if ((iUnixMode) || ((ieLogin) && (iePassword == usrconfig.iPassword))) { - alarm_on(); - Pause(); - } + alarm_on(); + Pause(); if (usrconfig.Archiver[0] == '\0') { usrconfig.Archiver[0] = 'Z'; @@ -879,292 +307,247 @@ void user() Syslog('+', "Setup default archiver ZIP"); } - if (usrconfig.iPassword == crc) { - recno = 0; - free(sGetPassword); + recno = 0; + free(sGetPassword); - /* - * Check if user has an Unix account, if not create one + + /* + * Check users date format. We do it strict as we + * need this to be good for several other purposes. + * If it is correct, the users age is set in UserAge + */ + if (!Test_DOB(usrconfig.sDateOfBirth)) { + Syslog('!', "Error in Date of Birth"); + Chg_DOB(); + strcpy(usrconfig.sDateOfBirth, exitinfo.sDateOfBirth); + } + + /* + * Check to see if user must expire + */ + sprintf(temp,"%s", (char *) GetDateDMY()); + SwapDate(temp, usrconfig.sExpiryDate); + + /* Convert Date1 & Date2 to longs for compare */ + l1 = atol(Date1); + l2 = atol(Date2); + + if(l1 >= l2 && l2 != 0) { + /* + * If Expiry Date is the same as today expire to + * Expire Sec level */ - if (usrconfig.Name[0] == '\0') { - alarm_on(); - sprintf(usrconfig.Name, "%s", (char *)NameCreate(NameGen(UserName), UserName, Passwd)); - sprintf(sUnixName, "%s", usrconfig.Name); - Pause(); - } - + usrconfig.Security = usrconfig.ExpirySec; + Syslog('!', "User is expired, resetting level"); /* - * Check users date format. We do it strict as we - * need this to be good for several other purposes. - * If it is correct, the users age is set in UserAge + * Show texfile to user telling him about this. */ - if (!Test_DOB(usrconfig.sDateOfBirth)) { - Syslog('!', "Error in Date of Birth"); - Chg_DOB(); - strcpy(usrconfig.sDateOfBirth, exitinfo.sDateOfBirth); - } + DisplayFile((char *)"expired"); + } + free(Date1); + free(Date2); + + /* + * Copy limits.data into memory + */ + FileName = calloc(84, sizeof(char)); + sprintf(FileName, "%s/etc/limits.data", getenv("MBSE_ROOT")); + + if(( pLimits = fopen(FileName,"rb")) == NULL) { + perror(""); + WriteError("Can't open file: %s", FileName); + } else { + fread(&LIMIThdr, sizeof(LIMIThdr), 1, pLimits); + + while (fread(&LIMIT, sizeof(LIMIT), 1, pLimits) == 1) { + if (LIMIT.Security == usrconfig.Security.level) { + iFoundLimit = TRUE; + break; + } else + lrecno++; + } + fclose(pLimits); + } + free(FileName); + + if(!iFoundLimit) { + Syslog('?', "Unknown Security Level in limits.data"); + usrconfig.iTimeLeft = 0; /* Could not find limit, so set to Zero */ + usrconfig.iTimeUsed = 0; /* Set to Zero as well */ + } else { /* - * Check to see if user must expire + * Give user new time limit everyday, also new users get a new limit. */ sprintf(temp,"%s", (char *) GetDateDMY()); - SwapDate(temp, usrconfig.sExpiryDate); - - /* Convert Date1 & Date2 to longs for compare */ - l1 = atol(Date1); - l2 = atol(Date2); - - if(l1 >= l2 && l2 != 0) { - /* - * If Expiry Date is the same as today expire to - * Expire Sec level - */ - usrconfig.Security = usrconfig.ExpirySec; - Syslog('!', "User is expired, resetting level"); + if (((strcmp(StrDateDMY(usrconfig.tLastLoginDate), temp)) != 0) || IsNew) { /* - * Show texfile to user telling him about this. + * If no timelimit set give user 24 hours. */ - DisplayFile((char *)"expired"); - } - - free(Date1); - free(Date2); - - /* - * Copy limits.data into memory - */ - FileName = calloc(84, sizeof(char)); - sprintf(FileName, "%s/etc/limits.data", getenv("MBSE_ROOT")); - - if(( pLimits = fopen(FileName,"rb")) == NULL) { - perror(""); - WriteError("Can't open file: %s", FileName); - } else { - fread(&LIMIThdr, sizeof(LIMIThdr), 1, pLimits); - - while (fread(&LIMIT, sizeof(LIMIT), 1, pLimits) == 1) { - if (LIMIT.Security == usrconfig.Security.level) { - iFoundLimit = TRUE; - break; - } else - lrecno++; - } - fclose(pLimits); - } - free(FileName); - - if(!iFoundLimit) { - Syslog('?', "Unknown Security Level in limits.data"); - usrconfig.iTimeLeft = 0; /* Could not find limit, so set to Zero */ - usrconfig.iTimeUsed = 0; /* Set to Zero as well */ - } else { - /* - * Give user new time limit everyday - */ - sprintf(temp,"%s", (char *) GetDateDMY()); - - if((strcmp(StrDateDMY(usrconfig.tLastLoginDate), temp)) != 0) { - /* - * If no timelimit set give user 24 hours. - */ - if (LIMIT.Time) - usrconfig.iTimeLeft = LIMIT.Time; - else - usrconfig.iTimeLeft = 86400; - usrconfig.iTimeUsed = 0; /* Set time used today to Zero */ - usrconfig.iConnectTime = 0; /* Set connect time to Zero */ - - /* - * Give user new bytes and files every day if needed. - */ - if (LIMIT.DownK && LIMIT.DownF) { - usrconfig.DownloadKToday = LIMIT.DownK; - usrconfig.DownloadsToday = LIMIT.DownF; - } - } - } /* End of else */ - - usrconfig.iConnectTime = 0; - - /* Copy Users Protocol into Memory */ - Set_Protocol(usrconfig.sProtocol); - tlf(usrconfig.sProtocol); - - /* - * Set last login Date and Time, copy previous session - * values in memory. - */ - sprintf(LastLoginDate, "%s", StrDateDMY(usrconfig.tLastLoginDate)); - sprintf(LastLoginTime, "%s", StrTimeHMS(usrconfig.tLastLoginDate)); - LastLogin = usrconfig.tLastLoginDate; - usrconfig.tLastLoginDate = ltime; /* Set current login to current date */ - usrconfig.iTotalCalls = ++usrconfig.iTotalCalls; - memset(&usrconfig.Password, 0, sizeof(usrconfig.Password)); - sprintf(usrconfig.Password, "%s", Passwd); - - /* - * If IEMSI login, update some settings - */ - if (ieLogin) { - usrconfig.Cls = ieCLR; - usrconfig.HotKeys = ieHOT; - usrconfig.ieNEWS = ieNEWS; - usrconfig.MailScan = ieMAIL; - usrconfig.ieFILE = ieFILE; - usrconfig.Chat = ieCHT; - usrconfig.ieASCII8 = ieASCII8; - usrconfig.DoNotDisturb = ieHUSH; - usrconfig.FsMsged = ieFSED; - } - - /* - * Update user record. - */ - if(fseek(pUsrConfig, offset, 0) != 0) - WriteError("Can't move pointer in file: %s", temp); - else { - fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig); - fclose(pUsrConfig); - } - - /* - * Write users structure to tmp file in ~/tmp - */ - InitExitinfo(); - GetLastUser(); - StartTime = xstrcpy(GetLocalHM()); - ChangeHomeDir(exitinfo.Name, exitinfo.Email); - - Syslog('+', "User successfully logged into BBS"); - Syslog('+', "Level %d (%s), %d mins. left, port %s", usrconfig.Security.level, LIMIT.Description, usrconfig.iTimeLeft, pTTY); - time(&Time2Go); - Time2Go += usrconfig.iTimeLeft * 60; - iUserTimeLeft = usrconfig.iTimeLeft; - - DisplayFile((char *)"mainlogo"); - DisplayFile((char *)"welcome"); - - /* - * The following files are only displayed if the user has - * turned the Bulletins on. - */ - if (exitinfo.ieNEWS) { - DisplayFile((char *)"welcome1"); - DisplayFile((char *)"welcome2"); - DisplayFile((char *)"welcome3"); - DisplayFile((char *)"welcome4"); - DisplayFile((char *)"welcome5"); - DisplayFile((char *)"welcome6"); - DisplayFile((char *)"welcome7"); - DisplayFile((char *)"welcome8"); - DisplayFile((char *)"welcome9"); - - sprintf(temp, "%s", (char *) GetDateDMY() ); - if ((strcmp(usrconfig.sDateOfBirth, temp)) == 0) - DisplayFile((char *)"birthday"); + if (LIMIT.Time) + usrconfig.iTimeLeft = LIMIT.Time; + else + usrconfig.iTimeLeft = 86400; + usrconfig.iTimeUsed = 0; /* Set time used today to Zero */ + usrconfig.iConnectTime = 0; /* Set connect time to Zero */ /* - * Displays file if it exists DD-MM.A?? + * Give user new bytes and files every day if needed. */ - sprintf(temp, "%s", (char *) GetDateDMY()); - strcpy(temp1, ""); - strncat(temp1, temp, 5); - sprintf(temp, "%s", temp1); - DisplayFile(temp); - - /* - * Displays users security file if it exists - */ - sprintf(temp, "sec%d", usrconfig.Security.level); - DisplayFile(temp); - - /* - * Display News file - */ - DisplayFile((char *)"news"); - } - - /* - * Display Onceonly file, first get the date of that - * file, search order is the same as in DisplayFile() - */ - st.st_mtime = 0; - if (usrconfig.GraphMode) { - sprintf(temp, "%s/onceonly.ans", lang.TextPath); - stat(temp, &st); - if (st.st_mtime == 0) { - sprintf(temp, "%s/onceonly.ans", CFG.bbs_txtfiles); - stat(temp, &st); - } - } - if (st.st_mtime == 0) { - sprintf(temp, "%s/onceonly.asc", lang.TextPath); - stat(temp, &st); - if (st.st_mtime == 0) { - sprintf(temp, "%s/onceonly.asc", CFG.bbs_txtfiles); - stat(temp, &st); + if (LIMIT.DownK && LIMIT.DownF) { + usrconfig.DownloadKToday = LIMIT.DownK; + usrconfig.DownloadsToday = LIMIT.DownF; } } + } /* End of else */ - if ((st.st_mtime != 0) && (LastLogin < st.st_mtime)) - DisplayFile((char *)"onceonly"); - - LoginPrompt = FALSE; - OLR_SyncTags(); + usrconfig.iConnectTime = 0; - if (usrconfig.MailScan) - CheckMail(); + /* Copy Users Protocol into Memory */ + Set_Protocol(usrconfig.sProtocol); + tlf(usrconfig.sProtocol); - /* - * We don't show new files to new users, their lastlogin - * date is not yet set so they would see all the files - * which can be boring... - */ - if (usrconfig.ieFILE && (!IsNew)) - NewfileScan(FALSE); + /* + * Set last login Date and Time, copy previous session + * values in memory. + */ + sprintf(LastLoginDate, "%s", StrDateDMY(usrconfig.tLastLoginDate)); + sprintf(LastLoginTime, "%s", StrTimeHMS(usrconfig.tLastLoginDate)); + LastLogin = usrconfig.tLastLoginDate; + usrconfig.tLastLoginDate = ltime; /* Set current login to current date */ + usrconfig.iTotalCalls++; + memset(&usrconfig.Password, 0, sizeof(usrconfig.Password)); + sprintf(usrconfig.Password, "%s", Passwd); - /* - * Copy last file Area in to current Area - */ - SetFileArea(usrconfig.iLastFileArea); - - /* - * Copy Last Message Area in to Current Msg Area - */ - SetMsgArea(usrconfig.iLastMsgArea); - SetEmailArea((char *)"mailbox"); - - /* - * Set or Reset the DoNotDisturb flag, now is the time - * we may be interrupted. - */ - UserSilent(usrconfig.DoNotDisturb); - - /* - * Start the menu, but first, wipe the password. - */ - memset(Passwd, 0, sizeof(Passwd)); - free(Passwd); - menu(); - } else { - Syslog('+',"Login attempt: %d, password: %s", iMaxLogin, sGetPassword); - free(sGetPassword); - iMaxLogin++; - if(iMaxLogin == CFG.max_login + 1) { - Enter(2); - language(LIGHTGRAY, BLACK, 9); - Enter(1); - Syslog('!', "Exceeded maximum login attempts, user disconnected"); - ExitClient(1); - } - Enter(2); - language(LIGHTGRAY, BLACK, 10); - Enter(2); - alarm_on(); - Pause(); - printf("\n"); - user(); + /* + * Update user record. + */ + if (fseek(pUsrConfig, offset, 0) != 0) + WriteError("Can't move pointer in file: %s", temp); + else { + fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig); + fclose(pUsrConfig); } + + /* + * Write users structure to tmp file in ~/tmp + */ + InitExitinfo(); + GetLastUser(); + StartTime = xstrcpy(GetLocalHM()); + ChangeHomeDir(exitinfo.Name, exitinfo.Email); + + Syslog('+', "User successfully logged into BBS"); + Syslog('+', "Level %d (%s), %d mins. left, port %s", + usrconfig.Security.level, LIMIT.Description, usrconfig.iTimeLeft, pTTY); + time(&Time2Go); + Time2Go += usrconfig.iTimeLeft * 60; + iUserTimeLeft = usrconfig.iTimeLeft; + + DisplayFile((char *)"mainlogo"); + DisplayFile((char *)"welcome"); + + /* + * The following files are only displayed if the user has + * turned the Bulletins on. + */ + if (exitinfo.ieNEWS) { + DisplayFile((char *)"welcome1"); + DisplayFile((char *)"welcome2"); + DisplayFile((char *)"welcome3"); + DisplayFile((char *)"welcome4"); + DisplayFile((char *)"welcome5"); + DisplayFile((char *)"welcome6"); + DisplayFile((char *)"welcome7"); + DisplayFile((char *)"welcome8"); + DisplayFile((char *)"welcome9"); + + sprintf(temp, "%s", (char *) GetDateDMY() ); + if ((strcmp(usrconfig.sDateOfBirth, temp)) == 0) + DisplayFile((char *)"birthday"); + + /* + * Displays file if it exists DD-MM.A?? + */ + sprintf(temp, "%s", (char *) GetDateDMY()); + strcpy(temp1, ""); + strncat(temp1, temp, 5); + sprintf(temp, "%s", temp1); + DisplayFile(temp); + + /* + * Displays users security file if it exists + */ + sprintf(temp, "sec%d", usrconfig.Security.level); + DisplayFile(temp); + + /* + * Display News file + */ + DisplayFile((char *)"news"); + } + + /* + * Display Onceonly file, first get the date of that + * file, search order is the same as in DisplayFile() + */ + st.st_mtime = 0; + if (usrconfig.GraphMode) { + sprintf(temp, "%s/onceonly.ans", lang.TextPath); + stat(temp, &st); + if (st.st_mtime == 0) { + sprintf(temp, "%s/onceonly.ans", CFG.bbs_txtfiles); + stat(temp, &st); + } + } + if (st.st_mtime == 0) { + sprintf(temp, "%s/onceonly.asc", lang.TextPath); + stat(temp, &st); + if (st.st_mtime == 0) { + sprintf(temp, "%s/onceonly.asc", CFG.bbs_txtfiles); + stat(temp, &st); + } + } + + if ((st.st_mtime != 0) && (LastLogin < st.st_mtime)) + DisplayFile((char *)"onceonly"); + + OLR_SyncTags(); + + if (usrconfig.MailScan) + CheckMail(); + + /* + * We don't show new files to new users, their lastlogin + * date is not yet set so they would see all the files + * which can be boring... + */ + if (usrconfig.ieFILE && (!IsNew)) + NewfileScan(FALSE); + + /* + * Copy last file Area in to current Area + */ + SetFileArea(usrconfig.iLastFileArea); + + /* + * Copy Last Message Area in to Current Msg Area + */ + SetMsgArea(usrconfig.iLastMsgArea); + SetEmailArea((char *)"mailbox"); + + /* + * Set or Reset the DoNotDisturb flag, now is the time + * we may be interrupted. + */ + UserSilent(usrconfig.DoNotDisturb); + + /* + * Start the menu, but first, wipe the password. + */ + memset(Passwd, 0, sizeof(Passwd)); + free(Passwd); + menu(); } diff --git a/mbsebbs/whoson.c b/mbsebbs/whoson.c new file mode 100644 index 00000000..7e9bf545 --- /dev/null +++ b/mbsebbs/whoson.c @@ -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(); +} + + diff --git a/mbsebbs/whoson.h b/mbsebbs/whoson.h new file mode 100644 index 00000000..629c6aa1 --- /dev/null +++ b/mbsebbs/whoson.h @@ -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 diff --git a/mbsetup/m_global.c b/mbsetup/m_global.c index 411fac23..2a7665d6 100644 --- a/mbsetup/m_global.c +++ b/mbsetup/m_global.c @@ -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)); diff --git a/mbtask/issue b/mbtask/issue index 5011e912..7852e9e2 100644 --- a/mbtask/issue +++ b/mbtask/issue @@ -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). diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index 88818ba9..39127b7c 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -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;