From 9e9fec9912010fd468d790d9bf6d9152c3d368f2 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 15 Apr 2004 21:29:59 +0000 Subject: [PATCH] Updates for mbtask and mbnntp --- ChangeLog | 4 ++++ TODO | 3 --- mbnntp/mbnntp.c | 33 ++++++++++++++++++++++++++++++--- mbtask/taskdisk.c | 11 ++++------- mbtask/taskregs.c | 2 +- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c540e7a..f805b0dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,10 @@ v0.51.4 11-Apr-2004 a faked newsgroup name in echomail areas. Both settings are needed for the newsserver. + mbtask: + Removed debug logging for the disk thread. + Added mbnntp to the taskregs to count as a user program. + v0.51.3 22-Mar-2003 - 11-Apr-2004 diff --git a/TODO b/TODO index 4b067e46..156e324f 100644 --- a/TODO +++ b/TODO @@ -29,9 +29,6 @@ libdiesel.a: U: Processed stringlines containing unbalanced " characters are not processed, instead the previous macro value will be returned. -libmsgbase.a: - N: CRC fields are not filled. - mbsebbs: X: Better word wrapping or paragraph justification in editor. diff --git a/mbnntp/mbnntp.c b/mbnntp/mbnntp.c index a23b0937..493a8da7 100644 --- a/mbnntp/mbnntp.c +++ b/mbnntp/mbnntp.c @@ -76,6 +76,25 @@ void die(int onsig) +/* + * Check if the system is available. + */ +int check_free(void); +int check_free(void) +{ + char buf[128]; + + strcpy(buf, SockR("SBBS:0;")); + if (strncmp(buf, "100:2,1", 7) == 0) { + Syslog('+', "The system is closed"); + return FALSE; + } + + return TRUE; +} + + + int main(int argc, char *argv[]) { struct passwd *pw; @@ -131,8 +150,12 @@ int main(int argc, char *argv[]) Syslog('s', "TCP connection: len=%d, family=%hd, port=%hu, addr=%s", addrlen,peeraddr.sin_family, peeraddr.sin_port, inet_ntoa(peeraddr.sin_addr)); Syslog('+', "Incoming connection from %s", inet_ntoa(peeraddr.sin_addr)); - send_nntp("200 MBNNTP v%s server ready -- no posting allowed", VERSION); - nntp(); + if (! check_free()) { + send_nntp("400 Server closed"); + } else { + send_nntp("200 MBNNTP v%s server ready -- posting allowed", VERSION); + nntp(); + } } } @@ -162,7 +185,7 @@ int get_nntp(char *buf, int max) /* * Timeout */ - send_nntp("400 Service discontinued"); + send_nntp("400 Service discontinued, timeout"); } Syslog('+', "Receiver status %s", ttystat[- c]); return c; @@ -223,6 +246,10 @@ void nntp(void) continue; Syslog('n', "< \"%s\"", printable(buf, 0)); + if (! check_free()) { + send_nntp("400 server closed"); + return; + } /* * Process received command diff --git a/mbtask/taskdisk.c b/mbtask/taskdisk.c index c67c68a6..7a1c5ea6 100644 --- a/mbtask/taskdisk.c +++ b/mbtask/taskdisk.c @@ -401,14 +401,11 @@ void add_path(char *lpath) return; } - rpath = calloc(PATH_MAX, sizeof(char)); - mbt_realpath(lpath, rpath); - Syslog('d', "realpath %s", MBSE_SS(rpath)); + rpath = calloc(PATH_MAX, sizeof(char)); + mbt_realpath(lpath, rpath); if (lstat(rpath, &sb) == 0) { -Syslog('d', "add_path(%s)", rpath); - if (S_ISDIR(sb.st_mode)) { #if defined(__linux__) @@ -687,9 +684,9 @@ void *disk_thread(void) disk_run = FALSE; Syslog('+', "Disk thread stopped"); pthread_exit(NULL); -#if defined(__NetBSD__) - return NULL; +#if defined(__NetBSD__) + return NULL; #endif } diff --git a/mbtask/taskregs.c b/mbtask/taskregs.c index 040b0b84..e621c772 100644 --- a/mbtask/taskregs.c +++ b/mbtask/taskregs.c @@ -489,7 +489,7 @@ char *reg_fre(void) if (reginfo[i].pid) { if ((!strncmp(reginfo[i].prg, "mbsebbs", 7)) || (!strncmp(reginfo[i].prg, "mbnewusr", 8)) || - (!strncmp(reginfo[i].prg, "mbftpd", 6))) + (!strncmp(reginfo[i].prg, "mbnntp", 6))) users++; if ((!strncmp(reginfo[i].prg, "mbfido", 6)) ||