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
|
||||
|
382
mbcico/mbout.c
382
mbcico/mbout.c
@ -168,200 +168,210 @@ void Fatal(char *msg)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *cmd, flavor = 'x';
|
||||
int i, j, rc = 0;
|
||||
struct passwd *pw;
|
||||
faddr *addr = NULL;
|
||||
node *nlent;
|
||||
char *cmd, flavor = 'x';
|
||||
int i, j, rc = 0;
|
||||
struct passwd *pw;
|
||||
faddr *addr = NULL;
|
||||
node *nlent;
|
||||
FILE *fl;
|
||||
|
||||
#ifdef MEMWATCH
|
||||
mwInit();
|
||||
mwInit();
|
||||
#endif
|
||||
InitConfig();
|
||||
InitNode();
|
||||
InitFidonet();
|
||||
TermInit(1);
|
||||
t_start = time(NULL);
|
||||
umask(002);
|
||||
InitConfig();
|
||||
InitNode();
|
||||
InitFidonet();
|
||||
TermInit(1);
|
||||
t_start = time(NULL);
|
||||
umask(002);
|
||||
|
||||
/*
|
||||
* 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))
|
||||
signal(i, (void (*))die);
|
||||
else
|
||||
signal(i, SIG_IGN);
|
||||
}
|
||||
|
||||
if(argc < 2)
|
||||
Help();
|
||||
|
||||
cmd = xstrcpy((char *)"Command line: mbout");
|
||||
|
||||
if (argc > 1) {
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[1]);
|
||||
|
||||
if (!strncasecmp(argv[1], "a", 1))
|
||||
do_attach = TRUE;
|
||||
if (!strncasecmp(argv[1], "n", 1))
|
||||
do_node = TRUE;
|
||||
if (!strncasecmp(argv[1], "p", 1))
|
||||
do_poll = TRUE;
|
||||
if (!strncasecmp(argv[1], "req", 3))
|
||||
do_req = TRUE;
|
||||
if (!strncasecmp(argv[1], "res", 3))
|
||||
do_reset = TRUE;
|
||||
if (!strncasecmp(argv[1], "sta", 3))
|
||||
do_stat = TRUE;
|
||||
if (!strncasecmp(argv[1], "sto", 3))
|
||||
do_stop = TRUE;
|
||||
}
|
||||
|
||||
for (i = 2; i < argc; i++) {
|
||||
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
|
||||
if (!strncasecmp(argv[i], "-q", 2))
|
||||
do_quiet = TRUE;
|
||||
}
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbout", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log);
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBOUT v%s", VERSION);
|
||||
Syslog(' ', cmd);
|
||||
free(cmd);
|
||||
|
||||
if (!do_quiet) {
|
||||
colour(3, 0);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (do_stat) {
|
||||
rc = outstat();
|
||||
if (rc)
|
||||
rc += 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get node number from commandline
|
||||
*/
|
||||
if (do_attach || do_node || do_poll || do_stop || do_req || do_reset) {
|
||||
if (argc < 3)
|
||||
Fatal((char *)"Not enough parameters");
|
||||
}
|
||||
|
||||
if (do_attach || do_node || do_req || do_reset) {
|
||||
if ((addr = parsefaddr(argv[2])) == NULL)
|
||||
Fatal((char *)"Unrecognizable address");
|
||||
}
|
||||
|
||||
if (do_node) {
|
||||
rc = nlinfo(addr);
|
||||
tidy_faddr(addr);
|
||||
if (rc)
|
||||
rc += 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
if (do_poll || do_stop) {
|
||||
for (i = 3; i <= argc; i++) {
|
||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||
if ((addr = parsefaddr(argv[i-1])) == NULL)
|
||||
Fatal((char *)"Unrecognizable address");
|
||||
j = poll(addr, do_stop);
|
||||
tidy_faddr(addr);
|
||||
if (j > rc)
|
||||
rc = j;
|
||||
}
|
||||
}
|
||||
if (rc)
|
||||
rc = 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
if (do_reset) {
|
||||
for (i = 3; i <= argc; i++) {
|
||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||
if ((addr = parsefaddr(argv[i-1])) == NULL)
|
||||
Fatal((char *)"Unrecognizable address");
|
||||
j = reset(addr);
|
||||
tidy_faddr(addr);
|
||||
if (j > rc)
|
||||
rc = j;
|
||||
}
|
||||
}
|
||||
if (rc)
|
||||
rc = 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
if (do_attach) {
|
||||
if (argc < 5)
|
||||
Fatal((char *)"Not enough parameters");
|
||||
flavor = tolower(argv[3][0]);
|
||||
switch (flavor) {
|
||||
case 'n' : flavor = 'f'; break;
|
||||
case 'i' : flavor = 'i'; break;
|
||||
case 'c' : flavor = 'c'; break;
|
||||
case 'h' : flavor = 'h'; break;
|
||||
default : Fatal((char *)"Invalid flavor, must be: immediate, crash, normal or hold");
|
||||
}
|
||||
|
||||
nlent = getnlent(addr);
|
||||
if (nlent->pflag == NL_DUMMY)
|
||||
Fatal((char *)"Node is not in nodelist");
|
||||
if (nlent->pflag == NL_DOWN)
|
||||
Fatal((char *)"Node has status Down");
|
||||
if (nlent->pflag == NL_HOLD)
|
||||
Fatal((char *)"Node has status Hold");
|
||||
if (((nlent->oflags & OL_CM) == 0) && (flavor == 'c'))
|
||||
Fatal((char *)"Node is not CM, must use Immediate, Normal or Hold flavor");
|
||||
|
||||
if (argv[4][0] == '-')
|
||||
Fatal((char *)"Invalid filename given");
|
||||
if (file_exist(argv[4], R_OK) != 0)
|
||||
Fatal((char *)"File doesn't exist");
|
||||
|
||||
if (attach(*addr, argv[4], LEAVE, flavor)) {
|
||||
Syslog('+', "File attach %s is successfull", argv[4]);
|
||||
if (!do_quiet)
|
||||
printf("File attach %s is successfull", argv[4]);
|
||||
CreateSema((char *)"scanout");
|
||||
tidy_faddr(addr);
|
||||
die(0);
|
||||
} else {
|
||||
Fatal((char *)"File attach failed");
|
||||
}
|
||||
}
|
||||
|
||||
if (do_req) {
|
||||
if (argc < 4)
|
||||
Fatal((char *)"Not enough parameters");
|
||||
for (i = 4; i <= argc; i++) {
|
||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||
rc = freq(addr, argv[i-1]);
|
||||
if (rc)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rc)
|
||||
rc += 100;
|
||||
die(rc);
|
||||
}
|
||||
/*
|
||||
* 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))
|
||||
signal(i, (void (*))die);
|
||||
else
|
||||
signal(i, SIG_IGN);
|
||||
}
|
||||
|
||||
if(argc < 2)
|
||||
Help();
|
||||
|
||||
cmd = xstrcpy((char *)"Command line: mbout");
|
||||
|
||||
if (argc > 1) {
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[1]);
|
||||
|
||||
if (!strncasecmp(argv[1], "a", 1))
|
||||
do_attach = TRUE;
|
||||
if (!strncasecmp(argv[1], "n", 1))
|
||||
do_node = TRUE;
|
||||
if (!strncasecmp(argv[1], "p", 1))
|
||||
do_poll = TRUE;
|
||||
if (!strncasecmp(argv[1], "req", 3))
|
||||
do_req = TRUE;
|
||||
if (!strncasecmp(argv[1], "res", 3))
|
||||
do_reset = TRUE;
|
||||
if (!strncasecmp(argv[1], "sta", 3))
|
||||
do_stat = TRUE;
|
||||
if (!strncasecmp(argv[1], "sto", 3))
|
||||
do_stop = TRUE;
|
||||
}
|
||||
|
||||
for (i = 2; i < argc; i++) {
|
||||
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
|
||||
if (!strncasecmp(argv[i], "-q", 2))
|
||||
do_quiet = TRUE;
|
||||
}
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbout", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log);
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBOUT v%s", VERSION);
|
||||
Syslog(' ', cmd);
|
||||
free(cmd);
|
||||
|
||||
if (!do_quiet) {
|
||||
colour(3, 0);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (strcmp(pw->pw_name, "mbse"))
|
||||
Fatal((char *)"You are not user 'mbse'");
|
||||
|
||||
if (do_stat) {
|
||||
rc = outstat();
|
||||
if (rc)
|
||||
rc += 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get node number from commandline
|
||||
*/
|
||||
if (do_attach || do_node || do_poll || do_stop || do_req || do_reset) {
|
||||
if (argc < 3)
|
||||
Fatal((char *)"Not enough parameters");
|
||||
}
|
||||
|
||||
if (do_attach || do_node || do_req || do_reset) {
|
||||
if ((addr = parsefaddr(argv[2])) == NULL)
|
||||
Fatal((char *)"Unrecognizable address");
|
||||
}
|
||||
|
||||
if (do_node) {
|
||||
rc = nlinfo(addr);
|
||||
tidy_faddr(addr);
|
||||
if (rc)
|
||||
rc += 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
if (do_poll || do_stop) {
|
||||
for (i = 3; i <= argc; i++) {
|
||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||
if ((addr = parsefaddr(argv[i-1])) == NULL)
|
||||
Fatal((char *)"Unrecognizable address");
|
||||
j = poll(addr, do_stop);
|
||||
tidy_faddr(addr);
|
||||
if (j > rc)
|
||||
rc = j;
|
||||
}
|
||||
}
|
||||
if (rc)
|
||||
rc = 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
if (do_reset) {
|
||||
for (i = 3; i <= argc; i++) {
|
||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||
if ((addr = parsefaddr(argv[i-1])) == NULL)
|
||||
Fatal((char *)"Unrecognizable address");
|
||||
j = reset(addr);
|
||||
tidy_faddr(addr);
|
||||
if (j > rc)
|
||||
rc = j;
|
||||
}
|
||||
}
|
||||
if (rc)
|
||||
rc = 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
if (do_attach) {
|
||||
if (argc < 5)
|
||||
Fatal((char *)"Not enough parameters");
|
||||
flavor = tolower(argv[3][0]);
|
||||
switch (flavor) {
|
||||
case 'n' : flavor = 'f'; break;
|
||||
case 'i' : flavor = 'i'; break;
|
||||
case 'c' : flavor = 'c'; break;
|
||||
case 'h' : flavor = 'h'; break;
|
||||
default : Fatal((char *)"Invalid flavor, must be: immediate, crash, normal or hold");
|
||||
}
|
||||
|
||||
nlent = getnlent(addr);
|
||||
if (nlent->pflag == NL_DUMMY)
|
||||
Fatal((char *)"Node is not in nodelist");
|
||||
if (nlent->pflag == NL_DOWN)
|
||||
Fatal((char *)"Node has status Down");
|
||||
if (nlent->pflag == NL_HOLD)
|
||||
Fatal((char *)"Node has status Hold");
|
||||
if (((nlent->oflags & OL_CM) == 0) && (flavor == 'c'))
|
||||
Fatal((char *)"Node is not CM, must use Immediate, Normal or Hold flavor");
|
||||
|
||||
if (argv[4][0] == '-')
|
||||
Fatal((char *)"Invalid filename given");
|
||||
if (file_exist(argv[4], R_OK) != 0)
|
||||
Fatal((char *)"File doesn't exist");
|
||||
|
||||
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 *)"mailin");
|
||||
tidy_faddr(addr);
|
||||
fsync(fileno(fl));
|
||||
fclose(fl);
|
||||
free(cmd);
|
||||
die(0);
|
||||
}
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
if (do_req) {
|
||||
if (argc < 4)
|
||||
Fatal((char *)"Not enough parameters");
|
||||
for (i = 4; i <= argc; i++) {
|
||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||
rc = freq(addr, argv[i-1]);
|
||||
if (rc)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rc)
|
||||
rc += 100;
|
||||
die(rc);
|
||||
}
|
||||
|
||||
Help();
|
||||
#ifdef MEMWATCH
|
||||
mwTerm();
|
||||
mwTerm();
|
||||
#endif
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
@ -90,7 +89,20 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
}
|
||||
}
|
||||
|
||||
fwdfile = calloc(PATH_MAX, sizeof(char));
|
||||
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,10 +135,7 @@ 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);
|
||||
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,10 +328,9 @@ 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