A lot of fixes found with valgrind

This commit is contained in:
Michiel Broek 2003-12-04 22:07:33 +00:00
parent fab5a2edae
commit f0bbdba104
37 changed files with 2267 additions and 1427 deletions

View File

@ -2,24 +2,67 @@ $Id$
v0.39.3 26-Nov-2003
WARNING: NOT EVERYTHING IS TESTED, WAIT A FEW DAYS AND DON'T USE THIS.
general:
Since this version Posix threads are being used, please let
me know if this doesn't compile on you system.
All Makefiles do not strip the binaries anymore, the binaries
are stripped during make install only. This allows to run the
not yet installed binaries under debuggers.
The configure script has a --enable-debugging option so that
all code can be compiled to let it run under debuggers.
libclcomm:
Fixed a small (not harmfull) buffer overlapped copy detected
by valgrind.
libcommon:
Code cleanup in proglock and pktname.
Fixed a forgotten fclose in proglock.
libmsgbase:
In JAM_Open replaced a strcpy with memmove.
mbcico:
Dropped binkp CRC support because it will be incompatible with
future extensions.
Fixed a small memory leak.
mbfido:
Fixed a small memory leak.
mbfile:
Fixed a uninitialized memory pointer in the index command.
mbindex:
Fixed a forgotten file close.
mbsetup:
Removed binkp CRC settings.
Fixed a unitialized unlink call in nodes close.
Fixed unclosed tempfile.
Fixed several small memory leaks.
mbsebbs:
Fixed small memory leak.
mball:
Fixed 2 forgotten fclose functions.
mbuser:
Fixed a forgotten file close when nothing was done.
mbmon:
Fixed a minor problem with an uninitialized array.
mbtask:
The ping function now runs in a separate thread.
Changed some ping timer logic.
mbpasswd:
Fixed a small memory leak.
v0.39.2 21-Nov-2003 - 26-Nov-2003

View File

@ -33,6 +33,7 @@ MAKE = @MAKE@
JOEBIN = @joebin@
JOELIB = @joelib@
CFLAGS = -O2 -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -pipe
CFLAGS = @COMPILEFLAGS@
LIBS = @LIBS@
PTLIBS = @PTLIBS@

18
TODO
View File

@ -29,7 +29,12 @@ libdiesel.a:
U: Processed stringlines containing unbalanced " characters are not
processed, instead the previous macro value will be returned.
mbtask:
N: Test with valgrind.
mbsebbs:
N: Test with valgrind.
X: Better word wrapping or paragraph justification in editor.
X: E-mail downloads with e-mail verification.
@ -57,6 +62,8 @@ mbsebbs:
N: Reimplememnt CHRS kludge.
newuser:
N: Test with valgrind.
L: Allow handles to be the same as the unixname.
@ -108,7 +115,13 @@ mbfido:
N: With auto created areas golded.inc is not adjusted to the new
setup.
N: After readalias we need to free the alias list when mbfido ends.
N: Tic, toss, scan tests with valgrind.
mbcico:
N: Test with valgrind, binkp is ok.
N: Upgrade binkp protocol to 1.1.
N: With binkp, if the other node is a binkp/1.0 mailer without MB
@ -120,6 +133,9 @@ mbcico:
U: Fix binkp file resume when mbcico silently dies.
mbout:
N: Fix prepbuf in libcommon so that valgind can test this.
mbfile:
L: Add a check to see if the magic filenames are (still) valid.
@ -129,6 +145,8 @@ mbfile:
L: Possibility to skip file areas from checking and reindexing.
N: Test with valgrind.
mbmsg:
N: With the post command if a netmail area is used the netmail area
will cause trouble later, should be blocked to be used on netmail

2484
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -55,11 +55,19 @@ CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes"
dnl Additional commandline switches
AC_ARG_ENABLE(experiment, [ --enable-experiment Compile experimental code], [ experiment=$enableval ], [ experiment=no ])
if test "$experiment" = "yes"; then
AC_DEFINE(USE_EXPERIMENT)
fi
AC_ARG_ENABLE(debugging, [ --enable-debugging Compile for debugging], [ debugging=$enableval ], [ debugging=no ])
if test "$debugging" = "yes"; then
COMPILEFLAGS="-O -g -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -pipe"
else
COMPILEFLAGS="-O2 -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -pipe"
fi
AC_SUBST(COMPILEFLAGS)
dnl Defines for MBSE BBS (must use tests or --enable-stuff later)
AC_DEFINE_UNQUOTED(RESTAMP_OLD_POSTINGS, 21)
AC_DEFINE(RESTAMP_FUTURE_POSTINGS)
@ -140,15 +148,16 @@ fi
PTHREADS=No
AC_CHECK_LIB(pthread,pthread_create,result=yes,result=no)
if test "$result" = "yes"; then
LIBS="$LIBS -lpthread"
PTLIBS="$PTLIBS -lpthread"
AC_CHECK_HEADERS(pthread.h,PTHREADS=Yes,PTHREADS=No)
else
AC_CHECK_LIB(c_r,pthread_create,result=yes,result=no)
if test "$result" = "yes"; then
LIBS="$LIBS -lc_r"
PTLIBS="$PTLIBS -lc_r"
AC_CHECK_HEADERS(pthread.h,PTHREADS=Yes,PTHREADS=No)
fi
fi
AC_SUBST(PTLIBS)
dnl Checks for header files.
AC_HEADER_STDC

View File

@ -49,88 +49,87 @@ char cpath[108]; /* Client socket path */
int socket_connect(char *user, char *prg, char *city)
{
int s;
static char buf[SS_BUFSIZE];
static char tty[18];
int s;
static char buf[SS_BUFSIZE], tty[18];
myname = prg;
myname = prg;
/*
* Create Unix Datagram socket for the client.
*/
s = socket(AF_UNIX, SOCK_DGRAM, 0);
if (s == -1) {
perror(myname);
printf("Unable to create Unix Datagram socket\n");
return -1;
}
/*
* Create Unix Datagram socket for the client.
*/
s = socket(AF_UNIX, SOCK_DGRAM, 0);
if (s == -1) {
perror(myname);
printf("Unable to create Unix Datagram socket\n");
return -1;
}
/*
* Client will bind to an address so the server will get
* an address in its recvfrom call and use it to send
* data back to the client.
*/
memset(&clntaddr, 0, sizeof(clntaddr));
clntaddr.sun_family = AF_UNIX;
strcpy(clntaddr.sun_path, cpath);
/*
* Client will bind to an address so the server will get
* an address in its recvfrom call and use it to send
* data back to the client.
*/
memset(&clntaddr, 0, sizeof(clntaddr));
clntaddr.sun_family = AF_UNIX;
strcpy(clntaddr.sun_path, cpath);
if (bind(s, (struct sockaddr *)&clntaddr, sizeof(clntaddr)) < 0) {
close(s);
perror(myname);
printf("Can't bind socket %s\n", cpath);
return -1;
}
if (bind(s, (struct sockaddr *)&clntaddr, sizeof(clntaddr)) < 0) {
close(s);
perror(myname);
printf("Can't bind socket %s\n", cpath);
return -1;
}
/*
* If running seteuid as another user, chown to mbse.bbs
*/
if (getuid() != geteuid()) {
chown(cpath, getuid(), getgid());
} else {
chmod(cpath, 0775);
}
/*
* If running seteuid as another user, chown to mbse.bbs
*/
if (getuid() != geteuid()) {
chown(cpath, getuid(), getgid());
} else {
chmod(cpath, 0775);
}
/*
* Setup address structure for the server socket.
*/
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
strcpy(servaddr.sun_path, spath);
/*
* Setup address structure for the server socket.
*/
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
strcpy(servaddr.sun_path, spath);
/*
* Now that we have an connection, we gather
* information to tell the server who we are.
*/
if (isatty(1) && (ttyname(1) != NULL)) {
strcpy(tty, ttyname(1));
if (strchr(tty, 'p'))
memccpy(tty, index(tty, 'p'), '\0', strlen(tty));
else if (strchr(tty, 't'))
memccpy(tty, index(tty, 't'), '\0', strlen(tty));
else if (strchr(tty, 'c'))
memccpy(tty, index(tty, 'c'), '\0', strlen(tty));
} else {
strcpy(tty, "-");
}
sock = s;
/*
* Send the information to the server.
*/
sprintf(buf, "AINI:5,%d,%s,%s,%s,%s;", getpid(), tty, user, prg, city);
if (socket_send(buf) != 0) {
sock = -1;
return -1;
}
/*
* Now that we have an connection, we gather
* information to tell the server who we are.
*/
if (isatty(1) && (ttyname(1) != NULL)) {
strcpy(tty, ttyname(1));
if (strchr(tty, 'p'))
strcpy(tty, index(tty, 'p'));
else if (strchr(tty, 't'))
strcpy(tty, index(tty, 't'));
else if (strchr(tty, 'c'))
strcpy(tty, index(tty, 'c'));
} else {
strcpy(tty, "-");
}
sock = s;
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) != 0) {
printf("AINI not acknowledged by the server\n");
sock = -1;
return -1;
}
/*
* Send the information to the server.
*/
sprintf(buf, "AINI:5,%d,%s,%s,%s,%s;", getpid(), tty, user, prg, city);
if (socket_send(buf) != 0) {
sock = -1;
return -1;
}
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) != 0) {
printf("AINI not acknowledged by the server\n");
sock = -1;
return -1;
}
return s;
return s;
}
@ -140,14 +139,14 @@ int socket_connect(char *user, char *prg, char *city)
*/
int socket_send(char *buf)
{
if (sock == -1)
return -1;
if (sock == -1)
return -1;
if (sendto(sock, buf, strlen(buf), 0, (struct sockaddr *)&servaddr, sizeof(servaddr)) != strlen(buf)) {
printf("Socket send failed error %d\n", errno);
return -1;
}
return 0;
if (sendto(sock, buf, strlen(buf), 0, (struct sockaddr *)&servaddr, sizeof(servaddr)) != strlen(buf)) {
printf("Socket send failed error %d\n", errno);
return -1;
}
return 0;
}
@ -158,19 +157,19 @@ int socket_send(char *buf)
*/
char *socket_receive(void)
{
static char buf[SS_BUFSIZE];
int rlen;
static char buf[SS_BUFSIZE];
int rlen;
memset((char *)&buf, 0, SS_BUFSIZE);
fromlen = sizeof(from);
rlen = recvfrom(sock, buf, SS_BUFSIZE, 0, (struct sockaddr *)&from, &fromlen);
if (rlen == -1) {
perror("recv");
printf("Error reading socket\n");
memset((char *)&buf, 0, SS_BUFSIZE);
return buf;
}
return buf;
memset((char *)&buf, 0, SS_BUFSIZE);
fromlen = sizeof(from);
rlen = recvfrom(sock, buf, SS_BUFSIZE, 0, (struct sockaddr *)&from, &fromlen);
if (rlen == -1) {
perror("recv");
printf("Error reading socket\n");
memset((char *)&buf, 0, SS_BUFSIZE);
return buf;
}
return buf;
}
@ -186,28 +185,28 @@ char *socket_receive(void)
int socket_shutdown(pid_t pid)
{
static char buf[SS_BUFSIZE];
static char buf[SS_BUFSIZE];
if (sock == -1)
return 0;
sprintf(buf, "ACLO:1,%d;", pid);
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "107:0;", 6) != 0) {
printf("Shutdown not acknowledged by the server\n");
printf("Got \"%s\"\n", buf);
}
}
if (shutdown(sock, 1) == -1) {
perror(myname);
printf("Cannot shutdown socket\n");
return -1;
}
sock = -1;
if (sock == -1)
return 0;
sprintf(buf, "ACLO:1,%d;", pid);
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "107:0;", 6) != 0) {
printf("Shutdown not acknowledged by the server\n");
printf("Got \"%s\"\n", buf);
}
}
if (shutdown(sock, 1) == -1) {
perror(myname);
printf("Cannot shutdown socket\n");
return -1;
}
sock = -1;
return 0;
}

View File

@ -303,7 +303,6 @@ int noderecord(faddr *);
/*
* From pktname.c
*/
char *prepbuf(faddr *);
char *pktname(faddr *, char);
char *reqname(faddr *);
char *floname(faddr *, char);

View File

@ -10,7 +10,7 @@
* MBSE BBS and utilities.
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -566,7 +566,7 @@ int JAM_Open(char *Msgbase)
fdJlr = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
RetVal = TRUE;
strcpy(BaseName, Msgbase);
memmove(BaseName, Msgbase, strlen(Msgbase));
} else {
close(fdHdr);
fdHdr = -1;

View File

@ -4,7 +4,7 @@
* Purpose ...............: BinkleyTerm outbound naming
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -51,172 +51,175 @@
#define ltyp "pol"
static char buf[PATH_MAX];
char *prepbuf(faddr *);
char *prepbuf(faddr *addr)
{
char *p, *domain=NULL;
char zpref[8];
int i;
static char buf[PATH_MAX];
char *p, *domain=NULL, zpref[8];
int i;
sprintf(buf, "%s", CFG.outbound);
sprintf(buf, "%s", CFG.outbound);
if (CFG.addr4d) {
Syslog('o', "Use 4d addressing, zone is %d", addr->zone);
if (CFG.addr4d) {
Syslog('o', "Use 4d addressing, zone is %d", addr->zone);
if ((addr->zone == 0) || (addr->zone == CFG.aka[0].zone))
zpref[0] = '\0';
else
sprintf(zpref, ".%03x", addr->zone);
} else {
/*
* If we got a 5d address we use the given domain, if
* we got a 4d address, we look for a matching domain name.
*/
if (addr->domain)
domain = xstrcpy(addr->domain);
else
for (i = 0; i < 40; i++)
if (CFG.aka[i].zone == addr->zone) {
domain = xstrcpy(CFG.aka[i].domain);
break;
}
if ((domain != NULL) && (strlen(CFG.aka[0].domain) != 0) &&
(strcasecmp(domain,CFG.aka[0].domain) != 0)) {
if ((p = strrchr(buf,'/')))
p++;
else
p = buf;
strcpy(p, domain);
for (; *p; p++)
*p = tolower(*p);
for (i = 0; i < 40; i++)
if ((strlen(CFG.aka[i].domain)) &&
(strcasecmp(CFG.aka[i].domain, domain) == 0))
break;
/*
* The default zone must be the first one in the
* setup, other zones get the hexadecimal zone
* number appended.
*/
if (CFG.aka[i].zone == addr->zone)
zpref[0] = '\0';
else
sprintf(zpref, ".%03x", addr->zone);
} else {
/*
* this is our primary domain
*/
if ((addr->zone == 0) || (addr->zone == CFG.aka[0].zone))
zpref[0]='\0';
else
sprintf(zpref,".%03x",addr->zone);
}
}
p = buf + strlen(buf);
if (addr->point)
sprintf(p,"%s/%04x%04x.pnt/%08x.", zpref,addr->net,addr->node,addr->point);
if ((addr->zone == 0) || (addr->zone == CFG.aka[0].zone))
zpref[0] = '\0';
else
sprintf(p,"%s/%04x%04x.",zpref,addr->net,addr->node);
sprintf(zpref, ".%03x", addr->zone);
} else {
/*
* If we got a 5d address we use the given domain, if
* we got a 4d address, we look for a matching domain name.
*/
if (addr && addr->domain && strlen(addr->domain)) {
domain = xstrcpy(addr->domain);
} else
for (i = 0; i < 40; i++)
if (CFG.aka[i].zone == addr->zone) {
domain = xstrcpy(CFG.aka[i].domain);
break;
}
p = buf + strlen(buf);
if (domain)
free(domain);
return p;
if ((domain != NULL) && (strlen(CFG.aka[0].domain) != 0) && (strcasecmp(domain,CFG.aka[0].domain) != 0)) {
if ((p = strrchr(buf,'/')))
p++;
else
p = buf;
strcpy(p, domain);
for (; *p; p++)
*p = tolower(*p);
for (i = 0; i < 40; i++)
if ((strlen(CFG.aka[i].domain)) && (strcasecmp(CFG.aka[i].domain, domain) == 0))
break;
/*
* The default zone must be the first one in the
* setup, other zones get the hexadecimal zone
* number appended.
*/
if (CFG.aka[i].zone == addr->zone)
zpref[0] = '\0';
else
sprintf(zpref, ".%03x", addr->zone);
} else {
/*
* this is our primary domain
*/
if ((addr->zone == 0) || (addr->zone == CFG.aka[0].zone))
zpref[0]='\0';
else
sprintf(zpref,".%03x",addr->zone);
}
}
p = buf + strlen(buf);
if (addr->point)
sprintf(p,"%s/%04x%04x.pnt/%08x.", zpref,addr->net,addr->node,addr->point);
else
sprintf(p,"%s/%04x%04x.",zpref,addr->net,addr->node);
if (domain)
free(domain);
return buf;
}
char *pktname(faddr *addr, char flavor)
{
char *p;
static char *p, *q;
p = prepbuf(addr);
if (flavor == 'f')
flavor = 'o';
p = prepbuf(addr);
if (flavor == 'f')
flavor = 'o';
sprintf(p, "%c%s", flavor, ptyp);
Syslog('O', "packet name is \"%s\"",buf);
return buf;
q = p + strlen(p);
sprintf(q, "%c%s", flavor, ptyp);
Syslog('O', "packet name is \"%s\"", p);
return p;
}
char *floname(faddr *addr, char flavor)
{
char *p;
static char *p, *q;
p = prepbuf(addr);
if (flavor == 'o')
flavor = 'f';
sprintf(p, "%c%s", flavor, ftyp);
Syslog('O', "flo file name is \"%s\"",buf);
return buf;
p = prepbuf(addr);
if (flavor == 'o')
flavor = 'f';
q = p + strlen(p);
sprintf(q, "%c%s", flavor, ftyp);
Syslog('O', "flo file name is \"%s\"", p);
return p;
}
char *reqname(faddr *addr)
{
char *p;
static char *p, *q;
p = prepbuf(addr);
sprintf(p, "%s", rtyp);
Syslog('O', "req file name is \"%s\"",buf);
return buf;
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", rtyp);
Syslog('O', "req file name is \"%s\"", p);
return p;
}
char *splname(faddr *addr)
{
char *p;
static char *p, *q;
p = prepbuf(addr);
sprintf(p, "%s", styp);
Syslog('O', "spl file name is \"%s\"",buf);
return buf;
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", styp);
Syslog('O', "spl file name is \"%s\"", p);
return p;
}
char *bsyname(faddr *addr)
{
char *p;
static char *p, *q;
p = prepbuf(addr);
sprintf(p, "%s", btyp);
Syslog('O', "bsy file name is \"%s\"",buf);
return buf;
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", btyp);
Syslog('O', "bsy file name is \"%s\"", p);
return p;
}
char *stsname(faddr *addr)
{
char *p;
static char *p, *q;
p = prepbuf(addr);
sprintf(p, "%s", qtyp);
Syslog('O', "sts file name is \"%s\"",buf);
return buf;
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", qtyp);
Syslog('O', "sts file name is \"%s\"", p);
return p;
}
char *polname(faddr *addr)
{
char *p;
static char *p, *q;
p = prepbuf(addr);
sprintf(p, "%s", ltyp);
Syslog('O', "pol file name is \"%s\"", buf);
return buf;
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", ltyp);
Syslog('O', "pol file name is \"%s\"", p);
return p;
}
@ -226,20 +229,22 @@ static char *dow[] = {(char *)"su", (char *)"mo", (char *)"tu", (char *)"we",
char *dayname(void)
{
time_t tt;
struct tm *ptm;
time_t tt;
struct tm *ptm;
static char buf[3];
tt = time(NULL);
ptm = localtime(&tt);
sprintf(buf, "%s", dow[ptm->tm_wday]);
tt = time(NULL);
ptm = localtime(&tt);
sprintf(buf, "%s", dow[ptm->tm_wday]);
return buf;
return buf;
}
char *arcname(faddr *addr, unsigned short Zone, int ARCmailCompat)
{
static char *buf;
char *p;
char *ext;
time_t tt;
@ -252,7 +257,7 @@ char *arcname(faddr *addr, unsigned short Zone, int ARCmailCompat)
bestaka = bestaka_s(addr);
(void)prepbuf(addr);
buf = prepbuf(addr);
p = strrchr(buf, '/');
if (!ARCmailCompat && (Zone != addr->zone)) {

View File

@ -127,18 +127,14 @@ void ulockprogram(char *progname)
free(lockfile);
return;
}
if (fscanf(fp, "%u", &oldpid) != 1) {
WriteError("$Can't read old pid from \"%s\"", lockfile);
fclose(fp);
unlink(lockfile);
free(lockfile);
return;
}
if (oldpid == getpid()) {
(void)unlink(lockfile);
}
fclose(fp);
unlink(lockfile);
free(lockfile);
lockfile = NULL;
}

View File

@ -136,7 +136,10 @@ void die(int onsig)
t_end = time(NULL);
Syslog(' ', "MBCICO finished in %s", t_elapsed(t_start, t_end));
free_mem();
deinitnl();
if (envptr)
free(envptr);
ExitClient(onsig);
@ -190,9 +193,9 @@ int main(int argc, char *argv[])
* Catch all signals we can, and ignore the rest.
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL)) {
if ((i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) {
signal(i, (void (*))die);
} else {
} else if ((i != SIGKILL) && (i != SIGSTOP)) {
signal(i, SIG_IGN);
}
}

View File

@ -43,6 +43,7 @@
#include "outstat.h"
#include "nlinfo.h"
extern int most_debug;
extern int do_quiet; /* Suppress screen output */
int do_attach = FALSE; /* Send file attaches */
@ -179,6 +180,8 @@ int main(int argc, char *argv[])
FILE *fl;
unsigned long cmmask;
most_debug = TRUE;
InitConfig();
InitNode();
InitFidonet();

View File

@ -373,7 +373,7 @@ int poll(faddr *addr, int stop)
if (addr == NULL)
return 0;
pol = polname(addr);
pol = xstrcpy(polname(addr));
if (stop) {
if (access(pol, R_OK) == 0) {
@ -393,18 +393,21 @@ int poll(faddr *addr, int stop)
Syslog('+', "Node %s not in nodelist", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s not in nodelist", ascfnode(addr, 0x1f));
free(pol);
return MBERR_NODE_NOT_IN_LIST;
}
if (nlent->pflag == NL_DOWN) {
Syslog('+', "Node %s has status Down", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s has status Down", ascfnode(addr, 0x1f));
free(pol);
return MBERR_NODE_MAY_NOT_CALL;
}
if (nlent->pflag == NL_HOLD) {
Syslog('+', "Node %s has status Hold", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s has status Hold", ascfnode(addr, 0x1f));
free(pol);
return MBERR_NODE_MAY_NOT_CALL;
}
@ -438,6 +441,7 @@ int poll(faddr *addr, int stop)
}
}
free(pol);
return 0;
}

View File

@ -215,6 +215,7 @@ int dirinbound(void)
}
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
}
fclose(fp);
}
free(temp);
Syslog('m', "Finished directory inbound sessions");

View File

@ -4,7 +4,7 @@
* Purpose ...............: Announce new files and FileFind
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -112,7 +112,7 @@ int main(int argc, char **argv)
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}

View File

@ -130,9 +130,9 @@ int main(int argc, char **argv)
* Catch all signals we can, and ignore the rest.
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGKILL))
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV))
signal(i, (void (*))die);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}

View File

@ -202,6 +202,7 @@ void die(int onsig)
Msg_Close();
signal(onsig, SIG_IGN);
deinitnl();
if (!do_quiet) {
show_log = TRUE;
@ -320,9 +321,9 @@ int main(int argc, char **argv)
*/
for(i = 0; i < NSIG; i++) {
if ((i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
if ((i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}

View File

@ -88,9 +88,9 @@ int main(int argc, char **argv)
* Catch all signals we can, and ignore the rest.
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGKILL) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}

View File

@ -324,9 +324,9 @@ void closepage(FILE *fa, char *Path, int inArea, int Current, FILE *fi)
sprintf(temp2, "%s/index.temp", Path);
}
rename(temp2, temp1);
chmod(temp1, 0644);
free(temp1);
free(temp2);
chmod(temp1, 0644);
fa = NULL;
}

View File

@ -154,7 +154,7 @@ int main(int argc,char *argv[])
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV))
signal(i, (void (*))die);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}
@ -581,6 +581,7 @@ int compile(char *nlname, unsigned short zo, unsigned short ne, unsigned short n
fill_nllist(ndx, &nll);
}
fclose(nl);
Syslog('+', "%d entries", entries);
if (!do_quiet) {

View File

@ -83,100 +83,99 @@ void ProgName()
int main(int argc, char **argv)
{
int i;
char *cmd, *too = NULL, *subj = NULL, *mfile = NULL, *flavor = NULL;
struct passwd *pw;
long tarea = 0;
int i;
char *cmd, *too = NULL, *subj = NULL, *mfile = NULL, *flavor = NULL;
struct passwd *pw;
long tarea = 0;
InitConfig();
TermInit(1);
oldmask = umask(007);
t_start = time(NULL);
InitConfig();
TermInit(1);
oldmask = umask(007);
t_start = time(NULL);
/*
* Catch all signals we can, and ignore or catch them
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) ||
(i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
signal(i, (void (*))die);
else
signal(i, SIG_IGN);
/*
* Catch all signals we can, and ignore or catch them
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}
if (argc < 2)
Help();
cmd = xstrcpy((char *)"Cmd:");
for (i = 1; i < argc; i++) {
cmd = xstrcat(cmd, (char *)" ");
cmd = xstrcat(cmd, argv[i]);
if (strncasecmp(argv[i], "i", 1) == 0)
do_index = TRUE;
if (strncasecmp(argv[i], "l", 1) == 0)
do_link = TRUE;
if (strncasecmp(argv[i], "k", 1) == 0)
do_kill = TRUE;
if (strncasecmp(argv[i], "pa", 2) == 0)
do_pack = TRUE;
if (strncasecmp(argv[i], "po", 2) == 0) {
do_post = TRUE;
too = argv[++i];
cmd = xstrcat(cmd, (char *)" \"");
cmd = xstrcat(cmd, too);
tarea = atoi(argv[++i]);
cmd = xstrcat(cmd, (char *)"\" ");
cmd = xstrcat(cmd, argv[i]);
subj = argv[++i];
cmd = xstrcat(cmd, (char *)" \"");
cmd = xstrcat(cmd, subj);
mfile = argv[++i];
cmd = xstrcat(cmd, (char *)"\" ");
cmd = xstrcat(cmd, mfile);
flavor = argv[++i];
cmd = xstrcat(cmd, (char *)" ");
cmd = xstrcat(cmd, flavor);
}
if (argc < 2)
Help();
cmd = xstrcpy((char *)"Cmd:");
for (i = 1; i < argc; i++) {
cmd = xstrcat(cmd, (char *)" ");
cmd = xstrcat(cmd, argv[i]);
if (strncasecmp(argv[i], "i", 1) == 0)
do_index = TRUE;
if (strncasecmp(argv[i], "l", 1) == 0)
do_link = TRUE;
if (strncasecmp(argv[i], "k", 1) == 0)
do_kill = TRUE;
if (strncasecmp(argv[i], "pa", 2) == 0)
do_pack = TRUE;
if (strncasecmp(argv[i], "po", 2) == 0) {
do_post = TRUE;
too = argv[++i];
cmd = xstrcat(cmd, (char *)" \"");
cmd = xstrcat(cmd, too);
tarea = atoi(argv[++i]);
cmd = xstrcat(cmd, (char *)"\" ");
cmd = xstrcat(cmd, argv[i]);
subj = argv[++i];
cmd = xstrcat(cmd, (char *)" \"");
cmd = xstrcat(cmd, subj);
mfile = argv[++i];
cmd = xstrcat(cmd, (char *)"\" ");
cmd = xstrcat(cmd, mfile);
flavor = argv[++i];
cmd = xstrcat(cmd, (char *)" ");
cmd = xstrcat(cmd, flavor);
}
if (strncasecmp(argv[i], "-a", 2) == 0) {
i++;
do_area = atoi(argv[i]);
}
if (strncasecmp(argv[i], "-q", 2) == 0)
do_quiet = TRUE;
if (strncasecmp(argv[i], "-a", 2) == 0) {
i++;
do_area = atoi(argv[i]);
}
if (strncasecmp(argv[i], "-q", 2) == 0)
do_quiet = TRUE;
}
if (!(do_index || do_link || do_kill || do_pack || do_post))
Help();
if (!(do_index || do_link || do_kill || do_pack || do_post))
Help();
ProgName();
pw = getpwuid(getuid());
InitClient(pw->pw_name, (char *)"mbmsg", CFG.location, CFG.logfile,
ProgName();
pw = getpwuid(getuid());
InitClient(pw->pw_name, (char *)"mbmsg", CFG.location, CFG.logfile,
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
Syslog(' ', " ");
Syslog(' ', "MBMSG v%s", VERSION);
Syslog(' ', cmd);
free(cmd);
Syslog(' ', " ");
Syslog(' ', "MBMSG v%s", VERSION);
Syslog(' ', cmd);
free(cmd);
if (!do_quiet) {
printf("\n");
colour(3, 0);
}
if (!do_quiet) {
printf("\n");
colour(3, 0);
}
if (do_index || do_link || do_kill || do_pack) {
memset(&MsgBase, 0, sizeof(MsgBase));
DoMsgBase();
}
if (do_index || do_link || do_kill || do_pack) {
memset(&MsgBase, 0, sizeof(MsgBase));
DoMsgBase();
}
if (do_post) {
Post(too, tarea, subj, mfile, flavor);
}
if (do_post) {
Post(too, tarea, subj, mfile, flavor);
}
die(MBERR_OK);
return 0;
die(MBERR_OK);
return 0;
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: Netmail tracker / router
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -267,6 +267,7 @@ int IsLocal(char *ftn, fidoaddr *res)
}
}
tidy_faddr(dest);
return R_NOROUTE;
}
@ -378,9 +379,9 @@ int AreWeHost(faddr *dest)
int AreWeHub(faddr *dest)
{
int i, j;
node *nl;
faddr *fido;
int i, j;
node *nl;
faddr *fido;
for (i = 0; i < 40; i++)
if (CFG.akavalid[i])

View File

@ -4,7 +4,7 @@
* Purpose ...............: Common utilities
*
*****************************************************************************
* Copyright (C) 1997-2001
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -207,65 +207,64 @@ void Nopper(void)
int socket_connect(char *user)
{
int s;
static char buf[SS_BUFSIZE];
char tty[18];
int s;
static char buf[SS_BUFSIZE], tty[18];
if ((s = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
perror("mbmon");
printf("Unable to create Unix Datagram socket\n");
return -1;
}
if ((s = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
perror("mbmon");
printf("Unable to create Unix Datagram socket\n");
return -1;
}
memset(&clntaddr, 0, sizeof(clntaddr));
clntaddr.sun_family = AF_UNIX;
strcpy(clntaddr.sun_path, cpath);
memset(&clntaddr, 0, sizeof(clntaddr));
clntaddr.sun_family = AF_UNIX;
strcpy(clntaddr.sun_path, cpath);
if (bind(s, (struct sockaddr *)&clntaddr, sizeof(clntaddr)) < 0) {
close(s);
perror("mbmon");
printf("Can't bind socket %s\n", cpath);
return -1;
}
if (bind(s, (struct sockaddr *)&clntaddr, sizeof(clntaddr)) < 0) {
close(s);
perror("mbmon");
printf("Can't bind socket %s\n", cpath);
return -1;
}
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
sprintf(servaddr.sun_path, "%s", (char *)spath);
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
sprintf(servaddr.sun_path, "%s", (char *)spath);
/*
* Now that we have an connection, we gather
* information to tell the server who we are.
*/
if (isatty(1) && (ttyname(1) != NULL)) {
strcpy(tty, ttyname(1));
if (strchr(tty, 'p'))
strcpy(tty, index(tty, 'p'));
else if (strchr(tty, 't'))
strcpy(tty, index(tty, 't'));
else if (strchr(tty, 'c'))
strcpy(tty, index(tty, 'c'));
} else {
strcpy(tty, "-");
}
sock = s;
/*
* Now that we have an connection, we gather
* information to tell the server who we are.
*/
if (isatty(1) && (ttyname(1) != NULL)) {
strcpy(tty, ttyname(1));
if (strchr(tty, 'p'))
memccpy(tty, index(tty, 'p'), '\0', strlen(tty));
else if (strchr(tty, 't'))
memccpy(tty, index(tty, 't'), '\0', strlen(tty));
else if (strchr(tty, 'c'))
memccpy(tty, index(tty, 'c'), '\0', strlen(tty));
} else {
strcpy(tty, "-");
}
sock = s;
/*
* Send the information to the server.
*/
sprintf(buf, "AINI:5,%d,%s,%s,mbmon,localhost;", getpid(), tty, user);
if (socket_send(buf) != 0) {
sock = -1;
return -1;
}
/*
* Send the information to the server.
*/
sprintf(buf, "AINI:5,%d,%s,%s,mbmon,localhost;", getpid(), tty, user);
if (socket_send(buf) != 0) {
sock = -1;
return -1;
}
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) != 0) {
printf("AINI not acknowledged by the server\n");
sock = -1;
return -1;
}
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) != 0) {
printf("AINI not acknowledged by the server\n");
sock = -1;
return -1;
}
return s;
return s;
}

View File

@ -318,72 +318,70 @@ void system_stat(void)
void disk_stat(void)
{
int ch, i;
char buf[1024];
char *cnt, *type, *fs, *p;
unsigned long last[10];
unsigned long size, used, perc;
char sign;
int ch, i;
char buf[1024], *cnt, *type, *fs, *p, sign;
unsigned long last[10], size, used, perc;
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "3. FILESYSTEM USAGE");
set_color(YELLOW, RED);
mvprintw( 7, 1, " Size MB Used MB Perc. FS-Type Mountpoint ");
set_color(CYAN, BLACK);
mvprintw(lines - 2, 6, "Press any key");
IsDoing("Filesystem Usage");
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "3. FILESYSTEM USAGE");
set_color(YELLOW, RED);
mvprintw( 7, 1, " Size MB Used MB Perc. FS-Type Mountpoint ");
set_color(CYAN, BLACK);
mvprintw(lines - 2, 6, "Press any key");
IsDoing("Filesystem Usage");
for (i = 0; i < 10; i++)
last[i] = 0;
do {
show_date(LIGHTGRAY, BLACK, 0, 0);
do {
show_date(LIGHTGRAY, BLACK, 0, 0);
sprintf(buf, "GDST:1,%d;", getpid());
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
set_color(LIGHTGRAY, BLACK);
cnt = strtok(buf, ":");
cnt = strtok(NULL, ",;");
if (atoi(cnt)) {
for (i = 0; i < atoi(cnt); i++) {
p = strtok(NULL, " ");
size = atoi(p);
p = strtok(NULL, " ");
used = size - atoi(p);
perc = (used * 100) / size;
sign = ' ';
fs = strtok(NULL, " ");
type = strtok(NULL, ",;");
if (used > last[i])
sign = '^';
if (used < last[i])
sign = 'v';
if (last[i] == 0)
sign = ' ';
last[i] = used;
set_color(CYAN, BLACK);
mvprintw(i+8, 1, "%8lu %8lu ",
size, used);
set_color(WHITE, BLACK);
printf("%c ", sign);
set_color(CYAN, BLACK);
if (strstr(type, "iso") == NULL) {
if (perc >= 95)
set_color(LIGHTRED, BLACK);
else if (perc >= 80)
set_color(YELLOW, BLACK);
}
printf("%3lu", perc);
putchar('%');
set_color(CYAN, BLACK);
printf(" %-8s %-40s", type, fs);
}
locate(i+8, 1);
clrtoeol();
}
sprintf(buf, "GDST:1,%d;", getpid());
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
set_color(LIGHTGRAY, BLACK);
cnt = strtok(buf, ":");
cnt = strtok(NULL, ",;");
if (atoi(cnt)) {
for (i = 0; i < atoi(cnt); i++) {
p = strtok(NULL, " ");
size = atoi(p);
p = strtok(NULL, " ");
used = size - atoi(p);
perc = (used * 100) / size;
sign = ' ';
fs = strtok(NULL, " ");
type = strtok(NULL, ",;");
if (used > last[i])
sign = '^';
if (used < last[i])
sign = 'v';
if (last[i] == 0)
sign = ' ';
last[i] = used;
set_color(CYAN, BLACK);
mvprintw(i+8, 1, "%8lu %8lu ", size, used);
set_color(WHITE, BLACK);
printf("%c ", sign);
set_color(CYAN, BLACK);
if (strstr(type, "iso") == NULL) {
if (perc >= 95)
set_color(LIGHTRED, BLACK);
else if (perc >= 80)
set_color(YELLOW, BLACK);
}
printf("%3lu", perc);
putchar('%');
set_color(CYAN, BLACK);
printf(" %-8s %-40s", type, fs);
}
locate(i+8, 1);
clrtoeol();
}
}
ch = testkey(lines - 2, 20);
} while (ch == '\0');
ch = testkey(lines - 2, 20);
} while (ch == '\0');
}

View File

@ -130,6 +130,7 @@ void ulockprogram(char *progname)
free(lockfile);
return;
}
fclose(fp);
if (oldpid == getpid()) {
(void)unlink(lockfile);

View File

@ -145,13 +145,13 @@ int main(int argc, char **argv)
* Catch all signals we can, and ignore the rest.
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGKILL) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}
if(argc < 2)
if (argc < 2)
Help();
cmd = xstrcpy((char *)"Command line: mball");
@ -320,10 +320,11 @@ void Masterlist()
Syslog('+', "Inserting %s", temp);
while( fgets(temp, 80 ,pHeader) != NULL) {
Striplf(temp);
fprintf(fp, "%s\r\n", temp);
fprintf(np, "%s\r\n", temp);
Striplf(temp);
fprintf(fp, "%s\r\n", temp);
fprintf(np, "%s\r\n", temp);
}
fclose(pHeader);
}
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
@ -457,6 +458,7 @@ void Masterlist()
fprintf(fp, "%s\r\n", temp);
fprintf(np, "%s\r\n", temp);
}
fclose(pHeader);
}
fclose(fp);
@ -505,6 +507,7 @@ void MakeArc()
(char *)"/dev/null", (char *)"/dev/null") == 0)
WriteError("Create newfiles.zip failed");
free(cmd);
cmd = NULL;
}

View File

@ -125,6 +125,7 @@ int main(int argc, char **argv)
if ((tty = ttyname(0)) == NULL) {
WriteError("Not at a tty");
Free_Language();
Quick_Bye(MBERR_OK);
}
@ -160,6 +161,7 @@ int main(int argc, char **argv)
*/
if (CheckStatus() == FALSE) {
Syslog('+', "Kicking user out, the BBS is closed");
Free_Language();
Quick_Bye(MBERR_OK);
}
@ -192,6 +194,7 @@ int main(int argc, char **argv)
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
printf("No BBS on this port allowed!\n\n");
Free_Language();
Quick_Bye(MBERR_OK);
}

View File

@ -122,7 +122,7 @@ int main(int argc, char **argv)
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}

View File

@ -387,7 +387,10 @@ void UserPack(int days, int level, int pack)
fclose(fout);
chmod(fnin, 0660);
Syslog('+', "Userbase is updated, written %d records", record);
} else {
fclose(fout);
}
unlink(fnout);
free(fnin);
free(fnout);

View File

@ -211,6 +211,7 @@ void user()
printf("%s\n", (char *) Language(390));
Syslog('?', "FATAL: Could not find user in BBS users file.");
Syslog('?', " and system is using unix accounts\n");
Free_Language();
ExitClient(MBERR_OK);
}

View File

@ -463,53 +463,55 @@ void InitFidonetdb(void)
void gold_akamatch(FILE *fp)
{
char temp[PATH_MAX];
FILE *fido;
faddr *want;
int i;
char temp[PATH_MAX];
FILE *fido;
faddr *want, *ta;
int i;
sprintf(temp, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
if ((fido = fopen(temp, "r")) == NULL)
return;
sprintf(temp, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
if ((fido = fopen(temp, "r")) == NULL)
return;
fprintf(fp, "; AKA Matching\n;\n");
want = (faddr *)malloc(sizeof(faddr));
fprintf(fp, "; AKA Matching\n;\n");
want = (faddr *)malloc(sizeof(faddr));
fread(&fidonethdr, sizeof(fidonethdr), 1, fido);
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
fread(&fidonethdr, sizeof(fidonethdr), 1, fido);
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
for (i = 0; i < 6; i++)
if (fidonet.zone[i]) {
want->zone = fidonet.zone[0];
want->net = 0;
want->node = 0;
want->point = 0;
want->name = NULL;
want->domain = NULL;
fprintf(fp, "AKAMATCH %d:* %s\n", fidonet.zone[i], ascfnode(bestaka_s(want), 0xf));
}
}
for (i = 0; i < 6; i++)
if (fidonet.zone[i]) {
want->zone = fidonet.zone[0];
want->net = 0;
want->node = 0;
want->point = 0;
want->name = NULL;
want->domain = NULL;
ta = bestaka_s(want);
fprintf(fp, "AKAMATCH %d:* %s\n", fidonet.zone[i], ascfnode(ta, 0xf));
tidy_faddr(ta);
}
}
free(want);
fprintf(fp, ";\n");
fprintf(fp, "AKAMATCHNET YES\n");
fprintf(fp, "AKAMATCHECHO YES\n"); /* On request, should work better */
fprintf(fp, "AKAMATCHLOCAL NO\n\n");
free(want);
fprintf(fp, ";\n");
fprintf(fp, "AKAMATCHNET YES\n");
fprintf(fp, "AKAMATCHECHO YES\n");
fprintf(fp, "AKAMATCHLOCAL NO\n\n");
fprintf(fp, "; NODELISTS\n;\n");
fprintf(fp, "NODEPATH %s/\n", CFG.nodelists);
fseek(fido, fidonethdr.hdrsize, SEEK_SET);
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
fprintf(fp, "NODELIST %s.*\n", fidonet.nodelist);
for (i = 0; i < 6; i++)
if (strlen(fidonet.seclist[i].nodelist) || fidonet.seclist[i].zone)
fprintf(fp, "NODELIST %s.*\n", fidonet.seclist[i].nodelist);
}
// fprintf(fp, "USERLIST golded.lst\n");
fprintf(fp, "LOOKUPNET YES\n");
fprintf(fp, "LOOKUPECHO NO\n");
fprintf(fp, "LOOKUPLOCAL NO\n\n");
fclose(fido);
fprintf(fp, "; NODELISTS\n;\n");
fprintf(fp, "NODEPATH %s/\n", CFG.nodelists);
fseek(fido, fidonethdr.hdrsize, SEEK_SET);
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
fprintf(fp, "NODELIST %s.*\n", fidonet.nodelist);
for (i = 0; i < 6; i++)
if (strlen(fidonet.seclist[i].nodelist) || fidonet.seclist[i].zone)
fprintf(fp, "NODELIST %s.*\n", fidonet.seclist[i].nodelist);
}
// fprintf(fp, "USERLIST golded.lst\n");
fprintf(fp, "LOOKUPNET YES\n");
fprintf(fp, "LOOKUPECHO NO\n");
fprintf(fp, "LOOKUPLOCAL NO\n\n");
fclose(fido);
}

View File

@ -779,7 +779,7 @@ void s_fidomailcfg(void)
mvprintw(12,42, "13. 4d address");
mvprintw(13,42, "14. Split at");
mvprintw(14,42, "15. Force at");
mvprintw(15,42, "16. Allow %+*");
mvprintw(15,42, "16. Allow +*");
mvprintw(16,42, "17. Notify");
mvprintw(17,42, "18. Passwd");
mvprintw(18,42, "19. Pause");

View File

@ -4,7 +4,7 @@
* Purpose ...............: Message Areas Setup
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -535,48 +535,48 @@ void SetScreen()
long LoadMsgRec(int, int);
long LoadMsgRec(int Area, int work)
{
FILE *fil;
char mfile[PATH_MAX];
long offset;
sysconnect System;
int i;
FILE *fil;
char mfile[PATH_MAX];
long offset;
sysconnect System;
int i;
if (work)
working(1, 0, 0);
if (work)
working(1, 0, 0);
sprintf(mfile, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(mfile, "r")) == NULL) {
working(2, 0, 0);
return -1;
}
sprintf(mfile, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(mfile, "r")) == NULL) {
working(2, 0, 0);
return -1;
}
if ((tfil = tmpfile()) == NULL) {
working(2, 0, 0);
return -1;
}
if ((tfil = tmpfile()) == NULL) {
working(2, 0, 0);
return -1;
}
fread(&msgshdr, sizeof(msgshdr), 1, fil);
offset = msgshdr.hdrsize + (((Area -1) * (msgshdr.recsize + msgshdr.syssize)));
if (fseek(fil, offset, SEEK_SET) != 0) {
fclose(tfil);
tfil = NULL;
working(2, 0, 0);
return -1;
}
fread(&msgshdr, sizeof(msgshdr), 1, fil);
offset = msgshdr.hdrsize + (((Area -1) * (msgshdr.recsize + msgshdr.syssize)));
if (fseek(fil, offset, SEEK_SET) != 0) {
fclose(tfil);
tfil = NULL;
working(2, 0, 0);
return -1;
}
fread(&msgs, msgshdr.recsize, 1, fil);
MsgCrc = 0xffffffff;
MsgCrc = upd_crc32((char *)&msgs, MsgCrc, msgshdr.recsize);
for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) {
fread(&System, sizeof(sysconnect), 1, fil);
fwrite(&System, sizeof(sysconnect), 1, tfil);
MsgCrc = upd_crc32((char *)&System, MsgCrc, sizeof(sysconnect));
}
fclose(fil);
if (work)
working(0, 0, 0);
fread(&msgs, msgshdr.recsize, 1, fil);
MsgCrc = 0xffffffff;
MsgCrc = upd_crc32((char *)&msgs, MsgCrc, msgshdr.recsize);
for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) {
fread(&System, sizeof(sysconnect), 1, fil);
fwrite(&System, sizeof(sysconnect), 1, tfil);
MsgCrc = upd_crc32((char *)&System, MsgCrc, sizeof(sysconnect));
}
fclose(fil);
if (work)
working(0, 0, 0);
return offset;
return offset;
}
@ -714,7 +714,8 @@ void MsgGlobal(void)
menu = select_menu(13);
switch (menu) {
case 0: return;
case 0: tidy_grlist(&mgr);
return;
case 1: a1 = PullUplink((char *)"AKA TO DELETE");
break;
case 2: a2 = PullUplink((char *)"AKA TO ADD");
@ -991,6 +992,7 @@ void MsgGlobal(void)
}
if (tfil != NULL)
fclose(tfil);
tfil = NULL;
}
working(0, 0, 0);
@ -1099,6 +1101,9 @@ int EditMsgRec(int Area)
Syslog('+', "Saved message area record %d", Area);
}
}
if (tfil != NULL)
fclose(tfil);
tfil = NULL;
IsDoing("Browsing Menu");
return 0;
case 1: E_STR( 6,16,40,msgs.Name, "The ^Name^ of this area")

View File

@ -270,10 +270,10 @@ void CloseNoderec(int Force)
}
chmod(fin, 0640);
unlink(fout);
working(1, 0, 0);
free(fin);
free(fout);
unlink(fout);
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: TIC Areas Setup Program
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -611,7 +611,8 @@ void TicGlobal(void)
menu = select_menu(7);
switch (menu) {
case 0: return;
case 0: tidy_grlist(&mgr);
return;
case 1: a1 = PullUplink((char *)"AKA TO DELETE");
break;
case 2: a2 = PullUplink((char *)"AKA TO ADD");
@ -900,6 +901,9 @@ int EditTicRec(int Area)
Syslog('+', "Saved tic record %d", Area);
}
}
if (ttfil != NULL)
fclose(ttfil);
ttfil = NULL;
IsDoing("Browsing Menu");
free(temp);
return 0;

View File

@ -24,7 +24,7 @@ OTHER = Makefile issue issue.netbsd
all: mbtask
mbtask: ${OBJS} ${LIBS}
${CC} -o mbtask ${OBJS} ${LIBS}
${CC} -o mbtask ${OBJS} ${PTLIBS} ${LIBS}
clean:
rm -f mbtask *.o *.h~ *.c~ version.* core filelist Makefile.bak

View File

@ -5,7 +5,7 @@
* Shadow Suite (c) ......: Julianne Frances Haugh
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2003
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -759,10 +759,12 @@ int main(int argc, char *argv[])
gr = getgrgid(pw->pw_gid);
if (!gr) {
fprintf(stderr, "mbpasswd: Cannot determine group name.\n");
free(myname);
exit(E_NOPERM);
}
if (strcmp(gr->gr_name, (char *)"bbs")) {
fprintf(stderr, "mbpasswd: You are not a member of group \"bbs\".\n");
free(myname);
exit(E_NOPERM);
}
@ -776,6 +778,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "mbpasswd [-opt] [username] [newpassword]\n");
fprintf(stderr, "options are: -n normal password change\n");
fprintf(stderr, " -f forced password change\n");
free(myname);
exit(E_FAILURE);
}
@ -787,6 +790,7 @@ int main(int argc, char *argv[])
force = 1;
if (strcmp(pw->pw_name, (char *)"mbse") && strcmp(pw->pw_name, (char *)"bbs")) {
fprintf(stderr, "mbpasswd: only users `mbse' and `bbs' may do this.\n");
free(myname);
exit(E_NOPERM);
}
} else if (strncmp(argv[1], "-n", 2) == 0) {
@ -797,10 +801,12 @@ int main(int argc, char *argv[])
force = 0;
if (strcmp(pw->pw_name, argv[2])) {
fprintf(stderr, "mbpasswd: only owner may do this.\n");
free(myname);
exit(E_NOPERM);
}
} else {
fprintf(stderr, "mbpasswd: wrong option switch.\n");
free(myname);
exit(E_FAILURE);
}
@ -809,10 +815,12 @@ int main(int argc, char *argv[])
*/
if (strlen(argv[2]) > 16) {
fprintf(stderr, "mbpasswd: Username too long\n");
free(myname);
exit(E_FAILURE);
}
if (strlen(argv[3]) > 16) {
fprintf(stderr, "mbpasswd: Password too long\n");
free(myname);
exit(E_FAILURE);
}
@ -826,6 +834,7 @@ int main(int argc, char *argv[])
if ((pw = getpwnam(name)) == NULL) {
syslog(LOG_ERR, "mbpasswd: Unknown user %s", name);
fprintf(stderr, "mbpasswd: Unknown user %s\n", name);
free(myname);
exit(E_FAILURE);
}
@ -855,6 +864,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "The password for %s is unchanged.\n", name);
syslog(LOG_ERR, "The password for %s is unchanged", name);
closelog();
free(myname);
exit(E_FAILURE);
}
do_update_pwd = 1;
@ -876,6 +886,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Cannot change ID to root.\n");
syslog(LOG_ERR, "can't setuid(0)");
closelog();
free(myname);
exit(E_FAILURE);
}
@ -927,6 +938,7 @@ int main(int argc, char *argv[])
syslog(LOG_NOTICE, "password for `%s' changed by user `%s'", name, myname);
closelog();
free(myname);
exit(E_SUCCESS);
}