Some fixes

This commit is contained in:
Michiel Broek 2005-04-18 14:49:23 +00:00
parent 81c697dc5c
commit b05118a4b2

View File

@ -182,27 +182,20 @@ void add_server(srv_list **fdp, char *name, int hops)
void del_server(srv_list **fdp, char *name) void del_server(srv_list **fap, char *name)
{ {
srv_list *tmp, *old = NULL; srv_list *ta, *tan;
Syslog('r', "delserver %s", name); Syslog('r', "delserver %s", name);
for (tmp = *fdp; tmp; tmp = old) { if (*fap == NULL)
Syslog('r', " loop %s", tmp->server); return;
if (strcmp(tmp->server, name) == 0) { for (ta = *fap; ta; ta = ta->next) {
if (old) { while ((tan = ta->next) && (strcmp(tan->server, name) == 0)) {
Syslog('r', " old is true"); ta->next = tan->next;
old->next = tmp->next; free(tan);
} else {
Syslog('r', " old = false");
*fdp = tmp->next;
}
old = tmp->next;
free(tmp);
} else {
old = tmp->next;
} }
ta->next = tan;
} }
} }
@ -419,6 +412,7 @@ void check_servers(void)
tnsl->gotpass = FALSE; tnsl->gotpass = FALSE;
tnsl->gotserver = FALSE; tnsl->gotserver = FALSE;
tnsl->token = 0; tnsl->token = 0;
del_server(&servers, tnsl->server);
changed = TRUE; changed = TRUE;
break; break;
} }
@ -698,7 +692,7 @@ void receiver(struct servent *se)
sprintf(csbuf, "461 %s: Not enough parameters\r\n", command); sprintf(csbuf, "461 %s: Not enough parameters\r\n", command);
send_msg(tnsl->socket, tnsl->servaddr_in, tnsl->server, csbuf); send_msg(tnsl->socket, tnsl->servaddr_in, tnsl->server, csbuf);
} else { } else {
sprintf(temp, "SQUIT %s %s", hostname, parameters); sprintf(temp, "SQUIT %s", parameters);
command_squit(hostname, parameters); command_squit(hostname, parameters);
send_all(temp); send_all(temp);
} }