Changed all error return codes
This commit is contained in:
parent
1d819c9201
commit
02a1621f62
@ -8,6 +8,8 @@ v0.35.05 19-Oct-2002
|
|||||||
|
|
||||||
general:
|
general:
|
||||||
This may become release 0.36.00
|
This may become release 0.36.00
|
||||||
|
There is now a mberrors.h file that defines all errorcodes
|
||||||
|
returned by all programs.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
14
lib/Makefile
14
lib/Makefile
@ -33,7 +33,7 @@ DIESEL_OBJS = diesel.o mbdiesel.o
|
|||||||
MEMWATCH_SRCS = memwatch.c
|
MEMWATCH_SRCS = memwatch.c
|
||||||
MEMWATCH_OBJS = memwatch.o
|
MEMWATCH_OBJS = memwatch.o
|
||||||
MEMWATCH_HDRS = memwatch.h
|
MEMWATCH_HDRS = memwatch.h
|
||||||
OTHER_HDRS = ansi.h bluewave.h libs.h mbse.h records.h structs.h users.h
|
OTHER_HDRS = ansi.h bluewave.h libs.h mbse.h records.h structs.h users.h mberrors.h
|
||||||
SRCS = ${CLCOMM_SRCS} ${COMMON_SRCS} ${DBASE_SRCS} ${MSGBASE_SRCS} ${MBINET_SRCS} \
|
SRCS = ${CLCOMM_SRCS} ${COMMON_SRCS} ${DBASE_SRCS} ${MSGBASE_SRCS} ${MBINET_SRCS} \
|
||||||
${DIESEL_SRCS} ${MEMWATCH_SRCS}
|
${DIESEL_SRCS} ${MEMWATCH_SRCS}
|
||||||
OBJS = ${CLCOMM_OBJS} ${COMMON_OBJS} ${DBASE_OBJS} ${MSGBASE_OBJS} ${MBINET_OBJS} \
|
OBJS = ${CLCOMM_OBJS} ${COMMON_OBJS} ${DBASE_OBJS} ${MSGBASE_OBJS} ${MBINET_OBJS} \
|
||||||
@ -115,7 +115,7 @@ depend: ftscprod.c
|
|||||||
|
|
||||||
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
|
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
|
||||||
# Dependencies generated by make depend
|
# Dependencies generated by make depend
|
||||||
clcomm.o: ../config.h libs.h memwatch.h clcomm.h
|
clcomm.o: ../config.h libs.h memwatch.h mberrors.h clcomm.h
|
||||||
client.o: ../config.h libs.h memwatch.h clcomm.h
|
client.o: ../config.h libs.h memwatch.h clcomm.h
|
||||||
crc.o: ../config.h libs.h memwatch.h clcomm.h
|
crc.o: ../config.h libs.h memwatch.h clcomm.h
|
||||||
semafore.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
semafore.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
||||||
@ -139,11 +139,11 @@ dostran.o: ../config.h libs.h memwatch.h structs.h users.h records.h common.h
|
|||||||
ftnmsg.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
|
ftnmsg.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
|
||||||
mbfile.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
mbfile.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
||||||
nodelock.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
nodelock.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
||||||
rawio.o: ../config.h libs.h memwatch.h structs.h common.h
|
rawio.o: ../config.h libs.h memwatch.h structs.h common.h mberrors.h
|
||||||
strcasestr.o: ../config.h libs.h memwatch.h
|
strcasestr.o: ../config.h libs.h memwatch.h
|
||||||
charconv_hz.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
|
charconv_hz.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
|
||||||
execute.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
execute.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h common.h
|
||||||
expipe.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
expipe.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h common.h
|
||||||
getheader.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h
|
getheader.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h
|
||||||
mime.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
mime.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
|
||||||
noderecord.o: ../config.h libs.h memwatch.h structs.h common.h users.h records.h dbnode.h common.h
|
noderecord.o: ../config.h libs.h memwatch.h structs.h common.h users.h records.h dbnode.h common.h
|
||||||
@ -155,8 +155,8 @@ gmtoffset.o: ../config.h libs.h memwatch.h structs.h common.h
|
|||||||
packet.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h dbnode.h
|
packet.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h dbnode.h
|
||||||
rfcdate.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
|
rfcdate.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
|
||||||
term.o: ../config.h libs.h memwatch.h structs.h users.h ansi.h records.h common.h
|
term.o: ../config.h libs.h memwatch.h structs.h users.h ansi.h records.h common.h
|
||||||
dbcfg.o: ../config.h libs.h memwatch.h mbse.h structs.h users.h records.h dbcfg.h
|
dbcfg.o: ../config.h libs.h memwatch.h mbse.h structs.h users.h records.h mberrors.h dbcfg.h
|
||||||
dbdupe.o: ../config.h libs.h memwatch.h structs.h clcomm.h dbdupe.h
|
dbdupe.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h dbdupe.h
|
||||||
dbftn.o: ../config.h libs.h memwatch.h structs.h users.h records.h dbcfg.h dbftn.h
|
dbftn.o: ../config.h libs.h memwatch.h structs.h users.h records.h dbcfg.h dbftn.h
|
||||||
dbmsgs.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h dbcfg.h dbmsgs.h
|
dbmsgs.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h dbcfg.h dbmsgs.h
|
||||||
dbnode.o: ../config.h libs.h memwatch.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h
|
dbnode.o: ../config.h libs.h memwatch.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "libs.h"
|
#include "libs.h"
|
||||||
#include "memwatch.h"
|
#include "memwatch.h"
|
||||||
|
#include "mberrors.h"
|
||||||
#include "clcomm.h"
|
#include "clcomm.h"
|
||||||
|
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch
|
|||||||
printf("Could not get the MBSE_ROOT environment variable\n");
|
printf("Could not get the MBSE_ROOT environment variable\n");
|
||||||
printf("Please set the environment variable ie:\n");
|
printf("Please set the environment variable ie:\n");
|
||||||
printf("\"MBSE_ROOT=/opt/mbse; export MBSE_ROOT\"\n\n");
|
printf("\"MBSE_ROOT=/opt/mbse; export MBSE_ROOT\"\n\n");
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(progname, "%s", myname);
|
sprintf(progname, "%s", myname);
|
||||||
@ -125,7 +126,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch
|
|||||||
mypid = getpid();
|
mypid = getpid();
|
||||||
if (socket_connect(user, myname, where) == -1) {
|
if (socket_connect(user, myname, where) == -1) {
|
||||||
printf("PANIC: cannot access socket\n");
|
printf("PANIC: cannot access socket\n");
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "users.h"
|
#include "users.h"
|
||||||
#include "records.h"
|
#include "records.h"
|
||||||
|
#include "mberrors.h"
|
||||||
#include "dbcfg.h"
|
#include "dbcfg.h"
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ void InitConfig(void)
|
|||||||
printf("Could not get MBSE_ROOT environment variable\n");
|
printf("Could not get MBSE_ROOT environment variable\n");
|
||||||
printf("Please set the environment variable ie:\n");
|
printf("Please set the environment variable ie:\n");
|
||||||
printf("\"MBSE_ROOT=/opt/mbse;export MBSE_ROOT\"\n\n");
|
printf("\"MBSE_ROOT=/opt/mbse;export MBSE_ROOT\"\n\n");
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ void LoadConfig(void)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(FileName);
|
free(FileName);
|
||||||
|
@ -33,9 +33,11 @@
|
|||||||
#include "memwatch.h"
|
#include "memwatch.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "clcomm.h"
|
#include "clcomm.h"
|
||||||
|
#include "mberrors.h"
|
||||||
#include "dbdupe.h"
|
#include "dbdupe.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _dupesrec {
|
typedef struct _dupesrec {
|
||||||
unsigned long *crcs;
|
unsigned long *crcs;
|
||||||
int loaded;
|
int loaded;
|
||||||
@ -85,7 +87,7 @@ int CheckDupe(unsigned long crc, int idx, int max)
|
|||||||
if ((fil = fopen(dfile, "w")) == NULL) {
|
if ((fil = fopen(dfile, "w")) == NULL) {
|
||||||
WriteError("$PANIC: dbdupe.c, can't create %s", dfile);
|
WriteError("$PANIC: dbdupe.c, can't create %s", dfile);
|
||||||
free(dfile);
|
free(dfile);
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
fclose(fil);
|
fclose(fil);
|
||||||
fil = fopen(dfile, "r+");
|
fil = fopen(dfile, "r+");
|
||||||
|
231
lib/execute.c
231
lib/execute.c
@ -1,11 +1,10 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* File ..................: execute.c
|
* $Id$
|
||||||
* Purpose ...............: Execute subprogram
|
* Purpose ...............: Execute subprogram
|
||||||
* Last modification date : 16-Feb-2001
|
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2001
|
* Copyright (C) 1997-2002
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -34,6 +33,7 @@
|
|||||||
#include "memwatch.h"
|
#include "memwatch.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "clcomm.h"
|
#include "clcomm.h"
|
||||||
|
#include "mberrors.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|
||||||
@ -43,91 +43,90 @@ int e_pid = 0; /* Execute child pid */
|
|||||||
|
|
||||||
int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
|
int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
char *vector[16];
|
char *vector[16];
|
||||||
int i;
|
int i, pid, status, rc;
|
||||||
int pid, status, rc;
|
|
||||||
|
|
||||||
if (pkt == NULL)
|
if (pkt == NULL)
|
||||||
sprintf(buf, "%s %s", cmd, file);
|
sprintf(buf, "%s %s", cmd, file);
|
||||||
else
|
else
|
||||||
sprintf(buf, "%s %s %s", cmd, file, pkt);
|
sprintf(buf, "%s %s %s", cmd, file, pkt);
|
||||||
Syslog('+', "Execute: %s",buf);
|
Syslog('+', "Execute: %s",buf);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
vector[i++] = strtok(buf," \t\n");
|
vector[i++] = strtok(buf," \t\n");
|
||||||
while ((vector[i++] = strtok(NULL," \t\n")) && (i<16));
|
while ((vector[i++] = strtok(NULL," \t\n")) && (i<16));
|
||||||
vector[15] = NULL;
|
vector[15] = NULL;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
if (in) {
|
if (in) {
|
||||||
close(0);
|
close(0);
|
||||||
if (open(in,O_RDONLY) != 0) {
|
if (open(in,O_RDONLY) != 0) {
|
||||||
WriteError("$Reopen of stdin to %s failed", MBSE_SS(in));
|
WriteError("$Reopen of stdin to %s failed", MBSE_SS(in));
|
||||||
exit(-1);
|
exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (out) {
|
|
||||||
close(1);
|
|
||||||
if (open(out,O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
|
|
||||||
WriteError("$Reopen of stdout to %s failed", MBSE_SS(out));
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (err) {
|
|
||||||
close(2);
|
|
||||||
if (open(err,O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
|
|
||||||
WriteError("$Reopen of stderr to %s failed", MBSE_SS(err));
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
rc = getpriority(PRIO_PROCESS, 0);
|
|
||||||
if (errno == 0) {
|
|
||||||
rc = setpriority(PRIO_PROCESS, 0, 15);
|
|
||||||
if (rc)
|
|
||||||
WriteError("$execv can't set priority to 15");
|
|
||||||
}
|
|
||||||
rc = execv(vector[0],vector);
|
|
||||||
WriteError("$execv \"%s\" returned %d", MBSE_SS(vector[0]), rc);
|
|
||||||
setpriority(PRIO_PROCESS, 0, 0);
|
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
|
if (out) {
|
||||||
e_pid = pid;
|
close(1);
|
||||||
|
if (open(out,O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
|
||||||
do {
|
WriteError("$Reopen of stdout to %s failed", MBSE_SS(out));
|
||||||
rc = wait(&status);
|
exit(MBERR_EXEC_FAILED);
|
||||||
e_pid = 0;
|
}
|
||||||
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
|
}
|
||||||
|
if (err) {
|
||||||
|
close(2);
|
||||||
|
if (open(err,O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
|
||||||
|
WriteError("$Reopen of stderr to %s failed", MBSE_SS(err));
|
||||||
|
exit(MBERR_EXEC_FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errno = 0;
|
||||||
|
rc = getpriority(PRIO_PROCESS, 0);
|
||||||
|
if (errno == 0) {
|
||||||
|
rc = setpriority(PRIO_PROCESS, 0, 15);
|
||||||
|
if (rc)
|
||||||
|
WriteError("$execv can't set priority to 15");
|
||||||
|
}
|
||||||
|
rc = execv(vector[0],vector);
|
||||||
|
WriteError("$execv \"%s\" returned %d", MBSE_SS(vector[0]), rc);
|
||||||
setpriority(PRIO_PROCESS, 0, 0);
|
setpriority(PRIO_PROCESS, 0, 0);
|
||||||
switch (rc) {
|
exit(MBERR_EXEC_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
|
e_pid = pid;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rc = wait(&status);
|
||||||
|
e_pid = 0;
|
||||||
|
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
|
||||||
|
|
||||||
|
setpriority(PRIO_PROCESS, 0, 0);
|
||||||
|
switch (rc) {
|
||||||
case -1:
|
case -1:
|
||||||
WriteError("$Wait returned %d, status %d,%d", rc,status>>8,status&0xff);
|
WriteError("$Wait returned %d, status %d,%d", rc,status>>8,status&0xff);
|
||||||
return -1;
|
return MBERR_EXEC_FAILED;
|
||||||
case 0:
|
case 0:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
if (WIFEXITED(status)) {
|
if (WIFEXITED(status)) {
|
||||||
rc = WEXITSTATUS(status);
|
rc = WEXITSTATUS(status);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
WriteError("Execute: returned error %d", rc);
|
WriteError("Execute: returned error %d", rc);
|
||||||
return rc;
|
return (rc + MBERR_EXTERNAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (WIFSIGNALED(status)) {
|
if (WIFSIGNALED(status)) {
|
||||||
rc = WTERMSIG(status);
|
rc = WTERMSIG(status);
|
||||||
WriteError("Wait stopped on signal %d", rc);
|
WriteError("Wait stopped on signal %d", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if (rc)
|
if (rc)
|
||||||
WriteError("Wait stopped unknown, rc=%d", rc);
|
WriteError("Wait stopped unknown, rc=%d", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,57 +135,57 @@ int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
|
|||||||
|
|
||||||
int execsh(char *cmd, char *in, char *out, char *err)
|
int execsh(char *cmd, char *in, char *out, char *err)
|
||||||
{
|
{
|
||||||
int pid, status, rc, sverr;
|
int pid, status, rc, sverr;
|
||||||
|
|
||||||
Syslog('+', "Execute shell: %s", MBSE_SS(cmd));
|
Syslog('+', "Execute shell: %s", MBSE_SS(cmd));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
if (in) {
|
if (in) {
|
||||||
close(0);
|
close(0);
|
||||||
if (open(in, O_RDONLY) != 0) {
|
if (open(in, O_RDONLY) != 0) {
|
||||||
WriteError("$Reopen of stdin to %s failed",MBSE_SS(in));
|
WriteError("$Reopen of stdin to %s failed",MBSE_SS(in));
|
||||||
exit(-1);
|
exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (out) {
|
if (out) {
|
||||||
close(1);
|
close(1);
|
||||||
if (open(out, O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
|
if (open(out, O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
|
||||||
WriteError("$Reopen of stdout to %s failed",MBSE_SS(out));
|
WriteError("$Reopen of stdout to %s failed",MBSE_SS(out));
|
||||||
exit(-1);
|
exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
close(2);
|
close(2);
|
||||||
if (open(err, O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
|
if (open(err, O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
|
||||||
WriteError("$Reopen of stderr to %s failed",MBSE_SS(err));
|
WriteError("$Reopen of stderr to %s failed",MBSE_SS(err));
|
||||||
exit(-1);
|
exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rc = execl(SHELL, "sh", "-c", cmd, NULL);
|
|
||||||
WriteError("$execl \"%s\" returned %d", MBSE_SS(cmd), rc);
|
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e_pid = pid;
|
rc = execl(SHELL, "sh", "-c", cmd, NULL);
|
||||||
|
WriteError("$execl \"%s\" returned %d", MBSE_SS(cmd), rc);
|
||||||
|
exit(MBERR_EXEC_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
e_pid = pid;
|
||||||
rc = wait(&status);
|
|
||||||
e_pid = 0;
|
|
||||||
sverr = errno;
|
|
||||||
if (status)
|
|
||||||
WriteError("$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (((rc > 0) && (rc != pid)) || ((rc == -1) && (sverr == EINTR)));
|
do {
|
||||||
if (rc == -1) {
|
rc = wait(&status);
|
||||||
WriteError("$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
|
e_pid = 0;
|
||||||
return -1;
|
sverr = errno;
|
||||||
}
|
if (status)
|
||||||
|
WriteError("$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
while (((rc > 0) && (rc != pid)) || ((rc == -1) && (sverr == EINTR)));
|
||||||
|
if (rc == -1) {
|
||||||
|
WriteError("$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
|
||||||
|
return MBERR_EXEC_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
234
lib/expipe.c
234
lib/expipe.c
@ -33,15 +33,16 @@
|
|||||||
#include "memwatch.h"
|
#include "memwatch.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "clcomm.h"
|
#include "clcomm.h"
|
||||||
|
#include "mberrors.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct _fppid {
|
static struct _fppid {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int pid;
|
int pid;
|
||||||
} fppid[] = {
|
} fppid[] = {
|
||||||
{NULL, 0}, {NULL, 0}, {NULL, 0}
|
{NULL, 0}, {NULL, 0}, {NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define maxfppid 2
|
#define maxfppid 2
|
||||||
@ -50,147 +51,142 @@ static struct _fppid {
|
|||||||
|
|
||||||
FILE *expipe(char *cmd, char *from, char *to)
|
FILE *expipe(char *cmd, char *from, char *to)
|
||||||
{
|
{
|
||||||
char buf[256], *buflimit;
|
char buf[256], *buflimit, *vector[16], *p, *q, *f=from, *t=to;
|
||||||
char *vector[16];
|
FILE *fp;
|
||||||
int i, rc;
|
int i, rc, pid, slot, pipedes[2];
|
||||||
char *p, *q, *f=from, *t=to;
|
|
||||||
int pipedes[2];
|
|
||||||
FILE *fp;
|
|
||||||
int pid, slot;
|
|
||||||
|
|
||||||
buflimit = buf + sizeof(buf) -1 - (f&&t&&(strlen(f)>strlen(t))?strlen(f):t?strlen(t):0);
|
buflimit = buf + sizeof(buf) -1 - (f&&t&&(strlen(f)>strlen(t))?strlen(f):t?strlen(t):0);
|
||||||
|
|
||||||
for (slot = 0; slot <= maxfppid; slot++) {
|
for (slot = 0; slot <= maxfppid; slot++) {
|
||||||
if (fppid[slot].fp == NULL)
|
if (fppid[slot].fp == NULL)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (slot > maxfppid) {
|
||||||
|
WriteError("Attempt to pipe more than %d processes", maxfppid + 1);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (p = cmd, q = buf; (*p); p++) {
|
||||||
|
if (q > buflimit) {
|
||||||
|
WriteError("Attempt to pipe too long command");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
switch (*p) {
|
||||||
|
case '$': switch (*(++p)) {
|
||||||
|
case 'f':
|
||||||
|
case 'F': if ((f))
|
||||||
|
while (*f)
|
||||||
|
*(q++) = *(f++);
|
||||||
|
f=from;
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
case 'T': if ((t))
|
||||||
|
while (*t)
|
||||||
|
*(q++) = *(t++);
|
||||||
|
t=to;
|
||||||
|
break;
|
||||||
|
default: *(q++)='$';
|
||||||
|
*(q++)=*p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '\\': *(q++) = *(++p);
|
||||||
|
break;
|
||||||
|
default: *(q++) = *p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (slot > maxfppid) {
|
}
|
||||||
WriteError("Attempt to pipe more than %d processes", maxfppid + 1);
|
|
||||||
return NULL;
|
*q = '\0';
|
||||||
|
Syslog('+', "Expipe: %s",buf);
|
||||||
|
i = 0;
|
||||||
|
vector[i++] = strtok(buf," \t\n");
|
||||||
|
while ((vector[i++] = strtok(NULL," \t\n")) && (i<16));
|
||||||
|
vector[15] = NULL;
|
||||||
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
|
if (pipe(pipedes) != 0) {
|
||||||
|
WriteError("$Pipe failed for command \"%s\"", MBSE_SS(vector[0]));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Syslog('e', "pipe() returned read=%d, write=%d", pipedes[0], pipedes[1]);
|
||||||
|
if ((pid = fork()) == 0) {
|
||||||
|
close(pipedes[1]);
|
||||||
|
close(0);
|
||||||
|
if (dup(pipedes[0]) != 0) {
|
||||||
|
WriteError("$Reopen of stdin for command %s failed", MBSE_SS(vector[0]));
|
||||||
|
exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
|
rc = execv(vector[0],vector);
|
||||||
|
WriteError("$Exec \"%s\" returned %d", MBSE_SS(vector[0]), rc);
|
||||||
|
exit(MBERR_EXEC_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
for (p = cmd, q = buf; (*p); p++) {
|
close(pipedes[0]);
|
||||||
if (q > buflimit) {
|
|
||||||
WriteError("Attempt to pipe too long command");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
switch (*p) {
|
|
||||||
case '$': switch (*(++p)) {
|
|
||||||
case 'f':
|
|
||||||
case 'F': if ((f))
|
|
||||||
while (*f)
|
|
||||||
*(q++) = *(f++);
|
|
||||||
f=from;
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
case 'T': if ((t))
|
|
||||||
while (*t)
|
|
||||||
*(q++) = *(t++);
|
|
||||||
t=to;
|
|
||||||
break;
|
|
||||||
default: *(q++)='$';
|
|
||||||
*(q++)=*p;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '\\': *(q++) = *(++p);
|
|
||||||
break;
|
|
||||||
default: *(q++) = *p;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*q = '\0';
|
if ((fp = fdopen(pipedes[1],"w")) == NULL) {
|
||||||
Syslog('+', "Expipe: %s",buf);
|
WriteError("$fdopen failed for pipe to command \"%s\"", MBSE_SS(vector[0]));
|
||||||
i = 0;
|
}
|
||||||
vector[i++] = strtok(buf," \t\n");
|
|
||||||
while ((vector[i++] = strtok(NULL," \t\n")) && (i<16));
|
|
||||||
vector[15] = NULL;
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stderr);
|
|
||||||
if (pipe(pipedes) != 0) {
|
|
||||||
WriteError("$Pipe failed for command \"%s\"", MBSE_SS(vector[0]));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Syslog('e', "pipe() returned read=%d, write=%d", pipedes[0], pipedes[1]);
|
fppid[slot].fp = fp;
|
||||||
if ((pid = fork()) == 0) {
|
fppid[slot].pid = pid;
|
||||||
close(pipedes[1]);
|
return fp;
|
||||||
close(0);
|
|
||||||
if (dup(pipedes[0]) != 0) {
|
|
||||||
WriteError("$Reopen of stdin for command %s failed", MBSE_SS(vector[0]));
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
rc = execv(vector[0],vector);
|
|
||||||
WriteError("$Exec \"%s\" returned %d", MBSE_SS(vector[0]), rc);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(pipedes[0]);
|
|
||||||
|
|
||||||
if ((fp = fdopen(pipedes[1],"w")) == NULL) {
|
|
||||||
WriteError("$fdopen failed for pipe to command \"%s\"", MBSE_SS(vector[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
fppid[slot].fp = fp;
|
|
||||||
fppid[slot].pid = pid;
|
|
||||||
return fp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int exclose(FILE *fp)
|
int exclose(FILE *fp)
|
||||||
{
|
{
|
||||||
int status, rc;
|
int status, rc, pid, slot, sverr;
|
||||||
int pid, slot, sverr;
|
|
||||||
|
|
||||||
for (slot = 0; slot <= maxfppid; slot++) {
|
for (slot = 0; slot <= maxfppid; slot++) {
|
||||||
if (fppid[slot].fp == fp)
|
if (fppid[slot].fp == fp)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (slot > maxfppid) {
|
if (slot > maxfppid) {
|
||||||
WriteError("Attempt to close unopened pipe");
|
WriteError("Attempt to close unopened pipe");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pid = fppid[slot].pid;
|
pid = fppid[slot].pid;
|
||||||
fppid[slot].fp = NULL;
|
fppid[slot].fp = NULL;
|
||||||
fppid[slot].pid = 0;
|
fppid[slot].pid = 0;
|
||||||
|
|
||||||
Syslog('e', "Closing pipe to the child process %d",pid);
|
Syslog('e', "Closing pipe to the child process %d",pid);
|
||||||
if ((rc = fclose(fp)) != 0) {
|
if ((rc = fclose(fp)) != 0) {
|
||||||
WriteError("$Error closing pipe to transport (rc=%d)", rc);
|
WriteError("$Error closing pipe to transport (rc=%d)", rc);
|
||||||
if ((rc = kill(pid,SIGKILL)) != 0)
|
if ((rc = kill(pid,SIGKILL)) != 0)
|
||||||
WriteError("$kill for pid %d returned %d",pid,rc);
|
WriteError("$kill for pid %d returned %d",pid,rc);
|
||||||
}
|
}
|
||||||
Syslog('e', "Waiting for process %d to finish",pid);
|
Syslog('e', "Waiting for process %d to finish",pid);
|
||||||
do {
|
do {
|
||||||
rc = wait(&status);
|
rc = wait(&status);
|
||||||
sverr = errno;
|
sverr = errno;
|
||||||
if (status)
|
if (status)
|
||||||
Syslog('e', "$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
|
Syslog('e', "$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
|
||||||
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (sverr == EINTR)));
|
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (sverr == EINTR)));
|
||||||
|
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case -1:WriteError("$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
|
case -1:WriteError("$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
|
||||||
return -1;
|
return MBERR_EXEC_FAILED;
|
||||||
case 0: return 0;
|
case 0: return 0;
|
||||||
default:
|
default:
|
||||||
if (WIFEXITED(status)) {
|
if (WIFEXITED(status)) {
|
||||||
rc = WEXITSTATUS(status);
|
rc = WEXITSTATUS(status);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
WriteError("Expipe: returned error %d", rc);
|
WriteError("Expipe: returned error %d", rc);
|
||||||
return rc;
|
return (rc + MBERR_EXTERNAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (WIFSIGNALED(status)) {
|
if (WIFSIGNALED(status)) {
|
||||||
rc = WTERMSIG(status);
|
rc = WTERMSIG(status);
|
||||||
WriteError("Wait stopped on signal %d", rc);
|
WriteError("Wait stopped on signal %d", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if (rc)
|
if (rc)
|
||||||
WriteError("Wait stopped unknown, rc=%d", rc);
|
WriteError("Wait stopped unknown, rc=%d", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
47
lib/mberrors.h
Normal file
47
lib/mberrors.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#ifndef _MBERRORS_H
|
||||||
|
#define _MBERRORS_H
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exit status values
|
||||||
|
*/
|
||||||
|
#define MBERR_OK 0 /* No errors */
|
||||||
|
#define MBERR_COMMANDLINE 100 /* Commandline error */
|
||||||
|
#define MBERR_CONFIG_ERROR 101 /* Configuration error */
|
||||||
|
#define MBERR_INIT_ERROR 102 /* Initialisation error */
|
||||||
|
#define MBERR_DISK_FULL 103 /* Some disk partition full */
|
||||||
|
#define MBERR_UPS_ALARM 104 /* UPS alarm detected */
|
||||||
|
#define MBERR_NO_RECIPIENTS 105 /* No valid recipients */
|
||||||
|
#define MBERR_EXEC_FAILED 106 /* Execute external prog failed */
|
||||||
|
#define MBERR_TTYIO_ERROR 107 /* Set tty failed */
|
||||||
|
#define MBERR_FTRANSFER 108 /* File transfer error */
|
||||||
|
#define MBERR_ATTACH_FAILED 109 /* File attach failed */
|
||||||
|
#define MBERR_NO_PROGLOCK 110 /* Cannot lock program, retry later */
|
||||||
|
#define MBERR_NODE_NOT_IN_LIST 111 /* Node not in nodelist */
|
||||||
|
#define MBERR_NODE_MAY_NOT_CALL 112 /* Node may not be called */
|
||||||
|
#define MBERR_NO_CONNECTION 113 /* Cannot make connection */
|
||||||
|
#define MBERR_PORTERROR 114 /* Cannot open tty port */
|
||||||
|
#define MBERR_NODE_LOCKED 115 /* Node is locked */
|
||||||
|
#define MBERR_NO_IP_ADDRESS 116 /* Node IP address not found */
|
||||||
|
#define MBERR_UNKNOWN_SESSION 117 /* Unknown session */
|
||||||
|
#define MBERR_NOT_ZMH 118 /* Not Zone Mail Hour */
|
||||||
|
#define MBERR_MODEM_ERROR 119 /* Modem error */
|
||||||
|
#define MBERR_NO_PORT_AVAILABLE 120 /* No modemport available */
|
||||||
|
#define MBERR_SESSION_ERROR 121 /* Session error (password) */
|
||||||
|
#define MBERR_EMSI 122 /* EMSI session error */
|
||||||
|
#define MBERR_FTSC 123 /* FTSC session error */
|
||||||
|
#define MBERR_WAZOO 124 /* WAZOO session error */
|
||||||
|
#define MBERR_YOOHOO 125 /* YOOHOO session error */
|
||||||
|
#define MBERR_OUTBOUND_SCAN 126 /* Outbound scan error */
|
||||||
|
#define MBERR_CANNOT_MAKE_POLL 127 /* Cannot make poll */
|
||||||
|
#define MBERR_REQUEST 128 /* File request error */
|
||||||
|
#define MBERR_DIFF_ERROR 129 /* Error processing nodediff */
|
||||||
|
#define MBERR_VIRUS_FOUND 130 /* Virus found */
|
||||||
|
#define MBERR_GENERAL 131 /* General error */
|
||||||
|
#define MBERR_TIMEOUT 132 /* Timeout error */
|
||||||
|
#define MBERR_TTYIO 200 /* Base for ttyio errors */
|
||||||
|
#define MBERR_MEMWATCH 255 /* Memwatch error */
|
||||||
|
#define MBERR_EXTERNAL 256 /* Status external prog + 256 */
|
||||||
|
|
||||||
|
#endif
|
67
lib/rawio.c
67
lib/rawio.c
@ -33,6 +33,7 @@
|
|||||||
#include "memwatch.h"
|
#include "memwatch.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "mberrors.h"
|
||||||
|
|
||||||
|
|
||||||
int rawset = FALSE;
|
int rawset = FALSE;
|
||||||
@ -43,31 +44,31 @@ int rawset = FALSE;
|
|||||||
*/
|
*/
|
||||||
void Setraw()
|
void Setraw()
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((rc = tcgetattr(ttyfd, &tbufs))) {
|
if ((rc = tcgetattr(ttyfd, &tbufs))) {
|
||||||
perror("");
|
perror("");
|
||||||
printf("$tcgetattr(0, save) return %d\n", rc);
|
printf("$tcgetattr(0, save) return %d\n", rc);
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
tbufsavs = tbufs;
|
tbufsavs = tbufs;
|
||||||
tbufs.c_iflag &= ~(INLCR | ICRNL | ISTRIP | IXON ); /* IUCLC removed for FreeBSD */
|
tbufs.c_iflag &= ~(INLCR | ICRNL | ISTRIP | IXON ); /* IUCLC removed for FreeBSD */
|
||||||
/*
|
/*
|
||||||
* Map CRNL modes strip control characters and flow control
|
* Map CRNL modes strip control characters and flow control
|
||||||
*/
|
*/
|
||||||
tbufs.c_oflag &= ~OPOST; /* Don't do ouput character translation */
|
tbufs.c_oflag &= ~OPOST; /* Don't do ouput character translation */
|
||||||
tbufs.c_lflag &= ~(ICANON | ECHO); /* No canonical input and no echo */
|
tbufs.c_lflag &= ~(ICANON | ECHO); /* No canonical input and no echo */
|
||||||
tbufs.c_cc[VMIN] = 1; /* Receive 1 character at a time */
|
tbufs.c_cc[VMIN] = 1; /* Receive 1 character at a time */
|
||||||
tbufs.c_cc[VTIME] = 0; /* No time limit per character */
|
tbufs.c_cc[VTIME] = 0; /* No time limit per character */
|
||||||
|
|
||||||
if ((rc = tcsetattr(ttyfd, TCSADRAIN, &tbufs))) {
|
if ((rc = tcsetattr(ttyfd, TCSADRAIN, &tbufs))) {
|
||||||
perror("");
|
perror("");
|
||||||
printf("$tcsetattr(%d, TCSADRAIN, raw) return %d\n", ttyfd, rc);
|
printf("$tcsetattr(%d, TCSADRAIN, raw) return %d\n", ttyfd, rc);
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
rawset = TRUE;
|
rawset = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,19 +78,19 @@ void Setraw()
|
|||||||
*/
|
*/
|
||||||
void Unsetraw()
|
void Unsetraw()
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only unset the mode if it is set to raw mode
|
* Only unset the mode if it is set to raw mode
|
||||||
*/
|
*/
|
||||||
if (rawset == TRUE) {
|
if (rawset == TRUE) {
|
||||||
if ((rc = tcsetattr(ttyfd, TCSAFLUSH, &tbufsavs))) {
|
if ((rc = tcsetattr(ttyfd, TCSAFLUSH, &tbufsavs))) {
|
||||||
perror("");
|
perror("");
|
||||||
printf("$tcsetattr(%d, TCSAFLUSH, save) return %d\n", ttyfd, rc);
|
printf("$tcsetattr(%d, TCSAFLUSH, save) return %d\n", ttyfd, rc);
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rawset = FALSE;
|
}
|
||||||
|
rawset = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ unsigned char Getone()
|
|||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
||||||
perror("open 8");
|
perror("open 8");
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
Setraw();
|
||||||
|
|
||||||
|
@ -90,15 +90,15 @@ zmmisc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/co
|
|||||||
zmrle.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ttyio.h session.h zmodem.h
|
zmrle.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ttyio.h session.h zmodem.h
|
||||||
zmrecv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h lutil.h ttyio.h session.h zmodem.h config.h emsi.h openfile.h filelist.h openport.h
|
zmrecv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h lutil.h ttyio.h session.h zmodem.h config.h emsi.h openfile.h filelist.h openport.h
|
||||||
zmsend.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h zmodem.h lutil.h emsi.h filelist.h
|
zmsend.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h zmodem.h lutil.h emsi.h filelist.h
|
||||||
binkp.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 ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h
|
binkp.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/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h
|
||||||
xmsend.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h xmsend.h m7send.h filelist.h filetime.h
|
xmsend.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h xmsend.h m7send.h filelist.h filetime.h
|
||||||
xmrecv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h lutil.h openfile.h m7recv.h xmrecv.h filelist.h filetime.h
|
xmrecv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h lutil.h openfile.h m7recv.h xmrecv.h filelist.h filetime.h
|
||||||
m7recv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7recv.h
|
m7recv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7recv.h
|
||||||
m7send.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7send.h
|
m7send.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7send.h
|
||||||
hydra.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h filelist.h filetime.h ttyio.h statetbl.h config.h emsi.h openfile.h lutil.h respfreq.h mbcico.h hydra.h
|
hydra.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h session.h filelist.h filetime.h ttyio.h statetbl.h config.h emsi.h openfile.h lutil.h respfreq.h mbcico.h hydra.h
|
||||||
answer.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 lutil.h session.h config.h answer.h openport.h portsel.h dial.h rdoptions.h mbcico.h
|
answer.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/mberrors.h lutil.h session.h config.h answer.h openport.h portsel.h dial.h rdoptions.h mbcico.h
|
||||||
chat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h config.h chat.h ttyio.h
|
chat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h config.h chat.h ttyio.h
|
||||||
dial.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 config.h chat.h ttyio.h session.h dial.h
|
dial.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/mberrors.h config.h chat.h ttyio.h session.h dial.h
|
||||||
dietifna.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h
|
dietifna.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h
|
||||||
emsidat.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 emsi.h session.h lutil.h config.h emsidat.h filetime.h
|
emsidat.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 emsi.h session.h lutil.h config.h emsidat.h filetime.h
|
||||||
filelist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h config.h session.h filelist.h
|
filelist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h config.h session.h filelist.h
|
||||||
@ -106,27 +106,27 @@ openfile.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/
|
|||||||
openport.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h openport.h
|
openport.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h openport.h
|
||||||
opentcp.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 session.h ttyio.h openport.h opentcp.h
|
opentcp.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 session.h ttyio.h openport.h opentcp.h
|
||||||
rdoptions.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 session.h config.h
|
rdoptions.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 session.h config.h
|
||||||
yoohoo.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 statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h
|
yoohoo.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/mberrors.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h
|
||||||
recvbark.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h recvbark.h respfreq.h filelist.h
|
recvbark.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h recvbark.h respfreq.h filelist.h
|
||||||
respfreq.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h session.h lutil.h config.h atoul.h respfreq.h filelist.h
|
respfreq.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h session.h lutil.h config.h atoul.h respfreq.h filelist.h
|
||||||
sendbark.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h sendbark.h xmrecv.h
|
sendbark.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h sendbark.h xmrecv.h
|
||||||
tcp.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h tcpproto.h tcp.h
|
tcp.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h tcpproto.h tcp.h
|
||||||
tcpproto.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h config.h emsi.h lutil.h openfile.h filelist.h tcpproto.h
|
tcpproto.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h config.h emsi.h lutil.h openfile.h filelist.h tcpproto.h
|
||||||
wazoo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h wazoo.h zmodem.h
|
wazoo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h wazoo.h zmodem.h
|
||||||
filetime.o: ../config.h ../lib/libs.h ../lib/memwatch.h filetime.h
|
filetime.o: ../config.h ../lib/libs.h ../lib/memwatch.h filetime.h
|
||||||
ftsc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h ftsc.h rdoptions.h recvbark.h filelist.h sendbark.h respfreq.h xmrecv.h xmsend.h
|
ftsc.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/mberrors.h session.h ttyio.h statetbl.h config.h ftsc.h rdoptions.h recvbark.h filelist.h sendbark.h respfreq.h xmrecv.h xmsend.h
|
||||||
atoul.o: ../config.h ../lib/libs.h ../lib/memwatch.h atoul.h
|
atoul.o: ../config.h ../lib/libs.h ../lib/memwatch.h atoul.h
|
||||||
portsel.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h portsel.h
|
portsel.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h portsel.h
|
||||||
ttyio.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h lutil.h
|
ttyio.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h lutil.h
|
||||||
lutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h lutil.h
|
lutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h lutil.h
|
||||||
scanout.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/dbftn.h config.h scanout.h lutil.h
|
scanout.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/dbftn.h config.h scanout.h lutil.h
|
||||||
emsi.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 ttyio.h session.h statetbl.h config.h emsi.h emsidat.h hydra.h rdoptions.h tcp.h wazoo.h
|
emsi.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/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h emsidat.h hydra.h rdoptions.h tcp.h wazoo.h
|
||||||
ulock.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h
|
ulock.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h
|
||||||
callstat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h callstat.h
|
callstat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h callstat.h
|
||||||
session.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h statetbl.h emsi.h ftsc.h session.h yoohoo.h mbcico.h binkp.h callstat.h
|
session.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/mberrors.h ttyio.h statetbl.h emsi.h ftsc.h session.h yoohoo.h mbcico.h binkp.h callstat.h
|
||||||
call.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 session.h callstat.h call.h config.h dial.h lutil.h portsel.h openport.h opentcp.h rdoptions.h
|
call.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/mberrors.h session.h callstat.h call.h config.h dial.h lutil.h portsel.h openport.h opentcp.h rdoptions.h
|
||||||
mbcico.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 ../lib/dbnode.h ../lib/dbftn.h config.h answer.h call.h lutil.h mbcico.h session.h
|
mbcico.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 ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h config.h answer.h call.h lutil.h mbcico.h session.h
|
||||||
outstat.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 ../lib/dbnode.h ../lib/dbftn.h scanout.h callstat.h outstat.h
|
outstat.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 ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h scanout.h callstat.h outstat.h
|
||||||
nlinfo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h nlinfo.h
|
nlinfo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h nlinfo.h
|
||||||
mbout.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 ../lib/dbnode.h ../lib/dbftn.h outstat.h nlinfo.h
|
mbout.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 ../lib/dbnode.h ../lib/dbftn.h ../lib/mberrors.h outstat.h nlinfo.h
|
||||||
# End of generated dependencies
|
# End of generated dependencies
|
||||||
|
188
mbcico/answer.c
188
mbcico/answer.c
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "lutil.h"
|
#include "lutil.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -56,109 +57,110 @@ extern int Loaded;
|
|||||||
|
|
||||||
int answer(char *stype)
|
int answer(char *stype)
|
||||||
{
|
{
|
||||||
int st, rc;
|
int st, rc;
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* mgetty set's the environment variable CONNECT and CALLER_ID,
|
||||||
|
* so if they are present, we might as well make log entries.
|
||||||
|
*/
|
||||||
|
if ((q = getenv("CONNECT")) != NULL)
|
||||||
|
Syslog('+', "CONNECT %s", q);
|
||||||
|
if ((q = getenv("CALLER_ID")) != NULL)
|
||||||
|
if (strncmp(q, "none", 4))
|
||||||
|
Syslog('+', "CALLER %s", q);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Incoming calls from modem/ISDN lines do have a tty.
|
||||||
|
* Network calls don't have a tty attached.
|
||||||
|
*/
|
||||||
|
carrier = TRUE;
|
||||||
|
p = ttyname(0);
|
||||||
|
if (p) {
|
||||||
|
q = strrchr(ttyname(0), '/');
|
||||||
|
if (q)
|
||||||
|
p = q + 1;
|
||||||
|
strncpy(history.tty, p, 6);
|
||||||
|
if (load_port(p))
|
||||||
|
Syslog('d', "Port %s, modem %s", ttyinfo.tty, modem.modem);
|
||||||
|
else
|
||||||
|
Syslog('d', "Port and modem not loaded!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((nlent = getnlent(NULL)) == NULL) {
|
||||||
|
WriteError("could not get dummy nodelist entry");
|
||||||
|
return MBERR_NODE_NOT_IN_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
c_start = time(NULL);
|
||||||
|
rdoptions(FALSE);
|
||||||
|
|
||||||
|
if (inbound)
|
||||||
|
free(inbound);
|
||||||
|
inbound = xstrcpy(CFG.inbound); /* slave session is unsecure by default */
|
||||||
|
|
||||||
|
if (stype == NULL) {
|
||||||
|
st=SESSION_UNKNOWN;
|
||||||
|
} else if (strcmp(stype,"tsync") == 0) {
|
||||||
|
st=SESSION_FTSC;
|
||||||
|
IsDoing("Answer ftsc");
|
||||||
|
} else if (strcmp(stype,"yoohoo") == 0) {
|
||||||
|
st=SESSION_YOOHOO;
|
||||||
|
IsDoing("Answer yoohoo");
|
||||||
|
} else if (strncmp(stype,"**EMSI_",7) == 0) {
|
||||||
|
st=SESSION_EMSI;
|
||||||
|
IsDoing("Answer EMSI");
|
||||||
|
} else if (strncmp(stype,"ibn",3) == 0) {
|
||||||
|
st=SESSION_BINKP;
|
||||||
|
IsDoing("Answer binkp");
|
||||||
|
} else {
|
||||||
|
st=SESSION_UNKNOWN;
|
||||||
|
IsDoing("Answer unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rc = rawport()) != 0)
|
||||||
|
WriteError("Unable to set raw mode");
|
||||||
|
else {
|
||||||
|
nolocalport();
|
||||||
|
rc = session(NULL,NULL,SESSION_SLAVE,st,stype);
|
||||||
|
}
|
||||||
|
|
||||||
|
cookedport();
|
||||||
|
if (p) {
|
||||||
/*
|
/*
|
||||||
* mgetty set's the environment variable CONNECT and CALLER_ID,
|
* Hangup will write the history record.
|
||||||
* so if they are present, we might as well make log entries.
|
|
||||||
*/
|
*/
|
||||||
if ((q = getenv("CONNECT")) != NULL)
|
hangup();
|
||||||
Syslog('+', "CONNECT %s", q);
|
} else {
|
||||||
if ((q = getenv("CALLER_ID")) != NULL)
|
|
||||||
if (strncmp(q, "none", 4))
|
|
||||||
Syslog('+', "CALLER %s", q);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Incoming calls from modem/ISDN lines do have a tty.
|
* Network call, write history record.
|
||||||
* Network calls don't have a tty attached.
|
|
||||||
*/
|
*/
|
||||||
carrier = TRUE;
|
c_end = time(NULL);
|
||||||
p = ttyname(0);
|
online += (c_end - c_start);
|
||||||
if (p) {
|
|
||||||
q = strrchr(ttyname(0), '/');
|
|
||||||
if (q)
|
|
||||||
p = q + 1;
|
|
||||||
strncpy(history.tty, p, 6);
|
|
||||||
if (load_port(p))
|
|
||||||
Syslog('d', "Port %s, modem %s", ttyinfo.tty, modem.modem);
|
|
||||||
else
|
|
||||||
Syslog('d', "Port and modem not loaded!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((nlent = getnlent(NULL)) == NULL) {
|
history.online = c_start;
|
||||||
WriteError("could not get dummy nodelist entry");
|
history.offline = c_end;
|
||||||
return 1;
|
history.sent_bytes = sentbytes;
|
||||||
}
|
history.rcvd_bytes = rcvdbytes;
|
||||||
|
history.inbound = TRUE;
|
||||||
|
|
||||||
c_start = time(NULL);
|
p = calloc(PATH_MAX, sizeof(char));
|
||||||
rdoptions(FALSE);
|
sprintf(p, "%s/var/mailer.hist", getenv("MBSE_ROOT"));
|
||||||
|
if ((fp = fopen(p, "a")) == NULL)
|
||||||
if (inbound)
|
WriteError("$Can't open %s", p);
|
||||||
free(inbound);
|
|
||||||
inbound = xstrcpy(CFG.inbound); /* slave session is unsecure by default */
|
|
||||||
|
|
||||||
if (stype == NULL) {
|
|
||||||
st=SESSION_UNKNOWN;
|
|
||||||
} else if (strcmp(stype,"tsync") == 0) {
|
|
||||||
st=SESSION_FTSC;
|
|
||||||
IsDoing("Answer ftsc");
|
|
||||||
} else if (strcmp(stype,"yoohoo") == 0) {
|
|
||||||
st=SESSION_YOOHOO;
|
|
||||||
IsDoing("Answer yoohoo");
|
|
||||||
} else if (strncmp(stype,"**EMSI_",7) == 0) {
|
|
||||||
st=SESSION_EMSI;
|
|
||||||
IsDoing("Answer EMSI");
|
|
||||||
} else if (strncmp(stype,"ibn",3) == 0) {
|
|
||||||
st=SESSION_BINKP;
|
|
||||||
IsDoing("Answer binkp");
|
|
||||||
} else {
|
|
||||||
st=SESSION_UNKNOWN;
|
|
||||||
IsDoing("Answer unknown");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rc = rawport()) != 0)
|
|
||||||
WriteError("Unable to set raw mode");
|
|
||||||
else {
|
else {
|
||||||
nolocalport();
|
fwrite(&history, sizeof(history), 1, fp);
|
||||||
rc=session(NULL,NULL,SESSION_SLAVE,st,stype);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
free(p);
|
||||||
cookedport();
|
|
||||||
if (p) {
|
if (Loaded) {
|
||||||
/*
|
nodes.LastDate = time(NULL);
|
||||||
* Hangup will write the history record.
|
UpdateNode();
|
||||||
*/
|
|
||||||
hangup();
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Network call, write history record.
|
|
||||||
*/
|
|
||||||
c_end = time(NULL);
|
|
||||||
online += (c_end - c_start);
|
|
||||||
|
|
||||||
history.online = c_start;
|
|
||||||
history.offline = c_end;
|
|
||||||
history.sent_bytes = sentbytes;
|
|
||||||
history.rcvd_bytes = rcvdbytes;
|
|
||||||
history.inbound = TRUE;
|
|
||||||
|
|
||||||
p = calloc(PATH_MAX, sizeof(char));
|
|
||||||
sprintf(p, "%s/var/mailer.hist", getenv("MBSE_ROOT"));
|
|
||||||
if ((fp = fopen(p, "a")) == NULL)
|
|
||||||
WriteError("$Can't open %s", p);
|
|
||||||
else {
|
|
||||||
fwrite(&history, sizeof(history), 1, fp);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
free(p);
|
|
||||||
if (Loaded) {
|
|
||||||
nodes.LastDate = time(NULL);
|
|
||||||
UpdateNode();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return rc;
|
}
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
185
mbcico/binkp.c
185
mbcico/binkp.c
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "statetbl.h"
|
#include "statetbl.h"
|
||||||
@ -95,96 +96,96 @@ int batchnr = 0, crc_errors = 0;
|
|||||||
|
|
||||||
int binkp(int role)
|
int binkp(int role)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = MBERR_OK;
|
||||||
fa_list *eff_remote;
|
fa_list *eff_remote;
|
||||||
file_list *tosend = NULL, *request = NULL, *respond = NULL, *tmpfl;
|
file_list *tosend = NULL, *request = NULL, *respond = NULL, *tmpfl;
|
||||||
char *nonhold_mail;
|
char *nonhold_mail;
|
||||||
|
|
||||||
if (role == 1) {
|
if (role == 1) {
|
||||||
Syslog('+', "BINKP start outbound session");
|
Syslog('+', "BINKP start outbound session");
|
||||||
if (orgbinkp()) {
|
if (orgbinkp()) {
|
||||||
rc = 5;
|
rc = MBERR_FTRANSFER;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Syslog('+', "BINKP start inbound session");
|
|
||||||
if (ansbinkp()) {
|
|
||||||
rc = 5;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Syslog('+', "BINKP start inbound session");
|
||||||
|
if (ansbinkp()) {
|
||||||
|
rc = MBERR_FTRANSFER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
Syslog('!', "BINKP session failed");
|
Syslog('!', "BINKP session failed");
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
nonhold_mail = (char *)ALL_MAIL;
|
|
||||||
eff_remote = remote;
|
|
||||||
/*
|
|
||||||
* If remote doesn't have the 8.3 flag set, allow long filenames.
|
|
||||||
*/
|
|
||||||
if (!nodes.FNC)
|
|
||||||
remote_flags &= ~SESSION_FNC;
|
|
||||||
|
|
||||||
tosend = create_filelist(eff_remote, nonhold_mail, 0);
|
|
||||||
request = create_freqlist(remote);
|
|
||||||
|
|
||||||
if (request != NULL) {
|
|
||||||
Syslog('b', "Inserting request list");
|
|
||||||
tmpfl = tosend;
|
|
||||||
tosend = request;
|
|
||||||
for (; request->next; request = request->next);
|
|
||||||
request->next = tmpfl;
|
|
||||||
|
|
||||||
request = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = binkp_batch(tosend, role);
|
|
||||||
tidy_filelist(tosend, (rc == 0));
|
|
||||||
tosend = NULL;
|
|
||||||
|
|
||||||
if ((rc == 0) && transferred && MBflag) {
|
|
||||||
/*
|
|
||||||
* Running Multiple Batch, only if last batch actually
|
|
||||||
* did transfer some data.
|
|
||||||
*/
|
|
||||||
respond = respond_wazoo();
|
|
||||||
/*
|
|
||||||
* Just create the tosend list again, there may be something
|
|
||||||
* ready again for this node.
|
|
||||||
*/
|
|
||||||
tosend = create_filelist(eff_remote, nonhold_mail, 0);
|
|
||||||
for (tmpfl = tosend; tmpfl->next; tmpfl = tmpfl->next);
|
|
||||||
tmpfl->next = respond;
|
|
||||||
rc = binkp_batch(tosend, role);
|
|
||||||
tmpfl->next = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Syslog('+', "BINKP end transfer rc=%d", rc);
|
|
||||||
closetcp();
|
|
||||||
|
|
||||||
if (!MBflag) {
|
|
||||||
/*
|
|
||||||
* In singe batch mode we process filerequests after the batch.
|
|
||||||
* The results will be put on hold for the calling node.
|
|
||||||
*/
|
|
||||||
respond = respond_wazoo();
|
|
||||||
for (tmpfl = respond; tmpfl; tmpfl = tmpfl->next) {
|
|
||||||
if (strncmp(tmpfl->local, "/tmp", 4)) {
|
|
||||||
attach(*remote->addr, tmpfl->local, LEAVE, 'h');
|
|
||||||
Syslog('+', "Put on hold: %s", MBSE_SS(tmpfl->local));
|
|
||||||
} else {
|
|
||||||
file_mv(tmpfl->local, pktname(remote->addr, 'h'));
|
|
||||||
Syslog('+', "New netmail: %s", pktname(remote->addr, 'h'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tidy_filelist(request, (rc == 0));
|
|
||||||
tidy_filelist(tosend, (rc == 0));
|
|
||||||
tidy_filelist(respond, 0);
|
|
||||||
|
|
||||||
rc = abs(rc);
|
|
||||||
return rc;
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
nonhold_mail = (char *)ALL_MAIL;
|
||||||
|
eff_remote = remote;
|
||||||
|
/*
|
||||||
|
* If remote doesn't have the 8.3 flag set, allow long filenames.
|
||||||
|
*/
|
||||||
|
if (!nodes.FNC)
|
||||||
|
remote_flags &= ~SESSION_FNC;
|
||||||
|
|
||||||
|
tosend = create_filelist(eff_remote, nonhold_mail, 0);
|
||||||
|
request = create_freqlist(remote);
|
||||||
|
|
||||||
|
if (request != NULL) {
|
||||||
|
Syslog('b', "Inserting request list");
|
||||||
|
tmpfl = tosend;
|
||||||
|
tosend = request;
|
||||||
|
for (; request->next; request = request->next);
|
||||||
|
request->next = tmpfl;
|
||||||
|
|
||||||
|
request = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = binkp_batch(tosend, role);
|
||||||
|
tidy_filelist(tosend, (rc == 0));
|
||||||
|
tosend = NULL;
|
||||||
|
|
||||||
|
if ((rc == 0) && transferred && MBflag) {
|
||||||
|
/*
|
||||||
|
* Running Multiple Batch, only if last batch actually
|
||||||
|
* did transfer some data.
|
||||||
|
*/
|
||||||
|
respond = respond_wazoo();
|
||||||
|
/*
|
||||||
|
* Just create the tosend list again, there may be something
|
||||||
|
* ready again for this node.
|
||||||
|
*/
|
||||||
|
tosend = create_filelist(eff_remote, nonhold_mail, 0);
|
||||||
|
for (tmpfl = tosend; tmpfl->next; tmpfl = tmpfl->next);
|
||||||
|
tmpfl->next = respond;
|
||||||
|
rc = binkp_batch(tosend, role);
|
||||||
|
tmpfl->next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Syslog('+', "BINKP end transfer rc=%d", rc);
|
||||||
|
closetcp();
|
||||||
|
|
||||||
|
if (!MBflag) {
|
||||||
|
/*
|
||||||
|
* In singe batch mode we process filerequests after the batch.
|
||||||
|
* The results will be put on hold for the calling node.
|
||||||
|
*/
|
||||||
|
respond = respond_wazoo();
|
||||||
|
for (tmpfl = respond; tmpfl; tmpfl = tmpfl->next) {
|
||||||
|
if (strncmp(tmpfl->local, "/tmp", 4)) {
|
||||||
|
attach(*remote->addr, tmpfl->local, LEAVE, 'h');
|
||||||
|
Syslog('+', "Put on hold: %s", MBSE_SS(tmpfl->local));
|
||||||
|
} else {
|
||||||
|
file_mv(tmpfl->local, pktname(remote->addr, 'h'));
|
||||||
|
Syslog('+', "New netmail: %s", pktname(remote->addr, 'h'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tidy_filelist(request, (rc == 0));
|
||||||
|
tidy_filelist(tosend, (rc == 0));
|
||||||
|
tidy_filelist(respond, 0);
|
||||||
|
|
||||||
|
rc = abs(rc);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -854,7 +855,7 @@ int binkp_batch(file_list *to_send, int role)
|
|||||||
RxState = RxDone;
|
RxState = RxDone;
|
||||||
TxState = TxDone;
|
TxState = TxDone;
|
||||||
binkp_send_control(MM_ERR, "Transfer timeout");
|
binkp_send_control(MM_ERR, "Transfer timeout");
|
||||||
rc = -2;
|
rc = MBERR_FTRANSFER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -876,7 +877,7 @@ int binkp_batch(file_list *to_send, int role)
|
|||||||
Syslog('?', "Binkp: receiver status %s", ttystat[c]);
|
Syslog('?', "Binkp: receiver status %s", ttystat[c]);
|
||||||
TxState = TxDone;
|
TxState = TxDone;
|
||||||
RxState = RxDone;
|
RxState = RxDone;
|
||||||
rc = -c;
|
rc = (MBERR_TTYIO + (-c));
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
switch (rxlen) {
|
switch (rxlen) {
|
||||||
@ -1056,13 +1057,13 @@ int binkp_batch(file_list *to_send, int role)
|
|||||||
case MM_ERR: Syslog('+', "Binkp: got ERR: %s", rxbuf+1);
|
case MM_ERR: Syslog('+', "Binkp: got ERR: %s", rxbuf+1);
|
||||||
RxState = RxDone;
|
RxState = RxDone;
|
||||||
TxState = TxDone;
|
TxState = TxDone;
|
||||||
rc = -10;
|
rc = MBERR_FTRANSFER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MM_BSY: Syslog('+', "Binkp: got BSY: %s", rxbuf+1);
|
case MM_BSY: Syslog('+', "Binkp: got BSY: %s", rxbuf+1);
|
||||||
RxState = RxDone;
|
RxState = RxDone;
|
||||||
TxState = TxDone;
|
TxState = TxDone;
|
||||||
rc = -11;
|
rc = MBERR_FTRANSFER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MM_SKIP: Syslog('+', "Binkp: got SKIP: %s", rxbuf+1);
|
case MM_SKIP: Syslog('+', "Binkp: got SKIP: %s", rxbuf+1);
|
||||||
@ -1151,7 +1152,7 @@ int binkp_batch(file_list *to_send, int role)
|
|||||||
WriteError("File CRC error nr %d, aborting session", crc_errors);
|
WriteError("File CRC error nr %d, aborting session", crc_errors);
|
||||||
binkp_send_control(MM_ERR, "Too much CRC errors, aborting session");
|
binkp_send_control(MM_ERR, "Too much CRC errors, aborting session");
|
||||||
RxState = RxDone;
|
RxState = RxDone;
|
||||||
rc = -12;
|
rc = MBERR_FTRANSFER;
|
||||||
}
|
}
|
||||||
closefile(FALSE);
|
closefile(FALSE);
|
||||||
}
|
}
|
||||||
@ -1205,7 +1206,7 @@ int binkp_batch(file_list *to_send, int role)
|
|||||||
binkp_send_control(MM_BSY, "Low diskspace, try again later");
|
binkp_send_control(MM_BSY, "Low diskspace, try again later");
|
||||||
RxState = RxDone;
|
RxState = RxDone;
|
||||||
TxState = TxDone;
|
TxState = TxDone;
|
||||||
rc = -13;
|
rc = MBERR_FTRANSFER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "callstat.h"
|
#include "callstat.h"
|
||||||
#include "call.h"
|
#include "call.h"
|
||||||
@ -68,10 +69,10 @@ int portopen(faddr *addr)
|
|||||||
if ((rc = opentcp(inetaddr))) {
|
if ((rc = opentcp(inetaddr))) {
|
||||||
Syslog('+', "Cannot connect %s", inetaddr);
|
Syslog('+', "Cannot connect %s", inetaddr);
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
putstatus(addr,1,ST_NOCONN);
|
putstatus(addr,1,MBERR_NO_CONNECTION);
|
||||||
return ST_NOCONN;
|
return MBERR_NO_CONNECTION;
|
||||||
}
|
}
|
||||||
return 0;
|
return MBERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forcedline) {
|
if (forcedline) {
|
||||||
@ -83,19 +84,19 @@ int portopen(faddr *addr)
|
|||||||
if ((rc = openport(p, ttyinfo.portspeed))) {
|
if ((rc = openport(p, ttyinfo.portspeed))) {
|
||||||
Syslog('+', "Cannot open port %s",p);
|
Syslog('+', "Cannot open port %s",p);
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
putstatus(addr, 10, ST_PORTERR);
|
putstatus(addr, 10, MBERR_PORTERROR);
|
||||||
return ST_PORTERR;
|
return MBERR_PORTERROR;
|
||||||
}
|
}
|
||||||
return ST_PORTOK;
|
return MBERR_OK;
|
||||||
} else {
|
} else {
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
putstatus(addr, 0, ST_PORTERR);
|
putstatus(addr, 0, MBERR_PORTERROR);
|
||||||
return ST_PORTERR;
|
return MBERR_PORTERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteError("No call method available, maybe missing parameters");
|
WriteError("No call method available, maybe missing parameters");
|
||||||
return ST_PORTERR;
|
return MBERR_NO_CONNECTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,15 +117,15 @@ int call(faddr *addr)
|
|||||||
*/
|
*/
|
||||||
if (nodelock(addr)) {
|
if (nodelock(addr)) {
|
||||||
Syslog('+', "System %s is locked", ascfnode(addr, 0x1f));
|
Syslog('+', "System %s is locked", ascfnode(addr, 0x1f));
|
||||||
putstatus(addr, 0, ST_LOCKED);
|
putstatus(addr, 0, MBERR_NODE_LOCKED);
|
||||||
return ST_LOCKED;
|
return MBERR_NODE_LOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((nlent = getnlent(addr)) == NULL) {
|
if ((nlent = getnlent(addr)) == NULL) {
|
||||||
WriteError("Cannot call %s: fatal in nodelist lookup", ascfnode(addr, 0x1f));
|
WriteError("Cannot call %s: fatal in nodelist lookup", ascfnode(addr, 0x1f));
|
||||||
putstatus(addr,0,ST_LOOKUP);
|
putstatus(addr,0,MBERR_NODE_NOT_IN_LIST);
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
return ST_LOOKUP;
|
return MBERR_NODE_NOT_IN_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -215,7 +216,7 @@ int call(faddr *addr)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WriteError("No IP address, abort call");
|
WriteError("No IP address, abort call");
|
||||||
rc = ST_NOCALL8;
|
rc = MBERR_NO_IP_ADDRESS;
|
||||||
putstatus(addr, 10, rc);
|
putstatus(addr, 10, rc);
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
return rc;
|
return rc;
|
||||||
@ -244,15 +245,14 @@ int call(faddr *addr)
|
|||||||
IsDoing("Call %s", ascfnode(addr, 0x0f));
|
IsDoing("Call %s", ascfnode(addr, 0x0f));
|
||||||
rc = portopen(addr);
|
rc = portopen(addr);
|
||||||
|
|
||||||
if ((rc == 0) && (!inetaddr)) {
|
if ((rc == MBERR_OK) && (!inetaddr)) {
|
||||||
if ((rc = dialphone(forcedphone?forcedphone:nlent->phone))) {
|
if ((rc = dialphone(forcedphone?forcedphone:nlent->phone))) {
|
||||||
Syslog('+', "Dial failed");
|
Syslog('+', "Dial failed");
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
rc+=1; /* rc=2 - dial fail, rc=3 - could not reset */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc == 0) {
|
if (rc == MBERR_OK) {
|
||||||
if (!inetaddr)
|
if (!inetaddr)
|
||||||
nolocalport();
|
nolocalport();
|
||||||
|
|
||||||
@ -260,9 +260,6 @@ int call(faddr *addr)
|
|||||||
rc = session(addr,nlent,SESSION_MASTER,SESSION_BINKP,NULL);
|
rc = session(addr,nlent,SESSION_MASTER,SESSION_BINKP,NULL);
|
||||||
else
|
else
|
||||||
rc = session(addr,nlent,SESSION_MASTER,SESSION_UNKNOWN,NULL);
|
rc = session(addr,nlent,SESSION_MASTER,SESSION_UNKNOWN,NULL);
|
||||||
|
|
||||||
if (rc)
|
|
||||||
rc=abs(rc)+10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IsDoing("Disconnect");
|
IsDoing("Disconnect");
|
||||||
@ -285,18 +282,15 @@ int call(faddr *addr)
|
|||||||
} else {
|
} else {
|
||||||
IsDoing("NoCall");
|
IsDoing("NoCall");
|
||||||
Syslog('+', "Cannot call %s (%s, phone %s)", ascfnode(addr,0x1f),MBSE_SS(nlent->name), MBSE_SS(nlent->phone));
|
Syslog('+', "Cannot call %s (%s, phone %s)", ascfnode(addr,0x1f),MBSE_SS(nlent->name), MBSE_SS(nlent->phone));
|
||||||
if ((nlent->phone || forcedphone || inetaddr ))
|
rc = MBERR_NO_CONNECTION;
|
||||||
rc=ST_NOCALL8;
|
|
||||||
else
|
|
||||||
rc=ST_NOCALL7;
|
|
||||||
putstatus(addr, 10, rc);
|
putstatus(addr, 10, rc);
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc > 10) && (rc < 20)) /* Session error */
|
if ((rc == MBERR_NOT_ZMH) || (rc == MBERR_UNKNOWN_SESSION)) /* Session error */
|
||||||
putstatus(addr, 5, rc);
|
putstatus(addr, 5, rc);
|
||||||
else if ((rc == 2) || (rc == 30))
|
else if ((rc == MBERR_NO_CONNECTION) || (rc == MBERR_SESSION_ERROR))
|
||||||
putstatus(addr,1,rc);
|
putstatus(addr,1,rc);
|
||||||
else
|
else
|
||||||
putstatus(addr,0,rc);
|
putstatus(addr,0,rc);
|
||||||
|
@ -72,6 +72,7 @@ void putstatus(faddr *addr, int incr, int sts)
|
|||||||
} else {
|
} else {
|
||||||
cst->tryno += incr;
|
cst->tryno += incr;
|
||||||
srand(getpid());
|
srand(getpid());
|
||||||
|
Syslog('d', "putstatus %s, incr=%d, tryno=%d, status=%d", ascfnode(addr, 0xf), incr, cst->tryno, sts);
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
j = 1+(int) (1.0 * CFG.dialdelay * rand() / (RAND_MAX + 1.0));
|
j = 1+(int) (1.0 * CFG.dialdelay * rand() / (RAND_MAX + 1.0));
|
||||||
if ((j > (CFG.dialdelay / 10)) && (j > 9))
|
if ((j > (CFG.dialdelay / 10)) && (j > 9))
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "chat.h"
|
#include "chat.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
@ -62,9 +63,9 @@ int initmodem(void)
|
|||||||
if (strlen(modem.init[i]))
|
if (strlen(modem.init[i]))
|
||||||
if (chat(modem.init[i], CFG.timeoutreset, FALSE, NULL)) {
|
if (chat(modem.init[i], CFG.timeoutreset, FALSE, NULL)) {
|
||||||
WriteError("dial: could not reset the modem");
|
WriteError("dial: could not reset the modem");
|
||||||
return 1;
|
return MBERR_MODEM_ERROR;
|
||||||
}
|
}
|
||||||
return 0;
|
return MBERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ int dialphone(char *Phone)
|
|||||||
carrier = FALSE;
|
carrier = FALSE;
|
||||||
|
|
||||||
if (initmodem())
|
if (initmodem())
|
||||||
return 2;
|
return MBERR_MODEM_ERROR;
|
||||||
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
if (strlen(nodes.phone[0])) {
|
if (strlen(nodes.phone[0])) {
|
||||||
@ -100,11 +101,11 @@ int dialphone(char *Phone)
|
|||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
Syslog('+', "Could not connect to the remote");
|
Syslog('+', "Could not connect to the remote");
|
||||||
return 1;
|
return MBERR_NO_CONNECTION;
|
||||||
} else {
|
} else {
|
||||||
c_start = time(NULL);
|
c_start = time(NULL);
|
||||||
carrier = TRUE;
|
carrier = TRUE;
|
||||||
return 0;
|
return MBERR_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +148,7 @@ int hangup()
|
|||||||
}
|
}
|
||||||
FLUSHIN();
|
FLUSHIN();
|
||||||
FLUSHOUT();
|
FLUSHOUT();
|
||||||
return 0;
|
return MBERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "statetbl.h"
|
#include "statetbl.h"
|
||||||
@ -105,7 +106,7 @@ int rx_emsi(char *data)
|
|||||||
caller=0;
|
caller=0;
|
||||||
|
|
||||||
if ((rc=rxemsi()))
|
if ((rc=rxemsi()))
|
||||||
return rc;
|
return MBERR_EMSI;
|
||||||
|
|
||||||
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
|
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
|
||||||
Syslog('i', "remote lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_remote_lcodes,emsi_remote_protos,emsi_remote_opts);
|
Syslog('i', "remote lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_remote_lcodes,emsi_remote_protos,emsi_remote_opts);
|
||||||
@ -179,7 +180,7 @@ int rx_emsi(char *data)
|
|||||||
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
|
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
|
||||||
|
|
||||||
if ((rc=txemsi()))
|
if ((rc=txemsi()))
|
||||||
return rc;
|
return MBERR_EMSI;
|
||||||
|
|
||||||
if (denypw || (emsi_local_protos == 0)) {
|
if (denypw || (emsi_local_protos == 0)) {
|
||||||
Syslog('+', "Refusing remote: %s", emsi_local_protos?"bad password presented": "no common protocols");
|
Syslog('+', "Refusing remote: %s", emsi_local_protos?"bad password presented": "no common protocols");
|
||||||
@ -243,10 +244,10 @@ int tx_emsi(char *data)
|
|||||||
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
|
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
|
||||||
|
|
||||||
if ((rc=txemsi()))
|
if ((rc=txemsi()))
|
||||||
return rc;
|
return MBERR_EMSI;
|
||||||
else {
|
else {
|
||||||
if ((rc=rxemsi()))
|
if ((rc=rxemsi()))
|
||||||
return rc;
|
return MBERR_EMSI;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((emsi_remote_opts & OPT_EII) == 0) {
|
if ((emsi_remote_opts & OPT_EII) == 0) {
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
#include "statetbl.h"
|
#include "statetbl.h"
|
||||||
@ -62,23 +63,26 @@ extern int Loaded;
|
|||||||
|
|
||||||
int rx_ftsc(void)
|
int rx_ftsc(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
Syslog('+', "Start inbound FTS-0001 session");
|
Syslog('+', "Start inbound FTS-0001 session");
|
||||||
IsDoing("FTS-0001 inbound");
|
IsDoing("FTS-0001 inbound");
|
||||||
|
|
||||||
session_flags |= SESSION_BARK;
|
session_flags |= SESSION_BARK;
|
||||||
if ((rc = rxftsc())) {
|
if ((rc = rxftsc())) {
|
||||||
WriteError("Session failed: rc=%d",rc);
|
WriteError("Session failed: rc=%d",rc);
|
||||||
PUTCHAR(CAN);
|
PUTCHAR(CAN);
|
||||||
PUTCHAR(CAN);
|
PUTCHAR(CAN);
|
||||||
PUTCHAR(CAN);
|
PUTCHAR(CAN);
|
||||||
} else
|
} else
|
||||||
Syslog('+', "FTS-0001 session completed");
|
Syslog('+', "FTS-0001 session completed");
|
||||||
|
|
||||||
tidy_filelist(tosend, (rc == 0));
|
tidy_filelist(tosend, (rc == 0));
|
||||||
tosend = NULL;
|
tosend = NULL;
|
||||||
return rc;
|
if (rc)
|
||||||
|
return MBERR_FTSC;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -86,22 +90,25 @@ int rx_ftsc(void)
|
|||||||
|
|
||||||
int tx_ftsc(void)
|
int tx_ftsc(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
Syslog('+', "Start outbound FTS-0001 session with %s", ascfnode(remote->addr,0x1f));
|
Syslog('+', "Start outbound FTS-0001 session with %s", ascfnode(remote->addr,0x1f));
|
||||||
IsDoing("FTS-0001 to %s", ascfnode(remote->addr, 0x0f));
|
IsDoing("FTS-0001 to %s", ascfnode(remote->addr, 0x0f));
|
||||||
|
|
||||||
if ((rc = txftsc())) {
|
if ((rc = txftsc())) {
|
||||||
WriteError("Session failed: rc=%d",rc);
|
WriteError("Session failed: rc=%d",rc);
|
||||||
PUTCHAR(CAN);
|
PUTCHAR(CAN);
|
||||||
PUTCHAR(CAN);
|
PUTCHAR(CAN);
|
||||||
PUTCHAR(CAN);
|
PUTCHAR(CAN);
|
||||||
} else
|
} else
|
||||||
Syslog('+', "FTS-0001 session completed");
|
Syslog('+', "FTS-0001 session completed");
|
||||||
|
|
||||||
tidy_filelist(tosend, (rc == 0));
|
tidy_filelist(tosend, (rc == 0));
|
||||||
tosend = NULL;
|
tosend = NULL;
|
||||||
return rc;
|
if (rc)
|
||||||
|
return MBERR_FTSC;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "filelist.h"
|
#include "filelist.h"
|
||||||
#include "filetime.h"
|
#include "filetime.h"
|
||||||
@ -278,7 +279,7 @@ enum HyPktTypes hyrxpkt(char *rxbuf, int *rxlen, int tot)
|
|||||||
|
|
||||||
if ((i & ~0x0f) || (n & ~ 0x0f)) {
|
if ((i & ~0x0f) || (n & ~ 0x0f)) {
|
||||||
Syslog('+', "Hydra: RXPKT assert");
|
Syslog('+', "Hydra: RXPKT assert");
|
||||||
die(1);
|
die(MBERR_FTRANSFER);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +296,7 @@ enum HyPktTypes hyrxpkt(char *rxbuf, int *rxlen, int tot)
|
|||||||
case HCHR_UUEPKT:
|
case HCHR_UUEPKT:
|
||||||
default:
|
default:
|
||||||
Syslog('+', "Hydra: RXPKT assert");
|
Syslog('+', "Hydra: RXPKT assert");
|
||||||
die(1);
|
die(MBERR_FTRANSFER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((format != HCHR_HEXPKT) && (rxoptions & HOPT_CRC32)) {
|
if ((format != HCHR_HEXPKT) && (rxoptions & HOPT_CRC32)) {
|
||||||
@ -449,7 +450,7 @@ void hytxpkt(enum HyPktTypes pkttype, char *txbuf, int txlen)
|
|||||||
case HCHR_UUEPKT:
|
case HCHR_UUEPKT:
|
||||||
default:
|
default:
|
||||||
Syslog('+', "Hydra: TXPKT assert");
|
Syslog('+', "Hydra: TXPKT assert");
|
||||||
die(1);
|
die(MBERR_FTRANSFER);
|
||||||
}
|
}
|
||||||
|
|
||||||
*outbuf++ = H_DLE;
|
*outbuf++ = H_DLE;
|
||||||
@ -1196,7 +1197,7 @@ int hydra_batch(int role, file_list *to_send)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
die(1);
|
die(MBERR_FTRANSFER);
|
||||||
} /* switch (txstate) */
|
} /* switch (txstate) */
|
||||||
|
|
||||||
switch (rxstate) {
|
switch (rxstate) {
|
||||||
@ -1586,10 +1587,10 @@ int hydra_batch(int role, file_list *to_send)
|
|||||||
sleep(4); /* wait a few seconds... */
|
sleep(4); /* wait a few seconds... */
|
||||||
FLUSHIN();
|
FLUSHIN();
|
||||||
|
|
||||||
return 2;
|
return MBERR_FTRANSFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return MBERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
#include "../lib/dbftn.h"
|
#include "../lib/dbftn.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "answer.h"
|
#include "answer.h"
|
||||||
#include "call.h"
|
#include "call.h"
|
||||||
@ -182,7 +183,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(101);
|
exit(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
InitConfig();
|
InitConfig();
|
||||||
@ -254,7 +255,7 @@ int main(int argc, char *argv[])
|
|||||||
tcp_mode = TCPMODE_IBN;
|
tcp_mode = TCPMODE_IBN;
|
||||||
else {
|
else {
|
||||||
usage();
|
usage();
|
||||||
die(101);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
free(p);
|
free(p);
|
||||||
RegTCP();
|
RegTCP();
|
||||||
@ -267,7 +268,7 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default: usage();
|
default: usage();
|
||||||
die(101);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -305,7 +306,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(100);
|
exit(MBERROR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((strcasecmp(argv[optind],"tsync") == 0) ||
|
if ((strcasecmp(argv[optind],"tsync") == 0) ||
|
||||||
@ -364,11 +365,11 @@ int main(int argc, char *argv[])
|
|||||||
* Don't do outbound calls if low diskspace
|
* Don't do outbound calls if low diskspace
|
||||||
*/
|
*/
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
if (callist == NULL) {
|
if (callist == NULL) {
|
||||||
WriteError("Calling mbcico without node address not supported anymore");
|
WriteError("Calling mbcico without node address not supported anymore");
|
||||||
die(101);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tmpl = &callist; *tmpl; tmpl = &((*tmpl)->next)) {
|
for (tmpl = &callist; *tmpl; tmpl = &((*tmpl)->next)) {
|
||||||
@ -401,9 +402,9 @@ int main(int argc, char *argv[])
|
|||||||
tidy_falist(&callist);
|
tidy_falist(&callist);
|
||||||
|
|
||||||
if (maxrc)
|
if (maxrc)
|
||||||
die(maxrc+100);
|
die(maxrc);
|
||||||
else
|
else
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
#include "../lib/dbftn.h"
|
#include "../lib/dbftn.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "outstat.h"
|
#include "outstat.h"
|
||||||
#include "nlinfo.h"
|
#include "nlinfo.h"
|
||||||
|
|
||||||
@ -147,21 +148,21 @@ void Help()
|
|||||||
colour(3, 0);
|
colour(3, 0);
|
||||||
printf(" -quiet Quiet mode\n");
|
printf(" -quiet Quiet mode\n");
|
||||||
colour(7, 0);
|
colour(7, 0);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Fatal(char *);
|
void Fatal(char *, int);
|
||||||
void Fatal(char *msg)
|
void Fatal(char *msg, int error)
|
||||||
{
|
{
|
||||||
show_log = TRUE;
|
show_log = TRUE;
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
colour(12, 0);
|
colour(12, 0);
|
||||||
printf("%s\n", msg);
|
printf("%s\n", msg);
|
||||||
}
|
}
|
||||||
WriteError(msg);
|
WriteError(msg);
|
||||||
die(100);
|
die(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -243,12 +244,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(pw->pw_name, "mbse"))
|
if (strcmp(pw->pw_name, "mbse"))
|
||||||
Fatal((char *)"You are not user 'mbse'");
|
Fatal((char *)"You are not user 'mbse'", MBERR_COMMANDLINE);
|
||||||
|
|
||||||
if (do_stat) {
|
if (do_stat) {
|
||||||
rc = outstat();
|
rc = outstat();
|
||||||
if (rc)
|
|
||||||
rc += 100;
|
|
||||||
die(rc);
|
die(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,19 +256,17 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
if (do_attach || do_node || do_poll || do_stop || do_req || do_reset) {
|
if (do_attach || do_node || do_poll || do_stop || do_req || do_reset) {
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
Fatal((char *)"Not enough parameters");
|
Fatal((char *)"Not enough parameters", MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_attach || do_node || do_req || do_reset) {
|
if (do_attach || do_node || do_req || do_reset) {
|
||||||
if ((addr = parsefaddr(argv[2])) == NULL)
|
if ((addr = parsefaddr(argv[2])) == NULL)
|
||||||
Fatal((char *)"Unrecognizable address");
|
Fatal((char *)"Unrecognizable address", MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_node) {
|
if (do_node) {
|
||||||
rc = nlinfo(addr);
|
rc = nlinfo(addr);
|
||||||
tidy_faddr(addr);
|
tidy_faddr(addr);
|
||||||
if (rc)
|
|
||||||
rc += 100;
|
|
||||||
die(rc);
|
die(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,15 +274,13 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 3; i <= argc; i++) {
|
for (i = 3; i <= argc; i++) {
|
||||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||||
if ((addr = parsefaddr(argv[i-1])) == NULL)
|
if ((addr = parsefaddr(argv[i-1])) == NULL)
|
||||||
Fatal((char *)"Unrecognizable address");
|
Fatal((char *)"Unrecognizable address", MBERR_COMMANDLINE);
|
||||||
j = poll(addr, do_stop);
|
j = poll(addr, do_stop);
|
||||||
tidy_faddr(addr);
|
tidy_faddr(addr);
|
||||||
if (j > rc)
|
if (j)
|
||||||
rc = j;
|
rc = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc)
|
|
||||||
rc = 100;
|
|
||||||
die(rc);
|
die(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,50 +288,48 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 3; i <= argc; i++) {
|
for (i = 3; i <= argc; i++) {
|
||||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||||
if ((addr = parsefaddr(argv[i-1])) == NULL)
|
if ((addr = parsefaddr(argv[i-1])) == NULL)
|
||||||
Fatal((char *)"Unrecognizable address");
|
Fatal((char *)"Unrecognizable address", MBERR_COMMANDLINE);
|
||||||
j = reset(addr);
|
j = reset(addr);
|
||||||
tidy_faddr(addr);
|
tidy_faddr(addr);
|
||||||
if (j > rc)
|
if (j)
|
||||||
rc = j;
|
rc = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc)
|
|
||||||
rc = 100;
|
|
||||||
die(rc);
|
die(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_attach) {
|
if (do_attach) {
|
||||||
if (argc < 5)
|
if (argc < 5)
|
||||||
Fatal((char *)"Not enough parameters");
|
Fatal((char *)"Not enough parameters", MBERR_COMMANDLINE);
|
||||||
flavor = tolower(argv[3][0]);
|
flavor = tolower(argv[3][0]);
|
||||||
switch (flavor) {
|
switch (flavor) {
|
||||||
case 'n' : flavor = 'f'; break;
|
case 'n' : flavor = 'f'; break;
|
||||||
case 'i' : flavor = 'i'; break;
|
case 'i' : flavor = 'i'; break;
|
||||||
case 'c' : flavor = 'c'; break;
|
case 'c' : flavor = 'c'; break;
|
||||||
case 'h' : flavor = 'h'; break;
|
case 'h' : flavor = 'h'; break;
|
||||||
default : Fatal((char *)"Invalid flavor, must be: immediate, crash, normal or hold");
|
default : Fatal((char *)"Invalid flavor, must be: immediate, crash, normal or hold", MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
nlent = getnlent(addr);
|
nlent = getnlent(addr);
|
||||||
if (nlent->pflag == NL_DUMMY)
|
if (nlent->pflag == NL_DUMMY)
|
||||||
Fatal((char *)"Node is not in nodelist");
|
Fatal((char *)"Node is not in nodelist", MBERR_NODE_NOT_IN_LIST);
|
||||||
if (nlent->pflag == NL_DOWN)
|
if (nlent->pflag == NL_DOWN)
|
||||||
Fatal((char *)"Node has status Down");
|
Fatal((char *)"Node has status Down", MBERR_NODE_MAY_NOT_CALL);
|
||||||
if (nlent->pflag == NL_HOLD)
|
if (nlent->pflag == NL_HOLD)
|
||||||
Fatal((char *)"Node has status Hold");
|
Fatal((char *)"Node has status Hold", MBERR_NODE_MAY_NOT_CALL);
|
||||||
if (((nlent->oflags & OL_CM) == 0) && (flavor == 'c'))
|
if (((nlent->oflags & OL_CM) == 0) && (flavor == 'c'))
|
||||||
Fatal((char *)"Node is not CM, must use Immediate, Normal or Hold flavor");
|
Fatal((char *)"Node is not CM, must use Immediate, Normal or Hold flavor", MBERR_NODE_MAY_NOT_CALL);
|
||||||
|
|
||||||
if (argv[4][0] == '-')
|
if (argv[4][0] == '-')
|
||||||
Fatal((char *)"Invalid filename given");
|
Fatal((char *)"Invalid filename given", MBERR_COMMANDLINE);
|
||||||
if (file_exist(argv[4], R_OK) != 0)
|
if (file_exist(argv[4], R_OK) != 0)
|
||||||
Fatal((char *)"File doesn't exist");
|
Fatal((char *)"File doesn't exist", MBERR_COMMANDLINE);
|
||||||
|
|
||||||
cmd = calloc(PATH_MAX, sizeof(char));
|
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);
|
sprintf(cmd, "%s/%d.%d.%d.%d/.filelist", CFG.out_queue, addr->zone, addr->net, addr->node, addr->point);
|
||||||
mkdirs(cmd, 0750);
|
mkdirs(cmd, 0750);
|
||||||
if ((fl = fopen(cmd, "a+")) == NULL) {
|
if ((fl = fopen(cmd, "a+")) == NULL) {
|
||||||
Fatal((char *)"File attach failed");
|
Fatal((char *)"File attach failed", MBERR_ATTACH_FAILED);
|
||||||
} else {
|
} else {
|
||||||
fprintf(fl, "%c LEAVE %s\n", flavor, argv[4]);
|
fprintf(fl, "%c LEAVE %s\n", flavor, argv[4]);
|
||||||
Syslog('+', "File attach %s is successfull", argv[4]);
|
Syslog('+', "File attach %s is successfull", argv[4]);
|
||||||
@ -347,14 +340,14 @@ int main(int argc, char *argv[])
|
|||||||
fsync(fileno(fl));
|
fsync(fileno(fl));
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_req) {
|
if (do_req) {
|
||||||
if (argc < 4)
|
if (argc < 4)
|
||||||
Fatal((char *)"Not enough parameters");
|
Fatal((char *)"Not enough parameters", MBERR_COMMANDLINE);
|
||||||
for (i = 4; i <= argc; i++) {
|
for (i = 4; i <= argc; i++) {
|
||||||
if (strncasecmp(argv[i-1], "-q", 2)) {
|
if (strncasecmp(argv[i-1], "-q", 2)) {
|
||||||
rc = freq(addr, argv[i-1]);
|
rc = freq(addr, argv[i-1]);
|
||||||
@ -362,8 +355,6 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc)
|
|
||||||
rc += 100;
|
|
||||||
die(rc);
|
die(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +362,7 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return MBERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
#include "../lib/dbftn.h"
|
#include "../lib/dbftn.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "scanout.h"
|
#include "scanout.h"
|
||||||
#include "callstat.h"
|
#include "callstat.h"
|
||||||
#include "outstat.h"
|
#include "outstat.h"
|
||||||
@ -82,7 +83,7 @@ int outstat()
|
|||||||
|
|
||||||
if ((rc = scanout(each))) {
|
if ((rc = scanout(each))) {
|
||||||
WriteError("Error scanning outbound, aborting");
|
WriteError("Error scanning outbound, aborting");
|
||||||
return rc;
|
return MBERR_OUTBOUND_SCAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -93,7 +94,7 @@ int outstat()
|
|||||||
if ((fp = fopen(temp, "r")) == NULL) {
|
if ((fp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("Error open %s, aborting", temp);
|
WriteError("Error open %s, aborting", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
return 1;
|
return MBERR_OUTBOUND_SCAN;
|
||||||
}
|
}
|
||||||
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
|
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
@ -364,24 +365,24 @@ int poll(faddr *addr, int stop)
|
|||||||
Syslog('+', "Node %s not in nodelist", ascfnode(addr, 0x1f));
|
Syslog('+', "Node %s not in nodelist", ascfnode(addr, 0x1f));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Node %s not in nodelist", ascfnode(addr, 0x1f));
|
printf("Node %s not in nodelist", ascfnode(addr, 0x1f));
|
||||||
return 1;
|
return MBERR_NODE_NOT_IN_LIST;
|
||||||
}
|
}
|
||||||
if (nlent->pflag == NL_DOWN) {
|
if (nlent->pflag == NL_DOWN) {
|
||||||
Syslog('+', "Node %s has status Down", ascfnode(addr, 0x1f));
|
Syslog('+', "Node %s has status Down", ascfnode(addr, 0x1f));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Node %s has status Down", ascfnode(addr, 0x1f));
|
printf("Node %s has status Down", ascfnode(addr, 0x1f));
|
||||||
return 1;
|
return MBERR_NODE_MAY_NOT_CALL;
|
||||||
}
|
}
|
||||||
if (nlent->pflag == NL_HOLD) {
|
if (nlent->pflag == NL_HOLD) {
|
||||||
Syslog('+', "Node %s has status Hold", ascfnode(addr, 0x1f));
|
Syslog('+', "Node %s has status Hold", ascfnode(addr, 0x1f));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Node %s has status Hold", ascfnode(addr, 0x1f));
|
printf("Node %s has status Hold", ascfnode(addr, 0x1f));
|
||||||
return 1;
|
return MBERR_NODE_MAY_NOT_CALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fp = fopen(pol, "w+")) == NULL) {
|
if ((fp = fopen(pol, "w+")) == NULL) {
|
||||||
WriteError("$Can't create poll for %s", ascfnode(addr, 0x1f));
|
WriteError("$Can't create poll for %s", ascfnode(addr, 0x1f));
|
||||||
rc = 1;
|
rc = MBERR_CANNOT_MAKE_POLL;
|
||||||
} else {
|
} else {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (((nlent->oflags & OL_CM) == 0) && (!IsZMH())) {
|
if (((nlent->oflags & OL_CM) == 0) && (!IsZMH())) {
|
||||||
@ -394,12 +395,13 @@ int poll(faddr *addr, int stop)
|
|||||||
printf("Created poll for %s\n", ascfnode(addr, 0x1f));
|
printf("Created poll for %s\n", ascfnode(addr, 0x1f));
|
||||||
}
|
}
|
||||||
cst = getstatus(addr);
|
cst = getstatus(addr);
|
||||||
if ((cst->trystat == 5) ||
|
if ((cst->trystat == MBERR_NODE_LOCKED) ||
|
||||||
(cst->trystat == ST_NOTZMH) ||
|
(cst->trystat == MBERR_NOT_ZMH) ||
|
||||||
(cst->trystat == ST_NOCONN) ||
|
(cst->trystat == MBERR_NO_CONNECTION) ||
|
||||||
(cst->trystat == ST_NOCALL7) ||
|
(cst->trystat == MBERR_SESSION_ERROR) ||
|
||||||
(cst->trystat == ST_NOCALL8) ||
|
(cst->trystat == MBERR_UNKNOWN_SESSION) ||
|
||||||
(cst->trystat > 10)) {
|
(cst->trystat == MBERR_NO_PORT_AVAILABLE) ||
|
||||||
|
(cst->trystat == MBERR_MODEM_ERROR)) {
|
||||||
putstatus(addr, 0, 0);
|
putstatus(addr, 0, 0);
|
||||||
}
|
}
|
||||||
CreateSema((char *)"scanout");
|
CreateSema((char *)"scanout");
|
||||||
@ -443,7 +445,7 @@ int freq(faddr *addr, char *fname)
|
|||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("File request failed\n");
|
printf("File request failed\n");
|
||||||
free(req);
|
free(req);
|
||||||
return 1;
|
return MBERR_REQUEST;
|
||||||
}
|
}
|
||||||
fprintf(fp, "%s\r\n", fname);
|
fprintf(fp, "%s\r\n", fname);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
#include "statetbl.h"
|
#include "statetbl.h"
|
||||||
#include "emsi.h"
|
#include "emsi.h"
|
||||||
@ -79,7 +80,7 @@ char *typestr(int tp)
|
|||||||
|
|
||||||
int session(faddr *a, node *nl, int role, int tp, char *dt)
|
int session(faddr *a, node *nl, int role, int tp, char *dt)
|
||||||
{
|
{
|
||||||
int rc = 1;
|
int rc = MBERR_OK;
|
||||||
fa_list *tmpl;
|
fa_list *tmpl;
|
||||||
struct sockaddr_in peeraddr;
|
struct sockaddr_in peeraddr;
|
||||||
int addrlen = sizeof(struct sockaddr_in);
|
int addrlen = sizeof(struct sockaddr_in);
|
||||||
@ -108,7 +109,7 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
|
|||||||
IsDoing("Incoming IFC/TCP");
|
IsDoing("Incoming IFC/TCP");
|
||||||
} else if (tcp_mode == TCPMODE_NONE) {
|
} else if (tcp_mode == TCPMODE_NONE) {
|
||||||
WriteError("Unknown TCP connection, parameter missing");
|
WriteError("Unknown TCP connection, parameter missing");
|
||||||
die(101);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
session_flags |= SESSION_TCP;
|
session_flags |= SESSION_TCP;
|
||||||
@ -147,11 +148,11 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
|
|||||||
if (type == SESSION_UNKNOWN)
|
if (type == SESSION_UNKNOWN)
|
||||||
(void)tx_define_type();
|
(void)tx_define_type();
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SESSION_UNKNOWN: rc=20; break;
|
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
|
||||||
case SESSION_FTSC: rc=tx_ftsc(); break;
|
case SESSION_FTSC: rc = tx_ftsc(); break;
|
||||||
case SESSION_YOOHOO: rc=tx_yoohoo(); break;
|
case SESSION_YOOHOO: rc = tx_yoohoo(); break;
|
||||||
case SESSION_EMSI: rc=tx_emsi(data); break;
|
case SESSION_EMSI: rc = tx_emsi(data); break;
|
||||||
case SESSION_BINKP: rc=binkp(role); break;
|
case SESSION_BINKP: rc = binkp(role); break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (type == SESSION_FTSC)
|
if (type == SESSION_FTSC)
|
||||||
@ -159,11 +160,11 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
|
|||||||
if (type == SESSION_UNKNOWN)
|
if (type == SESSION_UNKNOWN)
|
||||||
(void)rx_define_type();
|
(void)rx_define_type();
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SESSION_UNKNOWN: rc=20; break;
|
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
|
||||||
case SESSION_FTSC: rc=rx_ftsc(); break;
|
case SESSION_FTSC: rc = rx_ftsc(); break;
|
||||||
case SESSION_YOOHOO: rc=rx_yoohoo(); break;
|
case SESSION_YOOHOO: rc = rx_yoohoo(); break;
|
||||||
case SESSION_EMSI: rc=rx_emsi(data); break;
|
case SESSION_EMSI: rc = rx_emsi(data); break;
|
||||||
case SESSION_BINKP: rc=binkp(role); break;
|
case SESSION_BINKP: rc = binkp(role); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -84,7 +85,7 @@ int tcpsndfiles(file_list *lst)
|
|||||||
|
|
||||||
if (getsync()) {
|
if (getsync()) {
|
||||||
WriteError("Can't get synchronization");
|
WriteError("Can't get synchronization");
|
||||||
return 1;
|
return MBERR_FTRANSFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tmpf = lst; tmpf && (maxrc == 0); tmpf = tmpf->next) {
|
for (tmpf = lst; tmpf && (maxrc == 0); tmpf = tmpf->next) {
|
||||||
@ -108,9 +109,11 @@ int tcpsndfiles(file_list *lst)
|
|||||||
if (rc > maxrc)
|
if (rc > maxrc)
|
||||||
maxrc=rc;
|
maxrc=rc;
|
||||||
|
|
||||||
if (rc)
|
if (rc) {
|
||||||
WriteError("TCP send error: rc=%d",maxrc);
|
WriteError("TCP send error: rc=%d",maxrc);
|
||||||
return maxrc;
|
return MBERR_FTRANSFER;
|
||||||
|
} else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +127,7 @@ int tcprcvfiles(void)
|
|||||||
Syslog('+', "Start TCP receive");
|
Syslog('+', "Start TCP receive");
|
||||||
if (getsync()) {
|
if (getsync()) {
|
||||||
WriteError("Can't get synchronization");
|
WriteError("Can't get synchronization");
|
||||||
return 1;
|
return MBERR_FTRANSFER;
|
||||||
}
|
}
|
||||||
next:
|
next:
|
||||||
if ((rc = tcp_rblk(rxbuf, &bufl)) == 0) {
|
if ((rc = tcp_rblk(rxbuf, &bufl)) == 0) {
|
||||||
@ -155,9 +158,11 @@ next:
|
|||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc)
|
if (rc) {
|
||||||
WriteError("TCP receive error: rc=%d", rc);
|
WriteError("TCP receive error: rc=%d", rc);
|
||||||
return abs(rc);
|
return MBERR_FTRANSFER;
|
||||||
|
} else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
124
mbcico/wazoo.c
124
mbcico/wazoo.c
@ -34,6 +34,7 @@
|
|||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "statetbl.h"
|
#include "statetbl.h"
|
||||||
@ -50,80 +51,85 @@ extern int made_request;
|
|||||||
|
|
||||||
int rxwazoo(void)
|
int rxwazoo(void)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
fa_list *eff_remote, tmpl;
|
fa_list *eff_remote, tmpl;
|
||||||
file_list *tosend = NULL, **tmpfl;
|
file_list *tosend = NULL, **tmpfl;
|
||||||
|
|
||||||
Syslog('+', "Start WaZOO session");
|
Syslog('+', "Start WaZOO session");
|
||||||
|
|
||||||
if (emsi_remote_lcodes & LCODE_NPU) {
|
if (emsi_remote_lcodes & LCODE_NPU) {
|
||||||
Syslog('+', "Remote requested \"no pickup\", no send");
|
Syslog('+', "Remote requested \"no pickup\", no send");
|
||||||
eff_remote=NULL;
|
eff_remote=NULL;
|
||||||
} else if (emsi_remote_lcodes & LCODE_PUP) {
|
} else if (emsi_remote_lcodes & LCODE_PUP) {
|
||||||
Syslog('+', "Remote requested \"pickup primary\"");
|
Syslog('+', "Remote requested \"pickup primary\"");
|
||||||
tmpl.addr = remote->addr;
|
tmpl.addr = remote->addr;
|
||||||
tmpl.next = NULL;
|
tmpl.next = NULL;
|
||||||
eff_remote = &tmpl;
|
eff_remote = &tmpl;
|
||||||
} else eff_remote=remote;
|
} else eff_remote=remote;
|
||||||
|
|
||||||
tosend = create_filelist(eff_remote,(char *)ALL_MAIL,0);
|
tosend = create_filelist(eff_remote,(char *)ALL_MAIL,0);
|
||||||
|
|
||||||
if ((rc = zmrcvfiles()) == 0) {
|
if ((rc = zmrcvfiles()) == 0) {
|
||||||
if ((emsi_local_opts & OPT_NRQ) == 0) {
|
if ((emsi_local_opts & OPT_NRQ) == 0) {
|
||||||
for (tmpfl = &tosend; *tmpfl; tmpfl = &((*tmpfl)->next));
|
for (tmpfl = &tosend; *tmpfl; tmpfl = &((*tmpfl)->next));
|
||||||
*tmpfl = respond_wazoo();
|
*tmpfl = respond_wazoo();
|
||||||
}
|
|
||||||
|
|
||||||
if ((tosend != NULL) || ((emsi_remote_lcodes & LCODE_NPU) == 0))
|
|
||||||
rc = zmsndfiles(tosend);
|
|
||||||
|
|
||||||
if ((rc == 0) && (made_request)) {
|
|
||||||
Syslog('+', "Freq was made, trying to receive files");
|
|
||||||
rc = zmrcvfiles();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tidy_filelist(tosend, (rc == 0));
|
if ((tosend != NULL) || ((emsi_remote_lcodes & LCODE_NPU) == 0))
|
||||||
|
rc = zmsndfiles(tosend);
|
||||||
|
|
||||||
if (rc)
|
if ((rc == 0) && (made_request)) {
|
||||||
WriteError("WaZOO session failed: rc=%d", rc);
|
Syslog('+', "Freq was made, trying to receive files");
|
||||||
else
|
rc = zmrcvfiles();
|
||||||
Syslog('+', "WaZOO session completed");
|
}
|
||||||
return rc;
|
}
|
||||||
|
|
||||||
|
tidy_filelist(tosend, (rc == 0));
|
||||||
|
|
||||||
|
if (rc) {
|
||||||
|
WriteError("WaZOO session failed: rc=%d", rc);
|
||||||
|
return MBERR_WAZOO;
|
||||||
|
}
|
||||||
|
|
||||||
|
Syslog('+', "WaZOO session completed");
|
||||||
|
return MBERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int txwazoo(void)
|
int txwazoo(void)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
file_list *tosend = NULL, *respond = NULL;
|
file_list *tosend = NULL, *respond = NULL;
|
||||||
char *nonhold_mail;
|
char *nonhold_mail;
|
||||||
|
|
||||||
Syslog('+', "Start WaZOO session");
|
Syslog('+', "Start WaZOO session");
|
||||||
// if (localoptions & NOHOLD)
|
// if (localoptions & NOHOLD)
|
||||||
nonhold_mail = (char *)ALL_MAIL;
|
nonhold_mail = (char *)ALL_MAIL;
|
||||||
// else
|
// else
|
||||||
// nonhold_mail = (char *)NONHOLD_MAIL;
|
// nonhold_mail = (char *)NONHOLD_MAIL;
|
||||||
if (emsi_remote_lcodes & LCODE_HAT) {
|
if (emsi_remote_lcodes & LCODE_HAT) {
|
||||||
Syslog('+', "Remote asked to \"hold all traffic\", no send");
|
Syslog('+', "Remote asked to \"hold all traffic\", no send");
|
||||||
tosend = NULL;
|
tosend = NULL;
|
||||||
} else tosend = create_filelist(remote, nonhold_mail, 0);
|
} else tosend = create_filelist(remote, nonhold_mail, 0);
|
||||||
|
|
||||||
if ((tosend != NULL) || ((emsi_remote_lcodes & LCODE_NPU) == 0))
|
if ((tosend != NULL) || ((emsi_remote_lcodes & LCODE_NPU) == 0))
|
||||||
rc = zmsndfiles(tosend);
|
rc = zmsndfiles(tosend);
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
if ((rc = zmrcvfiles()) == 0)
|
if ((rc = zmrcvfiles()) == 0)
|
||||||
if ((emsi_local_opts & OPT_NRQ) == 0)
|
if ((emsi_local_opts & OPT_NRQ) == 0)
|
||||||
if ((respond = respond_wazoo()))
|
if ((respond = respond_wazoo()))
|
||||||
rc = zmsndfiles(respond);
|
rc = zmsndfiles(respond);
|
||||||
|
|
||||||
tidy_filelist(tosend,(rc == 0));
|
tidy_filelist(tosend,(rc == 0));
|
||||||
tidy_filelist(respond,0);
|
tidy_filelist(respond,0);
|
||||||
if (rc)
|
|
||||||
WriteError("WaZOO session failed: rc=%d", rc);
|
if (rc) {
|
||||||
else
|
WriteError("WaZOO session failed: rc=%d", rc);
|
||||||
Syslog('+', "WaZOO session completed");
|
return MBERR_WAZOO;
|
||||||
return rc;
|
}
|
||||||
|
|
||||||
|
Syslog('+', "WaZOO session completed");
|
||||||
|
return MBERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
282
mbcico/yoohoo.c
282
mbcico/yoohoo.c
@ -45,6 +45,7 @@
|
|||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/dbnode.h"
|
#include "../lib/dbnode.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "statetbl.h"
|
#include "statetbl.h"
|
||||||
#include "ttyio.h"
|
#include "ttyio.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
@ -121,165 +122,166 @@ Hello gethello2(unsigned char[]);
|
|||||||
|
|
||||||
int rx_yoohoo(void)
|
int rx_yoohoo(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
unsigned short capabilities,localcaps;
|
unsigned short capabilities,localcaps;
|
||||||
char *pwd = NULL;
|
char *pwd = NULL;
|
||||||
|
|
||||||
Syslog('+', "Start inbound YooHoo session");
|
Syslog('+', "Start inbound YooHoo session");
|
||||||
|
|
||||||
pwd = NULL;
|
pwd = NULL;
|
||||||
localcaps = LOCALCAPS;
|
localcaps = LOCALCAPS;
|
||||||
if (localoptions & NOZMODEM) localcaps &= ~(ZED_ZAPPER|ZED_ZIPPER);
|
if (localoptions & NOZMODEM) localcaps &= ~(ZED_ZAPPER|ZED_ZIPPER);
|
||||||
if (localoptions & NOZEDZAP) localcaps &= ~ZED_ZAPPER;
|
if (localoptions & NOZEDZAP) localcaps &= ~ZED_ZAPPER;
|
||||||
if (localoptions & NOHYDRA) localcaps &= ~DOES_HYDRA;
|
if (localoptions & NOHYDRA) localcaps &= ~DOES_HYDRA;
|
||||||
emsi_local_opts = 0;
|
emsi_local_opts = 0;
|
||||||
emsi_remote_opts = 0;
|
emsi_remote_opts = 0;
|
||||||
iscaller = 0;
|
iscaller = 0;
|
||||||
|
|
||||||
if ((rc = rxyoohoo()) == 0) {
|
if ((rc = rxyoohoo()) == 0) {
|
||||||
Loaded = checkhello();
|
Loaded = checkhello();
|
||||||
capabilities = hello2.capabilities;
|
capabilities = hello2.capabilities;
|
||||||
if (capabilities & WZ_FREQ)
|
if (capabilities & WZ_FREQ)
|
||||||
session_flags |= SESSION_WAZOO;
|
session_flags |= SESSION_WAZOO;
|
||||||
else
|
|
||||||
session_flags &= ~SESSION_WAZOO;
|
|
||||||
localcaps &= capabilities;
|
|
||||||
if (localcaps & DOES_HYDRA)
|
|
||||||
localcaps &= DOES_HYDRA;
|
|
||||||
else if (localcaps & ZED_ZAPPER)
|
|
||||||
localcaps &= ZED_ZAPPER;
|
|
||||||
else if (localcaps & ZED_ZIPPER)
|
|
||||||
localcaps &= ZED_ZIPPER;
|
|
||||||
else if (localcaps & FTB_USER)
|
|
||||||
localcaps &= FTB_USER;
|
|
||||||
else if (localcaps & Y_DIETIFNA)
|
|
||||||
localcaps &= Y_DIETIFNA;
|
|
||||||
if ((localoptions & NOFREQS) == 0)
|
|
||||||
localcaps |= WZ_FREQ;
|
|
||||||
else
|
|
||||||
emsi_local_opts |= OPT_NRQ;
|
|
||||||
|
|
||||||
if (((nlent=getnlent(remote->addr))) && (nlent->pflag != NL_DUMMY)) {
|
|
||||||
Syslog('+', "Remote is a listed system");
|
|
||||||
if (inbound)
|
|
||||||
free(inbound);
|
|
||||||
inbound = xstrcpy(CFG.inbound);
|
|
||||||
strncpy(history.location, nlent->location, 35);
|
|
||||||
}
|
|
||||||
if (nlent)
|
|
||||||
rdoptions(Loaded);
|
|
||||||
|
|
||||||
if (strlen(nodes.Spasswd)) {
|
|
||||||
if ((strncasecmp((char*)hello2.my_password, nodes.Spasswd, strlen(nodes.Spasswd)) == 0) &&
|
|
||||||
(strlen((char*)hello2.my_password) == strlen(nodes.Spasswd))) {
|
|
||||||
Syslog('+', "Password correct, protected mail session");
|
|
||||||
if (inbound)
|
|
||||||
free(inbound);
|
|
||||||
inbound = xstrcpy(CFG.pinbound);
|
|
||||||
pwd = xstrcpy(nodes.Spasswd);
|
|
||||||
} else {
|
|
||||||
pwd = (char *)"BAD_PASS";
|
|
||||||
Syslog('?', "Remote password \"%s\", expected \"%s\"", (char*)hello2.my_password, nodes.Spasswd);
|
|
||||||
localcaps = 0;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
Syslog('s', "No YooHoo password check");
|
|
||||||
fillhello(localcaps,pwd);
|
|
||||||
|
|
||||||
rc = txyoohoo();
|
|
||||||
if (pwd)
|
|
||||||
free(pwd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rc == 0) && ((localcaps & LOCALCAPS) == 0)) {
|
|
||||||
Syslog('+', "No common protocols or bad password");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
IsDoing("Inbound %s", ascfnode(remote->addr, 0x0f));
|
|
||||||
|
|
||||||
session_flags |= SESSION_WAZOO;
|
|
||||||
if (localcaps & DOES_HYDRA)
|
|
||||||
return hydra(0);
|
|
||||||
else if ((localcaps & ZED_ZAPPER) || (localcaps & ZED_ZIPPER)) {
|
|
||||||
if (localcaps & ZED_ZAPPER)
|
|
||||||
emsi_local_protos = PROT_ZAP;
|
|
||||||
else
|
|
||||||
emsi_local_protos = PROT_ZMO;
|
|
||||||
return rxwazoo();
|
|
||||||
} else if (localcaps & Y_DIETIFNA)
|
|
||||||
return rxdietifna();
|
|
||||||
else
|
else
|
||||||
WriteError("YooHoo internal error - no proto for 0x%04xh",localcaps);
|
session_flags &= ~SESSION_WAZOO;
|
||||||
return 1;
|
localcaps &= capabilities;
|
||||||
|
if (localcaps & DOES_HYDRA)
|
||||||
|
localcaps &= DOES_HYDRA;
|
||||||
|
else if (localcaps & ZED_ZAPPER)
|
||||||
|
localcaps &= ZED_ZAPPER;
|
||||||
|
else if (localcaps & ZED_ZIPPER)
|
||||||
|
localcaps &= ZED_ZIPPER;
|
||||||
|
else if (localcaps & FTB_USER)
|
||||||
|
localcaps &= FTB_USER;
|
||||||
|
else if (localcaps & Y_DIETIFNA)
|
||||||
|
localcaps &= Y_DIETIFNA;
|
||||||
|
if ((localoptions & NOFREQS) == 0)
|
||||||
|
localcaps |= WZ_FREQ;
|
||||||
|
else
|
||||||
|
emsi_local_opts |= OPT_NRQ;
|
||||||
|
|
||||||
|
if (((nlent=getnlent(remote->addr))) && (nlent->pflag != NL_DUMMY)) {
|
||||||
|
Syslog('+', "Remote is a listed system");
|
||||||
|
if (inbound)
|
||||||
|
free(inbound);
|
||||||
|
inbound = xstrcpy(CFG.inbound);
|
||||||
|
strncpy(history.location, nlent->location, 35);
|
||||||
|
}
|
||||||
|
if (nlent)
|
||||||
|
rdoptions(Loaded);
|
||||||
|
|
||||||
|
if (strlen(nodes.Spasswd)) {
|
||||||
|
if ((strncasecmp((char*)hello2.my_password, nodes.Spasswd, strlen(nodes.Spasswd)) == 0) &&
|
||||||
|
(strlen((char*)hello2.my_password) == strlen(nodes.Spasswd))) {
|
||||||
|
Syslog('+', "Password correct, protected mail session");
|
||||||
|
if (inbound)
|
||||||
|
free(inbound);
|
||||||
|
inbound = xstrcpy(CFG.pinbound);
|
||||||
|
pwd = xstrcpy(nodes.Spasswd);
|
||||||
|
} else {
|
||||||
|
pwd = (char *)"BAD_PASS";
|
||||||
|
Syslog('?', "Remote password \"%s\", expected \"%s\"", (char*)hello2.my_password, nodes.Spasswd);
|
||||||
|
localcaps = 0;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
Syslog('s', "No YooHoo password check");
|
||||||
|
|
||||||
|
fillhello(localcaps,pwd);
|
||||||
|
|
||||||
|
rc = txyoohoo();
|
||||||
|
if (pwd)
|
||||||
|
free(pwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rc == 0) && ((localcaps & LOCALCAPS) == 0)) {
|
||||||
|
Syslog('+', "No common protocols or bad password");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (rc)
|
||||||
|
return MBERR_YOOHOO;
|
||||||
|
|
||||||
|
IsDoing("Inbound %s", ascfnode(remote->addr, 0x0f));
|
||||||
|
|
||||||
|
session_flags |= SESSION_WAZOO;
|
||||||
|
if (localcaps & DOES_HYDRA)
|
||||||
|
return hydra(0);
|
||||||
|
else if ((localcaps & ZED_ZAPPER) || (localcaps & ZED_ZIPPER)) {
|
||||||
|
if (localcaps & ZED_ZAPPER)
|
||||||
|
emsi_local_protos = PROT_ZAP;
|
||||||
|
else
|
||||||
|
emsi_local_protos = PROT_ZMO;
|
||||||
|
return rxwazoo();
|
||||||
|
} else if (localcaps & Y_DIETIFNA)
|
||||||
|
return rxdietifna();
|
||||||
|
|
||||||
|
WriteError("YooHoo internal error - no proto for 0x%04xh",localcaps);
|
||||||
|
return MBERR_YOOHOO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int tx_yoohoo(void)
|
int tx_yoohoo(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
unsigned short capabilities;
|
unsigned short capabilities;
|
||||||
char *pwd;
|
char *pwd;
|
||||||
|
|
||||||
Syslog('+', "Start outbound YooHoo session");
|
Syslog('+', "Start outbound YooHoo session");
|
||||||
|
|
||||||
if (strlen(nodes.Spasswd))
|
if (strlen(nodes.Spasswd))
|
||||||
pwd = xstrcpy(nodes.Spasswd);
|
pwd = xstrcpy(nodes.Spasswd);
|
||||||
else
|
else
|
||||||
pwd = NULL;
|
pwd = NULL;
|
||||||
|
|
||||||
capabilities = LOCALCAPS;
|
capabilities = LOCALCAPS;
|
||||||
if (localoptions & NOZMODEM)
|
if (localoptions & NOZMODEM)
|
||||||
capabilities &= ~(ZED_ZAPPER|ZED_ZIPPER);
|
capabilities &= ~(ZED_ZAPPER|ZED_ZIPPER);
|
||||||
if (localoptions & NOZEDZAP)
|
if (localoptions & NOZEDZAP)
|
||||||
capabilities &= ~ZED_ZAPPER;
|
capabilities &= ~ZED_ZAPPER;
|
||||||
if (localoptions & NOHYDRA)
|
if (localoptions & NOHYDRA)
|
||||||
capabilities &= ~DOES_HYDRA;
|
capabilities &= ~DOES_HYDRA;
|
||||||
if ((localoptions & NOFREQS) == 0)
|
if ((localoptions & NOFREQS) == 0)
|
||||||
capabilities |= WZ_FREQ;
|
capabilities |= WZ_FREQ;
|
||||||
|
else
|
||||||
|
emsi_local_opts |= OPT_NRQ;
|
||||||
|
|
||||||
|
fillhello(capabilities,pwd);
|
||||||
|
iscaller=1;
|
||||||
|
|
||||||
|
if ((rc = txyoohoo()) == 0) {
|
||||||
|
rc = rxyoohoo();
|
||||||
|
checkhello();
|
||||||
|
capabilities = hello2.capabilities;
|
||||||
|
if (capabilities & WZ_FREQ)
|
||||||
|
session_flags |= SESSION_WAZOO;
|
||||||
else
|
else
|
||||||
emsi_local_opts |= OPT_NRQ;
|
session_flags &= ~SESSION_WAZOO;
|
||||||
|
}
|
||||||
|
|
||||||
fillhello(capabilities,pwd);
|
if ((rc == 0) && ((capabilities & LOCALCAPS) == 0)) {
|
||||||
iscaller=1;
|
Syslog('+', "No common protocols");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((rc = txyoohoo()) == 0) {
|
if (rc)
|
||||||
rc = rxyoohoo();
|
return MBERR_YOOHOO;
|
||||||
checkhello();
|
|
||||||
capabilities = hello2.capabilities;
|
|
||||||
if (capabilities & WZ_FREQ)
|
|
||||||
session_flags |= SESSION_WAZOO;
|
|
||||||
else
|
|
||||||
session_flags &= ~SESSION_WAZOO;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rc == 0) && ((capabilities & LOCALCAPS) == 0)) {
|
IsDoing("Outbound %s", ascfnode(remote->addr, 0x0f));
|
||||||
Syslog('+', "No common protocols");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc)
|
session_flags |= SESSION_WAZOO;
|
||||||
return rc;
|
if (capabilities & DOES_HYDRA)
|
||||||
|
return hydra(1);
|
||||||
IsDoing("Outbound %s", ascfnode(remote->addr, 0x0f));
|
else if ((capabilities & ZED_ZAPPER) || (capabilities & ZED_ZIPPER)) {
|
||||||
|
if (capabilities & ZED_ZAPPER)
|
||||||
session_flags |= SESSION_WAZOO;
|
emsi_local_protos = PROT_ZAP;
|
||||||
if (capabilities & DOES_HYDRA)
|
|
||||||
return hydra(1);
|
|
||||||
else if ((capabilities & ZED_ZAPPER) || (capabilities & ZED_ZIPPER)) {
|
|
||||||
if (capabilities & ZED_ZAPPER)
|
|
||||||
emsi_local_protos = PROT_ZAP;
|
|
||||||
else
|
|
||||||
emsi_local_protos = PROT_ZMO;
|
|
||||||
return txwazoo();
|
|
||||||
} else if (capabilities & Y_DIETIFNA)
|
|
||||||
return txdietifna();
|
|
||||||
else
|
else
|
||||||
WriteError("YooHoo internal error - no proto for 0x%04xh",capabilities);
|
emsi_local_protos = PROT_ZMO;
|
||||||
return 1;
|
return txwazoo();
|
||||||
|
} else if (capabilities & Y_DIETIFNA)
|
||||||
|
return txdietifna();
|
||||||
|
|
||||||
|
WriteError("YooHoo internal error - no proto for 0x%04xh",capabilities);
|
||||||
|
return MBERR_YOOHOO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ addbbs.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
|
|||||||
backalias.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h backalias.h
|
backalias.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h backalias.h
|
||||||
flock.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h flock.h
|
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 ../lib/mberrors.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 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 createm.h createf.h mgrutil.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 unpack.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 unpack.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
|
||||||
@ -148,7 +148,7 @@ addpkt.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
|
|||||||
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
|
||||||
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 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
|
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 ../lib/mberrors.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
|
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
|
||||||
ping.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h postnetmail.h ping.h
|
ping.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h postnetmail.h ping.h
|
||||||
rfc2ftn.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h postnetmail.h postecho.h msgflags.h rfc2ftn.h
|
rfc2ftn.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h postnetmail.h postecho.h msgflags.h rfc2ftn.h
|
||||||
@ -157,17 +157,17 @@ unpack.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
|
|||||||
aliasdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h aliasdb.h
|
aliasdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h aliasdb.h
|
||||||
fsort.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h fsort.h
|
fsort.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h fsort.h
|
||||||
magic.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 tic.h utic.h magic.h
|
magic.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 tic.h utic.h magic.h
|
||||||
mbfile.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 mbfkill.h mbfadopt.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfimport.h mbftoberep.h mbfmove.h mbfdel.h mbfutil.h mbfile.h
|
mbfile.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 ../lib/mberrors.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: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h
|
mover.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h
|
||||||
post.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 ../lib/msg.h ../lib/msgtext.h post.h
|
post.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 ../lib/msg.h ../lib/msgtext.h post.h
|
||||||
rnews.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h rfc2ftn.h mbfido.h ../paths.h rnews.h
|
rnews.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h ../lib/mberrors.h rfc2ftn.h mbfido.h ../paths.h rnews.h
|
||||||
storenet.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/msg.h ../lib/msgtext.h ../lib/dbmsgs.h ../lib/dbuser.h msgflags.h rollover.h storenet.h
|
storenet.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/msg.h ../lib/msgtext.h ../lib/dbmsgs.h ../lib/dbuser.h msgflags.h rollover.h storenet.h
|
||||||
utic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h tic.h utic.h
|
utic.o: ../config.h ../lib/libs.h ../lib/memwatch.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: ../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 ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h announce.h
|
announce.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 ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h announce.h
|
||||||
fflist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h ../lib/msg.h fflist.h
|
fflist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h ../lib/msg.h fflist.h
|
||||||
ftn2rfc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbftn.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h rollover.h aliasdb.h postemail.h backalias.h msgflags.h ftn2rfc.h
|
ftn2rfc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbftn.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h rollover.h aliasdb.h postemail.h backalias.h msgflags.h ftn2rfc.h
|
||||||
makestat.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/diesel.h ../lib/msg.h mgrutil.h makestat.h
|
makestat.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/diesel.h ../lib/msg.h mgrutil.h makestat.h
|
||||||
mbindex.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 ../lib/dbftn.h mbindex.h
|
mbindex.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 ../lib/dbftn.h ../lib/mberrors.h mbindex.h
|
||||||
msgutil.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 ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h msgutil.h
|
msgutil.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 ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h msgutil.h
|
||||||
postecho.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h
|
postecho.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h
|
||||||
rollover.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h rollover.h
|
rollover.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h rollover.h
|
||||||
@ -176,7 +176,7 @@ areamgr.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/u
|
|||||||
filefind.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 ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h fflist.h filefind.h msgutil.h
|
filefind.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 ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h fflist.h filefind.h msgutil.h
|
||||||
grlist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h grlist.h
|
grlist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h grlist.h
|
||||||
maketags.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h maketags.h
|
maketags.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h maketags.h
|
||||||
mbmsg.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/msg.h ../lib/dbcfg.h post.h mbmsg.h
|
mbmsg.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/msg.h ../lib/dbcfg.h ../lib/mberrors.h post.h mbmsg.h
|
||||||
newspost.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/mbinet.h newspost.h
|
newspost.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/mbinet.h newspost.h
|
||||||
postemail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h postemail.h
|
postemail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h postemail.h
|
||||||
scan.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msg.h ../lib/clcomm.h ../lib/msgtext.h ../lib/dbnode.h ../lib/dbmsgs.h addpkt.h tracker.h ftn2rfc.h rfc2ftn.h postemail.h scan.h
|
scan.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msg.h ../lib/clcomm.h ../lib/msgtext.h ../lib/dbnode.h ../lib/dbmsgs.h addpkt.h tracker.h ftn2rfc.h rfc2ftn.h postemail.h scan.h
|
||||||
@ -184,24 +184,24 @@ toberep.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/u
|
|||||||
atoul.o: ../config.h ../lib/libs.h ../lib/memwatch.h atoul.h
|
atoul.o: ../config.h ../lib/libs.h ../lib/memwatch.h atoul.h
|
||||||
filemgr.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ../lib/diesel.h sendmail.h mgrutil.h createf.h filemgr.h
|
filemgr.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ../lib/diesel.h sendmail.h mgrutil.h createf.h filemgr.h
|
||||||
hash.o: ../config.h ../lib/libs.h ../lib/memwatch.h hash.h lhash.h
|
hash.o: ../config.h ../lib/libs.h ../lib/memwatch.h hash.h lhash.h
|
||||||
mbaff.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 ../lib/msg.h announce.h filefind.h mbaff.h
|
mbaff.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 ../lib/msg.h ../lib/mberrors.h announce.h filefind.h mbaff.h
|
||||||
mbseq.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 mbseq.h
|
mbseq.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 mbseq.h
|
||||||
notify.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/msg.h ../lib/msgtext.h ../lib/dbnode.h filemgr.h areamgr.h sendmail.h mgrutil.h notify.h
|
notify.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/msg.h ../lib/msgtext.h ../lib/dbnode.h filemgr.h areamgr.h sendmail.h mgrutil.h notify.h
|
||||||
postnetmail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/common.h ../lib/records.h ../lib/dbcfg.h ../lib/dbuser.h ../lib/dbnode.h ../lib/dbftn.h ../lib/clcomm.h tracker.h addpkt.h storenet.h ftn2rfc.h areamgr.h filemgr.h ping.h bounce.h postemail.h
|
postnetmail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/common.h ../lib/records.h ../lib/dbcfg.h ../lib/dbuser.h ../lib/dbnode.h ../lib/dbftn.h ../lib/clcomm.h tracker.h addpkt.h storenet.h ftn2rfc.h areamgr.h filemgr.h ping.h bounce.h postemail.h
|
||||||
scannews.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h storeecho.h rfc2ftn.h scannews.h
|
scannews.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h storeecho.h rfc2ftn.h scannews.h
|
||||||
tosspkt.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h tosspkt.h postnetmail.h postecho.h rollover.h createm.h
|
tosspkt.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h tosspkt.h postnetmail.h postecho.h rollover.h createm.h
|
||||||
mbfkill.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 mbfkill.h mbfutil.h
|
mbfkill.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 ../lib/mberrors.h mbfkill.h mbfutil.h
|
||||||
mbfutil.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 mbfutil.h mbfile.h
|
mbfutil.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 ../lib/mberrors.h mbfutil.h mbfile.h
|
||||||
mbfindex.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 ../lib/diesel.h mbfutil.h mbfindex.h
|
mbfindex.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 ../lib/diesel.h ../lib/mberrors.h mbfutil.h mbfindex.h
|
||||||
mbfcheck.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 mbfutil.h mbfcheck.h
|
mbfcheck.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 ../lib/mberrors.h mbfutil.h mbfcheck.h
|
||||||
mbfpack.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 mbfutil.h mbfpack.h
|
mbfpack.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 ../lib/mberrors.h mbfutil.h mbfpack.h
|
||||||
mbflist.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 mbfutil.h mbflist.h
|
mbflist.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 ../lib/mberrors.h mbfutil.h mbflist.h
|
||||||
mbfadopt.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 virscan.h mbfutil.h mbflist.h
|
mbfadopt.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 ../lib/mberrors.h virscan.h mbfutil.h mbflist.h
|
||||||
mbfimport.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 virscan.h mbfutil.h mbfimport.h
|
mbfimport.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 ../lib/mberrors.h virscan.h mbfutil.h mbfimport.h
|
||||||
virscan.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h virscan.h
|
virscan.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h virscan.h
|
||||||
mbftoberep.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 mbfutil.h mbftoberep.h
|
mbftoberep.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 mbfutil.h mbftoberep.h
|
||||||
mbfmove.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 mbfutil.h mbfmove.h
|
mbfmove.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 ../lib/mberrors.h mbfutil.h mbfmove.h
|
||||||
mbfdel.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 mbfutil.h mbfmove.h
|
mbfdel.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 ../lib/mberrors.h mbfutil.h mbfmove.h
|
||||||
bounce.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h postnetmail.h ping.h
|
bounce.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h postnetmail.h ping.h
|
||||||
createm.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/msg.h mgrutil.h createm.h
|
createm.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/msg.h mgrutil.h createm.h
|
||||||
createf.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mgrutil.h createf.h
|
createf.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mgrutil.h createf.h
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "announce.h"
|
#include "announce.h"
|
||||||
#include "filefind.h"
|
#include "filefind.h"
|
||||||
#include "mbaff.h"
|
#include "mbaff.h"
|
||||||
@ -152,7 +153,7 @@ int main(int argc, char **argv)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
memset(&MsgBase, 0, sizeof(MsgBase));
|
memset(&MsgBase, 0, sizeof(MsgBase));
|
||||||
|
|
||||||
@ -169,7 +170,7 @@ int main(int argc, char **argv)
|
|||||||
CreateSema((char *)"msglink");
|
CreateSema((char *)"msglink");
|
||||||
}
|
}
|
||||||
|
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ void Help(void)
|
|||||||
printf(" -q -quiet Quiet mode\n");
|
printf(" -q -quiet Quiet mode\n");
|
||||||
colour(7, 0);
|
colour(7, 0);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
554
mbfido/mbdiff.c
554
mbfido/mbdiff.c
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbdiff.h"
|
#include "mbdiff.h"
|
||||||
|
|
||||||
|
|
||||||
@ -115,322 +116,317 @@ void die(int onsig)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, Match;
|
int i, Match, rc;
|
||||||
char *cmd, *nl = NULL, *nd = NULL, *nn;
|
char *cmd, *nl = NULL, *nd = NULL, *nn, *p, *q, *arc, *wrk, *onl, *ond;
|
||||||
int rc;
|
struct passwd *pw;
|
||||||
char *p, *q, *arc;
|
DIR *dp;
|
||||||
struct passwd *pw;
|
struct dirent *de;
|
||||||
char *wrk, *onl, *ond;
|
|
||||||
DIR *dp;
|
|
||||||
struct dirent *de;
|
|
||||||
|
|
||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwInit();
|
mwInit();
|
||||||
#endif
|
#endif
|
||||||
InitConfig();
|
InitConfig();
|
||||||
TermInit(1);
|
TermInit(1);
|
||||||
t_start = time(NULL);
|
t_start = time(NULL);
|
||||||
umask(002);
|
umask(002);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Catch all signals we can, and ignore the rest.
|
* Catch all signals we can, and ignore the rest.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) ||
|
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGKILL))
|
||||||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGKILL))
|
signal(i, (void (*))die);
|
||||||
signal(i, (void (*))die);
|
else
|
||||||
else
|
signal(i, SIG_IGN);
|
||||||
signal(i, SIG_IGN);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(argc < 3)
|
if(argc < 3)
|
||||||
|
Help();
|
||||||
|
|
||||||
|
cmd = xstrcpy((char *)"Cmd: mbdiff");
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
|
||||||
|
if (i == 1)
|
||||||
|
if ((nl = argv[i]) == NULL)
|
||||||
Help();
|
Help();
|
||||||
|
if (i == 2)
|
||||||
|
if ((nd = argv[i]) == NULL)
|
||||||
|
Help();
|
||||||
|
if (!strncasecmp(argv[i], "-q", 2))
|
||||||
|
do_quiet = TRUE;
|
||||||
|
|
||||||
cmd = xstrcpy((char *)"Cmd: mbdiff");
|
}
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
ProgName();
|
||||||
|
pw = getpwuid(getuid());
|
||||||
|
InitClient(pw->pw_name, (char *)"mbdiff", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||||
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
Syslog(' ', " ");
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
Syslog(' ', "MBDIFF v%s", VERSION);
|
||||||
|
Syslog(' ', cmd);
|
||||||
|
free(cmd);
|
||||||
|
|
||||||
if (i == 1)
|
if (!do_quiet) {
|
||||||
if ((nl = argv[i]) == NULL)
|
colour(12, 0);
|
||||||
Help();
|
printf("\n");
|
||||||
if (i == 2)
|
}
|
||||||
if ((nd = argv[i]) == NULL)
|
|
||||||
Help();
|
|
||||||
if (!strncasecmp(argv[i], "-q", 2))
|
|
||||||
do_quiet = TRUE;
|
|
||||||
|
|
||||||
|
if (!diskfree(CFG.freespace))
|
||||||
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Extract work directory from the first commandline parameter
|
||||||
|
* and set that directory as default.
|
||||||
|
*/
|
||||||
|
show_log = TRUE;
|
||||||
|
wrk = xstrcpy(nl);
|
||||||
|
if (strrchr(wrk, '/') == NULL) {
|
||||||
|
WriteError("No path in nodelist name");
|
||||||
|
free(wrk);
|
||||||
|
die(MBERR_COMMANDLINE);
|
||||||
|
}
|
||||||
|
if (strrchr(wrk, '.') != NULL) {
|
||||||
|
WriteError("Filename extension given for nodelist");
|
||||||
|
free(wrk);
|
||||||
|
die(MBERR_COMMANDLINE);
|
||||||
|
}
|
||||||
|
if (strrchr(nd, '/') == NULL) {
|
||||||
|
WriteError("No path in nodediff name");
|
||||||
|
free(wrk);
|
||||||
|
die(MBERR_COMMANDLINE);
|
||||||
|
}
|
||||||
|
show_log = FALSE;
|
||||||
|
|
||||||
|
while (wrk[strlen(wrk) -1] != '/')
|
||||||
|
wrk[strlen(wrk) -1] = '\0';
|
||||||
|
wrk[strlen(wrk) -1] = '\0';
|
||||||
|
|
||||||
|
show_log = TRUE;
|
||||||
|
if (access(wrk, R_OK|W_OK)) {
|
||||||
|
WriteError("$No R/W access in %s", wrk);
|
||||||
|
free(wrk);
|
||||||
|
die(MBERR_INIT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chdir(wrk)) {
|
||||||
|
WriteError("$Can't chdir to %s", wrk);
|
||||||
|
free(wrk);
|
||||||
|
die(MBERR_INIT_ERROR);
|
||||||
|
}
|
||||||
|
show_log = FALSE;
|
||||||
|
|
||||||
|
onl = xstrcpy(strrchr(nl, '/') + 1);
|
||||||
|
onl = xstrcat(onl, (char *)".???");
|
||||||
|
|
||||||
|
if ((dp = opendir(wrk)) == 0) {
|
||||||
|
show_log = TRUE;
|
||||||
|
free(wrk);
|
||||||
|
WriteError("$Error opening directory %s", wrk);
|
||||||
|
die(MBERR_INIT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
Match = FALSE;
|
||||||
|
while ((de = readdir(dp))) {
|
||||||
|
if (strlen(de->d_name) == strlen(onl)) {
|
||||||
|
Match = TRUE;
|
||||||
|
for (i = 0; i < strlen(onl); i++) {
|
||||||
|
if ((onl[i] != '?') && (onl[i] != de->d_name[i]))
|
||||||
|
Match = FALSE;
|
||||||
|
}
|
||||||
|
if (Match) {
|
||||||
|
free(onl);
|
||||||
|
onl = xstrcpy(de->d_name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
closedir(dp);
|
||||||
|
if (!Match) {
|
||||||
|
show_log = TRUE;
|
||||||
|
free(wrk);
|
||||||
|
free(onl);
|
||||||
|
WriteError("Old nodelist not found");
|
||||||
|
die(MBERR_INIT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
ProgName();
|
/*
|
||||||
pw = getpwuid(getuid());
|
* Now try to get the diff file into the workdir.
|
||||||
InitClient(pw->pw_name, (char *)"mbdiff", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
*/
|
||||||
|
if ((arc = unpacker(nd)) == NULL) {
|
||||||
|
show_log = TRUE;
|
||||||
|
free(onl);
|
||||||
|
free(wrk);
|
||||||
|
WriteError("Can't get filetype for %s", nd);
|
||||||
|
die(MBERR_CONFIG_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
Syslog(' ', " ");
|
ond = xstrcpy(strrchr(nd, '/') + 1);
|
||||||
Syslog(' ', "MBDIFF v%s", VERSION);
|
|
||||||
Syslog(' ', cmd);
|
|
||||||
free(cmd);
|
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (strncmp(arc, "ASC", 3)) {
|
||||||
colour(12, 0);
|
if (!getarchiver(arc)) {
|
||||||
printf("\n");
|
show_log = TRUE;
|
||||||
|
free(onl);
|
||||||
|
free(wrk);
|
||||||
|
free(ond);
|
||||||
|
WriteError("Can't find unarchiver %s", arc);
|
||||||
|
die(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
|
||||||
die(101);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract work directory from the first commandline parameter
|
* We may both use the unarchive command for files and mail,
|
||||||
* and set that directory as default.
|
* unarchiving isn't recursive anyway.
|
||||||
*/
|
*/
|
||||||
show_log = TRUE;
|
if (strlen(archiver.funarc))
|
||||||
wrk = xstrcpy(nl);
|
cmd = xstrcpy(archiver.funarc);
|
||||||
if (strrchr(wrk, '/') == NULL) {
|
else
|
||||||
WriteError("No path in nodelist name");
|
cmd = xstrcpy(archiver.munarc);
|
||||||
free(wrk);
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
if (strrchr(wrk, '.') != NULL) {
|
|
||||||
WriteError("Filename extension given for nodelist");
|
|
||||||
free(wrk);
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
if (strrchr(nd, '/') == NULL) {
|
|
||||||
WriteError("No path in nodediff name");
|
|
||||||
free(wrk);
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
show_log = FALSE;
|
|
||||||
|
|
||||||
while (wrk[strlen(wrk) -1] != '/')
|
if ((cmd == NULL) || (cmd == "")) {
|
||||||
wrk[strlen(wrk) -1] = '\0';
|
show_log = TRUE;
|
||||||
wrk[strlen(wrk) -1] = '\0';
|
free(cmd);
|
||||||
|
free(onl);
|
||||||
show_log = TRUE;
|
free(wrk);
|
||||||
if (access(wrk, R_OK|W_OK)) {
|
free(ond);
|
||||||
WriteError("$No R/W access in %s", wrk);
|
WriteError("No unarc command available for %s", arc);
|
||||||
free(wrk);
|
die(MBERR_CONFIG_ERROR);
|
||||||
die(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chdir(wrk)) {
|
if (execute(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) {
|
||||||
WriteError("$Can't chdir to %s", wrk);
|
show_log = TRUE;
|
||||||
free(wrk);
|
free(cmd);
|
||||||
die(100);
|
free(onl);
|
||||||
}
|
free(wrk);
|
||||||
show_log = FALSE;
|
free(ond);
|
||||||
|
WriteError("Unpack error");
|
||||||
onl = xstrcpy(strrchr(nl, '/') + 1);
|
die(MBERR_EXEC_FAILED);
|
||||||
onl = xstrcat(onl, (char *)".???");
|
|
||||||
|
|
||||||
if ((dp = opendir(wrk)) == 0) {
|
|
||||||
show_log = TRUE;
|
|
||||||
free(wrk);
|
|
||||||
WriteError("$Error opening directory %s", wrk);
|
|
||||||
die(100);
|
|
||||||
}
|
}
|
||||||
|
free(cmd);
|
||||||
|
sync();
|
||||||
|
|
||||||
Match = FALSE;
|
Match = FALSE;
|
||||||
while ((de = readdir(dp))) {
|
if ((dp = opendir(wrk)) != NULL) {
|
||||||
if (strlen(de->d_name) == strlen(onl)) {
|
while ((de = readdir(dp))) {
|
||||||
Match = TRUE;
|
if (strlen(ond) == strlen(de->d_name)) {
|
||||||
for (i = 0; i < strlen(onl); i++) {
|
Match = TRUE;
|
||||||
if ((onl[i] != '?') && (onl[i] != de->d_name[i]))
|
for (i = 0; i < (strlen(ond) -3); i++)
|
||||||
Match = FALSE;
|
if (toupper(ond[i]) != toupper(de->d_name[i]))
|
||||||
}
|
Match = FALSE;
|
||||||
if (Match) {
|
if (Match) {
|
||||||
free(onl);
|
free(ond);
|
||||||
onl = xstrcpy(de->d_name);
|
ond = xstrcpy(de->d_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
closedir(dp);
|
||||||
}
|
}
|
||||||
closedir(dp);
|
|
||||||
if (!Match) {
|
if (!Match) {
|
||||||
show_log = TRUE;
|
show_log = TRUE;
|
||||||
free(wrk);
|
free(ond);
|
||||||
free(onl);
|
free(onl);
|
||||||
WriteError("Old nodelist not found");
|
free(wrk);
|
||||||
die(100);
|
WriteError("Could not find extracted file");
|
||||||
|
die(MBERR_DIFF_ERROR);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
/*
|
if ((rc = file_cp(nd, ond))) {
|
||||||
* Now try to get the diff file into the workdir.
|
show_log = TRUE;
|
||||||
*/
|
free(ond);
|
||||||
if ((arc = unpacker(nd)) == NULL) {
|
free(onl);
|
||||||
show_log = TRUE;
|
free(wrk);
|
||||||
free(onl);
|
WriteError("Copy %s failed, %s", nd, strerror(rc));
|
||||||
free(wrk);
|
die(MBERR_DIFF_ERROR);
|
||||||
WriteError("Can't get filetype for %s", nd);
|
|
||||||
die(100);
|
|
||||||
}
|
}
|
||||||
|
Syslog('s', "Copied %s", nd);
|
||||||
|
}
|
||||||
|
|
||||||
ond = xstrcpy(strrchr(nd, '/') + 1);
|
if (((p = strrchr(onl, '.'))) && ((q = strrchr(ond, '.'))) && (strlen(p) == strlen(q))) {
|
||||||
|
nn = xstrcpy(onl);
|
||||||
if (strncmp(arc, "ASC", 3)) {
|
p = strrchr(nn, '.') + 1;
|
||||||
if (!getarchiver(arc)) {
|
q++;
|
||||||
show_log = TRUE;
|
strcpy(p, q);
|
||||||
free(onl);
|
} else
|
||||||
free(wrk);
|
nn = xstrcpy((char *)"newnodelist");
|
||||||
free(ond);
|
|
||||||
WriteError("Can't find unarchiver %s", arc);
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We may both use the unarchive command for files and mail,
|
|
||||||
* unarchiving isn't recursive anyway.
|
|
||||||
*/
|
|
||||||
if (strlen(archiver.funarc))
|
|
||||||
cmd = xstrcpy(archiver.funarc);
|
|
||||||
else
|
|
||||||
cmd = xstrcpy(archiver.munarc);
|
|
||||||
|
|
||||||
if ((cmd == NULL) || (cmd == "")) {
|
|
||||||
show_log = TRUE;
|
|
||||||
free(cmd);
|
|
||||||
free(onl);
|
|
||||||
free(wrk);
|
|
||||||
free(ond);
|
|
||||||
WriteError("No unarc command available for %s", arc);
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (execute(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) {
|
|
||||||
show_log = TRUE;
|
|
||||||
free(cmd);
|
|
||||||
free(onl);
|
|
||||||
free(wrk);
|
|
||||||
free(ond);
|
|
||||||
WriteError("Unpack error");
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
free(cmd);
|
|
||||||
sync();
|
|
||||||
|
|
||||||
Match = FALSE;
|
|
||||||
if ((dp = opendir(wrk)) != NULL) {
|
|
||||||
while ((de = readdir(dp))) {
|
|
||||||
if (strlen(ond) == strlen(de->d_name)) {
|
|
||||||
Match = TRUE;
|
|
||||||
for (i = 0; i < (strlen(ond) -3); i++)
|
|
||||||
if (toupper(ond[i]) != toupper(de->d_name[i]))
|
|
||||||
Match = FALSE;
|
|
||||||
if (Match) {
|
|
||||||
free(ond);
|
|
||||||
ond = xstrcpy(de->d_name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir(dp);
|
|
||||||
}
|
|
||||||
if (!Match) {
|
|
||||||
show_log = TRUE;
|
|
||||||
free(ond);
|
|
||||||
free(onl);
|
|
||||||
free(wrk);
|
|
||||||
WriteError("Could not find extracted file");
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((rc = file_cp(nd, ond))) {
|
|
||||||
show_log = TRUE;
|
|
||||||
free(ond);
|
|
||||||
free(onl);
|
|
||||||
free(wrk);
|
|
||||||
WriteError("Copy %s failed, %s", nd, strerror(rc));
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
Syslog('s', "Copied %s", nd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((p = strrchr(onl, '.'))) && ((q = strrchr(ond, '.'))) &&
|
|
||||||
(strlen(p) == strlen(q))) {
|
|
||||||
nn = xstrcpy(onl);
|
|
||||||
p = strrchr(nn, '.') + 1;
|
|
||||||
q++;
|
|
||||||
strcpy(p, q);
|
|
||||||
} else
|
|
||||||
nn = xstrcpy((char *)"newnodelist");
|
|
||||||
|
|
||||||
if (strcmp(onl, nn) == 0) {
|
|
||||||
show_log = TRUE;
|
|
||||||
WriteError("Attempt to update nodelist to the same version");
|
|
||||||
unlink(ond);
|
|
||||||
free(ond);
|
|
||||||
free(onl);
|
|
||||||
free(wrk);
|
|
||||||
free(nn);
|
|
||||||
die(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
Syslog('+', "Apply %s with %s to %s", onl, ond, nn);
|
|
||||||
if (!do_quiet) {
|
|
||||||
colour(3, 0);
|
|
||||||
printf("Apply %s with %s to %s\n", onl, ond, nn);
|
|
||||||
}
|
|
||||||
rc = apply(onl, ond, nn);
|
|
||||||
|
|
||||||
|
if (strcmp(onl, nn) == 0) {
|
||||||
|
show_log = TRUE;
|
||||||
|
WriteError("Attempt to update nodelist to the same version");
|
||||||
unlink(ond);
|
unlink(ond);
|
||||||
if (rc) {
|
free(ond);
|
||||||
unlink(nn);
|
free(onl);
|
||||||
free(nn);
|
free(wrk);
|
||||||
|
free(nn);
|
||||||
|
die(MBERR_DIFF_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
Syslog('+', "Apply %s with %s to %s", onl, ond, nn);
|
||||||
|
if (!do_quiet) {
|
||||||
|
colour(3, 0);
|
||||||
|
printf("Apply %s with %s to %s\n", onl, ond, nn);
|
||||||
|
}
|
||||||
|
rc = apply(onl, ond, nn);
|
||||||
|
|
||||||
|
unlink(ond);
|
||||||
|
if (rc) {
|
||||||
|
unlink(nn);
|
||||||
|
free(nn);
|
||||||
|
free(ond);
|
||||||
|
free(onl);
|
||||||
|
free(wrk);
|
||||||
|
die(MBERR_DIFF_ERROR);
|
||||||
|
} else {
|
||||||
|
unlink(onl);
|
||||||
|
cmd = xstrcpy(archiver.farc);
|
||||||
|
|
||||||
|
if ((cmd == NULL) || (!strlen(cmd))) {
|
||||||
|
free(cmd);
|
||||||
|
Syslog('+', "No archive command for %s, fallback to ZIP", arc);
|
||||||
|
if (!getarchiver((char *)"ZIP")) {
|
||||||
|
WriteError("No ZIP command available");
|
||||||
free(ond);
|
free(ond);
|
||||||
free(onl);
|
free(onl);
|
||||||
free(wrk);
|
free(wrk);
|
||||||
die(rc + 100);
|
free(nn);
|
||||||
} else {
|
die(MBERR_DIFF_ERROR);
|
||||||
unlink(onl);
|
} else {
|
||||||
cmd = xstrcpy(archiver.farc);
|
cmd = xstrcpy(archiver.farc);
|
||||||
|
}
|
||||||
if ((cmd == NULL) || (!strlen(cmd))) {
|
} else {
|
||||||
free(cmd);
|
free(cmd);
|
||||||
Syslog('+', "No archive command for %s, fallback to ZIP", arc);
|
cmd = xstrcpy(archiver.farc);
|
||||||
if (!getarchiver((char *)"ZIP")) {
|
|
||||||
WriteError("No ZIP command available");
|
|
||||||
free(ond);
|
|
||||||
free(onl);
|
|
||||||
free(wrk);
|
|
||||||
free(nn);
|
|
||||||
die(100);
|
|
||||||
} else {
|
|
||||||
cmd = xstrcpy(archiver.farc);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
free(cmd);
|
|
||||||
cmd = xstrcpy(archiver.farc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((cmd == NULL) || (!strlen(cmd))) {
|
|
||||||
WriteError("No archiver command available");
|
|
||||||
} else {
|
|
||||||
free(onl);
|
|
||||||
onl = xstrcpy(nn);
|
|
||||||
onl[strlen(onl) -3] = tolower(archiver.name[0]);
|
|
||||||
tl(onl);
|
|
||||||
p = xstrcpy(onl);
|
|
||||||
p = xstrcat(p, (char *)" ");
|
|
||||||
p = xstrcat(p, nn);
|
|
||||||
if (execute(cmd, p, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))
|
|
||||||
WriteError("Create %s failed", onl);
|
|
||||||
else {
|
|
||||||
CreateSema((char *)"mailin");
|
|
||||||
}
|
|
||||||
sync();
|
|
||||||
free(p);
|
|
||||||
free(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(onl);
|
|
||||||
free(ond);
|
|
||||||
free(wrk);
|
|
||||||
free(nn);
|
|
||||||
die(0);
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
if ((cmd == NULL) || (!strlen(cmd))) {
|
||||||
|
WriteError("No archiver command available");
|
||||||
|
} else {
|
||||||
|
free(onl);
|
||||||
|
onl = xstrcpy(nn);
|
||||||
|
onl[strlen(onl) -3] = tolower(archiver.name[0]);
|
||||||
|
tl(onl);
|
||||||
|
p = xstrcpy(onl);
|
||||||
|
p = xstrcat(p, (char *)" ");
|
||||||
|
p = xstrcat(p, nn);
|
||||||
|
if (execute(cmd, p, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))
|
||||||
|
WriteError("Create %s failed", onl);
|
||||||
|
else {
|
||||||
|
CreateSema((char *)"mailin");
|
||||||
|
}
|
||||||
|
sync();
|
||||||
|
free(p);
|
||||||
|
free(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(onl);
|
||||||
|
free(ond);
|
||||||
|
free(wrk);
|
||||||
|
free(nn);
|
||||||
|
die(MBERR_OK);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -455,7 +451,7 @@ void Help(void)
|
|||||||
printf(" -quiet Quiet mode\n");
|
printf(" -quiet Quiet mode\n");
|
||||||
colour(7, 0);
|
colour(7, 0);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
die(99);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "virscan.h"
|
#include "virscan.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbflist.h"
|
#include "mbflist.h"
|
||||||
@ -64,7 +65,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
|
|
||||||
if (LoadAreaRec(Area) == FALSE)
|
if (LoadAreaRec(Area) == FALSE)
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
|
|
||||||
if (area.Available) {
|
if (area.Available) {
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -73,7 +74,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
tmpdir = calloc(PATH_MAX, sizeof(char));
|
tmpdir = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
if (CheckFDB(Area, area.Path))
|
if (CheckFDB(Area, area.Path))
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
getcwd(pwd, PATH_MAX);
|
getcwd(pwd, PATH_MAX);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
@ -92,7 +93,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
} else {
|
} else {
|
||||||
if (do_novir == FALSE) {
|
if (do_novir == FALSE) {
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
@ -109,7 +110,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
WriteError("Virus found");
|
WriteError("Virus found");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Virus found\n");
|
printf("Virus found\n");
|
||||||
die(0);
|
die(MBERR_VIRUS_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -118,7 +119,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
MustRearc = TRUE;
|
MustRearc = TRUE;
|
||||||
UnPacked = UnpackFile(temp);
|
UnPacked = UnpackFile(temp);
|
||||||
if (!UnPacked)
|
if (!UnPacked)
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
|
|
||||||
if (do_novir == FALSE) {
|
if (do_novir == FALSE) {
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
@ -136,7 +137,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
WriteError("Virus found");
|
WriteError("Virus found");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Virus found\n");
|
printf("Virus found\n");
|
||||||
die(0);
|
die(MBERR_VIRUS_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +222,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("No FILE_ID.DIZ and no description on the commandline\n");
|
printf("No FILE_ID.DIZ and no description on the commandline\n");
|
||||||
DeleteVirusWork();
|
DeleteVirusWork();
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Create description from the commandline.
|
* Create description from the commandline.
|
||||||
@ -279,7 +280,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (AddFile(fdb, Area, temp2, File) == FALSE) {
|
if (AddFile(fdb, Area, temp2, File) == FALSE) {
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
Syslog('+', "File %s added to area %d", File, Area);
|
Syslog('+', "File %s added to area %d", File, Area);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbfcheck.h"
|
#include "mbfcheck.h"
|
||||||
|
|
||||||
@ -64,281 +65,278 @@ extern int do_pack; /* Pack filebase */
|
|||||||
*/
|
*/
|
||||||
void Check(void)
|
void Check(void)
|
||||||
{
|
{
|
||||||
FILE *pAreas, *pFile;
|
FILE *pAreas, *pFile;
|
||||||
int i, iAreas, iAreasNew = 0, Fix, inArea;
|
int i, iAreas, iAreasNew = 0, Fix, inArea, iTotal = 0, iErrors = 0;
|
||||||
int iTotal = 0, iErrors = 0;
|
char *sAreas, *fAreas, *newdir, *temp;
|
||||||
char *sAreas, *fAreas, *newdir, *temp;
|
DIR *dp;
|
||||||
DIR *dp;
|
struct dirent *de;
|
||||||
struct dirent *de;
|
int Found, Update;
|
||||||
int Found, Update;
|
char fn[PATH_MAX];
|
||||||
char fn[PATH_MAX];
|
struct stat stb;
|
||||||
struct stat stb;
|
struct passwd *pw;
|
||||||
struct passwd *pw;
|
struct group *gr;
|
||||||
struct group *gr;
|
|
||||||
|
|
||||||
sAreas = calloc(PATH_MAX, sizeof(char));
|
sAreas = calloc(PATH_MAX, sizeof(char));
|
||||||
fAreas = calloc(PATH_MAX, sizeof(char));
|
fAreas = calloc(PATH_MAX, sizeof(char));
|
||||||
newdir = calloc(PATH_MAX, sizeof(char));
|
newdir = calloc(PATH_MAX, sizeof(char));
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
colour(3, 0);
|
colour(3, 0);
|
||||||
printf("Checking file database...\n");
|
printf("Checking file database...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||||
WriteError("Can't open %s", sAreas);
|
WriteError("Can't open %s", sAreas);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||||
fseek(pAreas, 0, SEEK_END);
|
fseek(pAreas, 0, SEEK_END);
|
||||||
iAreas = (ftell(pAreas) - areahdr.hdrsize) / areahdr.recsize;
|
iAreas = (ftell(pAreas) - areahdr.hdrsize) / areahdr.recsize;
|
||||||
|
|
||||||
for (i = 1; i <= iAreas; i++) {
|
for (i = 1; i <= iAreas; i++) {
|
||||||
|
|
||||||
fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);
|
fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);
|
||||||
fread(&area, areahdr.recsize, 1, pAreas);
|
fread(&area, areahdr.recsize, 1, pAreas);
|
||||||
|
|
||||||
if (area.Available) {
|
if (area.Available) {
|
||||||
|
|
||||||
IsDoing("Check area %d", i);
|
IsDoing("Check area %d", i);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("\r%4d => %-44s \b\b\b\b", i, area.Name);
|
printf("\r%4d => %-44s \b\b\b\b", i, area.Name);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if download directory exists,
|
* Check if download directory exists,
|
||||||
* if not, create the directory.
|
* if not, create the directory.
|
||||||
*/
|
*/
|
||||||
if (access(area.Path, R_OK) == -1) {
|
if (access(area.Path, R_OK) == -1) {
|
||||||
Syslog('!', "No dir: %s", area.Path);
|
Syslog('!', "No dir: %s", area.Path);
|
||||||
sprintf(newdir, "%s/foobar", area.Path);
|
sprintf(newdir, "%s/foobar", area.Path);
|
||||||
mkdirs(newdir, 0775);
|
mkdirs(newdir, 0775);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat(area.Path, &stb) == 0) {
|
if (stat(area.Path, &stb) == 0) {
|
||||||
/*
|
/*
|
||||||
* Very extended directory check
|
* Very extended directory check
|
||||||
*/
|
*/
|
||||||
Fix = FALSE;
|
Fix = FALSE;
|
||||||
if ((stb.st_mode & S_IRUSR) == 0) {
|
if ((stb.st_mode & S_IRUSR) == 0) {
|
||||||
Fix = TRUE;
|
Fix = TRUE;
|
||||||
WriteError("No owner read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
WriteError("No owner read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||||
}
|
}
|
||||||
if ((stb.st_mode & S_IWUSR) == 0) {
|
if ((stb.st_mode & S_IWUSR) == 0) {
|
||||||
Fix = TRUE;
|
Fix = TRUE;
|
||||||
WriteError("No owner write access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
WriteError("No owner write access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||||
}
|
}
|
||||||
if ((stb.st_mode & S_IRGRP) == 0) {
|
if ((stb.st_mode & S_IRGRP) == 0) {
|
||||||
Fix = TRUE;
|
Fix = TRUE;
|
||||||
WriteError("No group read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
WriteError("No group read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||||
}
|
}
|
||||||
if ((stb.st_mode & S_IWGRP) == 0) {
|
if ((stb.st_mode & S_IWGRP) == 0) {
|
||||||
Fix = TRUE;
|
Fix = TRUE;
|
||||||
WriteError("No group write access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
WriteError("No group write access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||||
}
|
}
|
||||||
if ((stb.st_mode & S_IROTH) == 0) {
|
if ((stb.st_mode & S_IROTH) == 0) {
|
||||||
Fix = TRUE;
|
Fix = TRUE;
|
||||||
WriteError("No others read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
WriteError("No others read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||||
}
|
}
|
||||||
if (Fix) {
|
if (Fix) {
|
||||||
iErrors++;
|
iErrors++;
|
||||||
if (chmod(area.Path, 0775))
|
if (chmod(area.Path, 0775))
|
||||||
WriteError("Could not set mode to 0775");
|
WriteError("Could not set mode to 0775");
|
||||||
else
|
else
|
||||||
Syslog('+', "Corrected directory mode to 0775");
|
Syslog('+', "Corrected directory mode to 0775");
|
||||||
}
|
}
|
||||||
Fix = FALSE;
|
Fix = FALSE;
|
||||||
pw = getpwuid(stb.st_uid);
|
pw = getpwuid(stb.st_uid);
|
||||||
if (strcmp(pw->pw_name, (char *)"mbse")) {
|
if (strcmp(pw->pw_name, (char *)"mbse")) {
|
||||||
WriteError("Directory %s not owned by user mbse", area.Path);
|
WriteError("Directory %s not owned by user mbse", area.Path);
|
||||||
Fix = TRUE;
|
Fix = TRUE;
|
||||||
}
|
}
|
||||||
gr = getgrgid(stb.st_gid);
|
gr = getgrgid(stb.st_gid);
|
||||||
if (strcmp(gr->gr_name, (char *)"bbs")) {
|
if (strcmp(gr->gr_name, (char *)"bbs")) {
|
||||||
WriteError("Directory %s not owned by group bbs", area.Path);
|
WriteError("Directory %s not owned by group bbs", area.Path);
|
||||||
Fix = TRUE;
|
Fix = TRUE;
|
||||||
}
|
}
|
||||||
if (Fix) {
|
if (Fix) {
|
||||||
iErrors++;
|
iErrors++;
|
||||||
pw = getpwnam((char *)"mbse");
|
pw = getpwnam((char *)"mbse");
|
||||||
gr = getgrnam((char *)"bbs");
|
gr = getgrnam((char *)"bbs");
|
||||||
if (chown(area.Path, pw->pw_gid, gr->gr_gid))
|
if (chown(area.Path, pw->pw_gid, gr->gr_gid))
|
||||||
WriteError("Could not set owner to mbse.bbs");
|
WriteError("Could not set owner to mbse.bbs");
|
||||||
else
|
else
|
||||||
Syslog('+', "Corrected directory owner to mbse.bbs");
|
Syslog('+', "Corrected directory owner to mbse.bbs");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WriteError("Can't stat %s", area.Path);
|
WriteError("Can't stat %s", area.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
|
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the file database, if it doesn't exist,
|
* Open the file database, if it doesn't exist,
|
||||||
* create an empty one.
|
* create an empty one.
|
||||||
*/
|
*/
|
||||||
if ((pFile = fopen(fAreas, "r+")) == NULL) {
|
if ((pFile = fopen(fAreas, "r+")) == NULL) {
|
||||||
Syslog('!', "Creating new %s", fAreas);
|
Syslog('!', "Creating new %s", fAreas);
|
||||||
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
||||||
WriteError("$Can't create %s", fAreas);
|
WriteError("$Can't create %s", fAreas);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now start checking the files in the filedatabase
|
* Now start checking the files in the filedatabase
|
||||||
* against the contents of the directory.
|
* against the contents of the directory.
|
||||||
*/
|
*/
|
||||||
inArea = 0;
|
inArea = 0;
|
||||||
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
||||||
|
|
||||||
iTotal++;
|
iTotal++;
|
||||||
inArea++;
|
inArea++;
|
||||||
sprintf(newdir, "%s/%s", area.Path, file.LName);
|
sprintf(newdir, "%s/%s", area.Path, file.LName);
|
||||||
|
|
||||||
if (file_exist(newdir, R_OK)) {
|
if (file_exist(newdir, R_OK)) {
|
||||||
Syslog('+', "File %s area %d not on disk.", newdir, i);
|
Syslog('+', "File %s area %d not on disk.", newdir, i);
|
||||||
if (!file.NoKill) {
|
if (!file.NoKill) {
|
||||||
file.Deleted = TRUE;
|
file.Deleted = TRUE;
|
||||||
do_pack = TRUE;
|
do_pack = TRUE;
|
||||||
}
|
}
|
||||||
|
iErrors++;
|
||||||
|
file.Missing = TRUE;
|
||||||
|
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||||
|
fwrite(&file, sizeof(file), 1, pFile);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* File exists, now check the file.
|
||||||
|
*/
|
||||||
|
Marker();
|
||||||
|
Update = FALSE;
|
||||||
|
|
||||||
|
strcpy(temp, file.LName);
|
||||||
|
name_mangle(temp);
|
||||||
|
if (strcmp(file.Name, temp)) {
|
||||||
|
Syslog('!', "Converted %s to %s", file.Name, temp);
|
||||||
|
strncpy(file.Name, temp, 12);
|
||||||
|
iErrors++;
|
||||||
|
Update = TRUE;
|
||||||
|
}
|
||||||
|
if (file_time(newdir) != file.FileDate) {
|
||||||
|
Syslog('!', "Date mismatch area %d file %s", i, file.LName);
|
||||||
|
file.FileDate = file_time(newdir);
|
||||||
|
iErrors++;
|
||||||
|
Update = TRUE;
|
||||||
|
}
|
||||||
|
if (file_size(newdir) != file.Size) {
|
||||||
|
Syslog('!', "Size mismatch area %d file %s", i, file.LName);
|
||||||
|
file.Size = file_size(newdir);
|
||||||
|
iErrors++;
|
||||||
|
Update = TRUE;
|
||||||
|
}
|
||||||
|
if (file_crc(newdir, CFG.slow_util && do_quiet) != file.Crc32) {
|
||||||
|
Syslog('!', "CRC error area %d, file %s", i, file.LName);
|
||||||
|
file.Crc32 = file_crc(newdir, CFG.slow_util && do_quiet);
|
||||||
|
iErrors++;
|
||||||
|
Update = TRUE;
|
||||||
|
}
|
||||||
|
Marker();
|
||||||
|
if (Update) {
|
||||||
|
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||||
|
fwrite(&file, sizeof(file), 1, pFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inArea == 0)
|
||||||
|
Syslog('+', "Warning: area %d (%s) is empty", i, area.Name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check files in the directory against the database.
|
||||||
|
* This test is skipped for CD-rom.
|
||||||
|
*/
|
||||||
|
if (!area.CDrom) {
|
||||||
|
if ((dp = opendir(area.Path)) != NULL) {
|
||||||
|
while ((de = readdir(dp)) != NULL) {
|
||||||
|
if (de->d_name[0] != '.') {
|
||||||
|
Marker();
|
||||||
|
Found = FALSE;
|
||||||
|
rewind(pFile);
|
||||||
|
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
||||||
|
if (strcmp(file.LName, de->d_name) == 0) {
|
||||||
|
if (!Found) {
|
||||||
|
Found = TRUE;
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Record has been found before, so this must be
|
||||||
|
* a double record.
|
||||||
|
*/
|
||||||
|
Syslog('!', "Double file record area %d file %s", i, file.LName);
|
||||||
iErrors++;
|
iErrors++;
|
||||||
file.Missing = TRUE;
|
file.Double = TRUE;
|
||||||
|
do_pack = TRUE;
|
||||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||||
fwrite(&file, sizeof(file), 1, pFile);
|
fwrite(&file, sizeof(file), 1, pFile);
|
||||||
} else {
|
}
|
||||||
/*
|
|
||||||
* File exists, now check the file.
|
|
||||||
*/
|
|
||||||
Marker();
|
|
||||||
Update = FALSE;
|
|
||||||
|
|
||||||
strcpy(temp, file.LName);
|
|
||||||
name_mangle(temp);
|
|
||||||
if (strcmp(file.Name, temp)) {
|
|
||||||
Syslog('!', "Converted %s to %s", file.Name, temp);
|
|
||||||
strncpy(file.Name, temp, 12);
|
|
||||||
iErrors++;
|
|
||||||
Update = TRUE;
|
|
||||||
}
|
|
||||||
if (file_time(newdir) != file.FileDate) {
|
|
||||||
Syslog('!', "Date mismatch area %d file %s", i, file.LName);
|
|
||||||
file.FileDate = file_time(newdir);
|
|
||||||
iErrors++;
|
|
||||||
Update = TRUE;
|
|
||||||
}
|
|
||||||
if (file_size(newdir) != file.Size) {
|
|
||||||
Syslog('!', "Size mismatch area %d file %s", i, file.LName);
|
|
||||||
file.Size = file_size(newdir);
|
|
||||||
iErrors++;
|
|
||||||
Update = TRUE;
|
|
||||||
}
|
|
||||||
if (file_crc(newdir, CFG.slow_util && do_quiet) != file.Crc32) {
|
|
||||||
Syslog('!', "CRC error area %d, file %s", i, file.LName);
|
|
||||||
file.Crc32 = file_crc(newdir, CFG.slow_util && do_quiet);
|
|
||||||
iErrors++;
|
|
||||||
Update = TRUE;
|
|
||||||
}
|
|
||||||
Marker();
|
|
||||||
if (Update) {
|
|
||||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
|
||||||
fwrite(&file, sizeof(file), 1, pFile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inArea == 0)
|
if ((!Found) && (strncmp(de->d_name, "files.bbs", 9)) &&
|
||||||
Syslog('+', "Warning: area %d (%s) is empty", i, area.Name);
|
(strncmp(de->d_name, "files.bak", 9)) &&
|
||||||
|
(strncmp(de->d_name, "00index", 7)) &&
|
||||||
/*
|
(strncmp(de->d_name, "header", 6)) &&
|
||||||
* Check files in the directory against the database.
|
(strncmp(de->d_name, "index", 5)) &&
|
||||||
* This test is skipped for CD-rom.
|
(strncmp(de->d_name, "readme", 6))) {
|
||||||
*/
|
sprintf(fn, "%s/%s", area.Path, de->d_name);
|
||||||
if (!area.CDrom) {
|
if (stat(fn, &stb) == 0)
|
||||||
if ((dp = opendir(area.Path)) != NULL) {
|
if (S_ISREG(stb.st_mode)) {
|
||||||
while ((de = readdir(dp)) != NULL) {
|
if (unlink(fn) == 0) {
|
||||||
if (de->d_name[0] != '.') {
|
Syslog('!', "%s not in fdb, deleted from disk", fn);
|
||||||
Marker();
|
iErrors++;
|
||||||
Found = FALSE;
|
} else {
|
||||||
rewind(pFile);
|
WriteError("$%s not in fdb, cannot delete", fn);
|
||||||
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
|
||||||
if (strcmp(file.LName, de->d_name) == 0) {
|
|
||||||
if (!Found) {
|
|
||||||
Found = TRUE;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Record has been found before, so this must be
|
|
||||||
* a double record.
|
|
||||||
*/
|
|
||||||
Syslog('!', "Double file record area %d file %s",
|
|
||||||
i, file.LName);
|
|
||||||
iErrors++;
|
|
||||||
file.Double = TRUE;
|
|
||||||
do_pack = TRUE;
|
|
||||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
|
||||||
fwrite(&file, sizeof(file), 1, pFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((!Found) &&
|
|
||||||
(strncmp(de->d_name, "files.bbs", 9)) &&
|
|
||||||
(strncmp(de->d_name, "files.bak", 9)) &&
|
|
||||||
(strncmp(de->d_name, "00index", 7)) &&
|
|
||||||
(strncmp(de->d_name, "header", 6)) &&
|
|
||||||
(strncmp(de->d_name, "index", 5)) &&
|
|
||||||
(strncmp(de->d_name, "readme", 6))) {
|
|
||||||
sprintf(fn, "%s/%s", area.Path, de->d_name);
|
|
||||||
if (stat(fn, &stb) == 0)
|
|
||||||
if (S_ISREG(stb.st_mode)) {
|
|
||||||
if (unlink(fn) == 0) {
|
|
||||||
Syslog('!', "%s not in fdb, deleted from disk", fn);
|
|
||||||
iErrors++;
|
|
||||||
} else {
|
|
||||||
WriteError("$%s not in fdb, cannot delete", fn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
closedir(dp);
|
}
|
||||||
} else {
|
}
|
||||||
WriteError("Can't open %s", area.Path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(pFile);
|
|
||||||
chmod(fAreas, 0660);
|
|
||||||
iAreasNew++;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (strlen(area.Name) == 0) {
|
|
||||||
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
|
|
||||||
if (unlink(fAreas) == 0) {
|
|
||||||
Syslog('+', "Removed obsolete %s", fAreas);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
closedir(dp);
|
||||||
|
} else {
|
||||||
|
WriteError("Can't open %s", area.Path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} /* if area.Available */
|
fclose(pFile);
|
||||||
}
|
chmod(fAreas, 0660);
|
||||||
|
iAreasNew++;
|
||||||
|
|
||||||
fclose(pAreas);
|
} else {
|
||||||
if (!do_quiet) {
|
|
||||||
printf("\r \r");
|
if (strlen(area.Name) == 0) {
|
||||||
fflush(stdout);
|
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
|
||||||
}
|
if (unlink(fAreas) == 0) {
|
||||||
|
Syslog('+', "Removed obsolete %s", fAreas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(temp);
|
} /* if area.Available */
|
||||||
free(newdir);
|
}
|
||||||
free(sAreas);
|
|
||||||
free(fAreas);
|
|
||||||
|
|
||||||
Syslog('+', "Check Areas [%5d] Files [%5d] Errors [%5d]", iAreasNew, iTotal, iErrors);
|
fclose(pAreas);
|
||||||
|
if (!do_quiet) {
|
||||||
|
printf("\r \r");
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(temp);
|
||||||
|
free(newdir);
|
||||||
|
free(sAreas);
|
||||||
|
free(fAreas);
|
||||||
|
|
||||||
|
Syslog('+', "Check Areas [%5d] Files [%5d] Errors [%5d]", iAreasNew, iTotal, iErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbfmove.h"
|
#include "mbfmove.h"
|
||||||
|
|
||||||
@ -67,28 +68,28 @@ void Delete(int UnDel, int Area, char *File)
|
|||||||
*/
|
*/
|
||||||
if (LoadAreaRec(Area) == FALSE) {
|
if (LoadAreaRec(Area) == FALSE) {
|
||||||
WriteError("Can't load record %d", Area);
|
WriteError("Can't load record %d", Area);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
if (!area.Available) {
|
if (!area.Available) {
|
||||||
WriteError("Area %d not available", Area);
|
WriteError("Area %d not available", Area);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Area %d not available\n", Area);
|
printf("Area %d not available\n", Area);
|
||||||
die(0);
|
die(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
if (area.CDrom) {
|
if (area.CDrom) {
|
||||||
WriteError("Can't %sdelete from CD-ROM", UnDel?"un":"");
|
WriteError("Can't %sdelete from CD-ROM", UnDel?"un":"");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't %sdelete from CD-ROM\n", UnDel?"un":"");
|
printf("Can't %sdelete from CD-ROM\n", UnDel?"un":"");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
if (CheckFDB(Area, area.Path))
|
if (CheckFDB(Area, area.Path))
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(temp, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), Area);
|
sprintf(temp, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), Area);
|
||||||
|
|
||||||
if ((fp = fopen(temp, "r+")) == NULL)
|
if ((fp = fopen(temp, "r+")) == NULL)
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
|
|
||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "../lib/dbftn.h"
|
#include "../lib/dbftn.h"
|
||||||
#include "../lib/dbtic.h"
|
#include "../lib/dbtic.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "flock.h"
|
#include "flock.h"
|
||||||
#include "tosspkt.h"
|
#include "tosspkt.h"
|
||||||
#include "unpack.h"
|
#include "unpack.h"
|
||||||
@ -147,7 +148,7 @@ void Help(void)
|
|||||||
printf(" -uns -unsecure Toss unsecure\n");
|
printf(" -uns -unsecure Toss unsecure\n");
|
||||||
printf(" -unp -unprotect Toss unprotected inbound\n");
|
printf(" -unp -unprotect Toss unprotected inbound\n");
|
||||||
colour(LIGHTGRAY, BLACK);
|
colour(LIGHTGRAY, BLACK);
|
||||||
ExitClient(0);
|
ExitClient(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -189,7 +190,7 @@ void die(int onsig)
|
|||||||
system("stty sane");
|
system("stty sane");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onsig != 110)
|
if (onsig != MBERR_NO_PROGLOCK)
|
||||||
CloseDupes();
|
CloseDupes();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -244,7 +245,7 @@ void die(int onsig)
|
|||||||
* and there should be no lock. We prevent removing the lock of another
|
* and there should be no lock. We prevent removing the lock of another
|
||||||
* mbfido this way.
|
* mbfido this way.
|
||||||
*/
|
*/
|
||||||
if (onsig != 110) {
|
if (onsig != MBERR_NO_PROGLOCK) {
|
||||||
ulockdir(CFG.inbound);
|
ulockdir(CFG.inbound);
|
||||||
ulockdir(CFG.pinbound);
|
ulockdir(CFG.pinbound);
|
||||||
ulockdir(CFG.out_queue);
|
ulockdir(CFG.out_queue);
|
||||||
@ -433,10 +434,10 @@ int main(int argc, char **argv)
|
|||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Not yet locked, if anything goes wrong, exit with die(110)
|
* Not yet locked, if anything goes wrong, exit with die(MBERR_NO_PROGLOCK)
|
||||||
*/
|
*/
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(110);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
if (do_mail) {
|
if (do_mail) {
|
||||||
/*
|
/*
|
||||||
@ -458,7 +459,7 @@ int main(int argc, char **argv)
|
|||||||
i--;
|
i--;
|
||||||
if (! i) {
|
if (! i) {
|
||||||
WriteError("Lock timeout, aborting");
|
WriteError("Lock timeout, aborting");
|
||||||
die(110);
|
die(MBERR_NO_PROGLOCK);
|
||||||
}
|
}
|
||||||
sleep(20);
|
sleep(20);
|
||||||
Nopper();
|
Nopper();
|
||||||
@ -470,10 +471,10 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (do_unprot) {
|
if (do_unprot) {
|
||||||
if (! lockdir(CFG.inbound))
|
if (! lockdir(CFG.inbound))
|
||||||
die(110);
|
die(MBERR_NO_PROGLOCK);
|
||||||
} else {
|
} else {
|
||||||
if (! lockdir(CFG.pinbound))
|
if (! lockdir(CFG.pinbound))
|
||||||
die(110);
|
die(MBERR_NO_PROGLOCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +483,7 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (initnl())
|
if (initnl())
|
||||||
die(101);
|
die(MBERR_INIT_ERROR);
|
||||||
if (!do_mail && !do_uucp)
|
if (!do_mail && !do_uucp)
|
||||||
Rollover();
|
Rollover();
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
@ -500,13 +501,13 @@ int main(int argc, char **argv)
|
|||||||
if (do_mail) {
|
if (do_mail) {
|
||||||
if (!envrecip_count) {
|
if (!envrecip_count) {
|
||||||
WriteError("No valid receipients specified, aborting");
|
WriteError("No valid receipients specified, aborting");
|
||||||
die(105);
|
die(MBERR_NO_RECIPIENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
umask(066);
|
umask(066);
|
||||||
if ((ofp = tmpfile()) == NULL) {
|
if ((ofp = tmpfile()) == NULL) {
|
||||||
WriteError("$Can't open tmpfile for RFC message");
|
WriteError("$Can't open tmpfile for RFC message");
|
||||||
die(104);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
temp = calloc(10240, sizeof(char));
|
temp = calloc(10240, sizeof(char));
|
||||||
while (fgets(temp, 10240, stdin))
|
while (fgets(temp, 10240, stdin))
|
||||||
@ -520,7 +521,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
fclose(ofp);
|
fclose(ofp);
|
||||||
flush_queue();
|
flush_queue();
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
InitDupes();
|
InitDupes();
|
||||||
@ -540,7 +541,7 @@ int main(int argc, char **argv)
|
|||||||
do {
|
do {
|
||||||
Hatch();
|
Hatch();
|
||||||
switch (Tic()) {
|
switch (Tic()) {
|
||||||
case -1: die(0);
|
case -1: die(MBERR_OK);
|
||||||
break;
|
break;
|
||||||
case 0: Loop = FALSE;
|
case 0: Loop = FALSE;
|
||||||
break;
|
break;
|
||||||
@ -559,7 +560,7 @@ int main(int argc, char **argv)
|
|||||||
if (IsSema((char *)"mailin"))
|
if (IsSema((char *)"mailin"))
|
||||||
RemoveSema((char *)"mailin");
|
RemoveSema((char *)"mailin");
|
||||||
if (TossMail() == FALSE)
|
if (TossMail() == FALSE)
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
if (do_tic || do_toss) {
|
if (do_tic || do_toss) {
|
||||||
/*
|
/*
|
||||||
@ -586,7 +587,7 @@ int main(int argc, char **argv)
|
|||||||
if (do_flush)
|
if (do_flush)
|
||||||
flush_queue();
|
flush_queue();
|
||||||
|
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,7 +614,7 @@ int TossMail(void)
|
|||||||
|
|
||||||
if (chdir(inbound) == -1) {
|
if (chdir(inbound) == -1) {
|
||||||
WriteError("$Can't chdir(%s)", inbound);
|
WriteError("$Can't chdir(%s)", inbound);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -629,7 +630,7 @@ int TossMail(void)
|
|||||||
*/
|
*/
|
||||||
if ((dp = opendir(inbound)) == NULL) {
|
if ((dp = opendir(inbound)) == NULL) {
|
||||||
WriteError("$Can't opendir(%s)", inbound);
|
WriteError("$Can't opendir(%s)", inbound);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
Syslog('+', "Pass: toss ARCmail (%s)", inbound);
|
Syslog('+', "Pass: toss ARCmail (%s)", inbound);
|
||||||
@ -662,7 +663,7 @@ int TossMail(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!diskfree(CFG.freespace)) {
|
if (!diskfree(CFG.freespace)) {
|
||||||
rc = 101;
|
rc = MBERR_DISK_FULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
306
mbfido/mbfile.c
306
mbfido/mbfile.c
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfkill.h"
|
#include "mbfkill.h"
|
||||||
#include "mbfadopt.h"
|
#include "mbfadopt.h"
|
||||||
#include "mbfindex.h"
|
#include "mbfindex.h"
|
||||||
@ -74,191 +75,190 @@ time_t t_end; /* End time */
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, Area = 0, ToArea = 0, UnDel = FALSE;
|
int i, Area = 0, ToArea = 0, UnDel = FALSE;
|
||||||
char *cmd, *FileName = NULL, *Description = NULL;
|
char *cmd, *FileName = NULL, *Description = NULL;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwInit();
|
mwInit();
|
||||||
#endif
|
#endif
|
||||||
InitConfig();
|
InitConfig();
|
||||||
TermInit(1);
|
TermInit(1);
|
||||||
t_start = time(NULL);
|
t_start = time(NULL);
|
||||||
umask(002);
|
umask(002);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Catch all signals we can, and ignore the rest.
|
* Catch all signals we can, and ignore the rest.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGKILL) ||
|
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGKILL) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
signal(i, (void (*))die);
|
||||||
signal(i, (void (*))die);
|
else
|
||||||
else
|
signal(i, SIG_IGN);
|
||||||
signal(i, SIG_IGN);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
Help();
|
Help();
|
||||||
|
|
||||||
cmd = xstrcpy((char *)"Command line: mbfile");
|
cmd = xstrcpy((char *)"Command line: mbfile");
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
|
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
|
||||||
|
if (!strncasecmp(argv[i], "a", 1)) {
|
||||||
|
do_adopt = TRUE;
|
||||||
|
i++;
|
||||||
|
Area = atoi(argv[i]);
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
i++;
|
||||||
|
FileName = xstrcpy(argv[i]);
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
if (argc > (i + 1)) {
|
||||||
|
i++;
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
if (!strncasecmp(argv[i], "-a", 2)) {
|
||||||
if (!strncasecmp(argv[i], "a", 1)) {
|
do_annon = TRUE;
|
||||||
do_adopt = TRUE;
|
} else {
|
||||||
i++;
|
Description = xstrcpy(argv[i]);
|
||||||
Area = atoi(argv[i]);
|
}
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
}
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
} else if ((!strncasecmp(argv[i], "d", 1)) || (!strncasecmp(argv[i], "u", 1))) {
|
||||||
|
if (!strncasecmp(argv[i], "u", 1))
|
||||||
|
UnDel = TRUE;
|
||||||
|
if (argc > (i + 1)) {
|
||||||
|
i++;
|
||||||
|
Area = atoi(argv[i]);
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
if (argc > (i + 1)) {
|
||||||
|
i++;
|
||||||
|
FileName = xstrcpy(argv[i]);
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
do_del = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!strncasecmp(argv[i], "in", 2)) {
|
||||||
|
do_index = TRUE;
|
||||||
|
} else if (!strncasecmp(argv[i], "im", 2)) {
|
||||||
|
if (argc > (i + 1)) {
|
||||||
|
do_import = TRUE;
|
||||||
|
i++;
|
||||||
|
Area = atoi(argv[i]);
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
}
|
||||||
|
} else if (!strncasecmp(argv[i], "l", 1)) {
|
||||||
|
do_list = TRUE;
|
||||||
|
if (argc > (i + 1)) {
|
||||||
|
i++;
|
||||||
|
Area = atoi(argv[i]);
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
}
|
||||||
|
} else if (!strncasecmp(argv[i], "m", 1)) {
|
||||||
|
if (argc > (i + 1)) {
|
||||||
|
i++;
|
||||||
|
Area = atoi(argv[i]);
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
if (argc > (i + 1)) {
|
||||||
|
i++;
|
||||||
|
ToArea = atoi(argv[i]);
|
||||||
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
|
if (argc > (i + 1)) {
|
||||||
i++;
|
i++;
|
||||||
FileName = xstrcpy(argv[i]);
|
FileName = xstrcpy(argv[i]);
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
cmd = xstrcat(cmd, (char *)" ");
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
cmd = xstrcat(cmd, argv[i]);
|
||||||
if (argc > (i + 1)) {
|
do_move = TRUE;
|
||||||
i++;
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
|
||||||
if (!strncasecmp(argv[i], "-a", 2)) {
|
|
||||||
do_annon = TRUE;
|
|
||||||
} else {
|
|
||||||
Description = xstrcpy(argv[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ((!strncasecmp(argv[i], "d", 1)) || (!strncasecmp(argv[i], "u", 1))) {
|
|
||||||
if (!strncasecmp(argv[i], "u", 1))
|
|
||||||
UnDel = TRUE;
|
|
||||||
if (argc > (i + 1)) {
|
|
||||||
i++;
|
|
||||||
Area = atoi(argv[i]);
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
|
||||||
if (argc > (i + 1)) {
|
|
||||||
i++;
|
|
||||||
FileName = xstrcpy(argv[i]);
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
|
||||||
do_del = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (!strncasecmp(argv[i], "in", 2)) {
|
|
||||||
do_index = TRUE;
|
|
||||||
} else if (!strncasecmp(argv[i], "im", 2)) {
|
|
||||||
if (argc > (i + 1)) {
|
|
||||||
do_import = TRUE;
|
|
||||||
i++;
|
|
||||||
Area = atoi(argv[i]);
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
|
||||||
}
|
|
||||||
} else if (!strncasecmp(argv[i], "l", 1)) {
|
|
||||||
do_list = TRUE;
|
|
||||||
if (argc > (i + 1)) {
|
|
||||||
i++;
|
|
||||||
Area = atoi(argv[i]);
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
|
||||||
}
|
|
||||||
} else if (!strncasecmp(argv[i], "m", 1)) {
|
|
||||||
if (argc > (i + 1)) {
|
|
||||||
i++;
|
|
||||||
Area = atoi(argv[i]);
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
|
||||||
if (argc > (i + 1)) {
|
|
||||||
i++;
|
|
||||||
ToArea = atoi(argv[i]);
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
|
||||||
if (argc > (i + 1)) {
|
|
||||||
i++;
|
|
||||||
FileName = xstrcpy(argv[i]);
|
|
||||||
cmd = xstrcat(cmd, (char *)" ");
|
|
||||||
cmd = xstrcat(cmd, argv[i]);
|
|
||||||
do_move = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!strncasecmp(argv[i], "p", 1)) {
|
|
||||||
do_pack = TRUE;
|
|
||||||
} else if (!strncasecmp(argv[i], "c", 1)) {
|
|
||||||
do_check = TRUE;
|
|
||||||
} else if (!strncasecmp(argv[i], "k", 1)) {
|
|
||||||
do_kill = TRUE;
|
|
||||||
} else if (!strncasecmp(argv[i], "t", 1)) {
|
|
||||||
do_tobe = TRUE;
|
|
||||||
} else if (!strncasecmp(argv[i], "-q", 2)) {
|
|
||||||
do_quiet = TRUE;
|
|
||||||
} else if (!strncasecmp(argv[i], "-a", 2)) {
|
|
||||||
do_annon = TRUE;
|
|
||||||
} else if (!strncasecmp(argv[i], "-v", 2)) {
|
|
||||||
do_novir = TRUE;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else if (!strncasecmp(argv[i], "p", 1)) {
|
||||||
|
do_pack = TRUE;
|
||||||
|
} else if (!strncasecmp(argv[i], "c", 1)) {
|
||||||
|
do_check = TRUE;
|
||||||
|
} else if (!strncasecmp(argv[i], "k", 1)) {
|
||||||
|
do_kill = TRUE;
|
||||||
|
} else if (!strncasecmp(argv[i], "t", 1)) {
|
||||||
|
do_tobe = TRUE;
|
||||||
|
} else if (!strncasecmp(argv[i], "-q", 2)) {
|
||||||
|
do_quiet = TRUE;
|
||||||
|
} else if (!strncasecmp(argv[i], "-a", 2)) {
|
||||||
|
do_annon = TRUE;
|
||||||
|
} else if (!strncasecmp(argv[i], "-v", 2)) {
|
||||||
|
do_novir = TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(do_pack || do_check || do_kill || do_index || do_import || do_list || do_adopt || do_del || do_move || do_tobe))
|
if (!(do_pack || do_check || do_kill || do_index || do_import || do_list || do_adopt || do_del || do_move || do_tobe))
|
||||||
Help();
|
Help();
|
||||||
|
|
||||||
ProgName();
|
ProgName();
|
||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
InitClient(pw->pw_name, (char *)"mbfile", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
InitClient(pw->pw_name, (char *)"mbfile", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||||
|
|
||||||
Syslog(' ', " ");
|
Syslog(' ', " ");
|
||||||
Syslog(' ', "MBFILE v%s", VERSION);
|
Syslog(' ', "MBFILE v%s", VERSION);
|
||||||
Syslog(' ', cmd);
|
Syslog(' ', cmd);
|
||||||
if (do_novir)
|
if (do_novir)
|
||||||
Syslog('!', "WARNING: running without virus checking");
|
Syslog('!', "WARNING: running without virus checking");
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
if (do_adopt) {
|
if (do_adopt) {
|
||||||
AdoptFile(Area, FileName, Description);
|
AdoptFile(Area, FileName, Description);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_import) {
|
if (do_import) {
|
||||||
ImportFiles(Area);
|
ImportFiles(Area);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_kill)
|
if (do_kill)
|
||||||
Kill();
|
Kill();
|
||||||
|
|
||||||
if (do_check)
|
if (do_check)
|
||||||
Check();
|
Check();
|
||||||
|
|
||||||
if (do_pack)
|
if (do_pack)
|
||||||
PackFileBase();
|
PackFileBase();
|
||||||
|
|
||||||
if (do_index)
|
if (do_index)
|
||||||
Index();
|
Index();
|
||||||
|
|
||||||
if (do_move) {
|
if (do_move) {
|
||||||
Move(Area, ToArea, FileName);
|
Move(Area, ToArea, FileName);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_del) {
|
if (do_del) {
|
||||||
Delete(UnDel, Area, FileName);
|
Delete(UnDel, Area, FileName);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_list) {
|
if (do_list) {
|
||||||
ListFileAreas(Area);
|
ListFileAreas(Area);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_tobe)
|
if (do_tobe)
|
||||||
ToBeRep();
|
ToBeRep();
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "virscan.h"
|
#include "virscan.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbfimport.h"
|
#include "mbfimport.h"
|
||||||
@ -63,7 +64,7 @@ void ImportFiles(int Area)
|
|||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
|
|
||||||
if (LoadAreaRec(Area) == FALSE)
|
if (LoadAreaRec(Area) == FALSE)
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
|
|
||||||
if (area.Available && !area.CDrom) {
|
if (area.Available && !area.CDrom) {
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -75,7 +76,7 @@ void ImportFiles(int Area)
|
|||||||
|
|
||||||
getcwd(pwd, PATH_MAX);
|
getcwd(pwd, PATH_MAX);
|
||||||
if (CheckFDB(Area, area.Path))
|
if (CheckFDB(Area, area.Path))
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
sprintf(tmpdir, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
sprintf(tmpdir, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
IsDoing("Import files");
|
IsDoing("Import files");
|
||||||
@ -92,7 +93,7 @@ void ImportFiles(int Area)
|
|||||||
WriteError("Can't find files.bbs anywhere");
|
WriteError("Can't find files.bbs anywhere");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't find files.bbs anywhere\n");
|
printf("Can't find files.bbs anywhere\n");
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +166,7 @@ void ImportFiles(int Area)
|
|||||||
* Check diskspace
|
* Check diskspace
|
||||||
*/
|
*/
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
Files++;
|
Files++;
|
||||||
memset(&fdb, 0, sizeof(fdb));
|
memset(&fdb, 0, sizeof(fdb));
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/diesel.h"
|
#include "../lib/diesel.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbfindex.h"
|
#include "mbfindex.h"
|
||||||
|
|
||||||
@ -364,13 +365,13 @@ void Index(void)
|
|||||||
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
||||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", sAreas);
|
WriteError("$Can't open %s", sAreas);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(sIndex, "%s/etc/request.index", getenv("MBSE_ROOT"));
|
sprintf(sIndex, "%s/etc/request.index", getenv("MBSE_ROOT"));
|
||||||
if ((pIndex = fopen(sIndex, "w")) == NULL) {
|
if ((pIndex = fopen(sIndex, "w")) == NULL) {
|
||||||
WriteError("$Can't create %s", sIndex);
|
WriteError("$Can't create %s", sIndex);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||||
@ -422,7 +423,7 @@ void Index(void)
|
|||||||
if (area.Available) {
|
if (area.Available) {
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("\r%4ld => %-44s \b\b\b\b", i, area.Name);
|
printf("\r%4ld => %-44s \b\b\b\b", i, area.Name);
|
||||||
@ -452,7 +453,7 @@ void Index(void)
|
|||||||
Syslog('!', "Creating new %s", fAreas);
|
Syslog('!', "Creating new %s", fAreas);
|
||||||
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
||||||
WriteError("$Can't create %s", fAreas);
|
WriteError("$Can't create %s", fAreas);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfkill.h"
|
#include "mbfkill.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ void Kill(void)
|
|||||||
|
|
||||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||||
WriteError("Can't open %s", sAreas);
|
WriteError("Can't open %s", sAreas);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||||
@ -95,7 +96,7 @@ void Kill(void)
|
|||||||
if ((area.Available) && (area.DLdays || area.FDdays) && (!area.CDrom)) {
|
if ((area.Available) && (area.DLdays || area.FDdays) && (!area.CDrom)) {
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("\r%4d => %-44s \b\b\b\b", i, area.Name);
|
printf("\r%4d => %-44s \b\b\b\b", i, area.Name);
|
||||||
@ -125,7 +126,7 @@ void Kill(void)
|
|||||||
Syslog('!', "Creating new %s", fAreas);
|
Syslog('!', "Creating new %s", fAreas);
|
||||||
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
||||||
WriteError("$Can't create %s", fAreas);
|
WriteError("$Can't create %s", fAreas);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbflist.h"
|
#include "mbflist.h"
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ void ListFileAreas(int Area)
|
|||||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||||
WriteError("Can't open %s", sAreas);
|
WriteError("Can't open %s", sAreas);
|
||||||
printf("Can't open %s\n", sAreas);
|
printf("Can't open %s\n", sAreas);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||||
@ -83,7 +84,7 @@ void ListFileAreas(int Area)
|
|||||||
if ((pTic = fopen(sTic, "r")) == NULL) {
|
if ((pTic = fopen(sTic, "r")) == NULL) {
|
||||||
WriteError("Can't open %s", sTic);
|
WriteError("Can't open %s", sTic);
|
||||||
printf("Can't open %s\n", sTic);
|
printf("Can't open %s\n", sTic);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
fread(&tichdr, sizeof(tichdr), 1, pTic);
|
fread(&tichdr, sizeof(tichdr), 1, pTic);
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ void ListFileAreas(int Area)
|
|||||||
Syslog('!', "Creating new %s", fAreas);
|
Syslog('!', "Creating new %s", fAreas);
|
||||||
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
||||||
WriteError("$Can't create %s", fAreas);
|
WriteError("$Can't create %s", fAreas);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +205,7 @@ void ListFileAreas(int Area)
|
|||||||
Syslog('!', "Creating new %s", fAreas);
|
Syslog('!', "Creating new %s", fAreas);
|
||||||
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
||||||
WriteError("$Can't create %s", fAreas);
|
WriteError("$Can't create %s", fAreas);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbfmove.h"
|
#include "mbfmove.h"
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ void Move(int From, int To, char *File)
|
|||||||
WriteError("Area numbers are the same");
|
WriteError("Area numbers are the same");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't move to the same area\n");
|
printf("Can't move to the same area\n");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -71,22 +72,22 @@ void Move(int From, int To, char *File)
|
|||||||
*/
|
*/
|
||||||
if (LoadAreaRec(From) == FALSE) {
|
if (LoadAreaRec(From) == FALSE) {
|
||||||
WriteError("Can't load record %d", From);
|
WriteError("Can't load record %d", From);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
if (!area.Available) {
|
if (!area.Available) {
|
||||||
WriteError("Area %d not available", From);
|
WriteError("Area %d not available", From);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Area %d not available\n", From);
|
printf("Area %d not available\n", From);
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
if (area.CDrom) {
|
if (area.CDrom) {
|
||||||
WriteError("Can't move from CD-ROM");
|
WriteError("Can't move from CD-ROM");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't move from CD-ROM\n");
|
printf("Can't move from CD-ROM\n");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
if (CheckFDB(From, area.Path))
|
if (CheckFDB(From, area.Path))
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
frompath = xstrcpy(area.Path);
|
frompath = xstrcpy(area.Path);
|
||||||
frompath = xstrcat(frompath, (char *)"/");
|
frompath = xstrcat(frompath, (char *)"/");
|
||||||
frompath = xstrcat(frompath, File);
|
frompath = xstrcat(frompath, File);
|
||||||
@ -96,22 +97,22 @@ void Move(int From, int To, char *File)
|
|||||||
*/
|
*/
|
||||||
if (LoadAreaRec(To) == FALSE) {
|
if (LoadAreaRec(To) == FALSE) {
|
||||||
WriteError("Can't load record %d", To);
|
WriteError("Can't load record %d", To);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
if (!area.Available) {
|
if (!area.Available) {
|
||||||
WriteError("Area %d not available", To);
|
WriteError("Area %d not available", To);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Area %d not available\n", To);
|
printf("Area %d not available\n", To);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
if (area.CDrom) {
|
if (area.CDrom) {
|
||||||
WriteError("Can't move to CD-ROM");
|
WriteError("Can't move to CD-ROM");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't move to CD-ROM\n");
|
printf("Can't move to CD-ROM\n");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
if (CheckFDB(To, area.Path))
|
if (CheckFDB(To, area.Path))
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
topath = xstrcpy(area.Path);
|
topath = xstrcpy(area.Path);
|
||||||
topath = xstrcat(topath, (char *)"/");
|
topath = xstrcat(topath, (char *)"/");
|
||||||
topath = xstrcat(topath, File);
|
topath = xstrcat(topath, File);
|
||||||
@ -122,9 +123,9 @@ void Move(int From, int To, char *File)
|
|||||||
sprintf(temp2, "%s/fdb/fdb%d.temp", getenv("MBSE_ROOT"), From);
|
sprintf(temp2, "%s/fdb/fdb%d.temp", getenv("MBSE_ROOT"), From);
|
||||||
|
|
||||||
if ((fp1 = fopen(temp1, "r")) == NULL)
|
if ((fp1 = fopen(temp1, "r")) == NULL)
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
if ((fp2 = fopen(temp2, "a+")) == NULL)
|
if ((fp2 = fopen(temp2, "a+")) == NULL)
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search the file if the From area, if found, the
|
* Search the file if the From area, if found, the
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbfpack.h"
|
#include "mbfpack.h"
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ void PackFileBase(void)
|
|||||||
|
|
||||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||||
WriteError("Can't open %s", sAreas);
|
WriteError("Can't open %s", sAreas);
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||||
@ -86,7 +87,7 @@ void PackFileBase(void)
|
|||||||
if (area.Available && !area.CDrom) {
|
if (area.Available && !area.CDrom) {
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("\r%4d => %-44s", i, area.Name);
|
printf("\r%4d => %-44s", i, area.Name);
|
||||||
@ -101,13 +102,13 @@ void PackFileBase(void)
|
|||||||
Syslog('!', "Creating new %s", fAreas);
|
Syslog('!', "Creating new %s", fAreas);
|
||||||
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
||||||
WriteError("$Can't create %s", fAreas);
|
WriteError("$Can't create %s", fAreas);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fp = fopen(fTmp, "a+")) == NULL) {
|
if ((fp = fopen(fTmp, "a+")) == NULL) {
|
||||||
WriteError("$Can't create %s", fTmp);
|
WriteError("$Can't create %s", fTmp);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbfile.h"
|
#include "mbfile.h"
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ void Help(void)
|
|||||||
printf(" -a -announce Suppress announce added files\n");
|
printf(" -a -announce Suppress announce added files\n");
|
||||||
printf(" -q -quiet Quiet mode\n");
|
printf(" -q -quiet Quiet mode\n");
|
||||||
printf(" -v -virus Suppress virus scanning, use with care\n");
|
printf(" -v -virus Suppress virus scanning, use with care\n");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -250,7 +251,7 @@ int UnpackFile(char *File)
|
|||||||
WriteError("$Can't create %s", temp);
|
WriteError("$Can't create %s", temp);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't create %s\n", temp);
|
printf("Can't create %s\n", temp);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +283,7 @@ int UnpackFile(char *File)
|
|||||||
sprintf(temp, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
||||||
if (chdir(temp) != 0) {
|
if (chdir(temp) != 0) {
|
||||||
WriteError("$Can't change to %s", temp);
|
WriteError("$Can't change to %s", temp);
|
||||||
die(0);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (execute(cmd, File, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
|
if (execute(cmd, File, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/dbftn.h"
|
#include "../lib/dbftn.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
|
|
||||||
|
|
||||||
#define TMPNAME "TMP."
|
#define TMPNAME "TMP."
|
||||||
@ -151,7 +152,7 @@ void Help(void)
|
|||||||
printf(" -quiet Quiet mode\n");
|
printf(" -quiet Quiet mode\n");
|
||||||
colour(7, 0);
|
colour(7, 0);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -208,7 +209,7 @@ void die(int onsig)
|
|||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
int i, rc;
|
int i;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
@ -258,16 +259,18 @@ int main(int argc,char *argv[])
|
|||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
if (lockindex()) {
|
if (lockindex()) {
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't lock mbindex, abort.\n");
|
printf("Can't lock mbindex, abort.\n");
|
||||||
die(104);
|
die(MBERR_NO_PROGLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = nodebld();
|
if (nodebld())
|
||||||
die(rc);
|
die(MBERR_GENERAL);
|
||||||
|
else
|
||||||
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "post.h"
|
#include "post.h"
|
||||||
#include "mbmsg.h"
|
#include "mbmsg.h"
|
||||||
|
|
||||||
@ -177,7 +178,7 @@ int main(int argc, char **argv)
|
|||||||
Post(too, tarea, subj, mfile, flavor);
|
Post(too, tarea, subj, mfile, flavor);
|
||||||
}
|
}
|
||||||
|
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +206,7 @@ void Help()
|
|||||||
printf(" -q -quiet Quiet mode\n");
|
printf(" -q -quiet Quiet mode\n");
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -276,7 +277,7 @@ void DoMsgBase()
|
|||||||
sprintf(sAreas, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
sprintf(sAreas, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
||||||
if(( pAreas = fopen (sAreas, "r")) == NULL) {
|
if(( pAreas = fopen (sAreas, "r")) == NULL) {
|
||||||
WriteError("$Can't open Messages Areas File.");
|
WriteError("$Can't open Messages Areas File.");
|
||||||
die(SIGILL);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
fread(&msgshdr, sizeof(msgshdr), 1, pAreas);
|
fread(&msgshdr, sizeof(msgshdr), 1, pAreas);
|
||||||
|
|
||||||
@ -286,7 +287,7 @@ void DoMsgBase()
|
|||||||
if (msgs.Active) {
|
if (msgs.Active) {
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
colour(3, 0);
|
colour(3, 0);
|
||||||
@ -315,7 +316,7 @@ void DoMsgBase()
|
|||||||
if (msgs.Active) {
|
if (msgs.Active) {
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(MBERR_DISK_FULL);
|
||||||
|
|
||||||
Nopper();
|
Nopper();
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
@ -417,7 +418,7 @@ void DoMsgBase()
|
|||||||
|
|
||||||
free(sAreas);
|
free(sAreas);
|
||||||
free(Name);
|
free(Name);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
200
mbfido/rnews.c
200
mbfido/rnews.c
@ -43,6 +43,7 @@
|
|||||||
#include "../lib/dbmsgs.h"
|
#include "../lib/dbmsgs.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
#include "../lib/msgtext.h"
|
#include "../lib/msgtext.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "rfc2ftn.h"
|
#include "rfc2ftn.h"
|
||||||
#include "mbfido.h"
|
#include "mbfido.h"
|
||||||
#include "../paths.h"
|
#include "../paths.h"
|
||||||
@ -164,57 +165,56 @@ const char *HeaderFindMem(const char *Article, const int ArtLen, const char *Hea
|
|||||||
static int StartChild(int, char *, char *[]);
|
static int StartChild(int, char *, char *[]);
|
||||||
static int StartChild(int fd, char *path, char *argv[])
|
static int StartChild(int fd, char *path, char *argv[])
|
||||||
{
|
{
|
||||||
int pan[2];
|
int pan[2], i;
|
||||||
int i;
|
pid_t pid;
|
||||||
pid_t pid;
|
|
||||||
|
|
||||||
/* Create a pipe. */
|
/* Create a pipe. */
|
||||||
if (pipe(pan) < 0) {
|
if (pipe(pan) < 0) {
|
||||||
WriteError("%Cant pipe for %s", path);
|
WriteError("%Cant pipe for %s", path);
|
||||||
die(101);
|
die(MBERR_EXEC_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get a child. */
|
||||||
|
for (i = 0; (pid = fork()) < 0; i++) {
|
||||||
|
if (i == MAX_FORKS) {
|
||||||
|
WriteError("$Cant fork %s -- spooling", path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Syslog('n', "Cant fork %s -- waiting", path);
|
||||||
|
(void)sleep(60);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Run the child, with redirection. */
|
||||||
|
if (pid == 0) {
|
||||||
|
(void)close(pan[PIPE_READ]);
|
||||||
|
|
||||||
|
/* Stdin comes from our old input. */
|
||||||
|
if (fd != STDIN) {
|
||||||
|
if ((i = dup2(fd, STDIN)) != STDIN) {
|
||||||
|
WriteError("$Cant dup2 %d to 0 got %d", fd, i);
|
||||||
|
_exit(MBERR_EXEC_FAILED);
|
||||||
|
}
|
||||||
|
(void)close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a child. */
|
/* Stdout goes down the pipe. */
|
||||||
for (i = 0; (pid = fork()) < 0; i++) {
|
if (pan[PIPE_WRITE] != STDOUT) {
|
||||||
if (i == MAX_FORKS) {
|
if ((i = dup2(pan[PIPE_WRITE], STDOUT)) != STDOUT) {
|
||||||
WriteError("$Cant fork %s -- spooling", path);
|
WriteError("$Cant dup2 %d to 1 got %d", pan[PIPE_WRITE], i);
|
||||||
return -1;
|
_exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
Syslog('n', "Cant fork %s -- waiting", path);
|
(void)close(pan[PIPE_WRITE]);
|
||||||
(void)sleep(60);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run the child, with redirection. */
|
Syslog('n', "execv %s %s", MBSE_SS(path), MBSE_SS(argv[1]));
|
||||||
if (pid == 0) {
|
(void)execv(path, argv);
|
||||||
(void)close(pan[PIPE_READ]);
|
WriteError("$Cant execv %s", path);
|
||||||
|
_exit(MBERR_EXEC_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
/* Stdin comes from our old input. */
|
(void)close(pan[PIPE_WRITE]);
|
||||||
if (fd != STDIN) {
|
(void)close(fd);
|
||||||
if ((i = dup2(fd, STDIN)) != STDIN) {
|
return pan[PIPE_READ];
|
||||||
WriteError("$Cant dup2 %d to 0 got %d", fd, i);
|
|
||||||
_exit(1);
|
|
||||||
}
|
|
||||||
(void)close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Stdout goes down the pipe. */
|
|
||||||
if (pan[PIPE_WRITE] != STDOUT) {
|
|
||||||
if ((i = dup2(pan[PIPE_WRITE], STDOUT)) != STDOUT) {
|
|
||||||
WriteError("$Cant dup2 %d to 1 got %d", pan[PIPE_WRITE], i);
|
|
||||||
_exit(1);
|
|
||||||
}
|
|
||||||
(void)close(pan[PIPE_WRITE]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Syslog('n', "execv %s %s", MBSE_SS(path), MBSE_SS(argv[1]));
|
|
||||||
(void)execv(path, argv);
|
|
||||||
WriteError("$Cant execv %s", path);
|
|
||||||
_exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)close(pan[PIPE_WRITE]);
|
|
||||||
(void)close(fd);
|
|
||||||
return pan[PIPE_READ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -322,50 +322,50 @@ static int Process(char *article)
|
|||||||
static int ReadRemainder(register int, char, char);
|
static int ReadRemainder(register int, char, char);
|
||||||
static int ReadRemainder(register int fd, char first, char second)
|
static int ReadRemainder(register int fd, char first, char second)
|
||||||
{
|
{
|
||||||
register FILE *F;
|
register FILE *F;
|
||||||
register char *article;
|
register char *article;
|
||||||
register int size;
|
register int size;
|
||||||
register int used;
|
register int used;
|
||||||
register int left;
|
register int left;
|
||||||
register int i;
|
register int i;
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
/* Turn the descriptor into a stream. */
|
/* Turn the descriptor into a stream. */
|
||||||
if ((F = fdopen(fd, "r")) == NULL) {
|
if ((F = fdopen(fd, "r")) == NULL) {
|
||||||
WriteError("$Can't fdopen %d", fd);
|
WriteError("$Can't fdopen %d", fd);
|
||||||
die(101);
|
die(MBERR_GENERAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get an initial allocation, leaving space for the \0. */
|
||||||
|
size = BUFSIZ + 1;
|
||||||
|
article = NEW(char, size + 2);
|
||||||
|
article[0] = first;
|
||||||
|
article[1] = second;
|
||||||
|
used = second ? 2 : 1;
|
||||||
|
left = size - used;
|
||||||
|
|
||||||
|
/* Read the input. */
|
||||||
|
while ((i = fread((POINTER)&article[used], (size_t)1, (size_t)left, F)) != 0) {
|
||||||
|
if (i < 0) {
|
||||||
|
WriteError("$Cant fread after %d bytes", used);
|
||||||
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
used += i;
|
||||||
/* Get an initial allocation, leaving space for the \0. */
|
left -= i;
|
||||||
size = BUFSIZ + 1;
|
if (left < SMBUF) {
|
||||||
article = NEW(char, size + 2);
|
size += BUFSIZ;
|
||||||
article[0] = first;
|
left += BUFSIZ;
|
||||||
article[1] = second;
|
RENEW(article, char, size);
|
||||||
used = second ? 2 : 1;
|
|
||||||
left = size - used;
|
|
||||||
|
|
||||||
/* Read the input. */
|
|
||||||
while ((i = fread((POINTER)&article[used], (size_t)1, (size_t)left, F)) != 0) {
|
|
||||||
if (i < 0) {
|
|
||||||
WriteError("$Cant fread after %d bytes", used);
|
|
||||||
die(101);
|
|
||||||
}
|
|
||||||
used += i;
|
|
||||||
left -= i;
|
|
||||||
if (left < SMBUF) {
|
|
||||||
size += BUFSIZ;
|
|
||||||
left += BUFSIZ;
|
|
||||||
RENEW(article, char, size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (article[used - 1] != '\n')
|
}
|
||||||
article[used++] = '\n';
|
if (article[used - 1] != '\n')
|
||||||
article[used] = '\0';
|
article[used++] = '\n';
|
||||||
(void)fclose(F);
|
article[used] = '\0';
|
||||||
|
(void)fclose(F);
|
||||||
|
|
||||||
ok = Process(article);
|
ok = Process(article);
|
||||||
DISPOSE(article);
|
DISPOSE(article);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -421,23 +421,23 @@ static int ReadBytecount(register int fd, int artsize)
|
|||||||
static int ReadLine(char *, int, int);
|
static int ReadLine(char *, int, int);
|
||||||
static int ReadLine(char *p, int size, int fd)
|
static int ReadLine(char *p, int size, int fd)
|
||||||
{
|
{
|
||||||
char *save;
|
char *save;
|
||||||
|
|
||||||
/* Fill the buffer, a byte at a time. */
|
/* Fill the buffer, a byte at a time. */
|
||||||
for (save = p; size > 0; p++, size--) {
|
for (save = p; size > 0; p++, size--) {
|
||||||
if (read(fd, p, 1) != 1) {
|
if (read(fd, p, 1) != 1) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
WriteError("$Cant read first line got %s", save);
|
WriteError("$Cant read first line got %s", save);
|
||||||
die(101);
|
die(MBERR_GENERAL);
|
||||||
}
|
|
||||||
if (*p == '\n') {
|
|
||||||
*p = '\0';
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*p = '\0';
|
if (*p == '\n') {
|
||||||
WriteError("bad_line too long %s", save);
|
*p = '\0';
|
||||||
return FALSE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*p = '\0';
|
||||||
|
WriteError("bad_line too long %s", save);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ depend:
|
|||||||
|
|
||||||
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
|
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
|
||||||
# Dependencies generated by make depend
|
# Dependencies generated by make depend
|
||||||
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h common.h mutil.h
|
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mberrors.h common.h mutil.h
|
||||||
mbmon.o: ../config.h ../lib/libs.h ../lib/memwatch.h common.h mutil.h
|
mbmon.o: ../config.h ../lib/libs.h ../lib/memwatch.h common.h mutil.h
|
||||||
common.o: ../config.h ../lib/libs.h ../lib/memwatch.h common.h
|
common.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mberrors.h common.h
|
||||||
# End of generated dependencies
|
# End of generated dependencies
|
||||||
|
113
mbmon/common.c
113
mbmon/common.c
@ -31,6 +31,7 @@
|
|||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "../lib/libs.h"
|
#include "../lib/libs.h"
|
||||||
#include "../lib/memwatch.h"
|
#include "../lib/memwatch.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
@ -43,30 +44,30 @@ static int sock = -1; /* TCP/IP socket */
|
|||||||
int ttyfd; /* Filedescriptor for raw mode */
|
int ttyfd; /* Filedescriptor for raw mode */
|
||||||
struct termios tbufs, tbufsavs; /* Structure for raw mode */
|
struct termios tbufs, tbufsavs; /* Structure for raw mode */
|
||||||
|
|
||||||
struct sockaddr_un clntaddr; /* Client socket address */
|
struct sockaddr_un clntaddr; /* Client socket address */
|
||||||
struct sockaddr_un servaddr; /* Server socket address */
|
struct sockaddr_un servaddr; /* Server socket address */
|
||||||
struct sockaddr_un from; /* From socket address */
|
struct sockaddr_un from; /* From socket address */
|
||||||
int fromlen;
|
int fromlen;
|
||||||
static char spath[108]; /* Server socket path */
|
static char spath[PATH_MAX]; /* Server socket path */
|
||||||
static char cpath[108]; /* Client socket path */
|
static char cpath[PATH_MAX]; /* Client socket path */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InitClient(char *user)
|
void InitClient(char *user)
|
||||||
{
|
{
|
||||||
sprintf(cpath, "%s/tmp/mbmon%d", getenv("MBSE_ROOT"), getpid());
|
sprintf(cpath, "%s/tmp/mbmon%d", getenv("MBSE_ROOT"), getpid());
|
||||||
sprintf(spath, "%s/tmp/mbtask", getenv("MBSE_ROOT"));
|
sprintf(spath, "%s/tmp/mbtask", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store my pid in case a child process is forked and wants to do
|
* Store my pid in case a child process is forked and wants to do
|
||||||
* some communications with the mbsed server.
|
* some communications with the mbsed server.
|
||||||
*/
|
*/
|
||||||
mypid = getpid();
|
mypid = getpid();
|
||||||
if (socket_connect(user) == -1) {
|
if (socket_connect(user) == -1) {
|
||||||
printf("PANIC: cannot access socket\n");
|
printf("PANIC: cannot access socket\n");
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -456,41 +457,31 @@ int rawset = FALSE;
|
|||||||
*/
|
*/
|
||||||
void Setraw()
|
void Setraw()
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((rc = tcgetattr(ttyfd, &tbufs))) {
|
if ((rc = tcgetattr(ttyfd, &tbufs))) {
|
||||||
perror("");
|
perror("");
|
||||||
printf("$tcgetattr(0, save) return %d\n", rc);
|
printf("$tcgetattr(0, save) return %d\n", rc);
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (ioctl(ttyfd, TCGETA, &tbuf) == -1) {
|
tbufsavs = tbufs;
|
||||||
// perror("TCGETA Failed");
|
tbufs.c_iflag &= ~(INLCR | ICRNL | ISTRIP | IXON );
|
||||||
// exit(1); /* ERROR - could not set get tty ioctl */
|
/*
|
||||||
// }
|
* Map CRNL modes strip control characters and flow control
|
||||||
|
*/
|
||||||
|
tbufs.c_oflag &= ~OPOST; /* Don't do ouput character translation */
|
||||||
|
tbufs.c_lflag &= ~(ICANON | ECHO); /* No canonical input and no echo */
|
||||||
|
tbufs.c_cc[VMIN] = 1; /* Receive 1 character at a time */
|
||||||
|
tbufs.c_cc[VTIME] = 0; /* No time limit per character */
|
||||||
|
|
||||||
tbufsavs = tbufs;
|
if ((rc = tcsetattr(ttyfd, TCSADRAIN, &tbufs))) {
|
||||||
tbufs.c_iflag &= ~(INLCR | ICRNL | ISTRIP | IXON );
|
perror("");
|
||||||
/*
|
printf("$tcsetattr(%d, TCSADRAIN, raw) return %d\n", ttyfd, rc);
|
||||||
* Map CRNL modes strip control characters and flow control
|
exit(MBERR_TTYIO_ERROR);
|
||||||
*/
|
}
|
||||||
tbufs.c_oflag &= ~OPOST; /* Don't do ouput character translation */
|
|
||||||
tbufs.c_lflag &= ~(ICANON | ECHO); /* No canonical input and no echo */
|
|
||||||
tbufs.c_cc[VMIN] = 1; /* Receive 1 character at a time */
|
|
||||||
tbufs.c_cc[VTIME] = 0; /* No time limit per character */
|
|
||||||
|
|
||||||
if ((rc = tcsetattr(ttyfd, TCSADRAIN, &tbufs))) {
|
rawset = TRUE;
|
||||||
perror("");
|
|
||||||
printf("$tcsetattr(%d, TCSADRAIN, raw) return %d\n", ttyfd, rc);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (ioctl(ttyfd, TCSETAF, &tbuf) == -1) {
|
|
||||||
// perror("TCSETAF failed");
|
|
||||||
// exit(1); /* ERROR - could not set tty ioctl */
|
|
||||||
// }
|
|
||||||
|
|
||||||
rawset = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -500,23 +491,19 @@ void Setraw()
|
|||||||
*/
|
*/
|
||||||
void Unsetraw()
|
void Unsetraw()
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only unset the mode if it is set to raw mode
|
* Only unset the mode if it is set to raw mode
|
||||||
*/
|
*/
|
||||||
if (rawset == TRUE) {
|
if (rawset == TRUE) {
|
||||||
// if (ioctl(ttyfd, TCSETAF, &tbufsav) == -1) {
|
if ((rc = tcsetattr(ttyfd, TCSAFLUSH, &tbufsavs))) {
|
||||||
// perror("TCSETAF Normal Failed");
|
perror("");
|
||||||
// exit(1); /* ERROR - could not save original tty ioctl */
|
printf("$tcsetattr(%d, TCSAFLUSH, save) return %d\n", ttyfd, rc);
|
||||||
// }
|
exit(MBERR_TTYIO_ERROR);
|
||||||
if ((rc = tcsetattr(ttyfd, TCSAFLUSH, &tbufsavs))) {
|
|
||||||
perror("");
|
|
||||||
printf("$tcsetattr(%d, TCSAFLUSH, save) return %d\n", ttyfd, rc);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rawset = FALSE;
|
}
|
||||||
|
rawset = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "../lib/libs.h"
|
#include "../lib/libs.h"
|
||||||
#include "../lib/memwatch.h"
|
#include "../lib/memwatch.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "mutil.h"
|
#include "mutil.h"
|
||||||
|
|
||||||
@ -44,8 +45,8 @@ unsigned char readkey(int y, int x, int fg, int bg)
|
|||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
|
|
||||||
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
||||||
perror("open 9");
|
perror("open /dev/tty");
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
Setraw();
|
||||||
|
|
||||||
@ -87,8 +88,8 @@ unsigned char testkey(int y, int x)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
||||||
perror("open 9");
|
perror("open /dev/tty");
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
Setraw();
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ depend:
|
|||||||
# Dependencies generated by make depend
|
# Dependencies generated by make depend
|
||||||
bank.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bank.h input.h language.h dispfile.h timeout.h timecheck.h whoson.h exitinfo.h
|
bank.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bank.h input.h language.h dispfile.h timeout.h timecheck.h whoson.h exitinfo.h
|
||||||
filesub.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 filesub.h funcs.h language.h input.h misc.h timeout.h exitinfo.h change.h
|
filesub.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 filesub.h funcs.h language.h input.h misc.h timeout.h exitinfo.h change.h
|
||||||
language.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 input.h language.h
|
language.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/mberrors.h input.h language.h
|
||||||
mbtoberep.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h
|
mbtoberep.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mberrors.h
|
||||||
msgutil.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/msgtext.h ../lib/msg.h oneline.h msgutil.h
|
msgutil.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/msgtext.h ../lib/msg.h oneline.h msgutil.h
|
||||||
oneline.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 oneline.h funcs.h input.h language.h
|
oneline.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 oneline.h funcs.h input.h language.h
|
||||||
bbslist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bbslist.h funcs.h input.h language.h
|
bbslist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bbslist.h funcs.h input.h language.h
|
||||||
@ -145,20 +145,20 @@ morefile.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/str
|
|||||||
email.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/msgtext.h ../lib/msg.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h
|
email.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/msgtext.h ../lib/msg.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h
|
||||||
fsedit.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/ansi.h ../lib/common.h ../lib/clcomm.h mail.h input.h language.h timeout.h pinfo.h fsedit.h
|
fsedit.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/ansi.h ../lib/common.h ../lib/clcomm.h mail.h input.h language.h timeout.h pinfo.h fsedit.h
|
||||||
lineedit.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 mail.h input.h language.h timeout.h lineedit.h
|
lineedit.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 mail.h input.h language.h timeout.h lineedit.h
|
||||||
mblang.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h
|
mblang.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/mberrors.h
|
||||||
mbuser.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 mbuser.h
|
mbuser.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 ../lib/mberrors.h mbuser.h
|
||||||
page.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 dispfile.h input.h chat.h page.h timeout.h mail.h language.h
|
page.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 dispfile.h input.h chat.h page.h timeout.h mail.h language.h
|
||||||
bye.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h dispfile.h misc.h language.h bye.h
|
bye.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h dispfile.h misc.h language.h bye.h
|
||||||
funcs.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/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h
|
funcs.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/msgtext.h ../lib/msg.h ../lib/clcomm.h ../lib/mberrors.h funcs.h
|
||||||
mail.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/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h
|
mail.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/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h
|
||||||
newuser.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
|
newuser.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
|
||||||
pinfo.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 pinfo.h input.h
|
pinfo.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 pinfo.h input.h
|
||||||
timecheck.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h
|
timecheck.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h
|
||||||
change.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 change.h dispfile.h funcs.h input.h language.h misc.h timeout.h exitinfo.h bye.h
|
change.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 change.h dispfile.h funcs.h input.h language.h misc.h timeout.h exitinfo.h bye.h
|
||||||
exitinfo.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 funcs.h input.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
|
exitinfo.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 funcs.h input.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
|
||||||
mball.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mbse.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbcfg.h ../lib/clcomm.h mball.h
|
mball.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mbse.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbcfg.h ../lib/clcomm.h ../lib/mberrors.h mball.h
|
||||||
mbsebbs.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/msg.h mbsebbs.h user.h dispfile.h language.h menu.h misc.h bye.h timeout.h funcs.h
|
mbsebbs.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/msg.h ../lib/mberrors.h mbsebbs.h user.h dispfile.h language.h menu.h misc.h bye.h timeout.h funcs.h
|
||||||
menu.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 oneline.h mail.h bbslist.h change.h bank.h chat.h file.h funcs.h input.h misc.h nextuser.h safe.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h
|
menu.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/mberrors.h oneline.h mail.h bbslist.h change.h bank.h chat.h file.h funcs.h input.h misc.h nextuser.h safe.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h
|
||||||
nextuser.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/ansi.h ../lib/clcomm.h ../lib/common.h nextuser.h funcs.h input.h language.h timeout.h
|
nextuser.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/ansi.h ../lib/clcomm.h ../lib/common.h nextuser.h funcs.h input.h language.h timeout.h
|
||||||
pop3.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/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h
|
pop3.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/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h
|
||||||
lastcallers.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h lastcallers.h
|
lastcallers.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h lastcallers.h
|
||||||
@ -166,15 +166,15 @@ safe.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs
|
|||||||
timeout.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/msg.h timeout.h funcs.h bye.h filesub.h language.h
|
timeout.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/msg.h timeout.h funcs.h bye.h filesub.h language.h
|
||||||
chat.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 chat.h funcs.h input.h language.h misc.h whoson.h
|
chat.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 chat.h funcs.h input.h language.h misc.h whoson.h
|
||||||
file.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 filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h
|
file.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 filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h
|
||||||
mbchat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h
|
mbchat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h
|
||||||
mbstat.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 mbstat.h
|
mbstat.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 ../lib/mberrors.h mbstat.h
|
||||||
misc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h language.h misc.h timeout.h exitinfo.h
|
misc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h funcs.h input.h language.h misc.h timeout.h exitinfo.h
|
||||||
offline.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mbse.h ../lib/users.h ../lib/records.h ../lib/bluewave.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h
|
offline.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mbse.h ../lib/users.h ../lib/records.h ../lib/bluewave.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h
|
||||||
user.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 timeout.h user.h dispfile.h funcs.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h email.h
|
user.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/mberrors.h timeout.h user.h dispfile.h funcs.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h email.h
|
||||||
mbnewusr.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 mbnewusr.h funcs.h input.h language.h misc.h timeout.h newuser.h
|
mbnewusr.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/mberrors.h mbnewusr.h funcs.h input.h language.h misc.h timeout.h newuser.h
|
||||||
input.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h timeout.h language.h
|
input.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h input.h timeout.h language.h
|
||||||
whoson.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 input.h language.h exitinfo.h whoson.h
|
whoson.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 input.h language.h exitinfo.h whoson.h
|
||||||
door.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 input.h timeout.h exitinfo.h whoson.h door.h
|
door.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/mberrors.h input.h timeout.h exitinfo.h whoson.h door.h
|
||||||
dispfile.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/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h dispfile.h
|
dispfile.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/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h dispfile.h
|
||||||
userlist.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 userlist.h language.h input.h timeout.h
|
userlist.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 userlist.h language.h input.h timeout.h
|
||||||
timestats.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h timestats.h funcs.h language.h input.h exitinfo.h
|
timestats.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h timestats.h funcs.h language.h input.h exitinfo.h
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "dispfile.h"
|
#include "dispfile.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
@ -95,7 +96,7 @@ void Good_Bye(int onsig)
|
|||||||
offset = usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize);
|
offset = usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize);
|
||||||
if(fseek(pUsrConfig, offset, 0) != 0) {
|
if(fseek(pUsrConfig, offset, 0) != 0) {
|
||||||
WriteError("Can't move pointer in file %s", temp);
|
WriteError("Can't move pointer in file %s", temp);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig);
|
fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig);
|
||||||
@ -160,7 +161,7 @@ void Quick_Bye(int onsig)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "exitinfo.h"
|
#include "exitinfo.h"
|
||||||
@ -263,7 +264,7 @@ int exec_nosuid(char *mandato)
|
|||||||
argv[2] = mandato;
|
argv[2] = mandato;
|
||||||
argv[3] = 0;
|
argv[3] = 0;
|
||||||
execve("/bin/sh", argv, environ);
|
execve("/bin/sh", argv, environ);
|
||||||
exit(127);
|
exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
e_pid = pid;
|
e_pid = pid;
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "../lib/msgtext.h"
|
#include "../lib/msgtext.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
|
|
||||||
|
|
||||||
@ -197,7 +198,7 @@ char *ChangeHomeDir(char *Name, int Mailboxes)
|
|||||||
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
|
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
|
||||||
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
|
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
|
||||||
free(temp);
|
free(temp);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(temp1, "%s/%s", CFG.bbs_usersdir, Name);
|
sprintf(temp1, "%s/%s", CFG.bbs_usersdir, Name);
|
||||||
@ -208,7 +209,7 @@ char *ChangeHomeDir(char *Name, int Mailboxes)
|
|||||||
if ((access(temp1, R_OK)) != 0) {
|
if ((access(temp1, R_OK)) != 0) {
|
||||||
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
|
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
|
||||||
free(temp);
|
free(temp);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -217,7 +218,7 @@ char *ChangeHomeDir(char *Name, int Mailboxes)
|
|||||||
if (chdir(temp1) != 0) {
|
if (chdir(temp1) != 0) {
|
||||||
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
|
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
|
||||||
free(temp);
|
free(temp);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
setenv("HOME", temp1, 1);
|
setenv("HOME", temp1, 1);
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ void FindMBSE()
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
sprintf(FileName, "%s/etc/config.data", getenv("MBSE_ROOT"));
|
sprintf(FileName, "%s/etc/config.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
@ -331,7 +332,7 @@ void FindMBSE()
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&CFG, sizeof(CFG), 1, pDataFile);
|
fread(&CFG, sizeof(CFG), 1, pDataFile);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
@ -497,7 +498,7 @@ void Getpass(char *theword)
|
|||||||
*/
|
*/
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR)) < 0) {
|
if ((ttyfd = open ("/dev/tty", O_RDWR)) < 0) {
|
||||||
perror("open 7");
|
perror("open 7");
|
||||||
ExitClient(1);
|
ExitClient(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set Raw mode so that the characters don't echo */
|
/* Set Raw mode so that the characters don't echo */
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ void InitLanguage()
|
|||||||
sprintf(temp, "%s/etc/%s", getenv("MBSE_ROOT"), CFG.current_language);
|
sprintf(temp, "%s/etc/%s", getenv("MBSE_ROOT"), CFG.current_language);
|
||||||
if ((pLang = fopen(temp, "rb")) == NULL) {
|
if ((pLang = fopen(temp, "rb")) == NULL) {
|
||||||
WriteError("$FATAL: Can't open %s", temp);
|
WriteError("$FATAL: Can't open %s", temp);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fread(&ldata, sizeof(ldata), 1, pLang) == 1) {
|
while (fread(&ldata, sizeof(ldata), 1, pLang) == 1) {
|
||||||
@ -144,7 +145,7 @@ void InitLanguage()
|
|||||||
|
|
||||||
if(iLang >= LANG) {
|
if(iLang >= LANG) {
|
||||||
printf("FATAL: Language file has to many lines in it");
|
printf("FATAL: Language file has to many lines in it");
|
||||||
ExitClient(1);
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mball.h"
|
#include "mball.h"
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +125,7 @@ void Help()
|
|||||||
printf(" -z -zip Create .zip archives\n");
|
printf(" -z -zip Create .zip archives\n");
|
||||||
colour(7, 0);
|
colour(7, 0);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -148,8 +149,7 @@ int main(int argc, char **argv)
|
|||||||
* Catch all signals we can, and ignore the rest.
|
* Catch all signals we can, and ignore the rest.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGKILL) || (i == SIGBUS) ||
|
if ((i == SIGHUP) || (i == SIGKILL) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
@ -200,7 +200,7 @@ int main(int argc, char **argv)
|
|||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Done!\n");
|
printf("Done!\n");
|
||||||
|
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ void Masterlist()
|
|||||||
if(( pAreas = fopen (sAreas, "r")) == NULL) {
|
if(( pAreas = fopen (sAreas, "r")) == NULL) {
|
||||||
WriteError("Can't open File Areas File: %s", sAreas);
|
WriteError("Can't open File Areas File: %s", sAreas);
|
||||||
colour(7,0);
|
colour(7,0);
|
||||||
die(1);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||||
|
|
||||||
@ -295,12 +295,12 @@ void Masterlist()
|
|||||||
|
|
||||||
if ((fp = fopen("allfiles.tmp", "a+")) == NULL) {
|
if ((fp = fopen("allfiles.tmp", "a+")) == NULL) {
|
||||||
WriteError("$Can't open allfiles.tmp");
|
WriteError("$Can't open allfiles.tmp");
|
||||||
die(1);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
if ((np = fopen("newfiles.tmp", "a+")) == NULL) {
|
if ((np = fopen("newfiles.tmp", "a+")) == NULL) {
|
||||||
WriteError("$Can't open newfiles.tmp");
|
WriteError("$Can't open newfiles.tmp");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
die(1);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
TopBox(fp, TRUE);
|
TopBox(fp, TRUE);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Sysop chat utility.
|
* Purpose ...............: Sysop chat utility.
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2000
|
* Copyright (C) 1997-2002
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:2801/2802
|
* Michiel Broek FIDO: 2:2801/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -34,6 +34,7 @@
|
|||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
|
|
||||||
|
|
||||||
char *ttime2(void); /* Returns current time HH:MM */
|
char *ttime2(void); /* Returns current time HH:MM */
|
||||||
@ -72,7 +73,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(FileName, "%s/etc/config.data", BBSpath);
|
sprintf(FileName, "%s/etc/config.data", BBSpath);
|
||||||
@ -84,7 +85,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
fread(&CFG, sizeof(CFG), 1, pDataFile);
|
fread(&CFG, sizeof(CFG), 1, pDataFile);
|
||||||
fclose(pDataFile);
|
fclose(pDataFile);
|
||||||
@ -106,7 +107,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\f");
|
printf("\f");
|
||||||
@ -130,7 +131,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_COMMANDLINE);
|
||||||
} else {
|
} else {
|
||||||
fgets(pid1,19,pPid);
|
fgets(pid1,19,pPid);
|
||||||
fclose(pPid);
|
fclose(pPid);
|
||||||
@ -232,7 +233,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
#include "../lib/users.h"
|
#include "../lib/users.h"
|
||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@ -56,7 +57,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(temp1, "%s", *(argv + 1));
|
sprintf(temp1, "%s", *(argv + 1));
|
||||||
@ -68,7 +69,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
sprintf(temp1, "%s", *(argv + 1));
|
sprintf(temp1, "%s", *(argv + 1));
|
||||||
if ((fp = fopen(temp1, "a+")) == NULL) {
|
if ((fp = fopen(temp1, "a+")) == NULL) {
|
||||||
@ -76,7 +77,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
lines = 0;
|
lines = 0;
|
||||||
@ -97,7 +98,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -115,7 +116,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(&ldata, sizeof(ldata), 1, fp);
|
fwrite(&ldata, sizeof(ldata), 1, fp);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbnewusr.h"
|
#include "mbnewusr.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
@ -76,7 +77,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -87,7 +88,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -98,7 +99,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -137,7 +138,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((tty = ttyname(0)) == NULL) {
|
if ((tty = ttyname(0)) == NULL) {
|
||||||
WriteError("Not at a tty");
|
WriteError("Not at a tty");
|
||||||
Fast_Bye(0);
|
Fast_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp("/dev/", tty, 5) == 0)
|
if (strncmp("/dev/", tty, 5) == 0)
|
||||||
@ -154,8 +155,7 @@ int main(int argc, char **argv)
|
|||||||
* Trap signals
|
* Trap signals
|
||||||
*/
|
*/
|
||||||
for(i = 0; i < NSIG; i++) {
|
for(i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) ||
|
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
||||||
(i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
@ -173,7 +173,7 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (CheckStatus() == FALSE) {
|
if (CheckStatus() == FALSE) {
|
||||||
Syslog('+', "Kicking user out, the BBS is closed");
|
Syslog('+', "Kicking user out, the BBS is closed");
|
||||||
Fast_Bye(0);
|
Fast_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
colour(YELLOW, BLACK);
|
||||||
@ -200,7 +200,7 @@ int main(int argc, char **argv)
|
|||||||
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
||||||
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
||||||
printf("No BBS on this port allowed!\n\n");
|
printf("No BBS on this port allowed!\n\n");
|
||||||
Fast_Bye(0);
|
Fast_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -219,7 +219,7 @@ int main(int argc, char **argv)
|
|||||||
Pause();
|
Pause();
|
||||||
|
|
||||||
newuser();
|
newuser();
|
||||||
Fast_Bye(0);
|
Fast_Bye(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbsebbs.h"
|
#include "mbsebbs.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "dispfile.h"
|
#include "dispfile.h"
|
||||||
@ -78,7 +79,7 @@ int main(int argc, char **argv)
|
|||||||
strcpy(sUnixName, getenv("USER"));
|
strcpy(sUnixName, getenv("USER"));
|
||||||
} else {
|
} else {
|
||||||
WriteError("No username in environment");
|
WriteError("No username in environment");
|
||||||
Quick_Bye(0);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -128,7 +129,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((tty = ttyname(0)) == NULL) {
|
if ((tty = ttyname(0)) == NULL) {
|
||||||
WriteError("Not at a tty");
|
WriteError("Not at a tty");
|
||||||
Quick_Bye(0);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp("/dev/", tty, 5) == 0)
|
if (strncmp("/dev/", tty, 5) == 0)
|
||||||
@ -145,8 +146,7 @@ int main(int argc, char **argv)
|
|||||||
* Trap signals
|
* Trap signals
|
||||||
*/
|
*/
|
||||||
for(i = 0; i < NSIG; i++) {
|
for(i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) ||
|
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
||||||
(i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
@ -168,7 +168,7 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (CheckStatus() == FALSE) {
|
if (CheckStatus() == FALSE) {
|
||||||
Syslog('+', "Kicking user out, the BBS is closed");
|
Syslog('+', "Kicking user out, the BBS is closed");
|
||||||
Quick_Bye(0);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
@ -200,7 +200,7 @@ int main(int argc, char **argv)
|
|||||||
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
||||||
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
||||||
printf("No BBS on this port allowed!\n\n");
|
printf("No BBS on this port allowed!\n\n");
|
||||||
Quick_Bye(0);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
Syslog('b', "Node number %d", iNode);
|
Syslog('b', "Node number %d", iNode);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbstat.h"
|
#include "mbstat.h"
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ void Help(void)
|
|||||||
colour(3, 0);
|
colour(3, 0);
|
||||||
printf(" -q -quiet Quiet, no screen output\n");
|
printf(" -q -quiet Quiet, no screen output\n");
|
||||||
colour(7, 0);
|
colour(7, 0);
|
||||||
die(0);
|
die(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,9 +124,7 @@ int main(int argc, char **argv)
|
|||||||
* Catch or ignore signals
|
* Catch or ignore signals
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) ||
|
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) ||
|
|
||||||
(i == SIGKILL))
|
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
@ -191,7 +190,7 @@ int main(int argc, char **argv)
|
|||||||
Help();
|
Help();
|
||||||
|
|
||||||
usleep(1);
|
usleep(1);
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "../lib/libs.h"
|
#include "../lib/libs.h"
|
||||||
#include "../lib/memwatch.h"
|
#include "../lib/memwatch.h"
|
||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@ -50,7 +51,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -62,7 +63,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fread(&rep, sizeof(rep), 1, fp) == 1) {
|
while (fread(&rep, sizeof(rep), 1, fp) == 1) {
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "mbuser.h"
|
#include "mbuser.h"
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ int main(int argc, char **argv)
|
|||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
ExitClient(101);
|
ExitClient(MBERR_DISK_FULL);
|
||||||
|
|
||||||
oldmask = umask(027);
|
oldmask = umask(027);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
@ -121,7 +122,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
colour(7, 0);
|
colour(7, 0);
|
||||||
ExitClient(0);
|
ExitClient(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +164,7 @@ void Help(void)
|
|||||||
|
|
||||||
colour(7, 0);
|
colour(7, 0);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
ExitClient(1);
|
ExitClient(MBERR_COMMANDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
273
mbsebbs/menu.c
273
mbsebbs/menu.c
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "oneline.h"
|
#include "oneline.h"
|
||||||
#include "mail.h"
|
#include "mail.h"
|
||||||
#include "bbslist.h"
|
#include "bbslist.h"
|
||||||
@ -92,160 +93,160 @@ void InitMenu()
|
|||||||
|
|
||||||
void menu()
|
void menu()
|
||||||
{
|
{
|
||||||
FILE *pMenuFile;
|
FILE *pMenuFile;
|
||||||
int iFoundKey = FALSE, Key, IsANSI;
|
int iFoundKey = FALSE, Key, IsANSI;
|
||||||
char *Input, *Semfile;
|
char *Input, *Semfile, *sMenuPathFileName;
|
||||||
char *sMenuPathFileName;
|
|
||||||
|
|
||||||
Input = calloc(81, sizeof(char));
|
Input = calloc(PATH_MAX, sizeof(char));
|
||||||
sMenuPathFileName = calloc(PATH_MAX, sizeof(char));
|
sMenuPathFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop forever, this is what a BBS should do until a user logs out.
|
* Loop forever, this is what a BBS should do until a user logs out.
|
||||||
|
*/
|
||||||
|
while (TRUE) {
|
||||||
|
|
||||||
|
WhosDoingWhat(BROWSING);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open menufile, first users language menu, if it fails
|
||||||
|
* try to open the default menu.
|
||||||
*/
|
*/
|
||||||
while (TRUE) {
|
sprintf(sMenuPathFileName,"%s/%s", lang.MenuPath, Menus[MenuLevel]);
|
||||||
|
if ((pMenuFile = fopen(sMenuPathFileName, "r")) == NULL) {
|
||||||
|
sprintf(sMenuPathFileName,"%s/%s", CFG.bbs_menus, Menus[MenuLevel]);
|
||||||
|
pMenuFile = fopen(sMenuPathFileName,"r");
|
||||||
|
if (pMenuFile != NULL)
|
||||||
|
Syslog('+', "Menu %s (Default)", Menus[MenuLevel]);
|
||||||
|
} else {
|
||||||
|
Syslog('+', "Menu %s (%s)", Menus[MenuLevel], lang.Name);
|
||||||
|
}
|
||||||
|
|
||||||
WhosDoingWhat(BROWSING);
|
if (pMenuFile == NULL) {
|
||||||
|
clear();
|
||||||
|
WriteError("Can't open menu file: %s", sMenuPathFileName);
|
||||||
|
MenuError++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open menufile, first users language menu, if it fails
|
* Is this the last attempt to open the default menu?
|
||||||
* try to open the default menu.
|
*/
|
||||||
*/
|
if (MenuError == 10) {
|
||||||
sprintf(sMenuPathFileName,"%s/%s", lang.MenuPath, Menus[MenuLevel]);
|
WriteError("FATAL ERROR: Too many menu errors");
|
||||||
if ((pMenuFile = fopen(sMenuPathFileName, "r")) == NULL) {
|
printf("Too many menu errors, notifying Sysop\n\n");
|
||||||
sprintf(sMenuPathFileName,"%s/%s", CFG.bbs_menus, Menus[MenuLevel]);
|
sleep(3);
|
||||||
pMenuFile = fopen(sMenuPathFileName,"r");
|
die(MBERR_CONFIG_ERROR);
|
||||||
if (pMenuFile != NULL)
|
}
|
||||||
Syslog('+', "Menu %s (Default)", Menus[MenuLevel]);
|
|
||||||
} else {
|
/*
|
||||||
Syslog('+', "Menu %s (%s)", Menus[MenuLevel], lang.Name);
|
* Switch back to the default menu
|
||||||
|
*/
|
||||||
|
MenuLevel = 0;
|
||||||
|
strcpy(Menus[0], CFG.default_menu);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Display Menu Text Fields and Perform all autoexec menus in order of menu file.
|
||||||
|
* First check if there are any ANSI menus, if not, send a clearscreen first.
|
||||||
|
*/
|
||||||
|
IsANSI = FALSE;
|
||||||
|
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
||||||
|
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
|
||||||
|
if ((menus.MenuType == 5) || (menus.MenuType == 19) || (menus.MenuType == 20))
|
||||||
|
IsANSI = TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
fseek(pMenuFile, 0, SEEK_SET);
|
||||||
|
if (! IsANSI)
|
||||||
|
clear();
|
||||||
|
|
||||||
if (pMenuFile == NULL) {
|
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
||||||
clear();
|
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
|
||||||
WriteError("Can't open menu file: %s", sMenuPathFileName);
|
if ( menus.AutoExec ) {
|
||||||
MenuError++;
|
DoMenu( menus.MenuType );
|
||||||
|
}
|
||||||
|
DisplayMenu( );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is this the last attempt to open the default menu?
|
* Check if the BBS closed down for Zone Mail Hour or
|
||||||
*/
|
* system shutdown. If so, we run the Goodbye show.
|
||||||
if (MenuError == 10) {
|
*/
|
||||||
WriteError("FATAL ERROR: Too many menu errors");
|
if (CheckStatus() == FALSE) {
|
||||||
printf("Too many menu errors, notifying Sysop\n\n");
|
fclose(pMenuFile);
|
||||||
sleep(3);
|
Syslog('+', "Kicking user out, the BBS is closed.");
|
||||||
die(SIGILL);
|
sleep(3);
|
||||||
}
|
Good_Bye(MBERR_OK);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Switch back to the default menu
|
* Check the upsdown semafore
|
||||||
*/
|
*/
|
||||||
MenuLevel = 0;
|
Semfile = calloc(PATH_MAX, sizeof(char));
|
||||||
strcpy(Menus[0], CFG.default_menu);
|
sprintf(Semfile, "%s/sema/upsdown", getenv("MBSE_ROOT"));
|
||||||
} else {
|
if (file_exist(Semfile, R_OK) == 0) {
|
||||||
/*
|
fclose(pMenuFile);
|
||||||
* Display Menu Text Fields and Perform all autoexec menus in order of menu file.
|
Syslog('+', "Kicking user out, upsdown semafore detected");
|
||||||
* First check if there are any ANSI menus, if not, send a clearscreen first.
|
printf("System power failure, closing the bbs\n\n");
|
||||||
*/
|
free(Semfile);
|
||||||
IsANSI = FALSE;
|
sleep(3);
|
||||||
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
Good_Bye(MBERR_OK);
|
||||||
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
|
}
|
||||||
if ((menus.MenuType == 5) || (menus.MenuType == 19) || (menus.MenuType == 20))
|
free(Semfile);
|
||||||
IsANSI = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fseek(pMenuFile, 0, SEEK_SET);
|
|
||||||
if (! IsANSI)
|
|
||||||
clear();
|
|
||||||
|
|
||||||
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
/*
|
||||||
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
|
* Check if SysOp wants to chat to user everytime user
|
||||||
if ( menus.AutoExec ) {
|
* gets prompt. Make sure /tmp/chatdev exists before
|
||||||
DoMenu( menus.MenuType );
|
* before calling chat(). Make sure if a second user
|
||||||
}
|
* logs in, that .BusyChatting does exist.
|
||||||
DisplayMenu( );
|
*/
|
||||||
}
|
if(CFG.iChatPromptChk && (access("/tmp/chatdev", R_OK) == 0) && (access("/tmp/.BusyChatting", F_OK) != 0))
|
||||||
}
|
Chat();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the BBS closed down for Zone Mail Hour or
|
* Check users timeleft
|
||||||
* system shutdown. If so, we run the Goodbye show.
|
*/
|
||||||
*/
|
TimeCheck();
|
||||||
if (CheckStatus() == FALSE) {
|
|
||||||
fclose(pMenuFile);
|
|
||||||
Syslog('+', "Kicking user out, the BBS is closed.");
|
|
||||||
sleep(3);
|
|
||||||
Good_Bye(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
alarm_on();
|
||||||
* Check the upsdown semafore
|
|
||||||
*/
|
|
||||||
Semfile = calloc(PATH_MAX, sizeof(char));
|
|
||||||
sprintf(Semfile, "%s/sema/upsdown", getenv("MBSE_ROOT"));
|
|
||||||
if (file_exist(Semfile, R_OK) == 0) {
|
|
||||||
fclose(pMenuFile);
|
|
||||||
Syslog('+', "Kicking user out, upsdown semafore detected");
|
|
||||||
printf("System power failure, closing the bbs\n\n");
|
|
||||||
free(Semfile);
|
|
||||||
sleep(3);
|
|
||||||
Good_Bye(0);
|
|
||||||
}
|
|
||||||
free(Semfile);
|
|
||||||
|
|
||||||
/*
|
if (exitinfo.HotKeys) {
|
||||||
* Check if SysOp wants to chat to user everytime user
|
fflush(stdout);
|
||||||
* gets prompt. Make sure /tmp/chatdev exists before
|
Key = Getone();
|
||||||
* before calling chat(). Make sure if a second user
|
sprintf(Input, "%c", Key);
|
||||||
* logs in, that .BusyChatting does exist.
|
printf("\n");
|
||||||
*/
|
} else {
|
||||||
if(CFG.iChatPromptChk && (access("/tmp/chatdev", R_OK) == 0) && (access("/tmp/.BusyChatting", F_OK) != 0))
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
Chat();
|
GetstrC(Input, 80);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
if ((strcmp(Input, "")) != 0) {
|
||||||
* Check users timeleft
|
|
||||||
*/
|
|
||||||
TimeCheck();
|
|
||||||
|
|
||||||
alarm_on();
|
fseek(pMenuFile, 0, SEEK_SET);
|
||||||
|
|
||||||
if (exitinfo.HotKeys) {
|
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
||||||
fflush(stdout);
|
|
||||||
Key = Getone();
|
|
||||||
sprintf(Input, "%c", Key);
|
|
||||||
printf("\n");
|
|
||||||
} else {
|
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
|
||||||
GetstrC(Input, 80);
|
|
||||||
}
|
|
||||||
|
|
||||||
if((strcmp(Input, "")) != 0) {
|
|
||||||
|
|
||||||
fseek(pMenuFile, 0, SEEK_SET);
|
|
||||||
|
|
||||||
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
|
|
||||||
|
|
||||||
if ((strcmp(tu(Input), menus.MenuKey)) == 0) {
|
if ((strcmp(tu(Input), menus.MenuKey)) == 0) {
|
||||||
if ((Access(exitinfo.Security, menus.MenuSecurity)) && (UserAge >= menus.Age)) {
|
if ((Access(exitinfo.Security, menus.MenuSecurity)) && (UserAge >= menus.Age)) {
|
||||||
Syslog('b', "Menu[%d] %d=(%s), Opt: '%s'", MenuLevel, menus.MenuType, menus.TypeDesc, menus.OptionalData);
|
Syslog('b', "Menu[%d] %d=(%s), Opt: '%s'", MenuLevel, menus.MenuType,
|
||||||
if (menus.MenuType == 13) {
|
menus.TypeDesc, menus.OptionalData);
|
||||||
/*
|
if (menus.MenuType == 13) {
|
||||||
* Terminate call, cleanup here
|
/*
|
||||||
*/
|
* Terminate call, cleanup here
|
||||||
free(Input);
|
*/
|
||||||
free(sMenuPathFileName);
|
free(Input);
|
||||||
fclose(pMenuFile);
|
free(sMenuPathFileName);
|
||||||
}
|
fclose(pMenuFile);
|
||||||
DoMenu(menus.MenuType);
|
}
|
||||||
iFoundKey = TRUE;
|
DoMenu(menus.MenuType);
|
||||||
break;
|
iFoundKey = TRUE;
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fclose(pMenuFile);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(pMenuFile);
|
||||||
|
|
||||||
} /* If menu open */
|
} /* If menu open */
|
||||||
} /* while true */
|
} /* while true */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -370,7 +371,7 @@ void DoMenu(int Type)
|
|||||||
free(sPrompt);
|
free(sPrompt);
|
||||||
free(sPromptBak);
|
free(sPromptBak);
|
||||||
free(temp);
|
free(temp);
|
||||||
Good_Bye(0);
|
Good_Bye(MBERR_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 14:
|
case 14:
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
@ -79,7 +80,7 @@ int ChkFiles()
|
|||||||
if ((pUsersFile = fopen(temp,"rb")) == NULL) {
|
if ((pUsersFile = fopen(temp,"rb")) == NULL) {
|
||||||
if((pUsersFile = fopen(temp,"wb")) == NULL) {
|
if((pUsersFile = fopen(temp,"wb")) == NULL) {
|
||||||
WriteError("$Can't create %s", temp);
|
WriteError("$Can't create %s", temp);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
} else {
|
} else {
|
||||||
usrconfighdr.hdrsize = sizeof(usrconfighdr);
|
usrconfighdr.hdrsize = sizeof(usrconfighdr);
|
||||||
usrconfighdr.recsize = sizeof(usrconfig);
|
usrconfighdr.recsize = sizeof(usrconfig);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "newuser.h"
|
#include "newuser.h"
|
||||||
@ -85,7 +86,7 @@ int newuser()
|
|||||||
clear();
|
clear();
|
||||||
DisplayFile((char *)"newuser");
|
DisplayFile((char *)"newuser");
|
||||||
if ((iLang = Chg_Language(TRUE)) == 0)
|
if ((iLang = Chg_Language(TRUE)) == 0)
|
||||||
Fast_Bye(1);
|
Fast_Bye(MBERR_INIT_ERROR);
|
||||||
|
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* MBSE BBS - NEW USER REGISTRATION */
|
/* MBSE BBS - NEW USER REGISTRATION */
|
||||||
@ -119,7 +120,7 @@ int newuser()
|
|||||||
*/
|
*/
|
||||||
if ((strcasecmp(temp, "off")) == 0) {
|
if ((strcasecmp(temp, "off")) == 0) {
|
||||||
Syslog('+', "Quick \"off\" logout");
|
Syslog('+', "Quick \"off\" logout");
|
||||||
Fast_Bye(0);
|
Fast_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
Count++;
|
Count++;
|
||||||
@ -129,7 +130,7 @@ int newuser()
|
|||||||
language(CFG.HiliteF, CFG.HiliteB, 2);
|
language(CFG.HiliteF, CFG.HiliteB, 2);
|
||||||
Enter(2);
|
Enter(2);
|
||||||
Syslog('!', "Exceeded maximum login attempts");
|
Syslog('!', "Exceeded maximum login attempts");
|
||||||
Fast_Bye(0);
|
Fast_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -486,7 +487,7 @@ int newuser()
|
|||||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||||
if ((pUsrConfig = fopen(temp, "r+")) == NULL) {
|
if ((pUsrConfig = fopen(temp, "r+")) == NULL) {
|
||||||
WriteError("Can't open file: %s", temp);
|
WriteError("Can't open file: %s", temp);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
|
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
|
||||||
@ -582,7 +583,7 @@ void Fast_Bye(int onsig)
|
|||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
mwTerm();
|
mwTerm();
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -659,7 +660,7 @@ char *NameCreate(char *Name, char *Comment, char *Password)
|
|||||||
perror("");
|
perror("");
|
||||||
WriteError("Failed to create unix account");
|
WriteError("Failed to create unix account");
|
||||||
free(progname);
|
free(progname);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(progname, "%s/bin/mbpasswd -f %s %s", getenv("MBSE_ROOT"), Name, Password);
|
sprintf(progname, "%s/bin/mbpasswd -f %s %s", getenv("MBSE_ROOT"), Name, Password);
|
||||||
@ -671,7 +672,7 @@ char *NameCreate(char *Name, char *Comment, char *Password)
|
|||||||
perror("");
|
perror("");
|
||||||
WriteError("Failed to set unix password");
|
WriteError("Failed to set unix password");
|
||||||
free(progname);
|
free(progname);
|
||||||
ExitClient(1);
|
ExitClient(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
colour(YELLOW, BLACK);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "timecheck.h"
|
#include "timecheck.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
#include "bye.h"
|
#include "bye.h"
|
||||||
@ -116,7 +117,7 @@ void TimeCheck(void)
|
|||||||
sleep(3);
|
sleep(3);
|
||||||
Syslog('!', "Users time limit exceeded ... user disconnected!");
|
Syslog('!', "Users time limit exceeded ... user disconnected!");
|
||||||
iExpired = TRUE;
|
iExpired = TRUE;
|
||||||
Good_Bye(1);
|
Good_Bye(MBERR_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "dispfile.h"
|
#include "dispfile.h"
|
||||||
@ -195,7 +196,7 @@ void user()
|
|||||||
*/
|
*/
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
printf("Can't open userfile, run \"newuser\" first");
|
printf("Can't open userfile, run \"newuser\" first");
|
||||||
ExitClient(0);
|
ExitClient(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
|
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
|
||||||
@ -215,7 +216,7 @@ void user()
|
|||||||
printf("%s\n", (char *) Language(390));
|
printf("%s\n", (char *) Language(390));
|
||||||
Syslog('?', "FATAL: Could not find user in BBS users file.");
|
Syslog('?', "FATAL: Could not find user in BBS users file.");
|
||||||
Syslog('?', " and system is using unix accounts\n");
|
Syslog('?', " and system is using unix accounts\n");
|
||||||
ExitClient(0);
|
ExitClient(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -411,7 +412,7 @@ void user()
|
|||||||
* A copy of the userrecord is also in the variable exitinfo.
|
* A copy of the userrecord is also in the variable exitinfo.
|
||||||
*/
|
*/
|
||||||
if (! InitExitinfo())
|
if (! InitExitinfo())
|
||||||
Good_Bye(1);
|
Good_Bye(MBERR_INIT_ERROR);
|
||||||
|
|
||||||
GetLastUser();
|
GetLastUser();
|
||||||
StartTime = xstrcpy(GetLocalHM());
|
StartTime = xstrcpy(GetLocalHM());
|
||||||
|
@ -80,7 +80,7 @@ m_marea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/u
|
|||||||
m_new.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h grlist.h m_new.h m_lang.h m_marea.h m_ngroup.h
|
m_new.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h grlist.h m_new.h m_lang.h m_marea.h m_ngroup.h
|
||||||
m_protocol.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_protocol.h
|
m_protocol.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_protocol.h
|
||||||
m_ticarea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h grlist.h m_global.h m_node.h m_fgroup.h m_farea.h m_archive.h m_ticarea.h
|
m_ticarea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h grlist.h m_global.h m_node.h m_fgroup.h m_farea.h m_archive.h m_ticarea.h
|
||||||
mbsetup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_bbs.h m_farea.h m_fgroup.h m_mail.h m_mgroup.h m_hatch.h m_tic.h m_ticarea.h m_magic.h m_fido.h m_lang.h m_archive.h m_virus.h m_tty.h m_limits.h m_users.h m_node.h m_fdb.h m_new.h m_ol.h m_bbslist.h m_safe.h m_protocol.h m_ff.h m_modem.h m_marea.h m_ngroup.h m_service.h m_domain.h m_task.h m_route.h
|
mbsetup.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/mberrors.h screen.h mutil.h ledit.h m_global.h m_bbs.h m_farea.h m_fgroup.h m_mail.h m_mgroup.h m_hatch.h m_tic.h m_ticarea.h m_magic.h m_fido.h m_lang.h m_archive.h m_virus.h m_tty.h m_limits.h m_users.h m_node.h m_fdb.h m_new.h m_ol.h m_bbslist.h m_safe.h m_protocol.h m_ff.h m_modem.h m_marea.h m_ngroup.h m_service.h m_domain.h m_task.h m_route.h
|
||||||
ledit.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/msg.h screen.h mutil.h ledit.h
|
ledit.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/msg.h screen.h mutil.h ledit.h
|
||||||
m_farea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_fgroup.h m_archive.h m_farea.h m_fgroup.h m_ngroup.h
|
m_farea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_fgroup.h m_archive.h m_farea.h m_fgroup.h m_ngroup.h
|
||||||
m_fido.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_fido.h
|
m_fido.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_fido.h
|
||||||
@ -89,10 +89,10 @@ m_menu.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
|
|||||||
m_ngroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_ngroup.h
|
m_ngroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_ngroup.h
|
||||||
m_service.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_service.h
|
m_service.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_service.h
|
||||||
m_tty.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_modem.h m_global.h m_tty.h
|
m_tty.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_modem.h m_global.h m_tty.h
|
||||||
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h
|
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h
|
||||||
m_archive.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h
|
m_archive.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h
|
||||||
m_fdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h
|
m_fdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h
|
||||||
m_global.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_global.h
|
m_global.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/mberrors.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_global.h
|
||||||
m_magic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h
|
m_magic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h
|
||||||
m_mgroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h
|
m_mgroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h
|
||||||
m_node.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_node.h
|
m_node.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_node.h
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "mutil.h"
|
#include "mutil.h"
|
||||||
#include "ledit.h"
|
#include "ledit.h"
|
||||||
@ -69,7 +70,7 @@ void config_check(char *path)
|
|||||||
if (some_fd == -1) {
|
if (some_fd == -1) {
|
||||||
perror("");
|
perror("");
|
||||||
fprintf(stderr, "Fatal, %s/etc/config.data not found, is mbtask running?\n", path);
|
fprintf(stderr, "Fatal, %s/etc/config.data not found, is mbtask running?\n", path);
|
||||||
exit(1);
|
exit(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
close(some_fd);
|
close(some_fd);
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "../lib/records.h"
|
#include "../lib/records.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "mutil.h"
|
#include "mutil.h"
|
||||||
#include "ledit.h"
|
#include "ledit.h"
|
||||||
@ -130,7 +131,7 @@ static void die(int onsig)
|
|||||||
WriteError("MBSETUP finished on signal %s", SigName[onsig]);
|
WriteError("MBSETUP finished on signal %s", SigName[onsig]);
|
||||||
else
|
else
|
||||||
Syslog(' ', "MBSETUP finished");
|
Syslog(' ', "MBSETUP finished");
|
||||||
ExitClient(0);
|
ExitClient(onsig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -395,7 +396,7 @@ int main(int argc, char *argv[])
|
|||||||
pw = getpwuid(geteuid());
|
pw = getpwuid(geteuid());
|
||||||
if (strcmp(pw->pw_name, (char *)"mbse")) {
|
if (strcmp(pw->pw_name, (char *)"mbse")) {
|
||||||
printf("ERROR: only user \"mbse\" may use this program\n");
|
printf("ERROR: only user \"mbse\" may use this program\n");
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MEMWATCH
|
#ifdef MEMWATCH
|
||||||
@ -534,7 +535,7 @@ int main(int argc, char *argv[])
|
|||||||
} while (loop == 1);
|
} while (loop == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
die(0);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "mutil.h"
|
#include "mutil.h"
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ unsigned char readkey(int y, int x, int fg, int bg)
|
|||||||
|
|
||||||
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
||||||
perror("open 9");
|
perror("open 9");
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
Setraw();
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ unsigned char testkey(int y, int x)
|
|||||||
|
|
||||||
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
||||||
perror("open 9");
|
perror("open 9");
|
||||||
exit(1);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
Setraw();
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ nodelist.o: ../config.h libs.h ../lib/structs.h taskutil.h nodelist.h
|
|||||||
scanout.o: ../config.h libs.h ../lib/structs.h taskutil.h scanout.h
|
scanout.o: ../config.h libs.h ../lib/structs.h taskutil.h scanout.h
|
||||||
taskcomm.o: ../config.h libs.h ../lib/structs.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskcomm.h
|
taskcomm.o: ../config.h libs.h ../lib/structs.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskcomm.h
|
||||||
taskinfo.o: ../config.h libs.h ../lib/structs.h taskinfo.h
|
taskinfo.o: ../config.h libs.h ../lib/structs.h taskinfo.h
|
||||||
taskstat.o: ../config.h libs.h ../lib/structs.h taskstat.h callstat.h outstat.h taskutil.h
|
taskstat.o: ../config.h libs.h ../lib/structs.h ../lib/mberrors.h taskstat.h callstat.h outstat.h taskutil.h
|
||||||
mbtask.o: ../config.h libs.h ../lib/structs.h ../paths.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h callstat.h outstat.h nodelist.h ports.h calllist.h ping.h mbtask.h
|
mbtask.o: ../config.h libs.h ../lib/structs.h ../paths.h ../lib/mberrors.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h callstat.h outstat.h nodelist.h ports.h calllist.h ping.h mbtask.h
|
||||||
outstat.o: ../config.h libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h ports.h outstat.h
|
outstat.o: ../config.h libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h ports.h outstat.h
|
||||||
signame.o: ../config.h signame.h
|
signame.o: ../config.h signame.h
|
||||||
taskdisk.o: ../config.h libs.h ../lib/structs.h taskdisk.h taskutil.h
|
taskdisk.o: ../config.h libs.h ../lib/structs.h taskdisk.h taskutil.h
|
||||||
@ -91,6 +91,6 @@ taskregs.o: ../config.h libs.h ../lib/structs.h taskstat.h taskregs.h taskutil.h
|
|||||||
taskutil.o: ../config.h libs.h ../lib/structs.h signame.h scanout.h crc.h taskutil.h
|
taskutil.o: ../config.h libs.h ../lib/structs.h signame.h scanout.h crc.h taskutil.h
|
||||||
ports.o: ../config.h libs.h ../lib/structs.h taskutil.h nodelist.h ports.h
|
ports.o: ../config.h libs.h ../lib/structs.h taskutil.h nodelist.h ports.h
|
||||||
calllist.o: ../config.h libs.h ../lib/structs.h taskstat.h taskutil.h callstat.h outstat.h mbtask.h calllist.h
|
calllist.o: ../config.h libs.h ../lib/structs.h taskstat.h taskutil.h callstat.h outstat.h mbtask.h calllist.h
|
||||||
ping.o: ../config.h libs.h ../lib/structs.h taskstat.h taskutil.h ping.h
|
ping.o: ../config.h libs.h ../lib/structs.h ../lib/mberrors.h taskstat.h taskutil.h ping.h
|
||||||
crc.o: ../config.h libs.h crc.h
|
crc.o: ../config.h libs.h crc.h
|
||||||
# End of generated dependencies
|
# End of generated dependencies
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "libs.h"
|
#include "libs.h"
|
||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
#include "../paths.h"
|
#include "../paths.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "signame.h"
|
#include "signame.h"
|
||||||
#include "taskstat.h"
|
#include "taskstat.h"
|
||||||
#include "taskutil.h"
|
#include "taskutil.h"
|
||||||
@ -393,7 +394,7 @@ void load_maincfg(void)
|
|||||||
if ((fp = fopen(cfgfn, "a+")) == NULL) {
|
if ((fp = fopen(cfgfn, "a+")) == NULL) {
|
||||||
perror("");
|
perror("");
|
||||||
fprintf(stderr, "Can't create %s\n", cfgfn);
|
fprintf(stderr, "Can't create %s\n", cfgfn);
|
||||||
exit(2);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
fwrite(&CFG, sizeof(CFG), 1, fp);
|
fwrite(&CFG, sizeof(CFG), 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -434,7 +435,7 @@ void load_taskcfg(void)
|
|||||||
sprintf(TCFG.isp_ping2, "192.168.1.1");
|
sprintf(TCFG.isp_ping2, "192.168.1.1");
|
||||||
if ((fp = fopen(tcfgfn, "a+")) == NULL) {
|
if ((fp = fopen(tcfgfn, "a+")) == NULL) {
|
||||||
tasklog('?', "$Can't create %s", tcfgfn);
|
tasklog('?', "$Can't create %s", tcfgfn);
|
||||||
die(2);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
fwrite(&TCFG, sizeof(TCFG), 1, fp);
|
fwrite(&TCFG, sizeof(TCFG), 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -493,22 +494,22 @@ pid_t launch(char *cmd, char *opts, char *name, int tasktype)
|
|||||||
close(0);
|
close(0);
|
||||||
if (open("/dev/null", O_RDONLY) != 0) {
|
if (open("/dev/null", O_RDONLY) != 0) {
|
||||||
tasklog('?', "$Launch: \"%s\": reopen of stdin to /dev/null failed", buf);
|
tasklog('?', "$Launch: \"%s\": reopen of stdin to /dev/null failed", buf);
|
||||||
_exit(-1);
|
_exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
close(1);
|
close(1);
|
||||||
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
|
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
|
||||||
tasklog('?', "$Launch: \"%s\": reopen of stdout to /dev/null failed", buf);
|
tasklog('?', "$Launch: \"%s\": reopen of stdout to /dev/null failed", buf);
|
||||||
_exit(-1);
|
_exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
close(2);
|
close(2);
|
||||||
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
|
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
|
||||||
tasklog('?', "$Launch: \"%s\": reopen of stderr to /dev/null failed", buf);
|
tasklog('?', "$Launch: \"%s\": reopen of stderr to /dev/null failed", buf);
|
||||||
_exit(-1);
|
_exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
errno = 0;
|
errno = 0;
|
||||||
rc = execv(vector[0],vector);
|
rc = execv(vector[0],vector);
|
||||||
tasklog('?', "$Launch: execv \"%s\" failed, returned %d", cmd, rc);
|
tasklog('?', "$Launch: execv \"%s\" failed, returned %d", cmd, rc);
|
||||||
_exit(-1);
|
_exit(MBERR_EXEC_FAILED);
|
||||||
default:
|
default:
|
||||||
/* grandchild's daddy's process */
|
/* grandchild's daddy's process */
|
||||||
break;
|
break;
|
||||||
@ -819,7 +820,7 @@ void check_sema(void)
|
|||||||
* Since the upsdown semafore is permanent, the system WILL go down
|
* Since the upsdown semafore is permanent, the system WILL go down
|
||||||
* there is no point for this program to stay. Signal all tasks and stop.
|
* there is no point for this program to stay. Signal all tasks and stop.
|
||||||
*/
|
*/
|
||||||
die(SIGTERM);
|
die(MBERR_UPS_ALARM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -879,7 +880,7 @@ void scheduler(void)
|
|||||||
*/
|
*/
|
||||||
if ((sock = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) {
|
if ((sock = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) {
|
||||||
tasklog('?', "$Can't create socket");
|
tasklog('?', "$Can't create socket");
|
||||||
die(1);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&servaddr, 0, sizeof(servaddr));
|
memset(&servaddr, 0, sizeof(servaddr));
|
||||||
@ -890,7 +891,7 @@ void scheduler(void)
|
|||||||
close(sock);
|
close(sock);
|
||||||
sock = -1;
|
sock = -1;
|
||||||
tasklog('?', "$Can't bind socket %s", spath);
|
tasklog('?', "$Can't bind socket %s", spath);
|
||||||
die(1);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1273,19 +1274,19 @@ int main(int argc, char **argv)
|
|||||||
perror("");
|
perror("");
|
||||||
printf("can't setuid to mbse\n");
|
printf("can't setuid to mbse\n");
|
||||||
close(ping_isocket);
|
close(ping_isocket);
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
if (setgid(pw->pw_gid)) {
|
if (setgid(pw->pw_gid)) {
|
||||||
perror("");
|
perror("");
|
||||||
printf("can't setgid to bbs\n");
|
printf("can't setgid to bbs\n");
|
||||||
close(ping_isocket);
|
close(ping_isocket);
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
umask(007);
|
umask(007);
|
||||||
if (locktask(pw->pw_dir)) {
|
if (locktask(pw->pw_dir)) {
|
||||||
close(ping_isocket);
|
close(ping_isocket);
|
||||||
exit(1);
|
exit(MBERR_NO_PROGLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(cfgfn, "%s/etc/config.data", getenv("MBSE_ROOT"));
|
sprintf(cfgfn, "%s/etc/config.data", getenv("MBSE_ROOT"));
|
||||||
@ -1324,14 +1325,14 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if ((pgrp = setpgid(0, 0)) == -1) {
|
if ((pgrp = setpgid(0, 0)) == -1) {
|
||||||
tasklog('?', "$setpgid failed");
|
tasklog('?', "$setpgid failed");
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
frk = fork();
|
frk = fork();
|
||||||
switch (frk) {
|
switch (frk) {
|
||||||
case -1:
|
case -1:
|
||||||
tasklog('?', "$Unable to fork daemon");
|
tasklog('?', "$Unable to fork daemon");
|
||||||
die(0);
|
die(MBERR_INIT_ERROR);
|
||||||
case 0:
|
case 0:
|
||||||
/*
|
/*
|
||||||
* Starting the deamon child process here.
|
* Starting the deamon child process here.
|
||||||
@ -1352,7 +1353,7 @@ int main(int argc, char **argv)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
tasklog('+', "Starting daemon with pid %d", frk);
|
tasklog('+', "Starting daemon with pid %d", frk);
|
||||||
exit(0);
|
exit(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "libs.h"
|
#include "libs.h"
|
||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "taskstat.h"
|
#include "taskstat.h"
|
||||||
#include "taskutil.h"
|
#include "taskutil.h"
|
||||||
#include "ping.h"
|
#include "ping.h"
|
||||||
@ -432,7 +433,7 @@ void init_pingsocket(void)
|
|||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "socket init failed\n");
|
fprintf(stderr, "socket init failed\n");
|
||||||
}
|
}
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -440,7 +441,7 @@ void init_pingsocket(void)
|
|||||||
* It would be nice to issue an error message, but to where?
|
* It would be nice to issue an error message, but to where?
|
||||||
*/
|
*/
|
||||||
if (ping_isocket == STDIN_FILENO || ping_isocket == STDOUT_FILENO || ping_isocket == STDERR_FILENO) {
|
if (ping_isocket == STDIN_FILENO || ping_isocket == STDOUT_FILENO || ping_isocket == STDERR_FILENO) {
|
||||||
exit(255);
|
exit(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "libs.h"
|
#include "libs.h"
|
||||||
#include "../lib/structs.h"
|
#include "../lib/structs.h"
|
||||||
|
#include "../lib/mberrors.h"
|
||||||
#include "taskstat.h"
|
#include "taskstat.h"
|
||||||
#include "callstat.h"
|
#include "callstat.h"
|
||||||
#include "outstat.h"
|
#include "outstat.h"
|
||||||
@ -119,7 +120,7 @@ void status_init()
|
|||||||
cnt = read(stat_fd, &status, sizeof(status_r));
|
cnt = read(stat_fd, &status, sizeof(status_r));
|
||||||
if (cnt != sizeof(status_r)) {
|
if (cnt != sizeof(status_r)) {
|
||||||
printf("Error reading status file\n");
|
printf("Error reading status file\n");
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
status.startups++;
|
status.startups++;
|
||||||
status.laststart = time(NULL);
|
status.laststart = time(NULL);
|
||||||
@ -129,7 +130,7 @@ void status_init()
|
|||||||
cnt = write(stat_fd, &status, sizeof(status_r));
|
cnt = write(stat_fd, &status, sizeof(status_r));
|
||||||
if (cnt != sizeof(status_r)) {
|
if (cnt != sizeof(status_r)) {
|
||||||
tasklog('?', "$Error rewrite status file\n");
|
tasklog('?', "$Error rewrite status file\n");
|
||||||
exit(1);
|
exit(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
close(stat_fd);
|
close(stat_fd);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user