Experimental update for the binkp driver

This commit is contained in:
Michiel Broek 2002-02-23 16:00:53 +00:00
parent cc4ba4d2be
commit 22c8c978fb
3 changed files with 42 additions and 37 deletions

View File

@ -4642,7 +4642,10 @@ v0.33.20 10-Feb-2002
mbcico: mbcico:
Fixed binkp driver to accept incoming unprotected sessions. Fixed binkp driver to accept incoming unprotected sessions.
Temporary added extra password handling logs.
If a binkp session comes in and there already is a session
with that node, mbcico stopts the binkp session with an error.
mbsebbs: mbsebbs:
On some systems the download taglists contained garbage after On some systems the download taglists contained garbage after
the short filename causing wrong filenames at the users side. the short filename causing wrong filenames at the users side.

View File

@ -398,14 +398,12 @@ SM_STATES
sendpass, sendpass,
waitaddr, waitaddr,
authremote, authremote,
ifsecure,
waitok waitok
SM_NAMES SM_NAMES
(char *)"waitconn", (char *)"waitconn",
(char *)"sendpass", (char *)"sendpass",
(char *)"waitaddr", (char *)"waitaddr",
(char *)"authremote", (char *)"authremote",
(char *)"ifsecure",
(char *)"waitok" (char *)"waitok"
SM_EDECL SM_EDECL
faddr *primary; faddr *primary;
@ -436,12 +434,13 @@ SM_STATE(waitconn)
primary = bestaka_s(remote->addr); primary = bestaka_s(remote->addr);
p = xstrcpy(ascfnode(primary, 0x1f)); p = xstrcpy(ascfnode(primary, 0x1f));
/*
* Add all other aka's exept primary aka.
*/
for (i = 0; i < 40; i++) for (i = 0; i < 40; i++)
if ((CFG.aka[i].zone) && (CFG.akavalid[i]) && if ((CFG.aka[i].zone) && (CFG.akavalid[i]) &&
((CFG.aka[i].zone != primary->zone) || ((CFG.aka[i].zone != primary->zone) || (CFG.aka[i].net != primary->net) ||
(CFG.aka[i].net != primary->net) || (CFG.aka[i].node != primary->node) || (CFG.aka[i].point!= primary->point))) {
(CFG.aka[i].node != primary->node) ||
(CFG.aka[i].point!= primary->point))) {
p = xstrcat(p, (char *)" "); p = xstrcat(p, (char *)" ");
p = xstrcat(p, aka2str(CFG.aka[i])); p = xstrcat(p, aka2str(CFG.aka[i]));
} }
@ -494,6 +493,7 @@ SM_STATE(waitaddr)
Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f)); Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f));
if (nodelock(tmpa->addr)) { if (nodelock(tmpa->addr)) {
binkp_send_control(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f)); binkp_send_control(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f));
SM_ERROR;
} }
/* /*
@ -541,20 +541,13 @@ SM_STATE(authremote)
} }
if (rc) { if (rc) {
SM_PROCEED(ifsecure) SM_PROCEED(waitok)
} else { } else {
Syslog('!', "Error: the wrong node is reached"); Syslog('!', "Error: the wrong node is reached");
binkp_send_control(MM_ERR, "No AKAs in common or all AKAs busy"); binkp_send_control(MM_ERR, "No AKAs in common or all AKAs busy");
SM_ERROR; SM_ERROR;
} }
SM_STATE(ifsecure)
// if (SendPass) {
SM_PROCEED(waitok)
// }
// SM_SUCCESS;
SM_STATE(waitok) SM_STATE(waitok)
for (;;) { for (;;) {
@ -597,13 +590,11 @@ SM_DECL(ansbinkp, (char *)"ansbinkp")
SM_STATES SM_STATES
waitconn, waitconn,
waitaddr, waitaddr,
ispasswd,
waitpwd, waitpwd,
pwdack pwdack
SM_NAMES SM_NAMES
(char *)"waitconn", (char *)"waitconn",
(char *)"waitaddr", (char *)"waitaddr",
(char *)"ispasswd",
(char *)"waitpwd", (char *)"waitpwd",
(char *)"pwdack" (char *)"pwdack"
@ -661,6 +652,7 @@ SM_STATE(waitaddr)
Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f)); Syslog('+', "Address : %s", ascfnode(tmpa->addr, 0x1f));
if (nodelock(tmpa->addr)) { if (nodelock(tmpa->addr)) {
binkp_send_control(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f)); binkp_send_control(MM_BSY, "Address %s locked", ascfnode(tmpa->addr, 0x1f));
SM_ERROR;
} }
/* /*
@ -697,7 +689,7 @@ SM_STATE(waitaddr)
history.aka.point = remote->addr->point; history.aka.point = remote->addr->point;
sprintf(history.aka.domain, "%s", remote->addr->domain); sprintf(history.aka.domain, "%s", remote->addr->domain);
SM_PROCEED(ispasswd) SM_PROCEED(waitpwd)
} else if (rbuf[0] == MM_ERR) { } else if (rbuf[0] == MM_ERR) {
Syslog('!', "Remote error: %s", &rbuf[1]); Syslog('!', "Remote error: %s", &rbuf[1]);
@ -709,14 +701,6 @@ SM_STATE(waitaddr)
} }
} }
SM_STATE(ispasswd)
// if (!Loaded && !strlen(nodes.Epasswd)) {
// Syslog('+', "Unprotected session");
// SM_SUCCESS;
// }
SM_PROCEED(waitpwd)
SM_STATE(waitpwd) SM_STATE(waitpwd)
for (;;) { for (;;) {
@ -741,11 +725,15 @@ SM_STATE(waitpwd)
SM_STATE(pwdack) SM_STATE(pwdack)
Syslog('-', "pwdack '%s' Loaded=%s strlen(nodes.Epasswd)=%d", &rbuf[1], Loaded?"true":"false", strlen(nodes.Epasswd)); Syslog('-', "pwdack '%s' Loaded=%s strlen(nodes.Epasswd)=%d", &rbuf[1], Loaded?"true":"false", strlen(nodes.Epasswd));
if ((strcmp(&rbuf[1], "-") == 0) && (!Loaded && !strlen(nodes.Epasswd))) { if ((strcmp(&rbuf[1], "-") == 0) && !Loaded) {
Syslog('+', "No password, unprotected BINKP session"); Syslog('+', "Node not in setup, unprotected BINKP session");
binkp_send_control(MM_OK, ""); binkp_send_control(MM_OK, "");
SM_SUCCESS; SM_SUCCESS;
} else if (strcmp(&rbuf[1], nodes.Epasswd) == 0) { } else if ((strcmp(&rbuf[1], "-") == 0) && Loaded && !strlen(nodes.Epasswd)) {
Syslog('+', "Node in setup but no session password, unprotected BINKP session");
binkp_send_control(MM_OK, "");
SM_SUCCESS;
} else if ((strcmp(&rbuf[1], nodes.Epasswd) == 0) && Loaded) {
Syslog('+', "Password OK, protected BINKP session"); Syslog('+', "Password OK, protected BINKP session");
if (inbound) if (inbound)
free(inbound); free(inbound);
@ -759,7 +747,6 @@ SM_STATE(pwdack)
} }
SM_END SM_END
SM_RETURN SM_RETURN
@ -1053,8 +1040,6 @@ int binkp_batch(file_list *to_send)
TxState = TxDone; TxState = TxDone;
binkp_send_control(MM_EOB, ""); binkp_send_control(MM_EOB, "");
Syslog('+', "Binkp: sending EOB"); Syslog('+', "Binkp: sending EOB");
// } else {
// Syslog('b', "tmp != NULL");
} }
break; break;

View File

@ -61,7 +61,7 @@ int load_node(fidoaddr n)
{ {
char *temp; char *temp;
FILE *fp; FILE *fp;
int i; int i, j = 0;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
@ -74,11 +74,13 @@ int load_node(fidoaddr n)
fread(&nodeshdr, sizeof(nodeshdr), 1, fp); fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
while (fread(&nodes, nodeshdr.recsize, 1, fp) == 1) { while (fread(&nodes, nodeshdr.recsize, 1, fp) == 1) {
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR); fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
j++;
for (i = 0; i < 20; i++) { for (i = 0; i < 20; i++) {
if ((n.zone == nodes.Aka[i].zone) || (n.net == nodes.Aka[i].net) || if ((n.zone == nodes.Aka[i].zone) || (n.net == nodes.Aka[i].net) ||
(n.node == nodes.Aka[i].node) || (n.point == nodes.Aka[i].point)) { (n.node == nodes.Aka[i].node) || (n.point == nodes.Aka[i].point)) {
fclose(fp); fclose(fp);
free(temp); free(temp);
tasklog('-' , "Node record %d, aka nr %d", j, i+1);
return TRUE; return TRUE;
} }
} }
@ -92,6 +94,21 @@ int load_node(fidoaddr n)
char *size_str(long);
char *size_str(long size)
{
static char fmt[25];
if (size > 1048575) {
sprintf(fmt, "%ldK", size / 1024);
} else {
sprintf(fmt, "%ld ", size);
}
return fmt;
}
void set_next(int, int); void set_next(int, int);
void set_next(int hour, int min) void set_next(int hour, int min)
{ {
@ -198,12 +215,12 @@ int outstat()
*/ */
for (tmp = alist; tmp; tmp = tmp->next) { for (tmp = alist; tmp; tmp = tmp->next) {
if (first) { if (first) {
tasklog('+', "Flavor Out Size Online Modem ISDN TCP/IP Calls Status Mode Address"); tasklog('+', "Flavor Out Size Online Modem ISDN TCP/IP Calls Status Mode Address");
first = FALSE; first = FALSE;
} }
if (load_node(tmp->addr)) rc = load_node(tmp->addr);
tasklog('o', "Loaded node %s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f), tasklog('o', "Load node %s rc=%s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f), rc?"true":"false",
nodes.NoCall?"True":"False", nodes.NoTCP?"True":"False"); nodes.NoCall?"True":"False", nodes.NoTCP?"True":"False");
/* /*
@ -406,7 +423,7 @@ int outstat()
} }
} }
} }
sprintf(temp, "%s %8lu %08x %08x %08x %08x %5d %s %s %s", flstr, (long)tmp->size, sprintf(temp, "%s %8s %08x %08x %08x %08x %5d %s %s %s", flstr, size_str(tmp->size),
(unsigned int)tmp->olflags, (unsigned int)tmp->moflags, (unsigned int)tmp->olflags, (unsigned int)tmp->moflags,
(unsigned int)tmp->diflags, (unsigned int)tmp->ipflags, (unsigned int)tmp->diflags, (unsigned int)tmp->ipflags,
tmp->cst.tryno, callstatus(tmp->cst.trystat), callmode(tmp->callmode), ascfnode(tmp->addr, 0x0f)); tmp->cst.tryno, callstatus(tmp->cst.trystat), callmode(tmp->callmode), ascfnode(tmp->addr, 0x0f));