Bumped version number, added support for nodes outbound boxes

This commit is contained in:
Michiel Broek 2002-06-24 20:34:07 +00:00
parent cf432130e8
commit d864d6a2a9
28 changed files with 1503 additions and 921 deletions

View File

@ -2,7 +2,43 @@ $Id$
MBSEBBS History. MBSEBBS History.
v0.35.01 05-Jun-2002 v0.35.02 22-Jun-2002
general:
Added checks for GoldED in external program checks.
Added new empty path /opt/mbse/var/boxes.
Implemented nodes private outbound boxes.
common.a:
Added debug nodelist IFT flag for logging.
mbsetup:
Changed node records layout into 8 screens to be able to add
more settings. New settings not in use yet are disabled.
Added settings for node contact information. This is private
for mbsetup use only.
Implemented nodes special outbound box setup. When you enter
that item for the first time, it fills this with a suggested
path.
mbcico:
Implemented nodes special outbound boxes.
mbout:
Implemented nodes special outbound boxes.
mbfido:
In newsmode when a mesage is received with an illegal formated
date headerline, the date is replaced with the current date
and time. Possible cause: SunMail 1.0
mbtask:
When first run the goldnode command is only filled in if it
excists in the mbtask configuration.
Implemented nodes special outbound boxes.
v0.35.01 05-Jun-2002 - 22-Jun-2002
upgrade: upgrade:
Start mbsetup, check in the nodes setup if all the session Start mbsetup, check in the nodes setup if all the session

View File

@ -144,6 +144,11 @@ install:
${CHOWN} -R ${OWNER}.${GROUP} ${PREFIX}/var ; \ ${CHOWN} -R ${OWNER}.${GROUP} ${PREFIX}/var ; \
chmod -R 0750 ${PREFIX}/var ; \ chmod -R 0750 ${PREFIX}/var ; \
fi fi
@if [ ! -d ${PREFIX}/var/boxes ]; then \
mkdir ${PREFIX}/var/boxes ; \
${CHOWN} ${OWNER}.${GROUP} ${PREFIX}/var/boxes ; \
chmod 0750 ${PREFIX}/var/boxes ; \
fi
@if [ ! -d ${PREFIX}/var/unknown ] ; then \ @if [ ! -d ${PREFIX}/var/unknown ] ; then \
mkdir ${PREFIX}/var/unknown ; \ mkdir ${PREFIX}/var/unknown ; \
mkdir ${PREFIX}/var/inbound ; \ mkdir ${PREFIX}/var/inbound ; \

2
TODO
View File

@ -1,6 +1,6 @@
$Id$ $Id$
MBSE BBS V0.35.01 TODO list. MBSE BBS V0.35.02 TODO list.
---------------------------- ----------------------------
These are a list of things that must be implemented one way or These are a list of things that must be implemented one way or

83
configure vendored
View File

@ -1196,7 +1196,7 @@ SUBDIRS="lib mbcico mbfido mbmon mbsebbs mbtask mbsetup unix lang examples html
PACKAGE="mbsebbs" PACKAGE="mbsebbs"
VERSION="0.35.01" VERSION="0.35.02"
COPYRIGHT="Copyright (C) 1997-2002 Michiel Broek, All Rights Reserved" COPYRIGHT="Copyright (C) 1997-2002 Michiel Broek, All Rights Reserved"
SHORTRIGHT="Copyright (C) 1997-2002 M. Broek" SHORTRIGHT="Copyright (C) 1997-2002 M. Broek"
GROUP="bbs" GROUP="bbs"
@ -7689,6 +7689,85 @@ else
echo "${ECHO_T}no" >&6 echo "${ECHO_T}no" >&6
fi fi
# Extract the first word of "golded", so it can be a program name with args.
set dummy golded; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_GOLDEDBIN+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $GOLDEDBIN in
[\\/]* | ?:[\\/]*)
ac_cv_path_GOLDEDBIN="$GOLDEDBIN" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_GOLDEDBIN="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
;;
esac
fi
GOLDEDBIN=$ac_cv_path_GOLDEDBIN
if test -n "$GOLDEDBIN"; then
echo "$as_me:$LINENO: result: $GOLDEDBIN" >&5
echo "${ECHO_T}$GOLDEDBIN" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
# Extract the first word of "goldnode", so it can be a program name with args.
set dummy goldnode; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_GOLDNODE+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $GOLDNODE in
[\\/]* | ?:[\\/]*)
ac_cv_path_GOLDNODE="$GOLDNODE" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_GOLDNODE="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
;;
esac
fi
GOLDNODE=$ac_cv_path_GOLDNODE
if test -n "$GOLDNODE"; then
echo "$as_me:$LINENO: result: $GOLDNODE" >&5
echo "${ECHO_T}$GOLDNODE" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
# Check whether --with-log-compress or --without-log-compress was given. # Check whether --with-log-compress or --without-log-compress was given.
if test "${with_log_compress+set}" = set; then if test "${with_log_compress+set}" = set; then
@ -8375,6 +8454,8 @@ s,@RB@,$RB,;t t
s,@SB@,$SB,;t t s,@SB@,$SB,;t t
s,@RZ@,$RZ,;t t s,@RZ@,$RZ,;t t
s,@SZ@,$SZ,;t t s,@SZ@,$SZ,;t t
s,@GOLDEDBIN@,$GOLDEDBIN,;t t
s,@GOLDNODE@,$GOLDNODE,;t t
s,@LOG_COMPRESS@,$LOG_COMPRESS,;t t s,@LOG_COMPRESS@,$LOG_COMPRESS,;t t
s,@LOG_COMPRESSEXT@,$LOG_COMPRESSEXT,;t t s,@LOG_COMPRESSEXT@,$LOG_COMPRESSEXT,;t t
CEOF CEOF

View File

@ -9,7 +9,7 @@ AC_SUBST(SUBDIRS)
dnl General settings for MBSE BBS dnl General settings for MBSE BBS
dnl After changeing the version number, run autoconf! dnl After changeing the version number, run autoconf!
PACKAGE="mbsebbs" PACKAGE="mbsebbs"
VERSION="0.35.01" VERSION="0.35.02"
COPYRIGHT="Copyright (C) 1997-2002 Michiel Broek, All Rights Reserved" COPYRIGHT="Copyright (C) 1997-2002 Michiel Broek, All Rights Reserved"
SHORTRIGHT="Copyright (C) 1997-2002 M. Broek" SHORTRIGHT="Copyright (C) 1997-2002 M. Broek"
GROUP="bbs" GROUP="bbs"
@ -175,6 +175,9 @@ AC_PATH_PROG(RB,rb)
AC_PATH_PROG(SB,sb) AC_PATH_PROG(SB,sb)
AC_PATH_PROG(RZ,rz) AC_PATH_PROG(RZ,rz)
AC_PATH_PROG(SZ,sz) AC_PATH_PROG(SZ,sz)
AC_PATH_PROG(GOLDEDBIN,golded)
AC_PATH_PROG(GOLDNODE,goldnode)
dnl dnl
AC_ARG_WITH(log-compress,[ --with-log-compress=METHOD Log compression method (default gzip)], LOG_COMPRESS=$with_log_compress, LOG_COMPRESS=gzip) AC_ARG_WITH(log-compress,[ --with-log-compress=METHOD Log compression method (default gzip)], LOG_COMPRESS=$with_log_compress, LOG_COMPRESS=gzip)
case "$LOG_COMPRESS" in case "$LOG_COMPRESS" in

View File

@ -608,6 +608,8 @@ void ipflags(unsigned long flags)
t = xstrcat(t, (char *)" IVM"); t = xstrcat(t, (char *)" IVM");
if (flags & IP_IP) if (flags & IP_IP)
t = xstrcat(t, (char *)" IP"); t = xstrcat(t, (char *)" IP");
if (flags & IP_IFT)
t = xstrcat(t, (char *)" IFT");
Syslog('s', "%s", t); Syslog('s', "%s", t);
free(t); free(t);
} }

View File

@ -1240,7 +1240,7 @@ struct _nodes {
unsigned Dir_in_waitclr : 1; /* Inbound wait for clear */ unsigned Dir_in_waitclr : 1; /* Inbound wait for clear */
unsigned Dir_in_mklck : 1; /* Inbound create lock */ unsigned Dir_in_mklck : 1; /* Inbound create lock */
/* FTP transfer */ /* FTP transfers */
char FTP_site[65]; /* Site name or IP address */ char FTP_site[65]; /* Site name or IP address */
char FTP_user[17]; /* Username */ char FTP_user[17]; /* Username */
char FTP_pass[17]; /* Password */ char FTP_pass[17]; /* Password */
@ -1256,12 +1256,24 @@ struct _nodes {
unsigned FTP_unique : 1; /* Unique storage */ unsigned FTP_unique : 1; /* Unique storage */
unsigned FTP_uppercase : 1; /* Force uppercase */ unsigned FTP_uppercase : 1; /* Force uppercase */
unsigned FTP_lowercase : 1; /* Force lowercase */ unsigned FTP_lowercase : 1; /* Force lowercase */
unsigned FTP_passive : 1; /* Passive mode */
unsigned FTP_out_chklck : 1; /* Outbound check lockfile */ unsigned FTP_out_chklck : 1; /* Outbound check lockfile */
unsigned FTP_out_waitclr : 1; /* Outbound wait for clear */ unsigned FTP_out_waitclr : 1; /* Outbound wait for clear */
unsigned FTP_out_mklck : 1; /* Outbound create lock */ unsigned FTP_out_mklck : 1; /* Outbound create lock */
unsigned FTP_in_chklck : 1; /* Inbound check lockfile */ unsigned FTP_in_chklck : 1; /* Inbound check lockfile */
unsigned FTP_in_waitclr : 1; /* Inbound wait for clear */ unsigned FTP_in_waitclr : 1; /* Inbound wait for clear */
unsigned FTP_in_mklck : 1; /* Inbound create lock */ unsigned FTP_in_mklck : 1; /* Inbound create lock */
char OutBox[65]; /* Node's personal outbound */
char Nl_flags[65]; /* Override nodelist flags */
char Nl_hostname[41]; /* Override hostname */
/* Contact information */
char Ct_phone[17]; /* Node's private phone */
char Ct_fax[17]; /* Node's fax */
char Ct_cellphone[21]; /* Node's cellphone */
char Ct_email[31]; /* Node's email */
char Ct_remark[65]; /* Remark */
}; };

View File

@ -43,46 +43,47 @@
#define PATH_MAX 512 #define PATH_MAX 512
#endif #endif
extern int master; extern int master;
int made_request; extern int Loaded;
int made_request;
static char *tmpkname(void); static char *tmpkname(void);
static char *tmpkname(void) static char *tmpkname(void)
{ {
static char buf[16]; static char buf[16];
sprintf(buf,"%08lx.pkt", sequencer()); sprintf(buf,"%08lx.pkt", sequencer());
return buf; return buf;
} }
char *xtodos(char *orig) char *xtodos(char *orig)
{ {
char buf[13], *copy, *p; char buf[13], *copy, *p;
if (orig == NULL) if (orig == NULL)
return NULL; return NULL;
if ((remote_flags & SESSION_FNC) == 0) { if ((remote_flags & SESSION_FNC) == 0) {
Syslog('o', "No filename conversion for \"%s\"", MBSE_SS(orig)); Syslog('o', "No filename conversion for \"%s\"", MBSE_SS(orig));
return xstrcpy(orig); return xstrcpy(orig);
} }
copy = xstrcpy(orig); copy = xstrcpy(orig);
if ((p = strrchr(copy,'/'))) if ((p = strrchr(copy,'/')))
p++; p++;
else else
p = copy; p = copy;
name_mangle(p); name_mangle(p);
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
strncpy(buf, p, 12); strncpy(buf, p, 12);
Syslog('o', "name \"%s\" converted to \"%s\"", MBSE_SS(orig), MBSE_SS(buf)); Syslog('o', "name \"%s\" converted to \"%s\"", MBSE_SS(orig), MBSE_SS(buf));
free(copy); free(copy);
return xstrcpy(buf); return xstrcpy(buf);
} }
@ -100,29 +101,28 @@ char *xtodos(char *orig)
*/ */
void add_list(file_list **lst, char *local, char *Remote, int disposition, off_t floff, FILE *flofp, int toend) void add_list(file_list **lst, char *local, char *Remote, int disposition, off_t floff, FILE *flofp, int toend)
{ {
file_list **tmpl; file_list **tmpl, *tmp;
file_list *tmp;
Syslog('o', "add_list(\"%s\",\"%s\",%d,%s)", MBSE_SS(local),MBSE_SS(Remote),disposition,toend?"to end":"to beg"); Syslog('o', "add_list(\"%s\",\"%s\",%d,%s)", MBSE_SS(local),MBSE_SS(Remote),disposition,toend?"to end":"to beg");
if (toend) if (toend)
for (tmpl = lst; *tmpl; tmpl =&((*tmpl)->next)); for (tmpl = lst; *tmpl; tmpl =&((*tmpl)->next));
else else
tmpl = &tmp; tmpl = &tmp;
*tmpl = (file_list*)malloc(sizeof(file_list)); *tmpl = (file_list*)malloc(sizeof(file_list));
if (toend) { if (toend) {
(*tmpl)->next = NULL; (*tmpl)->next = NULL;
} else { } else {
(*tmpl)->next = *lst; (*tmpl)->next = *lst;
*lst = *tmpl; *lst = *tmpl;
} }
(*tmpl)->remote = xtodos(Remote); (*tmpl)->remote = xtodos(Remote);
(*tmpl)->local = xstrcpy(local); (*tmpl)->local = xstrcpy(local);
(*tmpl)->disposition = disposition; (*tmpl)->disposition = disposition;
(*tmpl)->floff = floff; (*tmpl)->floff = floff;
(*tmpl)->flofp = flofp; (*tmpl)->flofp = flofp;
return; return;
} }
@ -130,187 +130,248 @@ void add_list(file_list **lst, char *local, char *Remote, int disposition, off_t
static void check_flo(file_list **, char *); static void check_flo(file_list **, char *);
static void check_flo(file_list **lst, char *nm) static void check_flo(file_list **lst, char *nm)
{ {
FILE *fp; FILE *fp;
off_t off; off_t off;
struct flock fl; struct flock fl;
char buf[PATH_MAX],buf2[PATH_MAX],*p,*q; char buf[PATH_MAX], buf2[PATH_MAX], *p, *q;
int disposition; int disposition;
struct stat stbuf; struct stat stbuf;
Syslog('O', "check_flo(\"%s\")",MBSE_SS(nm));
if ((fp = fopen(nm,"r+")) == NULL) {
Syslog('O',"no flo file");
return;
}
fl.l_type = F_RDLCK;
fl.l_whence = 0;
fl.l_start = 0L;
fl.l_len = 0L;
if (fcntl(fileno(fp), F_SETLK, &fl) != 0) {
if (errno != EAGAIN)
WriteError("$cannot read-lock \"%s\"",MBSE_SS(nm));
else
Syslog('O',"flo file busy");
fclose(fp);
return;
}
if (stat(nm, &stbuf) != 0) {
WriteError("$cannot access \"%s\"",MBSE_SS(nm));
fclose(fp);
return;
}
while (!feof(fp) && !ferror(fp)) {
off = ftell(fp);
if (fgets(buf, sizeof(buf)-1, fp) == NULL)
continue;
if (buf[0] == '~')
continue; /* skip sent files */
if (*(p=buf + strlen(buf) -1) == '\n')
*p-- = '\0';
if (*p == '\r')
*p = '\0';
switch (buf[0]) {
case '#': p=buf+1; disposition=TFS; break;
case '-':
case '^': p=buf+1; disposition=KFS; break;
case '@': p=buf+1; disposition=LEAVE; break;
case 0: continue;
default: p=buf; disposition=LEAVE; break;
}
memset(&buf2, 0, sizeof(buf2));
if (strlen(CFG.dospath)) {
if (strncasecmp(p, CFG.dospath, strlen(CFG.dospath)) == 0) {
strcpy(buf2,uxoutbound);
for (p+=strlen(CFG.dospath), q=buf2+strlen(buf2); *p; p++, q++)
*q = ((*p) == '\\')?'/':tolower(*p);
*q = '\0';
p = buf2;
}
// FIXME: removed because it is useless, but it may break some systems.
// } else {
// if (strncasecmp(p, CFG.uxpath, strlen(CFG.uxpath)) == 0) {
// for (p=p, q=buf2+strlen(buf2); *p; p++, q++)
// *q = ((*p) == '\\')?'/':tolower(*p);
// *q = '\0';
// p = buf2;
// }
}
if ((q=strrchr(p,'/')))
q++;
else
q = p;
add_list(lst, p, q, disposition, off, fp, 1);
}
if ((fp = fopen(nm,"r+")) == NULL) {
/* /*
* Add flo file to file list * If no flo file, return.
*/ */
add_list(lst, nm, NULL, KFS, -1L, fp, 1);
/* here, we leave .flo file open, it will be closed by */
/* execute_disposition */
return; return;
}
Syslog('o', "check_flo(\"%s\")",MBSE_SS(nm));
fl.l_type = F_RDLCK;
fl.l_whence = 0;
fl.l_start = 0L;
fl.l_len = 0L;
if (fcntl(fileno(fp), F_SETLK, &fl) != 0) {
if (errno != EAGAIN)
WriteError("$Can't read-lock \"%s\"", MBSE_SS(nm));
else
Syslog('o',"flo file busy");
fclose(fp);
return;
}
if (stat(nm, &stbuf) != 0) {
WriteError("$Can't access \"%s\"", MBSE_SS(nm));
fclose(fp);
return;
}
while (!feof(fp) && !ferror(fp)) {
off = ftell(fp);
if (fgets(buf, sizeof(buf)-1, fp) == NULL)
continue;
if (buf[0] == '~')
continue; /* skip sent files */
if (*(p=buf + strlen(buf) -1) == '\n')
*p-- = '\0';
if (*p == '\r')
*p = '\0';
switch (buf[0]) {
case '#': p=buf+1; disposition=TFS; break;
case '-':
case '^': p=buf+1; disposition=KFS; break;
case '@': p=buf+1; disposition=LEAVE; break;
case 0: continue;
default: p=buf; disposition=LEAVE; break;
}
memset(&buf2, 0, sizeof(buf2));
if (strlen(CFG.dospath)) {
if (strncasecmp(p, CFG.dospath, strlen(CFG.dospath)) == 0) {
strcpy(buf2,uxoutbound);
for (p+=strlen(CFG.dospath), q=buf2+strlen(buf2); *p; p++, q++)
*q = ((*p) == '\\')?'/':tolower(*p);
*q = '\0';
p = buf2;
}
}
if ((q=strrchr(p,'/')))
q++;
else
q = p;
add_list(lst, p, q, disposition, off, fp, 1);
}
/*
* Add flo file to file list
*/
add_list(lst, nm, NULL, KFS, -1L, fp, 1);
/* here, we leave .flo file open, it will be closed by */
/* execute_disposition */
return;
} }
file_list *create_filelist(fa_list *al, char *fl, int create) file_list *create_filelist(fa_list *al, char *fl, int create)
{ {
file_list *st=NULL; file_list *st = NULL, *tmpf;
file_list *tmpf; fa_list *tmpa;
fa_list *tmpa; char flavor, *tmpfl, *nm, *temp, tmpreq[13];
char flavor, *tmpfl; struct stat stbuf;
char *nm; int packets = 0;
char tmpreq[13]; FILE *fp;
struct stat stbuf; DIR *dp;
int packets = 0; struct dirent *de;
FILE *fp; unsigned char buffer[2];
unsigned char buffer[2]; struct passwd *pw;
Syslog('o', "Create_filelist(%s,\"%s\",%d)", al?ascfnode(al->addr,0x1f):"<none>", MBSE_SS(fl), create); Syslog('o', "Create_filelist(%s,\"%s\",%d)", al?ascfnode(al->addr,0x1f):"<none>", MBSE_SS(fl), create);
made_request = 0; made_request = 0;
for (tmpa = al; tmpa; tmpa = tmpa->next) { for (tmpa = al; tmpa; tmpa = tmpa->next) {
Syslog('o', "Check address %s", ascfnode(tmpa->addr, 0x1f)); Syslog('o', "Check address %s", ascfnode(tmpa->addr, 0x1f));
/* /*
* Check spool files, these are more or less useless but they * For the main aka, check the outbox.
* create a filelist of files to send which are never send. */
* It gives the transfer protocols something "to do". if ((tmpa->addr) && Loaded && strlen(nodes.OutBox) &&
*/ (tmpa->addr->zone == nodes.Aka[0].zone) && (tmpa->addr->net == nodes.Aka[0].net) &&
if (strchr(fl, 'o')) { (tmpa->addr->node == nodes.Aka[0].node) && (tmpa->addr->point == nodes.Aka[0].point)) {
nm = splname(tmpa->addr); Syslog('o', "checking outbox %s", nodes.OutBox);
if ((fp = fopen(nm, "w"))) if (nodes.Crash)
fclose(fp); flavor = 'c';
if ((nm != NULL) && (stat(nm, &stbuf) == 0)) else if (nodes.Hold)
add_list(&st, nm, NULL, DSF, 0L, NULL, 1); flavor = 'h';
} else
flavor = 'o';
/* if ((dp = opendir(nodes.OutBox)) == NULL) {
* Check .pol files Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(nodes.OutBox));
*/ } else {
nm = polname(tmpa->addr); temp = calloc(PATH_MAX, sizeof(char));
if ((nm != NULL) && (stat(nm,&stbuf) == 0)) pw = getpwnam((char *)"mbse");
add_list(&st,nm,NULL,DSF,0L,NULL,1); while ((de = readdir(dp))) {
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
/* sprintf(temp, "%s/%s", nodes.OutBox, de->d_name);
* Check other files, all flavors if (stat(temp, &stbuf) == 0) {
*/ Syslog('o' ,"checking file \"%s\"", de->d_name);
tmpfl = fl; if (S_ISREG(stbuf.st_mode)) {
while ((flavor = *tmpfl++)) { if (pw->pw_uid == stbuf.st_uid) {
/* /*
* Check normal mail packets * We own the file
*/ */
nm = pktname(tmpa->addr,flavor); if ((stbuf.st_mode & S_IRUSR) && (stbuf.st_mode & S_IWUSR)) {
if ((nm != NULL) && (stat(nm,&stbuf) == 0)) { add_list(&st, temp, de->d_name, KFS, 0L, NULL, 1);
packets++; } else {
add_list(&st, nm, tmpkname(), KFS, 0L, NULL, 1); Syslog('+', "No R/W permission on %s", temp);
} }
} else if (pw->pw_gid == stbuf.st_gid) {
/* /*
* Check .flo files for file attaches * We own the file group
*/ */
nm = floname(tmpa->addr,flavor); if ((stbuf.st_mode & S_IRGRP) && (stbuf.st_mode & S_IWGRP)) {
check_flo(&st, nm); add_list(&st, temp, de->d_name, KFS, 0L, NULL, 1);
} } else {
Syslog('+', "No R/W permission on %s", temp);
if ((session_flags & SESSION_WAZOO) && }
((session_flags & SESSION_HYDRA) == 0) && (master || ((session_flags & SESSION_IFNA) == 0))) { } else {
/* /*
* we don't distinguish flavoured reqs * No owner of file
*/ */
nm = reqname(tmpa->addr); if ((stbuf.st_mode & S_IROTH) && (stbuf.st_mode & S_IWOTH)) {
if ((nm != NULL) && (stat(nm, &stbuf) == 0)) { add_list(&st, temp, de->d_name, KFS, 0L, NULL, 1);
sprintf(tmpreq, "%04X%04X.REQ", tmpa->addr->net, tmpa->addr->node); } else {
add_list(&st, nm, tmpreq, DSF, 0L, NULL, 1); Syslog('+', "No R/W permission on %s", temp);
made_request = 1; }
}
} else {
Syslog('+', "Not a regular file %s", temp);
}
} else {
WriteError("Can't stat %s", temp);
} }
}
} }
closedir(dp);
free(temp);
}
} }
if (((st == NULL) && (create > 1)) || ((st != NULL) && (packets == 0) && (create > 0))) { /*
Syslog('o', "Create packet for %s", ascfnode(al->addr,0x1f)); * Check spool files, these are more or less useless but they
if ((fp = openpkt(NULL, al->addr, 'o'))) { * create a filelist of files to send which are never send.
memset(&buffer, 0, sizeof(buffer)); * It gives the transfer protocols something "to do".
fwrite(buffer, 1, 2, fp); */
fclose(fp); if (strchr(fl, 'o')) {
} nm = splname(tmpa->addr);
add_list(&st, pktname(al->addr,'o'), tmpkname(), KFS, 0L, NULL, 0); if ((fp = fopen(nm, "w")))
fclose(fp);
if ((nm != NULL) && (stat(nm, &stbuf) == 0))
add_list(&st, nm, NULL, DSF, 0L, NULL, 1);
} }
for (tmpf = st; tmpf; tmpf = tmpf->next) /*
Syslog('O',"flist: \"%s\" -> \"%s\" dsp:%d flofp:%lu floff:%lu", * Check .pol files
MBSE_SS(tmpf->local), MBSE_SS(tmpf->remote), tmpf->disposition, */
(unsigned long)tmpf->flofp, (unsigned long)tmpf->floff); nm = polname(tmpa->addr);
if ((nm != NULL) && (stat(nm,&stbuf) == 0))
add_list(&st,nm,NULL,DSF,0L,NULL,1);
return st; /*
* Check other files, all flavors
*/
tmpfl = fl;
while ((flavor = *tmpfl++)) {
/*
* Check normal mail packets
*/
nm = pktname(tmpa->addr,flavor);
if ((nm != NULL) && (stat(nm,&stbuf) == 0)) {
packets++;
add_list(&st, nm, tmpkname(), KFS, 0L, NULL, 1);
}
/*
* Check .flo files for file attaches
*/
nm = floname(tmpa->addr,flavor);
check_flo(&st, nm);
}
if ((session_flags & SESSION_WAZOO) &&
((session_flags & SESSION_HYDRA) == 0) && (master || ((session_flags & SESSION_IFNA) == 0))) {
/*
* we don't distinguish flavoured reqs
*/
nm = reqname(tmpa->addr);
if ((nm != NULL) && (stat(nm, &stbuf) == 0)) {
sprintf(tmpreq, "%04X%04X.REQ", tmpa->addr->net, tmpa->addr->node);
add_list(&st, nm, tmpreq, DSF, 0L, NULL, 1);
made_request = 1;
}
}
}
if (((st == NULL) && (create > 1)) || ((st != NULL) && (packets == 0) && (create > 0))) {
Syslog('o', "Create packet for %s", ascfnode(al->addr,0x1f));
if ((fp = openpkt(NULL, al->addr, 'o'))) {
memset(&buffer, 0, sizeof(buffer));
fwrite(buffer, 1, 2, fp);
fclose(fp);
}
add_list(&st, pktname(al->addr,'o'), tmpkname(), KFS, 0L, NULL, 0);
}
for (tmpf = st; tmpf; tmpf = tmpf->next)
Syslog('o',"flist: \"%s\" -> \"%s\" dsp:%d flofp:%lu floff:%lu",
MBSE_SS(tmpf->local), MBSE_SS(tmpf->remote), tmpf->disposition,
(unsigned long)tmpf->flofp, (unsigned long)tmpf->floff);
return st;
} }
@ -320,157 +381,154 @@ file_list *create_filelist(fa_list *al, char *fl, int create)
*/ */
file_list *create_freqlist(fa_list *al) file_list *create_freqlist(fa_list *al)
{ {
file_list *st = NULL, *tmpf; file_list *st = NULL, *tmpf;
fa_list *tmpa; fa_list *tmpa;
char *nm; char *nm, tmpreq[13];
char tmpreq[13]; struct stat stbuf;
struct stat stbuf;
Syslog('o', "create_freqlist(%s)", al?ascfnode(al->addr, 0x1f):"<none>"); Syslog('o', "create_freqlist(%s)", al?ascfnode(al->addr, 0x1f):"<none>");
made_request = 0; made_request = 0;
for (tmpa = al; tmpa; tmpa = tmpa->next) { for (tmpa = al; tmpa; tmpa = tmpa->next) {
nm = reqname(tmpa->addr); nm = reqname(tmpa->addr);
if ((nm != NULL) && (stat(nm, &stbuf) == 0)) { if ((nm != NULL) && (stat(nm, &stbuf) == 0)) {
sprintf(tmpreq, "%04X%04X.REQ", tmpa->addr->net, tmpa->addr->node); sprintf(tmpreq, "%04X%04X.REQ", tmpa->addr->net, tmpa->addr->node);
add_list(&st, nm, tmpreq, DSF, 0L, NULL, 1); add_list(&st, nm, tmpreq, DSF, 0L, NULL, 1);
made_request = 1; made_request = 1;
}
} }
}
if (made_request) {
for (tmpf = st; tmpf; tmpf = tmpf->next) for (tmpf = st; tmpf; tmpf = tmpf->next)
Syslog('O', "flist: \"%s\" -> \"%s\" dsp:%d flofp:%lu floff:%lu", Syslog('o', "flist: \"%s\" -> \"%s\" dsp:%d flofp:%lu floff:%lu",
MBSE_SS(tmpf->local), MBSE_SS(tmpf->remote), tmpf->disposition, MBSE_SS(tmpf->local), MBSE_SS(tmpf->remote), tmpf->disposition, tmpf->flofp, tmpf->floff);
tmpf->flofp, tmpf->floff); }
return st; return st;
} }
void tidy_filelist(file_list *fl, int dsf) void tidy_filelist(file_list *fl, int dsf)
{ {
file_list *tmp; file_list *tmp;
if (fl == NULL) if (fl == NULL)
return;
for (tmp=fl;fl;fl=tmp) {
tmp=fl->next;
if (dsf && (fl->disposition == DSF)) {
Syslog('o',"Removing sent file \"%s\"",MBSE_SS(fl->local));
if (unlink(fl->local) != 0) {
if (errno == ENOENT)
Syslog('o',"Cannot unlink nonexistent file \"%s\"", MBSE_SS(fl->local));
else
WriteError("$Cannot unlink file \"%s\"", MBSE_SS(fl->local));
}
}
if (fl->local)
free(fl->local);
if (fl->remote)
free(fl->remote);
else if (fl->flofp)
fclose(fl->flofp);
free(fl);
}
return; return;
for (tmp=fl;fl;fl=tmp) {
tmp=fl->next;
if (dsf && (fl->disposition == DSF)) {
Syslog('o',"Removing sent file \"%s\"",MBSE_SS(fl->local));
if (unlink(fl->local) != 0) {
if (errno == ENOENT)
Syslog('o',"Cannot unlink nonexistent file \"%s\"", MBSE_SS(fl->local));
else
WriteError("$Cannot unlink file \"%s\"", MBSE_SS(fl->local));
}
}
if (fl->local)
free(fl->local);
if (fl->remote)
free(fl->remote);
else if (fl->flofp)
fclose(fl->flofp);
free(fl);
}
return;
} }
void execute_disposition(file_list *fl) void execute_disposition(file_list *fl)
{ {
FILE *fp=NULL; FILE *fp=NULL;
char *nm; char *nm, tpl='~';
char tpl='~';
Syslog('o', "execute_disposition(%s)", fl->local); Syslog('o', "execute_disposition(%s)", fl->local);
nm = fl->local; nm = fl->local;
if (fl->flofp) { if (fl->flofp) {
/* /*
* Check for special case: flo-file * Check for special case: flo-file
*/ */
if (fl->floff == -1) { if (fl->floff == -1) {
/* /*
* We check if there are any files left for transmission * We check if there are any files left for transmission
* in the flo-file to decide whether to remove or leave * in the flo-file to decide whether to remove or leave
* it on disk. * it on disk.
*/ */
char buf[PATH_MAX]; char buf[PATH_MAX];
int files_remain = 0; int files_remain = 0;
if (fseek(fl->flofp, 0L, 0) == 0) { if (fseek(fl->flofp, 0L, 0) == 0) {
while (!feof(fl->flofp) && !ferror(fl->flofp)) { while (!feof(fl->flofp) && !ferror(fl->flofp)) {
if (fgets(buf, sizeof(buf)-1, fl->flofp) == NULL) if (fgets(buf, sizeof(buf)-1, fl->flofp) == NULL)
continue; continue;
/* /*
* Count nr of files which haven't been * Count nr of files which haven't been sent yet
* sent yet */
*/ if (buf[0] != '~')
if (buf[0] != '~') files_remain++;
files_remain++; }
}
} else { } else {
WriteError("$Error seeking in .flo to 0"); WriteError("$Error seeking in .flo to 0");
files_remain = -1; /* Keep flo-file */ files_remain = -1; /* Keep flo-file */
} }
if (files_remain) { if (files_remain) {
Syslog('o', "Leaving flo-file \"%s\", %d files remaining", MBSE_SS(nm), files_remain); Syslog('o', "Leaving flo-file \"%s\", %d files remaining", MBSE_SS(nm), files_remain);
fl->disposition = LEAVE; fl->disposition = LEAVE;
} else { } else {
fl->disposition = KFS; fl->disposition = KFS;
} }
} else { } else {
/* /*
* Mark files as sent in flo-file * Mark files as sent in flo-file
*/ */
if (fseek(fl->flofp, fl->floff, 0) == 0) { if (fseek(fl->flofp, fl->floff, 0) == 0) {
if (fwrite(&tpl,1,1,fl->flofp) != 1) { if (fwrite(&tpl,1,1,fl->flofp) != 1) {
WriteError("$Error writing '~' to .flo at %lu", (unsigned long)fl->floff); WriteError("$Error writing '~' to .flo at %lu", (unsigned long)fl->floff);
} }
fflush(fl->flofp); fflush(fl->flofp);
#ifdef HAVE_FDATASYNC #ifdef HAVE_FDATASYNC
fdatasync(fileno(fl->flofp)); fdatasync(fileno(fl->flofp));
#else #else
#ifdef HAVE_FSYNC #ifdef HAVE_FSYNC
fsync(fileno(fl->flofp)); fsync(fileno(fl->flofp));
#endif #endif
#endif #endif
} else } else
WriteError("$error seeking in .flo to %lu", (unsigned long)fl->floff); WriteError("$error seeking in .flo to %lu", (unsigned long)fl->floff);
}
} }
}
switch (fl->disposition) { switch (fl->disposition) {
case DSF: case DSF:
case LEAVE: case LEAVE: break;
break;
case TFS:
Syslog('o', "Truncating sent file \"%s\"",MBSE_SS(nm));
if ((fp=fopen(nm,"w")))
fclose(fp);
else
WriteError("$Cannot truncate file \"%s\"",MBSE_SS(nm));
break;
case KFS:
Syslog('o', "Removing sent file \"%s\"",MBSE_SS(nm));
if (unlink(nm) != 0) {
if (errno == ENOENT)
Syslog('o', "Cannot unlink nonexistent file \"%s\"", MBSE_SS(nm));
else
WriteError("$Cannot unlink file \"%s\"", MBSE_SS(nm));
}
break;
default: WriteError("execute_disposition: unknown disp %d for \"%s\"",
fl->disposition,MBSE_SS(nm));
break;
}
return; case TFS: Syslog('o', "Truncating sent file \"%s\"",MBSE_SS(nm));
if ((fp=fopen(nm,"w")))
fclose(fp);
else
WriteError("$Cannot truncate file \"%s\"",MBSE_SS(nm));
break;
case KFS: Syslog('o', "Removing sent file \"%s\"",MBSE_SS(nm));
if (unlink(nm) != 0) {
if (errno == ENOENT)
Syslog('o', "Cannot unlink nonexistent file \"%s\"", MBSE_SS(nm));
else
WriteError("$Cannot unlink file \"%s\"", MBSE_SS(nm));
}
break;
default: WriteError("execute_disposition: unknown disp %d for \"%s\"", fl->disposition,MBSE_SS(nm));
break;
}
return;
} }

View File

@ -66,55 +66,138 @@ static struct _alist
int outstat() int outstat()
{ {
int rc; int rc;
struct _alist *tmp, *old; struct _alist *tmp, *old;
char flstr[6]; char flstr[6], *temp, flavor;
time_t age; time_t age;
char temp[81]; faddr *fa;
callstat *cst; callstat *cst;
FILE *fp;
DIR *dp = NULL;
struct dirent *de;
struct stat sb;
struct passwd *pw;
if ((rc = scanout(each))) { if ((rc = scanout(each))) {
WriteError("Error scanning outbound, aborting"); WriteError("Error scanning outbound, aborting");
return rc; return rc;
} }
if (!do_quiet) { /*
colour(10, 0); * Check private outbound box for nodes in the setup.
printf("flavor try size age address\n"); */
colour(3, 0); temp = calloc(PATH_MAX, sizeof(char));
} sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) {
WriteError("Error open %s, aborting", temp);
free(temp);
return 1;
}
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
fseek(fp, 0, SEEK_SET);
fread(&nodeshdr, nodeshdr.hdrsize, 1, fp);
pw = getpwnam((char *)"mbse");
Syslog('+', "Flavor Try Size Age Address"); while ((fread(&nodes, nodeshdr.recsize, 1, fp)) == 1) {
for (tmp = alist; tmp; tmp = tmp->next) { if (strlen(nodes.OutBox)) {
if ((tmp->flavors & F_FREQ) || (tmp->size) || 1) { if (nodes.Crash)
strcpy(flstr,"......"); flavor = 'c';
if ((tmp->flavors) & F_IMM ) flstr[0]='I'; else if (nodes.Hold)
if ((tmp->flavors) & F_CRASH ) flstr[1]='C'; flavor = 'h';
if ((tmp->flavors) & F_NORMAL) flstr[2]='N'; else
if ((tmp->flavors) & F_HOLD ) flstr[3]='H'; flavor = 'o';
if ((tmp->flavors) & F_FREQ ) flstr[4]='R'; fa = fido2faddr(nodes.Aka[0]);
if ((tmp->flavors) & F_POLL ) flstr[5]='P'; Syslog('o', "checking outbox %s (%s)", nodes.OutBox, ascfnode(fa, 0x2f));
if ((dp = opendir(nodes.OutBox)) == NULL) {
cst = getstatus(&(tmp->addr)); Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(nodes.OutBox));
age = time(NULL); } else {
age -= tmp->time; while ((de = readdir(dp))) {
sprintf(temp, "%s %3d %9lu %s %s", flstr, cst->tryno, (long)tmp->size, if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
str_time(age), ascfnode(&(tmp->addr), 0x1f)); sprintf(temp, "%s/%s", nodes.OutBox, de->d_name);
if (stat(temp, &sb) == 0) {
if (!do_quiet) Syslog('o' ,"checking: \"%s\"", de->d_name);
printf("%s\n", temp); if (S_ISREG(sb.st_mode)) {
Syslog('+', "%s", temp); if (pw->pw_uid == sb.st_uid) {
/*
* We own the file
*/
if ((sb.st_mode & S_IRUSR) && (sb.st_mode & S_IWUSR)) {
each(fa, flavor, 0, temp);
} else {
Syslog('o', "no R/W permission on %s", temp);
}
} else if (pw->pw_gid == sb.st_gid) {
/*
* We own the file group
*/
if ((sb.st_mode & S_IRGRP) && (sb.st_mode & S_IWGRP)) {
each(fa, flavor, 0, temp);
} else {
Syslog('o', "no R/W permission on %s", temp);
}
} else {
/*
* No owner of file
*/
if ((sb.st_mode & S_IROTH) && (sb.st_mode & S_IWOTH)) {
each(fa, flavor, 0, temp);
} else {
Syslog('o', "no R/W permission on %s", temp);
}
}
} else {
Syslog('o', "not a regular file");
}
} else {
WriteError("Can't stat %s", temp);
}
}
} }
closedir(dp);
}
tidy_faddr(fa);
} }
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
}
fclose(fp);
for (tmp = alist; tmp; tmp = old) { if (!do_quiet) {
old = tmp->next; colour(10, 0);
free(tmp->addr.domain); printf("flavor try size age address\n");
free(tmp); colour(3, 0);
}
Syslog('+', "Flavor Try Size Age Address");
for (tmp = alist; tmp; tmp = tmp->next) {
if ((tmp->flavors & F_FREQ) || (tmp->size) || 1) {
strcpy(flstr,"......");
if ((tmp->flavors) & F_IMM ) flstr[0]='I';
if ((tmp->flavors) & F_CRASH ) flstr[1]='C';
if ((tmp->flavors) & F_NORMAL) flstr[2]='N';
if ((tmp->flavors) & F_HOLD ) flstr[3]='H';
if ((tmp->flavors) & F_FREQ ) flstr[4]='R';
if ((tmp->flavors) & F_POLL ) flstr[5]='P';
cst = getstatus(&(tmp->addr));
age = time(NULL);
age -= tmp->time;
sprintf(temp, "%s %3d %9lu %s %s", flstr, cst->tryno, (long)tmp->size, str_time(age), ascfnode(&(tmp->addr), 0x1f));
if (!do_quiet)
printf("%s\n", temp);
Syslog('+', "%s", temp);
} }
alist = NULL; }
return 0; free(temp);
for (tmp = alist; tmp; tmp = old) {
old = tmp->next;
free(tmp->addr.domain);
free(tmp);
}
alist = NULL;
return 0;
} }
@ -126,6 +209,8 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
FILE *fp; FILE *fp;
char buf[256], *p; char buf[256], *p;
Syslog('o', "each(%s, %c, %s, %s)", ascfnode(addr, 0x2f), flavor, isflo?"isflo":"noflo", fname);
if ((isflo != OUT_PKT) && (isflo != OUT_FLO) && (isflo != OUT_REQ) && (isflo != OUT_POL)) if ((isflo != OUT_PKT) && (isflo != OUT_FLO) && (isflo != OUT_REQ) && (isflo != OUT_POL))
return 0; return 0;

View File

@ -57,121 +57,118 @@ extern time_t t_start;
static int scan_dir(int (*)(faddr*,char,int,char*),char*,int); static int scan_dir(int (*)(faddr*,char,int,char*),char*,int);
static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispoint) static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispoint)
{ {
char fname[PATH_MAX]; char fname[PATH_MAX];
char flavor = '?'; char flavor = '?';
DIR *dp = NULL; DIR *dp = NULL;
struct dirent *de; struct dirent *de;
int rc = 0, isflo, fage; int rc = 0, isflo, fage;
Syslog('o' ,"scan_dir \"%s\" (%s)",MBSE_SS(dname),ispoint?"point":"node"); Syslog('o' ,"scan_dir \"%s\" (%s)",MBSE_SS(dname),ispoint?"point":"node");
if ((dp = opendir(dname)) == NULL) {
Syslog('-', "Creating directory %s", dname);
/*
* Create a fake filename, mkdirs() likes that.
*/
sprintf(fname, "%s/foo", dname);
(void)mkdirs(fname, 0770);
if ((dp = opendir(dname)) == NULL) { if ((dp = opendir(dname)) == NULL) {
Syslog('-', "Creating directory %s", dname); Syslog('o' ,"\"%s\" cannot be opened, proceed",MBSE_SS(dname));
/* return 0;
* Create a fake filename, mkdirs() likes that.
*/
sprintf(fname, "%s/foo", dname);
(void)mkdirs(fname, 0770);
if ((dp = opendir(dname)) == NULL) {
Syslog('o' ,"\"%s\" cannot be opened, proceed",MBSE_SS(dname));
return 0;
}
} }
}
while ((de=readdir(dp))) while ((de=readdir(dp)))
if ((strlen(de->d_name) == 12) && (de->d_name[8] == '.') && if ((strlen(de->d_name) == 12) && (de->d_name[8] == '.') && (strspn(de->d_name,"0123456789abcdefABCDEF") == 8)) {
(strspn(de->d_name,"0123456789abcdefABCDEF") == 8)) { Syslog('o' ,"checking: \"%s\"",de->d_name);
Syslog('o' ,"checking: \"%s\"",de->d_name); addr.point= 0;
addr.point= 0; strncpy(fname,dname,PATH_MAX-2);
strncpy(fname,dname,PATH_MAX-2); strcat(fname,"/");
strcat(fname,"/"); strncat(fname,de->d_name,PATH_MAX-strlen(fname)-2);
strncat(fname,de->d_name,PATH_MAX-strlen(fname)-2);
if ((strcasecmp(de->d_name+9,"pnt") == 0) && !ispoint) { if ((strcasecmp(de->d_name+9,"pnt") == 0) && !ispoint) {
sscanf(de->d_name,"%04x%04x",&addr.net,&addr.node); sscanf(de->d_name,"%04x%04x",&addr.net,&addr.node);
if ((rc = scan_dir(fn, fname, 1))) if ((rc = scan_dir(fn, fname, 1)))
goto exout; goto exout;
} else if ((strcasecmp(de->d_name+8,".out") == 0) || } else if ((strcasecmp(de->d_name+8,".out") == 0) ||
(strcasecmp(de->d_name+8,".cut") == 0) || (strcasecmp(de->d_name+8,".cut") == 0) ||
(strcasecmp(de->d_name+8,".hut") == 0) || (strcasecmp(de->d_name+8,".hut") == 0) ||
(strcasecmp(de->d_name+8,".iut") == 0) || (strcasecmp(de->d_name+8,".iut") == 0) ||
(strcasecmp(de->d_name+8,".opk") == 0) || (strcasecmp(de->d_name+8,".opk") == 0) ||
(strcasecmp(de->d_name+8,".cpk") == 0) || (strcasecmp(de->d_name+8,".cpk") == 0) ||
(strcasecmp(de->d_name+8,".hpk") == 0) || (strcasecmp(de->d_name+8,".hpk") == 0) ||
(strcasecmp(de->d_name+8,".ipk") == 0) || (strcasecmp(de->d_name+8,".ipk") == 0) ||
(strcasecmp(de->d_name+8,".flo") == 0) || (strcasecmp(de->d_name+8,".flo") == 0) ||
(strcasecmp(de->d_name+8,".clo") == 0) || (strcasecmp(de->d_name+8,".clo") == 0) ||
(strcasecmp(de->d_name+8,".hlo") == 0) || (strcasecmp(de->d_name+8,".hlo") == 0) ||
(strcasecmp(de->d_name+8,".ilo") == 0) || (strcasecmp(de->d_name+8,".ilo") == 0) ||
(strcasecmp(de->d_name+8,".req") == 0) || (strcasecmp(de->d_name+8,".req") == 0) ||
(strcasecmp(de->d_name+8,".pol") == 0)) { (strcasecmp(de->d_name+8,".pol") == 0)) {
if (ispoint) if (ispoint)
sscanf(de->d_name,"%08x", &addr.point); sscanf(de->d_name,"%08x", &addr.point);
else else
sscanf(de->d_name,"%04x%04x", &addr.net,&addr.node); sscanf(de->d_name,"%04x%04x", &addr.net,&addr.node);
flavor = tolower(de->d_name[9]); flavor = tolower(de->d_name[9]);
if (flavor == 'f') if (flavor == 'f')
flavor='o'; flavor='o';
if (strcasecmp(de->d_name+10,"ut") == 0) if (strcasecmp(de->d_name+10,"ut") == 0)
isflo=OUT_PKT; isflo=OUT_PKT;
else if (strcasecmp(de->d_name+10,"pk") == 0) else if (strcasecmp(de->d_name+10,"pk") == 0)
isflo=OUT_DIR; isflo=OUT_DIR;
else if (strcasecmp(de->d_name+10,"lo") == 0) else if (strcasecmp(de->d_name+10,"lo") == 0)
isflo=OUT_FLO; isflo=OUT_FLO;
else if (strcasecmp(de->d_name+9,"req") == 0) else if (strcasecmp(de->d_name+9,"req") == 0)
isflo=OUT_REQ; isflo=OUT_REQ;
else if (strcasecmp(de->d_name+9,"pol") == 0) else if (strcasecmp(de->d_name+9,"pol") == 0)
isflo=OUT_POL; isflo=OUT_POL;
else else
isflo=-1; isflo=-1;
Syslog('o' ,"%s \"%s\"", Syslog('o' ,"%s \"%s\"", (isflo == OUT_FLO) ? "flo file" : "packet", de->d_name);
(isflo == OUT_FLO) ? "flo file" : "packet", if ((rc=fn(&addr,flavor,isflo,fname)))
de->d_name); goto exout;
if ((rc=fn(&addr,flavor,isflo,fname))) } else if ((strncasecmp(de->d_name+9,"su",2) == 0) ||
goto exout; (strncasecmp(de->d_name+9,"mo",2) == 0) ||
} else if ((strncasecmp(de->d_name+9,"su",2) == 0) || (strncasecmp(de->d_name+9,"tu",2) == 0) ||
(strncasecmp(de->d_name+9,"mo",2) == 0) || (strncasecmp(de->d_name+9,"we",2) == 0) ||
(strncasecmp(de->d_name+9,"tu",2) == 0) || (strncasecmp(de->d_name+9,"th",2) == 0) ||
(strncasecmp(de->d_name+9,"we",2) == 0) || (strncasecmp(de->d_name+9,"fr",2) == 0) ||
(strncasecmp(de->d_name+9,"th",2) == 0) || (strncasecmp(de->d_name+9,"sa",2) == 0)) {
(strncasecmp(de->d_name+9,"fr",2) == 0) || isflo = OUT_ARC;
(strncasecmp(de->d_name+9,"sa",2) == 0)) { if ((rc = fn(&addr, flavor, isflo, fname)))
isflo = OUT_ARC; goto exout;
if ((rc = fn(&addr, flavor, isflo, fname)))
goto exout;
Syslog('o' ,"arcmail file \"%s\"",de->d_name); Syslog('o' ,"arcmail file \"%s\"",de->d_name);
sprintf(fname, "%s/%s", dname, de->d_name); sprintf(fname, "%s/%s", dname, de->d_name);
fage = (int)((t_start - file_time(fname)) / 86400); fage = (int)((t_start - file_time(fname)) / 86400);
if (file_size(fname) == 0) { if (file_size(fname) == 0) {
Syslog('o', "Age %d days", fage); Syslog('o', "Age %d days", fage);
/* /*
* Remove truncated ARCmail that has a day extension * Remove truncated ARCmail that has a day extension
* other then the current day or if the file is older * other then the current day or if the file is older
* then 6 days. * then 6 days.
*/ */
if ((strncasecmp(de->d_name+9, dayname(), 2)) || (fage > 6)) { if ((strncasecmp(de->d_name+9, dayname(), 2)) || (fage > 6)) {
if (unlink(fname) == 0) if (unlink(fname) == 0)
Syslog('-', "Removed truncated ARCmail file %s", fname); Syslog('+', "Removed truncated ARCmail file %s", fname);
}
}
if (CFG.toss_days && (fage > CFG.toss_days)) {
/*
* Remove ARCmail that is on hold too long.
*/
if (unlink(fname) == 0)
Syslog('+', "Removed ARCmail %s, %d days", fname, fage);
}
} else {
Syslog('o' ,"skipping \"%s\"",de->d_name);
} }
}
if (CFG.toss_days && (fage > CFG.toss_days)) {
/*
* Remove ARCmail that is on hold too long.
*/
if (unlink(fname) == 0)
Syslog('+', "Removed ARCmail %s, %d days", fname, fage);
}
} else {
Syslog('o' ,"skipping \"%s\"",de->d_name);
} }
}
exout: exout:
closedir(dp); closedir(dp);
return rc; return rc;
} }

View File

@ -125,7 +125,7 @@ int E_Group(gr_list **fdp, char *title)
clr_index(); clr_index();
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
mvprintw(5, 5, (char *)"%s", title); mvprintw(5, 6, (char *)"%s", title);
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
for (tmp = *fdp; tmp; tmp = tmp->next) for (tmp = *fdp; tmp; tmp = tmp->next)

View File

@ -716,7 +716,7 @@ char *edit_str(int y, int x, int l, char *line, char *help)
char *edit_pth(int y, int x, int l, char *line, char *help) char *edit_pth(int y, int x, int l, char *line, char *help, mode_t mode)
{ {
static char s[256]; static char s[256];
char *temp; char *temp;
@ -729,7 +729,7 @@ char *edit_pth(int y, int x, int l, char *line, char *help)
temp = xstrcat(temp, (char *)"/foobar"); temp = xstrcat(temp, (char *)"/foobar");
if (access(s, R_OK)) { if (access(s, R_OK)) {
if (yes_no((char *)"Path doesn't exist, create")) if (yes_no((char *)"Path doesn't exist, create"))
if (! mkdirs(temp, 0775)) if (! mkdirs(temp, mode))
errmsg((char *)"Can't create path"); errmsg((char *)"Can't create path");
} }
} }
@ -1723,6 +1723,95 @@ char *getmagictype(int val)
char *get_sessiontype(int val)
{
switch (val) {
case S_DIRECT: return (char *)"Direct ";
case S_DIR: return (char *)"Directory";
case S_FTP: return (char *)"FTP ";
default: return NULL;
}
}
void show_sessiontype(int y, int x, int val)
{
mvprintw(y, x, get_sessiontype(val));
}
int edit_sessiontype(int y, int x, int val)
{
int ch;
showhelp((char *)"Toggle ^Session type^ with spacebar, press <Enter> whene done.");
do {
set_color(YELLOW, BLUE);
show_sessiontype(y, x, val);
ch = readkey(y, x, YELLOW, BLUE);
if (ch == ' ') {
if (val < S_FTP)
val++;
else
val = S_DIRECT;
}
} while (ch != KEY_ENTER && ch != '\012');
set_color(WHITE, BLACK);
show_sessiontype(y, x, val);
return val;
}
char *get_routertype(int val)
{
switch (val) {
case R_ROUTE: return (char *)"Routed ";
case R_NEWDEST: return (char *)"Redirect ";
case R_BOUNCE: return (char *)"Bounce ";
case R_CC: return (char *)"CarbonCopy";
default: return NULL;
}
}
void show_routertype(int y, int x, int val)
{
mvprintw(y, x, get_routertype(val));
}
int edit_routertype(int y, int x, int val)
{
int ch;
showhelp((char *)"Toggle ^Routing mode^ with spacebar, press <Enter> whene done.");
do {
set_color(YELLOW, BLUE);
show_routertype(y, x, val);
ch = readkey(y, x, YELLOW, BLUE);
if (ch == ' ') {
if (val < R_CC)
val++;
else
val = R_ROUTE;
}
} while (ch != KEY_ENTER && ch != '\012');
set_color(WHITE, BLACK);
show_routertype(y, x, val);
return val;
}
void show_aka(int y, int x, fidoaddr aka) void show_aka(int y, int x, fidoaddr aka)
{ {
char temp[24]; char temp[24];

View File

@ -20,7 +20,7 @@ int select_menu(int);
int select_tag(int); int select_tag(int);
void show_str(int, int, int, char *); void show_str(int, int, int, char *);
char *edit_str(int, int, int, char *, char *); char *edit_str(int, int, int, char *, char *);
char *edit_pth(int, int, int, char *, char *); char *edit_pth(int, int, int, char *, char *, mode_t);
void test_jam(char *); void test_jam(char *);
char *edit_jam(int, int, int, char *, char *); char *edit_jam(int, int, int, char *, char *);
char *edit_ups(int, int, int, char *, char *); char *edit_ups(int, int, int, char *, char *);
@ -67,6 +67,12 @@ int edit_linetype(int, int, int);
char *getmagictype(int); char *getmagictype(int);
void show_magictype(int, int, int); void show_magictype(int, int, int);
int edit_magictype(int, int, int); int edit_magictype(int, int, int);
char *get_sessiontype(int);
void show_sessiontype(int, int, int);
int edit_sessiontype(int, int, int);
char *get_routetype(int);
void show_routetype(int, int, int);
int edit_routetype(int, int, int);
void show_aka(int, int, fidoaddr); void show_aka(int, int, fidoaddr);
void edit_color(int *, int *, char *, char *); void edit_color(int *, int *, char *, char *);
char *get_color(int); char *get_color(int);
@ -77,7 +83,7 @@ char *getmenutype(int);
* Macro's for the edit functions * Macro's for the edit functions
*/ */
#define E_STR(y,x,l,str,help) strcpy(str, edit_str(y,x,l,str,(char *)help)); break; #define E_STR(y,x,l,str,help) strcpy(str, edit_str(y,x,l,str,(char *)help)); break;
#define E_PTH(y,x,l,str,help) strcpy(str, edit_pth(y,x,l,str,(char *)help)); break; #define E_PTH(y,x,l,str,help,mode) strcpy(str, edit_pth(y,x,l,str,(char *)help,mode)); break;
#define E_UPS(y,x,l,str,help) strcpy(str, edit_ups(y,x,l,str,(char *)help)); break; #define E_UPS(y,x,l,str,help) strcpy(str, edit_ups(y,x,l,str,(char *)help)); break;
#define E_JAM(y,x,l,str,help) strcpy(str, edit_jam(y,x,l,str,(char *)help)); break; #define E_JAM(y,x,l,str,help) strcpy(str, edit_jam(y,x,l,str,(char *)help)); break;
#define E_BOOL(y,x,bool,help) bool = edit_bool(y,x,bool,(char *)help); break; #define E_BOOL(y,x,bool,help) bool = edit_bool(y,x,bool,(char *)help); break;

View File

@ -332,7 +332,7 @@ int EditFileRec(int Area)
return 0; return 0;
case 1: E_STR( 6,16,44, area.Name, "The ^name^ for this area") case 1: E_STR( 6,16,44, area.Name, "The ^name^ for this area")
case 2: strcpy(tpath, area.Path); case 2: strcpy(tpath, area.Path);
strcpy(area.Path, edit_pth(7,16,64, area.Path, (char *)"The ^path^ for the files in this area")); strcpy(area.Path, edit_pth(7,16,64, area.Path, (char *)"The ^path^ for the files in this area", 0775));
if (strlen(tpath) && strlen(area.Path) && strcmp(tpath, area.Path) && strcmp(tpath, CFG.ftp_base)) { if (strlen(tpath) && strlen(area.Path) && strcmp(tpath, area.Path) && strcmp(tpath, CFG.ftp_base)) {
if ((dp = opendir(tpath)) == NULL) { if ((dp = opendir(tpath)) == NULL) {
WriteError("Can't open directory %s", tpath); WriteError("Can't open directory %s", tpath);

View File

@ -420,7 +420,7 @@ int EditFGrpRec(int Area)
strcpy(fgroup.BbsGroup, fgroup.Name); strcpy(fgroup.BbsGroup, fgroup.Name);
break; break;
case 2: E_STR( 7,16,55,fgroup.Comment, "The ^description^ of this file group") case 2: E_STR( 7,16,55,fgroup.Comment, "The ^description^ of this file group")
case 3: E_PTH( 8,16,64,fgroup.BasePath, "The ^base path^ for new created file areas") case 3: E_PTH( 8,16,64,fgroup.BasePath, "The ^base path^ for new created file areas", 0775)
case 4: tmp = PickAka((char *)"10.1.4", TRUE); case 4: tmp = PickAka((char *)"10.1.4", TRUE);
if (tmp != -1) if (tmp != -1)
fgroup.UseAka = CFG.aka[tmp]; fgroup.UseAka = CFG.aka[tmp];

View File

@ -240,12 +240,12 @@ void e_global2(void)
switch(select_menu(7)) { switch(select_menu(7)) {
case 0: return; case 0: return;
case 1: E_PTH( 6,16,64, CFG.req_magic, "The path to the ^magic filerequest^ files.") case 1: E_PTH( 6,16,64, CFG.req_magic, "The path to the ^magic filerequest^ files.", 0750)
case 2: E_STR( 7,16,64, CFG.dospath, "The translated ^DOS^ drive and path, empty disables translation") case 2: E_STR( 7,16,64, CFG.dospath, "The translated ^DOS^ drive and path, empty disables translation")
case 3: E_PTH( 8,16,64, CFG.uxpath, "The translated ^Unix^ path.") case 3: E_PTH( 8,16,64, CFG.uxpath, "The translated ^Unix^ path.", 0750)
case 4: E_BOOL(9,16, CFG.leavecase, "^Leave^ outbound flo filenames as is, ^No^ forces uppercase.") case 4: E_BOOL(9,16, CFG.leavecase, "^Leave^ outbound flo filenames as is, ^No^ forces uppercase.")
case 5: E_PTH(10,16,64, CFG.ftp_base, "The ^FTP home^ directory to strip of the real directory") case 5: E_PTH(10,16,64, CFG.ftp_base, "The ^FTP home^ directory to strip of the real directory", 0750)
case 6: E_PTH(11,16,64, CFG.alists_path, "The path where ^area lists^ and ^filebone lists^ are stored.") case 6: E_PTH(11,16,64, CFG.alists_path, "The path where ^area lists^ and ^filebone lists^ are stored.", 0750)
case 7: E_STR(12,16,64, CFG.externaleditor, case 7: E_STR(12,16,64, CFG.externaleditor,
"The full path and filename to the ^external message editor^ (blank=disable)") "The full path and filename to the ^external message editor^ (blank=disable)")
} }
@ -296,17 +296,17 @@ void e_global(void)
switch(select_menu(12)) { switch(select_menu(12)) {
case 0: return; case 0: return;
case 1: E_PTH( 6,16,64, CFG.bbs_menus, "The path to the ^default menus^.") case 1: E_PTH( 6,16,64, CFG.bbs_menus, "The path to the ^default menus^.", 0750)
case 2: E_PTH( 7,16,64, CFG.bbs_txtfiles, "The path to the ^default textfiles^.") case 2: E_PTH( 7,16,64, CFG.bbs_txtfiles, "The path to the ^default textfiles^.", 0750)
case 3: E_PTH( 8,16,64, CFG.bbs_macros, "The path to the ^default macro templates^.") case 3: E_PTH( 8,16,64, CFG.bbs_macros, "The path to the ^default macro templates^.", 0750)
case 4: E_PTH( 9,16,64, CFG.bbs_usersdir, "The path to the ^users home^ directories.") case 4: E_PTH( 9,16,64, CFG.bbs_usersdir, "The path to the ^users home^ directories.", 0770)
case 5: E_PTH(10,16,64, CFG.nodelists, "The path to the ^nodelists^.") case 5: E_PTH(10,16,64, CFG.nodelists, "The path to the ^nodelists^.", 0750)
case 6: E_PTH(11,16,64, CFG.inbound, "The path to the ^inbound^ for unknown systems.") case 6: E_PTH(11,16,64, CFG.inbound, "The path to the ^inbound^ for unknown systems.", 0750)
case 7: E_PTH(12,16,64, CFG.pinbound, "The path to the ^nodelists^ for protected systems.") case 7: E_PTH(12,16,64, CFG.pinbound, "The path to the ^nodelists^ for protected systems.", 0750)
case 8: E_PTH(13,16,64, CFG.outbound, "The path to the base ^outbound^ directory.") case 8: E_PTH(13,16,64, CFG.outbound, "The path to the base ^outbound^ directory.", 0750)
case 9: E_PTH(14,16,64, CFG.msgs_path, "The path to the ^*.msgs^ directory.") case 9: E_PTH(14,16,64, CFG.msgs_path, "The path to the ^*.msgs^ directory.", 0750)
case 10:E_PTH(15,16,64, CFG.badtic, "The path to the ^bad tic files^.") case 10:E_PTH(15,16,64, CFG.badtic, "The path to the ^bad tic files^.", 0750)
case 11:E_PTH(16,16,64, CFG.ticout, "The path to the ^outgoing TIC^ files.") case 11:E_PTH(16,16,64, CFG.ticout, "The path to the ^outgoing TIC^ files.", 0750)
case 12:e_global2(); case 12:e_global2();
s_global(); s_global();
break; break;
@ -1066,9 +1066,9 @@ void e_intmailcfg(void)
case 1: E_STR( 7,16,64, CFG.popnode, "The ^FQDN^ of the node where the ^POP3^ server runs.") case 1: E_STR( 7,16,64, CFG.popnode, "The ^FQDN^ of the node where the ^POP3^ server runs.")
case 2: E_STR( 8,16,64, CFG.smtpnode, "The ^FQDN^ of the node where the ^SMTP^ server runs.") case 2: E_STR( 8,16,64, CFG.smtpnode, "The ^FQDN^ of the node where the ^SMTP^ server runs.")
case 3: if (CFG.newsfeed == FEEDRNEWS) case 3: if (CFG.newsfeed == FEEDRNEWS)
strcpy(CFG.rnewspath, edit_pth(9,16,64, CFG.rnewspath, (char *)"The path and filename to the ^rnews^ command.")); strcpy(CFG.rnewspath, edit_pth(9,16,64, CFG.rnewspath, (char *)"The path and filename to the ^rnews^ command.", 0775));
if (CFG.newsfeed == FEEDUUCP) if (CFG.newsfeed == FEEDUUCP)
strcpy(CFG.rnewspath, edit_pth(9,16,64, CFG.rnewspath, (char *)"The path to the ^uucppublic^ directory.")); strcpy(CFG.rnewspath, edit_pth(9,16,64, CFG.rnewspath, (char *)"The path to the ^uucppublic^ directory.", 0775));
break; break;
case 4: if (CFG.newsfeed == FEEDINN) case 4: if (CFG.newsfeed == FEEDINN)
strcpy(CFG.nntpnode, edit_str(10,16,64, CFG.nntpnode, (char *)"The ^FQDN^ of the node where the ^NNTP^ server runs.")); strcpy(CFG.nntpnode, edit_str(10,16,64, CFG.nntpnode, (char *)"The ^FQDN^ of the node where the ^NNTP^ server runs."));

View File

@ -350,9 +350,9 @@ int EditLangRec(int Area)
return 0; return 0;
case 1: E_UPS( 7,16,1, lang.LangKey, "The ^Key^ to select this language") case 1: E_UPS( 7,16,1, lang.LangKey, "The ^Key^ to select this language")
case 2: E_STR( 8,16,30,lang.Name, "The ^name^ of this language") case 2: E_STR( 8,16,30,lang.Name, "The ^name^ of this language")
case 3: E_PTH( 9,16,64,lang.MenuPath, "The ^Menus Path^ of this language") case 3: E_PTH( 9,16,64,lang.MenuPath, "The ^Menus Path^ of this language", 0755)
case 4: E_PTH( 10,16,64,lang.TextPath, "The ^Textfile path^ of this language") case 4: E_PTH( 10,16,64,lang.TextPath, "The ^Textfile path^ of this language", 0755)
case 5: E_PTH( 11,16,64,lang.MacroPath,"The ^Macro template path^ if this language") case 5: E_PTH( 11,16,64,lang.MacroPath,"The ^Macro template path^ if this language", 0755)
case 6: E_BOOL(12,16, lang.Available,"Is this language ^available^") case 6: E_BOOL(12,16, lang.Available,"Is this language ^available^")
case 7: E_STR( 13,16,24,lang.Filename, "The ^Filename^ (without path) of the language datafile") case 7: E_STR( 13,16,24,lang.Filename, "The ^Filename^ (without path) of the language datafile")
case 8: E_SEC( 14,16, lang.Security, "8.2. LANGUAGE SECURITY", s_lang) case 8: E_SEC( 14,16, lang.Security, "8.2. LANGUAGE SECURITY", s_lang)

View File

@ -364,7 +364,7 @@ int EditMagicRec(int Area)
case MG_COPY: case MG_COPY:
case MG_UNPACK: case MG_UNPACK:
E_PTH(12,16,64, magic.Path, "The ^path^ to use") E_PTH(12,16,64, magic.Path, "The ^path^ to use", 0750)
case MG_EXEC: case MG_EXEC:
E_STR(12,16,64, magic.Cmd, "The ^command^ to execute") E_STR(12,16,64, magic.Cmd, "The ^command^ to execute")

View File

@ -381,7 +381,7 @@ int EditMGrpRec(int Area)
} }
break; break;
case 2: E_STR( 8,16,55, mgroup.Comment, "The ^desription^ for this message group") case 2: E_STR( 8,16,55, mgroup.Comment, "The ^desription^ for this message group")
case 3: E_PTH( 9,16,64, mgroup.BasePath, "The ^Base path^ where new JAM areas are created") case 3: E_PTH( 9,16,64, mgroup.BasePath, "The ^Base path^ where new JAM areas are created", 0770)
case 4: E_SEC( 10,16, mgroup.RDSec, "9.1.4 MESSAGE GROUP READ SECURITY", MgScreen) case 4: E_SEC( 10,16, mgroup.RDSec, "9.1.4 MESSAGE GROUP READ SECURITY", MgScreen)
case 5: E_SEC( 11,16, mgroup.WRSec, "9.1.5 MESSAGE GROUP WRITE SECURITY", MgScreen) case 5: E_SEC( 11,16, mgroup.WRSec, "9.1.5 MESSAGE GROUP WRITE SECURITY", MgScreen)
case 6: E_SEC( 12,16, mgroup.SYSec, "9.1.6 MESSAGE GROUP SYSOP SECURITY", MgScreen) case 6: E_SEC( 12,16, mgroup.SYSec, "9.1.6 MESSAGE GROUP SYSOP SECURITY", MgScreen)

File diff suppressed because it is too large Load Diff

View File

@ -83,7 +83,7 @@ scanout.o: libs.h ../lib/structs.h taskutil.h scanout.h
taskcomm.o: libs.h ../lib/structs.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskcomm.h taskcomm.o: libs.h ../lib/structs.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskcomm.h
taskinfo.o: libs.h ../lib/structs.h taskinfo.h taskinfo.o: libs.h ../lib/structs.h taskinfo.h
taskstat.o: libs.h ../lib/structs.h taskstat.h callstat.h outstat.h taskutil.h taskstat.o: libs.h ../lib/structs.h taskstat.h callstat.h outstat.h taskutil.h
mbtask.o: libs.h ../lib/structs.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: 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
outstat.o: libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h ports.h outstat.h outstat.o: libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h ports.h outstat.h
signame.o: signame.h signame.o: signame.h
taskdisk.o: libs.h ../lib/structs.h taskdisk.h taskutil.h taskdisk.o: libs.h ../lib/structs.h taskdisk.h taskutil.h

View File

@ -124,7 +124,7 @@ int check_calllist(void)
} }
} }
} }
tasklog('o', "%d systems to call", call_work); tasklog('o', "%d system%s to call", call_work, (call_work == 1)?"":"s");
} else { } else {
if (s_scanout) if (s_scanout)
sem_set((char *)"scanout", FALSE); sem_set((char *)"scanout", FALSE);

View File

@ -30,6 +30,7 @@
#include "libs.h" #include "libs.h"
#include "../lib/structs.h" #include "../lib/structs.h"
#include "../paths.h"
#include "signame.h" #include "signame.h"
#include "taskstat.h" #include "taskstat.h"
#include "taskutil.h" #include "taskutil.h"
@ -417,7 +418,8 @@ void load_taskcfg(void)
sprintf(TCFG.cmd_mailin, "%s/bin/mbfido tic toss web -quiet", getenv("MBSE_ROOT")); sprintf(TCFG.cmd_mailin, "%s/bin/mbfido tic toss web -quiet", getenv("MBSE_ROOT"));
sprintf(TCFG.cmd_newnews, "%s/bin/mbfido news web -quiet", getenv("MBSE_ROOT")); sprintf(TCFG.cmd_newnews, "%s/bin/mbfido news web -quiet", getenv("MBSE_ROOT"));
sprintf(TCFG.cmd_mbindex1, "%s/bin/mbindex -quiet", getenv("MBSE_ROOT")); sprintf(TCFG.cmd_mbindex1, "%s/bin/mbindex -quiet", getenv("MBSE_ROOT"));
sprintf(TCFG.cmd_mbindex2, "%s/bin/goldnode -f -q", getenv("MBSE_ROOT")); if (strlen(_PATH_GOLDNODE))
sprintf(TCFG.cmd_mbindex2, "%s/bin/goldnode -f -q", getenv("MBSE_ROOT"));
sprintf(TCFG.cmd_msglink, "%s/bin/mbmsg link -quiet", getenv("MBSE_ROOT")); sprintf(TCFG.cmd_msglink, "%s/bin/mbmsg link -quiet", getenv("MBSE_ROOT"));
sprintf(TCFG.cmd_reqindex, "%s/bin/mbfile index -quiet", getenv("MBSE_ROOT")); sprintf(TCFG.cmd_reqindex, "%s/bin/mbfile index -quiet", getenv("MBSE_ROOT"));
TCFG.debug = FALSE; TCFG.debug = FALSE;

View File

@ -82,7 +82,6 @@ int load_node(fidoaddr n)
(n.node == nodes.Aka[i].node) && (n.point == nodes.Aka[i].point)) { (n.node == nodes.Aka[i].node) && (n.point == nodes.Aka[i].point)) {
fclose(fp); fclose(fp);
free(temp); free(temp);
// tasklog('-' , "Node record %d, aka nr %d", j, i+1);
return TRUE; return TRUE;
} }
} }
@ -188,13 +187,17 @@ int outstat()
{ {
int rc, first = TRUE, T_window, iszmh = FALSE; int rc, first = TRUE, T_window, iszmh = FALSE;
struct _alist *tmp, *old; struct _alist *tmp, *old;
char flstr[13]; char flstr[13], *temp, as[6], be[6], utc[6], flavor;
char temp[81];
char as[6], be[6], utc[6];
time_t now; time_t now;
struct tm *tm; struct tm *tm;
int uhour, umin, thour, tmin; int uhour, umin, thour, tmin;
pp_list *tpl; pp_list *tpl;
faddr *fa;
FILE *fp;
DIR *dp = NULL;
struct dirent *de;
struct stat sb;
struct passwd *pw;
now = time(NULL); now = time(NULL);
tm = gmtime(&now); /* UTC time */ tm = gmtime(&now); /* UTC time */
@ -220,6 +223,90 @@ int outstat()
return rc; return rc;
} }
/*
* Check private outbound box for nodes in the setup.
*/
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) {
tasklog('?', "Error open %s, aborting", temp);
free(temp);
return 1;
}
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
fseek(fp, 0, SEEK_SET);
fread(&nodeshdr, nodeshdr.hdrsize, 1, fp);
pw = getpwnam((char *)"mbse");
while ((fread(&nodes, nodeshdr.recsize, 1, fp)) == 1) {
if (strlen(nodes.OutBox)) {
if (nodes.Crash)
flavor = 'c';
else if (nodes.Hold)
flavor = 'h';
else
flavor = 'o';
fa = (faddr *)malloc(sizeof(faddr));
fa->name = NULL;
fa->domain = xstrcpy(nodes.Aka[0].domain);
fa->zone = nodes.Aka[0].zone;
fa->net = nodes.Aka[0].net;
fa->node = nodes.Aka[0].node;
fa->point = nodes.Aka[0].point;
if ((dp = opendir(nodes.OutBox)) != NULL) {
while ((de = readdir(dp))) {
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
sprintf(temp, "%s/%s", nodes.OutBox, de->d_name);
if (stat(temp, &sb) == 0) {
if (S_ISREG(sb.st_mode)) {
if (pw->pw_uid == sb.st_uid) {
/*
* We own the file
*/
if ((sb.st_mode & S_IRUSR) && (sb.st_mode & S_IWUSR)) {
each(fa, flavor, OUT_FIL, temp);
} else {
tasklog('+', "No R/W permission on %s", temp);
}
} else if (pw->pw_gid == sb.st_gid) {
/*
* We own the file group
*/
if ((sb.st_mode & S_IRGRP) && (sb.st_mode & S_IWGRP)) {
each(fa, flavor, OUT_FIL, temp);
} else {
tasklog('+', "No R/W permission on %s", temp);
}
} else {
/*
* No owner of file
*/
if ((sb.st_mode & S_IROTH) && (sb.st_mode & S_IWOTH)) {
each(fa, flavor, OUT_FIL, temp);
} else {
tasklog('+', "No R/W permission on %s", temp);
}
}
} else {
tasklog('+', "Not a regular file: %s", temp);
}
} else {
tasklog('?', "Can't stat %s", temp);
}
}
}
closedir(dp);
}
if (fa->domain)
free(fa->domain);
free(fa);
}
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
}
fclose(fp);
/* /*
* During processing the outbound list, determine when the next event will occur, * During processing the outbound list, determine when the next event will occur,
* ie. the time when the callout status of a node changes because of starting a * ie. the time when the callout status of a node changes because of starting a
@ -227,7 +314,7 @@ int outstat()
*/ */
for (tmp = alist; tmp; tmp = tmp->next) { for (tmp = alist; tmp; tmp = tmp->next) {
if (first) { if (first) {
tasklog('+', "Flavor Out Size Online Modem ISDN TCP/IP Calls Status Mode Address"); tasklog('+', "Flavor Out Size Online Modem ISDN TCP/IP Calls Status Mode Address");
first = FALSE; first = FALSE;
} }
@ -309,7 +396,7 @@ int outstat()
} }
} }
// tasklog('o', "T_window=%s, iszmh=%s", T_window?"true":"false", iszmh?"true":"false"); // tasklog('o', "T_window=%s, iszmh=%s", T_window?"true":"false", iszmh?"true":"false");
strcpy(flstr,"...... ... .."); strcpy(flstr,"...... .... ..");
/* /*
* If the node has internet and we have internet configured, * If the node has internet and we have internet configured,
@ -351,8 +438,11 @@ int outstat()
flstr[5]='P'; flstr[5]='P';
tmp->flavors |= F_CALL; tmp->flavors |= F_CALL;
} }
if ((tmp->flavors) & F_ISFIL )
flstr[7]='A';
if ((tmp->flavors) & F_ISPKT ) { if ((tmp->flavors) & F_ISPKT ) {
flstr[7]='M'; flstr[8]='M';
/* /*
* Normal mail, send during ZMH or if node has a Txx window. * Normal mail, send during ZMH or if node has a Txx window.
*/ */
@ -361,7 +451,7 @@ int outstat()
} }
} }
if ((tmp->flavors) & F_ISFLO ) if ((tmp->flavors) & F_ISFLO )
flstr[8]='F'; flstr[9]='F';
if (tmp->cst.tryno >= 30) { if (tmp->cst.tryno >= 30) {
/* /*
@ -370,11 +460,11 @@ int outstat()
tmp->flavors &= ~F_CALL; tmp->flavors &= ~F_CALL;
} }
if ((tmp->flavors) & F_CALL) if ((tmp->flavors) & F_CALL)
flstr[9]='C'; flstr[10]='C';
if (tmp->t1) if (tmp->t1)
flstr[11] = tmp->t1; flstr[12] = tmp->t1;
if (tmp->t2) if (tmp->t2)
flstr[12] = tmp->t2; flstr[13] = tmp->t2;
/* /*
* If forbidden to call from setup, clear callflag. * If forbidden to call from setup, clear callflag.
@ -464,8 +554,9 @@ int outstat()
/* /*
* Log results * Log results
*/ */
tasklog('+', "Inet=%d, ISDN=%d, POTS=%d, Next event at %02d:%02d UTC", tasklog('+', "Systems to call: Inet=%d, ISDN=%d, POTS=%d, Next event at %02d:%02d UTC",
inet_calls, isdn_calls, pots_calls, nxt_hour, nxt_min); inet_calls, isdn_calls, pots_calls, nxt_hour, nxt_min);
free(temp);
return 0; return 0;
} }
@ -480,7 +571,7 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
node *nlent; node *nlent;
callstat *cst; callstat *cst;
if ((isflo != OUT_PKT) && (isflo != OUT_FLO) && (isflo != OUT_REQ) && (isflo != OUT_POL)) if ((isflo != OUT_PKT) && (isflo != OUT_FLO) && (isflo != OUT_REQ) && (isflo != OUT_POL) && (isflo != OUT_FIL))
return 0; return 0;
for (tmp = &alist; *tmp; tmp = &((*tmp)->next)) for (tmp = &alist; *tmp; tmp = &((*tmp)->next))
@ -525,7 +616,7 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
(*tmp)->cst.tryno = cst->tryno; (*tmp)->cst.tryno = cst->tryno;
(*tmp)->cst.trystat = cst->trystat; (*tmp)->cst.trystat = cst->trystat;
if ((isflo == OUT_FLO) || (isflo == OUT_PKT)) if ((isflo == OUT_FLO) || (isflo == OUT_PKT) || (isflo == OUT_FIL))
switch (flavor) { switch (flavor) {
case '?': break; case '?': break;
case 'i': (*tmp)->flavors |= F_IMM; break; case 'i': (*tmp)->flavors |= F_IMM; break;
@ -602,6 +693,9 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
(*tmp)->flavors |= F_FREQ; (*tmp)->flavors |= F_FREQ;
} else if (isflo == OUT_POL) { } else if (isflo == OUT_POL) {
(*tmp)->flavors |= F_POLL; (*tmp)->flavors |= F_POLL;
} else if (isflo == OUT_FIL) {
(*tmp)->size += st.st_size;
(*tmp)->flavors |= F_ISFIL;
} }
return 0; return 0;

View File

@ -43,7 +43,8 @@ typedef struct _alist
#define F_POLL 0x0020 #define F_POLL 0x0020
#define F_ISFLO 0x0040 #define F_ISFLO 0x0040
#define F_ISPKT 0x0080 #define F_ISPKT 0x0080
#define F_CALL 0x0100 #define F_ISFIL 0x0100
#define F_CALL 0x0200

View File

@ -336,7 +336,7 @@ void check_ping(void)
* Reply received. * Reply received.
*/ */
rc = time(NULL) - (pingtime - 20); rc = time(NULL) - (pingtime - 20);
if (rc != 1) if (rc > 2)
tasklog('p', "ping: reply after %d seconds", rc); tasklog('p', "ping: reply after %d seconds", rc);
pingresult[pingnr] = TRUE; pingresult[pingnr] = TRUE;
if (pingresult[1] || pingresult[2]) { if (pingresult[1] || pingresult[2]) {

View File

@ -10,6 +10,7 @@
#define OUT_ARC 3 #define OUT_ARC 3
#define OUT_REQ 4 #define OUT_REQ 4
#define OUT_POL 5 #define OUT_POL 5
#define OUT_FIL 6
extern int scanout(int (*)(faddr*,char,int,char*)); extern int scanout(int (*)(faddr*,char,int,char*));

View File

@ -40,3 +40,10 @@
#define _PATH_SZ "@SZ@" #define _PATH_SZ "@SZ@"
/*
* GoldED
*/
#define _PATH_GOLDED "@GOLDEDBIN@"
#define _PATH_GOLDNODE "@GOLDNODE@"