Added T-Mail fileboxes support
This commit is contained in:
parent
c4eea97ff1
commit
7d69fcdfb6
4
AUTHORS
4
AUTHORS
@ -1,5 +1,8 @@
|
|||||||
MBSE BBS AUTHORS.
|
MBSE BBS AUTHORS.
|
||||||
|
|
||||||
|
$id$
|
||||||
|
|
||||||
|
|
||||||
The following people are members of the MBSE BBS development team:
|
The following people are members of the MBSE BBS development team:
|
||||||
|
|
||||||
Michiel Broek mbroek@users.sourceforge.net 2:280/2802
|
Michiel Broek mbroek@users.sourceforge.net 2:280/2802
|
||||||
@ -46,4 +49,5 @@ Sergey Nechaev 2:5015/53@fidonet
|
|||||||
Serge Terekhov 2:5000/13@fidonet
|
Serge Terekhov 2:5000/13@fidonet
|
||||||
Vadim Kurland vadim@gu.kiev.ua
|
Vadim Kurland vadim@gu.kiev.ua
|
||||||
Vadim Zaliva lord@crocodile.kiev.ua
|
Vadim Zaliva lord@crocodile.kiev.ua
|
||||||
|
Przemyslaw Kwiatkowski 2:480/127@fidonet
|
||||||
|
|
||||||
|
@ -6,6 +6,13 @@ v0.39.6 11-Jan-2004
|
|||||||
New binkp/1.1 driver fixes for Sun NetBSD.
|
New binkp/1.1 driver fixes for Sun NetBSD.
|
||||||
Removed TCP ignore check in EOB state.
|
Removed TCP ignore check in EOB state.
|
||||||
Transmiter file close now right after last block.
|
Transmiter file close now right after last block.
|
||||||
|
Added support for T-Mail fileboxes, partly written and info
|
||||||
|
provided by Przemyslaw Kwiatkowski (2:480/127).
|
||||||
|
|
||||||
|
mbout:
|
||||||
|
Added support for T-Mail fileboxes.
|
||||||
|
|
||||||
|
mbtask:
|
||||||
Added support for T-Mail fileboxes.
|
Added support for T-Mail fileboxes.
|
||||||
|
|
||||||
mbsetup:
|
mbsetup:
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</HEAD>
|
</HEAD>
|
||||||
<BODY>
|
<BODY>
|
||||||
<BLOCKQUOTE>
|
<BLOCKQUOTE>
|
||||||
<div align="right"><h5>Last update 11-Jan-2004</h5></div>
|
<div align="right"><h5>Last update 14-Jan-2004</h5></div>
|
||||||
<div align="center"><H1>MBSE BBS Setup - Global Setup</H1></div>
|
<div align="center"><H1>MBSE BBS Setup - Global Setup</H1></div>
|
||||||
|
|
||||||
In this setup you can edit all global settings for MBSE BBS. All sections will
|
In this setup you can edit all global settings for MBSE BBS. All sections will
|
||||||
@ -64,7 +64,17 @@ group them.
|
|||||||
<pre>
|
<pre>
|
||||||
<strong>BBS Menus </strong>The path to the default menus
|
<strong>BBS Menus </strong>The path to the default menus
|
||||||
<strong>Txtfiles </strong>The path to the default ANSI and ASCII textfiles
|
<strong>Txtfiles </strong>The path to the default ANSI and ASCII textfiles
|
||||||
|
<strong>Macro's </strong>The path to the default macro templates
|
||||||
<strong>Home dirs </strong>The path to the users home directories
|
<strong>Home dirs </strong>The path to the users home directories
|
||||||
|
<strong>FTP base </strong>The FTP base path, ie. /opt/mbse/ftp/pub
|
||||||
|
<strong>Arealists </strong>The path where area lists and filebone lists are stored
|
||||||
|
<strong>Ext. edit </strong>The full path and filename to the external editor
|
||||||
|
<strong>Rules dir </strong>The path to the directory to store area rules
|
||||||
|
|
||||||
|
<strong>Magic's </strong>Where the magic filerequests are kept
|
||||||
|
<strong>DOS path </strong>The DOS drive and path
|
||||||
|
<strong>Unix path </strong>The Translated DOS path in real
|
||||||
|
<strong>LeaveCase </strong>Leave outbound .flo filenames as is, No forces to uppercase
|
||||||
<strong>Nodelists </strong>The path to the nodelist directory
|
<strong>Nodelists </strong>The path to the nodelist directory
|
||||||
<strong>Inbound </strong>The unprotected fidonet inbound
|
<strong>Inbound </strong>The unprotected fidonet inbound
|
||||||
<strong>Prot inb. </strong>The (password) protected fidonet inbound
|
<strong>Prot inb. </strong>The (password) protected fidonet inbound
|
||||||
@ -74,13 +84,8 @@ group them.
|
|||||||
These are *.msg files can be created by several doors. (Not in use yet)
|
These are *.msg files can be created by several doors. (Not in use yet)
|
||||||
<strong>Bad TIC's </strong>Where bad TIC files are saved
|
<strong>Bad TIC's </strong>Where bad TIC files are saved
|
||||||
<strong>TIC queue </strong>Where TIC files for downlinks are kept
|
<strong>TIC queue </strong>Where TIC files for downlinks are kept
|
||||||
<strong>Magic's </strong>Where the magic filerequests are kept
|
<strong>TMail DOS </strong>The T-Mail 8.3 (short) base path (empty = disable)
|
||||||
<strong>DOS path </strong>The DOS drive and path
|
<strong>TMail Win </strong>The T-Mail long filename base path (empty = disable)
|
||||||
<strong>Unix path </strong>The Translated DOS path in real
|
|
||||||
<strong>LeaveCase </strong>Leave outbound .flo filenames as is, No forces to uppercase
|
|
||||||
<strong>FTP base </strong>The FTP base path, ie. /opt/mbse/ftp/pub
|
|
||||||
<strong>Arealists </strong>The path where area lists and filebone lists are stored
|
|
||||||
<strong>Ext. edit </strong>The full path and filename to the external editor.
|
|
||||||
</pre>
|
</pre>
|
||||||
If you fill in the DOS path then the DOS path and Unix path are translated
|
If you fill in the DOS path then the DOS path and Unix path are translated
|
||||||
to DOS paths in the flo files for outbound mail sessions. You only need this if
|
to DOS paths in the flo files for outbound mail sessions. You only need this if
|
||||||
|
@ -306,12 +306,6 @@ file_list *create_filelist(fa_list *al, char *fl, int create)
|
|||||||
if ((tmpa->addr) && Loaded && strlen(nodes.OutBox) &&
|
if ((tmpa->addr) && Loaded && strlen(nodes.OutBox) &&
|
||||||
(tmpa->addr->zone == nodes.Aka[0].zone) && (tmpa->addr->net == nodes.Aka[0].net) &&
|
(tmpa->addr->zone == nodes.Aka[0].zone) && (tmpa->addr->net == nodes.Aka[0].net) &&
|
||||||
(tmpa->addr->node == nodes.Aka[0].node) && (tmpa->addr->point == nodes.Aka[0].point)) {
|
(tmpa->addr->node == nodes.Aka[0].node) && (tmpa->addr->point == nodes.Aka[0].point)) {
|
||||||
if (nodes.Crash)
|
|
||||||
flavor = 'c';
|
|
||||||
else if (nodes.Hold)
|
|
||||||
flavor = 'h';
|
|
||||||
else
|
|
||||||
flavor = 'o';
|
|
||||||
check_filebox(nodes.OutBox, st);
|
check_filebox(nodes.OutBox, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
176
mbcico/outstat.c
176
mbcico/outstat.c
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Show mail outbound status
|
* Purpose ...............: Show mail outbound status
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2004
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -67,57 +67,26 @@ static struct _alist
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int outstat()
|
void checkdir(char *, faddr *, char);
|
||||||
|
void checkdir(char *boxpath, faddr *fa, char flavor)
|
||||||
{
|
{
|
||||||
int rc;
|
char *temp;
|
||||||
struct _alist *tmp, *old;
|
|
||||||
char flstr[6], *temp, flavor;
|
|
||||||
time_t age;
|
|
||||||
faddr *fa;
|
|
||||||
callstat *cst;
|
|
||||||
FILE *fp;
|
|
||||||
DIR *dp = NULL;
|
DIR *dp = NULL;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
if ((rc = scanout(each))) {
|
|
||||||
WriteError("Error scanning outbound, aborting");
|
|
||||||
return MBERR_OUTBOUND_SCAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check private outbound box for nodes in the setup.
|
|
||||||
* Also, check directory outbounds for FTP nodes.
|
|
||||||
*/
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
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 MBERR_OUTBOUND_SCAN;
|
|
||||||
}
|
|
||||||
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
|
|
||||||
fseek(fp, 0, SEEK_SET);
|
|
||||||
fread(&nodeshdr, nodeshdr.hdrsize, 1, fp);
|
|
||||||
pw = getpwnam((char *)"mbse");
|
pw = getpwnam((char *)"mbse");
|
||||||
|
|
||||||
while ((fread(&nodes, nodeshdr.recsize, 1, fp)) == 1) {
|
Syslog('o', "checking filebox %s (%s) flavor %c", boxpath, ascfnode(fa, 0xff), flavor);
|
||||||
if (strlen(nodes.OutBox)) {
|
|
||||||
if (nodes.Crash)
|
if ((dp = opendir(boxpath)) == NULL) {
|
||||||
flavor = 'c';
|
Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(boxpath));
|
||||||
else if (nodes.Hold)
|
|
||||||
flavor = 'h';
|
|
||||||
else
|
|
||||||
flavor = 'o';
|
|
||||||
fa = fido2faddr(nodes.Aka[0]);
|
|
||||||
Syslog('o', "checking outbox %s (%s)", nodes.OutBox, ascfnode(fa, 0x2f));
|
|
||||||
if ((dp = opendir(nodes.OutBox)) == NULL) {
|
|
||||||
Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(nodes.OutBox));
|
|
||||||
} else {
|
} else {
|
||||||
while ((de = readdir(dp))) {
|
while ((de = readdir(dp))) {
|
||||||
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
||||||
sprintf(temp, "%s/%s", nodes.OutBox, de->d_name);
|
sprintf(temp, "%s/%s", boxpath, de->d_name);
|
||||||
if (stat(temp, &sb) == 0) {
|
if (stat(temp, &sb) == 0) {
|
||||||
Syslog('o' ,"checking: \"%s\"", de->d_name);
|
Syslog('o' ,"checking: \"%s\"", de->d_name);
|
||||||
if (S_ISREG(sb.st_mode)) {
|
if (S_ISREG(sb.st_mode)) {
|
||||||
@ -159,31 +128,60 @@ int outstat()
|
|||||||
}
|
}
|
||||||
closedir(dp);
|
closedir(dp);
|
||||||
}
|
}
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int outstat()
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
struct _alist *tmp, *old;
|
||||||
|
char digit[6], flstr[6], *temp, *temp2, flavor;
|
||||||
|
time_t age;
|
||||||
|
faddr *fa;
|
||||||
|
callstat *cst;
|
||||||
|
FILE *fp;
|
||||||
|
DIR *dp = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
struct stat sb;
|
||||||
|
|
||||||
|
if ((rc = scanout(each))) {
|
||||||
|
WriteError("Error scanning outbound, aborting");
|
||||||
|
return MBERR_OUTBOUND_SCAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check private outbound box for nodes in the setup.
|
||||||
|
* Also, check directory outbounds for FTP nodes.
|
||||||
|
*/
|
||||||
|
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 MBERR_OUTBOUND_SCAN;
|
||||||
|
}
|
||||||
|
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
|
||||||
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
fread(&nodeshdr, nodeshdr.hdrsize, 1, fp);
|
||||||
|
|
||||||
|
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 = fido2faddr(nodes.Aka[0]);
|
||||||
|
checkdir(nodes.OutBox, fa, flavor);
|
||||||
tidy_faddr(fa);
|
tidy_faddr(fa);
|
||||||
}
|
}
|
||||||
if ((nodes.Session_out == S_DIR) && strlen(nodes.Dir_out_path)) {
|
if ((nodes.Session_out == S_DIR) && strlen(nodes.Dir_out_path)) {
|
||||||
fa = fido2faddr(nodes.Aka[0]);
|
fa = fido2faddr(nodes.Aka[0]);
|
||||||
flavor = 'h'; /* Directory outbound files are always on hold */
|
flavor = 'h'; /* Directory outbound files are always on hold */
|
||||||
Syslog('o', "checking directory path %s (%s)", nodes.Dir_out_path, ascfnode(fa, 0x2f));
|
checkdir(nodes.Dir_out_path, fa, flavor);
|
||||||
if ((dp = opendir(nodes.Dir_out_path)) == NULL) {
|
|
||||||
Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(nodes.Dir_out_path));
|
|
||||||
} else {
|
|
||||||
while ((de = readdir(dp))) {
|
|
||||||
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
|
||||||
sprintf(temp, "%s/%s", nodes.Dir_out_path, de->d_name);
|
|
||||||
if (stat(temp, &sb) == 0) {
|
|
||||||
if (S_ISREG(sb.st_mode)) {
|
|
||||||
each(fa, flavor, 0, temp);
|
|
||||||
} else {
|
|
||||||
Syslog('o', "not a regular file");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
WriteError("Can't stat %s", temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir(dp);
|
|
||||||
}
|
|
||||||
tidy_faddr(fa);
|
tidy_faddr(fa);
|
||||||
}
|
}
|
||||||
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
|
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
|
||||||
@ -200,22 +198,75 @@ int outstat()
|
|||||||
sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name);
|
sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name);
|
||||||
if (stat(temp, &sb) == 0) {
|
if (stat(temp, &sb) == 0) {
|
||||||
Syslog('o' ,"checking \"%s\"", de->d_name);
|
Syslog('o' ,"checking \"%s\"", de->d_name);
|
||||||
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
|
fa = (faddr*)malloc(sizeof(faddr));
|
||||||
|
fa->name = NULL;
|
||||||
|
fa->domain = NULL;
|
||||||
|
memset(&digit, 0, sizeof(digit));
|
||||||
|
digit[0] = de->d_name[0];
|
||||||
|
digit[1] = de->d_name[1];
|
||||||
|
fa->zone = strtol(digit, NULL, 32);
|
||||||
|
memset(&digit, 0, sizeof(digit));
|
||||||
|
digit[0] = de->d_name[2];
|
||||||
|
digit[1] = de->d_name[3];
|
||||||
|
digit[2] = de->d_name[4];
|
||||||
|
fa->net = strtol(digit, NULL, 32);
|
||||||
|
memset(&digit, 0, sizeof(digit));
|
||||||
|
digit[0] = de->d_name[5];
|
||||||
|
digit[1] = de->d_name[6];
|
||||||
|
digit[2] = de->d_name[7];
|
||||||
|
fa->node = strtol(digit, NULL, 32);
|
||||||
|
memset(&digit, 0, sizeof(digit));
|
||||||
|
digit[0] = de->d_name[9];
|
||||||
|
digit[1] = de->d_name[10];
|
||||||
|
fa->point = strtol(digit, NULL, 32);
|
||||||
|
if (SearchFidonet(fa->zone)) {
|
||||||
|
fa->domain = xstrcpy(fidonet.domain);
|
||||||
|
}
|
||||||
|
if ((strlen(de->d_name) == 12) && (tolower(de->d_name[11]) == 'h'))
|
||||||
|
flavor = 'h';
|
||||||
|
else
|
||||||
|
flavor = 'o';
|
||||||
|
checkdir(temp, fa, flavor);
|
||||||
|
tidy_faddr(fa);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dp);
|
closedir(dp);
|
||||||
}
|
}
|
||||||
if (strlen(CFG.tmaillong) && (dp = opendir(CFG.tmaillong))) {
|
if (strlen(CFG.tmaillong) && (dp = opendir(CFG.tmaillong))) {
|
||||||
|
temp2 = calloc(PATH_MAX, sizeof(char));
|
||||||
Syslog('o', "Checking T-Mail long box \"%s\"", CFG.tmaillong);
|
Syslog('o', "Checking T-Mail long box \"%s\"", CFG.tmaillong);
|
||||||
while ((de = readdir(dp))) {
|
while ((de = readdir(dp))) {
|
||||||
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
||||||
sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name);
|
sprintf(temp, "%s/%s", CFG.tmaillong, de->d_name);
|
||||||
if (stat(temp, &sb) == 0) {
|
if (stat(temp, &sb) == 0) {
|
||||||
Syslog('o' ,"checking \"%s\"", de->d_name);
|
Syslog('o' ,"checking \"%s\"", de->d_name);
|
||||||
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
|
sprintf(temp2, "%s", de->d_name);
|
||||||
|
fa = (faddr*)malloc(sizeof(faddr));
|
||||||
|
fa->name = NULL;
|
||||||
|
fa->domain = NULL;
|
||||||
|
fa->zone = atoi(strtok(temp2, ".\n\r\0"));
|
||||||
|
fa->net = atoi(strtok(NULL, ".\n\r\0"));
|
||||||
|
fa->node = atoi(strtok(NULL, ".\n\r\0"));
|
||||||
|
fa->point = atoi(strtok(NULL, ".\n\r\0"));
|
||||||
|
if (SearchFidonet(fa->zone)) {
|
||||||
|
fa->domain = xstrcpy(fidonet.domain);
|
||||||
|
}
|
||||||
|
if (tolower(de->d_name[strlen(de->d_name) -1]) == 'h')
|
||||||
|
flavor = 'h';
|
||||||
|
else
|
||||||
|
flavor = 'o';
|
||||||
|
checkdir(temp, fa, flavor);
|
||||||
|
tidy_faddr(fa);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dp);
|
closedir(dp);
|
||||||
|
free(temp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
@ -324,7 +375,8 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
|
|||||||
if (*p == '\\')
|
if (*p == '\\')
|
||||||
*p='/';
|
*p='/';
|
||||||
for (p = buf; *p && isspace(*p); p++);
|
for (p = buf; *p && isspace(*p); p++);
|
||||||
if (*p == '~') continue;
|
if (*p == '~')
|
||||||
|
continue;
|
||||||
if ((*p == '#') || (*p == '-') || (*p == '^') || (*p == '@'))
|
if ((*p == '#') || (*p == '-') || (*p == '^') || (*p == '@'))
|
||||||
p++;
|
p++;
|
||||||
if (stat(p, &st) != 0) {
|
if (stat(p, &st) != 0) {
|
||||||
|
196
mbtask/outstat.c
196
mbtask/outstat.c
@ -45,6 +45,7 @@ extern int do_quiet;
|
|||||||
extern int internet; /* Internet status */
|
extern int internet; /* Internet status */
|
||||||
extern struct sysconfig CFG; /* Main configuration */
|
extern struct sysconfig CFG; /* Main configuration */
|
||||||
extern struct taskrec TCFG; /* Task configuration */
|
extern struct taskrec TCFG; /* Task configuration */
|
||||||
|
extern struct _fidonet fidonet; /* Fidonet records */
|
||||||
int nxt_hour, nxt_min; /* Time of next event */
|
int nxt_hour, nxt_min; /* Time of next event */
|
||||||
int inet_calls; /* Internet calls to make */
|
int inet_calls; /* Internet calls to make */
|
||||||
int isdn_calls; /* ISDN calls to make */
|
int isdn_calls; /* ISDN calls to make */
|
||||||
@ -208,6 +209,70 @@ const char* shortboxname(const faddr *fa) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Scan one directory filebox
|
||||||
|
*/
|
||||||
|
void checkdir(char *boxpath, faddr *fa, char flavor)
|
||||||
|
{
|
||||||
|
char *temp;
|
||||||
|
DIR *dp = NULL;
|
||||||
|
struct dirent *de;
|
||||||
|
struct stat sb;
|
||||||
|
struct passwd *pw;
|
||||||
|
|
||||||
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
|
pw = getpwnam((char *)"mbse");
|
||||||
|
Syslog('o', "check filebox %s (%s) flavor %c", boxpath, ascfnode(fa, 0xff), flavor);
|
||||||
|
|
||||||
|
if ((dp = opendir(boxpath)) != NULL) {
|
||||||
|
while ((de = readdir(dp))) {
|
||||||
|
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
||||||
|
sprintf(temp, "%s/%s", boxpath, 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 {
|
||||||
|
Syslog('+', "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 {
|
||||||
|
Syslog('+', "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 {
|
||||||
|
Syslog('+', "No R/W permission on %s", temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Syslog('+', "Not a regular file: %s", temp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Syslog('?', "Can't stat %s", temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dp);
|
||||||
|
}
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan outbound, the call status is set in three counters: internet,
|
* Scan outbound, the call status is set in three counters: internet,
|
||||||
* ISDN and POTS (analogue modems).
|
* ISDN and POTS (analogue modems).
|
||||||
@ -222,7 +287,7 @@ 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], *temp, as[6], be[6], utc[6], flavor;
|
char digit[6], flstr[13], *temp, as[6], be[6], utc[6], flavor, *temp2;
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
int uhour, umin, thour, tmin;
|
int uhour, umin, thour, tmin;
|
||||||
@ -232,7 +297,6 @@ int outstat()
|
|||||||
DIR *dp = NULL;
|
DIR *dp = NULL;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
struct passwd *pw;
|
|
||||||
unsigned long cmmask, ibnmask = 0, ifcmask = 0, itnmask = 0;
|
unsigned long cmmask, ibnmask = 0, ifcmask = 0, itnmask = 0;
|
||||||
nodelist_modem **tmpm;
|
nodelist_modem **tmpm;
|
||||||
|
|
||||||
@ -282,7 +346,6 @@ int outstat()
|
|||||||
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
|
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
fread(&nodeshdr, nodeshdr.hdrsize, 1, fp);
|
fread(&nodeshdr, nodeshdr.hdrsize, 1, fp);
|
||||||
pw = getpwnam((char *)"mbse");
|
|
||||||
|
|
||||||
while ((fread(&nodes, nodeshdr.recsize, 1, fp)) == 1) {
|
while ((fread(&nodes, nodeshdr.recsize, 1, fp)) == 1) {
|
||||||
if (strlen(nodes.OutBox)) {
|
if (strlen(nodes.OutBox)) {
|
||||||
@ -301,50 +364,7 @@ int outstat()
|
|||||||
fa->node = nodes.Aka[0].node;
|
fa->node = nodes.Aka[0].node;
|
||||||
fa->point = nodes.Aka[0].point;
|
fa->point = nodes.Aka[0].point;
|
||||||
|
|
||||||
if ((dp = opendir(nodes.OutBox)) != NULL) {
|
checkdir(nodes.OutBox, fa, flavor);
|
||||||
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 {
|
|
||||||
Syslog('+', "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 {
|
|
||||||
Syslog('+', "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 {
|
|
||||||
Syslog('+', "No R/W permission on %s", temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Syslog('+', "Not a regular file: %s", temp);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Syslog('?', "Can't stat %s", temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir(dp);
|
|
||||||
}
|
|
||||||
if (fa->domain)
|
if (fa->domain)
|
||||||
free(fa->domain);
|
free(fa->domain);
|
||||||
free(fa);
|
free(fa);
|
||||||
@ -353,6 +373,88 @@ int outstat()
|
|||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start checking T-Mail fileboxes
|
||||||
|
*/
|
||||||
|
if (strlen(CFG.tmailshort) && (dp = opendir(CFG.tmailshort))) {
|
||||||
|
while ((de = readdir(dp))) {
|
||||||
|
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
||||||
|
sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name);
|
||||||
|
if (stat(temp, &sb) == 0) {
|
||||||
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
|
fa = (faddr*)malloc(sizeof(faddr));
|
||||||
|
fa->name = NULL;
|
||||||
|
fa->domain = NULL;
|
||||||
|
memset(&digit, 0, sizeof(digit));
|
||||||
|
digit[0] = de->d_name[0];
|
||||||
|
digit[1] = de->d_name[1];
|
||||||
|
fa->zone = strtol(digit, NULL, 32);
|
||||||
|
memset(&digit, 0, sizeof(digit));
|
||||||
|
digit[0] = de->d_name[2];
|
||||||
|
digit[1] = de->d_name[3];
|
||||||
|
digit[2] = de->d_name[4];
|
||||||
|
fa->net = strtol(digit, NULL, 32);
|
||||||
|
memset(&digit, 0, sizeof(digit));
|
||||||
|
digit[0] = de->d_name[5];
|
||||||
|
digit[1] = de->d_name[6];
|
||||||
|
digit[2] = de->d_name[7];
|
||||||
|
fa->node = strtol(digit, NULL, 32);
|
||||||
|
memset(&digit, 0, sizeof(digit));
|
||||||
|
digit[0] = de->d_name[9];
|
||||||
|
digit[1] = de->d_name[10];
|
||||||
|
fa->point = strtol(digit, NULL, 32);
|
||||||
|
if (SearchFidonet(fa->zone)) {
|
||||||
|
fa->domain = xstrcpy(fidonet.domain);
|
||||||
|
}
|
||||||
|
if ((strlen(de->d_name) == 12) && (tolower(de->d_name[11]) == 'h'))
|
||||||
|
flavor = 'h';
|
||||||
|
else
|
||||||
|
flavor = 'o';
|
||||||
|
checkdir(temp, fa, flavor);
|
||||||
|
if (fa->domain)
|
||||||
|
free(fa->domain);
|
||||||
|
free(fa);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dp);
|
||||||
|
}
|
||||||
|
if (strlen(CFG.tmaillong) && (dp = opendir(CFG.tmaillong))) {
|
||||||
|
temp2 = calloc(PATH_MAX, sizeof(char));
|
||||||
|
while ((de = readdir(dp))) {
|
||||||
|
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
|
||||||
|
sprintf(temp, "%s/%s", CFG.tmaillong, de->d_name);
|
||||||
|
if (stat(temp, &sb) == 0) {
|
||||||
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
|
sprintf(temp2, "%s", de->d_name);
|
||||||
|
fa = (faddr*)malloc(sizeof(faddr));
|
||||||
|
fa->name = NULL;
|
||||||
|
fa->domain = NULL;
|
||||||
|
fa->zone = atoi(strtok(temp2, ".\n\r\0"));
|
||||||
|
fa->net = atoi(strtok(NULL, ".\n\r\0"));
|
||||||
|
fa->node = atoi(strtok(NULL, ".\n\r\0"));
|
||||||
|
fa->point = atoi(strtok(NULL, ".\n\r\0"));
|
||||||
|
if (SearchFidonet(fa->zone)) {
|
||||||
|
fa->domain = xstrcpy(fidonet.domain);
|
||||||
|
}
|
||||||
|
if (tolower(de->d_name[strlen(de->d_name) -1]) == 'h')
|
||||||
|
flavor = 'h';
|
||||||
|
else
|
||||||
|
flavor = 'o';
|
||||||
|
checkdir(temp, fa, flavor);
|
||||||
|
if (fa->domain)
|
||||||
|
free(fa->domain);
|
||||||
|
free(fa);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dp);
|
||||||
|
free(temp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
|
Reference in New Issue
Block a user