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:
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:
On some systems the download taglists contained garbage after
the short filename causing wrong filenames at the users side.

View File

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

View File

@ -61,7 +61,7 @@ int load_node(fidoaddr n)
{
char *temp;
FILE *fp;
int i;
int i, j = 0;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
@ -74,11 +74,13 @@ int load_node(fidoaddr n)
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
while (fread(&nodes, nodeshdr.recsize, 1, fp) == 1) {
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
j++;
for (i = 0; i < 20; i++) {
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)) {
fclose(fp);
free(temp);
tasklog('-' , "Node record %d, aka nr %d", j, i+1);
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 hour, int min)
{
@ -198,12 +215,12 @@ int outstat()
*/
for (tmp = alist; tmp; tmp = tmp->next) {
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;
}
if (load_node(tmp->addr))
tasklog('o', "Loaded node %s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f),
rc = load_node(tmp->addr);
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");
/*
@ -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->diflags, (unsigned int)tmp->ipflags,
tmp->cst.tryno, callstatus(tmp->cst.trystat), callmode(tmp->callmode), ascfnode(tmp->addr, 0x0f));