(void) freesessid(contact);
contact->sqlptr=sql_closesql(contact->sqlptr);
contact->logptr=log_closelog(contact->logptr);
+ contact->relayok=(char **)rou_freelist((void **)contact->relayok,
+ (genfree_t)rou_freestr);
contact->recipients=(RCPTYP **)rou_freelist((void **)contact->recipients,
(genfree_t)eml_freerecipient);
contact->authname=rou_freestr(contact->authname);
phase=999; //no contact possible.
}
break;
- case 2 : //waiting from contact
+ case 2 : //loading the relayable IP list
+ contact->relayok=eml_load_relayed(getenv("RELAYABLE"));
+ break;
+ case 3 : //waiting from contact
if ((contact->socptr=soc_accept(socptr,pos))==(SOCPTR *)0) {
(void) rou_alert(3,"%s Unable to open contact",OPEP);
contact=freecontact(contact);
phase=999; //no contact
}
break;
- case 3 : //Preparing contact
+ case 4 : //Preparing contact
contact->mainsesid=eml_getmainsesid();
contact->delay=MXDELAY;
if (debug>1)
(void) rou_alert(0,"Contact from peer <%s> to port <%s> started",
contact->peerip,contact->locserv);
break;
- case 4 : //check contact validity
+ case 5 : //check contact validity
if ((contact->locname==(char *)0)||(contact->peerip==(char *)0)) {
(void) rou_alert(0,"%s Unable to establish contact entities",OPEP);
contact=freecontact(contact);
phase=999; //no identity
}
break;
- case 5 : //contact is good, then sending a signon
+ case 6 : //contact is good, then sending a signon
(void) log_fprintlog(contact->logptr,false,"opening connection CNT=%s",
contact->mainsesid);
break;
}
break;
case 2 : { //scanning relayable contents
+ int num;
char line[300];
-
+
+ num=0;
while (fgets(line,sizeof(line)-1,relays)!=(char *)0) {
+ char *mask;
struct sockaddr_in sa;
+ num++;
(void) rou_clean_conf_line(line);
if (strlen(line)==0)
continue;
+ if ((mask=strrchr(line,'/'))!=(char *)0)
+ *mask='\000';
if (inet_pton(AF_INET,line,&(sa.sin_addr))<=0) {
- (void) rou_alert(0,"%s <%s> not a valie IP (error=<%s>, config?)",
- OPEP,line,strerror(errno));
+ (void) rou_alert(0,"%s line='%03d' <%s> not a valid IP "
+ "(error=<%s>, config?)",
+ OPEP,num,line,strerror(errno));
continue;
}
+ if (mask!=(char *)0)
+ *mask='/';
list=(char **)rou_addlist((void **)list,strdup(line));
}
}