Several small changes and fixes
This commit is contained in:
parent
a2da4208c3
commit
a894a7b08e
@ -8,6 +8,8 @@ v0.83.18 01-Apr-2006
|
|||||||
|
|
||||||
mbtask:
|
mbtask:
|
||||||
Removed some debug logging.
|
Removed some debug logging.
|
||||||
|
Fixed a small bug.
|
||||||
|
Code cleanup.
|
||||||
|
|
||||||
|
|
||||||
v0.83.17 27-Mar-2006 - 01-Apr-2006
|
v0.83.17 27-Mar-2006 - 01-Apr-2006
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: mbtask - calllist
|
* Purpose ...............: mbtask - calllist
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2005
|
* Copyright (C) 1997-2006
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -57,10 +57,11 @@ extern struct taskrec TCFG;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the actual list of nodes to call.
|
* Check the actual list of nodes to call.
|
||||||
|
* Returns number of systems to call.
|
||||||
*/
|
*/
|
||||||
int check_calllist(void)
|
int check_calllist(void)
|
||||||
{
|
{
|
||||||
int i, found, call_work;
|
int i, found, call_work = 0;
|
||||||
struct _alist *tmp;
|
struct _alist *tmp;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
@ -88,7 +89,6 @@ int check_calllist(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pots_calls || isdn_calls || inet_calls) {
|
if (pots_calls || isdn_calls || inet_calls) {
|
||||||
call_work = 0;
|
|
||||||
for (tmp = alist; tmp; tmp = tmp->next) {
|
for (tmp = alist; tmp; tmp = tmp->next) {
|
||||||
if ((((tmp->callmode == CM_INET) && TCFG.max_tcp && internet) ||
|
if ((((tmp->callmode == CM_INET) && TCFG.max_tcp && internet) ||
|
||||||
((tmp->callmode == CM_ISDN) && isdn_lines) || ((tmp->callmode == CM_POTS) && pots_lines)) &&
|
((tmp->callmode == CM_ISDN) && isdn_lines) || ((tmp->callmode == CM_POTS) && pots_lines)) &&
|
||||||
|
@ -1097,7 +1097,7 @@ void scheduler(void)
|
|||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
int rlen, rc, running = 0, i, found, call_work = 0, len;
|
int rlen, rc, running = 0, i, found, call_work = 0, len;
|
||||||
static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70, call_entry = MAXTASKS;
|
static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70, call_entry = MAXTASKS;
|
||||||
char *cmd = NULL, opts[41], port[21], crbuf[512];
|
char *cmd = NULL, *opts, port[21], crbuf[512];
|
||||||
static char doing[32], buf[2048];
|
static char doing[32], buf[2048];
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm tm, utm;
|
struct tm tm, utm;
|
||||||
@ -1110,7 +1110,7 @@ void scheduler(void)
|
|||||||
socklen_t sl;
|
socklen_t sl;
|
||||||
struct sockaddr_in ffrom;
|
struct sockaddr_in ffrom;
|
||||||
|
|
||||||
Syslog('+', "Starting scheduler thread");
|
Syslog('+', "Starting scheduler loop");
|
||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1120,7 +1120,7 @@ void scheduler(void)
|
|||||||
/*
|
/*
|
||||||
* Poll UNIX Datagram socket and IBC UDP socket until the defined
|
* Poll UNIX Datagram socket and IBC UDP socket until the defined
|
||||||
* timeout of one second.
|
* timeout of one second.
|
||||||
* This means we listen of a MBSE BBS client program has something
|
* This means we listen if a MBSE BBS client program has something
|
||||||
* to tell. Timeout is one second, after the timeout the rest of the
|
* to tell. Timeout is one second, after the timeout the rest of the
|
||||||
* mainloop is executed.
|
* mainloop is executed.
|
||||||
*/
|
*/
|
||||||
@ -1146,19 +1146,22 @@ void scheduler(void)
|
|||||||
} else if (rc) {
|
} else if (rc) {
|
||||||
if (pfd[0].revents & POLLIN) {
|
if (pfd[0].revents & POLLIN) {
|
||||||
/*
|
/*
|
||||||
* Process the clients request
|
* Process the clients request for mbtask commands.
|
||||||
*/
|
*/
|
||||||
memset(&buf, 0, sizeof(buf));
|
memset(&buf, 0, sizeof(buf));
|
||||||
fromlen = sizeof(from);
|
fromlen = sizeof(from);
|
||||||
rlen = recvfrom(sock, buf, sizeof(buf) -1, 0, (struct sockaddr *)&from, &fromlen);
|
rlen = recvfrom(sock, buf, sizeof(buf) -1, 0, (struct sockaddr *)&from, &fromlen);
|
||||||
if (rlen == -1) {
|
if (rlen == -1) {
|
||||||
Syslog('?', "$recvfrom() for command receiver");
|
WriteError("$recvfrom() for command receiver");
|
||||||
} else {
|
} else {
|
||||||
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) && Run_IBC) {
|
pfd[1].revents & POLLHUP || pfd[1].revents & POLLNVAL) && Run_IBC) {
|
||||||
|
/*
|
||||||
|
* IBC chat command received.
|
||||||
|
*/
|
||||||
sl = sizeof(myaddr_in);
|
sl = sizeof(myaddr_in);
|
||||||
memset(&clientaddr_in, 0, sizeof(struct sockaddr_in));
|
memset(&clientaddr_in, 0, sizeof(struct sockaddr_in));
|
||||||
memset(&crbuf, 0, sizeof(crbuf));
|
memset(&crbuf, 0, sizeof(crbuf));
|
||||||
@ -1169,6 +1172,9 @@ void scheduler(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pfd[2].revents & POLLIN || pfd[2].revents & POLLERR || pfd[2].revents & POLLHUP || pfd[2].revents & POLLNVAL) {
|
if (pfd[2].revents & POLLIN || pfd[2].revents & POLLERR || pfd[2].revents & POLLHUP || pfd[2].revents & POLLNVAL) {
|
||||||
|
/*
|
||||||
|
* Ping reply received.
|
||||||
|
*/
|
||||||
sl = sizeof(ffrom);
|
sl = sizeof(ffrom);
|
||||||
if ((len = recvfrom(ping_isocket, &buf, sizeof(buf)-1, 0,(struct sockaddr *)&ffrom, &sl)) != -1) {
|
if ((len = recvfrom(ping_isocket, &buf, sizeof(buf)-1, 0,(struct sockaddr *)&ffrom, &sl)) != -1) {
|
||||||
ping_receive(buf, len);
|
ping_receive(buf, len);
|
||||||
@ -1490,6 +1496,7 @@ void scheduler(void)
|
|||||||
default: port[0] = '\0';
|
default: port[0] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
opts = calloc(41, sizeof(char));
|
||||||
if (calllist[call_entry].addr.point) {
|
if (calllist[call_entry].addr.point) {
|
||||||
snprintf(opts, 41, "%sp%u.f%u.n%u.z%u.%s", port, calllist[call_entry].addr.point,
|
snprintf(opts, 41, "%sp%u.f%u.n%u.z%u.%s", port, calllist[call_entry].addr.point,
|
||||||
calllist[call_entry].addr.node, calllist[call_entry].addr.net,
|
calllist[call_entry].addr.node, calllist[call_entry].addr.net,
|
||||||
@ -1504,6 +1511,7 @@ void scheduler(void)
|
|||||||
calllist[call_entry].calling = TRUE;
|
calllist[call_entry].calling = TRUE;
|
||||||
running = checktasks(0);
|
running = checktasks(0);
|
||||||
rescan = TRUE;
|
rescan = TRUE;
|
||||||
|
free(opts);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
cmd = NULL;
|
cmd = NULL;
|
||||||
}
|
}
|
||||||
@ -1703,7 +1711,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Not reached
|
* Not reached in daemon mode.
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -242,14 +242,13 @@ void checkdir(char *boxpath, faddr *fa, char flavor)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan outbound, the call status is set in three counters: internet,
|
* Scan outbound, the call status is set in three counters: internet, ISDN and POTS (analogue modems).
|
||||||
* ISDN and POTS (analogue modems).
|
|
||||||
* For all systems the CM and Txx flags are checked and for official
|
* For all systems the CM and Txx flags are checked and for official
|
||||||
* FidoNet nodes the Zone Mail Hour wich belongs to the destination
|
* FidoNet nodes the Zone Mail Hour wich belongs to the destination zone.
|
||||||
* zone.
|
* All nodes are qualified if there is a way to call them or not on this moment.
|
||||||
* All nodes are qualified, if there is a way to call them or not on
|
|
||||||
* this moment.
|
|
||||||
* The method how to call a node is decided as well.
|
* The method how to call a node is decided as well.
|
||||||
|
*
|
||||||
|
* On success, return 0.
|
||||||
*/
|
*/
|
||||||
int outstat()
|
int outstat()
|
||||||
{
|
{
|
||||||
|
@ -319,10 +319,8 @@ void check_ping(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
|
||||||
// Syslog('p', "Ping: 1=%s 2=%s nr=%d", pingresult[0] ? "TRUE":"FALSE", pingresult[1] ? "TRUE":"FALSE", pingnr);
|
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
if ((int)now >= (int)ping_next) {
|
if ((int)now >= (int)ping_next) {
|
||||||
// Syslog('p', "Ping: time for next");
|
|
||||||
/*
|
/*
|
||||||
* Was previous ping received?
|
* Was previous ping received?
|
||||||
*/
|
*/
|
||||||
@ -349,27 +347,22 @@ void check_ping(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Syslog('p', "Ping: 1=%s 2=%s nr=%d", pingresult[0] ? "TRUE":"FALSE", pingresult[1] ? "TRUE":"FALSE", pingnr);
|
|
||||||
|
|
||||||
ping_next = (time_t)(now + 20);
|
ping_next = (time_t)(now + 20);
|
||||||
|
|
||||||
if (inet_aton(pingaddress, &paddr)) {
|
if (inet_aton(pingaddress, &paddr)) {
|
||||||
pingresult[pingnr - 1] = FALSE;
|
pingresult[pingnr - 1] = FALSE;
|
||||||
rc = ping_send(paddr);
|
rc = ping_send(paddr);
|
||||||
// Syslog('p', "Ping: %d sent to %s rc=%d", pingnr, pingaddress, rc);
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
if (icmp_errs++ < ICMP_MAX_ERRS)
|
if (icmp_errs++ < ICMP_MAX_ERRS)
|
||||||
Syslog('?', "ping: to %s rc=%d", pingaddress, rc);
|
Syslog('?', "ping: to %s rc=%d", pingaddress, rc);
|
||||||
} else {
|
} else {
|
||||||
ping_sent = now;
|
ping_sent = now;
|
||||||
pingresult[pingnr - 1] = FALSE;
|
pingresult[pingnr - 1] = FALSE;
|
||||||
// Syslog('p', "Ping: 1=%s 2=%s nr=%d", pingresult[0] ? "TRUE":"FALSE", pingresult[1] ? "TRUE":"FALSE", pingnr);
|
|
||||||
return; // Don't check right after send
|
return; // Don't check right after send
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Syslog('p', "Ping: 1=%s 2=%s nr=%d", pingresult[0] ? "TRUE":"FALSE", pingresult[1] ? "TRUE":"FALSE", pingnr);
|
|
||||||
/*
|
/*
|
||||||
* Evaluate the result of the ping test
|
* Evaluate the result of the ping test
|
||||||
*/
|
*/
|
||||||
|
@ -113,7 +113,7 @@ void load_ports()
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
pp_list new;
|
pp_list new;
|
||||||
int stdflag;
|
int stdflag;
|
||||||
char *p, *q, *capflags;
|
char *p, *q, *capflags = NULL;
|
||||||
nodelist_modem **tmpm;
|
nodelist_modem **tmpm;
|
||||||
|
|
||||||
tidy_portlist(&pl);
|
tidy_portlist(&pl);
|
||||||
@ -165,11 +165,13 @@ void load_ports()
|
|||||||
fill_portlist(&pl, &new);
|
fill_portlist(&pl, &new);
|
||||||
if (capflags)
|
if (capflags)
|
||||||
free(capflags);
|
free(capflags);
|
||||||
|
capflags = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
tty_time = file_time(ttyfn);
|
tty_time = file_time(ttyfn);
|
||||||
|
if (pots_lines || isdn_lines)
|
||||||
Syslog('+', "Detected %d modem port%s and %d ISDN port%s",
|
Syslog('+', "Detected %d modem port%s and %d ISDN port%s",
|
||||||
pots_lines, (pots_lines == 1)?"":"s", isdn_lines, (isdn_lines == 1)?"":"s");
|
pots_lines, (pots_lines == 1)?"":"s", isdn_lines, (isdn_lines == 1)?"":"s");
|
||||||
}
|
}
|
||||||
|
@ -395,10 +395,11 @@ void chat_msg(char *channel, char *nick, char *msg)
|
|||||||
*/
|
*/
|
||||||
void chat_connect_r(char *data, char *buf)
|
void chat_connect_r(char *data, char *buf)
|
||||||
{
|
{
|
||||||
char *pid, *realname, *nick, *temp;
|
char *realname, *nick, *temp;
|
||||||
int count = 0, sys = FALSE;
|
int count = 0, sys = FALSE;
|
||||||
srv_list *sl;
|
srv_list *sl;
|
||||||
usr_list *tmpu;
|
usr_list *tmpu;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
Syslog('c', "CCON:%s", data);
|
Syslog('c', "CCON:%s", data);
|
||||||
|
|
||||||
@ -420,8 +421,8 @@ void chat_connect_r(char *data, char *buf)
|
|||||||
/*
|
/*
|
||||||
* Register with IBC
|
* Register with IBC
|
||||||
*/
|
*/
|
||||||
pid = strtok(data, ","); /* Should be 3 */
|
strtok(data, ","); /* Should be 3 */
|
||||||
pid = strtok(NULL, ","); /* The pid */
|
pid = (pid_t)atoi(strtok(NULL, ",")); /* The pid */
|
||||||
realname = xstrcpy(cldecode(strtok(NULL, ",")));/* Username */
|
realname = xstrcpy(cldecode(strtok(NULL, ",")));/* Username */
|
||||||
nick = xstrcpy(cldecode(strtok(NULL, ","))); /* Nickname */
|
nick = xstrcpy(cldecode(strtok(NULL, ","))); /* Nickname */
|
||||||
sys = atoi(strtok(NULL, ";")); /* Sysop flag */
|
sys = atoi(strtok(NULL, ";")); /* Sysop flag */
|
||||||
@ -437,7 +438,7 @@ void chat_connect_r(char *data, char *buf)
|
|||||||
/*
|
/*
|
||||||
* Oke, found
|
* Oke, found
|
||||||
*/
|
*/
|
||||||
tmpu->pid = atoi(pid);
|
tmpu->pid = pid;
|
||||||
tmpu->pointer = buffer_head;
|
tmpu->pointer = buffer_head;
|
||||||
tmpu->sysop = sys;
|
tmpu->sysop = sys;
|
||||||
usrchg = TRUE;
|
usrchg = TRUE;
|
||||||
@ -479,27 +480,27 @@ void chat_connect_r(char *data, char *buf)
|
|||||||
|
|
||||||
void chat_close_r(char *data, char *buf)
|
void chat_close_r(char *data, char *buf)
|
||||||
{
|
{
|
||||||
char *pid;
|
pid_t pid;
|
||||||
usr_list *tmpu;
|
usr_list *tmpu;
|
||||||
|
|
||||||
Syslog('c', "CCLO:%s", data);
|
Syslog('c', "CCLO:%s", data);
|
||||||
pid = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
|
|
||||||
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
||||||
if (tmpu->pid == atoi(pid)) {
|
if (tmpu->pid == pid) {
|
||||||
/*
|
/*
|
||||||
* Remove from IBC network
|
* Remove from IBC network
|
||||||
*/
|
*/
|
||||||
send_at((char *)"QUIT", tmpu->name, (char *)"Leaving chat");
|
send_at((char *)"QUIT", tmpu->name, (char *)"Leaving chat");
|
||||||
del_user(&users, CFG.myfqdn, tmpu->name);
|
del_user(&users, CFG.myfqdn, tmpu->name);
|
||||||
Syslog('c', "Closing chat for pid %s", pid);
|
Syslog('c', "Closing chat for pid %d", (int)pid);
|
||||||
snprintf(buf, 81, "100:0;");
|
snprintf(buf, 81, "100:0;");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Syslog('c', "Pid %s was not connected to chatserver");
|
Syslog('c', "Pid %d was not connected to chatserver", (int)pid);
|
||||||
snprintf(buf, 81, "100:1,*** ERROR - Not connected to server;");
|
snprintf(buf, 81, "100:1,*** ERROR - Not connected to server;");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -508,10 +509,11 @@ void chat_close_r(char *data, char *buf)
|
|||||||
|
|
||||||
void chat_put_r(char *data, char *buf)
|
void chat_put_r(char *data, char *buf)
|
||||||
{
|
{
|
||||||
char *p, *q, *pid, *msg, *cmd, *mbuf, *flags, temp[81];
|
char *p, *q, *msg, *cmd, *mbuf, *flags, temp[81];
|
||||||
int first, count, owner = FALSE, found;
|
int first, count, owner = FALSE, found;
|
||||||
usr_list *tmpu, *tmp;
|
usr_list *tmpu, *tmp;
|
||||||
chn_list *tmpc;
|
chn_list *tmpc;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
if (IsSema((char *)"upsalarm")) {
|
if (IsSema((char *)"upsalarm")) {
|
||||||
snprintf(buf, 81, "100:2,1,*** Power alarm, running on UPS;");
|
snprintf(buf, 81, "100:2,1,*** Power alarm, running on UPS;");
|
||||||
@ -523,13 +525,13 @@ void chat_put_r(char *data, char *buf)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
msg = xstrcpy(cldecode(strtok(NULL, ";")));
|
msg = xstrcpy(cldecode(strtok(NULL, ";")));
|
||||||
mbuf = calloc(200, sizeof(char));
|
mbuf = calloc(200, sizeof(char));
|
||||||
|
|
||||||
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
||||||
if (tmpu->pid == atoi(pid)) {
|
if (tmpu->pid == pid) {
|
||||||
if (msg[0] == '/') {
|
if (msg[0] == '/') {
|
||||||
/*
|
/*
|
||||||
* A command, process this but first se if we are in a channel
|
* A command, process this but first se if we are in a channel
|
||||||
@ -545,7 +547,7 @@ void chat_put_r(char *data, char *buf)
|
|||||||
Syslog('c', "IBC: process command, in channel %s and we are %sthe owner", tmpu->channel, owner ? "":"not ");
|
Syslog('c', "IBC: process command, in channel %s and we are %sthe owner", tmpu->channel, owner ? "":"not ");
|
||||||
}
|
}
|
||||||
if (strncasecmp(msg, "/help", 5) == 0) {
|
if (strncasecmp(msg, "/help", 5) == 0) {
|
||||||
chat_help(atoi(pid), owner);
|
chat_help(pid, owner);
|
||||||
goto ack;
|
goto ack;
|
||||||
} else if (strncasecmp(msg, "/echo", 5) == 0) {
|
} else if (strncasecmp(msg, "/echo", 5) == 0) {
|
||||||
snprintf(mbuf, 200, "%s", msg);
|
snprintf(mbuf, 200, "%s", msg);
|
||||||
@ -777,8 +779,9 @@ hangup:
|
|||||||
*/
|
*/
|
||||||
void chat_get_r(char *data, char *buf)
|
void chat_get_r(char *data, char *buf)
|
||||||
{
|
{
|
||||||
char *pid, *p;
|
char *p;
|
||||||
usr_list *tmpu;
|
usr_list *tmpu;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
if (IsSema((char *)"upsalarm")) {
|
if (IsSema((char *)"upsalarm")) {
|
||||||
snprintf(buf, 200, "100:2,1,*** Power failure, running on UPS;");
|
snprintf(buf, 200, "100:2,1,*** Power failure, running on UPS;");
|
||||||
@ -790,11 +793,11 @@ void chat_get_r(char *data, char *buf)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
|
|
||||||
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
||||||
if (atoi(pid) == tmpu->pid) {
|
if (pid == tmpu->pid) {
|
||||||
while (tmpu->pointer != buffer_head) {
|
while (tmpu->pointer != buffer_head) {
|
||||||
if (tmpu->pointer < MAXMESSAGES)
|
if (tmpu->pointer < MAXMESSAGES)
|
||||||
tmpu->pointer++;
|
tmpu->pointer++;
|
||||||
@ -827,12 +830,11 @@ void chat_get_r(char *data, char *buf)
|
|||||||
*/
|
*/
|
||||||
void chat_checksysop_r(char *data, char *buf)
|
void chat_checksysop_r(char *data, char *buf)
|
||||||
{
|
{
|
||||||
char *pid;
|
pid_t pid;
|
||||||
usr_list *tmpu;
|
usr_list *tmpu;
|
||||||
|
|
||||||
pid = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
|
|
||||||
|
|
||||||
if (reg_ispaging(pid)) {
|
if (reg_ispaging(pid)) {
|
||||||
Syslog('c', "Check sysopchat for pid %s, user has paged", pid);
|
Syslog('c', "Check sysopchat for pid %s, user has paged", pid);
|
||||||
@ -841,7 +843,7 @@ void chat_checksysop_r(char *data, char *buf)
|
|||||||
* Now check if sysop is present in the sysop channel
|
* Now check if sysop is present in the sysop channel
|
||||||
*/
|
*/
|
||||||
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
for (tmpu = users; tmpu; tmpu = tmpu->next) {
|
||||||
if (atoi(pid) != tmpu->pid) {
|
if (pid != tmpu->pid) {
|
||||||
if (strlen(tmpu->channel) && (strcasecmp(tmpu->channel, "#sysop") == 0) && tmpu->sysop) {
|
if (strlen(tmpu->channel) && (strcasecmp(tmpu->channel, "#sysop") == 0) && tmpu->sysop) {
|
||||||
Syslog('c', "Sending ACK on check");
|
Syslog('c', "Sending ACK on check");
|
||||||
snprintf(buf, 20, "100:1,1;");
|
snprintf(buf, 20, "100:1,1;");
|
||||||
|
@ -61,8 +61,8 @@ int userlog(char *param)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
lfn[0] = '\0';
|
lfn[0] = '\0';
|
||||||
strcpy(token, strtok(param, ","));
|
strncpy(token, strtok(param, ","), 14);
|
||||||
strcpy(token, strtok(NULL, ","));
|
strncpy(token, strtok(NULL, ","), 14);
|
||||||
snprintf(lfn, PATH_MAX, "%s/log/%s", getenv("MBSE_ROOT"), token);
|
snprintf(lfn, PATH_MAX, "%s/log/%s", getenv("MBSE_ROOT"), token);
|
||||||
prname = strtok(NULL, ",");
|
prname = strtok(NULL, ",");
|
||||||
prpid = strtok(NULL, ",");
|
prpid = strtok(NULL, ",");
|
||||||
@ -90,18 +90,18 @@ char *exe_cmd(char *in)
|
|||||||
int result;
|
int result;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
strcpy(ibuf, in);
|
strncpy(ibuf, in, SS_BUFSIZE);
|
||||||
strncpy(cmd, ibuf, 4);
|
strncpy(cmd, ibuf, 4);
|
||||||
token[0] = '\0';
|
// token[0] = '\0';
|
||||||
strcpy(ebuf, "200:1,Syntax error;");
|
strncpy(ebuf, "200:1,Syntax error;", 19);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Split the commandline after the colon so we can give the
|
* Split the commandline after the colon so we can give the
|
||||||
* options directly to the actual functions. Also set a default
|
* options directly to the actual functions. Also set a default
|
||||||
* and most used answer.
|
* and most used answer.
|
||||||
*/
|
*/
|
||||||
strcpy(token, &ibuf[5]);
|
strncpy(token, &ibuf[5], SS_BUFSIZE);
|
||||||
strcpy(obuf, "100:0;");
|
strncpy(obuf, "100:0;", SS_BUFSIZE);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -496,13 +496,13 @@ char *exe_cmd(char *in)
|
|||||||
* GDST:0; Obsolete!
|
* GDST:0; Obsolete!
|
||||||
* 100:n,data1,..,data10;
|
* 100:n,data1,..,data10;
|
||||||
*/
|
*/
|
||||||
if (strncmp(cmd, "GDST", 4) == 0) {
|
// if (strncmp(cmd, "GDST", 4) == 0) {
|
||||||
buf = calloc(SS_BUFSIZE, sizeof(char));
|
// buf = calloc(SS_BUFSIZE, sizeof(char));
|
||||||
disk_getfs_r(buf);
|
// disk_getfs_r(buf);
|
||||||
snprintf(obuf, SS_BUFSIZE, "%s", buf);
|
// snprintf(obuf, SS_BUFSIZE, "%s", buf);
|
||||||
free(buf);
|
// free(buf);
|
||||||
return obuf;
|
// return obuf;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GSYS:0;
|
* GSYS:0;
|
||||||
|
@ -1778,7 +1778,7 @@ void ibc_receiver(char *crbuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First check fr a fixed IP address.
|
* First check for a fixed IP address.
|
||||||
*/
|
*/
|
||||||
inlist = FALSE;
|
inlist = FALSE;
|
||||||
for (tnsl = ncsl; tnsl; tnsl = tnsl->next) {
|
for (tnsl = ncsl; tnsl; tnsl = tnsl->next) {
|
||||||
|
@ -47,17 +47,17 @@ int ipmailers = 0; /* TCP/IP mail sessions */
|
|||||||
*
|
*
|
||||||
* Search for a pid.
|
* Search for a pid.
|
||||||
*/
|
*/
|
||||||
int reg_find(char *);
|
int reg_find(pid_t);
|
||||||
int reg_find(char *pids)
|
int reg_find(pid_t pids)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAXCLIENT; i++) {
|
for (i = 0; i < MAXCLIENT; i++) {
|
||||||
if ((int)reginfo[i].pid == atoi(pids))
|
if (reginfo[i].pid == pids)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
Syslog('?', "Panic, pid %s not found", pids);
|
WriteError("Panic, pid %d not found", (int)pids);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,12 +70,13 @@ int reg_find(char *pids)
|
|||||||
|
|
||||||
int reg_newcon(char *data)
|
int reg_newcon(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid, *tty, *uid, *prg, *city;
|
char *tty, *uid, *prg, *city;
|
||||||
int retval;
|
int retval;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
tty = strtok(NULL, ",");
|
tty = xstrcpy(strtok(NULL, ","));
|
||||||
uid = xstrcpy(cldecode(strtok(NULL, ",")));
|
uid = xstrcpy(cldecode(strtok(NULL, ",")));
|
||||||
prg = xstrcpy(cldecode(strtok(NULL, ",")));
|
prg = xstrcpy(cldecode(strtok(NULL, ",")));
|
||||||
city = xstrcpy(cldecode(strtok(NULL, ";")));
|
city = xstrcpy(cldecode(strtok(NULL, ";")));
|
||||||
@ -83,16 +84,12 @@ int reg_newcon(char *data)
|
|||||||
/*
|
/*
|
||||||
* Abort if no empty record is found
|
* Abort if no empty record is found
|
||||||
*/
|
*/
|
||||||
if ((retval = reg_find((char *)"0")) == -1) {
|
if ((retval = reg_find((pid_t)0)) == -1) {
|
||||||
Syslog('?', "Maximum clients (%d) reached", MAXCLIENT);
|
Syslog('?', "Maximum clients (%d) reached", MAXCLIENT);
|
||||||
free(uid);
|
retval = -1;
|
||||||
free(prg);
|
} else {
|
||||||
free(city);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset((char *)®info[retval], 0, sizeof(reg_info));
|
memset((char *)®info[retval], 0, sizeof(reg_info));
|
||||||
reginfo[retval].pid = atoi(pid);
|
reginfo[retval].pid = pid;
|
||||||
strncpy((char *)®info[retval].tty, tty, 6);
|
strncpy((char *)®info[retval].tty, tty, 6);
|
||||||
strncpy((char *)®info[retval].uname, uid, 35);
|
strncpy((char *)®info[retval].uname, uid, 35);
|
||||||
strncpy((char *)®info[retval].prg, prg, 14);
|
strncpy((char *)®info[retval].prg, prg, 14);
|
||||||
@ -111,11 +108,14 @@ int reg_newcon(char *data)
|
|||||||
stat_inc_clients();
|
stat_inc_clients();
|
||||||
if (strcmp(prg, (char *)"mbcico") == 0)
|
if (strcmp(prg, (char *)"mbcico") == 0)
|
||||||
mailers++;
|
mailers++;
|
||||||
Syslog('-', "Registered client pgm \"%s\", pid %s, slot %d, mailers %d, TCP/IP %d",
|
Syslog('-', "Registered client pgm \"%s\", pid %d, slot %d, mailers %d, TCP/IP %d",
|
||||||
prg, pid, retval, mailers, ipmailers);
|
prg, (int)pid, retval, mailers, ipmailers);
|
||||||
|
}
|
||||||
|
|
||||||
free(uid);
|
free(uid);
|
||||||
free(prg);
|
free(prg);
|
||||||
free(city);
|
free(city);
|
||||||
|
free(tty);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,23 +123,24 @@ int reg_newcon(char *data)
|
|||||||
|
|
||||||
int reg_closecon(char *data)
|
int reg_closecon(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid;
|
pid_t pid;
|
||||||
int rec;
|
int rec;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
if ((rec = reg_find(pid)) == -1)
|
if ((rec = reg_find(pid)) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(reginfo[rec].prg, (char *)"mbcico") == 0)
|
if (strcmp(reginfo[rec].prg, (char *)"mbcico") == 0)
|
||||||
mailers--;
|
mailers--;
|
||||||
if (reginfo[rec].istcp)
|
if (reginfo[rec].istcp)
|
||||||
ipmailers--;
|
ipmailers--;
|
||||||
if ((strcmp(reginfo[rec].prg, (char *)"mbsebbs") == 0) || (strcmp(reginfo[rec].prg, (char *)"mbmon") == 0))
|
if ((strcmp(reginfo[rec].prg, (char *)"mbsebbs") == 0) || (strcmp(reginfo[rec].prg, (char *)"mbmon") == 0))
|
||||||
chat_cleanuser(atoi(pid));
|
chat_cleanuser(pid);
|
||||||
|
|
||||||
Syslog('-', "Unregistered client pgm \"%s\", pid %s, slot %d, mailers %d, TCP/IP %d",
|
Syslog('-', "Unregistered client pgm \"%s\", pid %d, slot %d, mailers %d, TCP/IP %d",
|
||||||
reginfo[rec].prg, pid, rec, mailers, ipmailers);
|
reginfo[rec].prg, (int)pid, rec, mailers, ipmailers);
|
||||||
memset(®info[rec], 0, sizeof(reg_info));
|
memset(®info[rec], 0, sizeof(reg_info));
|
||||||
stat_dec_clients();
|
stat_dec_clients();
|
||||||
return 0;
|
return 0;
|
||||||
@ -202,11 +203,12 @@ void reg_check(void)
|
|||||||
*/
|
*/
|
||||||
int reg_doing(char *data)
|
int reg_doing(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid, *line;
|
char *line;
|
||||||
int rec;
|
int rec;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
line = xstrcpy(cldecode(strtok(NULL, ";")));
|
line = xstrcpy(cldecode(strtok(NULL, ";")));
|
||||||
|
|
||||||
if ((rec = reg_find(pid)) == -1) {
|
if ((rec = reg_find(pid)) == -1) {
|
||||||
@ -227,19 +229,20 @@ int reg_doing(char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_ip(char *data)
|
int reg_ip(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid;
|
pid_t pid;
|
||||||
int rec;
|
int rec;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
|
|
||||||
if ((rec = reg_find(pid)) == -1)
|
if ((rec = reg_find(pid)) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
reginfo[rec].istcp = TRUE;
|
reginfo[rec].istcp = TRUE;
|
||||||
reginfo[rec].lastcon = (int)time(NULL);
|
reginfo[rec].lastcon = (int)time(NULL);
|
||||||
ipmailers++;
|
ipmailers++;
|
||||||
Syslog('?', "TCP/IP session registered (%s), now %d sessions", pid, ipmailers);
|
Syslog('?', "TCP/IP session registered (%d), now %d sessions", (int)pid, ipmailers);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,13 +253,15 @@ int reg_ip(char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_nop(char *data)
|
int reg_nop(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid;
|
pid_t pid;
|
||||||
int rec;
|
int rec;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
if ((rec = reg_find(pid)) == -1)
|
|
||||||
|
if ((rec = reg_find(pid)) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
reginfo[rec].lastcon = (int)time(NULL);
|
reginfo[rec].lastcon = (int)time(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
@ -269,30 +274,31 @@ int reg_nop(char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_timer(int Set, char *data)
|
int reg_timer(int Set, char *data)
|
||||||
{
|
{
|
||||||
char *pid;
|
pid_t pid;
|
||||||
int cnt, rec, val;
|
int cnt, rec, val;
|
||||||
|
|
||||||
cnt = atoi(strtok(data, ","));
|
cnt = atoi(strtok(data, ","));
|
||||||
if (Set) {
|
if (Set) {
|
||||||
if (cnt != 2)
|
if (cnt != 2)
|
||||||
return -1;
|
return -1;
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
val = atoi(strtok(NULL, ";"));
|
val = atoi(strtok(NULL, ";"));
|
||||||
if (val < 600)
|
if (val < 600)
|
||||||
val = 600;
|
val = 600;
|
||||||
} else {
|
} else {
|
||||||
if (cnt != 1)
|
if (cnt != 1)
|
||||||
return -1;
|
return -1;
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
val = 600;
|
val = 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rec = reg_find(pid)) == -1)
|
if ((rec = reg_find(pid)) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
reginfo[rec].altime = val;
|
reginfo[rec].altime = val;
|
||||||
reginfo[rec].lastcon = (int)time(NULL);
|
reginfo[rec].lastcon = (int)time(NULL);
|
||||||
Syslog('r', "Set timeout value for %d to %d", reginfo[rec].pid, val);
|
Syslog('r', "Set timeout value for %d to %d", (int)pid, val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,18 +309,22 @@ int reg_timer(int Set, char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_tty(char *data)
|
int reg_tty(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid, *tty;
|
char *tty;
|
||||||
int rec;
|
int rec;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
tty = strtok(NULL, ";");
|
tty = xstrcpy(strtok(NULL, ";"));
|
||||||
|
|
||||||
if ((rec = reg_find(pid)) == -1)
|
if ((rec = reg_find(pid)) == -1) {
|
||||||
|
free(tty);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
strncpy((char *)®info[rec].tty, tty, 6);
|
strncpy((char *)®info[rec].tty, tty, 6);
|
||||||
reginfo[rec].lastcon = (int)time(NULL);
|
reginfo[rec].lastcon = (int)time(NULL);
|
||||||
|
free(tty);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,17 +335,18 @@ int reg_tty(char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_silent(char *data)
|
int reg_silent(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid, *line;
|
int rec, line;
|
||||||
int rec;
|
pid_t pid;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
line = strtok(NULL, ";");
|
line = atoi(strtok(NULL, ";"));
|
||||||
|
|
||||||
if ((rec = reg_find(pid)) == -1)
|
if ((rec = reg_find(pid)) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
reginfo[rec].silent = atoi(line);
|
reginfo[rec].silent = line;
|
||||||
reginfo[rec].lastcon = (int)time(NULL);
|
reginfo[rec].lastcon = (int)time(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -347,11 +358,12 @@ int reg_silent(char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_user(char *data)
|
int reg_user(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid, *user, *city;
|
char *user, *city;
|
||||||
int rec;
|
int rec;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
user = xstrcpy(cldecode(strtok(NULL, ",")));
|
user = xstrcpy(cldecode(strtok(NULL, ",")));
|
||||||
city = xstrcpy(cldecode(strtok(NULL, ";")));
|
city = xstrcpy(cldecode(strtok(NULL, ";")));
|
||||||
|
|
||||||
@ -376,11 +388,11 @@ int reg_user(char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_sysop(char *data)
|
int reg_sysop(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid;
|
pid_t pid;
|
||||||
int rec;
|
int rec;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
sysop_present = atoi(strtok(NULL, ";"));
|
sysop_present = atoi(strtok(NULL, ";"));
|
||||||
|
|
||||||
if ((rec = reg_find(pid)) != -1) {
|
if ((rec = reg_find(pid)) != -1) {
|
||||||
@ -398,13 +410,14 @@ int reg_sysop(char *data)
|
|||||||
*/
|
*/
|
||||||
void reg_ipm_r(char *data, char *buf)
|
void reg_ipm_r(char *data, char *buf)
|
||||||
{
|
{
|
||||||
char *cnt, *pid, *name, *msg;
|
char *name, *msg;
|
||||||
int rec;
|
int rec;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
snprintf(buf, SS_BUFSIZE, "100:0;");
|
snprintf(buf, SS_BUFSIZE, "100:0;");
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
|
|
||||||
if ((rec = reg_find(pid)) == -1)
|
if ((rec = reg_find(pid)) == -1)
|
||||||
return;
|
return;
|
||||||
@ -437,10 +450,10 @@ void reg_ipm_r(char *data, char *buf)
|
|||||||
*/
|
*/
|
||||||
int reg_spm(char *data)
|
int reg_spm(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *from, *too, *txt, *logm;
|
char *from, *too, *txt, *logm;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
from = xstrcpy(cldecode(strtok(NULL, ",")));
|
from = xstrcpy(cldecode(strtok(NULL, ",")));
|
||||||
too = xstrcpy(cldecode(strtok(NULL, ",")));
|
too = xstrcpy(cldecode(strtok(NULL, ",")));
|
||||||
txt = xstrcpy(cldecode(strtok(NULL, ";")));
|
txt = xstrcpy(cldecode(strtok(NULL, ";")));
|
||||||
@ -588,14 +601,15 @@ void get_reginfo_r(int first, char *buf)
|
|||||||
*/
|
*/
|
||||||
int reg_page(char *data)
|
int reg_page(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid, *reason;
|
char *reason;
|
||||||
int i, rec;
|
int i, rec;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ",");
|
pid = (pid_t)atoi(strtok(NULL, ","));
|
||||||
reason = xstrcpy(cldecode(strtok(NULL, ";")));
|
reason = xstrcpy(cldecode(strtok(NULL, ";")));
|
||||||
|
|
||||||
Syslog('+', "reg_page: pid=%d, reason=\"%s\"", pid, reason);
|
Syslog('+', "reg_page: pid=%d, reason=\"%s\"", (int)pid, reason);
|
||||||
|
|
||||||
if (!sysop_present) {
|
if (!sysop_present) {
|
||||||
free(reason);
|
free(reason);
|
||||||
@ -607,7 +621,7 @@ int reg_page(char *data)
|
|||||||
* If so, mark sysop busy.
|
* If so, mark sysop busy.
|
||||||
*/
|
*/
|
||||||
for (i = 1; i < MAXCLIENT; i++) {
|
for (i = 1; i < MAXCLIENT; i++) {
|
||||||
if (reginfo[i].pid && (reginfo[i].pid != atoi(pid)) && (reginfo[i].paging || reginfo[i].haspaged)) {
|
if (reginfo[i].pid && (reginfo[i].pid != pid) && (reginfo[i].paging || reginfo[i].haspaged)) {
|
||||||
free(reason);
|
free(reason);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -634,13 +648,13 @@ int reg_page(char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_cancel(char *data)
|
int reg_cancel(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *pid;
|
pid_t pid;
|
||||||
int rec;
|
int rec;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
pid = strtok(NULL, ";");
|
pid = (pid_t)atoi(strtok(NULL, ";"));
|
||||||
|
|
||||||
Syslog('+', "reg_cancel: pid=%s", pid);
|
Syslog('+', "reg_cancel: pid=%d", (int)pid);
|
||||||
|
|
||||||
if ((rec = reg_find(pid)) == -1)
|
if ((rec = reg_find(pid)) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
@ -649,6 +663,7 @@ int reg_cancel(char *data)
|
|||||||
reginfo[rec].paging = FALSE;
|
reginfo[rec].paging = FALSE;
|
||||||
reginfo[rec].haspaged = TRUE;
|
reginfo[rec].haspaged = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
reginfo[rec].lastcon = (int)time(NULL);
|
reginfo[rec].lastcon = (int)time(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -681,7 +696,7 @@ void reg_checkpage_r(char *data, char *buf)
|
|||||||
/*
|
/*
|
||||||
* Check if this user has paged or is paging
|
* Check if this user has paged or is paging
|
||||||
*/
|
*/
|
||||||
int reg_ispaging(char *pid)
|
int reg_ispaging(pid_t pid)
|
||||||
{
|
{
|
||||||
int rec;
|
int rec;
|
||||||
|
|
||||||
@ -696,7 +711,7 @@ int reg_ispaging(char *pid)
|
|||||||
/*
|
/*
|
||||||
* Mark that this user is now talking to the sysop
|
* Mark that this user is now talking to the sysop
|
||||||
*/
|
*/
|
||||||
void reg_sysoptalk(char *pid)
|
void reg_sysoptalk(pid_t pid)
|
||||||
{
|
{
|
||||||
int rec;
|
int rec;
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ int reg_sysop(char *); /* Registrate sysop presence */
|
|||||||
int reg_page(char *); /* Page sysop for chat */
|
int reg_page(char *); /* Page sysop for chat */
|
||||||
int reg_cancel(char *); /* Cancel sysop page */
|
int reg_cancel(char *); /* Cancel sysop page */
|
||||||
void reg_checkpage_r(char *, char *); /* Check paging status */
|
void reg_checkpage_r(char *, char *); /* Check paging status */
|
||||||
int reg_ispaging(char *); /* Check if user with pid paged */
|
int reg_ispaging(pid_t); /* Check if user with pid paged */
|
||||||
void reg_sysoptalk(char *); /* Is now talking to the sysop */
|
void reg_sysoptalk(pid_t); /* Is now talking to the sysop */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -430,16 +430,17 @@ void sem_status_r(char *data, char *buf)
|
|||||||
|
|
||||||
void sem_create_r(char *data, char *buf)
|
void sem_create_r(char *data, char *buf)
|
||||||
{
|
{
|
||||||
char *cnt, *sem;
|
char *sem;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
sem = strtok(NULL, ";");
|
sem = xstrcpy(strtok(NULL, ";"));
|
||||||
|
|
||||||
if (sem_set(sem, TRUE))
|
if (sem_set(sem, TRUE))
|
||||||
snprintf(buf, 40, "100:0;");
|
snprintf(buf, 40, "100:0;");
|
||||||
else
|
else
|
||||||
snprintf(buf, 40, "200:1,16;");
|
snprintf(buf, 40, "200:1,16;");
|
||||||
|
|
||||||
|
free(sem);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,16 +448,17 @@ void sem_create_r(char *data, char *buf)
|
|||||||
|
|
||||||
void sem_remove_r(char *data, char *buf)
|
void sem_remove_r(char *data, char *buf)
|
||||||
{
|
{
|
||||||
char *cnt, *sem;
|
char *sem;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
strtok(data, ",");
|
||||||
sem = strtok(NULL, ";");
|
sem = xstrcpy(strtok(NULL, ";"));
|
||||||
|
|
||||||
if (sem_set(sem, FALSE))
|
if (sem_set(sem, FALSE))
|
||||||
snprintf(buf, 40, "100:0;");
|
snprintf(buf, 40, "100:0;");
|
||||||
else
|
else
|
||||||
snprintf(buf, 40, "200:1,16;");
|
snprintf(buf, 40, "200:1,16;");
|
||||||
|
|
||||||
|
free(sem);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user