Finished new outbound queue
This commit is contained in:
parent
79327388e9
commit
445582946a
@ -1,6 +1,6 @@
|
||||
$Id$
|
||||
|
||||
WARNING, OUTBOUND QUEUE MAY NOT WORK WITH THIS VERSION, DO NOT USE !!!!!!!!
|
||||
WARNING, OUTBOUND QUEUE MAY NOT WORK WITH THIS VERSION, BE CAREFULL !!
|
||||
|
||||
MBSEBBS History.
|
||||
|
||||
@ -26,6 +26,9 @@ v0.35.03 06-Jul-2002
|
||||
|
||||
mbout:
|
||||
Makes use of the node nodelist override settings.
|
||||
The file attach function now adds the file to the queue, by
|
||||
setting the semafore mailin mbfido will place the file in the
|
||||
real outbound.
|
||||
|
||||
mbfido:
|
||||
Rollover now only sets IsDoing when it really does a date
|
||||
@ -37,6 +40,8 @@ v0.35.03 06-Jul-2002
|
||||
need this.
|
||||
The route test command now works exactly as netmails do.
|
||||
Implemented directory inbound tossing and outbound queueing.
|
||||
Rewrote the outbound queue system, the queue now works for
|
||||
files also.
|
||||
|
||||
newuser:
|
||||
Check for Unix accounts is now case sensitive.
|
||||
|
2
TODO
2
TODO
@ -72,6 +72,8 @@ mbfido:
|
||||
|
||||
L: Implement netmail K/S flag to mark netmail Deleted.
|
||||
|
||||
N: Implement file requests for directory nodes.
|
||||
|
||||
mbcico:
|
||||
L: Implement modem connect response translation for ISDN lines, i.e.
|
||||
make the CAUSE responses human readable. see McMail for this
|
||||
|
@ -173,6 +173,7 @@ int main(int argc, char *argv[])
|
||||
struct passwd *pw;
|
||||
faddr *addr = NULL;
|
||||
node *nlent;
|
||||
FILE *fl;
|
||||
|
||||
#ifdef MEMWATCH
|
||||
mwInit();
|
||||
@ -188,9 +189,7 @@ int main(int argc, char *argv[])
|
||||
* Catch all signals we can, and ignore the rest.
|
||||
*/
|
||||
for (i = 0; i < NSIG; i++) {
|
||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) ||
|
||||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) ||
|
||||
(i == SIGKILL))
|
||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
||||
signal(i, (void (*))die);
|
||||
else
|
||||
signal(i, SIG_IGN);
|
||||
@ -243,6 +242,9 @@ int main(int argc, char *argv[])
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (strcmp(pw->pw_name, "mbse"))
|
||||
Fatal((char *)"You are not user 'mbse'");
|
||||
|
||||
if (do_stat) {
|
||||
rc = outstat();
|
||||
if (rc)
|
||||
@ -330,16 +332,24 @@ int main(int argc, char *argv[])
|
||||
if (file_exist(argv[4], R_OK) != 0)
|
||||
Fatal((char *)"File doesn't exist");
|
||||
|
||||
if (attach(*addr, argv[4], LEAVE, flavor)) {
|
||||
cmd = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(cmd, "%s/%d.%d.%d.%d/.filelist", CFG.out_queue, addr->zone, addr->net, addr->node, addr->point);
|
||||
mkdirs(cmd, 0750);
|
||||
if ((fl = fopen(cmd, "a+")) == NULL) {
|
||||
Fatal((char *)"File attach failed");
|
||||
} else {
|
||||
fprintf(fl, "%c LEAVE %s\n", flavor, argv[4]);
|
||||
Syslog('+', "File attach %s is successfull", argv[4]);
|
||||
if (!do_quiet)
|
||||
printf("File attach %s is successfull", argv[4]);
|
||||
CreateSema((char *)"scanout");
|
||||
CreateSema((char *)"mailin");
|
||||
tidy_faddr(addr);
|
||||
fsync(fileno(fl));
|
||||
fclose(fl);
|
||||
free(cmd);
|
||||
die(0);
|
||||
} else {
|
||||
Fatal((char *)"File attach failed");
|
||||
}
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
if (do_req) {
|
||||
|
@ -146,7 +146,7 @@ sendmail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/
|
||||
tracker.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbftn.h tracker.h
|
||||
addpkt.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/dbnode.h ../lib/dbmsgs.h addpkt.h
|
||||
bwrite.o: ../config.h ../lib/libs.h ../lib/memwatch.h bwrite.h
|
||||
forward.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbtic.h ../lib/diesel.h tic.h sendmail.h rollover.h mgrutil.h forward.h dirsession.h
|
||||
forward.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbtic.h ../lib/diesel.h tic.h sendmail.h rollover.h mgrutil.h forward.h
|
||||
lhash.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h lhash.h
|
||||
mbfido.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbdupe.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbuser.h ../lib/dbftn.h ../lib/dbtic.h ../lib/msg.h flock.h tosspkt.h unpack.h tic.h fsort.h scan.h mbfido.h tracker.h notify.h rollover.h hatch.h scannews.h maketags.h makestat.h newspost.h rnews.h mgrutil.h backalias.h rfc2ftn.h dirsession.h dirlock.h queue.h
|
||||
mkftnhdr.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h atoul.h hash.h msgflags.h aliasdb.h mkftnhdr.h
|
||||
|
@ -44,14 +44,13 @@
|
||||
#include "rollover.h"
|
||||
#include "mgrutil.h"
|
||||
#include "forward.h"
|
||||
#include "dirsession.h"
|
||||
|
||||
|
||||
|
||||
void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
{
|
||||
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname, flavor;
|
||||
FILE *fp, *fi, *net;
|
||||
char *subject = NULL, *temp, *fwdfile = NULL, *queuedir, *listfile, *ticfile = NULL, fname[PATH_MAX], *ticname, flavor;
|
||||
FILE *fp, *fi, *fl, *net;
|
||||
faddr *dest, *routeto, *Fa, *Temp, *ba;
|
||||
int i, z, n;
|
||||
time_t now, ftime;
|
||||
@ -91,6 +90,19 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
}
|
||||
|
||||
fwdfile = calloc(PATH_MAX, sizeof(char));
|
||||
queuedir = calloc(PATH_MAX, sizeof(char));
|
||||
listfile = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(queuedir, "%s/%d.%d.%d.%d", CFG.out_queue, Node.zone, Node.net, Node.node, Node.point);
|
||||
sprintf(listfile, "%s/.filelist", queuedir);
|
||||
mkdirs(listfile, 0750);
|
||||
if ((fl = fopen(listfile, "a+")) == NULL) {
|
||||
WriteError("$Can't open %s", listfile);
|
||||
free(fwdfile);
|
||||
free(listfile);
|
||||
free(queuedir);
|
||||
return;
|
||||
}
|
||||
Syslog('f', "%s is open", listfile);
|
||||
|
||||
/*
|
||||
* Create the full filename
|
||||
@ -109,39 +121,13 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
if (nodes.Hold)
|
||||
flavor = 'h';
|
||||
|
||||
fprintf(fl, "%c LEAVE %s\n", flavor, fwdfile);
|
||||
|
||||
if (nodes.RouteVia.zone)
|
||||
routeto = fido2faddr(nodes.RouteVia);
|
||||
else
|
||||
routeto = fido2faddr(Node);
|
||||
dest = fido2faddr(Node);
|
||||
if (nodes.Session_out == S_DIR) {
|
||||
if (islocked(nodes.Dir_out_clock, nodes.Dir_out_chklck, nodes.Dir_out_waitclr, 'p')) {
|
||||
/*
|
||||
* Not good, should go to a queue
|
||||
*/
|
||||
attach(*routeto, fwdfile, LEAVE, flavor);
|
||||
} else {
|
||||
if (! setlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p')) {
|
||||
/*
|
||||
* Not good again
|
||||
*/
|
||||
attach(*routeto, fwdfile, LEAVE, flavor);
|
||||
} else {
|
||||
/*
|
||||
* Node locked, copy file to destination directory
|
||||
*/
|
||||
ticfile = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(ticfile, "%s/%s", nodes.Dir_out_path, subject);
|
||||
if (file_cp(fwdfile, ticfile))
|
||||
WriteError("$Can't copy %s to %s", fwdfile, ticfile);
|
||||
else
|
||||
chmod(ticfile, 0660);
|
||||
free(ticfile);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
attach(*routeto, fwdfile, LEAVE, flavor);
|
||||
}
|
||||
|
||||
ticfile = calloc(PATH_MAX, sizeof(char));
|
||||
ticname = calloc(15, sizeof(char));
|
||||
@ -149,9 +135,6 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
sprintf(ticname, "%08lx.tic", sequencer());
|
||||
subject = xstrcat(subject, (char *)" ");
|
||||
subject = xstrcat(subject, ticname);
|
||||
if (nodes.Session_out == S_DIR)
|
||||
sprintf(ticfile, "%s/%s", nodes.Dir_out_path, ticname);
|
||||
else
|
||||
sprintf(ticfile, "%s/%s", CFG.ticout, ticname);
|
||||
}
|
||||
free(ticname);
|
||||
@ -316,8 +299,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
|
||||
fprintf(fp, "Pw %s\r\n", nodes.Fpasswd);
|
||||
fclose(fp);
|
||||
if (nodes.Session_out == S_DIRECT)
|
||||
attach(*routeto, ticfile, KFS, flavor);
|
||||
fprintf(fl, "%c KFS %s\n", flavor, ticfile);
|
||||
} else {
|
||||
WriteError("$Can't create %s", ticfile);
|
||||
}
|
||||
@ -346,9 +328,8 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
WriteError("$Can't create %s", fname);
|
||||
}
|
||||
}
|
||||
|
||||
if (nodes.Session_out == S_DIR)
|
||||
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck, 'p');
|
||||
fsync(fileno(fl));
|
||||
fclose(fl);
|
||||
|
||||
/*
|
||||
* Update the nodes statistic counters
|
||||
@ -359,6 +340,8 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
SearchNode(Node);
|
||||
free(ticfile);
|
||||
free(fwdfile);
|
||||
free(queuedir);
|
||||
free(listfile);
|
||||
tidy_faddr(routeto);
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,10 @@ static char *dow[] = {(char *)"su", (char *)"mo", (char *)"tu", (char *)"we",
|
||||
extern int do_quiet;
|
||||
|
||||
|
||||
/*
|
||||
* Flush one queue directory of a node. If everything is successfull the
|
||||
* directory will become empty.
|
||||
*/
|
||||
void flush_dir(char *);
|
||||
void flush_dir(char *ndir)
|
||||
{
|
||||
@ -58,9 +62,9 @@ void flush_dir(char *ndir)
|
||||
FILE *fp, *inf, *ouf;
|
||||
faddr noden, *bestaka;
|
||||
fidoaddr nodenr;
|
||||
int flavor, Attach, fage, first, bread;
|
||||
int flavor, mode, Attach, fage, first, bread, rc;
|
||||
long fsize;
|
||||
char *temp, *fname, *arcfile, *pktfile, *ext, maxnr, nr, oldnr, *buf;
|
||||
char *p, *temp, *fname, *arcfile, *pktfile, *ext, maxnr, nr, oldnr, *buf;
|
||||
time_t Now;
|
||||
struct tm *ptm;
|
||||
struct stat sbuf;
|
||||
@ -192,7 +196,7 @@ void flush_dir(char *ndir)
|
||||
Syslog('p', "Arcmail file %s", arcfile);
|
||||
|
||||
/*
|
||||
* If a not finished .pkt file exist, close it first and rename it.
|
||||
* If there is a mailpkt.qqq file, close it and rename it.
|
||||
*/
|
||||
pktfile = calloc(PATH_MAX, sizeof(char));
|
||||
fname = calloc(PATH_MAX, sizeof(char));
|
||||
@ -487,8 +491,70 @@ void flush_dir(char *ndir)
|
||||
}
|
||||
Syslog('p', "Done with netmail");
|
||||
|
||||
// Add files
|
||||
/*
|
||||
* Now add the files for the node, information is in the .filelist
|
||||
* file, this tells the location of the file and what to do with
|
||||
* it after it is sent.
|
||||
*/
|
||||
sprintf(pktfile, "%s/.filelist", temp);
|
||||
if ((fp = fopen(pktfile, "r")) != NULL) {
|
||||
|
||||
Syslog('+', "Adding files for %s, via %s", aka2str(nodenr), ascfnode(&noden, 0x1f));
|
||||
if (!do_quiet) {
|
||||
printf("\rAdding files for %s ", ascfnode(&noden, 0x1f));
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
buf = calloc(PATH_MAX + 1, sizeof(char));
|
||||
|
||||
while (fgets(buf, PATH_MAX, fp)) {
|
||||
Striplf(buf);
|
||||
Syslog('p', "File: %s", buf);
|
||||
flavor = buf[0];
|
||||
p = strchr(buf, ' ');
|
||||
p++;
|
||||
if (strncmp(p, "LEAVE ", 6) == 0)
|
||||
mode = LEAVE;
|
||||
else if (strncmp(p, "KFS ", 4) == 0)
|
||||
mode = KFS;
|
||||
else if (strncmp(p, "TFS ", 4) == 0)
|
||||
mode = TFS;
|
||||
else {
|
||||
WriteError("Syntax error in filelist \"%s\"", buf);
|
||||
mode = LEAVE;
|
||||
}
|
||||
p = strchr(p, ' ');
|
||||
p++;
|
||||
|
||||
Syslog('+', "File attach %s", p);
|
||||
if (nodes.Session_out == S_DIRECT) {
|
||||
attach(noden, p, mode, flavor);
|
||||
} else if (nodes.Session_out == S_DIR) {
|
||||
sprintf(arcfile, "%s/%s", nodes.Dir_out_path, basename(p));
|
||||
if (mode == LEAVE) {
|
||||
/*
|
||||
* LEAVE file, so we copy this one.
|
||||
*/
|
||||
rc = file_cp(p, arcfile);
|
||||
Syslog('p', "file_cp(%s, %s) rc=%d", p, arcfile, rc);
|
||||
} else {
|
||||
/*
|
||||
* KFS or TFS, move file to node directory
|
||||
*/
|
||||
rc = file_mv(p, arcfile);
|
||||
Syslog('p', "file_mv(%s, %s) rc=%d", p, arcfile, rc);
|
||||
}
|
||||
chmod(arcfile, 0660);
|
||||
}
|
||||
|
||||
Syslog('p', "%c %d %s", flavor, mode, pktfile);
|
||||
|
||||
}
|
||||
|
||||
free(buf);
|
||||
fclose(fp);
|
||||
unlink(pktfile);
|
||||
}
|
||||
|
||||
/*
|
||||
* We are done, the queue is flushed, unlock the node.
|
||||
|
@ -783,7 +783,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
|
||||
{
|
||||
char *p, *q, ext[4], fromname[37], flavor, MailFrom[128], MailTo[128];
|
||||
int i, rc, flags = 0, first, is_fmpt = FALSE, is_topt = FALSE, is_intl = FALSE;
|
||||
FILE *qp, *fp;
|
||||
FILE *qp, *fp, *fl;
|
||||
fidoaddr Dest, Route, *dest;
|
||||
time_t now;
|
||||
struct tm *tm;
|
||||
@ -1041,12 +1041,22 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
|
||||
flavor = 'f';
|
||||
|
||||
ta = parsefnode(Msg.ToAddress);
|
||||
if (strlen(CFG.dospath)) {
|
||||
rc = attach(*ta, Dos2Unix(Msg.Subject), LEAVE, flavor);
|
||||
Syslog('+', "FileAttach %s %s", Dos2Unix(Msg.Subject), rc ? "Success":"Failed");
|
||||
p = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(p, "%s/%d.%d.%d.%d/.filelist", CFG.out_queue, ta->zone, ta->net, ta->node, ta->point);
|
||||
mkdirs(p, 0750);
|
||||
|
||||
if ((fl = fopen(p, "a+")) == NULL) {
|
||||
WriteError("$Can't open %s", p);
|
||||
} else {
|
||||
rc = attach(*ta, Msg.Subject, LEAVE, flavor);
|
||||
Syslog('+', "FileAttach %s %s", Msg.Subject, rc ? "Success":"Failed");
|
||||
if (strlen(CFG.dospath)) {
|
||||
fprintf(fl, "%c LEAVE %s\n", flavor, Dos2Unix(Msg.Subject));
|
||||
Syslog('+', "FileAttach %s", Dos2Unix(Msg.Subject));
|
||||
} else {
|
||||
fprintf(fl, "%c LEAVE %s\n", flavor, Msg.Subject);
|
||||
Syslog('+', "FileAttach %s", Msg.Subject);
|
||||
}
|
||||
fsync(fileno(fl));
|
||||
fclose(fl);
|
||||
}
|
||||
tidy_faddr(ta);
|
||||
}
|
||||
|
@ -310,9 +310,9 @@ void e_global(void)
|
||||
case 8: E_PTH(13,16,64, CFG.outbound, "The path to the base ^outbound^ directory.", 0750)
|
||||
case 9: E_PTH(14,16,64, CFG.out_queue, "The path to the ^temp outbound queue^ directory.", 0750)
|
||||
case 10:E_PTH(15,16,64, CFG.msgs_path, "The path to the ^*.msgs^ directory.", 0750)
|
||||
case 12:E_PTH(16,16,64, CFG.badtic, "The path to the ^bad tic files^.", 0750)
|
||||
case 13:E_PTH(17,16,64, CFG.ticout, "The path to the ^outgoing TIC^ files.", 0750)
|
||||
case 14:e_global2();
|
||||
case 11:E_PTH(16,16,64, CFG.badtic, "The path to the ^bad tic files^.", 0750)
|
||||
case 12:E_PTH(17,16,64, CFG.ticout, "The path to the ^outgoing TIC^ files.", 0750)
|
||||
case 13:e_global2();
|
||||
s_global();
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user