Added T-Mail fileboxes support

This commit is contained in:
Michiel Broek 2004-01-14 20:51:22 +00:00
parent c4eea97ff1
commit 7d69fcdfb6
6 changed files with 402 additions and 238 deletions

View File

@ -1,5 +1,8 @@
MBSE BBS AUTHORS.
$id$
The following people are members of the MBSE BBS development team:
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
Vadim Kurland vadim@gu.kiev.ua
Vadim Zaliva lord@crocodile.kiev.ua
Przemyslaw Kwiatkowski 2:480/127@fidonet

View File

@ -6,6 +6,13 @@ v0.39.6 11-Jan-2004
New binkp/1.1 driver fixes for Sun NetBSD.
Removed TCP ignore check in EOB state.
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.
mbsetup:

View File

@ -14,7 +14,7 @@
</HEAD>
<BODY>
<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>
In this setup you can edit all global settings for MBSE BBS. All sections will
@ -64,7 +64,17 @@ group them.
<pre>
<strong>BBS Menus </strong>The path to the default menus
<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>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>Inbound </strong>The unprotected 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)
<strong>Bad TIC's </strong>Where bad TIC files are saved
<strong>TIC queue </strong>Where TIC files for downlinks are kept
<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>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>TMail DOS </strong>The T-Mail 8.3 (short) base path (empty = disable)
<strong>TMail Win </strong>The T-Mail long filename base path (empty = disable)
</pre>
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

View File

@ -306,12 +306,6 @@ file_list *create_filelist(fa_list *al, char *fl, int create)
if ((tmpa->addr) && Loaded && strlen(nodes.OutBox) &&
(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)) {
if (nodes.Crash)
flavor = 'c';
else if (nodes.Hold)
flavor = 'h';
else
flavor = 'o';
check_filebox(nodes.OutBox, st);
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: Show mail outbound status
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -67,11 +67,77 @@ static struct _alist
void checkdir(char *, faddr *, char);
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', "checking filebox %s (%s) flavor %c", boxpath, ascfnode(fa, 0xff), flavor);
if ((dp = opendir(boxpath)) == NULL) {
Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(boxpath));
} else {
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) {
Syslog('o' ,"checking: \"%s\"", de->d_name);
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, 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);
}
free(temp);
}
int outstat()
{
int rc;
struct _alist *tmp, *old;
char flstr[6], *temp, flavor;
char digit[6], flstr[6], *temp, *temp2, flavor;
time_t age;
faddr *fa;
callstat *cst;
@ -79,7 +145,6 @@ int outstat()
DIR *dp = NULL;
struct dirent *de;
struct stat sb;
struct passwd *pw;
if ((rc = scanout(each))) {
WriteError("Error scanning outbound, aborting");
@ -100,7 +165,6 @@ int outstat()
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)) {
@ -111,79 +175,13 @@ int outstat()
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 {
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) {
Syslog('o' ,"checking: \"%s\"", de->d_name);
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, 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);
}
checkdir(nodes.OutBox, fa, flavor);
tidy_faddr(fa);
}
if ((nodes.Session_out == S_DIR) && strlen(nodes.Dir_out_path)) {
fa = fido2faddr(nodes.Aka[0]);
flavor = 'h'; /* Directory outbound files are always on hold */
Syslog('o', "checking directory path %s (%s)", nodes.Dir_out_path, ascfnode(fa, 0x2f));
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);
}
checkdir(nodes.Dir_out_path, fa, flavor);
tidy_faddr(fa);
}
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
@ -200,22 +198,75 @@ int outstat()
sprintf(temp, "%s/%s", CFG.tmailshort, de->d_name);
if (stat(temp, &sb) == 0) {
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);
}
if (strlen(CFG.tmaillong) && (dp = opendir(CFG.tmaillong))) {
temp2 = calloc(PATH_MAX, sizeof(char));
Syslog('o', "Checking T-Mail long box \"%s\"", CFG.tmaillong);
while ((de = readdir(dp))) {
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) {
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);
free(temp2);
}
if (!do_quiet) {
@ -261,114 +312,115 @@ int outstat()
int each(faddr *addr, char flavor, int isflo, char *fname)
{
struct _alist **tmp;
struct stat st;
FILE *fp;
char buf[256], *p;
struct _alist **tmp;
struct stat st;
FILE *fp;
char buf[256], *p;
Syslog('o', "each(%s, %c, %s, %s)", ascfnode(addr, 0x2f), flavor, isflo?"isflo":"noflo", fname);
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))
return 0;
if ((isflo != OUT_PKT) && (isflo != OUT_FLO) && (isflo != OUT_REQ) && (isflo != OUT_POL))
return 0;
for (tmp = &alist; *tmp; tmp = &((*tmp)->next))
if (((*tmp)->addr.zone == addr->zone) && ((*tmp)->addr.net == addr->net) &&
for (tmp = &alist; *tmp; tmp = &((*tmp)->next))
if (((*tmp)->addr.zone == addr->zone) && ((*tmp)->addr.net == addr->net) &&
((*tmp)->addr.node == addr->node) && ((*tmp)->addr.point == addr->point) &&
(((*tmp)->addr.domain == NULL) || (addr->domain == NULL) ||
(strcasecmp((*tmp)->addr.domain,addr->domain) == 0)))
break;
if (*tmp == NULL) {
*tmp = (struct _alist *)malloc(sizeof(struct _alist));
(*tmp)->next = NULL;
(*tmp)->addr.name = NULL;
(*tmp)->addr.zone = addr->zone;
(*tmp)->addr.net = addr->net;
(*tmp)->addr.node = addr->node;
(*tmp)->addr.point = addr->point;
(*tmp)->addr.domain = xstrcpy(addr->domain);
(*tmp)->flavors = 0;
(*tmp)->time = time(NULL);
(*tmp)->size = 0L;
break;
if (*tmp == NULL) {
*tmp = (struct _alist *)malloc(sizeof(struct _alist));
(*tmp)->next = NULL;
(*tmp)->addr.name = NULL;
(*tmp)->addr.zone = addr->zone;
(*tmp)->addr.net = addr->net;
(*tmp)->addr.node = addr->node;
(*tmp)->addr.point = addr->point;
(*tmp)->addr.domain = xstrcpy(addr->domain);
(*tmp)->flavors = 0;
(*tmp)->time = time(NULL);
(*tmp)->size = 0L;
}
if ((isflo == OUT_FLO) || (isflo == OUT_PKT))
switch (flavor) {
case '?': break;
case 'i': (*tmp)->flavors |= F_IMM; break;
case 'o': (*tmp)->flavors |= F_NORMAL; break;
case 'c': (*tmp)->flavors |= F_CRASH; break;
case 'h': (*tmp)->flavors |= F_HOLD; break;
default: WriteError("Unknown flavor: '%c'\n",flavor); break;
}
if ((isflo == OUT_FLO) || (isflo == OUT_PKT))
switch (flavor) {
case '?': break;
case 'i': (*tmp)->flavors |= F_IMM; break;
case 'o': (*tmp)->flavors |= F_NORMAL; break;
case 'c': (*tmp)->flavors |= F_CRASH; break;
case 'h': (*tmp)->flavors |= F_HOLD; break;
default: WriteError("Unknown flavor: '%c'\n",flavor); break;
if (stat(fname,&st) != 0) {
WriteError("$Can't stat %s", fname);
st.st_size = 0L;
st.st_mtime = time(NULL);
}
/*
* Find the oldest time
*/
if (st.st_mtime < (*tmp)->time)
(*tmp)->time = st.st_mtime;
if (isflo == OUT_FLO) {
if ((fp = fopen(fname,"r"))) {
while (fgets(buf, sizeof(buf) - 1, fp)) {
if (*(p = buf + strlen(buf) - 1) == '\n')
*p-- = '\0';
while (isspace(*p))
*p-- = '\0';
for (p = buf; *p; p++)
if (*p == '\\')
*p='/';
for (p = buf; *p && isspace(*p); p++);
if (*p == '~')
continue;
if ((*p == '#') || (*p == '-') || (*p == '^') || (*p == '@'))
p++;
if (stat(p, &st) != 0) {
if (strlen(CFG.dospath)) {
if (stat(Dos2Unix(p), &st) != 0) {
/*
* Fileattach dissapeared, maybe
* the node doesn't poll enough and
* is losing mail or files.
*/
st.st_size = 0L;
st.st_mtime = time(NULL);
}
} else {
if (stat(p, &st) != 0) {
st.st_size = 0L;
st.st_mtime = time(NULL);
}
}
}
if (stat(fname,&st) != 0) {
WriteError("$Can't stat %s", fname);
st.st_size = 0L;
st.st_mtime = time(NULL);
}
/*
* Find the oldest time
*/
if (st.st_mtime < (*tmp)->time)
(*tmp)->time = st.st_mtime;
if (isflo == OUT_FLO) {
if ((fp = fopen(fname,"r"))) {
while (fgets(buf, sizeof(buf) - 1, fp)) {
if (*(p = buf + strlen(buf) - 1) == '\n')
*p-- = '\0';
while (isspace(*p))
*p-- = '\0';
for (p = buf; *p; p++)
if (*p == '\\')
*p='/';
for (p = buf; *p && isspace(*p); p++);
if (*p == '~') continue;
if ((*p == '#') || (*p == '-') || (*p == '^') || (*p == '@'))
p++;
if (stat(p, &st) != 0) {
if (strlen(CFG.dospath)) {
if (stat(Dos2Unix(p), &st) != 0) {
/*
* Fileattach dissapeared, maybe
* the node doesn't poll enough and
* is losing mail or files.
*/
st.st_size = 0L;
st.st_mtime = time(NULL);
}
} else {
if (stat(p, &st) != 0) {
st.st_size = 0L;
st.st_mtime = time(NULL);
}
}
}
if ((p = strrchr(fname,'/')))
p++;
else
p = fname;
if ((strlen(p) == 12) && (strspn(p,"0123456789abcdefABCDEF") == 8) && (p[8] == '.')) {
if (st.st_mtime < (*tmp)->time)
(*tmp)->time = st.st_mtime;
}
(*tmp)->size += st.st_size;
}
fclose(fp);
} else
WriteError("Can't open %s", fname);
} else if (isflo == OUT_PKT) {
if ((p = strrchr(fname,'/')))
p++;
else
p = fname;
if ((strlen(p) == 12) && (strspn(p,"0123456789abcdefABCDEF") == 8) && (p[8] == '.')) {
if (st.st_mtime < (*tmp)->time)
(*tmp)->time = st.st_mtime;
}
(*tmp)->size += st.st_size;
} else if (isflo == OUT_REQ) {
(*tmp)->flavors |= F_FREQ;
} else if (isflo == OUT_POL) {
(*tmp)->flavors |= F_POLL;
}
}
fclose(fp);
} else
WriteError("Can't open %s", fname);
return 0;
} else if (isflo == OUT_PKT) {
(*tmp)->size += st.st_size;
} else if (isflo == OUT_REQ) {
(*tmp)->flavors |= F_FREQ;
} else if (isflo == OUT_POL) {
(*tmp)->flavors |= F_POLL;
}
return 0;
}
@ -376,15 +428,15 @@ int each(faddr *addr, char flavor, int isflo, char *fname)
int IsZMH(void);
int IsZMH()
{
static char buf[81];
static char buf[81];
sprintf(buf, "SBBS:0;");
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:2,2", 7) == 0)
return TRUE;
}
return FALSE;
sprintf(buf, "SBBS:0;");
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:2,2", 7) == 0)
return TRUE;
}
return FALSE;
}

View File

@ -45,6 +45,7 @@ extern int do_quiet;
extern int internet; /* Internet status */
extern struct sysconfig CFG; /* Main configuration */
extern struct taskrec TCFG; /* Task configuration */
extern struct _fidonet fidonet; /* Fidonet records */
int nxt_hour, nxt_min; /* Time of next event */
int inet_calls; /* Internet 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,
* ISDN and POTS (analogue modems).
@ -222,7 +287,7 @@ int outstat()
{
int rc, first = TRUE, T_window, iszmh = FALSE;
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;
struct tm *tm;
int uhour, umin, thour, tmin;
@ -232,7 +297,6 @@ int outstat()
DIR *dp = NULL;
struct dirent *de;
struct stat sb;
struct passwd *pw;
unsigned long cmmask, ibnmask = 0, ifcmask = 0, itnmask = 0;
nodelist_modem **tmpm;
@ -282,7 +346,6 @@ int outstat()
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)) {
@ -301,50 +364,7 @@ int outstat()
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 {
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);
}
checkdir(nodes.OutBox, fa, flavor);
if (fa->domain)
free(fa->domain);
free(fa);
@ -353,6 +373,88 @@ int outstat()
}
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,
* ie. the time when the callout status of a node changes because of starting a