Updates for mbnntp
This commit is contained in:
parent
3ddd56e7c5
commit
1e002f4cb4
11
ChangeLog
11
ChangeLog
@ -2,6 +2,10 @@ $Id$
|
||||
|
||||
v0.51.4 11-Apr-2004
|
||||
|
||||
upgrade:
|
||||
Start mbsetup and leave. This wil update the message area
|
||||
records.
|
||||
|
||||
mbcico:
|
||||
All heavy debug logmessages are now in defines and are only
|
||||
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
|
||||
virus scanners.
|
||||
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:
|
||||
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
|
||||
|
||||
|
@ -1317,6 +1317,7 @@ struct msgareas {
|
||||
int Charset; /* FTN characterset */
|
||||
int MaxArticles; /* Max. newsarticles to get */
|
||||
securityrec LinkSec; /* Link security flags */
|
||||
time_t Created; /* Area creation date */
|
||||
};
|
||||
|
||||
|
||||
|
@ -244,11 +244,20 @@ int CheckEchoGroup(char *Area, int SendUplink, faddr *f)
|
||||
msgs.Quotes = mgroup.Quotes;
|
||||
msgs.Charset = mgroup.Charset;
|
||||
msgs.MaxArticles = CFG.maxarticles;
|
||||
msgs.Created = time(NULL);
|
||||
tag = tl(tag);
|
||||
for (i = 0; i < strlen(tag); i++)
|
||||
if (tag[i] == '.')
|
||||
tag[i] = '/';
|
||||
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);
|
||||
mkdirs(msgs.Base, 0770);
|
||||
if (Msg_Open(msgs.Base))
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
include ../Makefile.global
|
||||
|
||||
SRCS = mbnntp.c openport.c ttyio.c auth.c
|
||||
HDRS = mbnntp.h openport.h ttyio.h auth.h
|
||||
OBJS = mbnntp.o openport.o ttyio.o auth.o
|
||||
SRCS = mbnntp.c openport.c ttyio.c auth.c commands.c
|
||||
HDRS = mbnntp.h openport.h ttyio.h auth.h commands.h
|
||||
OBJS = mbnntp.o openport.o ttyio.o auth.o commands.o
|
||||
LIBS += ../lib/libmbse.a ../lib/libdbase.a ../lib/libmsgbase.a
|
||||
OTHER = Makefile
|
||||
|
||||
@ -55,8 +55,9 @@ depend:
|
||||
|
||||
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
|
||||
# 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
|
||||
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
|
||||
|
43
mbnntp/commands.c
Normal file
43
mbnntp/commands.c
Normal 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
8
mbnntp/commands.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef _COMMANDS_H
|
||||
#define _COMMANDS_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
void command_list(char *); /* LIST */
|
||||
|
||||
#endif
|
@ -35,6 +35,7 @@
|
||||
#include "openport.h"
|
||||
#include "ttyio.h"
|
||||
#include "auth.h"
|
||||
#include "commands.h"
|
||||
#include "mbnntp.h"
|
||||
|
||||
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)
|
||||
{
|
||||
char buf[4096];
|
||||
|
@ -54,108 +54,112 @@ int MailForced = FALSE;
|
||||
*/
|
||||
int CountMsgarea(void)
|
||||
{
|
||||
FILE *fil;
|
||||
char ffile[PATH_MAX];
|
||||
int count, i;
|
||||
struct _sysconnect syscon;
|
||||
FILE *fil;
|
||||
char ffile[PATH_MAX];
|
||||
int count, i;
|
||||
struct _sysconnect syscon;
|
||||
|
||||
sprintf(ffile, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
msgshdr.hdrsize = sizeof(msgshdr);
|
||||
msgshdr.recsize = sizeof(msgs);
|
||||
msgshdr.syssize = CFG.toss_systems * sizeof(sysconnect);
|
||||
msgshdr.lastupd = time(NULL);
|
||||
fwrite(&msgshdr, sizeof(msgshdr), 1, fil);
|
||||
/*
|
||||
* Default first message area
|
||||
*/
|
||||
memset(&msgs, 0, sizeof(msgs));
|
||||
sprintf(msgs.Name, "Local users chat");
|
||||
sprintf(msgs.Base, "%s/var/mail/local/users", getenv("MBSE_ROOT"));
|
||||
sprintf(msgs.QWKname, "LOC_USERS");
|
||||
sprintf(msgs.Group, "LOCAL");
|
||||
msgs.Active = TRUE;
|
||||
msgs.Type = LOCALMAIL;
|
||||
msgs.MsgKinds = PUBLIC;
|
||||
msgs.SYSec.level = 32000;
|
||||
msgs.UsrDelete = TRUE;
|
||||
msgs.Aliases = TRUE;
|
||||
msgs.Quotes = TRUE;
|
||||
msgs.DaysOld = CFG.defdays;
|
||||
msgs.MaxMsgs = CFG.defmsgs;
|
||||
msgs.Charset = FTNC_NONE;
|
||||
strcpy(msgs.Origin, CFG.origin);
|
||||
fwrite(&msgs, sizeof(msgs), 1, fil);
|
||||
mkdirs(msgs.Base, 0770);
|
||||
if (Msg_Open(msgs.Base))
|
||||
Msg_Close();
|
||||
memset(&syscon, 0, sizeof(syscon));
|
||||
for (i = 1; i <= CFG.toss_systems; i++)
|
||||
fwrite(&syscon, sizeof(syscon), 1, fil);
|
||||
/*
|
||||
* Default message area for badmail
|
||||
*/
|
||||
memset(&msgs, 0, sizeof(msgs));
|
||||
sprintf(msgs.Name, "Bad mail");
|
||||
sprintf(msgs.Base, "%s/var/mail/badmail", getenv("MBSE_ROOT"));
|
||||
sprintf(msgs.QWKname, "BADMAIL");
|
||||
sprintf(msgs.Group, "LOCAL");
|
||||
msgs.Active = TRUE;
|
||||
msgs.Type = LOCALMAIL;
|
||||
msgs.MsgKinds = PUBLIC;
|
||||
msgs.RDSec.level = 32000;
|
||||
msgs.WRSec.level = 32000;
|
||||
msgs.SYSec.level = 32000;
|
||||
msgs.DaysOld = CFG.defdays;
|
||||
msgs.MaxMsgs = CFG.defmsgs;
|
||||
msgs.Charset = FTNC_NONE;
|
||||
fwrite(&msgs, sizeof(msgs), 1, fil);
|
||||
mkdirs(msgs.Base, 0770);
|
||||
if (Msg_Open(msgs.Base))
|
||||
Msg_Close();
|
||||
for (i = 1; i <= CFG.toss_systems; i++)
|
||||
fwrite(&syscon, sizeof(syscon), 1, fil);
|
||||
/*
|
||||
* Default dupemail message area
|
||||
*/
|
||||
memset(&msgs, 0, sizeof(msgs));
|
||||
sprintf(msgs.Name, "Dupe mail");
|
||||
sprintf(msgs.Base, "%s/var/mail/dupemail", getenv("MBSE_ROOT"));
|
||||
sprintf(msgs.QWKname, "DUPEMAIL");
|
||||
sprintf(msgs.Group, "LOCAL");
|
||||
msgs.Active = TRUE;
|
||||
msgs.Type = LOCALMAIL;
|
||||
msgs.MsgKinds = PUBLIC;
|
||||
msgs.RDSec.level = 32000;
|
||||
msgs.WRSec.level = 32000;
|
||||
msgs.SYSec.level = 32000;
|
||||
msgs.DaysOld = CFG.defdays;
|
||||
msgs.MaxMsgs = CFG.defmsgs;
|
||||
msgs.Charset = FTNC_NONE;
|
||||
fwrite(&msgs, sizeof(msgs), 1, fil);
|
||||
mkdirs(msgs.Base, 0770);
|
||||
if (Msg_Open(msgs.Base))
|
||||
for (i = 1; i <= CFG.toss_systems; i++)
|
||||
fwrite(&syscon, sizeof(syscon), 1, fil);
|
||||
sprintf(ffile, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
||||
if ((fil = fopen(ffile, "r")) == NULL) {
|
||||
if ((fil = fopen(ffile, "a+")) != NULL) {
|
||||
Syslog('+', "Created new %s", ffile);
|
||||
msgshdr.hdrsize = sizeof(msgshdr);
|
||||
msgshdr.recsize = sizeof(msgs);
|
||||
msgshdr.syssize = CFG.toss_systems * sizeof(sysconnect);
|
||||
msgshdr.lastupd = time(NULL);
|
||||
fwrite(&msgshdr, sizeof(msgshdr), 1, fil);
|
||||
/*
|
||||
* Default first message area
|
||||
*/
|
||||
memset(&msgs, 0, sizeof(msgs));
|
||||
sprintf(msgs.Name, "Local users chat");
|
||||
sprintf(msgs.Base, "%s/var/mail/local/users", getenv("MBSE_ROOT"));
|
||||
sprintf(msgs.QWKname, "LOC_USERS");
|
||||
sprintf(msgs.Group, "LOCAL");
|
||||
msgs.Active = TRUE;
|
||||
msgs.Type = LOCALMAIL;
|
||||
msgs.MsgKinds = PUBLIC;
|
||||
msgs.SYSec.level = 32000;
|
||||
msgs.UsrDelete = TRUE;
|
||||
msgs.Aliases = TRUE;
|
||||
msgs.Quotes = TRUE;
|
||||
msgs.DaysOld = CFG.defdays;
|
||||
msgs.MaxMsgs = CFG.defmsgs;
|
||||
msgs.Charset = FTNC_NONE;
|
||||
strcpy(msgs.Origin, CFG.origin);
|
||||
msgs.Created = time(NULL);
|
||||
fwrite(&msgs, sizeof(msgs), 1, fil);
|
||||
mkdirs(msgs.Base, 0770);
|
||||
if (Msg_Open(msgs.Base))
|
||||
Msg_Close();
|
||||
memset(&syscon, 0, sizeof(syscon));
|
||||
for (i = 1; i <= CFG.toss_systems; i++)
|
||||
fwrite(&syscon, sizeof(syscon), 1, fil);
|
||||
/*
|
||||
* Default message area for badmail
|
||||
*/
|
||||
memset(&msgs, 0, sizeof(msgs));
|
||||
sprintf(msgs.Name, "Bad mail");
|
||||
sprintf(msgs.Base, "%s/var/mail/badmail", getenv("MBSE_ROOT"));
|
||||
sprintf(msgs.QWKname, "BADMAIL");
|
||||
sprintf(msgs.Group, "LOCAL");
|
||||
msgs.Active = TRUE;
|
||||
msgs.Type = LOCALMAIL;
|
||||
msgs.MsgKinds = PUBLIC;
|
||||
msgs.RDSec.level = 32000;
|
||||
msgs.WRSec.level = 32000;
|
||||
msgs.SYSec.level = 32000;
|
||||
msgs.DaysOld = CFG.defdays;
|
||||
msgs.MaxMsgs = CFG.defmsgs;
|
||||
msgs.Charset = FTNC_NONE;
|
||||
msgs.Created = time(NULL);
|
||||
fwrite(&msgs, sizeof(msgs), 1, fil);
|
||||
mkdirs(msgs.Base, 0770);
|
||||
if (Msg_Open(msgs.Base))
|
||||
Msg_Close();
|
||||
for (i = 1; i <= CFG.toss_systems; i++)
|
||||
fwrite(&syscon, sizeof(syscon), 1, fil);
|
||||
/*
|
||||
* Default dupemail message area
|
||||
*/
|
||||
memset(&msgs, 0, sizeof(msgs));
|
||||
sprintf(msgs.Name, "Dupe mail");
|
||||
sprintf(msgs.Base, "%s/var/mail/dupemail", getenv("MBSE_ROOT"));
|
||||
sprintf(msgs.QWKname, "DUPEMAIL");
|
||||
sprintf(msgs.Group, "LOCAL");
|
||||
msgs.Active = TRUE;
|
||||
msgs.Type = LOCALMAIL;
|
||||
msgs.MsgKinds = PUBLIC;
|
||||
msgs.RDSec.level = 32000;
|
||||
msgs.WRSec.level = 32000;
|
||||
msgs.SYSec.level = 32000;
|
||||
msgs.DaysOld = CFG.defdays;
|
||||
msgs.MaxMsgs = CFG.defmsgs;
|
||||
msgs.Charset = FTNC_NONE;
|
||||
msgs.Created = time(NULL);
|
||||
fwrite(&msgs, sizeof(msgs), 1, fil);
|
||||
mkdirs(msgs.Base, 0770);
|
||||
if (Msg_Open(msgs.Base))
|
||||
Msg_Close();
|
||||
for (i = 1; i <= CFG.toss_systems; i++)
|
||||
fwrite(&syscon, sizeof(syscon), 1, fil);
|
||||
|
||||
fclose(fil);
|
||||
exp_golded = TRUE;
|
||||
chmod(ffile, 0660);
|
||||
return 3;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
fclose(fil);
|
||||
exp_golded = TRUE;
|
||||
chmod(ffile, 0660);
|
||||
return 3;
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
fread(&msgshdr, sizeof(msgshdr), 1, fil);
|
||||
fseek(fil, 0, SEEK_SET);
|
||||
fread(&msgshdr, msgshdr.hdrsize, 1, fil);
|
||||
fseek(fil, 0, SEEK_END);
|
||||
count = (ftell(fil) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize);
|
||||
fclose(fil);
|
||||
fread(&msgshdr, sizeof(msgshdr), 1, fil);
|
||||
fseek(fil, 0, SEEK_SET);
|
||||
fread(&msgshdr, msgshdr.hdrsize, 1, fil);
|
||||
fseek(fil, 0, SEEK_END);
|
||||
count = (ftell(fil) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize);
|
||||
fclose(fil);
|
||||
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@ -173,6 +177,19 @@ int OpenMsgarea(void)
|
||||
long oldsize, oldsys;
|
||||
struct _sysconnect syscon;
|
||||
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(fnout, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
|
||||
@ -221,6 +238,18 @@ int OpenMsgarea(void)
|
||||
msgs.LinkSec.level = 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);
|
||||
memset(&msgs, 0, sizeof(msgs));
|
||||
/*
|
||||
@ -300,6 +329,7 @@ void InitMsgRec(void)
|
||||
strcpy(msgs.Origin, CFG.origin);
|
||||
msgs.LinkSec.level = 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 *)"Last msg rcvd", ctime(&msgs.LastRcvd));
|
||||
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, "</TABLE>\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, " Last msg rcvd. %s", ctime(&msgs.LastRcvd));
|
||||
fprintf(fp, " Last msg posted %s", ctime(&msgs.LastPosted));
|
||||
fprintf(fp, " Area created at %s", ctime(&msgs.Created));
|
||||
|
||||
refs = 0;
|
||||
for (j = 0; j < systems; j++) {
|
||||
|
Reference in New Issue
Block a user