Does it work now?
This commit is contained in:
parent
b2b0a41c08
commit
bb8e570747
@ -515,13 +515,7 @@ void command_server(char *hostname, char *parameters)
|
|||||||
ncs_list *tnsl;
|
ncs_list *tnsl;
|
||||||
char temp[512], *name, *hops, *id, *prod, *vers, *fullname;
|
char temp[512], *name, *hops, *id, *prod, *vers, *fullname;
|
||||||
unsigned long token;
|
unsigned long token;
|
||||||
int ihops;
|
int ihops, found = FALSE;
|
||||||
|
|
||||||
for (tnsl = ncsl; tnsl; tnsl = tnsl->next) {
|
|
||||||
if (strcmp(tnsl->server, hostname) == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
name = strtok(parameters, " \0");
|
name = strtok(parameters, " \0");
|
||||||
hops = strtok(NULL, " \0");
|
hops = strtok(NULL, " \0");
|
||||||
@ -531,6 +525,13 @@ void command_server(char *hostname, char *parameters)
|
|||||||
fullname = strtok(NULL, "\0");
|
fullname = strtok(NULL, "\0");
|
||||||
ihops = atoi(hops) + 1;
|
ihops = atoi(hops) + 1;
|
||||||
|
|
||||||
|
for (tnsl = ncsl; tnsl; tnsl = tnsl->next) {
|
||||||
|
if (strcmp(tnsl->server, name) == 0) {
|
||||||
|
found = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Syslog('r', "name \"%s\"", printable(name, 0));
|
Syslog('r', "name \"%s\"", printable(name, 0));
|
||||||
Syslog('r', "hops \"%s\"", printable(hops, 0));
|
Syslog('r', "hops \"%s\"", printable(hops, 0));
|
||||||
Syslog('r', "id \"%s\"", printable(id, 0));
|
Syslog('r', "id \"%s\"", printable(id, 0));
|
||||||
@ -547,7 +548,7 @@ void command_server(char *hostname, char *parameters)
|
|||||||
token = atoi(id);
|
token = atoi(id);
|
||||||
sprintf(temp, "SERVER %s %d %s %s %s %s", name, ihops, id, prod, vers, fullname);
|
sprintf(temp, "SERVER %s %d %s %s %s %s", name, ihops, id, prod, vers, fullname);
|
||||||
|
|
||||||
if (tnsl->token) {
|
if (found && tnsl->token) {
|
||||||
/*
|
/*
|
||||||
* We are in calling state, so we expect the token from the
|
* We are in calling state, so we expect the token from the
|
||||||
* remote is the same as the token we sent.
|
* remote is the same as the token we sent.
|
||||||
@ -572,7 +573,7 @@ void command_server(char *hostname, char *parameters)
|
|||||||
* messages and set the session to connected if we got a
|
* messages and set the session to connected if we got a
|
||||||
* valid PASS command.
|
* valid PASS command.
|
||||||
*/
|
*/
|
||||||
if (tnsl->gotpass) {
|
if (found && tnsl->gotpass) {
|
||||||
sprintf(csbuf, "PASS %s 0000 IBC| %s\r\n", tnsl->passwd, tnsl->compress ? "Z":"");
|
sprintf(csbuf, "PASS %s 0000 IBC| %s\r\n", tnsl->passwd, tnsl->compress ? "Z":"");
|
||||||
send_msg(tnsl->socket, tnsl->servaddr_in, tnsl->server, csbuf);
|
send_msg(tnsl->socket, tnsl->servaddr_in, tnsl->server, csbuf);
|
||||||
sprintf(csbuf, "SERVER %s 0 %ld mbsebbs %s %s\r\n", tnsl->myname, token, VERSION, CFG.bbs_name);
|
sprintf(csbuf, "SERVER %s 0 %ld mbsebbs %s %s\r\n", tnsl->myname, token, VERSION, CFG.bbs_name);
|
||||||
@ -584,9 +585,20 @@ void command_server(char *hostname, char *parameters)
|
|||||||
Syslog('+', "IBC: connected with %s", tnsl->server);
|
Syslog('+', "IBC: connected with %s", tnsl->server);
|
||||||
add_server(&servers, tnsl->server, ihops, prod, vers, fullname);
|
add_server(&servers, tnsl->server, ihops, prod, vers, fullname);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
} else {
|
return;
|
||||||
Syslog('r', "IBC: got SERVER command without PASS command from %s", hostname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! found) {
|
||||||
|
/*
|
||||||
|
* Got a message about a server that is not our neighbour.
|
||||||
|
*/
|
||||||
|
add_server(&servers, name, ihops, prod, vers, fullname);
|
||||||
|
broadcast(temp, hostname);
|
||||||
|
changed = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Syslog('r', "IBC: got SERVER command without PASS command from %s", hostname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user