Implemented directory outbound queueing
This commit is contained in:
parent
ae5dd4bfbe
commit
d3cf5b2a64
@ -29,7 +29,7 @@ v0.35.03 06-Jul-2002
|
|||||||
Added routing tables for special cases. Most systems don't
|
Added routing tables for special cases. Most systems don't
|
||||||
need this.
|
need this.
|
||||||
The route test command now works exactly as netmails do.
|
The route test command now works exactly as netmails do.
|
||||||
Implemented directory inbound tossing.
|
Implemented directory inbound tossing and outbound queueing.
|
||||||
|
|
||||||
newuser:
|
newuser:
|
||||||
Check for Unix accounts is now case sensitive.
|
Check for Unix accounts is now case sensitive.
|
||||||
|
@ -140,13 +140,13 @@ flock.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h flock.h
|
|||||||
hatch.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/dbtic.h utic.h rollover.h hatch.h
|
hatch.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/dbtic.h utic.h rollover.h hatch.h
|
||||||
mbdiff.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 mbdiff.h
|
mbdiff.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 mbdiff.h
|
||||||
mgrutil.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/diesel.h sendmail.h rollover.h addpkt.h pack.h createm.h createf.h mgrutil.h
|
mgrutil.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/diesel.h sendmail.h rollover.h addpkt.h pack.h createm.h createf.h mgrutil.h
|
||||||
pack.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbftn.h ../lib/clcomm.h ../lib/dbnode.h pack.h
|
pack.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbftn.h ../lib/clcomm.h ../lib/dbnode.h dirsession.h pack.h
|
||||||
ptic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbtic.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbdupe.h ulock.h mover.h toberep.h tic.h utic.h addbbs.h magic.h forward.h rollover.h ptic.h magic.h createf.h virscan.h
|
ptic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbtic.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbdupe.h ulock.h mover.h toberep.h tic.h utic.h addbbs.h magic.h forward.h rollover.h ptic.h magic.h createf.h virscan.h
|
||||||
sendmail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ../lib/dbmsgs.h addpkt.h rollover.h sendmail.h
|
sendmail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ../lib/dbmsgs.h addpkt.h rollover.h sendmail.h
|
||||||
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
|
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 pack.h addpkt.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 pack.h addpkt.h
|
||||||
bwrite.o: ../config.h ../lib/libs.h ../lib/memwatch.h bwrite.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
|
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
|
||||||
lhash.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h lhash.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 pack.h ulock.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
|
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 pack.h ulock.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
|
||||||
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
|
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
|
||||||
|
@ -45,7 +45,6 @@ extern int do_unprot;
|
|||||||
/*
|
/*
|
||||||
* Check for lock, return TRUE if node is locked.
|
* Check for lock, return TRUE if node is locked.
|
||||||
*/
|
*/
|
||||||
int islocked(char *, int, int);
|
|
||||||
int islocked(char *lockfile, int chklck, int waitclr)
|
int islocked(char *lockfile, int chklck, int waitclr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -104,7 +103,6 @@ int islocked(char *lockfile, int chklck, int waitclr)
|
|||||||
* Create a 1 byte lockfile if create is TRUE.
|
* Create a 1 byte lockfile if create is TRUE.
|
||||||
* Returns FALSE if failed.
|
* Returns FALSE if failed.
|
||||||
*/
|
*/
|
||||||
int setlock(char *, int);
|
|
||||||
int setlock(char *lockfile, int create)
|
int setlock(char *lockfile, int create)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -130,7 +128,6 @@ int setlock(char *lockfile, int create)
|
|||||||
/*
|
/*
|
||||||
* Removing lockfile
|
* Removing lockfile
|
||||||
*/
|
*/
|
||||||
void remlock(char *, int);
|
|
||||||
void remlock(char *lockfile, int create)
|
void remlock(char *lockfile, int create)
|
||||||
{
|
{
|
||||||
if (create) {
|
if (create) {
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
|
||||||
void dirinbound(void);
|
int islocked(char *, int, int); /* Is directory locked */
|
||||||
|
int setlock(char *, int); /* Lock directory */
|
||||||
|
void remlock(char *, int); /* Unlock directory */
|
||||||
|
void dirinbound(void); /* Process nodes */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,15 +44,14 @@
|
|||||||
#include "rollover.h"
|
#include "rollover.h"
|
||||||
#include "mgrutil.h"
|
#include "mgrutil.h"
|
||||||
#include "forward.h"
|
#include "forward.h"
|
||||||
|
#include "dirsession.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ForwardFile(fidoaddr Node, fa_list *sbl)
|
void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||||
{
|
{
|
||||||
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname;
|
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname, flavor;
|
||||||
FILE *fp, *fi, *net;
|
FILE *fp, *fi, *net;
|
||||||
char flavor;
|
|
||||||
faddr *dest, *routeto, *Fa, *Temp, *ba;
|
faddr *dest, *routeto, *Fa, *Temp, *ba;
|
||||||
int i, z, n;
|
int i, z, n;
|
||||||
time_t now, ftime;
|
time_t now, ftime;
|
||||||
@ -92,6 +91,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fwdfile = calloc(PATH_MAX, sizeof(char));
|
fwdfile = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the full filename
|
* Create the full filename
|
||||||
*/
|
*/
|
||||||
@ -114,7 +114,34 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
|||||||
else
|
else
|
||||||
routeto = fido2faddr(Node);
|
routeto = fido2faddr(Node);
|
||||||
dest = 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)) {
|
||||||
|
/*
|
||||||
|
* Not good, should go to a queue
|
||||||
|
*/
|
||||||
attach(*routeto, fwdfile, LEAVE, flavor);
|
attach(*routeto, fwdfile, LEAVE, flavor);
|
||||||
|
} else {
|
||||||
|
if (! setlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck)) {
|
||||||
|
/*
|
||||||
|
* 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));
|
ticfile = calloc(PATH_MAX, sizeof(char));
|
||||||
ticname = calloc(15, sizeof(char));
|
ticname = calloc(15, sizeof(char));
|
||||||
@ -122,6 +149,9 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
|||||||
sprintf(ticname, "%08lx.tic", sequencer());
|
sprintf(ticname, "%08lx.tic", sequencer());
|
||||||
subject = xstrcat(subject, (char *)" ");
|
subject = xstrcat(subject, (char *)" ");
|
||||||
subject = xstrcat(subject, ticname);
|
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);
|
sprintf(ticfile, "%s/%s", CFG.ticout, ticname);
|
||||||
}
|
}
|
||||||
free(ticname);
|
free(ticname);
|
||||||
@ -229,8 +259,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
|||||||
subject = ctime(&now);
|
subject = ctime(&now);
|
||||||
Striplf(subject);
|
Striplf(subject);
|
||||||
ba = bestaka_s(dest);
|
ba = bestaka_s(dest);
|
||||||
fprintf(fp, "Path %s %lu %s %s\r\n", ascfnode(ba, 0x1f),
|
fprintf(fp, "Path %s %lu %s %s\r\n", ascfnode(ba, 0x1f), mktime(localtime(&now)), subject, tzname[0]);
|
||||||
mktime(localtime(&now)), subject, tzname[0]);
|
|
||||||
tidy_faddr(ba);
|
tidy_faddr(ba);
|
||||||
|
|
||||||
if (nodes.AdvTic) {
|
if (nodes.AdvTic) {
|
||||||
@ -287,6 +316,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
|||||||
|
|
||||||
fprintf(fp, "Pw %s\r\n", nodes.Fpasswd);
|
fprintf(fp, "Pw %s\r\n", nodes.Fpasswd);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
if (nodes.Session_out == S_DIRECT)
|
||||||
attach(*routeto, ticfile, KFS, flavor);
|
attach(*routeto, ticfile, KFS, flavor);
|
||||||
} else {
|
} else {
|
||||||
WriteError("$Can't create %s", ticfile);
|
WriteError("$Can't create %s", ticfile);
|
||||||
@ -317,6 +347,9 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodes.Session_out == S_DIR)
|
||||||
|
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the nodes statistic counters
|
* Update the nodes statistic counters
|
||||||
*/
|
*/
|
||||||
|
128
mbfido/pack.c
128
mbfido/pack.c
@ -38,12 +38,17 @@
|
|||||||
#include "../lib/dbftn.h"
|
#include "../lib/dbftn.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
|
#include "dirsession.h"
|
||||||
#include "pack.h"
|
#include "pack.h"
|
||||||
|
|
||||||
|
|
||||||
extern int do_quiet; /* Quiet flag */
|
extern int do_quiet; /* Quiet flag */
|
||||||
|
|
||||||
|
|
||||||
|
static char *dow[] = {(char *)"su", (char *)"mo", (char *)"tu", (char *)"we",
|
||||||
|
(char *)"th", (char *)"fr", (char *)"sa"};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pack queued arcmail mail for a node. If the node is locked, the mail won't
|
* Pack queued arcmail mail for a node. If the node is locked, the mail won't
|
||||||
* be packed, and the queue stays as it is. The mail will then be packed
|
* be packed, and the queue stays as it is. The mail will then be packed
|
||||||
@ -52,13 +57,13 @@ extern int do_quiet; /* Quiet flag */
|
|||||||
int pack_queue(char *name)
|
int pack_queue(char *name)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
faddr noden;
|
faddr noden, *bestaka;
|
||||||
fidoaddr nodenr;
|
fidoaddr nodenr;
|
||||||
char flavor, nr, oldnr, maxnr;
|
char flavor, nr, oldnr, maxnr, *ext, srcfile[128], *arcfile, *pktfile;
|
||||||
char srcfile[128], *arcfile, *pktfile;
|
|
||||||
int Attach, fage;
|
int Attach, fage;
|
||||||
long fsize;
|
long fsize;
|
||||||
time_t Now;
|
time_t Now;
|
||||||
|
struct tm *ptm;
|
||||||
|
|
||||||
sprintf(srcfile, "%s", name);
|
sprintf(srcfile, "%s", name);
|
||||||
|
|
||||||
@ -132,10 +137,62 @@ int pack_queue(char *name)
|
|||||||
* Generate ARCmail filename and .PKT filename,
|
* Generate ARCmail filename and .PKT filename,
|
||||||
*/
|
*/
|
||||||
arcfile = calloc(PATH_MAX, sizeof(char));
|
arcfile = calloc(PATH_MAX, sizeof(char));
|
||||||
|
if (nodes.Session_out == S_DIR) {
|
||||||
|
|
||||||
|
Now = time(NULL);
|
||||||
|
ptm = localtime(&Now);
|
||||||
|
ext = dow[ptm->tm_wday];
|
||||||
|
|
||||||
|
if (!nodes.ARCmailCompat && (nodes.Aka[0].zone != noden.zone)) {
|
||||||
|
/*
|
||||||
|
* Generate ARCfile name from the CRC of the ASCII string
|
||||||
|
* of the node address.
|
||||||
|
*/
|
||||||
|
sprintf(arcfile, "%s/%08lx.%s0", nodes.Dir_out_path, StringCRC32(ascfnode(&noden, 0x1f)), ext);
|
||||||
|
} else {
|
||||||
|
bestaka = bestaka_s(&noden);
|
||||||
|
|
||||||
|
if (noden.point) {
|
||||||
|
sprintf(arcfile, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff,
|
||||||
|
((bestaka->node) - (noden.node) + (noden.point)) & 0xffff, ext);
|
||||||
|
} else if (bestaka->point) {
|
||||||
|
/*
|
||||||
|
* Inserted the next code for if we are a point,
|
||||||
|
* I hope this is ARCmail 0.60 compliant. 21-May-1999
|
||||||
|
*/
|
||||||
|
sprintf(arcfile, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff,
|
||||||
|
((bestaka->node) - (noden.node) - (bestaka->point)) & 0xffff, ext);
|
||||||
|
} else {
|
||||||
|
sprintf(arcfile, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff,
|
||||||
|
((bestaka->node) - (noden.node)) &0xffff, ext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Syslog('m', "Arcmail file %s", arcfile);
|
||||||
|
} else {
|
||||||
sprintf(arcfile, "%s", arcname(&noden, nodes.Aka[0].zone, nodes.ARCmailCompat));
|
sprintf(arcfile, "%s", arcname(&noden, nodes.Aka[0].zone, nodes.ARCmailCompat));
|
||||||
|
}
|
||||||
pktfile = calloc(40, sizeof(char));
|
pktfile = calloc(40, sizeof(char));
|
||||||
sprintf(pktfile, "%08lx.pkt", sequencer());
|
sprintf(pktfile, "%08lx.pkt", sequencer());
|
||||||
|
|
||||||
|
if (nodes.Session_out == S_DIR) {
|
||||||
|
if (islocked(nodes.Dir_out_clock, nodes.Dir_out_chklck, nodes.Dir_out_waitclr)) {
|
||||||
|
Syslog('+', "Mail stays in queue, will be added later");
|
||||||
|
if (noden.domain)
|
||||||
|
free(noden.domain);
|
||||||
|
free(arcfile);
|
||||||
|
free(pktfile);
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
if (! setlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck)) {
|
||||||
|
Syslog('+', "Mail stays in queue, will be added later");
|
||||||
|
if (noden.domain)
|
||||||
|
free(noden.domain);
|
||||||
|
free(arcfile);
|
||||||
|
free(pktfile);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (nodelock(&noden)) {
|
if (nodelock(&noden)) {
|
||||||
Syslog('+', "Mail stays in queue, will be added later");
|
Syslog('+', "Mail stays in queue, will be added later");
|
||||||
if (noden.domain)
|
if (noden.domain)
|
||||||
@ -144,9 +201,13 @@ int pack_queue(char *name)
|
|||||||
free(pktfile);
|
free(pktfile);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rename(srcfile, pktfile)) {
|
if (rename(srcfile, pktfile)) {
|
||||||
WriteError("$Can't rename %s to %s", srcfile, pktfile);
|
WriteError("$Can't rename %s to %s", srcfile, pktfile);
|
||||||
|
if (nodes.Session_out == S_DIR)
|
||||||
|
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck);
|
||||||
|
else
|
||||||
nodeulock(&noden);
|
nodeulock(&noden);
|
||||||
if (noden.domain)
|
if (noden.domain)
|
||||||
free(noden.domain);
|
free(noden.domain);
|
||||||
@ -160,6 +221,9 @@ int pack_queue(char *name)
|
|||||||
*/
|
*/
|
||||||
if ((fp = fopen(pktfile, "a+")) == NULL) {
|
if ((fp = fopen(pktfile, "a+")) == NULL) {
|
||||||
WriteError("$Can't open %s", pktfile);
|
WriteError("$Can't open %s", pktfile);
|
||||||
|
if (nodes.Session_out == S_DIR)
|
||||||
|
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck);
|
||||||
|
else
|
||||||
nodeulock(&noden);
|
nodeulock(&noden);
|
||||||
if (noden.domain)
|
if (noden.domain)
|
||||||
free(noden.domain);
|
free(noden.domain);
|
||||||
@ -260,12 +324,22 @@ int pack_queue(char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodes.Session_out == S_DIR) {
|
||||||
/*
|
/*
|
||||||
* Attach file to .flo
|
* Change filemode so downlink has rights to the file.
|
||||||
*/
|
*/
|
||||||
if (Attach)
|
chmod(arcfile, 0660);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Attach file to .flo, not for FTP or Directory sessions.
|
||||||
|
*/
|
||||||
|
if (Attach && nodes.Session_out == S_DIRECT)
|
||||||
attach(noden, arcfile, TFS, flavor);
|
attach(noden, arcfile, TFS, flavor);
|
||||||
|
|
||||||
|
if (nodes.Session_out == S_DIR)
|
||||||
|
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck);
|
||||||
|
else
|
||||||
nodeulock(&noden);
|
nodeulock(&noden);
|
||||||
if (noden.domain)
|
if (noden.domain)
|
||||||
free(noden.domain);
|
free(noden.domain);
|
||||||
@ -283,9 +357,7 @@ int pack_queue(char *name)
|
|||||||
int add_queue(char *name)
|
int add_queue(char *name)
|
||||||
{
|
{
|
||||||
faddr noden;
|
faddr noden;
|
||||||
char flavor;
|
char flavor, srcfile[128], *outfile, *buf;
|
||||||
char srcfile[128], *outfile;
|
|
||||||
char *buf;
|
|
||||||
FILE *inf, *ouf;
|
FILE *inf, *ouf;
|
||||||
int bread;
|
int bread;
|
||||||
|
|
||||||
@ -309,7 +381,7 @@ int add_queue(char *name)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
outfile = calloc(128, sizeof(char));
|
outfile = calloc(PATH_MAX, sizeof(char));
|
||||||
if (strstr(srcfile, ".iii"))
|
if (strstr(srcfile, ".iii"))
|
||||||
flavor = 'i';
|
flavor = 'i';
|
||||||
else if (strstr(srcfile, ".ccc"))
|
else if (strstr(srcfile, ".ccc"))
|
||||||
@ -318,9 +390,33 @@ int add_queue(char *name)
|
|||||||
flavor = 'h';
|
flavor = 'h';
|
||||||
else
|
else
|
||||||
flavor = 'f';
|
flavor = 'f';
|
||||||
|
if (nodes.Session_out == S_DIR) {
|
||||||
|
if (flavor == 'f')
|
||||||
|
flavor = 'o';
|
||||||
|
if (noden.point)
|
||||||
|
sprintf(outfile, "%s/%08x.%cut", nodes.Dir_out_path, noden.point, flavor);
|
||||||
|
else
|
||||||
|
sprintf(outfile, "%s/%04x%04x.%cut", nodes.Dir_out_path, noden.net, noden.node, flavor);
|
||||||
|
} else {
|
||||||
sprintf(outfile, "%s", pktname(&noden, flavor));
|
sprintf(outfile, "%s", pktname(&noden, flavor));
|
||||||
|
}
|
||||||
Syslog('p', "Outfile: %s", outfile);
|
Syslog('p', "Outfile: %s", outfile);
|
||||||
|
|
||||||
|
if (nodes.Session_out == S_DIR) {
|
||||||
|
if (islocked(nodes.Dir_out_clock, nodes.Dir_out_chklck, nodes.Dir_out_waitclr)) {
|
||||||
|
Syslog('+', "Mail stays in queue, will be added later");
|
||||||
|
if (noden.domain)
|
||||||
|
free(noden.domain);
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
if (! setlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck)) {
|
||||||
|
Syslog('+', "Mail stays in queue, will be added later");
|
||||||
|
if (noden.domain)
|
||||||
|
free(noden.domain);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (nodelock(&noden)) {
|
if (nodelock(&noden)) {
|
||||||
Syslog('+', "Mail stays in queue, will be added later");
|
Syslog('+', "Mail stays in queue, will be added later");
|
||||||
free(outfile);
|
free(outfile);
|
||||||
@ -328,6 +424,7 @@ int add_queue(char *name)
|
|||||||
free(noden.domain);
|
free(noden.domain);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now we must see if there is already mail in the outbound.
|
* Now we must see if there is already mail in the outbound.
|
||||||
@ -366,6 +463,16 @@ int add_queue(char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodes.Session_out == S_DIR) {
|
||||||
|
/*
|
||||||
|
* Change filemode so downlink has rights to the file.
|
||||||
|
*/
|
||||||
|
chmod(outfile, 0660);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nodes.Session_out == S_DIR)
|
||||||
|
remlock(nodes.Dir_out_mlock, nodes.Dir_out_mklck);
|
||||||
|
else
|
||||||
nodeulock(&noden);
|
nodeulock(&noden);
|
||||||
if (noden.domain)
|
if (noden.domain)
|
||||||
free(noden.domain);
|
free(noden.domain);
|
||||||
@ -415,8 +522,7 @@ void packmail()
|
|||||||
while ((de = readdir(dp))) {
|
while ((de = readdir(dp))) {
|
||||||
if (strstr(de->d_name, ".qqq"))
|
if (strstr(de->d_name, ".qqq"))
|
||||||
pack_queue(de->d_name);
|
pack_queue(de->d_name);
|
||||||
if (strstr(de->d_name, ".nnn") || strstr(de->d_name, ".iii") ||
|
if (strstr(de->d_name, ".nnn") || strstr(de->d_name, ".iii") || strstr(de->d_name, ".ccc") || strstr(de->d_name, ".hhh"))
|
||||||
strstr(de->d_name, ".ccc") || strstr(de->d_name, ".hhh"))
|
|
||||||
add_queue(de->d_name);
|
add_queue(de->d_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user