Fixed a crash when there is no /etc/services udp port for the chatserver
This commit is contained in:
parent
79a99763a9
commit
d739685039
@ -7,6 +7,10 @@ v0.83.21 10-Jun-2006
|
|||||||
In nodes setup added check for paths when directory sessions
|
In nodes setup added check for paths when directory sessions
|
||||||
are selected.
|
are selected.
|
||||||
|
|
||||||
|
mbtask:
|
||||||
|
Fixed a crash when there is no /etc/services udp port for the
|
||||||
|
chatserver.
|
||||||
|
|
||||||
|
|
||||||
v0.83.20 27-May-2006 - 10-Jun-2006
|
v0.83.20 27-May-2006 - 10-Jun-2006
|
||||||
|
|
||||||
|
@ -1003,6 +1003,7 @@ void start_scheduler(int port)
|
|||||||
|
|
||||||
if (nodaemon)
|
if (nodaemon)
|
||||||
printf("init fidonet\n");
|
printf("init fidonet\n");
|
||||||
|
|
||||||
InitFidonet();
|
InitFidonet();
|
||||||
if (nodaemon)
|
if (nodaemon)
|
||||||
printf("done\n");
|
printf("done\n");
|
||||||
@ -1137,14 +1138,20 @@ void scheduler(void)
|
|||||||
pfd[0].fd = sock;
|
pfd[0].fd = sock;
|
||||||
pfd[0].events = POLLIN;
|
pfd[0].events = POLLIN;
|
||||||
pfd[0].revents = 0;
|
pfd[0].revents = 0;
|
||||||
pfd[1].fd = ibcsock;
|
pfd[1].fd = ping_isocket;
|
||||||
pfd[1].events = POLLIN;
|
pfd[1].events = POLLIN;
|
||||||
pfd[1].revents = 0;
|
pfd[1].revents = 0;
|
||||||
pfd[2].fd = ping_isocket;
|
if (Run_IBC) {
|
||||||
pfd[2].events = POLLIN;
|
pfd[2].fd = ibcsock;
|
||||||
pfd[2].revents = 0;
|
pfd[2].events = POLLIN;
|
||||||
|
pfd[2].revents = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Run_IBC)
|
||||||
|
rc = poll(pfd, 3, 1000);
|
||||||
|
else
|
||||||
|
rc = poll(pfd, 2, 1000);
|
||||||
|
|
||||||
rc = poll(pfd, 3, 1000);
|
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
/*
|
/*
|
||||||
* Poll can be interrupted by a finished child so that's not a real error.
|
* Poll can be interrupted by a finished child so that's not a real error.
|
||||||
@ -1152,6 +1159,8 @@ void scheduler(void)
|
|||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
Syslog('?', "$poll() rc=%d sock=%d, events=%04x", rc, sock, pfd[0].revents);
|
Syslog('?', "$poll() rc=%d sock=%d, events=%04x", rc, sock, pfd[0].revents);
|
||||||
Syslog('?', "$poll() rc=%d sock=%d, events=%04x", rc, ibcsock, pfd[1].revents);
|
Syslog('?', "$poll() rc=%d sock=%d, events=%04x", rc, ibcsock, pfd[1].revents);
|
||||||
|
if (Run_IBC)
|
||||||
|
Syslog('?', "$poll() rc=%d sock=%d, events=%04x", rc, ping_isocket, pfd[2].revents);
|
||||||
}
|
}
|
||||||
} else if (rc) {
|
} else if (rc) {
|
||||||
if (pfd[0].revents & POLLIN) {
|
if (pfd[0].revents & POLLIN) {
|
||||||
@ -1167,8 +1176,19 @@ void scheduler(void)
|
|||||||
do_cmd(buf);
|
do_cmd(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((pfd[1].revents & POLLIN || pfd[1].revents & POLLERR ||
|
if (pfd[1].revents & POLLIN || pfd[1].revents & POLLERR || pfd[1].revents & POLLHUP || pfd[1].revents & POLLNVAL) {
|
||||||
pfd[1].revents & POLLHUP || pfd[1].revents & POLLNVAL) && Run_IBC) {
|
/*
|
||||||
|
* Ping reply received.
|
||||||
|
*/
|
||||||
|
sl = sizeof(ffrom);
|
||||||
|
if ((len = recvfrom(ping_isocket, &buf, sizeof(buf)-1, 0,(struct sockaddr *)&ffrom, &sl)) != -1) {
|
||||||
|
ping_receive(buf, len);
|
||||||
|
} else {
|
||||||
|
WriteError("$recvfrom() for ping receiver");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Run_IBC && (pfd[2].revents & POLLIN || pfd[2].revents & POLLERR ||
|
||||||
|
pfd[2].revents & POLLHUP || pfd[2].revents & POLLNVAL)) {
|
||||||
/*
|
/*
|
||||||
* IBC chat command received.
|
* IBC chat command received.
|
||||||
*/
|
*/
|
||||||
@ -1181,17 +1201,6 @@ void scheduler(void)
|
|||||||
WriteError("$recvfrom() for IBC receiver");
|
WriteError("$recvfrom() for IBC receiver");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pfd[2].revents & POLLIN || pfd[2].revents & POLLERR || pfd[2].revents & POLLHUP || pfd[2].revents & POLLNVAL) {
|
|
||||||
/*
|
|
||||||
* Ping reply received.
|
|
||||||
*/
|
|
||||||
sl = sizeof(ffrom);
|
|
||||||
if ((len = recvfrom(ping_isocket, &buf, sizeof(buf)-1, 0,(struct sockaddr *)&ffrom, &sl)) != -1) {
|
|
||||||
ping_receive(buf, len);
|
|
||||||
} else {
|
|
||||||
WriteError("$recvfrom() for ping receiver");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_Shutdown)
|
if (G_Shutdown)
|
||||||
@ -1540,7 +1549,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
char *lockfile;
|
char *lockfile;
|
||||||
int i;
|
int i, chatport = 0;
|
||||||
pid_t frk;
|
pid_t frk;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct servent *se;
|
struct servent *se;
|
||||||
@ -1628,12 +1637,15 @@ int main(int argc, char **argv)
|
|||||||
if ((se = getservbyname("fido", "udp")) == NULL) {
|
if ((se = getservbyname("fido", "udp")) == NULL) {
|
||||||
WriteError("IBC: no fido udp entry in /etc/services, cannot start Internet BBS Chat");
|
WriteError("IBC: no fido udp entry in /etc/services, cannot start Internet BBS Chat");
|
||||||
Run_IBC = FALSE;
|
Run_IBC = FALSE;
|
||||||
} else if (strlen(CFG.bbs_name) == 0) {
|
} else {
|
||||||
WriteError("IBC: mbsetup 1.2.1 is empty, cannot start Internet BBS Chat");
|
chatport = se->s_port;
|
||||||
Run_IBC = FALSE;
|
if (strlen(CFG.bbs_name) == 0) {
|
||||||
} else if (strlen(CFG.myfqdn) == 0) {
|
WriteError("IBC: mbsetup 1.2.1 is empty, cannot start Internet BBS Chat");
|
||||||
Run_IBC = FALSE;
|
Run_IBC = FALSE;
|
||||||
WriteError("IBC: mbsetup 1.2.10 is empty, cannot start Internet BBS Chat");
|
} else if (strlen(CFG.myfqdn) == 0) {
|
||||||
|
Run_IBC = FALSE;
|
||||||
|
WriteError("IBC: mbsetup 1.2.10 is empty, cannot start Internet BBS Chat");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&task, 0, sizeof(task));
|
memset(&task, 0, sizeof(task));
|
||||||
@ -1660,7 +1672,7 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
mypid = getpid();
|
mypid = getpid();
|
||||||
printf("init complete, starting scheduler ...\n");
|
printf("init complete, starting scheduler ...\n");
|
||||||
start_scheduler(se->s_port);
|
start_scheduler(chatport);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Server initialization is complete. Now we can fork the
|
* Server initialization is complete. Now we can fork the
|
||||||
@ -1701,7 +1713,7 @@ int main(int argc, char **argv)
|
|||||||
_exit(MBERR_EXEC_FAILED);
|
_exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
mypid = getpid();
|
mypid = getpid();
|
||||||
start_scheduler(se->s_port);
|
start_scheduler(chatport);
|
||||||
/* Not reached */
|
/* Not reached */
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user