#undef FMT
}
/*
-\f
+^L
*/
-/************************************************/
-/* */
-/* Procedure to send an "HELO" message */
-/* if EHLO message is not accepted. */
-/* */
-/************************************************/
-static _Bool dohelo(CONTYP *contact,char *parameter)
+/********************************************************/
+/* */
+/* Procedure to check if helo or ehlo paratmeter */
+/* is a correct one */
+/* */
+/********************************************************/
+static _Bool isgoodfqdn(CONTYP *contact,char *parameter)
{
-#define OPEP "lvleml.c:dohelo"
-#define DETAIL "HELO argument is mandatory, closing connection"
+#define OPEP "lvleml.c:isgoodfqdn"
_Bool done;
int phase;
phase=0;
proceed=true;
while (proceed==true) {
+ (void) rou_alert(0,"JMPDBG %s phase='%d' parm=<%s>",OPEP,phase,parameter);
switch (phase) {
- case 0 : //checking need parameter
- if ((parameter==(char *)0)||(strlen(parameter)==0)) {
- (void) transmit(contact,"%d 5.5.4 %s.",BADPAR,DETAIL);
- phase=999; //Trouble trouble
- }
+ case 0 : //checking if we have a parameter
+ if ((parameter==(char *)0)||(strlen(parameter)==0))
+ phase=999; //no parameter
break;
- case 1 : //thereis an FQDN
+ case 1 : //do we have space
+ if ((parameter[0]!=' ')&&(parameter[0]!='\t'))
+ phase=999; //parameter wrong format
+ break;
+ case 2 : //cleaning space character
+ while ((parameter[0]==' ')||(parameter[0]=='\t'))
+ parameter++;
+ if (strlen(parameter)==0)
+ phase=999; //no parameter?
+ break;
+ case 3 : //seems to be a good fqdn
contact->fqdn=rou_freestr(contact->fqdn);
contact->fqdn=strdup(parameter);
- (void) transmit(contact,"%d-%s ready, your IP/FQDN=[%s/%s]",
- CMDOK,contact->locname,
- contact->peerip,contact->peername);
- done=true;
+ done=true;
break;
default : //SAFE guard
proceed=false;
phase++;
}
return done;
+#undef OPEP
+}
+/*
+\f
+*/
+/************************************************/
+/* */
+/* Procedure to send an "HELO" message */
+/* if EHLO message is not accepted. */
+/* */
+/************************************************/
+static _Bool dohelo(CONTYP *contact,char *parameter)
+
+{
+#define OPEP "lvleml.c:dohelo"
+#define DETAIL "HELO argument is mandatory, closing connection"
+
+_Bool done;
+
+if ((done=isgoodfqdn(contact,parameter))==false)
+ (void) transmit(contact,"%d 5.5.4 %s.",BADPAR,DETAIL);
+else
+ (void) transmit(contact,"%d %s ready, your IP/FQDN=[%s/%s]",
+ CMDOK,contact->locname,
+ contact->peerip,contact->peername);
+return done;
#undef DETAIL
#undef OPEP
}
phase=0;
proceed=true;
while (proceed==true) {
+ (void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
switch (phase) {
case 0 : //Do we have a parameter
- if ((parameter==(char *)0)||(strlen(parameter)==0)) {
+ if ((done=isgoodfqdn(contact,parameter))==false) {
(void) transmit(contact,"%d 5.5.4 %s.",BADPAR,DETAIL);
phase=999; //Trouble trouble
}
break;
case 1 : //thereis an FQDN
- contact->fqdn=rou_freestr(contact->fqdn);
- contact->fqdn=strdup(parameter);
+ if (contact->tlsok==true)
+ strstart++;
(void) transmit(contact,"%d-%s ready, your IP/FQDN=[%s/%s]",
CMDOK,contact->locname,
contact->peerip,contact->peername);
(void) transmit(contact,"%d-SIZE %ld",CMDOK,MXMSIZE);
- if (contact->tlsok==true)
- strstart++;
for (int i=strstart;ehlostr[i]!=(char *)0;i++) {
(void) transmit(contact,"%d%s",CMDOK,ehlostr[i]);
}
{
#define OPEP "lvleml.c:eml_docontact"
+
int status;
int got;
int delay;
got=0;
delay=300; //5 minutes standard delay
if (debug>1)
- delay/=30; //10 sec in debug mode
+ delay/=10; //30 sec in debug mode
proceed=true;
(void) signon(contact);
while (proceed==true) {
proceed=doehlo(contact,line);
break;
case c_quit : //QUIT SMTP protocol
- //(void) rou_alert(0,"%s JMPDBG sleep started",OPEP);
(void) transmit(contact,"%d 2.0.0 Bye, closing connection %s",
QUITOK,contact->mainsesid);
- //(void) rou_alert(0,"%s JMPDBG Bye transmitted",OPEP);
status=1; //every thing fine
proceed=false;
break;
case c_unknown : //uknown keyword
(void) rou_alert(0,"Command <%s> from [%s] is unknown (config?)",
line,contact->peerip);
- (void) transmit(contact,"%d 5.5.1 command <%s> is unknown",CMDBAD,line);
+ (void) transmit(contact,"%d-5.5.1 command <%s> is unknown",CMDBAD,line);
+ (void) transmit(contact,"%d 2.0.0 Bye, closing connection %s",
+ QUITOK,contact->mainsesid);
+ status=-1; //remote is a trouble maker
+ proceed=false;
+ (void) rou_alert(0,"%s JMPDBG should ho out",OPEP);
break;
default :
(void) rou_alert(0,"Unable to find keyword for <%s> (Bug?)",OPEP,line);