Updates for mbnntp

This commit is contained in:
Michiel Broek 2004-04-12 13:01:51 +00:00
parent 3ddd56e7c5
commit 1e002f4cb4
8 changed files with 209 additions and 112 deletions

View File

@ -2,6 +2,10 @@ $Id$
v0.51.4 11-Apr-2004 v0.51.4 11-Apr-2004
upgrade:
Start mbsetup and leave. This wil update the message area
records.
mbcico: mbcico:
All heavy debug logmessages are now in defines and are only All heavy debug logmessages are now in defines and are only
enabled with ./configure --enable-newbinkp enabled with ./configure --enable-newbinkp
@ -11,10 +15,17 @@ v0.51.4 11-Apr-2004
function is removed, this should be done in the setup for the function is removed, this should be done in the setup for the
virus scanners. virus scanners.
Added loging of virus scanner results. Added loging of virus scanner results.
When a new echomail area is auto created, the creation date and
the newsgroup name will be set.
mbsebbs: mbsebbs:
Added loging of virus scanner results. Added loging of virus scanner results.
mbsetup:
Added auto setup for message area creation date. Also creates
a faked newsgroup name in echomail areas. Both settings are
needed for the (upcoming) newsserver.
v0.51.3 22-Mar-2003 - 11-Apr-2004 v0.51.3 22-Mar-2003 - 11-Apr-2004

View File

@ -1317,6 +1317,7 @@ struct msgareas {
int Charset; /* FTN characterset */ int Charset; /* FTN characterset */
int MaxArticles; /* Max. newsarticles to get */ int MaxArticles; /* Max. newsarticles to get */
securityrec LinkSec; /* Link security flags */ securityrec LinkSec; /* Link security flags */
time_t Created; /* Area creation date */
}; };

View File

@ -244,11 +244,20 @@ int CheckEchoGroup(char *Area, int SendUplink, faddr *f)
msgs.Quotes = mgroup.Quotes; msgs.Quotes = mgroup.Quotes;
msgs.Charset = mgroup.Charset; msgs.Charset = mgroup.Charset;
msgs.MaxArticles = CFG.maxarticles; msgs.MaxArticles = CFG.maxarticles;
msgs.Created = time(NULL);
tag = tl(tag); tag = tl(tag);
for (i = 0; i < strlen(tag); i++) for (i = 0; i < strlen(tag); i++)
if (tag[i] == '.') if (tag[i] == '.')
tag[i] = '/'; tag[i] = '/';
sprintf(msgs.Base, "%s/%s", mgroup.BasePath, tag); sprintf(msgs.Base, "%s/%s", mgroup.BasePath, tag);
sprintf(msgs.Newsgroup, "%s.%s", msgs.Group, tag);
for (i = 0; i < strlen(msgs.Newsgroup); i++) {
msgs.Newsgroup[i] = tolower(msgs.Newsgroup[i]);
if (msgs.Newsgroup[i] == '/')
msgs.Newsgroup[i] = '.';
if (msgs.Newsgroup[i] == '_')
msgs.Newsgroup[i] = '.';
}
fwrite(&msgs, sizeof(msgs), 1, mp); fwrite(&msgs, sizeof(msgs), 1, mp);
mkdirs(msgs.Base, 0770); mkdirs(msgs.Base, 0770);
if (Msg_Open(msgs.Base)) if (Msg_Open(msgs.Base))

View File

@ -3,9 +3,9 @@
include ../Makefile.global include ../Makefile.global
SRCS = mbnntp.c openport.c ttyio.c auth.c SRCS = mbnntp.c openport.c ttyio.c auth.c commands.c
HDRS = mbnntp.h openport.h ttyio.h auth.h HDRS = mbnntp.h openport.h ttyio.h auth.h commands.h
OBJS = mbnntp.o openport.o ttyio.o auth.o OBJS = mbnntp.o openport.o ttyio.o auth.o commands.o
LIBS += ../lib/libmbse.a ../lib/libdbase.a ../lib/libmsgbase.a LIBS += ../lib/libmbse.a ../lib/libdbase.a ../lib/libmsgbase.a
OTHER = Makefile OTHER = Makefile
@ -55,8 +55,9 @@ depend:
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT # DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend # Dependencies generated by make depend
mbnntp.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h openport.h ttyio.h auth.h mbnntp.h mbnntp.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h openport.h ttyio.h auth.h commands.h mbnntp.h
openport.o: ../config.h ../lib/mbselib.h openport.h openport.o: ../config.h ../lib/mbselib.h openport.h
ttyio.o: ../config.h ../lib/mbselib.h ttyio.h ttyio.o: ../config.h ../lib/mbselib.h ttyio.h
auth.o: ../config.h ../lib/mbselib.h mbnntp.h auth.h auth.o: ../config.h ../lib/mbselib.h ../lib/users.h mbnntp.h auth.h
commands.o: ../config.h ../lib/mbselib.h mbnntp.h commands.h
# End of generated dependencies # End of generated dependencies

43
mbnntp/commands.c Normal file
View File

@ -0,0 +1,43 @@
/*****************************************************************************
*
* $Id$
*
*****************************************************************************
* Copyright (C) 1997-2004
*
* 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, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*****************************************************************************/
#include "../config.h"
#include "../lib/mbselib.h"
#include "mbnntp.h"
#include "commands.h"
void command_list(char *cmd)
{
send_nntp("215 List of newsgroups follows");
send_nntp(".");
}

8
mbnntp/commands.h Normal file
View File

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

View File

@ -35,6 +35,7 @@
#include "openport.h" #include "openport.h"
#include "ttyio.h" #include "ttyio.h"
#include "auth.h" #include "auth.h"
#include "commands.h"
#include "mbnntp.h" #include "mbnntp.h"
time_t t_start; time_t t_start;
@ -197,15 +198,6 @@ void send_nntp(const char *format, ...)
void command_list(char *cmd)
{
send_nntp("215 List of newsgroups follows");
send_nntp(".");
}
void nntp(void) void nntp(void)
{ {
char buf[4096]; char buf[4096];

View File

@ -87,6 +87,7 @@ int CountMsgarea(void)
msgs.MaxMsgs = CFG.defmsgs; msgs.MaxMsgs = CFG.defmsgs;
msgs.Charset = FTNC_NONE; msgs.Charset = FTNC_NONE;
strcpy(msgs.Origin, CFG.origin); strcpy(msgs.Origin, CFG.origin);
msgs.Created = time(NULL);
fwrite(&msgs, sizeof(msgs), 1, fil); fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base, 0770); mkdirs(msgs.Base, 0770);
if (Msg_Open(msgs.Base)) if (Msg_Open(msgs.Base))
@ -111,6 +112,7 @@ int CountMsgarea(void)
msgs.DaysOld = CFG.defdays; msgs.DaysOld = CFG.defdays;
msgs.MaxMsgs = CFG.defmsgs; msgs.MaxMsgs = CFG.defmsgs;
msgs.Charset = FTNC_NONE; msgs.Charset = FTNC_NONE;
msgs.Created = time(NULL);
fwrite(&msgs, sizeof(msgs), 1, fil); fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base, 0770); mkdirs(msgs.Base, 0770);
if (Msg_Open(msgs.Base)) if (Msg_Open(msgs.Base))
@ -134,9 +136,11 @@ int CountMsgarea(void)
msgs.DaysOld = CFG.defdays; msgs.DaysOld = CFG.defdays;
msgs.MaxMsgs = CFG.defmsgs; msgs.MaxMsgs = CFG.defmsgs;
msgs.Charset = FTNC_NONE; msgs.Charset = FTNC_NONE;
msgs.Created = time(NULL);
fwrite(&msgs, sizeof(msgs), 1, fil); fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base, 0770); mkdirs(msgs.Base, 0770);
if (Msg_Open(msgs.Base)) if (Msg_Open(msgs.Base))
Msg_Close();
for (i = 1; i <= CFG.toss_systems; i++) for (i = 1; i <= CFG.toss_systems; i++)
fwrite(&syscon, sizeof(syscon), 1, fil); fwrite(&syscon, sizeof(syscon), 1, fil);
@ -173,6 +177,19 @@ int OpenMsgarea(void)
long oldsize, oldsys; long oldsize, oldsys;
struct _sysconnect syscon; struct _sysconnect syscon;
int i, oldsystems; int i, oldsystems;
time_t start = 900000000; /* Faked startdate of 09-07-1998 17:00:00 */
/*
* Find system startdate, we use this to update the area records
* if they don't have a creation date. All new areas will get the
* right date.
*/
sprintf(fnin, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
if ((fin = fopen(fnin, "r"))) {
fread(&SYSINFO, sizeof(SYSINFO), 1, fin);
start = SYSINFO.StartDate;
fclose(fin);
}
sprintf(fnin, "%s/etc/mareas.data", getenv("MBSE_ROOT")); sprintf(fnin, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
sprintf(fnout, "%s/etc/mareas.temp", getenv("MBSE_ROOT")); sprintf(fnout, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
@ -221,6 +238,18 @@ int OpenMsgarea(void)
msgs.LinkSec.level = 1; msgs.LinkSec.level = 1;
msgs.LinkSec.flags = 1; msgs.LinkSec.flags = 1;
} }
if ((int)msgs.Created == 0) {
msgs.Created = start;
if ((strlen(msgs.Newsgroup) == 0) && (msgs.Type == ECHOMAIL) && strlen(msgs.Group)) {
sprintf(msgs.Newsgroup, "%s.%s", msgs.Group, msgs.Tag);
for (i = 0; i < strlen(msgs.Newsgroup); i++) {
msgs.Newsgroup[i] = tolower(msgs.Newsgroup[i]);
if (msgs.Newsgroup[i] == '_')
msgs.Newsgroup[i] = '.';
}
Syslog('+', "Area %s created newsgroup name %s", msgs.Tag, msgs.Newsgroup);
}
}
fwrite(&msgs, sizeof(msgs), 1, fout); fwrite(&msgs, sizeof(msgs), 1, fout);
memset(&msgs, 0, sizeof(msgs)); memset(&msgs, 0, sizeof(msgs));
/* /*
@ -300,6 +329,7 @@ void InitMsgRec(void)
strcpy(msgs.Origin, CFG.origin); strcpy(msgs.Origin, CFG.origin);
msgs.LinkSec.level = 1; msgs.LinkSec.level = 1;
msgs.LinkSec.flags = 1; msgs.LinkSec.flags = 1;
msgs.Created = time(NULL);
} }
@ -1844,6 +1874,7 @@ int mail_area_doc(FILE *fp, FILE *toc, int page)
add_webtable(wp, (char *)"UnSecure toss", getboolean(msgs.UnSecure)); add_webtable(wp, (char *)"UnSecure toss", getboolean(msgs.UnSecure));
add_webtable(wp, (char *)"Last msg rcvd", ctime(&msgs.LastRcvd)); add_webtable(wp, (char *)"Last msg rcvd", ctime(&msgs.LastRcvd));
add_webtable(wp, (char *)"Last msg posted", ctime(&msgs.LastPosted)); add_webtable(wp, (char *)"Last msg posted", ctime(&msgs.LastPosted));
add_webtable(wp, (char *)"Area created at", ctime(&msgs.Created));
fprintf(wp, "</TBODY>\n"); fprintf(wp, "</TBODY>\n");
fprintf(wp, "</TABLE>\n"); fprintf(wp, "</TABLE>\n");
fprintf(wp, "<HR>\n"); fprintf(wp, "<HR>\n");
@ -1882,6 +1913,7 @@ int mail_area_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " UnSecure toss %s\n", getboolean(msgs.UnSecure)); fprintf(fp, " UnSecure toss %s\n", getboolean(msgs.UnSecure));
fprintf(fp, " Last msg rcvd. %s", ctime(&msgs.LastRcvd)); fprintf(fp, " Last msg rcvd. %s", ctime(&msgs.LastRcvd));
fprintf(fp, " Last msg posted %s", ctime(&msgs.LastPosted)); fprintf(fp, " Last msg posted %s", ctime(&msgs.LastPosted));
fprintf(fp, " Area created at %s", ctime(&msgs.Created));
refs = 0; refs = 0;
for (j = 0; j < systems; j++) { for (j = 0; j < systems; j++) {