a lot of mbsebbs cleanups

This commit is contained in:
Michiel Broek 2001-11-12 21:42:17 +00:00
parent d91305ad80
commit 686f670a43
49 changed files with 1886 additions and 1691 deletions

View File

@ -4226,14 +4226,13 @@ v0.33.19 26-Oct-2001
Made the Makefile system more simple.
lang:
Changed language prompts 6 and 71.
Changed language prompts 6, 71, 429.
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:
Changed menu setup.mnu and textfiles setup.* to show the new
setup entries for the users.
@ -4275,6 +4274,9 @@ v0.33.19 26-Oct-2001
issues with previous versions.
QuickScan messages in netmail areas now only shows personal
messages.
The whoson list now uses mbtask to get the information.
The users exitinfo file is now stored in his homedirectory
with mode 0600.
mbnewusr:
New program, run by user bbs. This is only to register a new

Binary file not shown.

View File

@ -11,7 +11,7 @@
</HEAD>
<BODY>
<BLOCKQUOTE>
<h5>Last update 26-Oct-2001</h5>
<h5>Last update 11-Nov-2001</h5>
<P>&nbsp;<P>
<h1>MBSE BBS Control Codes in ANSI and ASCII files</h1>
@ -65,7 +65,7 @@ For example: ^B32000^BThis is the text^B<br>
C Print date in DD-Mmm
D Print date in DD-Mmm-YYYY
E Print locked port baudrate
F Last caller
F Print the name of the Last caller
G Total users in userlist
H Number of system calls
I Current message area number
@ -76,6 +76,7 @@ For example: ^B32000^BThis is the text^B<br>
N Print users current e-mail mailbox name.
O Print number of messages in current e-mail box.
P Print users LastRead pointer of current e-mail box.
Q Print the date and time of the last caller.
</PRE>

View File

@ -1,319 +1,321 @@
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO 8859-1">
<META http-equiv="Content-Style-Type" content="text/css">
<META name="author" lang="en" "content="Michiel Broek">
<META name="copyright" lang="en" content="Copyright Michiel Broek">
<META name="description" lang="en" content="MBSE BBS Manual">
<META name="keywords" lang="en" content="MBSE BBS, MBSE, BBS, manual, fido, fidonet, gateway, tosser, mail, tic, mailer">
<TITLE>MBSE BBS Programs - mbtask - MBSE BBS Taskmanager.</TITLE>
<LINK rel=stylesheet HREF="../manual.css">
</HEAD>
<BODY>
<BLOCKQUOTE>
<h5>Last update 07-Jul-2001</h5>
<P>&nbsp;<P>
<H1>mbtask - MBSE BBS Taskmanager</H1>
<P>
<H3>Sysopsis.</H3>
<P>
<code><strong>mbtask</strong></code>
<P>&nbsp;<P>
<H3>Description.</H3>
<P>
<strong>mbtask</strong> is the taskmanager for the whole MBSE BBS system.
This deamon keeps track of all client actions,
does the logging for the clients, does database locking, authorizes clients,
set/resets users "do not disturb flags", sends and receives chat messages,
keeps track of Zone Mail Hour and the BBS open/close status. Communication
between <strong>mbsed</strong> and the client programs is done via Unix
Datagram sockets. The protocol used to communicate between <strong>mbtask</strong>
and the clients is explained later.
This daemon also watches the semafore directory for some special files.
It also starts programs when they are needed.
The very first time <b>mbtask</b> is started it creates a default config.data and task.data,
the main configuration and task configuration files
<b>mbtask</b> should be started at system boot so the bbs system will start working.
The init script that is installed on your system will do that.
This program is introduced with MBSE BBS v0.33.16
and replaces the run_inout and mailer scripts that were called by cron every minute.
<P>
After startup and initalization <b>mbtask</b> runs internally once per second forever.
If there is nothing to do then this time will slowly increase upto 5 seconds. This time will be reset
to one second as soon as there is work to be done. The actual work is to check a number of external and
internal semafore's and act on these.
But before any program is started a number of things are checked:
<OL>
<LI>Check the system's load average. If it is too busy the processing of background
tasks is suspended until your system load drops.
The default setup is set at 1.50 but you can change that with mbsetup. Experience
will learn what the best value will be and I need some feedback on that.<br>
<LI>The UPS semafore <b>upsalarm</b> will be checked. This means that the system is running on
battery power and no new jobs are started.
<LI>The UPS semafore <b>upsdown</b> will be checked. This is the fatal one, if
this one exists <b>mbtask</b> will try to stop all current running jobs.
If there are no jobs left running then <b>mbtask</b> will stop itself.
The upsdown semafore means that the system
will shutdown and power off, that's why it's fatal and there is no way back.<br>
<LI>The status of the bbs will be checked, is it open or closed. If it is closed, no
jobs will be started.
<LI>The Zone Mail Hour is checked. If ZMH begins the semafore's <b>zmh</b> is created and
a outbound scan is forced.
If ZMH ends the semafore <b>zmh</b> is removed a new outbound scan is forced.
<LI>Each twenty seconds a ping is send to the IP addresses defined with <b>mbsetup</b> to
check if the internet can be reached. If both ping addresses fail, it is assumed that
the internet can't be reached. <i>Note: this is for future use!</i>
</OL>
Each new minute the timestamp of semafore <b>mbtask.last</b> is updated so that you can check that
<b>mbtask</b> is running. Also each minute is checked if the system configuration files are
changed, is so they are reloaded. There is no need to stop and start <b>mbtask</b> if you made
changes to the system configuration.
Then all kind of internal semafore's will be checked. The commands that are executed have default
values, but they can be changed wit mbsetup. The commands can be scripts as well.
The checks and actions are:
<P>
<table border=1 bgcolor=#FFFF99 cellspacing=0 cellpadding=3 bordercolor=#000080>
<tr>
<th align=left bgcolor=#000080><font color=#FFFFFF>Semafore</font></th>
<th align=left bgcolor=#000080><font color=#FFFFFF>Speed</font></th>
<th align=left bgcolor=#000080><font color=#FFFFFF>Tasktype</font></th>
<th align=left bgcolor=#000080><font color=#FFFFFF>Depends on</font></th>
<th align=left bgcolor=#000080><font color=#FFFFFF>Job to run</font></th>
</tr>
<tr><td>mailout</td><td>Fast</td><td>mbfido</td><td>Max. 1 mbfido task</td><td>mbfido scan web -quiet</td></tr>
<tr><td>mailin</td><td>Fast</td><td>mbfido</td><td>Max. 1 mbfido task</td><td>mbfido tic toss web -quiet</td></tr>
<tr><td>newnews</td><td>Fast</td><td>mbfido</td><td>Max. 1 mbfido task</td><td>mbfido news web -quiet</td></tr>
<tr><td>mbindex</td><td>Fast</td><td>mbindex</td><td>No other tasks</td><td>mbindex -quiet and if exist: goldnode</td></tr>
<tr><td>msglink</td><td>Fast</td><td>mbfido</td><td>No other tasks</td><td>mbmsg link -quiet</td></tr>
<tr><td>reqindex</td><td>Fast</td><td>mbfile</td><td>No other tasks</td><td>mbfile index -quiet</td></tr>
<tr><td>scanout</td><td>Slow</td><td>call</td><td>Only 1 call task</td><td>mbcico -r1</td></tr>
</table>
<P>
The Fast and Slow values mean: Fast is each second, Slow is check each 20 seconds.
As you can see, the system will not do too much at the same time. Jobs like compiling
new nodelists or create file request indexes have a very low priority. Because this
daemon checks the semafore's each second it responds much better that the old scripts
running on the cron daemon. The system will be expanded so that more outgoing calls
will be done at the same time, ie. ISDN and analogue calls, and if they are present
internet calls, will be made at the same time.
<P>
The <b>mbtask</b> program keeps also track of a unique number generator, this is
just a simple counter that is increased each time it is asked for a new number.
It will take years for the numbers to repeat. Even if the status file is lost
the chance that numbers are repeated on your system are almost zero. The first
time the counter is initialized it is set to the current unix time in seconds
since 1 januari 1970. This counter is used by several programs to create unique
.pkt filenames, msgid numbers etc.
<P>&nbsp;<P>
<H3>Environment.</H3>
<P>
In order to run <strong>mbtask</strong> you must set the global variable
<strong>$MBSE_ROOT</strong>. This variable must point to the root directory
of the bbs structure.
<P>&nbsp;<P>
<H3>Security.</H3>
<P>
<strong>mbtask</strong is installed setuid root. This is needed to initialize
a raw socket for the ping function. After that is done the privilege drops to
user <strong>mbse</strong> before the child process is created and the rest
of the initialisation is done.
The child process can never get root privileges because it is spawned by user mbse.
<P>&nbsp;<P>
<H3>Communications.</H3>
<P>
Communication between the server and the clients is established by
Unix datagram sockets. There can be only 1 server running.
The server will accept connections from clients on your local machine only.
The limit for the amount of clients that can connect to the server is set to 100.
<P>
The server creates a Unix datagram socket at startup and waits for connections.
The name of this this socket is /opt/mbse/tmp/mbtask.
When a client connects it creates a Unix datagram socket in /opt/mbse/tmp, the name is
the name of the program, added with the pid of the program. So if <b>mbcico</b> is started
with pid 2312 the socket will be /opt/mbse/tmp/mbcico2312.
<P>
All commands are 4 capital letters followed by a colon, a number indicating
how much data fields will follow. If that number is higher than zero, the
data fields are seperated with commas. The command is terminated
with a ; character. Examples are:<br>
<pre>
GCLO:0; Zero datafields command.
DOPE:1,dbname; One datafield command.
</pre>
All commands will receive a reply as soon as possible. If a
resource is temporary not available, a reply will follow too, telling
this condition. Replies can also contain optional data. Examples:<br>
<pre>
100:0; Response 100, no data.
200:1,Syntax error; One datafield.
</pre>
The server has a 10 minute timeout for receiving data when a connection
is established. The clients need to "ping" the server at regular intervals
to prevent a disconnect. All official MBSE BBS programs do that. The pid
send with most commands is the pid of the calling program. Since this number
is unique, it is used to keep track of the connected clients.
<P>
The commands are divided in 26 catagories, most unused at this time.
<P>
<pre>
Catagories:
Cat. Description
---- -------------------------------------------
Axxx Accounting, system monitor info etc.
Cxxx Chatting
Gxxx Global commands.
Sxxx Status commands.
Group A, Accounting.
Command: AINI:5,pid,tty,uid,prg,city; Initialize connection, and who am I.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ADOI:2,pid,doing; What am I doing right now.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ACLO:1,pid; Close my connection.
Reply: 107:0; Connection closed.
200:1,Syntax Error; Error, connection is still open.
Command: ALOG:5,fil,prg,pid,grade,txt; Write a line of text in logfile with grade.
Reply: 100:0; Ok.
201:1,errno; Error, number in errno.
Command: AUSR:3,pid,uid,city; Set username and city
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ADIS:2,pid,flag; Set Do Not Disturb flag.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ATIM:1,time; Set new Client/Server timer in seconds.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ADEF:0; Set Client/Server timer to default (10 minutes).
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ATTY:2,pid,tty; Set new tty name.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Group C, Chatting (just some ideas).
Command: CIPM:1,pid; Is Personal Message present.
Reply: 100:2,fromname,message; Yes, from .. with message text.
100:0; No.
Command: CSPM:3,fromuser,touser,txt; Send personal message to user.
Reply: 100:1,n; n: 0=Ok, 1=Do not disturb, 2=Buffer full, 3=Error.
100:0; Impossible.
The next commandis are some ideas, they are not implemented.
-CBPM:2,fromuser,txt; Broadcast message to all users.
-CJCH:2,pid,channel; Join Channel
-CCCH:2,pid,channel; Close Channel
-CAML:2,channel,text; Add textline to channel
-CIML:1,channel; Is new textline present
-CSSP:1,user,reason; Send Sysop Page
-CESP:1,user; Retract Sysop Page
-CRSP:1,user; Reject user Page
-CFCH:2,channel,user; Force user in chatmode (for Sysop chat).
-CKCH:2,channel,user; Kill user chatmode (for Sysops and moderators).
Group G, Global commands.
Command: GNOP:0; No OPerations.
Reply: 100:0; Ok.
Command: GPNG:1,data; Ping, echo data.
Reply: 100:1,data; Ping reply.
Command: GVER:0; Give server version.
Reply: 100:1,Version ....; Version reply.
Command: GSTA:0; Get complete mbsed status record. (13 fields)
Reply: 100:19,start,laststart,daily,startups,clients,tot_clients,tot_peak,syntax_errs,
com_errs,today_clients,today_peak,today_syntax,today_comerr,bbsopen,
is_zmh,processing,system_load,sequence;
Command: GMON:1,n; Get registration info line, 1=First, 0=Next line.
Reply: 100:7,pid,tty,user,program,city,isdoing,starttime;
100:0; No more lines.
Command: GDST:0; Get filesystem status (see note below).
100:n,data1, ..., data10; Maximum 10 filesystems datalines.
Command: GSYS:0; Get bbs statistics.
100:7,calls,pots_calls,isdn_calls,network_calls,local_calls,startdate,lastcaller;
Command: GLCC:0; Get Lastcallers count
100,1,n; Return counter value.
Command: GLCR:1,recno; Get Lastcaller record
100:9,user,location,level,tty,time,minsmcalls,speed,cations;
201:1,16; Not available.
Group S, Status commands.
Command: SBBS:0; Get BBS Status (open, zmh, shutdown).
Reply: 100:2,0,The system is open for use;
100:2,1,The system is closed right now!;
100:2,2,The system is closed for Zone Mail Hour!;
Command: SOPE:0; Open the BBS.
Reply: 100:0; Ok.
Command: SCLO:1,mesage; Close the BBS with reason.
Reply: 100:0; Ok.
Command: SFRE:0; Is the BBS Free.
Reply: 100:1,Running utilities: n Active users: n;
100:0; It's free.
Command: SSEQ:0; Get next unique sequence number.
Reply: 100:1,number; Next unique sequence number.
Command: SEST:1,semafore; Get status of internal semafore.
Reply: 100:1,n; 1 = set, 0 = not set.
200:1,16; Semafore not known.
Command: SECR:1,semafore; Set semafore
Reply: 100:0; Ok.
200:1,16; Error.
Command: SERM:1,semafore; Remove semafore
Reply: 100:0; Ok (also if there was no semafore).
200:1,16; Semafore not known.
</pre>
Note: in reply of GDST the reply is 100:n,size free mountpoint fstype,.....
where n = 1 for 1 filesystem, and 10 for a total of 10 filesystems. There
will never be a reply for more then 10 filesystems. The reported filesystems
are retrieved from /etc/mtab which is the actual mountstatus. This is used
by the <b>mbmon</b> program to get a "live" view of your filesystems.
<P>&nbsp;<P>
<A HREF="index.htm"><IMG SRC="../images/larrow.gif" ALT="Index" Border="0" width="40" height="30"> Back to index</A>&nbsp;
<A HREF="../index.htm"><IMG SRC="../images/b_arrow.gif" ALT="Main" Border="0" width="33" height="35"> Back to Main index</A>
</BLOCKQUOTE>
</BODY>
</HTML>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO 8859-1">
<META http-equiv="Content-Style-Type" content="text/css">
<META name="author" lang="en" "content=Michiel Broek">
<META name="copyright" lang="en" content="Copyright Michiel Broek">
<META name="description" lang="en" content="MBSE BBS Manual">
<META name="keywords" lang="en" content="MBSE BBS, MBSE, BBS, manual, fido, fidonet, gateway, tosser, mail, tic, mailer">
<TITLE>MBSE BBS Programs - mbtask - MBSE BBS Taskmanager.</TITLE>
<LINK rel=stylesheet HREF="../manual.css">
</HEAD>
<BODY>
<BLOCKQUOTE>
<h5>Last update 12-Nov-2001</h5>
<P>&nbsp;<P>
<H1>mbtask - MBSE BBS Taskmanager</H1>
<P>
<H3>Sysopsis.</H3>
<P>
<code><strong>mbtask</strong></code>
<P>&nbsp;<P>
<H3>Description.</H3>
<P>
<strong>mbtask</strong> is the taskmanager for the whole MBSE BBS system.
This deamon keeps track of all client actions,
does the logging for the clients, does database locking, authorizes clients,
set/resets users "do not disturb flags", sends and receives chat messages,
keeps track of Zone Mail Hour and the BBS open/close status. Communication
between <strong>mbsed</strong> and the client programs is done via Unix
Datagram sockets. The protocol used to communicate between <strong>mbtask</strong>
and the clients is explained later.
This daemon also watches the semafore directory for some special files.
It also starts programs when they are needed.
The very first time <b>mbtask</b> is started it creates a default config.data and task.data,
the main configuration and task configuration files
<b>mbtask</b> should be started at system boot so the bbs system will start working.
The init script that is installed on your system will do that.
This program is introduced with MBSE BBS v0.33.16
and replaces the run_inout and mailer scripts that were called by cron every minute.
<P>
After startup and initalization <b>mbtask</b> runs internally once per second forever.
If there is nothing to do then this time will slowly increase upto 5 seconds. This time will be reset
to one second as soon as there is work to be done. The actual work is to check a number of external and
internal semafore's and act on these.
But before any program is started a number of things are checked:
<OL>
<LI>Check the system's load average. If it is too busy the processing of background
tasks is suspended until your system load drops.
The default setup is set at 1.50 but you can change that with mbsetup. Experience
will learn what the best value will be and I need some feedback on that.<br>
<LI>The UPS semafore <b>upsalarm</b> will be checked. This means that the system is running on
battery power and no new jobs are started.
<LI>The UPS semafore <b>upsdown</b> will be checked. This is the fatal one, if
this one exists <b>mbtask</b> will try to stop all current running jobs.
If there are no jobs left running then <b>mbtask</b> will stop itself.
The upsdown semafore means that the system
will shutdown and power off, that's why it's fatal and there is no way back.<br>
<LI>The status of the bbs will be checked, is it open or closed. If it is closed, no
jobs will be started.
<LI>The Zone Mail Hour is checked. If ZMH begins the semafore's <b>zmh</b> is created and
a outbound scan is forced.
If ZMH ends the semafore <b>zmh</b> is removed a new outbound scan is forced.
<LI>Each twenty seconds a ping is send to the IP addresses defined with <b>mbsetup</b> to
check if the internet can be reached. If both ping addresses fail, it is assumed that
the internet can't be reached. <i>Note: this is for future use!</i>
</OL>
Each new minute the timestamp of semafore <b>mbtask.last</b> is updated so that you can check that
<b>mbtask</b> is running. Also each minute is checked if the system configuration files are
changed, is so they are reloaded. There is no need to stop and start <b>mbtask</b> if you made
changes to the system configuration.
Then all kind of internal semafore's will be checked. The commands that are executed have default
values, but they can be changed wit mbsetup. The commands can be scripts as well.
The checks and actions are:
<P>
<table border=1 bgcolor=#FFFF99 cellspacing=0 cellpadding=3 bordercolor=#000080>
<tr>
<th align=left bgcolor=#000080><font color=#FFFFFF>Semafore</font></th>
<th align=left bgcolor=#000080><font color=#FFFFFF>Speed</font></th>
<th align=left bgcolor=#000080><font color=#FFFFFF>Tasktype</font></th>
<th align=left bgcolor=#000080><font color=#FFFFFF>Depends on</font></th>
<th align=left bgcolor=#000080><font color=#FFFFFF>Job to run</font></th>
</tr>
<tr><td>mailout</td><td>Fast</td><td>mbfido</td><td>Max. 1 mbfido task</td><td>mbfido scan web -quiet</td></tr>
<tr><td>mailin</td><td>Fast</td><td>mbfido</td><td>Max. 1 mbfido task</td><td>mbfido tic toss web -quiet</td></tr>
<tr><td>newnews</td><td>Fast</td><td>mbfido</td><td>Max. 1 mbfido task</td><td>mbfido news web -quiet</td></tr>
<tr><td>mbindex</td><td>Fast</td><td>mbindex</td><td>No other tasks</td><td>mbindex -quiet and if exist: goldnode</td></tr>
<tr><td>msglink</td><td>Fast</td><td>mbfido</td><td>No other tasks</td><td>mbmsg link -quiet</td></tr>
<tr><td>reqindex</td><td>Fast</td><td>mbfile</td><td>No other tasks</td><td>mbfile index -quiet</td></tr>
<tr><td>scanout</td><td>Slow</td><td>call</td><td>Only 1 call task</td><td>mbcico -r1</td></tr>
</table>
<P>
The Fast and Slow values mean: Fast is each second, Slow is check each 20 seconds.
As you can see, the system will not do too much at the same time. Jobs like compiling
new nodelists or create file request indexes have a very low priority. Because this
daemon checks the semafore's each second it responds much better that the old scripts
running on the cron daemon. The system will be expanded so that more outgoing calls
will be done at the same time, ie. ISDN and analogue calls, and if they are present
internet calls, will be made at the same time.
<P>
The <b>mbtask</b> program keeps also track of a unique number generator, this is
just a simple counter that is increased each time it is asked for a new number.
It will take years for the numbers to repeat. Even if the status file is lost
the chance that numbers are repeated on your system are almost zero. The first
time the counter is initialized it is set to the current unix time in seconds
since 1 januari 1970. This counter is used by several programs to create unique
.pkt filenames, msgid numbers etc.
<P>&nbsp;<P>
<H3>Environment.</H3>
<P>
In order to run <strong>mbtask</strong> you must set the global variable
<strong>$MBSE_ROOT</strong>. This variable must point to the root directory
of the bbs structure.
<P>&nbsp;<P>
<H3>Security.</H3>
<P>
<strong>mbtask</strong is installed setuid root. This is needed to initialize
a raw socket for the ping function. After that is done the privilege drops to
user <strong>mbse</strong> before the child process is created and the rest
of the initialisation is done.
The child process can never get root privileges because it is spawned by user mbse.
<P>&nbsp;<P>
<H3>Communications.</H3>
<P>
Communication between the server and the clients is established by
Unix datagram sockets. There can be only 1 server running.
The server will accept connections from clients on your local machine only.
The limit for the amount of clients that can connect to the server is set to 100.
<P>
The server creates a Unix datagram socket at startup and waits for connections.
The name of this this socket is /opt/mbse/tmp/mbtask.
When a client connects it creates a Unix datagram socket in /opt/mbse/tmp, the name is
the name of the program, added with the pid of the program. So if <b>mbcico</b> is started
with pid 2312 the socket will be /opt/mbse/tmp/mbcico2312.
<P>
All commands are 4 capital letters followed by a colon, a number indicating
how much data fields will follow. If that number is higher than zero, the
data fields are seperated with commas. The command is terminated
with a ; character. Examples are:<br>
<pre>
GCLO:0; Zero datafields command.
DOPE:1,dbname; One datafield command.
</pre>
All commands will receive a reply as soon as possible. If a
resource is temporary not available, a reply will follow too, telling
this condition. Replies can also contain optional data. Examples:<br>
<pre>
100:0; Response 100, no data.
200:1,Syntax error; One datafield.
</pre>
The server has a 10 minute timeout for receiving data when a connection
is established. The clients need to "ping" the server at regular intervals
to prevent a disconnect. All official MBSE BBS programs do that. The pid
send with most commands is the pid of the calling program. Since this number
is unique, it is used to keep track of the connected clients.
<P>
The commands are divided in 26 catagories, most unused at this time.
<P>
<pre>
Catagories:
Cat. Description
---- -------------------------------------------
Axxx Accounting, system monitor info etc.
Cxxx Chatting
Gxxx Global commands.
Sxxx Status commands.
Group A, Accounting.
Command: AINI:5,pid,tty,uid,prg,city; Initialize connection, and who am I.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ADOI:2,pid,doing; What am I doing right now.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ACLO:1,pid; Close my connection.
Reply: 107:0; Connection closed.
200:1,Syntax Error; Error, connection is still open.
Command: ALOG:5,fil,prg,pid,grade,txt; Write a line of text in logfile with grade.
Reply: 100:0; Ok.
201:1,errno; Error, number in errno.
Command: AUSR:3,pid,uid,city; Set username and city
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ADIS:2,pid,flag; Set Do Not Disturb flag.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ATIM:1,time; Set new Client/Server timer in seconds.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ADEF:0; Set Client/Server timer to default (10 minutes).
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Command: ATTY:2,pid,tty; Set new tty name.
Reply: 100:0; Ok.
200:1,Syntax Error; Error.
Group C, Chatting (just some ideas).
Command: CIPM:1,pid; Is Personal Message present.
Reply: 100:2,fromname,message; Yes, from .. with message text.
100:0; No.
Command: CSPM:3,fromuser,touser,txt; Send personal message to user.
Reply: 100:1,n; n: 0=Ok, 1=Do not disturb, 2=Buffer full, 3=Error.
100:0; Impossible.
The next commands are some ideas, they are not implemented.
Channel 0 will be for sysop chat only, other channels are
user channels.
-CBPM:2,fromuser,txt; Broadcast message to all users.
-CJCH:2,pid,channel; Join Channel
-CCCH:2,pid,channel; Close Channel
-CAML:2,channel,text; Add textline to channel
-CIML:1,channel; Is new textline present
-CSSP:1,user,reason; Send Sysop Page
-CESP:1,user; Retract Sysop Page
-CRSP:1,user; Reject user Page
-CFCH:2,channel,user; Force user in chatmode (for Sysop chat).
-CKCH:2,channel,user; Kill user chatmode (for Sysops and moderators).
Group G, Global commands.
Command: GNOP:0; No OPerations.
Reply: 100:0; Ok.
Command: GPNG:1,data; Ping, echo data.
Reply: 100:1,data; Ping reply.
Command: GVER:0; Give server version.
Reply: 100:1,Version ....; Version reply.
Command: GSTA:0; Get complete mbsed status record. (13 fields)
Reply: 100:19,start,laststart,daily,startups,clients,tot_clients,tot_peak,syntax_errs,
com_errs,today_clients,today_peak,today_syntax,today_comerr,bbsopen,
is_zmh,processing,system_load,sequence;
Command: GMON:1,n; Get registration info line, 1=First, 0=Next line.
Reply: 100:7,pid,tty,user,program,city,isdoing,starttime;
100:0; No more lines.
Command: GDST:0; Get filesystem status (see note below).
100:n,data1, ..., data10; Maximum 10 filesystems datalines.
Command: GSYS:0; Get bbs statistics.
100:7,calls,pots_calls,isdn_calls,network_calls,local_calls,startdate,lastcaller;
Command: GLCC:0; Get Lastcallers count
100,1,n; Return counter value.
Command: GLCR:1,recno; Get Lastcaller record
100:9,user,location,level,tty,time,minsmcalls,speed,cations;
201:1,16; Not available.
Group S, Status commands.
Command: SBBS:0; Get BBS Status (open, zmh, shutdown).
Reply: 100:2,0,The system is open for use;
100:2,1,The system is closed right now!;
100:2,2,The system is closed for Zone Mail Hour!;
Command: SOPE:0; Open the BBS.
Reply: 100:0; Ok.
Command: SCLO:1,mesage; Close the BBS with reason.
Reply: 100:0; Ok.
Command: SFRE:0; Is the BBS Free.
Reply: 100:1,Running utilities: n Active users: n;
100:0; It's free.
Command: SSEQ:0; Get next unique sequence number.
Reply: 100:1,number; Next unique sequence number.
Command: SEST:1,semafore; Get status of internal semafore.
Reply: 100:1,n; 1 = set, 0 = not set.
200:1,16; Semafore not known.
Command: SECR:1,semafore; Set semafore
Reply: 100:0; Ok.
200:1,16; Error.
Command: SERM:1,semafore; Remove semafore
Reply: 100:0; Ok (also if there was no semafore).
200:1,16; Semafore not known.
</pre>
Note: in reply of GDST the reply is 100:n,size free mountpoint fstype,.....
where n = 1 for 1 filesystem, and 10 for a total of 10 filesystems. There
will never be a reply for more then 10 filesystems. The reported filesystems
are retrieved from /etc/mtab which is the actual mountstatus. This is used
by the <b>mbmon</b> program to get a "live" view of your filesystems.
<P>&nbsp;<P>
<A HREF="index.htm"><IMG SRC="../images/larrow.gif" ALT="Index" Border="0" width="40" height="30"> Back to index</A>&nbsp;
<A HREF="../index.htm"><IMG SRC="../images/b_arrow.gif" ALT="Main" Border="0" width="33" height="35"> Back to Main index</A>
</BLOCKQUOTE>
</BODY>
</HTML>

View File

@ -427,7 +427,7 @@
426 exitinfo.c |Banking Door
427 exitinfo.c |Safe Door
428 exitinfo.c |WhosOn List
429 exitinfo.c |Idle
429 exitinfo.c |Offline Reader
430 exitinfo.c |Please enter username to send message to:
431 exitinfo.c |Sorry, there is no user on
432 exitinfo.c |doesn't wish to be disturbed

View File

@ -427,7 +427,7 @@ JN|Wilt U deze berichten downloaden [J/n]?
|Tijd Bank
|Kluis kraken
|Wie is hier
|Vrij
|Offline Reader
|Geef de gebruikersnaam waar het bericht heen moet:
|Sorry, er is niemand op
|wil niet gestoord worden

View File

@ -427,7 +427,7 @@ YN|Do you want to download these messages [Y/n]?
|Banking Door
|Safe Door
|WhosOn List
|Idle
|Offline Reader
|Please enter username to send message to:
|Sorry, there is no user on
|doesn't wish to be disturbed

View File

@ -427,7 +427,7 @@ SN|
|No Banco
|Safe Door
|L. Conectados
|Desocupado
|Offline Reader
|Teclea usuario ¢ que queres dar recado:
|Non hai usuario en
|Non quere que o molesten

View File

@ -427,7 +427,7 @@ SN|Vuoi scaricare questi messaggi [S/n]?
|Banking Door
|Safe Door
|WhosOn
|Idle
|Offline Reader
|Digita il nome della persona a cui inviare il messaggio:
|Mi dispiace, non c'e' tale utente
|l'utente non vuole essere disturbato

View File

@ -427,7 +427,7 @@ SN|
|En el Banco
|Safe Door
|L. Conectados
|Desocupado
|Offline Reader
|Teclea usuario al que enviar un aviso:
|No hay usuario en
|No quiere ser molestado

View File

@ -1,3 +1,5 @@
/* $Id$ */
#ifndef _COMMON_H
#define _COMMON_H
@ -504,7 +506,7 @@ char *arcname(faddr *, unsigned short, int);
void Setraw(void); /* Set raw mode */
void Unsetraw(void); /* Unset raw mode */
unsigned char Getone(void); /* Get one raw character */
int Speed(void); /* Get (locked) tty speed */
long Speed(void); /* Get (locked) tty speed */
int Waitchar(unsigned char *, int); /* Wait n * 10mSec for char */
int Escapechar(unsigned char *); /* Escape sequence test */
unsigned char Readkey(void); /* Read a translated key */

View File

@ -94,7 +94,8 @@ char sUserTimeleft[7]; /* Global Time Left Variable */
int iUserTimeLeft; /* Global Time Left Variable */
char LastLoginDate[12]; /* Last login date */
char LastLoginTime[9]; /* Last login time */
char LastCaller[36]; /* Last caller on system */
char LastCaller[36]; /* Last caller on system name */
time_t LastCallerTime; /* Last caller on system time */
char FirstName[20]; /* Users First name */
char LastName[30]; /* Users Last name */
int UserAge; /* Users age */

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: rawio.c
* $Id$
* Purpose ...............: Raw I/O routines.
* Last modification date : 07-Aug-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -44,10 +43,6 @@ void Setraw()
{
int rc;
// if (ioctl(ttyfd, TCGETA, &tbuf) == -1) {
// perror("TCGETA Failed");
// exit(1); /* ERROR - could not set get tty ioctl */
// }
if ((rc = tcgetattr(ttyfd, &tbufs))) {
perror("");
printf("$tcgetattr(0, save) return %d\n", rc);
@ -70,11 +65,6 @@ void Setraw()
exit(1);
}
// if (ioctl(ttyfd, TCSETAF, &tbuf) == -1) {
// perror("TCSETAF failed");
// exit(1); /* ERROR - could not set tty ioctl */
// }
rawset = TRUE;
}
@ -91,10 +81,6 @@ void Unsetraw()
* Only unset the mode if it is set to raw mode
*/
if (rawset == TRUE) {
// if (ioctl(ttyfd, TCSETAF, &tbufsav) == -1) {
// perror("TCSETAF Normal Failed");
// exit(1); /* ERROR - could not save original tty ioctl */
// }
if ((rc = tcsetattr(ttyfd, TCSAFLUSH, &tbufsavs))) {
perror("");
printf("$tcsetattr(%d, TCSAFLUSH, save) return %d\n", ttyfd, rc);
@ -132,21 +118,109 @@ unsigned char Getone()
/*
* Read the (locked) speed from the tty
*/
int Speed(void)
long Speed(void)
{
// int mspeed;
// struct termio ttyhold;
speed_t mspeed;
// static int baud[16] = {0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400};
// ioctl(0, TCGETA, &ttyhold);
// mspeed = baud[ttyhold.c_cflag & 017];
// ioctl(0, TCSETAF, &ttyhold);
mspeed = cfgetospeed(&tbufs);
return(mspeed);
#ifdef CBAUD
switch (mspeed & CBAUD) {
#else
switch (mspeed) {
#endif
case B0: return 0;
#if defined(B50)
case B50: return 50;
#endif
#if defined(B75)
case B75: return 75;
#endif
#if defined(B110)
case B110: return 110;
#endif
#if defined(B134)
case B134: return 134;
#endif
#if defined(B150)
case B150: return 150;
#endif
#if defined(B200)
case B200: return 200;
#endif
#if defined(B300)
case B300: return 300;
#endif
#if defined(B600)
case B600: return 600;
#endif
#if defined(B1200)
case B1200: return 1200;
#endif
#if defined(B1800)
case B1800: return 1800;
#endif
#if defined(B2400)
case B2400: return 2400;
#endif
#if defined(B4800)
case B4800: return 4800;
#endif
#if defined(B9600)
case B9600: return 9600;
#endif
#if defined(B19200)
case B19200: return 19200;
#endif
#if defined(B38400)
case B38400: return 38400;
#endif
#if defined(B57600)
case B57600: return 57600;
#endif
#if defined(B115200)
case B115200: return 115200;
#endif
#if defined(B230400)
case B230400: return 203400;
#endif
#if defined(B460800)
case B460800: return 460800;
#endif
#if defined(B500000)
case B500000: return 500000;
#endif
#if defined(B576000)
case B576000: return 576000;
#endif
#if defined(B921600)
case B921600: return 921600;
#endif
#if defined(B1000000)
case B1000000: return 1000000;
#endif
#if defined(B1152000)
case B1152000: return 1152000;
#endif
#if defined(B1500000)
case B1500000: return 1500000;
#endif
#if defined(B2000000)
case B2000000: return 2000000;
#endif
#if defined(B2500000)
case B2500000: return 2500000;
#endif
#if defined(B3000000)
case B3000000: return 3000000;
#endif
#if defined(B3500000)
case B3500000: return 3500000;
#endif
#if defined(B4000000)
case B4000000: return 4000000;
#endif
default: return 9600;
}
}

View File

@ -388,7 +388,8 @@ struct sysrec {
unsigned long Local; /* Local calls */
unsigned long ADSL; /* ADSL calls */
time_t StartDate; /* Start Date of BBS */
char LastCaller[36]; /* Last Caller to BBS */
char LastCaller[37]; /* Last Caller to BBS */
time_t LastTime; /* Time of last caller */
};

View File

@ -5,33 +5,33 @@
include ../Makefile.global
SRCS = bank.c commonio.c filesub.c language.c mbfbgen.c mbtoberep.c \
msgutil.c oneline.c sgetpwent.c xmalloc.c bbslist.c \
msgutil.c oneline.c sgetpwent.c xmalloc.c bbslist.c morefile.c \
email.c fsedit.c lineedit.c mblang.c mbuser.c myname.c page.c \
pwio.c shadowio.c bye.c encrypt.c funcs.c mail.c mbpasswd.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 \
exitinfo.c mball.c mbsebbs.c menu.c nextuser.c pop3.c lastcallers.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 mbnewusr.c input.c whoson.c \
door.c dispfile.c
door.c dispfile.c userlist.c timestats.c logentry.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 sgetpwent.h user.h bye.h \
mbstat.h msgutil.h oneline.h sgetpwent.h user.h bye.h morefile.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 \
xmalloc.h change.h exitinfo.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 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 \
door.h dispfile.h userlist.h timestats.h logentry.h lastcallers.h
MBSEBBS_OBJS = bank.o bbslist.o chat.o file.o funcs.o mail.o menu.o \
misc.o pinfo.o nextuser.o oneline.o page.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 \
pop3.o email.o input.o whoson.o door.o dispfile.o
pop3.o email.o input.o whoson.o door.o dispfile.o userlist.o timestats.o \
logentry.o morefile.o lastcallers.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 timeout.o dispfile.o oneline.o \
timecheck.o input.o exitinfo.o mail.o email.o msgutil.o whoson.o \
pop3.o funcs.o misc.o lineedit.o fsedit.o funcs4.o change.o \
filesub.o
timecheck.o input.o exitinfo.o funcs.o misc.o change.o \
filesub.o mail.o email.o msgutil.o pop3.o lineedit.o fsedit.o whoson.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
@ -155,7 +155,7 @@ depend:
# 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 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 input.h misc.h timeout.h exitinfo.h change.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 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
@ -164,8 +164,9 @@ oneline.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/
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 input.h language.h
morefile.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h morefile.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
fsedit.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/ansi.h ../lib/common.h ../lib/clcomm.h mail.h funcs.h language.h timeout.h pinfo.h fsedit.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
@ -175,37 +176,40 @@ 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 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 funcs4.h language.h input.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h mail.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
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 input.h newuser.h language.h timeout.h change.h dispfile.h
newuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h newuser.h language.h timeout.h change.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 dispfile.h funcs.h funcs4.h input.h language.h misc.h timeout.h exitinfo.h bye.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 bye.h exitinfo.h language.h input.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 input.h language.h misc.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 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
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 language.h menu.h misc.h bye.h timeout.h funcs.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 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 userlist.h timestats.h logentry.h morefile.h lastcallers.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
lastcallers.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h lastcallers.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
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 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 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 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
misc.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.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 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 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 timeout.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 dispfile.h funcs.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 input.h language.h misc.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
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 language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h dispfile.h
userlist.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h userlist.h language.h input.h timeout.h
timestats.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h timestats.h funcs.h language.h input.h exitinfo.h
logentry.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h logentry.h
# End of generated dependencies

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/bye.c
* $Id$
* Purpose ...............: Hangup functions
* Last modification date : 26-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -70,7 +69,7 @@ void Good_Bye(int onsig)
*/
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp,"r+b")) != NULL) {
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, exitinfo.Name);
if ((pExitinfo = fopen(temp,"rb")) != NULL) {
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
offset = usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize);
@ -111,7 +110,7 @@ void Good_Bye(int onsig)
sprintf(temp, "%s/tmp/mbsebbs%d", getenv("MBSE_ROOT"), getpid());
unlink(temp);
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, exitinfo.Name);
unlink(temp);
free(temp);
unlink("taglist");

View File

@ -37,7 +37,6 @@
#include "change.h"
#include "dispfile.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
@ -224,6 +223,45 @@ void Chg_Password()
/*
* Function to check if User Handle exists and returns a 0 or 1
*/
int CheckHandle(char *);
int CheckHandle(char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp, *temp1;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(PATH_MAX, sizeof(char));
strcpy(temp1, tl(Name));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( fp = fopen(temp,"rb")) != NULL) {
fread(&uhdr, sizeof(uhdr), 1, fp);
while (fread(&u, uhdr.recsize, 1, fp) == 1) {
strcpy(temp, tl(u.sHandle));
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
free(temp);
free(temp1);
fclose(fp);
}
return Status;
}
/*
* Function will allow a user to change his handle
*/

View File

@ -37,7 +37,6 @@
#include "../lib/msg.h"
#include "../lib/clcomm.h"
#include "funcs.h"
#include "funcs4.h"
#include "language.h"
#include "oneline.h"
#include "misc.h"
@ -441,7 +440,7 @@ void ControlCodeK(int ch)
break;
case 'E':
printf("%d", Speed() );
printf("%ld", Speed());
break;
case 'F':
@ -514,6 +513,10 @@ void ControlCodeK(int ch)
}
break;
case 'Q':
printf("%s %s", StrDateDMY(LastCallerTime), StrTimeHMS(LastCallerTime));
break;
default:
printf(" ");

View File

@ -45,11 +45,9 @@
#include "exitinfo.h"
//extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
/*
* Copy usersrecord into ~/tmp/.bbs-exitinfo.tty
* Copy usersrecord into ~/home/unixname/exitinfo
*/
int InitExitinfo()
{
@ -79,8 +77,7 @@ int InitExitinfo()
exitinfo = usrconfig;
fclose(pUsrConfig);
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
mkdirs(temp);
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, usrconfig.Name);
if ((pExitinfo = fopen(temp, "w+b")) == NULL) {
WriteError("$Can't open %s for writing", temp);
free(temp);
@ -88,6 +85,8 @@ int InitExitinfo()
} else {
fwrite(&exitinfo, sizeof(exitinfo), 1, pExitinfo);
fclose(pExitinfo);
if (chmod(temp, 0600))
WriteError("$Can't chmod 0600 %s", temp);
}
free(temp);
return TRUE;
@ -105,9 +104,9 @@ void ReadExitinfo()
char *temp;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, sUnixName);
mkdirs(temp);
if(( pExitinfo = fopen(temp,"r+b")) == NULL)
if ((pExitinfo = fopen(temp,"r+b")) == NULL)
InitExitinfo();
else {
fflush(stdin);
@ -130,8 +129,8 @@ void WriteExitinfo()
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
if(( pExitinfo = fopen(temp,"w+b")) == NULL)
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, sUnixName);
if ((pExitinfo = fopen(temp,"w+b")) == NULL)
WriteError("$WriteExitinfo() failed");
else {
fwrite(&exitinfo, sizeof(exitinfo), 1, pExitinfo);

View File

@ -53,6 +53,40 @@ int FileRecno = 0;
int CheckFile(char *, int);
int CheckFile(char *File, int iArea)
{
FILE *pFileB;
int iFile = FALSE;
char *sFileArea;
sFileArea = calloc(PATH_MAX, sizeof(char));
sprintf(sFileArea,"%s/fdb/fdb%d.dta", getenv("MBSE_ROOT"), iArea);
if(( pFileB = fopen(sFileArea,"r+")) == NULL) {
mkdir(sFileArea, 755);
return FALSE;
}
while ( fread(&file, sizeof(file), 1, pFileB) == 1) {
if((strcmp(tl(file.Name), tl(File))) == 0) {
iFile = TRUE;
fclose(pFileB);
return TRUE;
}
}
fclose(pFileB);
free(sFileArea);
if(!iFile)
return FALSE;
return 1;
}
/*
* Show filelist from current area, called from the menu.
*/

View File

@ -37,7 +37,6 @@
#include "filesub.h"
#include "funcs.h"
#include "language.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "timeout.h"

View File

@ -30,6 +30,19 @@
* 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/ansi.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "mail.h"
#include "funcs.h"
#include "language.h"
#include "timeout.h"
#include "pinfo.h"
#include "fsedit.h"

View File

@ -3,20 +3,6 @@
/* $Id$ */
/* Includes needed for fsedit.c */
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/ansi.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "mail.h"
#include "funcs4.h"
#include "language.h"
#include "timeout.h"
#include "pinfo.h"
int Fs_Edit(void); /* The fullscreen message editor */

View File

@ -37,24 +37,322 @@
#include "../lib/msg.h"
#include "../lib/clcomm.h"
#include "funcs.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 pid_t mypid; /* Original pid */
void UserSilent(int flag)
{
SockS("ADIS:2,%d,%d;", mypid, flag);
}
/*
* Check BBS open status, return FALSE if the bbs is closed.
* Display the reason why to the user.
*/
int CheckStatus()
{
static char buf[81];
sprintf(buf, "SBBS:0;");
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:2,0", 7) == 0)
return TRUE;
if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh))
return TRUE;
buf[strlen(buf) -1] = '\0';
printf("\n\n\007*** %s ***\n\n\n", buf+8);
fflush(stdout);
}
return FALSE;
}
/*
* Function to check if UserName exists and returns a 0 or 1
*/
int CheckName(char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp, *temp1;
struct userhdr ushdr;
struct userrec us;
temp = calloc(81, sizeof(char));
temp1 = calloc(81, sizeof(char));
strcpy(temp1, tl(Name));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp,"rb")) != NULL) {
fread(&ushdr, sizeof(ushdr), 1, fp);
while (fread(&us, ushdr.recsize, 1, fp) == 1) {
strcpy(temp, tl(us.sUserName));
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(temp1);
return Status;
}
/*
* Function will check and create a home directory for the user if
* needed. It will also change into the users home directory when
* they login.
*/
char *ChangeHomeDir(char *Name, int Mailboxes)
{
char *temp;
static char temp1[PATH_MAX];
FILE *fp;
temp = calloc(PATH_MAX, sizeof(char));
/*
* set umask bits to zero's then reset with mkdir
*/
umask(000);
/*
* First check to see if users home directory exists
* else try create directory, as set in CFG.bbs_usersdir
*/
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
free(temp);
ExitClient(1);
}
sprintf(temp1, "%s/%s", CFG.bbs_usersdir, Name);
/*
* Then check to see if users directory exists in the home dir
*/
if ((access(temp1, R_OK)) != 0) {
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
free(temp);
ExitClient(1);
}
/*
* Change to users home directory
*/
if (chdir(temp1) != 0) {
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
free(temp);
ExitClient(1);
}
setenv("HOME", temp1, 1);
/*
* Check if user has a .signature file.
* If not, create a simple one.
*/
sprintf(temp, "%s/%s/.signature", CFG.bbs_usersdir, Name);
if (access(temp, R_OK)) {
Syslog('+', "Creating users .signature file");
if ((fp = fopen(temp, "w")) == NULL) {
WriteError("$Can't create %s", temp);
} else {
fprintf(fp, " Gtx, %s\n", exitinfo.sUserName);
if (CFG.EmailMode == E_PRMISP)
fprintf(fp, " email: %s@%s\n", exitinfo.Name, CFG.sysdomain);
fclose(fp);
}
}
/*
* Check subdirectories, create them if they don't exist.
*/
sprintf(temp, "%s/wrk", temp1);
CheckDir(temp);
sprintf(temp, "%s/tag", temp1);
CheckDir(temp);
sprintf(temp, "%s/upl", temp1);
CheckDir(temp);
sprintf(temp, "%s/tmp", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu/run", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu/tmp", temp1);
CheckDir(temp);
umask(007);
/*
* Check users private emailboxes
*/
if (Mailboxes) {
sprintf(temp, "%s/mailbox", temp1);
if (Msg_Open(temp))
Msg_Close();
sprintf(temp, "%s/archive", temp1);
if (Msg_Open(temp))
Msg_Close();
sprintf(temp, "%s/trash", temp1);
if (Msg_Open(temp))
Msg_Close();
}
free(temp);
return temp1;
}
void CheckDir(char *dir)
{
if ((access(dir, R_OK) != 0)) {
Syslog('+', "Creating %s", dir);
if (mkdir(dir, 0770))
WriteError("$Can't create %s", dir);
}
}
/*
* Function will find where MBSE is located on system and load
* the file $MBSE_ROOT/etc/config.data in memory.
*/
void FindMBSE()
{
FILE *pDataFile;
static char p[81];
char *FileName;
struct passwd *pw;
FileName = calloc(PATH_MAX, sizeof(char));
/*
* Check if the environment is set, if not, then we create the
* environment from the passwd file.
*/
if (getenv("MBSE_ROOT") == NULL) {
pw = getpwnam("mbse");
memset(&p, 0, sizeof(p));
sprintf(p, "MBSE_ROOT=%s", pw->pw_dir);
putenv(p);
}
if (getenv("MBSE_ROOT") == NULL) {
printf("FATAL ERROR: Environment variable MBSE_ROOT not set\n");
free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
sprintf(FileName, "%s/etc/config.data", getenv("MBSE_ROOT"));
if(( pDataFile = fopen(FileName, "rb")) == NULL) {
printf("FATAL ERROR: Can't open %s for reading!\n", FileName);
printf("Please run mbsetup to create configuration file.\n");
printf("Or check that your environment variable MBSE_ROOT is set to the BBS Path!\n");
free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
fread(&CFG, sizeof(CFG), 1, pDataFile);
free(FileName);
fclose(pDataFile);
}
/*
* Returns Mmm in the users language.
*/
char *GetMonth(int Month)
{
static char month[10];
switch (Month) {
case 1:
strcpy(month, *(mLanguage + 398));
break;
case 2:
strcpy(month, *(mLanguage + 399));
break;
case 3:
strcpy(month, *(mLanguage + 400));
break;
case 4:
strcpy(month, *(mLanguage + 401));
break;
case 5:
strcpy(month, *(mLanguage + 402));
break;
case 6:
strcpy(month, *(mLanguage + 403));
break;
case 7:
strcpy(month, *(mLanguage + 404));
break;
case 8:
strcpy(month, *(mLanguage + 405));
break;
case 9:
strcpy(month, *(mLanguage + 406));
break;
case 10:
strcpy(month, *(mLanguage + 407));
break;
case 11:
strcpy(month, *(mLanguage + 408));
break;
case 12:
strcpy(month, *(mLanguage + 409));
break;
default:
strcpy(month, "Unknown");
}
return(month);
}
/* Returns DD-Mmm-YYYY */
char *GLCdateyy()
{
static char GLcdateyy[15];
char ntime[15];
time(&Time_Now);
l_date = localtime(&Time_Now);
sprintf(GLcdateyy,"%02d-",
l_date->tm_mday);
sprintf(ntime,"-%02d", l_date->tm_year+1900);
strcat(GLcdateyy, GetMonth(l_date->tm_mon+1));
strcat(GLcdateyy,ntime);
return(GLcdateyy);
}
/*
@ -78,277 +376,3 @@ int Access(securityrec us, securityrec ref)
}
void UserList(char *OpData)
{
FILE *pUsrConfig;
int LineCount = 2;
int iFoundName = FALSE;
int iNameCount = 0;
char *Name, *sTemp, *User;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
Name = calloc(37, sizeof(char));
sTemp = calloc(81, sizeof(char));
User = calloc(81, sizeof(char));
clear();
/* User List */
language(15, 0, 126);
Enter(1);
LineCount = 1;
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp, "rb")) == NULL) {
WriteError("UserList: Can't open file: %s", temp);
return;
}
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
/* Enter Username search string or (Enter) for all users: */
language(15, 0, 127);
colour(CFG.InputColourF, CFG.InputColourB);
alarm_on();
GetstrC(Name,35);
clear();
/* Name Location Last On Calls */
language(15, 0, 128);
Enter(1);
colour(2, 0);
fLine(79);
colour(3, 0);
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) {
if ((strcmp(Name,"")) != 0) {
if((strcmp(OpData, "/H")) == 0)
sprintf(User, "%s", u.sHandle);
else
sprintf(User, "%s", u.sUserName);
if ((strstr(tl(User), tl(Name)) != NULL)) {
if ((!u.Hidden) && (!u.Deleted)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
}
}
} else
if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
Enter(1);
}
if (LineCount >= exitinfo.iScreenLen - 2) {
LineCount = 0;
Pause();
colour(3, 0);
}
}
if(!iFoundName) {
language(3, 0, 129);
Enter(1);
}
fclose(pUsrConfig);
colour(2, 0);
fLine(79);
free(temp);
free(Name);
free(sTemp);
free(User);
Pause();
}
void TimeStats()
{
clear();
ReadExitinfo();
colour(15, 0);
/* TIME STATISTICS for */
printf("\n%s%s ", (char *) Language(134), exitinfo.sUserName);
/* on */
printf("%s %s\n", (char *) Language(135), (char *) logdate());
colour(12, 0);
fLine(79);
printf("\n");
colour(10, 0);
/* Current Time */
printf("%s %s\n", (char *) Language(136), (char *) GetLocalHMS());
/* Current Date */
printf("%s %s\n\n", (char *) Language(137), (char *) GLCdateyy());
/* Connect time */
printf("%s %d %s\n", (char *) Language(138), exitinfo.iConnectTime, (char *) Language(471));
/* Time used today */
printf("%s %d %s\n", (char *) Language(139), exitinfo.iTimeUsed, (char *) Language(471));
/* Time remaining today */
printf("%s %d %s\n", (char *) Language(140), exitinfo.iTimeLeft, (char *) Language(471));
/* Daily time limit */
printf("%s %d %s\n", (char *) Language(141), exitinfo.iTimeUsed + exitinfo.iTimeLeft, (char *) Language(471));
printf("\n");
Pause();
}
int CheckFile(char *File, int iArea)
{
FILE *pFileB;
int iFile = FALSE;
char *sFileArea;
sFileArea = calloc(PATH_MAX, sizeof(char));
sprintf(sFileArea,"%s/fdb/fdb%d.dta", getenv("MBSE_ROOT"), iArea);
if(( pFileB = fopen(sFileArea,"r+")) == NULL) {
mkdir(sFileArea, 755);
return FALSE;
}
while ( fread(&file, sizeof(file), 1, pFileB) == 1) {
if((strcmp(tl(file.Name), tl(File))) == 0) {
iFile = TRUE;
fclose(pFileB);
return TRUE;
}
}
fclose(pFileB);
free(sFileArea);
if(!iFile)
return FALSE;
return 1;
}
/*
* View a textfile.
*/
void ViewTextFile(char *Textfile)
{
FILE *fp;
int iLine = 0;
char *temp, *temp1;
char sPrompt[] = "\n(More (Y/n/=): ";
int i, x, z;
x = strlen(sPrompt);
temp1 = calloc(PATH_MAX, sizeof(char));
temp = calloc(81, sizeof(char));
sprintf(temp1, "%s", Textfile);
if(( fp = fopen (temp1, "r")) != NULL) {
while (fgets(temp, 80, fp) != NULL) {
printf("%s", temp);
++iLine;
if(iLine >= exitinfo.iScreenLen && iLine < 1000) {
iLine = 0;
pout(CFG.MoreF, CFG.MoreB, sPrompt);
fflush(stdout);
z = Getone();
switch(z) {
case 'n':
case 'N':
printf("\n");
break;
case '=':
iLine = 1000;
}
for(i = 0; i < x; i++)
printf("\b");
for(i = 0; i < x; i++)
printf(" ");
printf("\r");
}
}
fclose(fp);
}
Pause();
free(temp1);
free(temp);
}
/*
* Function will make log entry in users logfile
* Understands @ for Fileareas and ^ for Message Areas
*/
void LogEntry(char *Log)
{
char *Entry, *temp;
int i;
Entry = calloc(256, sizeof(char));
temp = calloc(1, sizeof(char));
for(i = 0; i < strlen(Log); i++) {
if(*(Log + i) == '@')
strcat(Entry, sAreaDesc);
else
if(*(Log + i) == '^')
strcat(Entry, sMsgAreaDesc);
else {
sprintf(temp, "%c", *(Log + i));
strcat(Entry, temp);
}
}
Syslog('+', Entry);
free(Entry);
free(temp);
}

View File

@ -3,12 +3,15 @@
#ifndef _FUNCS_H
#define _FUNCS_H
int Access(securityrec, securityrec); /* Check security access */
void UserList(char *); /* Get complete users list */
void TimeStats(void); /* Get users Time Statistics */
int CheckFile(char *, int); /* Check for Dupe file in Database */
void ViewTextFile(char *); /* View text file */
void LogEntry(char *); /* Create log entry in logfile */
void UserSilent(int); /* Update users silent flag info */
int CheckStatus(void); /* Check BBS open status */
int CheckName(char *); /* Check if user name exists */
char *ChangeHomeDir(char *, int); /* Change and Create Users Home Directories */
void CheckDir(char *); /* Check and create directory */
void FindMBSE(void); /* Load Configuration file in memory */
char *GLCdateyy(void); /* Returns current date DD-Mmm-YYYY */
char *GetMonth(int); /* Returns Mmm */
int Access(securityrec, securityrec); /* Check security access */
#endif

View File

@ -1,597 +0,0 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Misc 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 "../lib/msg.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "timeout.h"
#include "language.h"
extern pid_t mypid; /* Original pid */
void UserSilent(int flag)
{
SockS("ADIS:2,%d,%d;", mypid, flag);
}
/*
* Check BBS open status, return FALSE if the bbs is closed.
* Display the reason why to the user.
*/
int CheckStatus()
{
static char buf[81];
sprintf(buf, "SBBS:0;");
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:2,0", 7) == 0)
return TRUE;
if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh))
return TRUE;
buf[strlen(buf) -1] = '\0';
printf("\n\n\007*** %s ***\n\n\n", buf+8);
fflush(stdout);
}
return FALSE;
}
/*
* Function will Scan Users Database for existing phone numbers. If
* found, it will write a log entry to the logfile. The user WILL NOT
* be notified about the same numbers
*/
int TelephoneScan(char *Number, char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(81, sizeof(char));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( fp = fopen(temp,"rb")) != NULL) {
fread(&uhdr, sizeof(uhdr), 1, fp);
while (fread(&u, uhdr.recsize, 1, fp) == 1) {
if (strcasecmp(u.sUserName, Name) != 0)
if ((strlen(u.sVoicePhone) && (strcmp(u.sVoicePhone, Number) == 0)) ||
(strlen(u.sDataPhone) && (strcmp(u.sDataPhone, Number) == 0))) {
Status = TRUE;
Syslog('b', "Dupe phones ref: \"%s\" voice: \"%s\" data: \"%s\"",
Number, u.sVoicePhone, u.sDataPhone);
Syslog('+', "Uses the same telephone number as %s", u.sUserName);
}
}
fclose(fp);
}
free(temp);
return Status;
}
/*
* Function to check if UserName exists and returns a 0 or 1
*/
int CheckName(char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp, *temp1;
struct userhdr ushdr;
struct userrec us;
temp = calloc(81, sizeof(char));
temp1 = calloc(81, sizeof(char));
strcpy(temp1, tl(Name));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp,"rb")) != NULL) {
fread(&ushdr, sizeof(ushdr), 1, fp);
while (fread(&us, ushdr.recsize, 1, fp) == 1) {
strcpy(temp, tl(us.sUserName));
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(temp1);
return Status;
}
/*
* This function returns the date in the following format:
* DD-Mon HH:MM:SS (Day-Month Time)
* The users language is used.
*/
char *logdate()
{
static char Logdate[15];
time(&Time_Now);
l_date = localtime(&Time_Now);
sprintf(Logdate,"%02d-%s %02d:%02d:%02d", l_date->tm_mday, GetMonth(l_date->tm_mon+1),
l_date->tm_hour, l_date->tm_min, l_date->tm_sec);
return(Logdate);
}
/*
* Function will ask user to create a unix login
* Name cannot be longer than 8 characters
*/
char *NameGen(char *FidoName)
{
char *sUserName;
struct passwd *pw;
sUserName = calloc(10, sizeof(char));
Syslog('+', "NameGen(%s)", FidoName);
setpwent();
while ((strcmp(sUserName, "") == 0 || (pw = getpwnam(sUserName)) != NULL) || (strlen(sUserName) < 3)) {
colour(12, 0);
printf("\n%s\n\n", (char *) Language(381));
colour(15, 0);
/* Please enter a login name (Maximum 8 characters) */
printf("\n%s\n", (char *) Language(383));
/* ie. John Doe, login = jdoe */
printf("%s\n", (char *) Language(384));
colour(10, 0);
/* login > */
printf("%s", (char *) Language(385));
fflush(stdout);
fflush(stdin);
GetstrU(sUserName, 7);
setpwent();
if (pw = getpwnam(tl(sUserName)), pw != NULL) {
/* That login name already exists, please choose another one. */
colour(12, 0);
printf("\n%s\n", (char *) Language(386));
setpwent();
}
}
return tl(sUserName);
}
/*
* Function will create the users name in the passwd file
*/
char *NameCreate(char *Name, char *Comment, char *Password)
{
char *PassEnt;
PassEnt = calloc(256, sizeof(char));
/*
* Call mbuseradd, this is a special setuid root program to create
* unix acounts and home directories.
*/
sprintf(PassEnt, "%s/bin/mbuseradd %d %s \"%s\" %s",
getenv("MBSE_ROOT"), getgid(), Name, Comment, CFG.bbs_usersdir);
Syslog('+', "%s", PassEnt);
fflush(stdout);
fflush(stdin);
if (system(PassEnt) != 0) {
WriteError("Failed to create unix account");
free(PassEnt);
ExitClient(1);
}
sprintf(PassEnt, "%s/bin/mbpasswd -f %s %s", getenv("MBSE_ROOT"), Name, Password);
Syslog('+', "%s/bin/mbpasswd -f %s ******", getenv("MBSE_ROOT"), Name);
if (system(PassEnt) != 0) {
WriteError("Failed to set unix password");
free(PassEnt);
ExitClient(1);
}
colour(14, 0);
/* Your "Unix Account" is created, you may use it the next time you call */
printf("\n%s\n", (char *) Language(382));
Syslog('+', "Created Unix account %s for %s", Name, Comment);
free(PassEnt);
return Name;
}
/*
* Function will check and create a home directory for the user if
* needed. It will also change into the users home directory when
* they login.
*/
char *ChangeHomeDir(char *Name, int Mailboxes)
{
char *temp;
static char temp1[PATH_MAX];
FILE *fp;
temp = calloc(PATH_MAX, sizeof(char));
/*
* set umask bits to zero's then reset with mkdir
*/
umask(000);
/*
* First check to see if users home directory exists
* else try create directory, as set in CFG.bbs_usersdir
*/
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
free(temp);
ExitClient(1);
}
sprintf(temp1, "%s/%s", CFG.bbs_usersdir, Name);
/*
* Then check to see if users directory exists in the home dir
*/
if ((access(temp1, R_OK)) != 0) {
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
free(temp);
ExitClient(1);
}
/*
* Change to users home directory
*/
if (chdir(temp1) != 0) {
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
free(temp);
ExitClient(1);
}
setenv("HOME", temp1, 1);
/*
* Check if user has a .signature file.
* If not, create a simple one.
*/
sprintf(temp, "%s/%s/.signature", CFG.bbs_usersdir, Name);
if (access(temp, R_OK)) {
Syslog('+', "Creating users .signature file");
if ((fp = fopen(temp, "w")) == NULL) {
WriteError("$Can't create %s", temp);
} else {
fprintf(fp, " Gtx, %s\n", exitinfo.sUserName);
if (CFG.EmailMode == E_PRMISP)
fprintf(fp, " email: %s@%s\n", exitinfo.Name, CFG.sysdomain);
fclose(fp);
}
}
/*
* Check subdirectories, create them if they don't exist.
*/
sprintf(temp, "%s/wrk", temp1);
CheckDir(temp);
sprintf(temp, "%s/tag", temp1);
CheckDir(temp);
sprintf(temp, "%s/upl", temp1);
CheckDir(temp);
sprintf(temp, "%s/tmp", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu/run", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu/tmp", temp1);
CheckDir(temp);
umask(007);
/*
* Check users private emailboxes
*/
if (Mailboxes) {
sprintf(temp, "%s/mailbox", temp1);
if (Msg_Open(temp))
Msg_Close();
sprintf(temp, "%s/archive", temp1);
if (Msg_Open(temp))
Msg_Close();
sprintf(temp, "%s/trash", temp1);
if (Msg_Open(temp))
Msg_Close();
}
free(temp);
return temp1;
}
void CheckDir(char *dir)
{
if ((access(dir, R_OK) != 0)) {
Syslog('+', "Creating %s", dir);
if (mkdir(dir, 0770))
WriteError("$Can't create %s", dir);
}
}
/*
* Function will check /etc/passwd for users fidonet login name.
* This will allow users to login in with there full name instead of
* their login name, to cut out confusion between unix accounts
* and normal bbs logins.
*/
int Check4UnixLogin(char *UsersName)
{
unsigned UID = -1; /* Set to -1 incase user is not found */
struct passwd *pw;
while ((pw = getpwent())) {
if(strcmp(pw->pw_gecos, UsersName) == 0) {
UID = pw->pw_uid;
break;
}
}
return UID;
}
/*
* Function to check if User Handle exists and returns a 0 or 1
*/
int CheckHandle(char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp, *temp1;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(PATH_MAX, sizeof(char));
strcpy(temp1, tl(Name));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( fp = fopen(temp,"rb")) != NULL) {
fread(&uhdr, sizeof(uhdr), 1, fp);
while (fread(&u, uhdr.recsize, 1, fp) == 1) {
strcpy(temp, tl(u.sHandle));
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
free(temp);
free(temp1);
fclose(fp);
}
return Status;
}
/*
* Function will check for unwanted user names
*/
int BadNames(char *Username)
{
FILE *fp;
short iFoundName = FALSE;
char *temp, *String, *User;
temp = calloc(PATH_MAX, sizeof(char));
String = calloc(81, sizeof(char));
User = calloc(81, sizeof(char));
strcpy(User, tl(Username));
sprintf(temp, "%s/etc/badnames.ctl", getenv("MBSE_ROOT"));
if(( fp = fopen(temp, "r")) != NULL) {
while((fgets(String, 80, fp)) != NULL) {
strcpy(String, tl(String));
Striplf(String);
if((strstr(User, String)) != NULL) {
printf("\nSorry that name is not acceptable on this system\n");
iFoundName = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(String);
free(User);
return iFoundName;
}
/*
* Function will find where MBSE is located on system and load
* the file $MBSE_ROOT/etc/config.data in memory.
*/
void FindMBSE()
{
FILE *pDataFile;
static char p[81];
char *FileName;
struct passwd *pw;
FileName = calloc(PATH_MAX, sizeof(char));
/*
* Check if the environment is set, if not, then we create the
* environment from the passwd file.
*/
if (getenv("MBSE_ROOT") == NULL) {
pw = getpwnam("mbse");
memset(&p, 0, sizeof(p));
sprintf(p, "MBSE_ROOT=%s", pw->pw_dir);
putenv(p);
}
if (getenv("MBSE_ROOT") == NULL) {
printf("FATAL ERROR: Environment variable MBSE_ROOT not set\n");
free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
sprintf(FileName, "%s/etc/config.data", getenv("MBSE_ROOT"));
if(( pDataFile = fopen(FileName, "rb")) == NULL) {
printf("FATAL ERROR: Can't open %s for reading!\n", FileName);
printf("Please run mbsetup to create configuration file.\n");
printf("Or check that your environment variable MBSE_ROOT is set to the BBS Path!\n");
free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
fread(&CFG, sizeof(CFG), 1, pDataFile);
free(FileName);
fclose(pDataFile);
}
/*
* Returns Mmm in the users language.
*/
char *GetMonth(int Month)
{
static char month[10];
switch (Month) {
case 1:
strcpy(month, *(mLanguage + 398));
break;
case 2:
strcpy(month, *(mLanguage + 399));
break;
case 3:
strcpy(month, *(mLanguage + 400));
break;
case 4:
strcpy(month, *(mLanguage + 401));
break;
case 5:
strcpy(month, *(mLanguage + 402));
break;
case 6:
strcpy(month, *(mLanguage + 403));
break;
case 7:
strcpy(month, *(mLanguage + 404));
break;
case 8:
strcpy(month, *(mLanguage + 405));
break;
case 9:
strcpy(month, *(mLanguage + 406));
break;
case 10:
strcpy(month, *(mLanguage + 407));
break;
case 11:
strcpy(month, *(mLanguage + 408));
break;
case 12:
strcpy(month, *(mLanguage + 409));
break;
default:
strcpy(month, "Unknown");
}
return(month);
}
/* Returns DD-Mmm-YYYY */
char *GLCdateyy()
{
static char GLcdateyy[15];
char ntime[15];
time(&Time_Now);
l_date = localtime(&Time_Now);
sprintf(GLcdateyy,"%02d-",
l_date->tm_mday);
sprintf(ntime,"-%02d", l_date->tm_year+1900);
strcat(GLcdateyy, GetMonth(l_date->tm_mon+1));
strcat(GLcdateyy,ntime);
return(GLcdateyy);
}

View File

@ -1,24 +0,0 @@
/* $Id$ */
#ifndef _FUNCS4_H
#define _FUNCS4_H
void UserSilent(int); /* Update users silent flag info */
int CheckStatus(void); /* Check BBS open status */
int TelephoneScan(char *, char *);/* Scans for Duplicate User Phone Numbers */
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 */
char *NameCreate(char *, char *, char *);/* Create users login in passwd file */
char *ChangeHomeDir(char *, int); /* Change and Create Users Home Directories */
void CheckDir(char *); /* Check and create directory */
int Check4UnixLogin(char *); /* Check Passwd File for Users Login */
int CheckHandle(char *); /* Check if user handle exists */
int BadNames(char *); /* Check for Unwanted user names */
void FindMBSE(void); /* Load Configuration file in memory */
char *GLCdateyy(void); /* Returns current date DD-Mmm-YYYY */
char *GetMonth(int); /* Returns Mmm */
#endif

152
mbsebbs/lastcallers.c Normal file
View File

@ -0,0 +1,152 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Display Last Callers
*
*****************************************************************************
* 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 "language.h"
#include "lastcallers.h"
/*
* Last caller action flags
*/
extern int LC_Download;
extern int LC_Upload;
extern int LC_Read;
extern int LC_Wrote;
extern int LC_Chat;
extern int LC_Olr;
extern int LC_Door;
/*
* Display last callers screen.
*/
void LastCallers(char *OpData)
{
FILE *pLC;
int LineCount = 5;
int count = 0;
char *sFileName;
char *Heading;
char *Underline;
int i, x;
struct lastcallers lcall;
struct lastcallershdr lcallhdr;
sFileName = calloc(PATH_MAX, sizeof(char));
Heading = calloc(81, sizeof(char));
Underline = calloc(81, sizeof(char));
clear();
sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT"));
if((pLC = fopen(sFileName,"r")) == NULL)
WriteError("$LastCallers: Can't open %s", sFileName);
else {
fread(&lcallhdr, sizeof(lcallhdr), 1, pLC);
colour(15, 0);
/* Todays callers to */
sprintf(Heading, "%s%s", (char *) Language(84), 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");
/* # User Name Device timeOn Calls Location */
pout(10, 0, (char *) Language(85));
Enter(1);
colour(2, 0);
fLine(79);
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
if(!lcall.Hidden) {
count++;
colour(15,0);
printf("%-5d", count);
colour(11, 0);
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
printf("%-20s", lcall.Handle);
else
printf("%-20s", lcall.UserName);
} else
printf("%-20s", lcall.UserName);
colour(9, 0);
printf("%-8s", lcall.Device);
colour(13, 0);
printf("%-8s", lcall.TimeOn);
colour(14, 0);
printf("%-7d", lcall.Calls);
colour(12, 0);
printf("%-32s\n", lcall.Location);
LineCount++;
if (LineCount == exitinfo.iScreenLen) {
Pause();
LineCount = 0;
}
} /* End of check if user is sysop */
}
colour(2, 0);
fLine(79);
fclose(pLC);
printf("\n");
Pause();
}
free(sFileName);
free(Heading);
free(Underline);
}

8
mbsebbs/lastcallers.h Normal file
View File

@ -0,0 +1,8 @@
/* $Id$ */
#ifndef _LASTCALLERS_H
#define _LASTCALLERS_H
void LastCallers(char *);
#endif

70
mbsebbs/logentry.c Normal file
View File

@ -0,0 +1,70 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Make a log entry
*
*****************************************************************************
* 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 "logentry.h"
/*
* Function will make log entry in users logfile
* Understands @ for Fileareas and ^ for Message Areas
*/
void LogEntry(char *Log)
{
char *Entry, *temp;
int i;
Entry = calloc(256, sizeof(char));
temp = calloc(1, sizeof(char));
for(i = 0; i < strlen(Log); i++) {
if(*(Log + i) == '@')
strcat(Entry, sAreaDesc);
else
if(*(Log + i) == '^')
strcat(Entry, sMsgAreaDesc);
else {
sprintf(temp, "%c", *(Log + i));
strcat(Entry, temp);
}
}
Syslog('+', Entry);
free(Entry);
free(temp);
}

9
mbsebbs/logentry.h Normal file
View File

@ -0,0 +1,9 @@
/* $Id$ */
#ifndef _LOGENTRY_H
#define _LOGENTRY_H
void LogEntry(char *); /* Create log entry in logfile */
#endif

View File

@ -111,10 +111,10 @@ int main(int argc, char **argv)
if (strncmp( (tty = *(argv+1)), "/dev/", 5 ) == 0 ) {
tty+=5;
sprintf(pid,"%s/tmp/.bbs-exitinfo.%s",BBSpath,tty);
sprintf(pid,"%s/bbs/exitinfo", CFG.bbs_usersdir);
strcpy(sTTY,"");
} else {
sprintf(pid,"%s/tmp/.bbs-exitinfo.%s",BBSpath,*(argv+1));
sprintf(pid,"%s/bbs/exitinfo", CFG.bbs_usersdir);
strcpy(sTTY,"/dev/");
}

View File

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

View File

@ -38,12 +38,13 @@
#include "mbsebbs.h"
#include "user.h"
#include "dispfile.h"
#include "funcs4.h"
#include "language.h"
#include "menu.h"
#include "misc.h"
#include "bye.h"
#include "timeout.h"
#include "funcs.h"
extern int do_quiet; /* Logging quiet flag */
time_t t_start;

View File

@ -42,7 +42,6 @@
#include "chat.h"
#include "file.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "nextuser.h"
@ -59,6 +58,11 @@
#include "email.h"
#include "door.h"
#include "dispfile.h"
#include "userlist.h"
#include "timestats.h"
#include "logentry.h"
#include "morefile.h"
#include "lastcallers.h"

View File

@ -35,7 +35,6 @@
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
@ -43,7 +42,6 @@
#include "exitinfo.h"
extern pid_t mypid; /* Pid of this program */
extern char *StartTime; /* Time user logged in */
/*
@ -58,112 +56,6 @@ int LC_Olr = FALSE;
int LC_Door = FALSE;
int MoreFile(char *filename)
{
char Buf[81];
static FILE *fptr;
int lines;
int input;
int ignore = FALSE;
int maxlines;
maxlines = lines = exitinfo.iScreenLen - 2;
if ((fptr = fopen(filename,"r")) == NULL) {
printf("%s%s\n", (char *) Language(72), filename);
return(0);
}
printf("\n");
while (fgets(Buf,80,fptr) != NULL) {
if ((lines != 0) || (ignore)) {
lines--;
printf("%s",Buf);
}
if (strlen(Buf) == 0) {
fclose(fptr);
return(0);
}
if (lines == 0) {
fflush(stdin);
/* More (Y/n/=) */
printf(" %sY\x08", (char *) Language(61));
fflush(stdout);
alarm_on();
input = toupper(getchar());
if ((input == Keystroke(61, 0)) || (input == '\r'))
lines = maxlines;
if (input == Keystroke(61, 1)) {
fclose(fptr);
return(0);
}
if (input == Keystroke(61, 2))
ignore = TRUE;
else
lines = maxlines;
}
}
Pause();
fclose(fptr);
return 1;
}
int GetLastUser()
{
FILE *pCallerLog;
char *sDataFile;
sDataFile = calloc(PATH_MAX, sizeof(char));
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
if((pCallerLog = fopen(sDataFile, "r+")) == NULL)
WriteError("GetLastUser: Can't open file: %s", sDataFile);
else {
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
/* Get lastcaller in memory */
strcpy(LastCaller, SYSINFO.LastCaller);
/* Set next lastcaller (this user) */
if(!usrconfig.Hidden)
strcpy(SYSINFO.LastCaller,exitinfo.sUserName);
SYSINFO.SystemCalls++;
switch(ttyinfo.type) {
case POTS:
SYSINFO.Pots++;
break;
case ISDN:
SYSINFO.ISDN++;
break;
case NETWORK:
SYSINFO.Network++;
break;
case LOCAL:
SYSINFO.Local++;
break;
}
rewind(pCallerLog);
fwrite(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
fclose(pCallerLog);
}
free(sDataFile);
return 1;
}
int ChkFiles()
{
@ -338,128 +230,3 @@ char *GLCdate()
/*
* Display last callers screen.
*/
void LastCallers(char *OpData)
{
FILE *pLC;
int LineCount = 5;
int count = 0;
char *sFileName;
char *Heading;
char *Underline;
int i, x;
struct lastcallers lcall;
struct lastcallershdr lcallhdr;
sFileName = calloc(PATH_MAX, sizeof(char));
Heading = calloc(81, sizeof(char));
Underline = calloc(81, sizeof(char));
clear();
sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT"));
if((pLC = fopen(sFileName,"r")) == NULL)
WriteError("$LastCallers: Can't open %s", sFileName);
else {
fread(&lcallhdr, sizeof(lcallhdr), 1, pLC);
colour(15, 0);
/* Todays callers to */
sprintf(Heading, "%s%s", (char *) Language(84), 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");
/* # User Name Device timeOn Calls Location */
pout(10, 0, (char *) Language(85));
Enter(1);
colour(2, 0);
fLine(79);
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
if(!lcall.Hidden) {
count++;
colour(15,0);
printf("%-5d", count);
colour(11, 0);
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
printf("%-20s", lcall.Handle);
else
printf("%-20s", lcall.UserName);
} else
printf("%-20s", lcall.UserName);
colour(9, 0);
printf("%-8s", lcall.Device);
colour(13, 0);
printf("%-8s", lcall.TimeOn);
colour(14, 0);
printf("%-7d", lcall.Calls);
colour(12, 0);
printf("%-32s\n", lcall.Location);
LineCount++;
if (LineCount == exitinfo.iScreenLen) {
Pause();
LineCount = 0;
}
} /* End of check if user is sysop */
}
colour(2, 0);
fLine(79);
fclose(pLC);
printf("\n");
Pause();
}
free(sFileName);
free(Heading);
free(Underline);
}
/*
* Check for a personal message, this will go via mbsed. If there
* is a message, it will be displayed, else nothing happens.
*/
void Check_PM(void)
{
static char buf[128];
char resp[128];
sprintf(buf, "CIPM:1,%d;", mypid);
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) == 0)
return;
strcpy(resp, strtok(buf, ":"));
strcpy(resp, strtok(NULL, ","));
colour(CYAN, BLACK);
/* ** Message ** from */
printf("\n\n\007%s %s:\n", (char *)Language(434), strtok(NULL, ","));
printf("%s\n", strtok(NULL, ";"));
Pause();
}
}

View File

@ -1,15 +1,12 @@
/* $Id$ */
#ifndef _MISC_H
#define _MISC_H
void Setup(char *, char *); /* This function replaces a string in the users file */
int GetLastUser(void);
void LastCallers(char *);
void SaveLastCallers(void);
char *GLCdate(void); /* Returns current date DD-Mmm */
void DisplayLogo(void);
int ChkFiles(void);
int MoreFile(char *);
void Check_PM(void); /* Check for personal message */
#endif

116
mbsebbs/morefile.c Normal file
View File

@ -0,0 +1,116 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Display file with more
*
*****************************************************************************
* 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 "funcs.h"
//#include "input.h"
//#include "language.h"
#include "morefile.h"
//#include "timeout.h"
//#include "exitinfo.h"
//extern pid_t mypid; /* Pid of this program */
//extern char *StartTime; /* Time user logged in */
/*
* Last caller action flags
*/
//int LC_Download = FALSE;
//int LC_Upload = FALSE;
//int LC_Read = FALSE;
//int LC_Wrote = FALSE;
//int LC_Chat = FALSE;
//int LC_Olr = FALSE;
//int LC_Door = FALSE;
int MoreFile(char *filename)
{
char Buf[81];
static FILE *fptr;
int lines;
int input;
int ignore = FALSE;
int maxlines;
maxlines = lines = exitinfo.iScreenLen - 2;
if ((fptr = fopen(filename,"r")) == NULL) {
printf("%s%s\n", (char *) Language(72), filename);
return(0);
}
printf("\n");
while (fgets(Buf,80,fptr) != NULL) {
if ((lines != 0) || (ignore)) {
lines--;
printf("%s",Buf);
}
if (strlen(Buf) == 0) {
fclose(fptr);
return(0);
}
if (lines == 0) {
fflush(stdin);
/* More (Y/n/=) */
printf(" %sY\x08", (char *) Language(61));
fflush(stdout);
alarm_on();
input = toupper(getchar());
if ((input == Keystroke(61, 0)) || (input == '\r'))
lines = maxlines;
if (input == Keystroke(61, 1)) {
fclose(fptr);
return(0);
}
if (input == Keystroke(61, 2))
ignore = TRUE;
else
lines = maxlines;
}
}
Pause();
fclose(fptr);
return 1;
}

8
mbsebbs/morefile.h Normal file
View File

@ -0,0 +1,8 @@
/* $Id$ */
#ifndef _MOREFILE_H
#define _MOREFILE_H
int MoreFile(char *);
#endif

View File

@ -35,7 +35,7 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "funcs4.h"
#include "funcs.h"
#include "input.h"
#include "newuser.h"
#include "language.h"
@ -44,15 +44,30 @@
#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 char *ieHandle; /* Users Handle */
extern time_t t_start; /* Program starttime */
int do_mailout = FALSE; /* Just for linking */
/*
* Internal prototypes
*/
char *NameGen(char *); /* Get and test for unix login */
char *NameCreate(char *, char *, char *); /* Create users login in passwd file */
int BadNames(char *); /* Check for Unwanted user names */
int TelephoneScan(char *, char *); /* Scans for Duplicate User Phone Numbers */
/*
* Variables
*/
extern int do_quiet; /* No logging to the screen */
extern pid_t mypid; /* Pid of this program */
char UnixName[9]; /* Unix Name */
extern char *ieHandle; /* Users Handle */
extern time_t t_start; /* Program starttime */
int do_mailout = FALSE; /* Just for linking */
/*
* The main newuser registration function
*/
int newuser()
{
FILE *pUsrConfig;
@ -574,3 +589,161 @@ void Good_Bye(int onsig)
}
/*
* Function will ask user to create a unix login
* Name cannot be longer than 8 characters
*/
char *NameGen(char *FidoName)
{
char *sUserName;
struct passwd *pw;
sUserName = calloc(10, sizeof(char));
Syslog('+', "NameGen(%s)", FidoName);
setpwent();
while ((strcmp(sUserName, "") == 0 || (pw = getpwnam(sUserName)) != NULL) || (strlen(sUserName) < 3)) {
colour(12, 0);
printf("\n%s\n\n", (char *) Language(381));
colour(15, 0);
/* Please enter a login name (Maximum 8 characters) */
printf("\n%s\n", (char *) Language(383));
/* ie. John Doe, login = jdoe */
printf("%s\n", (char *) Language(384));
colour(10, 0);
/* login > */
printf("%s", (char *) Language(385));
fflush(stdout);
fflush(stdin);
GetstrU(sUserName, 7);
setpwent();
if (pw = getpwnam(tl(sUserName)), pw != NULL) {
/* That login name already exists, please choose another one. */
colour(12, 0);
printf("\n%s\n", (char *) Language(386));
setpwent();
}
}
return tl(sUserName);
}
/*
* Function will create the users name in the passwd file
*/
char *NameCreate(char *Name, char *Comment, char *Password)
{
char *PassEnt;
PassEnt = calloc(256, sizeof(char));
/*
* Call mbuseradd, this is a special setuid root program to create
* unix acounts and home directories.
*/
sprintf(PassEnt, "%s/bin/mbuseradd %d %s \"%s\" %s",
getenv("MBSE_ROOT"), getgid(), Name, Comment, CFG.bbs_usersdir);
Syslog('+', "%s", PassEnt);
fflush(stdout);
fflush(stdin);
if (system(PassEnt) != 0) {
WriteError("Failed to create unix account");
free(PassEnt);
ExitClient(1);
}
sprintf(PassEnt, "%s/bin/mbpasswd -f %s %s", getenv("MBSE_ROOT"), Name, Password);
Syslog('+', "%s/bin/mbpasswd -f %s ******", getenv("MBSE_ROOT"), Name);
if (system(PassEnt) != 0) {
WriteError("Failed to set unix password");
free(PassEnt);
ExitClient(1);
}
colour(14, 0);
/* Your "Unix Account" is created, you may use it the next time you call */
printf("\n%s\n", (char *) Language(382));
Syslog('+', "Created Unix account %s for %s", Name, Comment);
free(PassEnt);
return Name;
}
/*
* Function will check for unwanted user names
*/
int BadNames(char *Username)
{
FILE *fp;
short iFoundName = FALSE;
char *temp, *String, *User;
temp = calloc(PATH_MAX, sizeof(char));
String = calloc(81, sizeof(char));
User = calloc(81, sizeof(char));
strcpy(User, tl(Username));
sprintf(temp, "%s/etc/badnames.ctl", getenv("MBSE_ROOT"));
if(( fp = fopen(temp, "r")) != NULL) {
while((fgets(String, 80, fp)) != NULL) {
strcpy(String, tl(String));
Striplf(String);
if((strstr(User, String)) != NULL) {
printf("\nSorry that name is not acceptable on this system\n");
iFoundName = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(String);
free(User);
return iFoundName;
}
/*
* Function will Scan Users Database for existing phone numbers. If
* found, it will write a log entry to the logfile. The user WILL NOT
* be notified about the same numbers
*/
int TelephoneScan(char *Number, char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(81, sizeof(char));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( fp = fopen(temp,"rb")) != NULL) {
fread(&uhdr, sizeof(uhdr), 1, fp);
while (fread(&u, uhdr.recsize, 1, fp) == 1) {
if (strcasecmp(u.sUserName, Name) != 0)
if ((strlen(u.sVoicePhone) && (strcmp(u.sVoicePhone, Number) == 0)) ||
(strlen(u.sDataPhone) && (strcmp(u.sDataPhone, Number) == 0))) {
Status = TRUE;
Syslog('b', "Dupe phones ref: \"%s\" voice: \"%s\" data: \"%s\"",
Number, u.sVoicePhone, u.sDataPhone);
Syslog('+', "Uses the same telephone number as %s", u.sUserName);
}
}
fclose(fp);
}
free(temp);
return Status;
}

View File

@ -42,7 +42,6 @@
#include "../lib/msg.h"
#include "mail.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "file.h"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/timecheck.c
* $Id$
* Purpose ...............: Timecheck functions
* Last modification date : 28-May-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -37,11 +36,42 @@
#include "../lib/common.h"
#include "timecheck.h"
#include "funcs.h"
#include "funcs4.h"
#include "misc.h"
//#include "misc.h"
#include "bye.h"
#include "exitinfo.h"
#include "language.h"
#include "input.h"
extern pid_t mypid; /* Pid of this program */
/*
* Check for a personal message, this will go via mbsed. If there
* is a message, it will be displayed, else nothing happens.
*/
void Check_PM(void);
void Check_PM(void)
{
static char buf[128];
char resp[128];
sprintf(buf, "CIPM:1,%d;", mypid);
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) == 0)
return;
strcpy(resp, strtok(buf, ":"));
strcpy(resp, strtok(NULL, ","));
colour(CYAN, BLACK);
/* ** Message ** from */
printf("\n\n\007%s %s:\n", (char *)Language(434), strtok(NULL, ","));
printf("%s\n", strtok(NULL, ";"));
Pause();
}
}
/*

View File

@ -37,7 +37,6 @@
#include "../lib/msg.h"
#include "timeout.h"
#include "funcs.h"
#include "funcs4.h"
#include "bye.h"
#include "filesub.h"
#include "language.h"

91
mbsebbs/timestats.c Normal file
View File

@ -0,0 +1,91 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Time Statistics
*
*****************************************************************************
* 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 "timestats.h"
#include "funcs.h"
#include "language.h"
#include "input.h"
#include "exitinfo.h"
void TimeStats()
{
char Logdate[15];
time(&Time_Now);
l_date = localtime(&Time_Now);
sprintf(Logdate,"%02d-%s %02d:%02d:%02d", l_date->tm_mday, GetMonth(l_date->tm_mon+1),
l_date->tm_hour, l_date->tm_min, l_date->tm_sec);
clear();
ReadExitinfo();
colour(15, 0);
/* TIME STATISTICS for */
printf("\n%s%s ", (char *) Language(134), exitinfo.sUserName);
/* on */
printf("%s %s\n", (char *) Language(135), Logdate);
colour(12, 0);
fLine(79);
printf("\n");
colour(10, 0);
/* Current Time */
printf("%s %s\n", (char *) Language(136), (char *) GetLocalHMS());
/* Current Date */
printf("%s %s\n\n", (char *) Language(137), (char *) GLCdateyy());
/* Connect time */
printf("%s %d %s\n", (char *) Language(138), exitinfo.iConnectTime, (char *) Language(471));
/* Time used today */
printf("%s %d %s\n", (char *) Language(139), exitinfo.iTimeUsed, (char *) Language(471));
/* Time remaining today */
printf("%s %d %s\n", (char *) Language(140), exitinfo.iTimeLeft, (char *) Language(471));
/* Daily time limit */
printf("%s %d %s\n", (char *) Language(141), exitinfo.iTimeUsed + exitinfo.iTimeLeft, (char *) Language(471));
printf("\n");
Pause();
}

9
mbsebbs/timestats.h Normal file
View File

@ -0,0 +1,9 @@
/* $Id$ */
#ifndef _TIMESTATS_H
#define _TIMESTATS_H
void TimeStats(void); /* Get users Time Statistics */
#endif

View File

@ -39,7 +39,7 @@
#include "timeout.h"
#include "user.h"
#include "dispfile.h"
#include "funcs4.h"
#include "funcs.h"
#include "input.h"
#include "misc.h"
#include "bye.h"
@ -67,6 +67,59 @@ void SwapDate(char *, char *); /* Swap two Date strings around
void GetLastUser(void);
void GetLastUser(void)
{
FILE *pCallerLog;
char *sDataFile;
sDataFile = calloc(PATH_MAX, sizeof(char));
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
if((pCallerLog = fopen(sDataFile, "r+")) == NULL)
WriteError("GetLastUser: Can't open file: %s", sDataFile);
else {
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
/* Get lastcaller in memory */
strcpy(LastCaller, SYSINFO.LastCaller);
LastCallerTime = SYSINFO.LastTime;
/* Set next lastcaller (this user) */
if (!usrconfig.Hidden) {
strcpy(SYSINFO.LastCaller,exitinfo.sUserName);
SYSINFO.LastTime = time(NULL);
}
SYSINFO.SystemCalls++;
switch(ttyinfo.type) {
case POTS:
SYSINFO.Pots++;
break;
case ISDN:
SYSINFO.ISDN++;
break;
case NETWORK:
SYSINFO.Network++;
break;
case LOCAL:
SYSINFO.Local++;
break;
}
rewind(pCallerLog);
fwrite(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
fclose(pCallerLog);
}
free(sDataFile);
}
/*
* Function will take two date strings in the following format DD-MM-YYYY and
* swap them around in the following format YYYYMMDD
@ -343,7 +396,7 @@ void user()
}
/*
* Write users structure to tmp file in ~/tmp/.bbs-exitinfo.ttyxx
* Write users structure to tmp file in ~/home/unixname/exitinfo
* A copy of the userrecord is also in the variable exitinfo.
*/
if (! InitExitinfo())

154
mbsebbs/userlist.c Normal file
View File

@ -0,0 +1,154 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Display Userlist
*
*****************************************************************************
* 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 "userlist.h"
#include "language.h"
#include "input.h"
#include "timeout.h"
void UserList(char *OpData)
{
FILE *pUsrConfig;
int LineCount = 2;
int iFoundName = FALSE;
int iNameCount = 0;
char *Name, *sTemp, *User;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
Name = calloc(37, sizeof(char));
sTemp = calloc(81, sizeof(char));
User = calloc(81, sizeof(char));
clear();
/* User List */
language(WHITE, BLACK, 126);
Enter(1);
LineCount = 1;
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp, "rb")) == NULL) {
WriteError("UserList: Can't open file: %s", temp);
return;
}
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
/* Enter Username search string or (Enter) for all users: */
language(WHITE, BLACK, 127);
colour(CFG.InputColourF, CFG.InputColourB);
alarm_on();
GetstrC(Name, 35);
clear();
/* Name Location Last On Calls */
language(WHITE, BLACK, 128);
Enter(1);
colour(GREEN, BLACK);
fLine(79);
colour(CYAN, BLACK);
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) {
if ((strcmp(Name,"")) != 0) {
if((strcmp(OpData, "/H")) == 0)
sprintf(User, "%s", u.sHandle);
else
sprintf(User, "%s", u.sUserName);
if ((strstr(tl(User), tl(Name)) != NULL)) {
if ((!u.Hidden) && (!u.Deleted)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
}
}
} else
if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
Enter(1);
}
if (LineCount >= exitinfo.iScreenLen - 2) {
LineCount = 0;
Pause();
colour(CYAN, BLACK);
}
}
if(!iFoundName) {
language(CYAN, BLACK, 129);
Enter(1);
}
fclose(pUsrConfig);
colour(GREEN, BLACK);
fLine(79);
free(temp);
free(Name);
free(sTemp);
free(User);
Pause();
}

8
mbsebbs/userlist.h Normal file
View File

@ -0,0 +1,8 @@
/* $Id$ */
#ifndef _USERLIST_H
#define _USERLIST_H
void UserList(char *); /* Get complete users list */
#endif

View File

@ -34,14 +34,8 @@
#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"
@ -56,125 +50,115 @@ extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
*/
void WhosOn(char *OpData)
{
FILE *pExitinfo;
DIR *Directory;
char *Heading, *Underline, *temp, *tmp, *device;
struct dirent *Dir;
int i, x;
char buf[128], *Heading, *Underline, *cnt, *isdoing, *location, *device;
int i, x, Start = TRUE;
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);
colour(WHITE, BLACK);
/* Callers On-Line to */
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);
colour(LIGHTRED, BLACK);
Center(Underline);
printf("\n");
pout(10, 0, (char *) Language(415));
/* Name Device Status Location */
pout(LIGHTGREEN, BLACK, (char *) Language(415));
Enter(1);
colour(2, 0);
colour(GREEN, BLACK);
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);
while (TRUE) {
if (Start)
sprintf(buf, "GMON:1,1;");
else
sprintf(buf, "GMON:1,0;");
Start = FALSE;
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) == 0)
break; /* No more data */
if (strstr(buf, "mbsebbs")) {
cnt = strtok(buf, ",");
strtok(NULL, ",");
device = xstrcpy(strtok(NULL, ","));
/*
* We are only interested in copies of the mbsebbs program
*/
if ((strcmp(OpData, "/H")) == 0) {
/*
* The mbtask daemon has only the users real names, we
* want the handle instead.
*/
}
colour(LIGHTCYAN, BLACK);
printf("%-30s", strtok(NULL, ","));
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(LIGHTBLUE, BLACK);
printf("%-9s", device);
free(device);
strtok(NULL, ",");
location = xstrcpy(strtok(NULL, ","));
isdoing = xstrcpy(strtok(NULL, ","));
colour(9, 0);
if((device = strstr(Dir->d_name, "tty")) != NULL)
printf("%-9s", device);
else
printf("%-9s", "None");
colour(WHITE, BLACK);
if (strstr(isdoing, "Browsing"))
/* Browseng */
printf("%-15s", (char *) Language(418));
else if (strstr(isdoing, "Downloading"))
/* Downloading */
printf("%-15s", (char *) Language(419));
else if (strstr(isdoing, "Uploading"))
/* Uploading */
printf("%-15s", (char *) Language(420));
else if (strstr(isdoing, "Read"))
/* Msg Section */
printf("%-15s", (char *) Language(421));
else if (strstr(isdoing, "External"))
/* External Door */
printf("%-15s", (char *) Language(422));
else if (strstr(isdoing, "Chat"))
/* Chatting */
printf("%-15s", (char *) Language(423));
else if (strstr(isdoing, "Files"))
/* Listing Files */
printf("%-15s", (char *) Language(424));
else if (strstr(isdoing, "Time"))
/* Banking Door */
printf("%-15s", (char *) Language(426));
else if (strstr(isdoing, "Safe"))
/* Safe Door */
printf("%-15s", (char *) Language(427));
else if (strstr(isdoing, "Whoson"))
/* WhosOn List */
printf("%-15s", (char *) Language(428));
else if (strstr(isdoing, "Offline"))
/* Idle */
printf("%-15s", (char *) Language(429));
else
printf("System error ");
colour(15, 0);
colour(LIGHTRED, BLACK);
printf("%-25s\n", location);
free(location);
free(isdoing);
}
}
}
/* 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);
colour(GREEN, BLACK);
fLine(79);
free(tmp);
free(temp);
free(Underline);
free(Heading);