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.
|
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
|
v0.36.00 26-Dec-2002 - stable release
|
||||||
|
@ -403,7 +403,7 @@ SM_NAMES
|
|||||||
SM_EDECL
|
SM_EDECL
|
||||||
faddr *primary;
|
faddr *primary;
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
int i, rc, bufl, cmd;
|
int i, rc, bufl, cmd, dupe;
|
||||||
fa_list **tmp, *tmpa;
|
fa_list **tmp, *tmpa;
|
||||||
int SendPass = FALSE;
|
int SendPass = FALSE;
|
||||||
faddr *fa, ra;
|
faddr *fa, ra;
|
||||||
@ -473,10 +473,22 @@ SM_STATE(waitaddr)
|
|||||||
|
|
||||||
for (q = strtok(p, " "); q; q = strtok(NULL, " "))
|
for (q = strtok(p, " "); q; q = strtok(NULL, " "))
|
||||||
if ((fa = parsefnode(q))) {
|
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 = (fa_list*)malloc(sizeof(fa_list));
|
||||||
(*tmp)->next = NULL;
|
(*tmp)->next = NULL;
|
||||||
(*tmp)->addr = fa;
|
(*tmp)->addr = fa;
|
||||||
tmp = &((*tmp)->next);
|
tmp = &((*tmp)->next);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Syslog('!', "Bad remote address: \"%s\"", printable(q, 0));
|
Syslog('!', "Bad remote address: \"%s\"", printable(q, 0));
|
||||||
binkp_send_control(MM_ERR, "Bad address");
|
binkp_send_control(MM_ERR, "Bad address");
|
||||||
@ -591,7 +603,7 @@ SM_NAMES
|
|||||||
|
|
||||||
SM_EDECL
|
SM_EDECL
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
int i, rc, bufl, cmd;
|
int i, rc, bufl, cmd, dupe;
|
||||||
fa_list **tmp, *tmpa;
|
fa_list **tmp, *tmpa;
|
||||||
faddr *fa;
|
faddr *fa;
|
||||||
|
|
||||||
@ -630,10 +642,22 @@ SM_STATE(waitaddr)
|
|||||||
|
|
||||||
for (q = strtok(p, " "); q; q = strtok(NULL, " "))
|
for (q = strtok(p, " "); q; q = strtok(NULL, " "))
|
||||||
if ((fa = parsefnode(q))) {
|
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 = (fa_list*)malloc(sizeof(fa_list));
|
||||||
(*tmp)->next = NULL;
|
(*tmp)->next = NULL;
|
||||||
(*tmp)->addr = fa;
|
(*tmp)->addr = fa;
|
||||||
tmp = &((*tmp)->next);
|
tmp = &((*tmp)->next);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Syslog('!', "Bad remote address: \"%s\"", printable(q, 0));
|
Syslog('!', "Bad remote address: \"%s\"", printable(q, 0));
|
||||||
binkp_send_control(MM_ERR, "Bad address");
|
binkp_send_control(MM_ERR, "Bad address");
|
||||||
|
@ -328,10 +328,10 @@ exit:
|
|||||||
|
|
||||||
int scanemsidat(char *buf)
|
int scanemsidat(char *buf)
|
||||||
{
|
{
|
||||||
char *p,*q;
|
|
||||||
fa_list **tmp,*tmpa;
|
fa_list **tmp,*tmpa;
|
||||||
faddr *fa;
|
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);
|
Syslog('I',"got data packet: \"%s\"",buf);
|
||||||
|
|
||||||
@ -348,13 +348,26 @@ int scanemsidat(char *buf)
|
|||||||
tidy_falist(&remote);
|
tidy_falist(&remote);
|
||||||
remote = NULL;
|
remote = NULL;
|
||||||
tmp = &remote;
|
tmp = &remote;
|
||||||
for (q = strtok(p," "); q; q = strtok(NULL," "))
|
for (q = strtok(p," "); q; q = strtok(NULL," ")) {
|
||||||
if ((fa = parsefnode(q))) {
|
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 = (fa_list*)malloc(sizeof(fa_list));
|
||||||
(*tmp)->next = NULL;
|
(*tmp)->next = NULL;
|
||||||
(*tmp)->addr = fa;
|
(*tmp)->addr = fa;
|
||||||
tmp = &((*tmp)->next);
|
tmp = &((*tmp)->next);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
for (tmpa = remote; tmpa; tmpa = tmpa->next) {
|
||||||
Syslog('+', "address : %s",ascfnode(tmpa->addr,0x1f));
|
Syslog('+', "address : %s",ascfnode(tmpa->addr,0x1f));
|
||||||
@ -378,19 +391,12 @@ int scanemsidat(char *buf)
|
|||||||
if (emsi_remote_password)
|
if (emsi_remote_password)
|
||||||
free(emsi_remote_password);
|
free(emsi_remote_password);
|
||||||
emsi_remote_password=xstrcpy(sel_brace(NULL));
|
emsi_remote_password=xstrcpy(sel_brace(NULL));
|
||||||
// Syslog('+', "password: %s", MBSE_SS(emsi_remote_password));
|
|
||||||
|
|
||||||
p=sel_brace(NULL);
|
p=sel_brace(NULL);
|
||||||
Syslog('+', "link : %s", MBSE_SS(p));
|
Syslog('+', "link : %s", MBSE_SS(p));
|
||||||
for (q=strtok(p,",");q;q=strtok(NULL,",")) {
|
for (q=strtok(p,",");q;q=strtok(NULL,",")) {
|
||||||
if (((q[0] >= '5') && (q[0] <= '8')) &&
|
if (((q[0] >= '5') && (q[0] <= '8')) && ((toupper(q[1]) == 'N') || (toupper(q[1]) == 'O') ||
|
||||||
((toupper(q[1]) == 'N') ||
|
(toupper(q[1]) == 'E') || (toupper(q[1]) == 'S') || (toupper(q[1]) == 'M')) && ((q[2] == '1') || (q[2] == '2'))) {
|
||||||
(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);
|
strncpy(emsi_remote_comm,q,3);
|
||||||
}
|
}
|
||||||
else if (strcasecmp(q,"PUA") == 0) emsi_remote_lcodes |= LCODE_PUA;
|
else if (strcasecmp(q,"PUA") == 0) emsi_remote_lcodes |= LCODE_PUA;
|
||||||
@ -407,8 +413,7 @@ int scanemsidat(char *buf)
|
|||||||
|
|
||||||
p=sel_brace(NULL);
|
p=sel_brace(NULL);
|
||||||
Syslog('+', "comp : %s", p);
|
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;
|
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,"ZAP") == 0) emsi_remote_protos |= PROT_ZAP;
|
||||||
else if (strcasecmp(q,"ZMO") == 0) emsi_remote_protos |= PROT_ZMO;
|
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_name=sel_brace(NULL);
|
||||||
mailer_version=sel_brace(NULL);
|
mailer_version=sel_brace(NULL);
|
||||||
mailer_serial=sel_brace(NULL);
|
mailer_serial=sel_brace(NULL);
|
||||||
Syslog('+', "uses : %s [%s] version %s/%s",
|
Syslog('+', "uses : %s [%s] version %s/%s", mailer_name, mailer_prod, mailer_version, mailer_serial);
|
||||||
mailer_name,mailer_prod,mailer_version,mailer_serial);
|
|
||||||
|
|
||||||
while ((p=sel_brace(NULL)))
|
while ((p=sel_brace(NULL))) {
|
||||||
if (strcasecmp(p,"IDENT") == 0) {
|
if (strcasecmp(p,"IDENT") == 0) {
|
||||||
p=sel_brace(NULL);
|
p=sel_brace(NULL);
|
||||||
Syslog('+', "system : %s",(p=sel_bracket(p)));
|
Syslog('+', "system : %s",(p=sel_bracket(p)));
|
||||||
@ -496,6 +500,7 @@ int scanemsidat(char *buf)
|
|||||||
q=sel_brace(NULL);
|
q=sel_brace(NULL);
|
||||||
Syslog('+', "extra : \"%s\" value: \"%s\"",p,q);
|
Syslog('+', "extra : \"%s\" value: \"%s\"",p,q);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user