Fixed duplicate newfiles bug

This commit is contained in:
Michiel Broek 2004-03-05 19:27:09 +00:00
parent 4437cb6082
commit e261f5072e
7 changed files with 35 additions and 74 deletions

View File

@ -79,6 +79,8 @@ v0.51.1 21-Feb-2004
now case insensitive, also the area tagnames are forced to
uppercase. This should solve the problems with Linuxnet.
Replaced system() call with execute.
New files with already in the toberep database will not be
added again.
mbdiff:
Replaced system() call with execute.

4
TODO
View File

@ -121,10 +121,6 @@ mbfido:
N: After readalias we need to free the alias list when mbfido ends.
N: When a file with the same name is received in a tic area more than
once (virus defs for example) the file is written multiple times
in the toberep database and will be multiple times announced.
N: Reimplement characterset conversion again on the gateway.
mbcico:

View File

@ -131,6 +131,7 @@ client.o: ../config.h mbselib.h
crc.o: ../config.h mbselib.h
semafore.o: ../config.h mbselib.h
signame.o: ../config.h mbselib.h
charset.o: ../config.h mbselib.h
attach.o: ../config.h mbselib.h
falists.o: ../config.h mbselib.h
hdr.o: ../config.h mbselib.h
@ -178,5 +179,6 @@ smtp.o: ../config.h mbselib.h mbinet.h
diesel.o: ../config.h mbselib.h diesel.h
mbdiesel.o: ../config.h mbselib.h diesel.h
nodelist.o: ../config.h mbselib.h nodelist.h
mbcharsetc.o: ../config.h mbselib.h mbcharsetc.h
ftscprod.o: ../config.h mbselib.h
# End of generated dependencies

View File

@ -35,7 +35,7 @@ MBFIDO_OBJS = flock.o tosspkt.o mbfido.o hatch.o maketags.o virscan.o tracker.o
postecho.o backalias.o createm.o createf.o msgflags.o dirsession.o \
queue.o dirlock.o qualify.o
MBSEQ_OBJS = mbseq.o
MBAFF_OBJS = announce.o fflist.o filefind.o grlist.o mbaff.o msgutil.o
MBAFF_OBJS = announce.o fflist.o filefind.o grlist.o mbaff.o msgutil.o toberep.o
MBINDEX_OBJS = mbindex.o
MBDIFF_OBJS = mbdiff.o
MBFILE_OBJS = mbfile.o mbfkill.o mbfutil.o mbfindex.o mbfcheck.o mbfpack.o mbflist.o mbfadopt.o \
@ -153,7 +153,7 @@ post.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h
rnews.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbinet.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h rfc2ftn.h mbfido.h ../paths.h rnews.h
storenet.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h msgflags.h rollover.h storenet.h
utic.o: ../config.h ../lib/mbselib.h tic.h mover.h tic.h utic.h
announce.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h announce.h
announce.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h toberep.h announce.h
fflist.o: ../config.h ../lib/mbselib.h ../lib/msg.h fflist.h
ftn2rfc.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h rollover.h aliasdb.h postemail.h backalias.h msgflags.h ftn2rfc.h
makestat.o: ../config.h ../lib/mbselib.h ../lib/diesel.h ../lib/msg.h mgrutil.h makestat.h

View File

@ -37,6 +37,7 @@
#include "../lib/diesel.h"
#include "grlist.h"
#include "msgutil.h"
#include "toberep.h"
#include "announce.h"
@ -48,45 +49,6 @@ int MsgCount; /* Message counter */
/*
* Add a file whos data is in T_File to the toberep.data file.
*/
int Add_ToBeRep(void);
int Add_ToBeRep()
{
char *fname;
struct _filerecord Temp;
FILE *tbr;
int Found = FALSE;
fname = calloc(PATH_MAX, sizeof(char));
sprintf(fname, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
if ((tbr = fopen(fname, "a+")) == NULL) {
WriteError("$Can't create %s", fname);
free(fname);
return FALSE;
}
free(fname);
fseek(tbr, 0, SEEK_SET);
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
if ((strcmp(Temp.Name, T_File.Name) == 0) && (Temp.Fdate = T_File.Fdate))
Found = TRUE;
}
if (Found) {
Syslog('!', "File %s already in toberep.data", T_File.Name);
fclose(tbr);
return FALSE;
}
fwrite(&T_File, sizeof(T_File), 1, tbr);
fclose(tbr);
return TRUE;
}
/*
* Check for uploads, these are files in the files database with
* the announced flag not yet set.

View File

@ -31,8 +31,6 @@
#include "../config.h"
#include "../lib/mbselib.h"
#include "tic.h"
#include "toberep.h"
@ -40,35 +38,37 @@
* Add a file whos data is in T_File to the toberep.data file.
* The newfiles announce option will later remove these records.
*/
void Add_ToBeRep()
int Add_ToBeRep()
{
char fname[128];
struct _filerecord Temp;
FILE *tbr;
int Found = FALSE;
char *fname;
struct _filerecord Temp;
FILE *tbr;
int Found = FALSE;
sprintf(fname, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
if ((tbr = fopen(fname, "a+")) == NULL) {
WriteError("$Can't create %s", fname);
return;
}
fname = calloc(PATH_MAX, sizeof(char));
sprintf(fname, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
if ((tbr = fopen(fname, "a+")) == NULL) {
WriteError("$Can't create %s", fname);
free(fname);
return FALSE;
}
free(fname);
fseek(tbr, 0, SEEK_SET);
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
if ((strcmp(Temp.Name, T_File.Name) == 0) &&
(Temp.Fdate == T_File.Fdate) &&
(strcmp(Temp.Echo, T_File.Echo) == 0))
Found = TRUE;
}
fseek(tbr, 0, SEEK_SET);
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
if ((strcmp(Temp.Name, T_File.Name) == 0) && (Temp.Fdate == T_File.Fdate))
Found = TRUE;
}
if (Found) {
Syslog('!', "File %s already in toberep.data", T_File.Name);
fclose(tbr);
return;
}
fwrite(&T_File, sizeof(T_File), 1, tbr);
if (Found) {
Syslog('!', "File %s already in toberep.data", T_File.Name);
fclose(tbr);
return FALSE;
}
fwrite(&T_File, sizeof(T_File), 1, tbr);
fclose(tbr);
return TRUE;
}

View File

@ -1,9 +1,8 @@
#ifndef _TOBEREP_H
#define _TOBEREP_H
/* $Id$ */
void Add_ToBeRep(void);
int Add_ToBeRep(void);
#endif