Fix against double remote aka's
This commit is contained in:
parent
390340c2ba
commit
545dccd376
@ -3,6 +3,9 @@ $Id$
|
||||
|
||||
v0.37.00 26-Dec-2002.
|
||||
|
||||
mbcico:
|
||||
With binkp and EMSI sessions double received remote aka's are
|
||||
filtered.
|
||||
|
||||
|
||||
v0.36.00 26-Dec-2002 - stable release
|
||||
|
@ -403,7 +403,7 @@ SM_NAMES
|
||||
SM_EDECL
|
||||
faddr *primary;
|
||||
char *p, *q;
|
||||
int i, rc, bufl, cmd;
|
||||
int i, rc, bufl, cmd, dupe;
|
||||
fa_list **tmp, *tmpa;
|
||||
int SendPass = FALSE;
|
||||
faddr *fa, ra;
|
||||
@ -473,10 +473,22 @@ SM_STATE(waitaddr)
|
||||
|
||||
for (q = strtok(p, " "); q; q = strtok(NULL, " "))
|
||||
if ((fa = parsefnode(q))) {
|
||||
dupe = FALSE;
|
||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||
if ((tmpa->addr->zone == fa->zone) && (tmpa->addr->net == fa->net) &&
|
||||
(tmpa->addr->node == fa->node) && (tmpa->addr->point == fa->point) &&
|
||||
(strcmp(tmpa->addr->domain, fa->domain) == 0)) {
|
||||
dupe = TRUE;
|
||||
Syslog('b', "Double address %s", ascfnode(tmpa->addr, 0x1f));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dupe) {
|
||||
*tmp = (fa_list*)malloc(sizeof(fa_list));
|
||||
(*tmp)->next = NULL;
|
||||
(*tmp)->addr = fa;
|
||||
tmp = &((*tmp)->next);
|
||||
}
|
||||
} else {
|
||||
Syslog('!', "Bad remote address: \"%s\"", printable(q, 0));
|
||||
binkp_send_control(MM_ERR, "Bad address");
|
||||
@ -591,7 +603,7 @@ SM_NAMES
|
||||
|
||||
SM_EDECL
|
||||
char *p, *q;
|
||||
int i, rc, bufl, cmd;
|
||||
int i, rc, bufl, cmd, dupe;
|
||||
fa_list **tmp, *tmpa;
|
||||
faddr *fa;
|
||||
|
||||
@ -630,10 +642,22 @@ SM_STATE(waitaddr)
|
||||
|
||||
for (q = strtok(p, " "); q; q = strtok(NULL, " "))
|
||||
if ((fa = parsefnode(q))) {
|
||||
dupe = FALSE;
|
||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||
if ((tmpa->addr->zone == fa->zone) && (tmpa->addr->net == fa->net) &&
|
||||
(tmpa->addr->node == fa->node) && (tmpa->addr->point == fa->point) &&
|
||||
(strcmp(tmpa->addr->domain, fa->domain) == 0)) {
|
||||
dupe = TRUE;
|
||||
Syslog('b', "Double address %s", ascfnode(tmpa->addr, 0x1f));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dupe) {
|
||||
*tmp = (fa_list*)malloc(sizeof(fa_list));
|
||||
(*tmp)->next = NULL;
|
||||
(*tmp)->addr = fa;
|
||||
tmp = &((*tmp)->next);
|
||||
}
|
||||
} else {
|
||||
Syslog('!', "Bad remote address: \"%s\"", printable(q, 0));
|
||||
binkp_send_control(MM_ERR, "Bad address");
|
||||
|
@ -328,10 +328,10 @@ exit:
|
||||
|
||||
int scanemsidat(char *buf)
|
||||
{
|
||||
char *p,*q;
|
||||
fa_list **tmp,*tmpa;
|
||||
faddr *fa;
|
||||
char *mailer_prod,*mailer_name,*mailer_version,*mailer_serial;
|
||||
char *p, *q, *mailer_prod, *mailer_name, *mailer_version, *mailer_serial;
|
||||
int dupe;
|
||||
|
||||
Syslog('I',"got data packet: \"%s\"",buf);
|
||||
|
||||
@ -348,13 +348,26 @@ int scanemsidat(char *buf)
|
||||
tidy_falist(&remote);
|
||||
remote = NULL;
|
||||
tmp = &remote;
|
||||
for (q = strtok(p," "); q; q = strtok(NULL," "))
|
||||
for (q = strtok(p," "); q; q = strtok(NULL," ")) {
|
||||
if ((fa = parsefnode(q))) {
|
||||
dupe = FALSE;
|
||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||
if ((tmpa->addr->zone == fa->zone) && (tmpa->addr->net == fa->net) &&
|
||||
(tmpa->addr->node == fa->node) && (tmpa->addr->point == fa->point) &&
|
||||
(strcmp(tmpa->addr->domain, fa->domain) == 0)) {
|
||||
dupe = TRUE;
|
||||
Syslog('i', "Double address %s", ascfnode(tmpa->addr, 0x1f));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dupe) {
|
||||
*tmp = (fa_list*)malloc(sizeof(fa_list));
|
||||
(*tmp)->next = NULL;
|
||||
(*tmp)->addr = fa;
|
||||
tmp = &((*tmp)->next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||
Syslog('+', "address : %s",ascfnode(tmpa->addr,0x1f));
|
||||
@ -378,19 +391,12 @@ int scanemsidat(char *buf)
|
||||
if (emsi_remote_password)
|
||||
free(emsi_remote_password);
|
||||
emsi_remote_password=xstrcpy(sel_brace(NULL));
|
||||
// Syslog('+', "password: %s", MBSE_SS(emsi_remote_password));
|
||||
|
||||
p=sel_brace(NULL);
|
||||
Syslog('+', "link : %s", MBSE_SS(p));
|
||||
for (q=strtok(p,",");q;q=strtok(NULL,",")) {
|
||||
if (((q[0] >= '5') && (q[0] <= '8')) &&
|
||||
((toupper(q[1]) == 'N') ||
|
||||
(toupper(q[1]) == 'O') ||
|
||||
(toupper(q[1]) == 'E') ||
|
||||
(toupper(q[1]) == 'S') ||
|
||||
(toupper(q[1]) == 'M')) &&
|
||||
((q[2] == '1') || (q[2] == '2')))
|
||||
{
|
||||
if (((q[0] >= '5') && (q[0] <= '8')) && ((toupper(q[1]) == 'N') || (toupper(q[1]) == 'O') ||
|
||||
(toupper(q[1]) == 'E') || (toupper(q[1]) == 'S') || (toupper(q[1]) == 'M')) && ((q[2] == '1') || (q[2] == '2'))) {
|
||||
strncpy(emsi_remote_comm,q,3);
|
||||
}
|
||||
else if (strcasecmp(q,"PUA") == 0) emsi_remote_lcodes |= LCODE_PUA;
|
||||
@ -407,8 +413,7 @@ int scanemsidat(char *buf)
|
||||
|
||||
p=sel_brace(NULL);
|
||||
Syslog('+', "comp : %s", p);
|
||||
for (q=strtok(p,",");q;q=strtok(NULL,","))
|
||||
{
|
||||
for (q=strtok(p,",");q;q=strtok(NULL,",")) {
|
||||
if (strcasecmp(q,"DZA") == 0) emsi_remote_protos |= PROT_DZA;
|
||||
else if (strcasecmp(q,"ZAP") == 0) emsi_remote_protos |= PROT_ZAP;
|
||||
else if (strcasecmp(q,"ZMO") == 0) emsi_remote_protos |= PROT_ZMO;
|
||||
@ -436,10 +441,9 @@ int scanemsidat(char *buf)
|
||||
mailer_name=sel_brace(NULL);
|
||||
mailer_version=sel_brace(NULL);
|
||||
mailer_serial=sel_brace(NULL);
|
||||
Syslog('+', "uses : %s [%s] version %s/%s",
|
||||
mailer_name,mailer_prod,mailer_version,mailer_serial);
|
||||
Syslog('+', "uses : %s [%s] version %s/%s", mailer_name, mailer_prod, mailer_version, mailer_serial);
|
||||
|
||||
while ((p=sel_brace(NULL)))
|
||||
while ((p=sel_brace(NULL))) {
|
||||
if (strcasecmp(p,"IDENT") == 0) {
|
||||
p=sel_brace(NULL);
|
||||
Syslog('+', "system : %s",(p=sel_bracket(p)));
|
||||
@ -496,6 +500,7 @@ int scanemsidat(char *buf)
|
||||
q=sel_brace(NULL);
|
||||
Syslog('+', "extra : \"%s\" value: \"%s\"",p,q);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user