Added -v switch to mbfile

This commit is contained in:
Michiel Broek 2002-06-15 14:00:49 +00:00
parent 51c58dcb88
commit b23210284a
10 changed files with 89 additions and 73 deletions

View File

@ -17,7 +17,7 @@ SRCS = addbbs.c backalias.c flock.c hatch.c mbdiff.c mgrutil.c pack.c \
createm.c createf.c
HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h pack.h \
postnetmail.h scannews.h tosspkt.h addpkt.h bwrite.h forward.h \
lhash.h mbfido.h mkftnhdr.h paths.h ptic.h sendmail.h tracker.h \
lhash.h mbfido.h mkftnhdr.h ptic.h sendmail.h tracker.h \
aliasdb.h fsort.h magic.h mbfile.h mover.h ping.h rfc2ftn.h \
storeecho.h ulock.h announce.h fflist.h ftn2rfc.h makestat.h mbindex.h \
msgutil.h post.h rnews.h storenet.h utic.h areamgr.h filefind.h \
@ -49,7 +49,7 @@ MBINDEX_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib
MBDIFF_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
MBFILE_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a ../lib/libdiesel.a
MBMSG_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a ../lib/libdbase.a
OTHER = Makefile README maptabs.tgz paths.h.in
OTHER = Makefile README maptabs.tgz
TARGET = mbfido mbseq mbaff mbindex mbdiff mbfile mbmsg
####################################################################################################################
@ -160,7 +160,7 @@ magic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/c
mbfile.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfkill.h mbfadopt.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfimport.h mbftoberep.h mbfmove.h mbfdel.h mbfutil.h mbfile.h
mover.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h
post.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h post.h
rnews.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h pack.h rfc2ftn.h mbfido.h paths.h rnews.h
rnews.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h pack.h rfc2ftn.h mbfido.h ../paths.h rnews.h
storenet.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbmsgs.h ../lib/dbuser.h rollover.h storenet.h
utic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h tic.h utic.h
announce.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h announce.h

View File

@ -51,7 +51,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname;
FILE *fp, *fi, *net;
char flavor;
faddr *dest, *route, *Fa;
faddr *dest, *routeto, *Fa;
int i, z, n;
time_t now, ftime;
fa_list *tmp;
@ -108,11 +108,11 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
flavor = 'h';
if (nodes.RouteVia.zone)
route = fido2faddr(nodes.RouteVia);
routeto = fido2faddr(nodes.RouteVia);
else
route = fido2faddr(Node);
routeto = fido2faddr(Node);
dest = fido2faddr(Node);
attach(*route, fwdfile, LEAVE, flavor);
attach(*routeto, fwdfile, LEAVE, flavor);
// if (strlen(CFG.dospath))
// subject = xstrcpy(Unix2Dos(fwdfile));
@ -286,7 +286,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
fprintf(fp, "Pw %s\r\n", nodes.Fpasswd);
fclose(fp);
attach(*route, ticfile, KFS, flavor);
attach(*routeto, ticfile, KFS, flavor);
} else {
WriteError("$Can't create %s", ticfile);
}
@ -325,7 +325,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
SearchNode(Node);
free(ticfile);
free(fwdfile);
tidy_faddr(route);
tidy_faddr(routeto);
}

View File

@ -43,6 +43,7 @@
extern int do_quiet; /* Supress screen output */
extern int do_annon; /* Supress announce file */
extern int do_novir; /* Suppess virus check */
void AdoptFile(int Area, char *File, char *Description)
@ -91,11 +92,15 @@ void AdoptFile(int Area, char *File, char *Description)
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
die(0);
} else {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
if (do_novir == FALSE) {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
IsVirus = VirScan(tmpdir);
} else {
IsVirus = FALSE;
}
IsVirus = VirScan(tmpdir);
if (IsVirus) {
DeleteVirusWork();
chdir(pwd);
@ -113,12 +118,16 @@ void AdoptFile(int Area, char *File, char *Description)
if (!UnPacked)
die(0);
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (do_novir == FALSE) {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
IsVirus = VirScan(tmpdir);
} else {
IsVirus = FALSE;
}
IsVirus = VirScan(tmpdir);
if (IsVirus) {
DeleteVirusWork();
chdir(pwd);

View File

@ -52,6 +52,7 @@
extern int do_quiet; /* Supress screen output */
int do_annon = FALSE; /* Suppress announce on new files */
int do_novir = FALSE; /* Suppress virus check */
int do_adopt = FALSE; /* Adopt a file */
int do_pack = FALSE; /* Pack filebase */
int do_check = FALSE; /* Check filebase */
@ -190,6 +191,8 @@ int main(int argc, char **argv)
do_quiet = TRUE;
} else if (!strncasecmp(argv[i], "-a", 2)) {
do_annon = TRUE;
} else if (!strncasecmp(argv[i], "-v", 2)) {
do_novir = TRUE;
}
}
@ -203,6 +206,8 @@ int main(int argc, char **argv)
Syslog(' ', " ");
Syslog(' ', "MBFILE v%s", VERSION);
Syslog(' ', cmd);
if (do_novir)
Syslog('!', "WARNING: running without virus checking");
free(cmd);
if (!do_quiet)

View File

@ -43,6 +43,7 @@
extern int do_quiet; /* Supress screen output */
extern int do_annon; /* Supress announce files */
extern int do_novir; /* Supress virus scanning */
void ImportFiles(int Area)
@ -112,12 +113,14 @@ void ImportFiles(int Area)
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
Doit = FALSE;
} else {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (VirScan(tmpdir)) {
Doit = FALSE;
if (do_novir == FALSE) {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (VirScan(tmpdir)) {
Doit = FALSE;
}
}
}
} else {
@ -126,12 +129,14 @@ void ImportFiles(int Area)
fflush(stdout);
}
if (UnpackFile(temp)) {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (VirScan(tmpdir)) {
Doit = FALSE;
if (do_novir == FALSE) {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (VirScan(tmpdir)) {
Doit = FALSE;
}
}
} else {
Doit = FALSE;
@ -311,12 +316,14 @@ void ImportFiles(int Area)
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
Doit = FALSE;
} else {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (VirScan(tmpdir)) {
Doit = FALSE;
if (do_novir == FALSE) {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (VirScan(tmpdir)) {
Doit = FALSE;
}
}
}
} else {
@ -325,12 +332,14 @@ void ImportFiles(int Area)
fflush(stdout);
}
if (UnpackFile(temp)) {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (VirScan(tmpdir)) {
Doit = FALSE;
if (do_novir == FALSE) {
if (!do_quiet) {
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (VirScan(tmpdir)) {
Doit = FALSE;
}
}
} else {
Doit = FALSE;

View File

@ -131,6 +131,7 @@ void Help(void)
colour(CYAN, BLACK);
printf(" -a -announce Supress announce added files\n");
printf(" -q -quiet Quiet mode\n");
printf(" -v -virus Suppress virus scanning, use with care\n");
die(0);
}

View File

@ -1,8 +0,0 @@
/*
* $Id$
*
* Autogenerated by configure
*/
#define _PATH_COMPRESS "@COMPRESS@"
#define _PATH_GZIP "@GZIP@"

View File

@ -76,7 +76,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
char System[36], ext[4];
int result = 1, email = FALSE, fmpt = 0, topt = 0;
faddr *ta, *ra;
fidoaddr na, route, Orig;
fidoaddr na, routeto, Orig;
FILE *sfp, *net;
time_t now;
struct tm *tm;
@ -224,7 +224,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
if (SearchFidonet(na.zone))
sprintf(na.domain, "%s", fidonet.domain);
switch(TrackMail(na, &route)) {
switch(TrackMail(na, &routeto)) {
case R_LOCAL:
/*
* Check the To: field.
@ -328,7 +328,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
case R_DIRECT:
case R_ROUTE:
Syslog('+', "Route netmail via %s", aka2str(route));
Syslog('+', "Route netmail via %s", aka2str(routeto));
if (!strcasecmp(t->name, (char *)"ping") && DoPing) {
Syslog('+', "In transit \"Ping\" message detected");
Ping(f, t, fp, TRUE);
@ -339,9 +339,9 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
* Forward this message. Will not work for unknown
* direct links.
*/
if (SearchNode(route)) {
if (SearchNode(routeto)) {
memset(&Orig, 0, sizeof(Orig));
ra = fido2faddr(route);
ra = fido2faddr(routeto);
ta = bestaka_s(ra);
Orig.zone = ta->zone;
Orig.net = ta->net;
@ -360,7 +360,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
else
sprintf(ext, (char *)"nnn");
if ((net = OpenPkt(Orig , route, (char *)ext)) == NULL) {
if ((net = OpenPkt(Orig , routeto, (char *)ext)) == NULL) {
net_bad++;
WriteError("Can't create netmail");
return 0;
@ -374,7 +374,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
*/
Syslog('!', "Warning: not a direct link, check setup");
memset(&Orig, 0, sizeof(Orig));
ra = fido2faddr(route);
ra = fido2faddr(routeto);
ta = bestaka_s(ra);
Orig.zone = ta->zone;
Orig.net = ta->net;
@ -383,7 +383,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
tidy_faddr(ra);
tidy_faddr(ta);
if ((net = OpenPkt(Orig , route, (char *)"nnn")) == NULL) {
if ((net = OpenPkt(Orig , routeto, (char *)"nnn")) == NULL) {
net_bad++;
WriteError("Can't create netmail");
return 0;

View File

@ -44,7 +44,7 @@
#include "pack.h"
#include "rfc2ftn.h"
#include "mbfido.h"
#include "paths.h"
#include "../paths.h"
#include "rnews.h"

View File

@ -48,13 +48,13 @@ extern long nodes_pos;
* If not, return FALSE. The calling program must bounce the
* original message.
*/
int TrackMail(fidoaddr too, fidoaddr *route)
int TrackMail(fidoaddr too, fidoaddr *routeto)
{
int rc, i;
Syslog('r', "Tracking destination %s", aka2str(too));
rc = GetRoute(aka2str(too) , route);
rc = GetRoute(aka2str(too) , routeto);
if (rc == R_NOROUTE) {
WriteError("No route to %s, not parsed", aka2str(too));
return R_NOROUTE;
@ -74,26 +74,26 @@ int TrackMail(fidoaddr too, fidoaddr *route)
* Now look again if from the routing result we find a
* direct link. If so, maybe adjust something.
*/
if (SearchNode(*route)) {
if (SearchNode(*routeto)) {
Syslog('r', "Known node: %s", aka2str(nodes.Aka[0]));
Syslog('r', "Check \"too\" %s", aka2str(too));
if (nodes.RouteVia.zone) {
route->zone = nodes.RouteVia.zone;
route->net = nodes.RouteVia.net;
route->node = nodes.RouteVia.node;
route->point = nodes.RouteVia.point;
sprintf(route->domain, "%s", nodes.RouteVia.domain);
routeto->zone = nodes.RouteVia.zone;
routeto->net = nodes.RouteVia.net;
routeto->node = nodes.RouteVia.node;
routeto->point = nodes.RouteVia.point;
sprintf(routeto->domain, "%s", nodes.RouteVia.domain);
return R_ROUTE;
} else {
for (i = 0; i < 20; i++)
if (route->zone == nodes.Aka[i].zone)
if (routeto->zone == nodes.Aka[i].zone)
break;
route->zone = nodes.Aka[i].zone;
route->net = nodes.Aka[i].net;
route->node = nodes.Aka[i].node;
route->point = nodes.Aka[i].point;
sprintf(route->domain, "%s", nodes.Aka[i].domain);
routeto->zone = nodes.Aka[i].zone;
routeto->net = nodes.Aka[i].net;
routeto->node = nodes.Aka[i].node;
routeto->point = nodes.Aka[i].point;
sprintf(routeto->domain, "%s", nodes.Aka[i].domain);
return R_ROUTE;
}
}