Errorcode return bugfixes

This commit is contained in:
Michiel Broek 2002-10-21 18:29:29 +00:00
parent 02a1621f62
commit e72f7c6274
7 changed files with 192 additions and 216 deletions

View File

@ -180,18 +180,27 @@ This variable must point to the root of the bbs directoy structure.
<pre> <pre>
0 - No errors 0 - No errors
1..32 - OS errors, SIGHUP, SIGKILL, etc. 1..32 - OS errors, SIGHUP, SIGKILL, etc.
101 - No dialout ports available. 100 - Commandline error.
102 - Dial failed (no CONNECT or TCP connection failed). 101 - Configuration error.
103 - Could not reset the modem (no OK). 103 - Disk full.
104 - System is locked. 108 - File transfer error.
105 - not used? 111 - Node not in nodelist.
106 - Nodelist lookup failed. 112 - Node may not be called (Hold, Down, not ZMH).
107 - Call prohibited by config options. 113 - Could not make connection.
108 - Phone number unavailable. 114 - Cannot open tty port.
109 - No matching ports defined. 115 - Node is locked.
110 - Tried to call a CM system outside ZMH. 116 - No IP address.
111..129 - Session failures (not defined). 117 - Unknown session type.
130 - Could not establish session, system is marked undialable. 118 - Not Zone Mail Hour.
119 - Modem error.
120 - Not port available.
121 - Session error.
122 - EMSI session error.
123 - FTSC session error.
124 - Wazoo session error.
125 - YooHoo session error.
126 - Outbound scan error.
127 - Cannot poll.
</pre> </pre>
These codes are also stored in status files for nodes, with the extension These codes are also stored in status files for nodes, with the extension
of ".sts". These are small datafiles containing three decimal numbers. of ".sts". These are small datafiles containing three decimal numbers.

View File

@ -104,12 +104,12 @@ int binkp(int role)
if (role == 1) { if (role == 1) {
Syslog('+', "BINKP start outbound session"); Syslog('+', "BINKP start outbound session");
if (orgbinkp()) { if (orgbinkp()) {
rc = MBERR_FTRANSFER; rc = MBERR_SESSION_ERROR;
} }
} else { } else {
Syslog('+', "BINKP start inbound session"); Syslog('+', "BINKP start inbound session");
if (ansbinkp()) { if (ansbinkp()) {
rc = MBERR_FTRANSFER; rc = MBERR_SESSION_ERROR;
} }
} }

View File

@ -69,7 +69,7 @@ int portopen(faddr *addr)
if ((rc = opentcp(inetaddr))) { if ((rc = opentcp(inetaddr))) {
Syslog('+', "Cannot connect %s", inetaddr); Syslog('+', "Cannot connect %s", inetaddr);
nodeulock(addr); nodeulock(addr);
putstatus(addr,1,MBERR_NO_CONNECTION); // putstatus(addr,1,MBERR_NO_CONNECTION);
return MBERR_NO_CONNECTION; return MBERR_NO_CONNECTION;
} }
return MBERR_OK; return MBERR_OK;
@ -288,9 +288,9 @@ int call(faddr *addr)
return rc; return rc;
} }
if ((rc == MBERR_NOT_ZMH) || (rc == MBERR_UNKNOWN_SESSION)) /* Session error */ if ((rc == MBERR_NOT_ZMH) || (rc == MBERR_SESSION_ERROR)) /* Session error */
putstatus(addr, 5, rc); putstatus(addr, 5, rc);
else if ((rc == MBERR_NO_CONNECTION) || (rc == MBERR_SESSION_ERROR)) else if ((rc == MBERR_NO_CONNECTION) || (rc == MBERR_UNKNOWN_SESSION))
putstatus(addr,1,rc); putstatus(addr,1,rc);
else else
putstatus(addr,0,rc); putstatus(addr,0,rc);

View File

@ -4,19 +4,6 @@
#define CALLSTAT_H #define CALLSTAT_H
#define ST_PORTOK 0
#define ST_PORTERR 1
#define ST_NOCONN 2
#define ST_MDMERR 3
#define ST_LOCKED 4
#define ST_LOOKUP 6
#define ST_NOCALL7 7
#define ST_NOCALL8 8
#define ST_NOPORT 9
#define ST_NOTZMH 10
#define ST_SESSION 30
typedef struct _callstat { typedef struct _callstat {
time_t trytime; time_t trytime;
int tryno; int tryno;

View File

@ -73,210 +73,202 @@ char emsi_remote_comm[4]="8N1";
int rx_emsi(char *data) int rx_emsi(char *data)
{ {
int rc; int rc;
fa_list *tmr; fa_list *tmr;
int denypw=0; int denypw=0;
Syslog('+', "Start inbound EMSI session"); Syslog('+', "Start inbound EMSI session");
emsi_local_lcodes = LCODE_RH1; emsi_local_lcodes = LCODE_RH1;
// if (localoptions & NOPUA) emsi_remote_lcodes=0;
// emsi_local_lcodes |= LCODE_PUP;
emsi_remote_lcodes=0;
emsi_local_protos=LOCAL_PROTOS; emsi_local_protos=LOCAL_PROTOS;
if (localoptions & NOZMODEM) if (localoptions & NOZMODEM)
emsi_local_protos &= ~(PROT_ZMO | PROT_ZAP | PROT_DZA); emsi_local_protos &= ~(PROT_ZMO | PROT_ZAP | PROT_DZA);
if (localoptions & NOZEDZAP) if (localoptions & NOZEDZAP)
emsi_local_protos &= ~PROT_ZAP; emsi_local_protos &= ~PROT_ZAP;
if (localoptions & NOJANUS) if (localoptions & NOJANUS)
emsi_local_protos &= ~PROT_JAN; emsi_local_protos &= ~PROT_JAN;
if (localoptions & NOHYDRA) if (localoptions & NOHYDRA)
emsi_local_protos &= ~PROT_HYD; emsi_local_protos &= ~PROT_HYD;
if ((localoptions & NOITN) || (localoptions & NOIFC) || ((session_flags & SESSION_TCP) == 0)) { if ((localoptions & NOITN) || (localoptions & NOIFC) || ((session_flags & SESSION_TCP) == 0)) {
emsi_local_protos &= ~PROT_TCP; emsi_local_protos &= ~PROT_TCP;
}
emsi_remote_protos=0;
emsi_local_opts = OPT_XMA;
emsi_remote_opts=0;
emsi_local_password = NULL;
emsi_remote_password = NULL;
intro=data+2;
caller=0;
if ((rc=rxemsi()))
return MBERR_EMSI;
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
Syslog('i', "remote lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_remote_lcodes,emsi_remote_protos,emsi_remote_opts);
if (emsi_remote_opts & OPT_EII) {
emsi_local_opts |= OPT_EII;
}
emsi_local_protos &= emsi_remote_protos;
if (emsi_local_protos & PROT_TCP)
emsi_local_protos &= PROT_TCP;
else if (emsi_local_protos & PROT_HYD)
emsi_local_protos &= PROT_HYD;
else if (emsi_local_protos & PROT_JAN)
emsi_local_protos &= PROT_JAN;
else if (emsi_local_protos & PROT_ZAP)
emsi_local_protos &= PROT_ZAP;
else if (emsi_local_protos & PROT_ZMO)
emsi_local_protos &= PROT_ZMO;
else if (emsi_local_protos & PROT_DZA)
emsi_local_protos &= PROT_DZA;
else if (emsi_local_protos & PROT_KER)
emsi_local_protos &= PROT_KER;
emsi_local_password = NULL;
for (tmr = remote; tmr; tmr = tmr->next)
if (((nlent = getnlent(tmr->addr))) && (nlent->pflag != NL_DUMMY)) {
Syslog('+', "Remote is a listed system");
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.inbound);
break;
} }
if (nlent)
rdoptions(TRUE);
emsi_remote_protos=0; /*
emsi_local_opts = OPT_XMA; * Added these options, if they are in the setup for this
emsi_remote_opts=0; * calling node, then disable these options.
emsi_local_password = NULL; */
emsi_remote_password = NULL; if (localoptions & NOHYDRA)
intro=data+2; emsi_local_opts &= ~PROT_HYD;
caller=0; if (localoptions & NOZEDZAP)
emsi_local_opts &= ~PROT_ZAP;
if (localoptions & NOZMODEM)
emsi_local_opts &= ~(PROT_ZMO | PROT_ZAP | PROT_DZA);
if ((rc=rxemsi())) if (localoptions & NOFREQS)
return MBERR_EMSI; emsi_local_opts |= OPT_NRQ;
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts); if (strlen(nodes.Spasswd)) {
Syslog('i', "remote lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_remote_lcodes,emsi_remote_protos,emsi_remote_opts); if ((strncasecmp(emsi_remote_password, nodes.Spasswd, strlen(nodes.Spasswd)) == 0) &&
(strlen(emsi_remote_password) == strlen(nodes.Spasswd))) {
if (emsi_remote_opts & OPT_EII) { emsi_local_password = xstrcpy(nodes.Spasswd);
emsi_local_opts |= OPT_EII; if (inbound)
} free(inbound);
inbound = xstrcpy(CFG.pinbound);
emsi_local_protos &= emsi_remote_protos; Syslog('+', "Password correct, protected EMSI session");
if (emsi_local_protos & PROT_TCP)
emsi_local_protos &= PROT_TCP;
else if (emsi_local_protos & PROT_HYD)
emsi_local_protos &= PROT_HYD;
else if (emsi_local_protos & PROT_JAN)
emsi_local_protos &= PROT_JAN;
else if (emsi_local_protos & PROT_ZAP)
emsi_local_protos &= PROT_ZAP;
else if (emsi_local_protos & PROT_ZMO)
emsi_local_protos &= PROT_ZMO;
else if (emsi_local_protos & PROT_DZA)
emsi_local_protos &= PROT_DZA;
else if (emsi_local_protos & PROT_KER)
emsi_local_protos &= PROT_KER;
emsi_local_password = NULL;
for (tmr = remote; tmr; tmr = tmr->next)
if (((nlent = getnlent(tmr->addr))) && (nlent->pflag != NL_DUMMY)) {
Syslog('+', "Remote is a listed system");
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.inbound);
break;
}
if (nlent)
rdoptions(TRUE);
/*
* Added these options, if they are in the setup for this
* calling node, then disable these options.
*/
if (localoptions & NOHYDRA)
emsi_local_opts &= ~PROT_HYD;
if (localoptions & NOZEDZAP)
emsi_local_opts &= ~PROT_ZAP;
if (localoptions & NOZMODEM)
emsi_local_opts &= ~(PROT_ZMO | PROT_ZAP | PROT_DZA);
if (localoptions & NOFREQS)
emsi_local_opts |= OPT_NRQ;
if (strlen(nodes.Spasswd)) {
if ((strncasecmp(emsi_remote_password, nodes.Spasswd, strlen(nodes.Spasswd)) == 0) &&
(strlen(emsi_remote_password) == strlen(nodes.Spasswd))) {
emsi_local_password = xstrcpy(nodes.Spasswd);
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.pinbound);
Syslog('+', "Password correct, protected EMSI session");
} else {
denypw = 1;
Syslog('?', "Remote password \"%s\", expected \"%s\"", MBSE_SS(emsi_remote_password), nodes.Spasswd);
emsi_local_password = xstrcpy((char *)"BAD_PASS");
emsi_local_lcodes = LCODE_HAT;
}
} else { } else {
Syslog('i', "No EMSI password check"); denypw = 1;
Syslog('?', "Unexpected remote password \"%s\"", MBSE_SS(emsi_local_password)); Syslog('?', "Remote password \"%s\", expected \"%s\"", MBSE_SS(emsi_remote_password), nodes.Spasswd);
emsi_local_password = xstrcpy((char *)"BAD_PASS");
emsi_local_lcodes = LCODE_HAT;
} }
} else {
Syslog('i', "No EMSI password check");
Syslog('?', "Unexpected remote password \"%s\"", MBSE_SS(emsi_local_password));
}
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts); Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
if ((rc=txemsi())) if ((rc=txemsi()))
return MBERR_EMSI; return MBERR_EMSI;
if (denypw || (emsi_local_protos == 0)) { if (denypw || (emsi_local_protos == 0)) {
Syslog('+', "Refusing remote: %s", emsi_local_protos?"bad password presented": "no common protocols"); Syslog('+', "Refusing remote: %s", emsi_local_protos?"bad password presented": "no common protocols");
return 0; return 0;
} }
IsDoing("EMSI %s inb", ascfnode(remote->addr, 0x0f)); IsDoing("EMSI %s inb", ascfnode(remote->addr, 0x0f));
if ((emsi_remote_opts & OPT_NRQ) == 0) if ((emsi_remote_opts & OPT_NRQ) == 0)
session_flags |= SESSION_WAZOO; session_flags |= SESSION_WAZOO;
else else
session_flags &= ~SESSION_WAZOO; session_flags &= ~SESSION_WAZOO;
if (emsi_local_protos & PROT_TCP) if (emsi_local_protos & PROT_TCP)
return rxtcp(); return rxtcp();
else if (emsi_local_protos & PROT_HYD) else if (emsi_local_protos & PROT_HYD)
return hydra(0); return hydra(0);
// else if (emsi_local_protos & PROT_JAN) // else if (emsi_local_protos & PROT_JAN)
// return janus(); // return janus();
else else
return rxwazoo(); return rxwazoo();
} }
int tx_emsi(char *data) int tx_emsi(char *data)
{ {
int rc; int rc;
Syslog('+', "Start outbound EMSI session"); Syslog('+', "Start outbound EMSI session");
emsi_local_lcodes = LCODE_PUA | LCODE_RH1; emsi_local_lcodes = LCODE_PUA | LCODE_RH1;
// if (localoptions & NOPUA) { emsi_remote_lcodes = 0;
// emsi_local_lcodes |= LCODE_PUP;
// emsi_local_lcodes &= ~LCODE_PUA;
// }
emsi_remote_lcodes = 0;
emsi_local_protos=LOCAL_PROTOS; emsi_local_protos=LOCAL_PROTOS;
if (localoptions & NOZMODEM) if (localoptions & NOZMODEM)
emsi_local_protos &= ~(PROT_ZMO | PROT_ZAP | PROT_DZA); emsi_local_protos &= ~(PROT_ZMO | PROT_ZAP | PROT_DZA);
if (localoptions & NOZEDZAP) if (localoptions & NOZEDZAP)
emsi_local_protos &= ~PROT_ZAP; emsi_local_protos &= ~PROT_ZAP;
if (localoptions & NOJANUS) if (localoptions & NOJANUS)
emsi_local_protos &= ~PROT_JAN; emsi_local_protos &= ~PROT_JAN;
if (localoptions & NOHYDRA) if (localoptions & NOHYDRA)
emsi_local_protos &= ~PROT_HYD; emsi_local_protos &= ~PROT_HYD;
if ((localoptions & NOIFC) || (localoptions & NOITN) || ((session_flags & SESSION_TCP) == 0)) { if ((localoptions & NOIFC) || (localoptions & NOITN) || ((session_flags & SESSION_TCP) == 0)) {
emsi_local_protos &= ~PROT_TCP; emsi_local_protos &= ~PROT_TCP;
} }
emsi_remote_protos=0; emsi_remote_protos=0;
emsi_local_opts=OPT_XMA | OPT_EII | OPT_NRQ; emsi_local_opts=OPT_XMA | OPT_EII | OPT_NRQ;
// if (localoptions & NOFREQS) /* 17-Dec-1998, refuse requests when we pay the bill. */ emsi_remote_opts=0;
// emsi_local_opts |= OPT_NRQ; emsi_local_password=NULL;
emsi_remote_opts=0; emsi_remote_password=NULL;
emsi_local_password=NULL; intro=data+2;
emsi_remote_password=NULL; caller=1;
intro=data+2; emsi_local_password=NULL;
caller=1;
emsi_local_password=NULL;
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts); Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
if ((rc=txemsi())) if ((rc=txemsi()))
return MBERR_EMSI; return MBERR_EMSI;
else { else {
if ((rc=rxemsi())) if ((rc=rxemsi()))
return MBERR_EMSI; return MBERR_EMSI;
} }
if ((emsi_remote_opts & OPT_EII) == 0) { if ((emsi_remote_opts & OPT_EII) == 0) {
emsi_local_opts &= ~OPT_EII; emsi_local_opts &= ~OPT_EII;
} }
Syslog('i', "remote lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_remote_lcodes,emsi_remote_protos,emsi_remote_opts); Syslog('i', "remote lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_remote_lcodes,emsi_remote_protos,emsi_remote_opts);
if ((emsi_remote_protos == 0) || (emsi_remote_lcodes & LCODE_HAT)) { if ((emsi_remote_protos == 0) || (emsi_remote_lcodes & LCODE_HAT)) {
Syslog('+', "Remote refused us: %s", emsi_remote_protos?"traffic held":"no common protos"); Syslog('+', "Remote refused us: %s", emsi_remote_protos?"traffic held":"no common protos");
return 0; return MBERR_SESSION_ERROR;
} }
IsDoing("EMSI %s out", ascfnode(remote->addr, 0x0f)); IsDoing("EMSI %s out", ascfnode(remote->addr, 0x0f));
emsi_local_protos &= emsi_remote_protos; emsi_local_protos &= emsi_remote_protos;
if ((emsi_remote_opts & OPT_NRQ) == 0) if ((emsi_remote_opts & OPT_NRQ) == 0)
session_flags |= SESSION_WAZOO; session_flags |= SESSION_WAZOO;
else else
session_flags &= ~SESSION_WAZOO; session_flags &= ~SESSION_WAZOO;
if (emsi_local_protos & PROT_TCP) if (emsi_local_protos & PROT_TCP)
return txtcp(); return txtcp();
else if (emsi_local_protos & PROT_HYD) else if (emsi_local_protos & PROT_HYD)
return hydra(1); return hydra(1);
// else if (emsi_local_protos & PROT_JAN) // else if (emsi_local_protos & PROT_JAN)
// return janus(); // return janus();
else else
return txwazoo(); return txwazoo();
} }

View File

@ -260,7 +260,7 @@ int tx_yoohoo(void)
if ((rc == 0) && ((capabilities & LOCALCAPS) == 0)) { if ((rc == 0) && ((capabilities & LOCALCAPS) == 0)) {
Syslog('+', "No common protocols"); Syslog('+', "No common protocols");
return 0; return MBERR_SESSION_ERROR;
} }
if (rc) if (rc)

View File

@ -4,18 +4,6 @@
/* $Id$ */ /* $Id$ */
#define ST_PORTERR 1
#define ST_NOCONN 2
#define ST_MDMERR 3
#define ST_LOCKED 4
#define ST_LOOKUP 6
#define ST_NOCALL7 7
#define ST_NOCALL8 8
#define ST_NOPORT 9
#define ST_NOTZMH 10
#define ST_SESSION 30
typedef struct _callstat { typedef struct _callstat {
time_t trytime; time_t trytime;
int tryno; int tryno;