Lost of changes

This commit is contained in:
Michiel Broek 2004-01-25 10:57:35 +00:00
parent 1382701bd8
commit 5a0e317f23
41 changed files with 762 additions and 604 deletions

View File

@ -8,16 +8,33 @@ v0.39.7 14-Jan-2004
that mbtask didn't exist. It is possible that something is that mbtask didn't exist. It is possible that something is
broken now, please report such situations. broken now, please report such situations.
general:
In all sources replaced the usleep function with the msleep
function. The usleep function will become obsolete someday.
libcommon.a: libcommon.a:
In execute and execsh on Linux systems sync() is called before In execute and execsh on Linux systems sync() is called before
and after running the external program to make sure diskbuffers and after running the external program to make sure diskbuffers
are committed. are committed.
Added a milliseconds timer.
Before and after execute and execsh a 100 ms pause is inserted
to prevent (un)archiver and other errors.
mbcico: mbcico:
Removed the check to disable calling points. Removed the check to disable calling points.
Added a check to see if we get a URL to call other systems. Added a check to see if we get a URL to call other systems.
If nodelist info fails, increase error counter in steps of 10. If nodelist info fails, increase error counter in steps of 10.
Merged tmail patches from Przemyslaw Kwiatkowski. Merged tmail patches from Przemyslaw Kwiatkowski.
Fixed nodelocks during session handshake after many years. The
problem showed only when mbcico was used together with a mailer
on a different OS. When a aka is busy, the aka is now dropped.
When all akas are busy, a session is impossible and the session
is refused. Thanks to Przemyslaw Kwiatkowski for finding and
documenting this bug.
The total session avg cps is now corrected with the two seconds
session close delay time.
During binkp handshake increased the timer of the receiver to
avoid handshake timeouts.
mbfido: mbfido:
Removed sync calls that are now in execute. Removed sync calls that are now in execute.

4
TODO
View File

@ -121,7 +121,9 @@ mbcico:
U: Fix binkp file resume when mbcico silently dies. Check with the new U: Fix binkp file resume when mbcico silently dies. Check with the new
driver. driver.
U: Check node locking results for EMSI, YooHoo and FTS-0001 sessions. L: Implement binkp option ND.
L: Implement binkp zlib compression.
mbfile: mbfile:
L: Add a check to see if the magic filenames are (still) valid. L: Add a check to see if the magic filenames are (still) valid.

View File

@ -13,51 +13,58 @@
<LINK rel=stylesheet HREF="../manual.css"> <LINK rel=stylesheet HREF="../manual.css">
</HEAD> </HEAD>
<BODY> <BODY>
<PRE> <BLOCKQUOTE>
usleep.doc <div align='right'><h5>Last update 23-Jan-2004</h5></div>
<div align='center'><H1>System load and the usleep() call.</H1></div>
At some time when developping MBSE BBS I decided that background utilities At some time when developping MBSE BBS I decided that background utilities
did't need full speed to do their jobs. BBS utilities under DOS needed did't need full speed to do their jobs. BBS utilities under DOS needed
to run as fast as possible because you needed to bring the bbs down to run to run as fast as possible because you needed to bring the bbs down to run
these programs and users couldn't login during that time. these programs and users couldn't login during that time.
<p>
Starting with mball, the allfiles creator, I inserted code that does usleep(1) Starting with mball, the allfiles creator, I inserted code that does usleep(1)
after each 5 processed files. The 1 microsecond is not really the time the after each 5 processed files. The 1 microsecond is not really the time the
program pauses, it's probably a lot longer. I think this depends on the program pauses, it's probably a lot longer. I think this depends on the
hardware type, (Intel, Sparc, Alpha etc) how long GNU/Linux will really suspends hardware type, (Intel, Sparc, Alpha etc) how long GNU/Linux will really suspends
executing the utility. executing the utility.
<p>
The program speed downgrade at the development machine that mball needed was The program speed downgrade at the development machine that mball needed was
3 times the original exection time, while system loading stayed under 30%. 3 times the original exection time, while system loading stayed under 30%.
At that time the development machine is an 486DX2-66 with a Seagate ST32151N At that time the development machine is an 486DX2-66 with a Seagate ST32151N
SCSI harddisk. SCSI harddisk.
<p>
The extra usleep code is only active if you run these utils with the -quiet The extra usleep code is only active if you run these utils with the -quiet
switch and when this is set in mbsetup. See menu 1-&gt;5. switch and when this is set in mbsetup. See menu 1-&gt;5.
With this switch, the program is mostly run by cron. If you onmit With this switch, the program is mostly run by cron. If you onmit
this switch, this is probably when you start the program manually, it will this switch, this is probably when you start the program manually, it will
then always run at full speed, no matter what the setting in mbsetup is. then always run at full speed, no matter what the setting in mbsetup is.
<p>
If you have a fast system or don't care that the performance of your system If you have a fast system or don't care that the performance of your system
drops because of background processing, you can turn this future off with drops because of background processing, you can turn this future off with
mbsetup in the global section. (menu 1-&gt;5). mbsetup in the global section. (menu 1-&gt;5).
<p>
Remember, if you have a PII-400 MMX or so with IDE disks, you may still have Remember, if you have a PII-400 MMX or so with IDE disks, you may still have
performance problems and need to set that switch to yes. There is only one performance problems and need to set that switch to yes. There is only one
way to find out if you need it. way to find out if you need it.
<p>
Well, actually, I tested this on a Dell Latitude PII-266, setting the switch to Well, actually, I tested this on a Dell Latitude PII-266, setting the switch to
yes gave better performance then no. Why? The CPU has more time for the slow yes gave better performance then no. Why? The CPU has more time for the slow
IDE disk. With the slow switch on programs runs even faster then with the switch IDE disk. With the slow switch on programs runs even faster then with the switch
off. Modern hardware (PIII and later) may run fine with the slow switch turned
off. off.
<p>
In januari 2004 the usleep code is replaced by a milliseconds timer written
around the nanosleep system call. This call conforms to POSIX.1b and is written
so that if the timer is interrupted it will resume with the time left to do.
The real minimum time the timer runs is 10 ms on Intel systems, see also <b>man
nanosleep</b> All usleep(1) calls are now msleep(1) calls, in practice these are
pauses of 10 ms.
<P>
Michiel. Michiel.
<p>
</PRE>
<A HREF="index.htm"><IMG SRC="../images/b_arrow.png" ALT="Back" Border="0">Go Back</A> <A HREF="index.htm"><IMG SRC="../images/b_arrow.png" ALT="Back" Border="0">Go Back</A>
</BLOCKQUOTE>
</BODY> </BODY>
</HTML> </HTML>

View File

@ -40,7 +40,7 @@ OBJS = ${CLCOMM_OBJS} ${COMMON_OBJS} ${DBASE_OBJS} ${MSGBASE_OBJS} ${MBINET_OBJ
${DIESEL_OBJS} ${NODELIST_OBJS} ${DIESEL_OBJS} ${NODELIST_OBJS}
HDRS = ${CLCOMM_HDRS} ${COMMON_HDRS} ${DBASE_HDRS} ${MSGBASE_HDRS} ${MBINET_HDRS} \ HDRS = ${CLCOMM_HDRS} ${COMMON_HDRS} ${DBASE_HDRS} ${MSGBASE_HDRS} ${MBINET_HDRS} \
${DIESEL_HDRS} ${NODELIST_HDRS} ${OTHER_HDRS} ${DIESEL_HDRS} ${NODELIST_HDRS} ${OTHER_HDRS}
OTHER = Makefile README ftscprod.007 mkprod.awk \ OTHER = Makefile README ftscprod.008 mkprod.awk \
README.diesel README.macro Diesel.doc nodelist.conf README.diesel README.macro Diesel.doc nodelist.conf
TARGET = libclcomm.a libcommon.a libdbase.a libmsgbase.a libmbinet.a libdiesel.a \ TARGET = libclcomm.a libcommon.a libdbase.a libmsgbase.a libmbinet.a libdiesel.a \
libnodelist.a libnodelist.a
@ -137,7 +137,7 @@ proglock.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/rec
dostran.o: ../config.h libs.h structs.h users.h records.h common.h dostran.o: ../config.h libs.h structs.h users.h records.h common.h
ftnmsg.o: ../config.h libs.h structs.h common.h clcomm.h ftnmsg.o: ../config.h libs.h structs.h common.h clcomm.h
mbfile.o: ../config.h libs.h structs.h clcomm.h common.h mbfile.o: ../config.h libs.h structs.h clcomm.h common.h
nodelock.o: ../config.h libs.h structs.h clcomm.h common.h nodelock.o: ../config.h libs.h structs.h users.h records.h clcomm.h common.h
rawio.o: ../config.h libs.h structs.h common.h mberrors.h rawio.o: ../config.h libs.h structs.h common.h mberrors.h
strcasestr.o: ../config.h libs.h strcasestr.o: ../config.h libs.h
execute.o: ../config.h libs.h structs.h clcomm.h mberrors.h common.h execute.o: ../config.h libs.h structs.h clcomm.h mberrors.h common.h
@ -160,7 +160,7 @@ dbmsgs.o: ../config.h libs.h structs.h users.h records.h clcomm.h dbcfg.h dbmsgs
dbnode.o: ../config.h libs.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h dbnode.o: ../config.h libs.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h
dbtic.o: ../config.h libs.h structs.h users.h records.h clcomm.h dbcfg.h dbtic.h dbtic.o: ../config.h libs.h structs.h users.h records.h clcomm.h dbcfg.h dbtic.h
dbuser.o: ../config.h libs.h structs.h users.h records.h dbcfg.h dbuser.h dbuser.o: ../config.h libs.h structs.h users.h records.h dbcfg.h dbuser.h
jammsg.o: ../config.h libs.h clcomm.h msgtext.h msg.h jam.h jammsg.h jammsg.o: ../config.h libs.h clcomm.h msgtext.h structs.h common.h msg.h jam.h jammsg.h
msg.o: ../config.h libs.h msgtext.h msg.h clcomm.h structs.h common.h jammsg.h msg.o: ../config.h libs.h msgtext.h msg.h clcomm.h structs.h common.h jammsg.h
msgtext.o: ../config.h libs.h msgtext.h msg.h msgtext.o: ../config.h libs.h msgtext.h msg.h
nntp.o: ../config.h libs.h structs.h users.h records.h clcomm.h mbinet.h nntp.o: ../config.h libs.h structs.h users.h records.h clcomm.h mbinet.h

View File

@ -512,6 +512,8 @@ void gpt_resettimers(void); /* Reset all timers */
int gpt_settimer(int, int); /* Set timer no to time */ int gpt_settimer(int, int); /* Set timer no to time */
int gpt_expired(int); /* Is timer expired */ int gpt_expired(int); /* Is timer expired */
int gpt_running(int); /* Is timer running */ int gpt_running(int); /* Is timer running */
int msleep(int); /* Milliseconds timer */
#endif #endif

View File

@ -140,7 +140,9 @@ int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
#ifdef __linux__ #ifdef __linux__
sync(); sync();
#endif #endif
msleep(100);
rc = _execute(cmd, file, pkt, in, out, err); rc = _execute(cmd, file, pkt, in, out, err);
msleep(100);
#ifdef __linux #ifdef __linux
sync(); sync();
#endif #endif
@ -215,7 +217,9 @@ int execsh(char *cmd, char *in, char *out, char *err)
#ifdef __linux__ #ifdef __linux__
sync(); sync();
#endif #endif
msleep(100);
rc = _execsh(cmd, in, out, err); rc = _execsh(cmd, in, out, err);
msleep(100);
#ifdef __linux__ #ifdef __linux__
sync(); sync();
#endif #endif

View File

@ -10,7 +10,7 @@
* MBSE BBS and utilities. * MBSE BBS and utilities.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -38,10 +38,13 @@
#include "libs.h" #include "libs.h"
#include "clcomm.h" #include "clcomm.h"
#include "msgtext.h" #include "msgtext.h"
#include "structs.h"
#include "common.h"
#include "msg.h" #include "msg.h"
#include "jam.h" #include "jam.h"
#include "jammsg.h" #include "jammsg.h"
#define MAX_TEXT 2048 #define MAX_TEXT 2048
int fdHdr = -1; int fdHdr = -1;
@ -400,7 +403,7 @@ int JAM_Lock(unsigned long ulTimeout)
WriteError("JAM messagebase is locked by pid %d", fl.l_pid); WriteError("JAM messagebase is locked by pid %d", fl.l_pid);
return FALSE; return FALSE;
} }
usleep(250000); msleep(250);
Syslog('m', "JAM messagebase lock attempt %d", Tries); Syslog('m', "JAM messagebase lock attempt %d", Tries);
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Basic File I/O * Purpose ...............: Basic File I/O
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -193,8 +193,6 @@ long file_crc(char *path, int slow)
do { do {
bread = fread(line, 1, 32768, fp); bread = fread(line, 1, 32768, fp);
crc = upd_crc32(line, crc, bread); crc = upd_crc32(line, crc, bread);
if (slow)
usleep(1);
Nopper(); // For large files on slow systems. Nopper(); // For large files on slow systems.
} while (bread > 0); } while (bread > 0);

View File

@ -381,7 +381,7 @@ int Msg_Link(char *Path, int do_quiet, int slow_util)
i++; i++;
if (slow_util && do_quiet && ((i % 5) == 0)) if (slow_util && do_quiet && ((i % 5) == 0))
usleep(1); msleep(1);
if (((i % 10) == 0) && (!do_quiet)) { if (((i % 10) == 0) && (!do_quiet)) {
printf("%6d / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", i, Total); printf("%6d / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", i, Total);
@ -414,7 +414,7 @@ int Msg_Link(char *Path, int do_quiet, int slow_util)
} }
if (slow_util && do_quiet && ((i % 5) == 0)) if (slow_util && do_quiet && ((i % 5) == 0))
usleep(1); msleep(1);
if (((i % 10) == 0) && (!do_quiet)) { if (((i % 10) == 0) && (!do_quiet)) {
printf("%6d / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", i, Total); printf("%6d / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", i, Total);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Raw I/O routines. * Purpose ...............: Raw I/O routines.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -238,7 +238,7 @@ int Waitchar(unsigned char *ch, int wtime)
rc = read(ttyfd, ch, 1); rc = read(ttyfd, ch, 1);
if (rc == 1) if (rc == 1)
return rc; return rc;
usleep(10000); msleep(10);
} }
return rc; return rc;
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: General Purpose Timers * Purpose ...............: General Purpose Timers
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -127,3 +127,40 @@ int gpt_running(int tno)
} }
/*
* Milliseconds timer, returns 0 on success.
*/
int msleep(int msecs)
{
int rc;
struct timespec req, rem;
rem.tv_sec = 0;
rem.tv_nsec = 0;
req.tv_sec = msecs / 1000;
req.tv_nsec = (msecs % 1000) * 1000000;
while (TRUE) {
rc = nanosleep(&req, &rem);
if (rc == 0)
break;
if ((errno == EINVAL) || (errno == EFAULT)) {
WriteError("$msleep(%d)", msecs);
break;
}
/*
* Error was EINTR, run timer again to complete.
*/
req.tv_sec = rem.tv_sec;
req.tv_nsec = rem.tv_nsec;
rem.tv_sec = 0;
rem.tv_nsec = 0;
}
return rc;
}

View File

@ -306,7 +306,7 @@ SM_NAMES
SM_EDECL SM_EDECL
faddr *primary; faddr *primary;
char *p, *q, *pwd; char *p, *q, *pwd;
int i, rc = 0, bufl, cmd, dupe, SendPass = FALSE; int i, rc = 0, bufl, cmd, dupe, SendPass = FALSE, akas = 0;
fa_list **tmp, *tmpa; fa_list **tmp, *tmpa;
faddr *fa, ra; faddr *fa, ra;
@ -409,22 +409,35 @@ SM_STATE(WaitAddr)
} }
} }
free(p); free(p);
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f)); tmp = &remote;
if (nodelock(tmpa->addr, mypid)) { while (*tmp) {
binkp_send_command(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f)); if (nodelock((*tmp)->addr, mypid)) {
SM_ERROR; Syslog('+', "address : %s is locked, removed from aka list",ascfnode((*tmp)->addr,0x1f));
} tmpa=*tmp;
/* *tmp=(*tmp)->next;
* With the loaded flag we prevent removing the noderecord free(tmpa);
* when the remote presents us an address we don't know about. } else {
*/ /*
if (!Loaded) { * With the loaded flag we prevent removing the noderecord
if (noderecord(tmpa->addr)) * when the remote presents us an address we don't know about.
Loaded = TRUE; */
akas++;
Syslog('+', "address : %s",ascfnode((*tmp)->addr,0x1f));
if (!Loaded) {
if (noderecord((*tmp)->addr))
Loaded = TRUE;
}
tmp = &((*tmp)->next);
} }
} }
if (akas == 0) {
binkp_send_command(MM_BSY, "All aka's busy");
Syslog('+', "Binkp: abort, all aka's are busy");
SM_ERROR;
}
history.aka.zone = remote->addr->zone; history.aka.zone = remote->addr->zone;
history.aka.net = remote->addr->net; history.aka.net = remote->addr->net;
history.aka.node = remote->addr->node; history.aka.node = remote->addr->node;
@ -578,7 +591,7 @@ SM_NAMES
(char *)"Opts" (char *)"Opts"
SM_EDECL SM_EDECL
char *p, *q, *pw; char *p, *q, *pw;
int i, rc, bufl, cmd, dupe, we_have_pwd = FALSE; int i, rc, bufl, cmd, dupe, we_have_pwd = FALSE, akas = 0;
fa_list **tmp, *tmpa; fa_list **tmp, *tmpa;
faddr *fa; faddr *fa;
@ -667,22 +680,34 @@ SM_STATE(WaitAddr)
} }
} }
for (tmpa = remote; tmpa; tmpa = tmpa->next) { tmp = &remote;
Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f)); while (*tmp) {
if (nodelock(tmpa->addr, mypid)) { if (nodelock((*tmp)->addr, mypid)) {
binkp_send_command(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f)); Syslog('+', "address : %s is locked, removed from aka list",ascfnode((*tmp)->addr,0x1f));
SM_ERROR; tmpa=*tmp;
} *tmp=(*tmp)->next;
/* free(tmpa);
* With the loaded flag we prevent removing the noderecord } else {
* when the remote presents us an address we don't know about. /*
*/ * With the loaded flag we prevent removing the noderecord
if (!Loaded) { * when the remote presents us an address we don't know about.
if (noderecord(tmpa->addr)) */
Loaded = TRUE; akas++;
Syslog('+', "address : %s",ascfnode((*tmp)->addr,0x1f));
if (!Loaded) {
if (noderecord((*tmp)->addr))
Loaded = TRUE;
}
tmp = &((*tmp)->next);
} }
} }
if (akas == 0) {
binkp_send_command(MM_BSY, "All aka's busy");
Syslog('+', "Binkp: abort, all aka's are busy");
SM_ERROR;
}
for (tmpa = remote; tmpa; tmpa = tmpa->next) { for (tmpa = remote; tmpa; tmpa = tmpa->next) {
if (((nlent = getnlent(tmpa->addr))) && (nlent->pflag != NL_DUMMY)) { if (((nlent = getnlent(tmpa->addr))) && (nlent->pflag != NL_DUMMY)) {
Syslog('+', "Binkp: remote is a listed system"); Syslog('+', "Binkp: remote is a listed system");
@ -874,7 +899,7 @@ int file_transfer(void)
* Nothing done, release * Nothing done, release
*/ */
Syslog('b', "Binkp: NOTHING DONE"); Syslog('b', "Binkp: NOTHING DONE");
usleep(1); msleep(1);
break; break;
case Receive: Trc = binkp_receiver(); case Receive: Trc = binkp_receiver();
@ -1626,7 +1651,7 @@ int binkp_recv_command(char *buf, int *len, int *cmd)
if (b0 & 0x80) if (b0 & 0x80)
*cmd = 1; *cmd = 1;
b1 = GETCHAR(1); b1 = GETCHAR(BINKP_TIMEOUT / 2);
if (tty_status) if (tty_status)
goto to; goto to;
@ -1725,7 +1750,7 @@ int binkp_poll_frame(void)
if (c < 0) { if (c < 0) {
c = -c; c = -c;
if (c == STAT_TIMEOUT) { if (c == STAT_TIMEOUT) {
usleep(1); msleep(1);
rc = 0; rc = 0;
break; break;
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer - modem chat * Purpose ...............: Fidonet mailer - modem chat
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -104,7 +104,7 @@ int send_str(char *str, char *Phone)
case 's': PUTCHAR(' '); *q++ = ' '; break; case 's': PUTCHAR(' '); *q++ = ' '; break;
case ' ': PUTCHAR(' '); *q++ = ' '; break; case ' ': PUTCHAR(' '); *q++ = ' '; break;
case 'd': sleep(1); *q++ = '\\'; *q++ = 'd'; break; case 'd': sleep(1); *q++ = '\\'; *q++ = 'd'; break;
case 'p': usleep(250000L); *q++ = '\\'; *q++ = 'p'; break; case 'p': msleep(250); *q++ = '\\'; *q++ = 'p'; break;
case 'D': if (Phone) { case 'D': if (Phone) {
PUTSTR(Phone); PUTSTR(Phone);
sprintf(q, "%s", Phone); sprintf(q, "%s", Phone);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer * Purpose ...............: Fidonet mailer
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -70,7 +70,7 @@ int emsi_remote_opts;
char *emsi_local_password = NULL; char *emsi_local_password = NULL;
char *emsi_remote_password = NULL; char *emsi_remote_password = NULL;
char emsi_remote_comm[4]="8N1"; char emsi_remote_comm[4]="8N1";
int emsi_akas = 0;
int rx_emsi(char *data) int rx_emsi(char *data)
@ -448,6 +448,10 @@ SM_STATE(checkdat)
Syslog('+', "Got EMSI_DAT packet \"%s\" with bad crc: %04x/%04x", printable(databuf, 0), lcrc, rcrc); Syslog('+', "Got EMSI_DAT packet \"%s\" with bad crc: %04x/%04x", printable(databuf, 0), lcrc, rcrc);
SM_PROCEED(sendnak); SM_PROCEED(sendnak);
} if (scanemsidat(databuf + 12) == 0) { } if (scanemsidat(databuf + 12) == 0) {
if (emsi_akas == 0) {
Syslog('+', "All akas busy, abort");
SM_ERROR;
}
SM_PROCEED(sendack); SM_PROCEED(sendack);
} else { } else {
Syslog('+', "Could not parse EMSI_DAT packet \"%s\"",databuf); Syslog('+', "Could not parse EMSI_DAT packet \"%s\"",databuf);

View File

@ -47,6 +47,7 @@
extern int Loaded; extern int Loaded;
extern int mypid; extern int mypid;
extern int emsi_akas;
@ -334,7 +335,7 @@ exit:
int scanemsidat(char *buf) int scanemsidat(char *buf)
{ {
fa_list **tmp,*tmpa; fa_list **tmp, *tmpa;
faddr *fa; faddr *fa;
char *p, *q, *mailer_prod, *mailer_name, *mailer_version, *mailer_serial; char *p, *q, *mailer_prod, *mailer_name, *mailer_version, *mailer_serial;
int dupe; int dupe;
@ -375,24 +376,35 @@ int scanemsidat(char *buf)
} }
} }
for (tmpa = remote; tmpa; tmpa = tmpa->next) { tmp = &remote;
Syslog('+', "address : %s",ascfnode(tmpa->addr,0x1f)); while (*tmp) {
(void)nodelock(tmpa->addr, mypid); if (nodelock((*tmp)->addr, mypid)) {
/* Syslog('+', "address : %s is locked, removed from aka list",ascfnode((*tmp)->addr,0x1f));
* With the loaded flag we prevent removing the noderecord tmpa=*tmp;
* when the remote presents us an address we don't know about. *tmp=(*tmp)->next;
*/ free(tmpa);
if (!Loaded) { } else {
if (noderecord(tmpa->addr)) /*
Loaded = TRUE; * With the loaded flag we prevent removing the noderecord
* when the remote presents us an address we don't know about.
*/
emsi_akas++;
Syslog('+', "address : %s",ascfnode((*tmp)->addr,0x1f));
if (!Loaded) {
if (noderecord((*tmp)->addr))
Loaded = TRUE;
}
tmp = &((*tmp)->next);
} }
} }
history.aka.zone = remote->addr->zone; if (emsi_akas) { /* Only if any aka's left */
history.aka.net = remote->addr->net; history.aka.zone = remote->addr->zone;
history.aka.node = remote->addr->node; history.aka.net = remote->addr->net;
history.aka.point = remote->addr->point; history.aka.node = remote->addr->node;
sprintf(history.aka.domain, "%s", remote->addr->domain); history.aka.point = remote->addr->point;
sprintf(history.aka.domain, "%s", remote->addr->domain);
}
if (emsi_remote_password) if (emsi_remote_password)
free(emsi_remote_password); free(emsi_remote_password);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer * Purpose ...............: Fidonet mailer
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -116,95 +116,89 @@ int tx_ftsc(void)
SM_DECL(txftsc,(char *)"txftsc") SM_DECL(txftsc,(char *)"txftsc")
SM_STATES SM_STATES
wait_command, wait_command,
recv_mail, recv_mail,
send_req, send_req,
recv_req recv_req
SM_NAMES SM_NAMES
(char *)"wait_command", (char *)"wait_command",
(char *)"recv_mail", (char *)"recv_mail",
(char *)"send_req", (char *)"send_req",
(char *)"recv_req" (char *)"recv_req"
SM_EDECL SM_EDECL
int c,rc; int c,rc, mailsent = FALSE, mailrcvd = FALSE;
char *nonhold_mail; char *nonhold_mail;
int mailsent = FALSE, mailrcvd = FALSE;
nonhold_mail = (char *)ALL_MAIL; nonhold_mail = (char *)ALL_MAIL;
tosend = create_filelist(remote,nonhold_mail,2); tosend = create_filelist(remote,nonhold_mail,2);
Syslog('s', "txftsc SEND_MAIL"); if ((rc = xmsndfiles(tosend)))
if ((rc = xmsndfiles(tosend))) return rc;
return rc; mailsent = TRUE;
mailsent = TRUE;
SM_START(wait_command) SM_START(wait_command)
SM_STATE(wait_command) SM_STATE(wait_command)
Syslog('s', "txftsc WAIT_COMMAND"); c = GETCHAR(30);
c = GETCHAR(30); if (c == TIMEOUT) {
if (c == TIMEOUT) { Syslog('+', "timeout waiting for remote action, try receive");
Syslog('+', "timeout waiting for remote action, try receive"); SM_PROCEED(recv_mail);
SM_PROCEED(recv_mail); } else if (c < 0) {
} else if (c < 0) { if (mailrcvd && mailsent) {
if (mailrcvd && mailsent) { /*
/* * Some systems hangup after sending mail, so if we did
* Some systems hangup after sending mail, so if we did * send and receive mail we consider the session OK.
* send and receive mail we consider the session OK. */
*/ Syslog('+', "Lost carrier, FTS-0001 session looks complete");
Syslog('+', "Lost carrier, FTS-0001 session looks complete"); SM_SUCCESS;
SM_SUCCESS; } else {
} else { Syslog('+', "got error waiting for TSYNC: received %d",c);
Syslog('+', "got error waiting for TSYNC: received %d",c); SM_ERROR;
SM_ERROR;
}
} else switch (c) {
case TSYNC: SM_PROCEED(recv_mail);
break;
case SYN: SM_PROCEED(recv_req);
break;
case ENQ: SM_PROCEED(send_req);
break;
case 'C':
case NAK: PUTCHAR(EOT);
SM_PROCEED(wait_command);
break;
case CAN: SM_SUCCESS; /* this is not in BT */
break;
default: Syslog('s', "got '%s' waiting command", printablec(c));
PUTCHAR(SUB);
SM_PROCEED(wait_command);
break;
} }
} else switch (c) {
case TSYNC: SM_PROCEED(recv_mail);
break;
case SYN: SM_PROCEED(recv_req);
break;
case ENQ: SM_PROCEED(send_req);
break;
case 'C':
case NAK: PUTCHAR(EOT);
SM_PROCEED(wait_command);
break;
case CAN: SM_SUCCESS; /* this is not in BT */
break;
default: Syslog('s', "got '%s' waiting command", printablec(c));
PUTCHAR(SUB);
SM_PROCEED(wait_command);
break;
}
SM_STATE(recv_mail) SM_STATE(recv_mail)
Syslog('s', "txftsc RECV_MAIL"); if (recvfiles()) {
if (recvfiles()) { SM_ERROR;
SM_ERROR; } else {
} else { mailrcvd = TRUE;
mailrcvd = TRUE; SM_PROCEED(wait_command);
SM_PROCEED(wait_command); }
}
SM_STATE(send_req) SM_STATE(send_req)
Syslog('s', "txftsc SEND_BARK"); if (sendbark()) {
if (sendbark()) { SM_ERROR;
SM_ERROR; } else {
} else { SM_SUCCESS;
SM_SUCCESS; }
}
SM_STATE(recv_req) SM_STATE(recv_req)
Syslog('s', "txftsc RECV_BARK"); if (recvbark()) {
if (recvbark()) { SM_ERROR;
SM_ERROR; } else {
} else { SM_PROCEED(wait_command);
SM_PROCEED(wait_command); }
}
SM_END SM_END
SM_RETURN SM_RETURN
@ -213,148 +207,145 @@ SM_RETURN
SM_DECL(rxftsc,(char *)"rxftsc") SM_DECL(rxftsc,(char *)"rxftsc")
SM_STATES SM_STATES
recv_mail, recv_mail,
send_mail, send_mail,
send_req, send_req,
recv_req recv_req
SM_NAMES SM_NAMES
(char *)"recv_mail", (char *)"recv_mail",
(char *)"send_mail", (char *)"send_mail",
(char *)"send_req", (char *)"send_req",
(char *)"recv_req" (char *)"recv_req"
SM_EDECL SM_EDECL
int c, count = 0, didwazoo = FALSE; int c, count = 0, didwazoo = FALSE, sentmail = FALSE, rcvdmail = FALSE;
int sentmail = FALSE, rcvdmail = FALSE; file_list *request = NULL, *tmpfl;
file_list *request = NULL, *tmpfl;
SM_START(recv_mail) SM_START(recv_mail)
SM_STATE(recv_mail) SM_STATE(recv_mail)
Syslog('s', "rxftsc RECV_MAIL"); if (recvfiles()) {
if (recvfiles()) { SM_ERROR;
SM_ERROR; } else {
} else { rcvdmail = TRUE;
rcvdmail = TRUE; SM_PROCEED(send_mail);
SM_PROCEED(send_mail); }
}
SM_STATE(send_mail) SM_STATE(send_mail)
Syslog('s', "rxftsc SEND_MAIL count=%d", count); Syslog('x', "rxftsc SEND_MAIL count=%d", count);
if (count++ > 45) { if (count++ > 45) {
SM_ERROR; SM_ERROR;
} }
/* /*
* If we got a wazoo request, add files now. * If we got a wazoo request, add files now.
*/ */
request = respond_wazoo(); request = respond_wazoo();
if (request != NULL) { if (request != NULL) {
didwazoo = TRUE; didwazoo = TRUE;
tmpfl = tosend; tmpfl = tosend;
tosend = request; tosend = request;
for (; request->next; request = request->next); for (; request->next; request = request->next);
request->next = tmpfl; request->next = tmpfl;
request = NULL; request = NULL;
} }
if (tosend == NULL) { if (tosend == NULL) {
count = 0; count = 0;
SM_PROCEED(send_req); SM_PROCEED(send_req);
} }
PUTCHAR(TSYNC); PUTCHAR(TSYNC);
c = GETCHAR(1); c = GETCHAR(1);
Syslog('x', "Got char 0x%02x", c); Syslog('x', "Got char 0x%02x", c);
if (c == TIMEOUT) { if (c == TIMEOUT) {
Syslog('x', " timeout"); Syslog('x', " timeout");
SM_PROCEED(send_mail); SM_PROCEED(send_mail);
} else if (c < 0) { } else if (c < 0) {
Syslog('+', "got error waiting for NAK: received %d",c); Syslog('+', "got error waiting for NAK: received %d",c);
SM_ERROR; SM_ERROR;
} else switch (c) { } else switch (c) {
case 'C': case 'C':
case NAK: if (xmsndfiles(tosend)) { case NAK: if (xmsndfiles(tosend)) {
SM_ERROR; SM_ERROR;
} else { } else {
sentmail = TRUE; sentmail = TRUE;
count = 0; count = 0;
SM_PROCEED(send_req); SM_PROCEED(send_req);
} }
break; break;
case CAN: Syslog('+', "Remote refused to pickup mail"); case CAN: Syslog('+', "Remote refused to pickup mail");
SM_SUCCESS; SM_SUCCESS;
break; break;
case EOT: PUTCHAR(ACK); case EOT: PUTCHAR(ACK);
SM_PROCEED(send_mail); SM_PROCEED(send_mail);
break; break;
default: Syslog('s', "Got '%s' waiting NAK", printablec(c)); default: Syslog('s', "Got '%s' waiting NAK", printablec(c));
SM_PROCEED(send_mail); SM_PROCEED(send_mail);
break; break;
} }
SM_STATE(send_req) SM_STATE(send_req)
Syslog('s', "rxftsc SEND_REQ count=%d", count); Syslog('x', "rxftsc SEND_REQ count=%d", count);
if (didwazoo) { if (didwazoo) {
SM_SUCCESS; SM_SUCCESS;
} }
if (count > 15) { if (count > 15) {
SM_ERROR; SM_ERROR;
} }
if (!made_request) { if (!made_request) {
SM_PROCEED(recv_req); SM_PROCEED(recv_req);
} }
PUTCHAR(SYN); PUTCHAR(SYN);
c = GETCHAR(5); c = GETCHAR(5);
Syslog('x', "Got char 0x%02x", c); Syslog('x', "Got char 0x%02x", c);
count++; count++;
if (c == TIMEOUT) { if (c == TIMEOUT) {
Syslog('x', " timeout"); Syslog('x', " timeout");
SM_PROCEED(send_req); SM_PROCEED(send_req);
} else if (c < 0) { } else if (c < 0) {
Syslog('+', "got error waiting for ENQ: received %d",c); Syslog('+', "got error waiting for ENQ: received %d",c);
SM_ERROR; SM_ERROR;
} else switch (c) { } else switch (c) {
case ENQ: if (sendbark()) { case ENQ: if (sendbark()) {
SM_ERROR; SM_ERROR;
} else { } else {
SM_PROCEED(recv_req); SM_PROCEED(recv_req);
} }
break; break;
case CAN: Syslog('+', "Remote refused to accept request"); case CAN: Syslog('+', "Remote refused to accept request");
SM_PROCEED(recv_req); SM_PROCEED(recv_req);
break; break;
case 'C': case 'C':
case NAK: PUTCHAR(EOT); case NAK: PUTCHAR(EOT);
SM_PROCEED(send_req); SM_PROCEED(send_req);
break; break;
case SUB: SM_PROCEED(send_req); case SUB: SM_PROCEED(send_req);
break; break;
default: Syslog('s', "got '%s' waiting ENQ", printablec(c)); default: Syslog('s', "got '%s' waiting ENQ", printablec(c));
SM_PROCEED(send_req); SM_PROCEED(send_req);
break; break;
} }
SM_STATE(recv_req) SM_STATE(recv_req)
Syslog('s', "rxftsc RECV_REQ"); if (recvbark()) {
if (recvbark()) { if (sentmail && rcvdmail) {
if (sentmail && rcvdmail) { Syslog('+', "Consider session OK");
Syslog('+', "Consider session OK"); SM_SUCCESS;
SM_SUCCESS;
} else {
SM_ERROR;
}
} else { } else {
SM_SUCCESS; SM_ERROR;
} }
} else {
SM_SUCCESS;
}
SM_END SM_END
SM_RETURN SM_RETURN
@ -420,8 +411,18 @@ SM_STATE(scan_packet)
free(fpath); free(fpath);
SM_ERROR; SM_ERROR;
case 0: case 0:
case 5: Syslog('+', "accepting session"); case 5: fclose(fp);
fclose(fp); if (nodelock(&f, mypid)) {
/*
* Lock failed, FTSC-0001 allowes only one aka, so abort session.
*/
Syslog('+', "address : %s is locked, abort", ascfnode(&f, 0x1f));
Syslog('s', "Unlink %s rc=%d", fpath, unlink(fpath));
free(fpath);
SM_ERROR;
}
Syslog('+', "accepting session");
for (tmpl = &remote; *tmpl; tmpl = &((*tmpl)->next)); for (tmpl = &remote; *tmpl; tmpl = &((*tmpl)->next));
(*tmpl)=(fa_list*)malloc(sizeof(fa_list)); (*tmpl)=(fa_list*)malloc(sizeof(fa_list));
(*tmpl)->next=NULL; (*tmpl)->next=NULL;
@ -432,12 +433,15 @@ SM_STATE(scan_packet)
(*tmpl)->addr->point=f.point; (*tmpl)->addr->point=f.point;
(*tmpl)->addr->name=NULL; (*tmpl)->addr->name=NULL;
(*tmpl)->addr->domain=NULL; (*tmpl)->addr->domain=NULL;
for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next)) { Syslog('+', "address : %s",ascfnode((*tmpl)->addr,0x1f));
(void)nodelock((*tmpl)->addr, mypid);
/* try lock all remotes, ignore locking result */ /*
if (!Loaded) * With the loaded flag we prevent removing the noderecord
if (noderecord((*tmpl)->addr)) * when the remote presents us an address we don't know about.
Loaded = TRUE; */
if (!Loaded) {
if (noderecord((*tmpl)->addr))
Loaded = TRUE;
} }
history.aka.zone = remote->addr->zone; history.aka.zone = remote->addr->zone;

View File

@ -126,8 +126,8 @@ void die(int onsig)
} }
if (sentbytes || rcvdbytes) { if (sentbytes || rcvdbytes) {
total = (int)(c_end - c_start); total = (int)(c_end - c_start -2);
if (!total) if (total < 1)
total = 1; total = 1;
Syslog('+', "Sent %lu bytes, received %lu bytes, avg %d cps", sentbytes, rcvdbytes, (sentbytes + rcvdbytes) / total); Syslog('+', "Sent %lu bytes, received %lu bytes, avg %d cps", sentbytes, rcvdbytes, (sentbytes + rcvdbytes) / total);
} }

View File

@ -19,7 +19,7 @@ int proc(void)\
#define SM_START(x) \ #define SM_START(x) \
sm_state=x;\ sm_state=x;\
Syslog('S', "SM (%s): Start => %s", sm_name, sm_sname[sm_state]); \ Syslog('s', "SM (%s): Start => %s", sm_name, sm_sname[sm_state]); \
while (!sm_success) switch (sm_state)\ while (!sm_success) switch (sm_state)\
{\ {\
default: WriteError("Statemachine %s error: state=%d",sm_name,sm_state);\ default: WriteError("Statemachine %s error: state=%d",sm_name,sm_state);\
@ -38,16 +38,16 @@ int proc(void)\
#define SM_PROCEED(x) \ #define SM_PROCEED(x) \
if (x != sm_state) {\ if (x != sm_state) {\
Syslog('S', "SM (%s): %s => %s", sm_name, sm_sname[sm_state], sm_sname[x]);\ Syslog('s', "SM (%s): %s => %s", sm_name, sm_sname[sm_state], sm_sname[x]);\
}\ }\
sm_state=x; break; sm_state=x; break;
#define SM_SUCCESS \ #define SM_SUCCESS \
Syslog('S', "SM (%s): %s => Success", sm_name, sm_sname[sm_state]);\ Syslog('s', "SM (%s): %s => Success", sm_name, sm_sname[sm_state]);\
sm_success=1; break; sm_success=1; break;
#define SM_ERROR \ #define SM_ERROR \
Syslog('S', "SM (%s): %s => Error", sm_name, sm_sname[sm_state]);\ Syslog('s', "SM (%s): %s => Error", sm_name, sm_sname[sm_state]);\
sm_success=-1; break; sm_success=-1; break;
#endif #endif

View File

@ -87,7 +87,9 @@ static int txyoohoo(void);
static void fillhello(unsigned short,char*); static void fillhello(unsigned short,char*);
static int checkhello(void); static int checkhello(void);
static int iscaller; static int y_akas;
static int iscaller;
static struct _hello { static struct _hello {
unsigned char data[128]; unsigned char data[128];
unsigned char crc[2]; unsigned char crc[2];
@ -129,6 +131,7 @@ int rx_yoohoo(void)
char *pwd = NULL; char *pwd = NULL;
pwd = NULL; pwd = NULL;
y_akas = 0;
localcaps = LOCALCAPS; localcaps = LOCALCAPS;
if (localoptions & NOZMODEM) localcaps &= ~(ZED_ZAPPER|ZED_ZIPPER); if (localoptions & NOZMODEM) localcaps &= ~(ZED_ZAPPER|ZED_ZIPPER);
if (localoptions & NOZEDZAP) localcaps &= ~ZED_ZAPPER; if (localoptions & NOZEDZAP) localcaps &= ~ZED_ZAPPER;
@ -139,6 +142,12 @@ int rx_yoohoo(void)
if ((rc = rxyoohoo()) == 0) { if ((rc = rxyoohoo()) == 0) {
Loaded = checkhello(); Loaded = checkhello();
if (y_akas == 0) {
Syslog('+', "All akas busy, abort");
return MBERR_SESSION_ERROR;
}
capabilities = hello2.capabilities; capabilities = hello2.capabilities;
if (capabilities & WZ_FREQ) if (capabilities & WZ_FREQ)
session_flags |= SESSION_WAZOO; session_flags |= SESSION_WAZOO;
@ -226,6 +235,7 @@ int tx_yoohoo(void)
unsigned short capabilities; unsigned short capabilities;
char *pwd; char *pwd;
y_akas = 0;
if (strlen(nodes.Spasswd)) if (strlen(nodes.Spasswd))
pwd = xstrcpy(nodes.Spasswd); pwd = xstrcpy(nodes.Spasswd);
else else
@ -256,6 +266,10 @@ int tx_yoohoo(void)
session_flags &= ~SESSION_WAZOO; session_flags &= ~SESSION_WAZOO;
} }
if (y_akas == 0) {
Syslog('+', "All akas busy, abort");
return MBERR_SESSION_ERROR;
}
if ((rc == 0) && ((capabilities & LOCALCAPS) == 0)) { if ((rc == 0) && ((capabilities & LOCALCAPS) == 0)) {
Syslog('+', "No common protocols"); Syslog('+', "No common protocols");
return MBERR_SESSION_ERROR; return MBERR_SESSION_ERROR;
@ -286,84 +300,78 @@ int tx_yoohoo(void)
SM_DECL(rxyoohoo,(char *)"rxyoohoo") SM_DECL(rxyoohoo,(char *)"rxyoohoo")
SM_STATES SM_STATES
sendenq, sendenq,
waitchar, waitchar,
getpacket, getpacket,
sendnak, sendnak,
sendack sendack
SM_NAMES SM_NAMES
(char *)"sendenq", (char *)"sendenq",
(char *)"waitchar", (char *)"waitchar",
(char *)"getpacket", (char *)"getpacket",
(char *)"sendnak", (char *)"sendnak",
(char *)"sendack" (char *)"sendack"
SM_EDECL SM_EDECL
int c; int c, count=0;
int count=0; unsigned short lcrc, rcrc;
unsigned short lcrc,rcrc;
SM_START(sendenq) SM_START(sendenq)
SM_STATE(sendenq) SM_STATE(sendenq)
Syslog('S', "rxyoohoo SENDENQ"); if (count++ > 12) {
if (count++ > 12) { Syslog('+', "Too many tries to get YooHoo hello packet");
Syslog('+', "Too many tries to get hello packet"); SM_ERROR;
SM_ERROR; }
} PUTCHAR(ENQ);
PUTCHAR(ENQ); SM_PROCEED(waitchar)
SM_PROCEED(waitchar)
SM_STATE(waitchar) SM_STATE(waitchar)
Syslog('S', "rxyoohoo WAITCHAR"); c=GETCHAR(10);
c=GETCHAR(10); if (c == TIMEOUT) {
if (c == TIMEOUT) { SM_PROCEED(sendenq);
SM_PROCEED(sendenq); } else if (c < 0) {
} else if (c < 0) { SM_ERROR;
SM_ERROR; } else switch (c) {
} else switch (c) { case 0x1f: SM_PROCEED(getpacket);
case 0x1f: SM_PROCEED(getpacket); break;
break; case YOOHOO: SM_PROCEED(sendenq);
case YOOHOO: SM_PROCEED(sendenq); break;
break; default: SM_PROCEED(waitchar);
default: SM_PROCEED(waitchar); break;
break; }
}
SM_STATE(getpacket) SM_STATE(getpacket)
Syslog('S', "rxyoohoo GETPACKET"); GET((char*)&hello, sizeof(hello), 30);
GET((char*)&hello, sizeof(hello), 30); if (STATUS) {
if (STATUS) { SM_ERROR;
SM_ERROR; }
}
lcrc = crc16xmodem((char*)hello.data, sizeof(hello.data)); lcrc = crc16xmodem((char*)hello.data, sizeof(hello.data));
rcrc = (hello.crc[0] << 8) + hello.crc[1]; rcrc = (hello.crc[0] << 8) + hello.crc[1];
if (lcrc != rcrc) { if (lcrc != rcrc) {
Syslog('+',"crc does not match in hello packet: %04xh/%04xh", rcrc,lcrc); Syslog('+',"crc does not match in YooHoo hello packet: %04xh/%04xh", rcrc,lcrc);
SM_PROCEED(sendnak); SM_PROCEED(sendnak);
} else { } else {
SM_PROCEED(sendack); SM_PROCEED(sendack);
} }
SM_STATE(sendnak) SM_STATE(sendnak)
Syslog('S', "rxyoohoo SENDNAK"); if (count++ > 9) {
if (count++ > 9) { Syslog('+', "Too many tries to get YooHoo hello packet");
Syslog('+', "Too many tries to get hello packet"); SM_ERROR;
SM_ERROR; }
} PUTCHAR('?');
PUTCHAR('?'); SM_PROCEED(waitchar);
SM_PROCEED(waitchar);
SM_STATE(sendack) SM_STATE(sendack)
Syslog('S', "rxyoohoo SENDACK"); PUTCHAR(ACK);
PUTCHAR(ACK); SM_SUCCESS;
SM_SUCCESS;
SM_END SM_END
SM_RETURN SM_RETURN
@ -372,268 +380,269 @@ SM_RETURN
SM_DECL(txyoohoo,(char *)"txyoohoo") SM_DECL(txyoohoo,(char *)"txyoohoo")
SM_STATES SM_STATES
sendyoohoo, sendyoohoo,
waitenq, waitenq,
sendpkt, sendpkt,
waitchar waitchar
SM_NAMES SM_NAMES
(char *)"sendyoohoo", (char *)"sendyoohoo",
(char *)"waitenq", (char *)"waitenq",
(char *)"sendpkt", (char *)"sendpkt",
(char *)"waitchar" (char *)"waitchar"
SM_EDECL SM_EDECL
int c; int c, count = 0, startstate;
int count=0; unsigned short lcrc;
int startstate;
unsigned short lcrc;
if (iscaller) if (iscaller)
startstate = sendpkt; startstate = sendpkt;
else else
startstate = sendyoohoo; startstate = sendyoohoo;
lcrc = crc16xmodem((char*)hello.data, sizeof(hello.data)); lcrc = crc16xmodem((char*)hello.data, sizeof(hello.data));
hello.crc[0] = lcrc >> 8; hello.crc[0] = lcrc >> 8;
hello.crc[1] = lcrc & 0xff; hello.crc[1] = lcrc & 0xff;
Syslog('S', "txyoohoo INIT");
SM_START(startstate) SM_START(startstate)
SM_STATE(sendyoohoo) SM_STATE(sendyoohoo)
Syslog('S', "txyoohoo SENDYOOHOO"); PUTCHAR(YOOHOO);
PUTCHAR(YOOHOO); SM_PROCEED(waitenq);
SM_PROCEED(waitenq);
SM_STATE(waitenq) SM_STATE(waitenq)
Syslog('S', "txyoohoo WAITENQ"); c=GETCHAR(10);
c=GETCHAR(10); if (c == TIMEOUT) {
if (c == TIMEOUT) { if (count++ > 9) {
if (count++ > 9) { Syslog('+', "Timeout waiting ENQ");
Syslog('+', "Timeout waiting ENQ"); SM_ERROR;
SM_ERROR; } else {
} else { SM_PROCEED(sendyoohoo);
SM_PROCEED(sendyoohoo);
}
} else if (c < 0) {
SM_ERROR;
} else switch (c) {
case ENQ: SM_PROCEED(sendpkt);
case YOOHOO: SM_PROCEED(waitenq);
default: Syslog('+',"Got '%s' waiting hello ACK", printablec(c));
SM_PROCEED(waitchar);
break;
} }
} else if (c < 0) {
SM_ERROR;
} else switch (c) {
case ENQ: SM_PROCEED(sendpkt);
case YOOHOO: SM_PROCEED(waitenq);
default: Syslog('+',"Got '%s' waiting hello ACK", printablec(c));
SM_PROCEED(waitchar);
break;
}
SM_STATE(sendpkt) SM_STATE(sendpkt)
Syslog('S', "txyoohoo SENDPKT"); if (count++ > 9) {
if (count++ > 9) { Syslog('+', "Too many tries to send YooHoo hello packet");
Syslog('+', "Too many tries to send hello packet"); SM_ERROR;
SM_ERROR; }
}
PUTCHAR(0x1f); PUTCHAR(0x1f);
PUT((char*)&hello, sizeof(hello)); PUT((char*)&hello, sizeof(hello));
if (STATUS) { if (STATUS) {
SM_ERROR; SM_ERROR;
} }
SM_PROCEED(waitchar); SM_PROCEED(waitchar);
SM_STATE(waitchar) SM_STATE(waitchar)
Syslog('S', "txyoohoo WAITCHAR"); c=GETCHAR(30);
c=GETCHAR(30); if (c == TIMEOUT) {
if (c == TIMEOUT) { Syslog('+', "Timeout waiting hello ACK");
Syslog('+', "Timeout waiting hello ACK"); SM_ERROR;
SM_ERROR; } else if (c < 0) {
} else if (c < 0) { SM_ERROR;
SM_ERROR; } else switch (c) {
} else switch (c) { case ACK: SM_SUCCESS;
case ACK: Syslog('S', "Handshake successfull"); break;
SM_SUCCESS; case '?': SM_PROCEED(sendpkt);
break; break;
case '?': SM_PROCEED(sendpkt); case ENQ: SM_PROCEED(sendpkt);
break; break;
case ENQ: SM_PROCEED(sendpkt); default: SM_PROCEED(waitchar);
break; break;
default: SM_PROCEED(waitchar); }
break;
}
SM_END SM_END
SM_RETURN SM_RETURN
void fillhello(unsigned short capabilities, char *password) void fillhello(unsigned short capabilities, char *password)
{ {
faddr *best; faddr *best;
unsigned short majver, minver; unsigned short majver, minver;
Syslog('S',"fillhello(0x%04hx)",capabilities); best = bestaka_s(remote->addr);
sscanf(VERSION,"%hd.%hd", &majver, &minver);
memset(&hello, 0, sizeof(hello));
best = bestaka_s(remote->addr); hello.data[0] = 'o'; /* signal */
hello.data[2] = 1; /* hello-version */
hello.data[4] = (PRODCODE & 0x00ff); /* product code */
hello.data[5] = (PRODCODE & 0xff00) >> 8; /* product code */
hello.data[6] = (VERSION_MAJOR & 0x00ff); /* prod-ver-major */
hello.data[7] = (VERSION_MAJOR & 0xff00) >> 8; /* prod-ver-major */
hello.data[8] = (VERSION_MINOR & 0x00ff); /* prod-ver-minor */
hello.data[9] = (VERSION_MINOR & 0xff00) >> 8; /* prod-ver-minor */
strncpy((char*)hello.data+10, name?name:"Unavailable",59); /* name */
if (name) {
hello.data[10+strlen(name)] = '\0';
strncpy((char*)hello.data+11 + strlen(name),
best->domain, 58-strlen(name)); /* domain */
} else
strncpy((char*)hello.data + 22, best->domain, 47); /* domain */
strncpy((char*)hello.data+70, CFG.sysop_name,19); /* sysop */
hello.data[90] = best->zone&0xff; /* zone */
hello.data[91] = best->zone>>8; /* zone */
hello.data[92] = best->net&0xff; /* net */
hello.data[93] = best->net>>8; /* net */
hello.data[94] = best->node&0xff; /* node */
hello.data[95] = best->node>>8; /* node */
hello.data[96] = best->point&0xff; /* point */
hello.data[97] = best->point>>8; /* point */
sscanf(VERSION,"%hd.%hd", &majver, &minver); if (password)
memset(&hello, 0, sizeof(hello)); strncpy((char*)hello.data + 98, password, 8);
hello.data[0] = 'o'; /* signal */
hello.data[2] = 1; /* hello-version */
hello.data[4] = (PRODCODE & 0x00ff); /* product code */
hello.data[5] = (PRODCODE & 0xff00) >> 8; /* product code */
hello.data[6] = (VERSION_MAJOR & 0x00ff); /* prod-ver-major */
hello.data[7] = (VERSION_MAJOR & 0xff00) >> 8; /* prod-ver-major */
hello.data[8] = (VERSION_MINOR & 0x00ff); /* prod-ver-minor */
hello.data[9] = (VERSION_MINOR & 0xff00) >> 8; /* prod-ver-minor */
strncpy((char*)hello.data+10, name?name:"Unavailable",59); /* name */
if (name) {
hello.data[10+strlen(name)] = '\0';
strncpy((char*)hello.data+11 + strlen(name),
best->domain, 58-strlen(name)); /* domain */
} else
strncpy((char*)hello.data + 22, best->domain, 47); /* domain */
strncpy((char*)hello.data+70, CFG.sysop_name,19); /* sysop */
hello.data[90] = best->zone&0xff; /* zone */
hello.data[91] = best->zone>>8; /* zone */
hello.data[92] = best->net&0xff; /* net */
hello.data[93] = best->net>>8; /* net */
hello.data[94] = best->node&0xff; /* node */
hello.data[95] = best->node>>8; /* node */
hello.data[96] = best->point&0xff; /* point */
hello.data[97] = best->point>>8; /* point */
if (password) hello.data[114] = capabilities & 0xff; /* capabilities */
strncpy((char*)hello.data + 98, password, 8); hello.data[115] = capabilities >> 8; /* capabilities */
tidy_faddr(best);
hello.data[114] = capabilities & 0xff; /* capabilities */
hello.data[115] = capabilities >> 8; /* capabilities */
tidy_faddr(best);
Syslog('S',"filled hello \"%s\"",printable((char*)hello.data,128));
} }
int checkhello(void) int checkhello(void)
{ {
unsigned short i, majver = 0, minver = 0; unsigned short i, majver = 0, minver = 0;
fa_list **tmpl,*tmpn; fa_list **tmpl, *tmpa;
faddr remaddr; faddr remaddr;
char *prodnm, *q; char *prodnm, *q;
int loaded = FALSE; int loaded = FALSE;
Syslog('S',"check hello \"%s\"",printable((char*)hello.data,128)); Syslog('s',"check hello \"%s\"",printable((char*)hello.data,128));
hello2 = gethello2(hello.data);
hello2 = gethello2(hello.data); if ((hello2.signal != 0x6f) || (hello2.hello_version != 0x01)) {
Syslog('+', "Got \"%s\" instead of \"o\\000\\001\000\"", printable((char*)hello.data,3));
}
if ((hello2.signal != 0x6f) || prodnm = xstrcpy((char *)"<unknown program>");
(hello2.hello_version != 0x01)) { for (i = 0; ftscprod[i].name; i++) {
Syslog('+', "Got \"%s\" instead of \"o\\000\\001\000\"", printable((char*)hello.data,3)); if (ftscprod[i].code == hello2.product) {
free(prodnm);
prodnm = xstrcpy(ftscprod[i].name);
majver = hello2.product_maj;
minver = hello2.product_min;
break;
} }
}
prodnm = xstrcpy((char *)"<unknown program>"); remaddr.zone = hello2.my_zone;
for (i = 0; ftscprod[i].name; i++) remaddr.net = hello2.my_net;
if (ftscprod[i].code == hello2.product) { remaddr.node = hello2.my_node;
free(prodnm); remaddr.point = hello2.my_point;
prodnm = xstrcpy(ftscprod[i].name); remaddr.name = NULL;
majver = hello2.product_maj; remaddr.domain = NULL;
minver = hello2.product_min; if (hello2.my_name[0])
break; remaddr.domain = hello2.my_name + (strlen(hello2.my_name)) + 1;
} if (remaddr.domain[0]) {
if ((q = strchr(remaddr.domain, '.')))
remaddr.zone = hello2.my_zone; *q = '\0';
remaddr.net = hello2.my_net; } else {
remaddr.node = hello2.my_node;
remaddr.point = hello2.my_point;
remaddr.name = NULL;
remaddr.domain = NULL; remaddr.domain = NULL;
if (hello2.my_name[0]) }
remaddr.domain = hello2.my_name + (strlen(hello2.my_name)) + 1; if (remote)
if (remaddr.domain[0]) { Syslog('s',"Remote known address: %s",ascfnode(remote->addr,0x1f));
if ((q = strchr(remaddr.domain, '.')))
*q = '\0'; for (tmpl = &remote; *tmpl; tmpl = &((*tmpl)->next));
if ((remote == NULL) || (metric(remote->addr, &remaddr) != 0)) {
(*tmpl) = (fa_list*)malloc(sizeof(fa_list));
(*tmpl)->next = NULL;
(*tmpl)->addr = (faddr*)malloc(sizeof(faddr));
(*tmpl)->addr->zone = remaddr.zone;
(*tmpl)->addr->net = remaddr.net;
(*tmpl)->addr->node = remaddr.node;
(*tmpl)->addr->point = remaddr.point;
(*tmpl)->addr->domain = xstrcpy(remaddr.domain);
(*tmpl)->addr->name = NULL; /* Added 15-Dec-1998 */
} else {
tmpl=&remote;
Syslog('s',"Using single remote address");
}
tmpl = &remote;
while (*tmpl) {
if (nodelock((*tmpl)->addr, mypid)) {
Syslog('+', " address: %s is locked, removed from aka list",ascfnode((*tmpl)->addr,0x1f));
tmpa = *tmpl;
*tmpl = (*tmpl)->next;
tidy_faddr(tmpa->addr);
free(tmpa);
} else { } else {
remaddr.domain = NULL; Syslog('+', " address: %s",ascfnode((*tmpl)->addr,0x1f));
y_akas++;
/*
* With the loaded flag we prevent removing the noderecord
* when the remote presents us an address we don't know about.
*/
if (!Loaded) {
if (noderecord((*tmpl)->addr))
Loaded = TRUE;
}
tmpl = &((*tmpl)->next);
} }
if (remote) }
Syslog('S',"Remote known address: %s",ascfnode(remote->addr,0x1f));
for (tmpl = &remote; *tmpl; tmpl = &((*tmpl)->next)); if (y_akas) { /* Only set if we have aka's left */
if ((remote == NULL) || (metric(remote->addr, &remaddr) != 0)) {
(*tmpl) = (fa_list*)malloc(sizeof(fa_list));
(*tmpl)->next = NULL;
(*tmpl)->addr = (faddr*)malloc(sizeof(faddr));
(*tmpl)->addr->zone = remaddr.zone;
(*tmpl)->addr->net = remaddr.net;
(*tmpl)->addr->node = remaddr.node;
(*tmpl)->addr->point = remaddr.point;
(*tmpl)->addr->domain = xstrcpy(remaddr.domain);
(*tmpl)->addr->name = NULL; /* Added 15-Dec-1998 */
} else {
tmpl=&remote;
Syslog('S',"Using single remote address");
}
for (tmpn = remote; tmpn; tmpn = tmpn->next) {
(void)nodelock(tmpn->addr, mypid);
/*
* lock all remotes, ignore locking result
*/
if (!loaded)
if (noderecord(tmpn->addr))
loaded = TRUE;
}
Syslog('+', " address: %s",ascfnode(remote->addr,0x1f));
history.aka.zone = remote->addr->zone; history.aka.zone = remote->addr->zone;
history.aka.net = remote->addr->net; history.aka.net = remote->addr->net;
history.aka.node = remote->addr->node; history.aka.node = remote->addr->node;
history.aka.point = remote->addr->point; history.aka.point = remote->addr->point;
Syslog('S', "password: %s",(char*)hello2.my_password); }
if (hello2.product < 0x0100)
Syslog('+', " uses: %s [%02X] version %d.%d", prodnm, hello2.product, majver, minver);
else
Syslog('+', " uses: %s [%04X] version %d.%d", prodnm, hello2.product, majver, minver);
Syslog('+', " system: %s",(char*)hello2.my_name);
strncpy(history.system_name, hello2.my_name, 35);
Syslog('+', " sysop: %s",(char*)hello2.sysop);
strncpy(history.sysop, hello2.sysop, 35);
sprintf(history.location, "Somewhere");
free(prodnm); if (hello2.product < 0x0100)
return loaded; Syslog('+', " uses: %s [%02X] version %d.%d", prodnm, hello2.product, majver, minver);
else
Syslog('+', " uses: %s [%04X] version %d.%d", prodnm, hello2.product, majver, minver);
Syslog('+', " system: %s",(char*)hello2.my_name);
strncpy(history.system_name, hello2.my_name, 35);
Syslog('+', " sysop: %s",(char*)hello2.sysop);
strncpy(history.sysop, hello2.sysop, 35);
sprintf(history.location, "Somewhere");
free(prodnm);
return loaded;
} }
Hello gethello2(unsigned char Hellop[]) Hello gethello2(unsigned char Hellop[])
{ {
int i; int i;
Hello p; Hello p;
p.signal=Hellop[0]+(Hellop[1]<<8); p.signal=Hellop[0]+(Hellop[1]<<8);
p.hello_version=Hellop[2]+(Hellop[3]<<8); p.hello_version=Hellop[2]+(Hellop[3]<<8);
p.product=Hellop[4]+(Hellop[5]<<8); p.product=Hellop[4]+(Hellop[5]<<8);
p.product_maj=Hellop[6]+(Hellop[7]<<8); p.product_maj=Hellop[6]+(Hellop[7]<<8);
p.product_min=Hellop[8]+(Hellop[9]<<8); p.product_min=Hellop[8]+(Hellop[9]<<8);
for (i=0;i<60;i++) for (i=0;i<60;i++)
p.my_name[i]=Hellop[10+i]; p.my_name[i]=Hellop[10+i];
for (i=0;i<20;i++) for (i=0;i<20;i++)
p.sysop[i]=Hellop[70+i]; p.sysop[i]=Hellop[70+i];
p.my_zone=Hellop[90]+(Hellop[91]<<8); p.my_zone=Hellop[90]+(Hellop[91]<<8);
p.my_net=Hellop[92]+(Hellop[93]<<8); p.my_net=Hellop[92]+(Hellop[93]<<8);
p.my_node=Hellop[94]+(Hellop[95]<<8); p.my_node=Hellop[94]+(Hellop[95]<<8);
p.my_point=Hellop[96]+(Hellop[97]<<8); p.my_point=Hellop[96]+(Hellop[97]<<8);
for (i=0;i<8;i++) for (i=0;i<8;i++)
p.my_password[i]=Hellop[98+i]; p.my_password[i]=Hellop[98+i];
for (i=0;i<8;i++) for (i=0;i<8;i++)
p.reserved2[i]=Hellop[106+i]; p.reserved2[i]=Hellop[106+i];
p.capabilities=Hellop[114]+(Hellop[115]<<8); p.capabilities=Hellop[114]+(Hellop[115]<<8);
for (i=0;i<12;i++) for (i=0;i<12;i++)
p.reserved3[i]=Hellop[116+i]; p.reserved3[i]=Hellop[116+i];
return p; return p;
} }

View File

@ -89,7 +89,7 @@ static int alias_db_init(void)
while (fcntl(fileno(afp), F_SETLK, &txflock) != 0) { while (fcntl(fileno(afp), F_SETLK, &txflock) != 0) {
if (tries > 4) if (tries > 4)
Syslog('+', "Alias database locked %d errno=%d %s", tries +1, errno, strerror(errno)); Syslog('+', "Alias database locked %d errno=%d %s", tries +1, errno, strerror(errno));
usleep(250000); msleep(250);
if (++tries >= 60) { if (++tries >= 60) {
fclose(afp); fclose(afp);
afp = NULL; afp = NULL;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Announce new files and FileFind * Purpose ...............: Announce new files and FileFind
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -127,7 +127,7 @@ void Uploads()
i++; i++;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
if ((area.Available) && strlen(area.NewGroup)) { if ((area.Available) && strlen(area.NewGroup)) {
@ -321,7 +321,7 @@ long Report(gr_list *ta, long filepos)
if ((!strcmp(T_File.Echo, ta->echo)) && (!strcmp(T_File.Group, ta->group))) { if ((!strcmp(T_File.Echo, ta->echo)) && (!strcmp(T_File.Group, ta->group))) {
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
/* /*
* Report one newfile, first line. * Report one newfile, first line.

View File

@ -4,7 +4,7 @@
* Purpose ...............: Announce new files and FileFind * Purpose ...............: Announce new files and FileFind
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -117,7 +117,7 @@ void ScanArea(ff_list **ffl)
} }
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
if (Msg_ReadHeader(Number) == TRUE) { if (Msg_ReadHeader(Number) == TRUE) {
if (((!strcasecmp(Msg.To, "allfix")) || (!strcasecmp(Msg.To, "filefind"))) && (!Msg.Received)) { if (((!strcasecmp(Msg.To, "allfix")) || (!strcasecmp(Msg.To, "filefind"))) && (!Msg.Received)) {
@ -288,7 +288,7 @@ void ScanFiles(ff_list *tmp)
Nopper(); Nopper();
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
if (!do_quiet) { if (!do_quiet) {
printf("%6lu / %6lu", areanr, found); printf("%6lu / %6lu", areanr, found);

View File

@ -4,7 +4,7 @@
* Purpose: File Database Maintenance - Build index for request processor * Purpose: File Database Maintenance - Build index for request processor
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -478,7 +478,7 @@ void ReqIndex(void)
*/ */
x++; x++;
if (CFG.slow_util && do_quiet && ((x % 3) == 0)) if (CFG.slow_util && do_quiet && ((x % 3) == 0))
usleep(1); msleep(1);
for (z = 0; z <= 25; z++) { for (z = 0; z <= 25; z++) {
if (strlen(file.Desc[z])) { if (strlen(file.Desc[z])) {
@ -658,7 +658,7 @@ void HtmlIndex(char *Lang)
TotalHtml++; TotalHtml++;
aTotal++; aTotal++;
if (CFG.slow_util && do_quiet && ((x % 3) == 0)) if (CFG.slow_util && do_quiet && ((x % 3) == 0))
usleep(1); msleep(1);
MacroVars("efghijklm", "ddsssssds", 0, 0, "", "", "", "", "", 0, ""); MacroVars("efghijklm", "ddsssssds", 0, 0, "", "", "", "", "", 0, "");
MacroVars("e", "d", aTotal); MacroVars("e", "d", aTotal);

View File

@ -152,7 +152,7 @@ void Marker(void)
* Release system resources when running in the background * Release system resources when running in the background
*/ */
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
if (do_quiet) if (do_quiet)
return; return;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Nodelist Compiler * Purpose ...............: Nodelist Compiler
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -374,10 +374,10 @@ int compile(char *nlname, unsigned short zo, unsigned short ne, unsigned short n
if (CFG.slow_util && do_quiet) { if (CFG.slow_util && do_quiet) {
if (zo) { if (zo) {
usleep(1); msleep(1);
} else { } else {
if ((lineno % 40) == 0) if ((lineno % 40) == 0)
usleep(1); msleep(1);
} }
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Message Base Maintenance * Purpose ...............: Message Base Maintenance
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -475,7 +475,7 @@ void KillArea(char *Path, char *Name, int DaysOld, int MaxMsgs, long Areanr)
do { do {
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
if ((!do_quiet) && ((Counter % 10L) == 0)) { if ((!do_quiet) && ((Counter % 10L) == 0)) {
printf("%6lu / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", Counter, TotalMsgs); printf("%6lu / %6lu\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", Counter, TotalMsgs);
@ -587,7 +587,7 @@ void PackArea(char *Path, long Areanr)
} }
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: AreaMgr and FileMgr utilities. * Purpose ...............: AreaMgr and FileMgr utilities.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -589,7 +589,7 @@ int Areas(void)
for (tmp = alist; tmp; tmp = tmp->next) { for (tmp = alist; tmp; tmp = tmp->next) {
fseek(fp, msgshdr.hdrsize, SEEK_SET); fseek(fp, msgshdr.hdrsize, SEEK_SET);
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) { while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) {
if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name)) if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name))
tmp->IsPresent = TRUE; tmp->IsPresent = TRUE;
@ -639,7 +639,7 @@ int Areas(void)
} }
cmd = xstrcat(cmd, tmp->Name); cmd = xstrcat(cmd, tmp->Name);
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
} }
@ -658,7 +658,7 @@ int Areas(void)
fseek(fp, msgshdr.hdrsize, SEEK_SET); fseek(fp, msgshdr.hdrsize, SEEK_SET);
Syslog('m', "Delete %s", tmp->Name); Syslog('m', "Delete %s", tmp->Name);
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) { while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) {
if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name)) { if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name)) {
fseek(fp, - msgshdr.recsize, SEEK_CUR); fseek(fp, - msgshdr.recsize, SEEK_CUR);
@ -828,7 +828,7 @@ int Areas(void)
for (tmp = alist; tmp; tmp = tmp->next) { for (tmp = alist; tmp; tmp = tmp->next) {
fseek(fp, tichdr.hdrsize, SEEK_SET); fseek(fp, tichdr.hdrsize, SEEK_SET);
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
while (fread(&tic, tichdr.recsize, 1, fp) == 1) { while (fread(&tic, tichdr.recsize, 1, fp) == 1) {
if (tic.Active && !strcmp(tic.Group, fgroup.Name) && !strcmp(tic.Name, tmp->Name)) if (tic.Active && !strcmp(tic.Group, fgroup.Name) && !strcmp(tic.Name, tmp->Name))
tmp->IsPresent = TRUE; tmp->IsPresent = TRUE;
@ -886,7 +886,7 @@ int Areas(void)
} }
cmd = xstrcat(cmd, tmp->Name); cmd = xstrcat(cmd, tmp->Name);
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
} }
@ -907,7 +907,7 @@ int Areas(void)
fseek(fp, tichdr.hdrsize, SEEK_SET); fseek(fp, tichdr.hdrsize, SEEK_SET);
Syslog('f', "Delete %s", tmp->Name); Syslog('f', "Delete %s", tmp->Name);
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
while (fread(&tic, tichdr.recsize, 1, fp) == 1) { while (fread(&tic, tichdr.recsize, 1, fp) == 1) {
if (tic.Active && !strcmp(tic.Group, fgroup.Name) && !strcmp(tic.Name, tmp->Name)) { if (tic.Active && !strcmp(tic.Group, fgroup.Name) && !strcmp(tic.Name, tmp->Name)) {
fseek(fp, - tichdr.recsize, SEEK_CUR); fseek(fp, - tichdr.recsize, SEEK_CUR);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Statistic rollover util. * Purpose ...............: Statistic rollover util.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -65,7 +65,7 @@ void RollWeek(statcnt *S)
S->tweek = 0L; S->tweek = 0L;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
@ -158,7 +158,7 @@ void Rollover()
nodes.MailSent.month[Miy] = 0; nodes.MailSent.month[Miy] = 0;
nodes.MailRcvd.month[Miy] = 0; nodes.MailRcvd.month[Miy] = 0;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
fseek(fp, - nodeshdr.recsize, SEEK_CUR); fseek(fp, - nodeshdr.recsize, SEEK_CUR);
fwrite(&nodes, nodeshdr.recsize, 1, fp); fwrite(&nodes, nodeshdr.recsize, 1, fp);
@ -199,7 +199,7 @@ void Rollover()
msgs.Received.month[Miy] = 0; msgs.Received.month[Miy] = 0;
msgs.Posted.month[Miy] = 0; msgs.Posted.month[Miy] = 0;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
fseek(fp, - msgshdr.recsize, SEEK_CUR); fseek(fp, - msgshdr.recsize, SEEK_CUR);
fwrite(&msgs, msgshdr.recsize, 1, fp); fwrite(&msgs, msgshdr.recsize, 1, fp);
@ -239,7 +239,7 @@ void Rollover()
mgroup.MsgsRcvd.month[Miy] = 0; mgroup.MsgsRcvd.month[Miy] = 0;
mgroup.MsgsSent.month[Miy] = 0; mgroup.MsgsSent.month[Miy] = 0;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
fseek(fp, - mgrouphdr.recsize, SEEK_CUR); fseek(fp, - mgrouphdr.recsize, SEEK_CUR);
fwrite(&mgroup, mgrouphdr.recsize, 1, fp); fwrite(&mgroup, mgrouphdr.recsize, 1, fp);
@ -278,7 +278,7 @@ void Rollover()
tic.Files.month[Miy] = 0; tic.Files.month[Miy] = 0;
tic.KBytes.month[Miy] = 0; tic.KBytes.month[Miy] = 0;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
fseek(fp, - tichdr.recsize, SEEK_CUR); fseek(fp, - tichdr.recsize, SEEK_CUR);
fwrite(&tic, tichdr.recsize, 1, fp); fwrite(&tic, tichdr.recsize, 1, fp);
@ -318,7 +318,7 @@ void Rollover()
fgroup.Files.month[Miy] = 0; fgroup.Files.month[Miy] = 0;
fgroup.KBytes.month[Miy] = 0; fgroup.KBytes.month[Miy] = 0;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
fseek(fp, - fgrouphdr.recsize, SEEK_CUR); fseek(fp, - fgrouphdr.recsize, SEEK_CUR);
fwrite(&fgroup, fgrouphdr.recsize, 1, fp); fwrite(&fgroup, fgrouphdr.recsize, 1, fp);
@ -354,7 +354,7 @@ void Rollover()
if (do_month) { if (do_month) {
hatch.Hatched.month[Miy] = 0; hatch.Hatched.month[Miy] = 0;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
fseek(fp, - hatchhdr.recsize, SEEK_CUR); fseek(fp, - hatchhdr.recsize, SEEK_CUR);
fwrite(&hatch, hatchhdr.recsize, 1, fp); fwrite(&hatch, hatchhdr.recsize, 1, fp);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Scan for outgoing mail. * Purpose ...............: Scan for outgoing mail.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -182,7 +182,7 @@ void ScanFull()
do { do {
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
if (((Number % 10) == 0) && (!do_quiet)) { if (((Number % 10) == 0) && (!do_quiet)) {
printf("%6lu\b\b\b\b\b\b", Number); printf("%6lu\b\b\b\b\b\b", Number);
@ -245,7 +245,7 @@ void ScanFull()
do { do {
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
if (((Number % 10) == 0) && (!do_quiet)) { if (((Number % 10) == 0) && (!do_quiet)) {
printf("%6lu\b\b\b\b\b\b", Number); printf("%6lu\b\b\b\b\b\b", Number);

View File

@ -464,7 +464,7 @@ int get_xover(char *grpname, long startnr, long endnr, List **art)
fill_artlist(art, ptr, nr, dupe); fill_artlist(art, ptr, nr, dupe);
free(p); free(p);
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
} }
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Process .tic files * Purpose ...............: Process .tic files
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -169,7 +169,7 @@ int LoadTic(char *inb, char *tfn)
fa_list *sbl = NULL; fa_list *sbl = NULL;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
memset(&RealName, 0, sizeof(RealName)); memset(&RealName, 0, sizeof(RealName));
memset(&TIC, 0, sizeof(TIC)); memset(&TIC, 0, sizeof(TIC));

View File

@ -4,7 +4,7 @@
* Purpose ...............: Toss a single *.pkt file * Purpose ...............: Toss a single *.pkt file
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -156,7 +156,7 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
sysconnect Link; sysconnect Link;
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
memset(&Link, 0, sizeof(Link)); memset(&Link, 0, sizeof(Link));

View File

@ -4,7 +4,7 @@
* Purpose ...............: Common utilities * Purpose ...............: Common utilities
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -514,7 +514,7 @@ int Waitchar(unsigned char *ch, int wtime)
rc = read(ttyfd, ch, 1); rc = read(ttyfd, ch, 1);
if (rc == 1) if (rc == 1)
return rc; return rc;
usleep(10000); msleep(10);
} }
return rc; return rc;
} }
@ -862,6 +862,42 @@ void mvprintw(int y, int x, const char *format, ...)
/*
* * Milliseconds timer, returns 0 on success.
* */
int msleep(int msecs)
{
int rc;
struct timespec req, rem;
rem.tv_sec = 0;
rem.tv_nsec = 0;
req.tv_sec = msecs / 1000;
req.tv_nsec = (msecs % 1000) * 1000000;
while (TRUE) {
rc = nanosleep(&req, &rem);
if (rc == 0)
break;
if ((errno == EINVAL) || (errno == EFAULT)) {
Syslog('?', "$msleep(%d)", msecs);
break;
}
/*
* Error was EINTR, run timer again to complete.
*/
req.tv_sec = rem.tv_sec;
req.tv_nsec = rem.tv_nsec;
rem.tv_sec = 0;
rem.tv_nsec = 0;
}
return rc;
}
/* /*
* Signal handler signal names. * Signal handler signal names.
*/ */

View File

@ -86,7 +86,7 @@ void colour(int, int);
void clear(void); void clear(void);
void locate(int, int); void locate(int, int);
void mvprintw(int, int, const char *, ...); void mvprintw(int, int, const char *, ...);
int msleep(int);
#endif #endif

View File

@ -4,7 +4,7 @@
* Purpose ...............: Utilities * Purpose ...............: Utilities
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -531,9 +531,9 @@ void working(int txno, int y, int x)
for (i = 1; i <= 5; i++) { for (i = 1; i <= 5; i++) {
putchar(7); putchar(7);
fflush(stdout); fflush(stdout);
usleep(150000); msleep(150);
} }
usleep(550000); msleep(550);
break; break;
case 3: mvprintw(4, columns - 14, (char *)"Form inserted"); case 3: mvprintw(4, columns - 14, (char *)"Form inserted");
putchar(7); putchar(7);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Creates allfiles listings * Purpose ...............: Creates allfiles listings
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -350,7 +350,7 @@ void Masterlist()
*/ */
x++; x++;
if (CFG.slow_util && do_quiet && ((x % 3) == 0)) if (CFG.slow_util && do_quiet && ((x % 3) == 0))
usleep(1); msleep(1);
AllFiles++; AllFiles++;
AllAreaFiles++; AllAreaFiles++;
AllAreaBytes += file.Size; AllAreaBytes += file.Size;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Change BBS status * Purpose ...............: Change BBS status
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -153,7 +153,6 @@ int main(int argc, char **argv)
pw = getpwuid(getuid()); pw = getpwuid(getuid());
InitClient(pw->pw_name, (char *)"mbstat", CFG.location, CFG.logfile, InitClient(pw->pw_name, (char *)"mbstat", CFG.location, CFG.logfile,
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog); CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
usleep(1);
Syslog(' ', " "); Syslog(' ', " ");
Syslog(' ', "MBSTAT v%s", VERSION); Syslog(' ', "MBSTAT v%s", VERSION);
@ -186,7 +185,6 @@ int main(int argc, char **argv)
if (!(do_open || do_close || do_wait || do_sema)) if (!(do_open || do_close || do_wait || do_sema))
Help(); Help();
usleep(1);
die(MBERR_OK); die(MBERR_OK);
return 0; return 0;
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: User Pack Util * Purpose ...............: User Pack Util
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -255,7 +255,7 @@ void UserPack(int days, int level, int pack)
fwrite(&usr, sizeof(usr), 1, fout); fwrite(&usr, sizeof(usr), 1, fout);
memset(&usr, 0, sizeof(usr)); memset(&usr, 0, sizeof(usr));
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
Nopper(); Nopper();
} }
fclose(fin); fclose(fin);
@ -300,7 +300,7 @@ void UserPack(int days, int level, int pack)
fwrite(&usr, sizeof(usr), 1, fout); fwrite(&usr, sizeof(usr), 1, fout);
} }
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
} }
Syslog('+', "Marked %d users to delete", delete); Syslog('+', "Marked %d users to delete", delete);
} }
@ -314,7 +314,7 @@ void UserPack(int days, int level, int pack)
fseek(fout, sizeof(usrhdr), SEEK_SET); fseek(fout, sizeof(usrhdr), SEEK_SET);
while (fread(&usr, sizeof(usr), 1, fout) == 1) { while (fread(&usr, sizeof(usr), 1, fout) == 1) {
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); msleep(1);
Nopper(); Nopper();
if (usr.Deleted) { if (usr.Deleted) {

View File

@ -4,7 +4,7 @@
* Purpose ...............: Offline Reader * Purpose ...............: Offline Reader
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2003 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -2693,7 +2693,7 @@ unsigned long QWK_PackArea(unsigned long ulLast, long Area)
fwrite(&Qwk, sizeof(Qwk), 1, fdm); fwrite(&Qwk, sizeof(Qwk), 1, fdm);
fseek(fdm, 0L, SEEK_END); fseek(fdm, 0L, SEEK_END);
if ((Total % 16L) == 0L) if ((Total % 16L) == 0L)
usleep(1); msleep(1);
} }
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) { if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
@ -2937,7 +2937,7 @@ unsigned long ASCII_PackArea(unsigned long ulLast, long Area)
} }
if ((Total % 16L) == 0L) if ((Total % 16L) == 0L)
usleep(1); msleep(1);
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) { if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
BarWidth = (unsigned short)((Total * 61L) / TotalPack); BarWidth = (unsigned short)((Total * 61L) / TotalPack);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Screen functions for setup. * Purpose ...............: Screen functions for setup.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2004
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -227,9 +227,9 @@ void working(int txno, int y, int x)
for (i = 1; i <= 5; i++) { for (i = 1; i <= 5; i++) {
fputc(7, stdout); fputc(7, stdout);
fflush(stdout); fflush(stdout);
usleep(150000); msleep(150);
} }
usleep(550000); msleep(550);
break; break;
case 3: mvprintw(4, 66, (char *)"Form inserted"); case 3: mvprintw(4, 66, (char *)"Form inserted");
fputc(7, stdout); fputc(7, stdout);

View File

@ -3,8 +3,8 @@
include ../Makefile.global include ../Makefile.global
OTHER = Makefile README maint midnight weekly monthly installinit.sh rc rc.shutdown \ OTHER = Makefile README maint midnight weekly monthly installinit.sh setup.mbse \
mbse.start mbse.stop bbsdoor.sh rundoor.sh init.Debian init.RedHat \ bbsdoor.sh rundoor.sh init.Debian init.RedHat init.FreeBSD init.NetBSD \
init.Slackware init.SuSE init.Gentoo hatch editor.in bbsjoerc bbsjmacsrc init.Slackware init.SuSE init.Gentoo hatch editor.in bbsjoerc bbsjmacsrc
#################################################################################################### ####################################################################################################