A lot of fixes found with valgrind
This commit is contained in:
parent
fab5a2edae
commit
f0bbdba104
43
ChangeLog
43
ChangeLog
@ -2,24 +2,67 @@ $Id$
|
|||||||
|
|
||||||
v0.39.3 26-Nov-2003
|
v0.39.3 26-Nov-2003
|
||||||
|
|
||||||
|
WARNING: NOT EVERYTHING IS TESTED, WAIT A FEW DAYS AND DON'T USE THIS.
|
||||||
|
|
||||||
general:
|
general:
|
||||||
Since this version Posix threads are being used, please let
|
Since this version Posix threads are being used, please let
|
||||||
me know if this doesn't compile on you system.
|
me know if this doesn't compile on you system.
|
||||||
All Makefiles do not strip the binaries anymore, the binaries
|
All Makefiles do not strip the binaries anymore, the binaries
|
||||||
are stripped during make install only. This allows to run the
|
are stripped during make install only. This allows to run the
|
||||||
not yet installed binaries under debuggers.
|
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:
|
mbcico:
|
||||||
Dropped binkp CRC support because it will be incompatible with
|
Dropped binkp CRC support because it will be incompatible with
|
||||||
future extensions.
|
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:
|
mbsetup:
|
||||||
Removed binkp CRC settings.
|
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:
|
mbtask:
|
||||||
The ping function now runs in a separate thread.
|
The ping function now runs in a separate thread.
|
||||||
Changed some ping timer logic.
|
Changed some ping timer logic.
|
||||||
|
|
||||||
|
mbpasswd:
|
||||||
|
Fixed a small memory leak.
|
||||||
|
|
||||||
|
|
||||||
v0.39.2 21-Nov-2003 - 26-Nov-2003
|
v0.39.2 21-Nov-2003 - 26-Nov-2003
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ MAKE = @MAKE@
|
|||||||
JOEBIN = @joebin@
|
JOEBIN = @joebin@
|
||||||
JOELIB = @joelib@
|
JOELIB = @joelib@
|
||||||
|
|
||||||
CFLAGS = -O2 -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes -pipe
|
CFLAGS = @COMPILEFLAGS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
|
PTLIBS = @PTLIBS@
|
||||||
|
|
||||||
|
18
TODO
18
TODO
@ -29,7 +29,12 @@ libdiesel.a:
|
|||||||
U: Processed stringlines containing unbalanced " characters are not
|
U: Processed stringlines containing unbalanced " characters are not
|
||||||
processed, instead the previous macro value will be returned.
|
processed, instead the previous macro value will be returned.
|
||||||
|
|
||||||
|
mbtask:
|
||||||
|
N: Test with valgrind.
|
||||||
|
|
||||||
mbsebbs:
|
mbsebbs:
|
||||||
|
N: Test with valgrind.
|
||||||
|
|
||||||
X: Better word wrapping or paragraph justification in editor.
|
X: Better word wrapping or paragraph justification in editor.
|
||||||
|
|
||||||
X: E-mail downloads with e-mail verification.
|
X: E-mail downloads with e-mail verification.
|
||||||
@ -57,6 +62,8 @@ mbsebbs:
|
|||||||
N: Reimplememnt CHRS kludge.
|
N: Reimplememnt CHRS kludge.
|
||||||
|
|
||||||
newuser:
|
newuser:
|
||||||
|
N: Test with valgrind.
|
||||||
|
|
||||||
L: Allow handles to be the same as the unixname.
|
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
|
N: With auto created areas golded.inc is not adjusted to the new
|
||||||
setup.
|
setup.
|
||||||
|
|
||||||
|
N: After readalias we need to free the alias list when mbfido ends.
|
||||||
|
|
||||||
|
N: Tic, toss, scan tests with valgrind.
|
||||||
|
|
||||||
mbcico:
|
mbcico:
|
||||||
|
N: Test with valgrind, binkp is ok.
|
||||||
|
|
||||||
N: Upgrade binkp protocol to 1.1.
|
N: Upgrade binkp protocol to 1.1.
|
||||||
|
|
||||||
N: With binkp, if the other node is a binkp/1.0 mailer without MB
|
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.
|
U: Fix binkp file resume when mbcico silently dies.
|
||||||
|
|
||||||
|
mbout:
|
||||||
|
N: Fix prepbuf in libcommon so that valgind can test this.
|
||||||
|
|
||||||
mbfile:
|
mbfile:
|
||||||
L: Add a check to see if the magic filenames are (still) valid.
|
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.
|
L: Possibility to skip file areas from checking and reindexing.
|
||||||
|
|
||||||
|
N: Test with valgrind.
|
||||||
|
|
||||||
mbmsg:
|
mbmsg:
|
||||||
N: With the post command if a netmail area is used the netmail area
|
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
|
will cause trouble later, should be blocked to be used on netmail
|
||||||
|
15
configure.in
15
configure.in
@ -55,11 +55,19 @@ CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes"
|
|||||||
|
|
||||||
dnl Additional commandline switches
|
dnl Additional commandline switches
|
||||||
AC_ARG_ENABLE(experiment, [ --enable-experiment Compile experimental code], [ experiment=$enableval ], [ experiment=no ])
|
AC_ARG_ENABLE(experiment, [ --enable-experiment Compile experimental code], [ experiment=$enableval ], [ experiment=no ])
|
||||||
|
|
||||||
if test "$experiment" = "yes"; then
|
if test "$experiment" = "yes"; then
|
||||||
AC_DEFINE(USE_EXPERIMENT)
|
AC_DEFINE(USE_EXPERIMENT)
|
||||||
fi
|
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)
|
dnl Defines for MBSE BBS (must use tests or --enable-stuff later)
|
||||||
AC_DEFINE_UNQUOTED(RESTAMP_OLD_POSTINGS, 21)
|
AC_DEFINE_UNQUOTED(RESTAMP_OLD_POSTINGS, 21)
|
||||||
AC_DEFINE(RESTAMP_FUTURE_POSTINGS)
|
AC_DEFINE(RESTAMP_FUTURE_POSTINGS)
|
||||||
@ -140,15 +148,16 @@ fi
|
|||||||
PTHREADS=No
|
PTHREADS=No
|
||||||
AC_CHECK_LIB(pthread,pthread_create,result=yes,result=no)
|
AC_CHECK_LIB(pthread,pthread_create,result=yes,result=no)
|
||||||
if test "$result" = "yes"; then
|
if test "$result" = "yes"; then
|
||||||
LIBS="$LIBS -lpthread"
|
PTLIBS="$PTLIBS -lpthread"
|
||||||
AC_CHECK_HEADERS(pthread.h,PTHREADS=Yes,PTHREADS=No)
|
AC_CHECK_HEADERS(pthread.h,PTHREADS=Yes,PTHREADS=No)
|
||||||
else
|
else
|
||||||
AC_CHECK_LIB(c_r,pthread_create,result=yes,result=no)
|
AC_CHECK_LIB(c_r,pthread_create,result=yes,result=no)
|
||||||
if test "$result" = "yes"; then
|
if test "$result" = "yes"; then
|
||||||
LIBS="$LIBS -lc_r"
|
PTLIBS="$PTLIBS -lc_r"
|
||||||
AC_CHECK_HEADERS(pthread.h,PTHREADS=Yes,PTHREADS=No)
|
AC_CHECK_HEADERS(pthread.h,PTHREADS=Yes,PTHREADS=No)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
AC_SUBST(PTLIBS)
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
221
lib/client.c
221
lib/client.c
@ -49,88 +49,87 @@ char cpath[108]; /* Client socket path */
|
|||||||
|
|
||||||
int socket_connect(char *user, char *prg, char *city)
|
int socket_connect(char *user, char *prg, char *city)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
static char buf[SS_BUFSIZE];
|
static char buf[SS_BUFSIZE], tty[18];
|
||||||
static char tty[18];
|
|
||||||
|
|
||||||
myname = prg;
|
myname = prg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create Unix Datagram socket for the client.
|
* Create Unix Datagram socket for the client.
|
||||||
*/
|
*/
|
||||||
s = socket(AF_UNIX, SOCK_DGRAM, 0);
|
s = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
perror(myname);
|
perror(myname);
|
||||||
printf("Unable to create Unix Datagram socket\n");
|
printf("Unable to create Unix Datagram socket\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Client will bind to an address so the server will get
|
* Client will bind to an address so the server will get
|
||||||
* an address in its recvfrom call and use it to send
|
* an address in its recvfrom call and use it to send
|
||||||
* data back to the client.
|
* data back to the client.
|
||||||
*/
|
*/
|
||||||
memset(&clntaddr, 0, sizeof(clntaddr));
|
memset(&clntaddr, 0, sizeof(clntaddr));
|
||||||
clntaddr.sun_family = AF_UNIX;
|
clntaddr.sun_family = AF_UNIX;
|
||||||
strcpy(clntaddr.sun_path, cpath);
|
strcpy(clntaddr.sun_path, cpath);
|
||||||
|
|
||||||
if (bind(s, (struct sockaddr *)&clntaddr, sizeof(clntaddr)) < 0) {
|
if (bind(s, (struct sockaddr *)&clntaddr, sizeof(clntaddr)) < 0) {
|
||||||
close(s);
|
close(s);
|
||||||
perror(myname);
|
perror(myname);
|
||||||
printf("Can't bind socket %s\n", cpath);
|
printf("Can't bind socket %s\n", cpath);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If running seteuid as another user, chown to mbse.bbs
|
* If running seteuid as another user, chown to mbse.bbs
|
||||||
*/
|
*/
|
||||||
if (getuid() != geteuid()) {
|
if (getuid() != geteuid()) {
|
||||||
chown(cpath, getuid(), getgid());
|
chown(cpath, getuid(), getgid());
|
||||||
} else {
|
} else {
|
||||||
chmod(cpath, 0775);
|
chmod(cpath, 0775);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup address structure for the server socket.
|
* Setup address structure for the server socket.
|
||||||
*/
|
*/
|
||||||
memset(&servaddr, 0, sizeof(servaddr));
|
memset(&servaddr, 0, sizeof(servaddr));
|
||||||
servaddr.sun_family = AF_UNIX;
|
servaddr.sun_family = AF_UNIX;
|
||||||
strcpy(servaddr.sun_path, spath);
|
strcpy(servaddr.sun_path, spath);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that we have an connection, we gather
|
* Now that we have an connection, we gather
|
||||||
* information to tell the server who we are.
|
* information to tell the server who we are.
|
||||||
*/
|
*/
|
||||||
if (isatty(1) && (ttyname(1) != NULL)) {
|
if (isatty(1) && (ttyname(1) != NULL)) {
|
||||||
strcpy(tty, ttyname(1));
|
strcpy(tty, ttyname(1));
|
||||||
if (strchr(tty, 'p'))
|
if (strchr(tty, 'p'))
|
||||||
strcpy(tty, index(tty, 'p'));
|
memccpy(tty, index(tty, 'p'), '\0', strlen(tty));
|
||||||
else if (strchr(tty, 't'))
|
else if (strchr(tty, 't'))
|
||||||
strcpy(tty, index(tty, 't'));
|
memccpy(tty, index(tty, 't'), '\0', strlen(tty));
|
||||||
else if (strchr(tty, 'c'))
|
else if (strchr(tty, 'c'))
|
||||||
strcpy(tty, index(tty, 'c'));
|
memccpy(tty, index(tty, 'c'), '\0', strlen(tty));
|
||||||
} else {
|
} else {
|
||||||
strcpy(tty, "-");
|
strcpy(tty, "-");
|
||||||
}
|
}
|
||||||
sock = s;
|
sock = s;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send the information to the server.
|
* Send the information to the server.
|
||||||
*/
|
*/
|
||||||
sprintf(buf, "AINI:5,%d,%s,%s,%s,%s;", getpid(), tty, user, prg, city);
|
sprintf(buf, "AINI:5,%d,%s,%s,%s,%s;", getpid(), tty, user, prg, city);
|
||||||
if (socket_send(buf) != 0) {
|
if (socket_send(buf) != 0) {
|
||||||
sock = -1;
|
sock = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
if (strncmp(buf, "100:0;", 6) != 0) {
|
if (strncmp(buf, "100:0;", 6) != 0) {
|
||||||
printf("AINI not acknowledged by the server\n");
|
printf("AINI not acknowledged by the server\n");
|
||||||
sock = -1;
|
sock = -1;
|
||||||
return -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)
|
int socket_send(char *buf)
|
||||||
{
|
{
|
||||||
if (sock == -1)
|
if (sock == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (sendto(sock, buf, strlen(buf), 0, (struct sockaddr *)&servaddr, sizeof(servaddr)) != strlen(buf)) {
|
if (sendto(sock, buf, strlen(buf), 0, (struct sockaddr *)&servaddr, sizeof(servaddr)) != strlen(buf)) {
|
||||||
printf("Socket send failed error %d\n", errno);
|
printf("Socket send failed error %d\n", errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,19 +157,19 @@ int socket_send(char *buf)
|
|||||||
*/
|
*/
|
||||||
char *socket_receive(void)
|
char *socket_receive(void)
|
||||||
{
|
{
|
||||||
static char buf[SS_BUFSIZE];
|
static char buf[SS_BUFSIZE];
|
||||||
int rlen;
|
int rlen;
|
||||||
|
|
||||||
memset((char *)&buf, 0, SS_BUFSIZE);
|
memset((char *)&buf, 0, SS_BUFSIZE);
|
||||||
fromlen = sizeof(from);
|
fromlen = sizeof(from);
|
||||||
rlen = recvfrom(sock, buf, SS_BUFSIZE, 0, (struct sockaddr *)&from, &fromlen);
|
rlen = recvfrom(sock, buf, SS_BUFSIZE, 0, (struct sockaddr *)&from, &fromlen);
|
||||||
if (rlen == -1) {
|
if (rlen == -1) {
|
||||||
perror("recv");
|
perror("recv");
|
||||||
printf("Error reading socket\n");
|
printf("Error reading socket\n");
|
||||||
memset((char *)&buf, 0, SS_BUFSIZE);
|
memset((char *)&buf, 0, SS_BUFSIZE);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,28 +185,28 @@ char *socket_receive(void)
|
|||||||
|
|
||||||
int socket_shutdown(pid_t pid)
|
int socket_shutdown(pid_t pid)
|
||||||
{
|
{
|
||||||
static char buf[SS_BUFSIZE];
|
static char buf[SS_BUFSIZE];
|
||||||
|
|
||||||
if (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;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -303,7 +303,6 @@ int noderecord(faddr *);
|
|||||||
/*
|
/*
|
||||||
* From pktname.c
|
* From pktname.c
|
||||||
*/
|
*/
|
||||||
char *prepbuf(faddr *);
|
|
||||||
char *pktname(faddr *, char);
|
char *pktname(faddr *, char);
|
||||||
char *reqname(faddr *);
|
char *reqname(faddr *);
|
||||||
char *floname(faddr *, char);
|
char *floname(faddr *, char);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* MBSE BBS and utilities.
|
* MBSE BBS and utilities.
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* 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);
|
fdJlr = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
|
||||||
RetVal = TRUE;
|
RetVal = TRUE;
|
||||||
|
|
||||||
strcpy(BaseName, Msgbase);
|
memmove(BaseName, Msgbase, strlen(Msgbase));
|
||||||
} else {
|
} else {
|
||||||
close(fdHdr);
|
close(fdHdr);
|
||||||
fdHdr = -1;
|
fdHdr = -1;
|
||||||
|
237
lib/pktname.c
237
lib/pktname.c
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: BinkleyTerm outbound naming
|
* Purpose ...............: BinkleyTerm outbound naming
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -51,172 +51,175 @@
|
|||||||
#define ltyp "pol"
|
#define ltyp "pol"
|
||||||
|
|
||||||
|
|
||||||
static char buf[PATH_MAX];
|
|
||||||
|
|
||||||
|
|
||||||
|
char *prepbuf(faddr *);
|
||||||
char *prepbuf(faddr *addr)
|
char *prepbuf(faddr *addr)
|
||||||
{
|
{
|
||||||
char *p, *domain=NULL;
|
static char buf[PATH_MAX];
|
||||||
char zpref[8];
|
char *p, *domain=NULL, zpref[8];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sprintf(buf, "%s", CFG.outbound);
|
sprintf(buf, "%s", CFG.outbound);
|
||||||
|
|
||||||
if (CFG.addr4d) {
|
if (CFG.addr4d) {
|
||||||
Syslog('o', "Use 4d addressing, zone is %d", addr->zone);
|
Syslog('o', "Use 4d addressing, zone is %d", addr->zone);
|
||||||
|
|
||||||
if ((addr->zone == 0) || (addr->zone == CFG.aka[0].zone))
|
if ((addr->zone == 0) || (addr->zone == CFG.aka[0].zone))
|
||||||
zpref[0] = '\0';
|
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);
|
|
||||||
else
|
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 != NULL) && (strlen(CFG.aka[0].domain) != 0) && (strcasecmp(domain,CFG.aka[0].domain) != 0)) {
|
||||||
if (domain)
|
if ((p = strrchr(buf,'/')))
|
||||||
free(domain);
|
p++;
|
||||||
return 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 *pktname(faddr *addr, char flavor)
|
||||||
{
|
{
|
||||||
char *p;
|
static char *p, *q;
|
||||||
|
|
||||||
p = prepbuf(addr);
|
p = prepbuf(addr);
|
||||||
if (flavor == 'f')
|
if (flavor == 'f')
|
||||||
flavor = 'o';
|
flavor = 'o';
|
||||||
|
|
||||||
sprintf(p, "%c%s", flavor, ptyp);
|
q = p + strlen(p);
|
||||||
Syslog('O', "packet name is \"%s\"",buf);
|
sprintf(q, "%c%s", flavor, ptyp);
|
||||||
return buf;
|
Syslog('O', "packet name is \"%s\"", p);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *floname(faddr *addr, char flavor)
|
char *floname(faddr *addr, char flavor)
|
||||||
{
|
{
|
||||||
char *p;
|
static char *p, *q;
|
||||||
|
|
||||||
p = prepbuf(addr);
|
p = prepbuf(addr);
|
||||||
if (flavor == 'o')
|
if (flavor == 'o')
|
||||||
flavor = 'f';
|
flavor = 'f';
|
||||||
sprintf(p, "%c%s", flavor, ftyp);
|
q = p + strlen(p);
|
||||||
Syslog('O', "flo file name is \"%s\"",buf);
|
sprintf(q, "%c%s", flavor, ftyp);
|
||||||
return buf;
|
Syslog('O', "flo file name is \"%s\"", p);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *reqname(faddr *addr)
|
char *reqname(faddr *addr)
|
||||||
{
|
{
|
||||||
char *p;
|
static char *p, *q;
|
||||||
|
|
||||||
p = prepbuf(addr);
|
p = prepbuf(addr);
|
||||||
sprintf(p, "%s", rtyp);
|
q = p + strlen(p);
|
||||||
Syslog('O', "req file name is \"%s\"",buf);
|
sprintf(q, "%s", rtyp);
|
||||||
return buf;
|
Syslog('O', "req file name is \"%s\"", p);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *splname(faddr *addr)
|
char *splname(faddr *addr)
|
||||||
{
|
{
|
||||||
char *p;
|
static char *p, *q;
|
||||||
|
|
||||||
p = prepbuf(addr);
|
p = prepbuf(addr);
|
||||||
sprintf(p, "%s", styp);
|
q = p + strlen(p);
|
||||||
Syslog('O', "spl file name is \"%s\"",buf);
|
sprintf(q, "%s", styp);
|
||||||
return buf;
|
Syslog('O', "spl file name is \"%s\"", p);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *bsyname(faddr *addr)
|
char *bsyname(faddr *addr)
|
||||||
{
|
{
|
||||||
char *p;
|
static char *p, *q;
|
||||||
|
|
||||||
p = prepbuf(addr);
|
p = prepbuf(addr);
|
||||||
sprintf(p, "%s", btyp);
|
q = p + strlen(p);
|
||||||
Syslog('O', "bsy file name is \"%s\"",buf);
|
sprintf(q, "%s", btyp);
|
||||||
return buf;
|
Syslog('O', "bsy file name is \"%s\"", p);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *stsname(faddr *addr)
|
char *stsname(faddr *addr)
|
||||||
{
|
{
|
||||||
char *p;
|
static char *p, *q;
|
||||||
|
|
||||||
p = prepbuf(addr);
|
p = prepbuf(addr);
|
||||||
sprintf(p, "%s", qtyp);
|
q = p + strlen(p);
|
||||||
Syslog('O', "sts file name is \"%s\"",buf);
|
sprintf(q, "%s", qtyp);
|
||||||
return buf;
|
Syslog('O', "sts file name is \"%s\"", p);
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *polname(faddr *addr)
|
char *polname(faddr *addr)
|
||||||
{
|
{
|
||||||
char *p;
|
static char *p, *q;
|
||||||
|
|
||||||
p = prepbuf(addr);
|
p = prepbuf(addr);
|
||||||
sprintf(p, "%s", ltyp);
|
q = p + strlen(p);
|
||||||
Syslog('O', "pol file name is \"%s\"", buf);
|
sprintf(q, "%s", ltyp);
|
||||||
return buf;
|
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)
|
char *dayname(void)
|
||||||
{
|
{
|
||||||
time_t tt;
|
time_t tt;
|
||||||
struct tm *ptm;
|
struct tm *ptm;
|
||||||
|
static char buf[3];
|
||||||
|
|
||||||
tt = time(NULL);
|
tt = time(NULL);
|
||||||
ptm = localtime(&tt);
|
ptm = localtime(&tt);
|
||||||
sprintf(buf, "%s", dow[ptm->tm_wday]);
|
sprintf(buf, "%s", dow[ptm->tm_wday]);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *arcname(faddr *addr, unsigned short Zone, int ARCmailCompat)
|
char *arcname(faddr *addr, unsigned short Zone, int ARCmailCompat)
|
||||||
{
|
{
|
||||||
|
static char *buf;
|
||||||
char *p;
|
char *p;
|
||||||
char *ext;
|
char *ext;
|
||||||
time_t tt;
|
time_t tt;
|
||||||
@ -252,7 +257,7 @@ char *arcname(faddr *addr, unsigned short Zone, int ARCmailCompat)
|
|||||||
|
|
||||||
bestaka = bestaka_s(addr);
|
bestaka = bestaka_s(addr);
|
||||||
|
|
||||||
(void)prepbuf(addr);
|
buf = prepbuf(addr);
|
||||||
p = strrchr(buf, '/');
|
p = strrchr(buf, '/');
|
||||||
|
|
||||||
if (!ARCmailCompat && (Zone != addr->zone)) {
|
if (!ARCmailCompat && (Zone != addr->zone)) {
|
||||||
|
@ -127,18 +127,14 @@ void ulockprogram(char *progname)
|
|||||||
free(lockfile);
|
free(lockfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fscanf(fp, "%u", &oldpid) != 1) {
|
if (fscanf(fp, "%u", &oldpid) != 1) {
|
||||||
WriteError("$Can't read old pid from \"%s\"", lockfile);
|
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);
|
free(lockfile);
|
||||||
|
lockfile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,10 @@ void die(int onsig)
|
|||||||
|
|
||||||
t_end = time(NULL);
|
t_end = time(NULL);
|
||||||
Syslog(' ', "MBCICO finished in %s", t_elapsed(t_start, t_end));
|
Syslog(' ', "MBCICO finished in %s", t_elapsed(t_start, t_end));
|
||||||
|
|
||||||
free_mem();
|
free_mem();
|
||||||
|
deinitnl();
|
||||||
|
|
||||||
if (envptr)
|
if (envptr)
|
||||||
free(envptr);
|
free(envptr);
|
||||||
ExitClient(onsig);
|
ExitClient(onsig);
|
||||||
@ -190,9 +193,9 @@ int main(int argc, char *argv[])
|
|||||||
* Catch all signals we can, and ignore the rest.
|
* Catch all signals we can, and ignore the rest.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == 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);
|
signal(i, (void (*))die);
|
||||||
} else {
|
} else if ((i != SIGKILL) && (i != SIGSTOP)) {
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "outstat.h"
|
#include "outstat.h"
|
||||||
#include "nlinfo.h"
|
#include "nlinfo.h"
|
||||||
|
|
||||||
|
extern int most_debug;
|
||||||
|
|
||||||
extern int do_quiet; /* Suppress screen output */
|
extern int do_quiet; /* Suppress screen output */
|
||||||
int do_attach = FALSE; /* Send file attaches */
|
int do_attach = FALSE; /* Send file attaches */
|
||||||
@ -179,6 +180,8 @@ int main(int argc, char *argv[])
|
|||||||
FILE *fl;
|
FILE *fl;
|
||||||
unsigned long cmmask;
|
unsigned long cmmask;
|
||||||
|
|
||||||
|
most_debug = TRUE;
|
||||||
|
|
||||||
InitConfig();
|
InitConfig();
|
||||||
InitNode();
|
InitNode();
|
||||||
InitFidonet();
|
InitFidonet();
|
||||||
|
@ -373,7 +373,7 @@ int poll(faddr *addr, int stop)
|
|||||||
if (addr == NULL)
|
if (addr == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pol = polname(addr);
|
pol = xstrcpy(polname(addr));
|
||||||
|
|
||||||
if (stop) {
|
if (stop) {
|
||||||
if (access(pol, R_OK) == 0) {
|
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));
|
Syslog('+', "Node %s not in nodelist", ascfnode(addr, 0x1f));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Node %s not in nodelist", ascfnode(addr, 0x1f));
|
printf("Node %s not in nodelist", ascfnode(addr, 0x1f));
|
||||||
|
free(pol);
|
||||||
return MBERR_NODE_NOT_IN_LIST;
|
return MBERR_NODE_NOT_IN_LIST;
|
||||||
}
|
}
|
||||||
if (nlent->pflag == NL_DOWN) {
|
if (nlent->pflag == NL_DOWN) {
|
||||||
Syslog('+', "Node %s has status Down", ascfnode(addr, 0x1f));
|
Syslog('+', "Node %s has status Down", ascfnode(addr, 0x1f));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Node %s has status Down", ascfnode(addr, 0x1f));
|
printf("Node %s has status Down", ascfnode(addr, 0x1f));
|
||||||
|
free(pol);
|
||||||
return MBERR_NODE_MAY_NOT_CALL;
|
return MBERR_NODE_MAY_NOT_CALL;
|
||||||
}
|
}
|
||||||
if (nlent->pflag == NL_HOLD) {
|
if (nlent->pflag == NL_HOLD) {
|
||||||
Syslog('+', "Node %s has status Hold", ascfnode(addr, 0x1f));
|
Syslog('+', "Node %s has status Hold", ascfnode(addr, 0x1f));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Node %s has status Hold", ascfnode(addr, 0x1f));
|
printf("Node %s has status Hold", ascfnode(addr, 0x1f));
|
||||||
|
free(pol);
|
||||||
return MBERR_NODE_MAY_NOT_CALL;
|
return MBERR_NODE_MAY_NOT_CALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,6 +441,7 @@ int poll(faddr *addr, int stop)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(pol);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,6 +215,7 @@ int dirinbound(void)
|
|||||||
}
|
}
|
||||||
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
|
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
free(temp);
|
free(temp);
|
||||||
Syslog('m', "Finished directory inbound sessions");
|
Syslog('m', "Finished directory inbound sessions");
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Announce new files and FileFind
|
* Purpose ...............: Announce new files and FileFind
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -112,7 +112,7 @@ int main(int argc, char **argv)
|
|||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,9 +130,9 @@ int main(int argc, char **argv)
|
|||||||
* Catch all signals we can, and ignore the rest.
|
* Catch all signals we can, and ignore the rest.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGKILL))
|
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,6 +202,7 @@ void die(int onsig)
|
|||||||
Msg_Close();
|
Msg_Close();
|
||||||
|
|
||||||
signal(onsig, SIG_IGN);
|
signal(onsig, SIG_IGN);
|
||||||
|
deinitnl();
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
show_log = TRUE;
|
show_log = TRUE;
|
||||||
@ -320,9 +321,9 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
for(i = 0; i < NSIG; i++) {
|
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);
|
signal(i, (void (*))die);
|
||||||
else
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,9 +88,9 @@ int main(int argc, char **argv)
|
|||||||
* Catch all signals we can, and ignore the rest.
|
* Catch all signals we can, and ignore the rest.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGKILL) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,9 +324,9 @@ void closepage(FILE *fa, char *Path, int inArea, int Current, FILE *fi)
|
|||||||
sprintf(temp2, "%s/index.temp", Path);
|
sprintf(temp2, "%s/index.temp", Path);
|
||||||
}
|
}
|
||||||
rename(temp2, temp1);
|
rename(temp2, temp1);
|
||||||
|
chmod(temp1, 0644);
|
||||||
free(temp1);
|
free(temp1);
|
||||||
free(temp2);
|
free(temp2);
|
||||||
chmod(temp1, 0644);
|
|
||||||
fa = NULL;
|
fa = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ int main(int argc,char *argv[])
|
|||||||
|
|
||||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV))
|
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
signal(i, SIG_IGN);
|
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);
|
fill_nllist(ndx, &nll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(nl);
|
||||||
Syslog('+', "%d entries", entries);
|
Syslog('+', "%d entries", entries);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
|
161
mbfido/mbmsg.c
161
mbfido/mbmsg.c
@ -83,100 +83,99 @@ void ProgName()
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *cmd, *too = NULL, *subj = NULL, *mfile = NULL, *flavor = NULL;
|
char *cmd, *too = NULL, *subj = NULL, *mfile = NULL, *flavor = NULL;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
long tarea = 0;
|
long tarea = 0;
|
||||||
|
|
||||||
|
|
||||||
InitConfig();
|
InitConfig();
|
||||||
TermInit(1);
|
TermInit(1);
|
||||||
oldmask = umask(007);
|
oldmask = umask(007);
|
||||||
t_start = time(NULL);
|
t_start = time(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Catch all signals we can, and ignore or catch them
|
* Catch all signals we can, and ignore or catch them
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) ||
|
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
(i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
signal(i, (void (*))die);
|
||||||
signal(i, (void (*))die);
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
else
|
signal(i, SIG_IGN);
|
||||||
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 (strncasecmp(argv[i], "-a", 2) == 0) {
|
||||||
if (argc < 2)
|
i++;
|
||||||
Help();
|
do_area = atoi(argv[i]);
|
||||||
|
|
||||||
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], "-q", 2) == 0)
|
||||||
|
do_quiet = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(do_index || do_link || do_kill || do_pack || do_post))
|
if (!(do_index || do_link || do_kill || do_pack || do_post))
|
||||||
Help();
|
Help();
|
||||||
|
|
||||||
ProgName();
|
ProgName();
|
||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
InitClient(pw->pw_name, (char *)"mbmsg", CFG.location, CFG.logfile,
|
InitClient(pw->pw_name, (char *)"mbmsg", CFG.location, CFG.logfile,
|
||||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||||
|
|
||||||
Syslog(' ', " ");
|
Syslog(' ', " ");
|
||||||
Syslog(' ', "MBMSG v%s", VERSION);
|
Syslog(' ', "MBMSG v%s", VERSION);
|
||||||
Syslog(' ', cmd);
|
Syslog(' ', cmd);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
colour(3, 0);
|
colour(3, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_index || do_link || do_kill || do_pack) {
|
if (do_index || do_link || do_kill || do_pack) {
|
||||||
memset(&MsgBase, 0, sizeof(MsgBase));
|
memset(&MsgBase, 0, sizeof(MsgBase));
|
||||||
DoMsgBase();
|
DoMsgBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_post) {
|
if (do_post) {
|
||||||
Post(too, tarea, subj, mfile, flavor);
|
Post(too, tarea, subj, mfile, flavor);
|
||||||
}
|
}
|
||||||
|
|
||||||
die(MBERR_OK);
|
die(MBERR_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Netmail tracker / router
|
* Purpose ...............: Netmail tracker / router
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -267,6 +267,7 @@ int IsLocal(char *ftn, fidoaddr *res)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tidy_faddr(dest);
|
||||||
return R_NOROUTE;
|
return R_NOROUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,9 +379,9 @@ int AreWeHost(faddr *dest)
|
|||||||
|
|
||||||
int AreWeHub(faddr *dest)
|
int AreWeHub(faddr *dest)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
node *nl;
|
node *nl;
|
||||||
faddr *fido;
|
faddr *fido;
|
||||||
|
|
||||||
for (i = 0; i < 40; i++)
|
for (i = 0; i < 40; i++)
|
||||||
if (CFG.akavalid[i])
|
if (CFG.akavalid[i])
|
||||||
|
103
mbmon/common.c
103
mbmon/common.c
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Common utilities
|
* Purpose ...............: Common utilities
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2001
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -207,65 +207,64 @@ void Nopper(void)
|
|||||||
|
|
||||||
int socket_connect(char *user)
|
int socket_connect(char *user)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
static char buf[SS_BUFSIZE];
|
static char buf[SS_BUFSIZE], tty[18];
|
||||||
char tty[18];
|
|
||||||
|
|
||||||
if ((s = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
|
if ((s = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
|
||||||
perror("mbmon");
|
perror("mbmon");
|
||||||
printf("Unable to create Unix Datagram socket\n");
|
printf("Unable to create Unix Datagram socket\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&clntaddr, 0, sizeof(clntaddr));
|
memset(&clntaddr, 0, sizeof(clntaddr));
|
||||||
clntaddr.sun_family = AF_UNIX;
|
clntaddr.sun_family = AF_UNIX;
|
||||||
strcpy(clntaddr.sun_path, cpath);
|
strcpy(clntaddr.sun_path, cpath);
|
||||||
|
|
||||||
if (bind(s, (struct sockaddr *)&clntaddr, sizeof(clntaddr)) < 0) {
|
if (bind(s, (struct sockaddr *)&clntaddr, sizeof(clntaddr)) < 0) {
|
||||||
close(s);
|
close(s);
|
||||||
perror("mbmon");
|
perror("mbmon");
|
||||||
printf("Can't bind socket %s\n", cpath);
|
printf("Can't bind socket %s\n", cpath);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&servaddr, 0, sizeof(servaddr));
|
memset(&servaddr, 0, sizeof(servaddr));
|
||||||
servaddr.sun_family = AF_UNIX;
|
servaddr.sun_family = AF_UNIX;
|
||||||
sprintf(servaddr.sun_path, "%s", (char *)spath);
|
sprintf(servaddr.sun_path, "%s", (char *)spath);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that we have an connection, we gather
|
* Now that we have an connection, we gather
|
||||||
* information to tell the server who we are.
|
* information to tell the server who we are.
|
||||||
*/
|
*/
|
||||||
if (isatty(1) && (ttyname(1) != NULL)) {
|
if (isatty(1) && (ttyname(1) != NULL)) {
|
||||||
strcpy(tty, ttyname(1));
|
strcpy(tty, ttyname(1));
|
||||||
if (strchr(tty, 'p'))
|
if (strchr(tty, 'p'))
|
||||||
strcpy(tty, index(tty, 'p'));
|
memccpy(tty, index(tty, 'p'), '\0', strlen(tty));
|
||||||
else if (strchr(tty, 't'))
|
else if (strchr(tty, 't'))
|
||||||
strcpy(tty, index(tty, 't'));
|
memccpy(tty, index(tty, 't'), '\0', strlen(tty));
|
||||||
else if (strchr(tty, 'c'))
|
else if (strchr(tty, 'c'))
|
||||||
strcpy(tty, index(tty, 'c'));
|
memccpy(tty, index(tty, 'c'), '\0', strlen(tty));
|
||||||
} else {
|
} else {
|
||||||
strcpy(tty, "-");
|
strcpy(tty, "-");
|
||||||
}
|
}
|
||||||
sock = s;
|
sock = s;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send the information to the server.
|
* Send the information to the server.
|
||||||
*/
|
*/
|
||||||
sprintf(buf, "AINI:5,%d,%s,%s,mbmon,localhost;", getpid(), tty, user);
|
sprintf(buf, "AINI:5,%d,%s,%s,mbmon,localhost;", getpid(), tty, user);
|
||||||
if (socket_send(buf) != 0) {
|
if (socket_send(buf) != 0) {
|
||||||
sock = -1;
|
sock = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
if (strncmp(buf, "100:0;", 6) != 0) {
|
if (strncmp(buf, "100:0;", 6) != 0) {
|
||||||
printf("AINI not acknowledged by the server\n");
|
printf("AINI not acknowledged by the server\n");
|
||||||
sock = -1;
|
sock = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
120
mbmon/mbmon.c
120
mbmon/mbmon.c
@ -318,72 +318,70 @@ void system_stat(void)
|
|||||||
|
|
||||||
void disk_stat(void)
|
void disk_stat(void)
|
||||||
{
|
{
|
||||||
int ch, i;
|
int ch, i;
|
||||||
char buf[1024];
|
char buf[1024], *cnt, *type, *fs, *p, sign;
|
||||||
char *cnt, *type, *fs, *p;
|
unsigned long last[10], size, used, perc;
|
||||||
unsigned long last[10];
|
|
||||||
unsigned long size, used, perc;
|
|
||||||
char sign;
|
|
||||||
|
|
||||||
clr_index();
|
clr_index();
|
||||||
set_color(WHITE, BLACK);
|
set_color(WHITE, BLACK);
|
||||||
mvprintw( 5, 6, "3. FILESYSTEM USAGE");
|
mvprintw( 5, 6, "3. FILESYSTEM USAGE");
|
||||||
set_color(YELLOW, RED);
|
set_color(YELLOW, RED);
|
||||||
mvprintw( 7, 1, " Size MB Used MB Perc. FS-Type Mountpoint ");
|
mvprintw( 7, 1, " Size MB Used MB Perc. FS-Type Mountpoint ");
|
||||||
set_color(CYAN, BLACK);
|
set_color(CYAN, BLACK);
|
||||||
mvprintw(lines - 2, 6, "Press any key");
|
mvprintw(lines - 2, 6, "Press any key");
|
||||||
IsDoing("Filesystem Usage");
|
IsDoing("Filesystem Usage");
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
last[i] = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
show_date(LIGHTGRAY, BLACK, 0, 0);
|
show_date(LIGHTGRAY, BLACK, 0, 0);
|
||||||
|
|
||||||
sprintf(buf, "GDST:1,%d;", getpid());
|
sprintf(buf, "GDST:1,%d;", getpid());
|
||||||
if (socket_send(buf) == 0) {
|
if (socket_send(buf) == 0) {
|
||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
set_color(LIGHTGRAY, BLACK);
|
set_color(LIGHTGRAY, BLACK);
|
||||||
cnt = strtok(buf, ":");
|
cnt = strtok(buf, ":");
|
||||||
cnt = strtok(NULL, ",;");
|
cnt = strtok(NULL, ",;");
|
||||||
if (atoi(cnt)) {
|
if (atoi(cnt)) {
|
||||||
for (i = 0; i < atoi(cnt); i++) {
|
for (i = 0; i < atoi(cnt); i++) {
|
||||||
p = strtok(NULL, " ");
|
p = strtok(NULL, " ");
|
||||||
size = atoi(p);
|
size = atoi(p);
|
||||||
p = strtok(NULL, " ");
|
p = strtok(NULL, " ");
|
||||||
used = size - atoi(p);
|
used = size - atoi(p);
|
||||||
perc = (used * 100) / size;
|
perc = (used * 100) / size;
|
||||||
sign = ' ';
|
sign = ' ';
|
||||||
fs = strtok(NULL, " ");
|
fs = strtok(NULL, " ");
|
||||||
type = strtok(NULL, ",;");
|
type = strtok(NULL, ",;");
|
||||||
if (used > last[i])
|
if (used > last[i])
|
||||||
sign = '^';
|
sign = '^';
|
||||||
if (used < last[i])
|
if (used < last[i])
|
||||||
sign = 'v';
|
sign = 'v';
|
||||||
if (last[i] == 0)
|
if (last[i] == 0)
|
||||||
sign = ' ';
|
sign = ' ';
|
||||||
last[i] = used;
|
last[i] = used;
|
||||||
set_color(CYAN, BLACK);
|
set_color(CYAN, BLACK);
|
||||||
mvprintw(i+8, 1, "%8lu %8lu ",
|
mvprintw(i+8, 1, "%8lu %8lu ", size, used);
|
||||||
size, used);
|
set_color(WHITE, BLACK);
|
||||||
set_color(WHITE, BLACK);
|
printf("%c ", sign);
|
||||||
printf("%c ", sign);
|
set_color(CYAN, BLACK);
|
||||||
set_color(CYAN, BLACK);
|
if (strstr(type, "iso") == NULL) {
|
||||||
if (strstr(type, "iso") == NULL) {
|
if (perc >= 95)
|
||||||
if (perc >= 95)
|
set_color(LIGHTRED, BLACK);
|
||||||
set_color(LIGHTRED, BLACK);
|
else if (perc >= 80)
|
||||||
else if (perc >= 80)
|
set_color(YELLOW, BLACK);
|
||||||
set_color(YELLOW, BLACK);
|
}
|
||||||
}
|
printf("%3lu", perc);
|
||||||
printf("%3lu", perc);
|
putchar('%');
|
||||||
putchar('%');
|
set_color(CYAN, BLACK);
|
||||||
set_color(CYAN, BLACK);
|
printf(" %-8s %-40s", type, fs);
|
||||||
printf(" %-8s %-40s", type, fs);
|
|
||||||
}
|
|
||||||
locate(i+8, 1);
|
|
||||||
clrtoeol();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
locate(i+8, 1);
|
||||||
|
clrtoeol();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ch = testkey(lines - 2, 20);
|
ch = testkey(lines - 2, 20);
|
||||||
} while (ch == '\0');
|
} while (ch == '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ void ulockprogram(char *progname)
|
|||||||
free(lockfile);
|
free(lockfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
if (oldpid == getpid()) {
|
if (oldpid == getpid()) {
|
||||||
(void)unlink(lockfile);
|
(void)unlink(lockfile);
|
||||||
|
@ -145,13 +145,13 @@ int main(int argc, char **argv)
|
|||||||
* Catch all signals we can, and ignore the rest.
|
* Catch all signals we can, and ignore the rest.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGKILL) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc < 2)
|
if (argc < 2)
|
||||||
Help();
|
Help();
|
||||||
|
|
||||||
cmd = xstrcpy((char *)"Command line: mball");
|
cmd = xstrcpy((char *)"Command line: mball");
|
||||||
@ -320,10 +320,11 @@ void Masterlist()
|
|||||||
Syslog('+', "Inserting %s", temp);
|
Syslog('+', "Inserting %s", temp);
|
||||||
|
|
||||||
while( fgets(temp, 80 ,pHeader) != NULL) {
|
while( fgets(temp, 80 ,pHeader) != NULL) {
|
||||||
Striplf(temp);
|
Striplf(temp);
|
||||||
fprintf(fp, "%s\r\n", temp);
|
fprintf(fp, "%s\r\n", temp);
|
||||||
fprintf(np, "%s\r\n", temp);
|
fprintf(np, "%s\r\n", temp);
|
||||||
}
|
}
|
||||||
|
fclose(pHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
|
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
|
||||||
@ -457,6 +458,7 @@ void Masterlist()
|
|||||||
fprintf(fp, "%s\r\n", temp);
|
fprintf(fp, "%s\r\n", temp);
|
||||||
fprintf(np, "%s\r\n", temp);
|
fprintf(np, "%s\r\n", temp);
|
||||||
}
|
}
|
||||||
|
fclose(pHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -505,6 +507,7 @@ void MakeArc()
|
|||||||
(char *)"/dev/null", (char *)"/dev/null") == 0)
|
(char *)"/dev/null", (char *)"/dev/null") == 0)
|
||||||
WriteError("Create newfiles.zip failed");
|
WriteError("Create newfiles.zip failed");
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
cmd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,6 +125,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((tty = ttyname(0)) == NULL) {
|
if ((tty = ttyname(0)) == NULL) {
|
||||||
WriteError("Not at a tty");
|
WriteError("Not at a tty");
|
||||||
|
Free_Language();
|
||||||
Quick_Bye(MBERR_OK);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +161,7 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (CheckStatus() == FALSE) {
|
if (CheckStatus() == FALSE) {
|
||||||
Syslog('+', "Kicking user out, the BBS is closed");
|
Syslog('+', "Kicking user out, the BBS is closed");
|
||||||
|
Free_Language();
|
||||||
Quick_Bye(MBERR_OK);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +194,7 @@ int main(int argc, char **argv)
|
|||||||
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
||||||
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
||||||
printf("No BBS on this port allowed!\n\n");
|
printf("No BBS on this port allowed!\n\n");
|
||||||
|
Free_Language();
|
||||||
Quick_Bye(MBERR_OK);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ int main(int argc, char **argv)
|
|||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +387,10 @@ void UserPack(int days, int level, int pack)
|
|||||||
fclose(fout);
|
fclose(fout);
|
||||||
chmod(fnin, 0660);
|
chmod(fnin, 0660);
|
||||||
Syslog('+', "Userbase is updated, written %d records", record);
|
Syslog('+', "Userbase is updated, written %d records", record);
|
||||||
|
} else {
|
||||||
|
fclose(fout);
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(fnout);
|
unlink(fnout);
|
||||||
free(fnin);
|
free(fnin);
|
||||||
free(fnout);
|
free(fnout);
|
||||||
|
@ -211,6 +211,7 @@ void user()
|
|||||||
printf("%s\n", (char *) Language(390));
|
printf("%s\n", (char *) Language(390));
|
||||||
Syslog('?', "FATAL: Could not find user in BBS users file.");
|
Syslog('?', "FATAL: Could not find user in BBS users file.");
|
||||||
Syslog('?', " and system is using unix accounts\n");
|
Syslog('?', " and system is using unix accounts\n");
|
||||||
|
Free_Language();
|
||||||
ExitClient(MBERR_OK);
|
ExitClient(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,53 +463,55 @@ void InitFidonetdb(void)
|
|||||||
|
|
||||||
void gold_akamatch(FILE *fp)
|
void gold_akamatch(FILE *fp)
|
||||||
{
|
{
|
||||||
char temp[PATH_MAX];
|
char temp[PATH_MAX];
|
||||||
FILE *fido;
|
FILE *fido;
|
||||||
faddr *want;
|
faddr *want, *ta;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sprintf(temp, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
|
||||||
if ((fido = fopen(temp, "r")) == NULL)
|
if ((fido = fopen(temp, "r")) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf(fp, "; AKA Matching\n;\n");
|
fprintf(fp, "; AKA Matching\n;\n");
|
||||||
want = (faddr *)malloc(sizeof(faddr));
|
want = (faddr *)malloc(sizeof(faddr));
|
||||||
|
|
||||||
fread(&fidonethdr, sizeof(fidonethdr), 1, fido);
|
fread(&fidonethdr, sizeof(fidonethdr), 1, fido);
|
||||||
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
|
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
if (fidonet.zone[i]) {
|
if (fidonet.zone[i]) {
|
||||||
want->zone = fidonet.zone[0];
|
want->zone = fidonet.zone[0];
|
||||||
want->net = 0;
|
want->net = 0;
|
||||||
want->node = 0;
|
want->node = 0;
|
||||||
want->point = 0;
|
want->point = 0;
|
||||||
want->name = NULL;
|
want->name = NULL;
|
||||||
want->domain = NULL;
|
want->domain = NULL;
|
||||||
fprintf(fp, "AKAMATCH %d:* %s\n", fidonet.zone[i], ascfnode(bestaka_s(want), 0xf));
|
ta = bestaka_s(want);
|
||||||
}
|
fprintf(fp, "AKAMATCH %d:* %s\n", fidonet.zone[i], ascfnode(ta, 0xf));
|
||||||
}
|
tidy_faddr(ta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(want);
|
free(want);
|
||||||
fprintf(fp, ";\n");
|
fprintf(fp, ";\n");
|
||||||
fprintf(fp, "AKAMATCHNET YES\n");
|
fprintf(fp, "AKAMATCHNET YES\n");
|
||||||
fprintf(fp, "AKAMATCHECHO YES\n"); /* On request, should work better */
|
fprintf(fp, "AKAMATCHECHO YES\n");
|
||||||
fprintf(fp, "AKAMATCHLOCAL NO\n\n");
|
fprintf(fp, "AKAMATCHLOCAL NO\n\n");
|
||||||
|
|
||||||
fprintf(fp, "; NODELISTS\n;\n");
|
fprintf(fp, "; NODELISTS\n;\n");
|
||||||
fprintf(fp, "NODEPATH %s/\n", CFG.nodelists);
|
fprintf(fp, "NODEPATH %s/\n", CFG.nodelists);
|
||||||
fseek(fido, fidonethdr.hdrsize, SEEK_SET);
|
fseek(fido, fidonethdr.hdrsize, SEEK_SET);
|
||||||
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
|
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
|
||||||
fprintf(fp, "NODELIST %s.*\n", fidonet.nodelist);
|
fprintf(fp, "NODELIST %s.*\n", fidonet.nodelist);
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
if (strlen(fidonet.seclist[i].nodelist) || fidonet.seclist[i].zone)
|
if (strlen(fidonet.seclist[i].nodelist) || fidonet.seclist[i].zone)
|
||||||
fprintf(fp, "NODELIST %s.*\n", fidonet.seclist[i].nodelist);
|
fprintf(fp, "NODELIST %s.*\n", fidonet.seclist[i].nodelist);
|
||||||
}
|
}
|
||||||
// fprintf(fp, "USERLIST golded.lst\n");
|
// fprintf(fp, "USERLIST golded.lst\n");
|
||||||
fprintf(fp, "LOOKUPNET YES\n");
|
fprintf(fp, "LOOKUPNET YES\n");
|
||||||
fprintf(fp, "LOOKUPECHO NO\n");
|
fprintf(fp, "LOOKUPECHO NO\n");
|
||||||
fprintf(fp, "LOOKUPLOCAL NO\n\n");
|
fprintf(fp, "LOOKUPLOCAL NO\n\n");
|
||||||
fclose(fido);
|
fclose(fido);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ void s_fidomailcfg(void)
|
|||||||
mvprintw(12,42, "13. 4d address");
|
mvprintw(12,42, "13. 4d address");
|
||||||
mvprintw(13,42, "14. Split at");
|
mvprintw(13,42, "14. Split at");
|
||||||
mvprintw(14,42, "15. Force at");
|
mvprintw(14,42, "15. Force at");
|
||||||
mvprintw(15,42, "16. Allow %+*");
|
mvprintw(15,42, "16. Allow +*");
|
||||||
mvprintw(16,42, "17. Notify");
|
mvprintw(16,42, "17. Notify");
|
||||||
mvprintw(17,42, "18. Passwd");
|
mvprintw(17,42, "18. Passwd");
|
||||||
mvprintw(18,42, "19. Pause");
|
mvprintw(18,42, "19. Pause");
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Message Areas Setup
|
* Purpose ...............: Message Areas Setup
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -535,48 +535,48 @@ void SetScreen()
|
|||||||
long LoadMsgRec(int, int);
|
long LoadMsgRec(int, int);
|
||||||
long LoadMsgRec(int Area, int work)
|
long LoadMsgRec(int Area, int work)
|
||||||
{
|
{
|
||||||
FILE *fil;
|
FILE *fil;
|
||||||
char mfile[PATH_MAX];
|
char mfile[PATH_MAX];
|
||||||
long offset;
|
long offset;
|
||||||
sysconnect System;
|
sysconnect System;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (work)
|
if (work)
|
||||||
working(1, 0, 0);
|
working(1, 0, 0);
|
||||||
|
|
||||||
sprintf(mfile, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
|
sprintf(mfile, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
|
||||||
if ((fil = fopen(mfile, "r")) == NULL) {
|
if ((fil = fopen(mfile, "r")) == NULL) {
|
||||||
working(2, 0, 0);
|
working(2, 0, 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tfil = tmpfile()) == NULL) {
|
if ((tfil = tmpfile()) == NULL) {
|
||||||
working(2, 0, 0);
|
working(2, 0, 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&msgshdr, sizeof(msgshdr), 1, fil);
|
fread(&msgshdr, sizeof(msgshdr), 1, fil);
|
||||||
offset = msgshdr.hdrsize + (((Area -1) * (msgshdr.recsize + msgshdr.syssize)));
|
offset = msgshdr.hdrsize + (((Area -1) * (msgshdr.recsize + msgshdr.syssize)));
|
||||||
if (fseek(fil, offset, SEEK_SET) != 0) {
|
if (fseek(fil, offset, SEEK_SET) != 0) {
|
||||||
fclose(tfil);
|
fclose(tfil);
|
||||||
tfil = NULL;
|
tfil = NULL;
|
||||||
working(2, 0, 0);
|
working(2, 0, 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&msgs, msgshdr.recsize, 1, fil);
|
fread(&msgs, msgshdr.recsize, 1, fil);
|
||||||
MsgCrc = 0xffffffff;
|
MsgCrc = 0xffffffff;
|
||||||
MsgCrc = upd_crc32((char *)&msgs, MsgCrc, msgshdr.recsize);
|
MsgCrc = upd_crc32((char *)&msgs, MsgCrc, msgshdr.recsize);
|
||||||
for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) {
|
for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) {
|
||||||
fread(&System, sizeof(sysconnect), 1, fil);
|
fread(&System, sizeof(sysconnect), 1, fil);
|
||||||
fwrite(&System, sizeof(sysconnect), 1, tfil);
|
fwrite(&System, sizeof(sysconnect), 1, tfil);
|
||||||
MsgCrc = upd_crc32((char *)&System, MsgCrc, sizeof(sysconnect));
|
MsgCrc = upd_crc32((char *)&System, MsgCrc, sizeof(sysconnect));
|
||||||
}
|
}
|
||||||
fclose(fil);
|
fclose(fil);
|
||||||
if (work)
|
if (work)
|
||||||
working(0, 0, 0);
|
working(0, 0, 0);
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -714,7 +714,8 @@ void MsgGlobal(void)
|
|||||||
|
|
||||||
menu = select_menu(13);
|
menu = select_menu(13);
|
||||||
switch (menu) {
|
switch (menu) {
|
||||||
case 0: return;
|
case 0: tidy_grlist(&mgr);
|
||||||
|
return;
|
||||||
case 1: a1 = PullUplink((char *)"AKA TO DELETE");
|
case 1: a1 = PullUplink((char *)"AKA TO DELETE");
|
||||||
break;
|
break;
|
||||||
case 2: a2 = PullUplink((char *)"AKA TO ADD");
|
case 2: a2 = PullUplink((char *)"AKA TO ADD");
|
||||||
@ -991,6 +992,7 @@ void MsgGlobal(void)
|
|||||||
}
|
}
|
||||||
if (tfil != NULL)
|
if (tfil != NULL)
|
||||||
fclose(tfil);
|
fclose(tfil);
|
||||||
|
tfil = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
working(0, 0, 0);
|
working(0, 0, 0);
|
||||||
@ -1099,6 +1101,9 @@ int EditMsgRec(int Area)
|
|||||||
Syslog('+', "Saved message area record %d", Area);
|
Syslog('+', "Saved message area record %d", Area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (tfil != NULL)
|
||||||
|
fclose(tfil);
|
||||||
|
tfil = NULL;
|
||||||
IsDoing("Browsing Menu");
|
IsDoing("Browsing Menu");
|
||||||
return 0;
|
return 0;
|
||||||
case 1: E_STR( 6,16,40,msgs.Name, "The ^Name^ of this area")
|
case 1: E_STR( 6,16,40,msgs.Name, "The ^Name^ of this area")
|
||||||
|
@ -270,10 +270,10 @@ void CloseNoderec(int Force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
chmod(fin, 0640);
|
chmod(fin, 0640);
|
||||||
|
unlink(fout);
|
||||||
working(1, 0, 0);
|
working(1, 0, 0);
|
||||||
free(fin);
|
free(fin);
|
||||||
free(fout);
|
free(fout);
|
||||||
unlink(fout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: TIC Areas Setup Program
|
* Purpose ...............: TIC Areas Setup Program
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -611,7 +611,8 @@ void TicGlobal(void)
|
|||||||
|
|
||||||
menu = select_menu(7);
|
menu = select_menu(7);
|
||||||
switch (menu) {
|
switch (menu) {
|
||||||
case 0: return;
|
case 0: tidy_grlist(&mgr);
|
||||||
|
return;
|
||||||
case 1: a1 = PullUplink((char *)"AKA TO DELETE");
|
case 1: a1 = PullUplink((char *)"AKA TO DELETE");
|
||||||
break;
|
break;
|
||||||
case 2: a2 = PullUplink((char *)"AKA TO ADD");
|
case 2: a2 = PullUplink((char *)"AKA TO ADD");
|
||||||
@ -900,6 +901,9 @@ int EditTicRec(int Area)
|
|||||||
Syslog('+', "Saved tic record %d", Area);
|
Syslog('+', "Saved tic record %d", Area);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ttfil != NULL)
|
||||||
|
fclose(ttfil);
|
||||||
|
ttfil = NULL;
|
||||||
IsDoing("Browsing Menu");
|
IsDoing("Browsing Menu");
|
||||||
free(temp);
|
free(temp);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -24,7 +24,7 @@ OTHER = Makefile issue issue.netbsd
|
|||||||
all: mbtask
|
all: mbtask
|
||||||
|
|
||||||
mbtask: ${OBJS} ${LIBS}
|
mbtask: ${OBJS} ${LIBS}
|
||||||
${CC} -o mbtask ${OBJS} ${LIBS}
|
${CC} -o mbtask ${OBJS} ${PTLIBS} ${LIBS}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f mbtask *.o *.h~ *.c~ version.* core filelist Makefile.bak
|
rm -f mbtask *.o *.h~ *.c~ version.* core filelist Makefile.bak
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Shadow Suite (c) ......: Julianne Frances Haugh
|
* Shadow Suite (c) ......: Julianne Frances Haugh
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -759,10 +759,12 @@ int main(int argc, char *argv[])
|
|||||||
gr = getgrgid(pw->pw_gid);
|
gr = getgrgid(pw->pw_gid);
|
||||||
if (!gr) {
|
if (!gr) {
|
||||||
fprintf(stderr, "mbpasswd: Cannot determine group name.\n");
|
fprintf(stderr, "mbpasswd: Cannot determine group name.\n");
|
||||||
|
free(myname);
|
||||||
exit(E_NOPERM);
|
exit(E_NOPERM);
|
||||||
}
|
}
|
||||||
if (strcmp(gr->gr_name, (char *)"bbs")) {
|
if (strcmp(gr->gr_name, (char *)"bbs")) {
|
||||||
fprintf(stderr, "mbpasswd: You are not a member of group \"bbs\".\n");
|
fprintf(stderr, "mbpasswd: You are not a member of group \"bbs\".\n");
|
||||||
|
free(myname);
|
||||||
exit(E_NOPERM);
|
exit(E_NOPERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,6 +778,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "mbpasswd [-opt] [username] [newpassword]\n");
|
fprintf(stderr, "mbpasswd [-opt] [username] [newpassword]\n");
|
||||||
fprintf(stderr, "options are: -n normal password change\n");
|
fprintf(stderr, "options are: -n normal password change\n");
|
||||||
fprintf(stderr, " -f forced password change\n");
|
fprintf(stderr, " -f forced password change\n");
|
||||||
|
free(myname);
|
||||||
exit(E_FAILURE);
|
exit(E_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,6 +790,7 @@ int main(int argc, char *argv[])
|
|||||||
force = 1;
|
force = 1;
|
||||||
if (strcmp(pw->pw_name, (char *)"mbse") && strcmp(pw->pw_name, (char *)"bbs")) {
|
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");
|
fprintf(stderr, "mbpasswd: only users `mbse' and `bbs' may do this.\n");
|
||||||
|
free(myname);
|
||||||
exit(E_NOPERM);
|
exit(E_NOPERM);
|
||||||
}
|
}
|
||||||
} else if (strncmp(argv[1], "-n", 2) == 0) {
|
} else if (strncmp(argv[1], "-n", 2) == 0) {
|
||||||
@ -797,10 +801,12 @@ int main(int argc, char *argv[])
|
|||||||
force = 0;
|
force = 0;
|
||||||
if (strcmp(pw->pw_name, argv[2])) {
|
if (strcmp(pw->pw_name, argv[2])) {
|
||||||
fprintf(stderr, "mbpasswd: only owner may do this.\n");
|
fprintf(stderr, "mbpasswd: only owner may do this.\n");
|
||||||
|
free(myname);
|
||||||
exit(E_NOPERM);
|
exit(E_NOPERM);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "mbpasswd: wrong option switch.\n");
|
fprintf(stderr, "mbpasswd: wrong option switch.\n");
|
||||||
|
free(myname);
|
||||||
exit(E_FAILURE);
|
exit(E_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,10 +815,12 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
if (strlen(argv[2]) > 16) {
|
if (strlen(argv[2]) > 16) {
|
||||||
fprintf(stderr, "mbpasswd: Username too long\n");
|
fprintf(stderr, "mbpasswd: Username too long\n");
|
||||||
|
free(myname);
|
||||||
exit(E_FAILURE);
|
exit(E_FAILURE);
|
||||||
}
|
}
|
||||||
if (strlen(argv[3]) > 16) {
|
if (strlen(argv[3]) > 16) {
|
||||||
fprintf(stderr, "mbpasswd: Password too long\n");
|
fprintf(stderr, "mbpasswd: Password too long\n");
|
||||||
|
free(myname);
|
||||||
exit(E_FAILURE);
|
exit(E_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,6 +834,7 @@ int main(int argc, char *argv[])
|
|||||||
if ((pw = getpwnam(name)) == NULL) {
|
if ((pw = getpwnam(name)) == NULL) {
|
||||||
syslog(LOG_ERR, "mbpasswd: Unknown user %s", name);
|
syslog(LOG_ERR, "mbpasswd: Unknown user %s", name);
|
||||||
fprintf(stderr, "mbpasswd: Unknown user %s\n", name);
|
fprintf(stderr, "mbpasswd: Unknown user %s\n", name);
|
||||||
|
free(myname);
|
||||||
exit(E_FAILURE);
|
exit(E_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,6 +864,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "The password for %s is unchanged.\n", name);
|
fprintf(stderr, "The password for %s is unchanged.\n", name);
|
||||||
syslog(LOG_ERR, "The password for %s is unchanged", name);
|
syslog(LOG_ERR, "The password for %s is unchanged", name);
|
||||||
closelog();
|
closelog();
|
||||||
|
free(myname);
|
||||||
exit(E_FAILURE);
|
exit(E_FAILURE);
|
||||||
}
|
}
|
||||||
do_update_pwd = 1;
|
do_update_pwd = 1;
|
||||||
@ -876,6 +886,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "Cannot change ID to root.\n");
|
fprintf(stderr, "Cannot change ID to root.\n");
|
||||||
syslog(LOG_ERR, "can't setuid(0)");
|
syslog(LOG_ERR, "can't setuid(0)");
|
||||||
closelog();
|
closelog();
|
||||||
|
free(myname);
|
||||||
exit(E_FAILURE);
|
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);
|
syslog(LOG_NOTICE, "password for `%s' changed by user `%s'", name, myname);
|
||||||
closelog();
|
closelog();
|
||||||
|
free(myname);
|
||||||
exit(E_SUCCESS);
|
exit(E_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user