/* if EHLO message is not accepted. */
/* */
/************************************************/
-static _Bool doehlo(CONTYP *contact,char *line)
+static _Bool dohelo(CONTYP *contact,char *keyword,char *parameter)
+
+{
+#define OPEP "unieml.c:dohelo"
+#define DETAIL "HELO argument is mandatory, closing connection"
+
+_Bool done;
+int phase;
+_Bool proceed;
+
+done=false;
+phase=0;
+proceed=true;
+while (proceed==true) {
+ 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
+ }
+ break;
+ case 1 : //thereis an FQDN
+ contact->fqdn=rou_freestr(contact->fqdn);
+ contact->fqdn=strdup(parameter);
+ (void) transmit(contact,"%d-%s ready, your IP=[%s]",
+ CMDOK,contact->locname,contact->peerip);
+ done=true;
+ break;
+ default : //SAFE guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+return done;
+#undef DETAIL
+#undef OPEP
+}
+/*
+\f
+*/
+/************************************************/
+/* */
+/* Procedure to send an "HELO" message */
+/* if EHLO message is not accepted. */
+/* */
+/************************************************/
+static _Bool doehlo(CONTYP *contact,char *keyword,char *parameter)
{
static char *ehlostr[]= {
};
#define OPEP "unieml.c:doehlo"
-#define DETAIL "syntax error (domain part missing), disconnecting"
+#define DETAIL "syntax error (domain part missing), closing connection"
_Bool done;
-char *fqdn;
int strstart;
int phase;
_Bool proceed;
done=false;
-fqdn=(char *)0;
strstart=0;
phase=0;
proceed=true;
while (proceed==true) {
switch (phase) {
- case 0 : //Do we have
- fqdn=strchr(line,' ');
- if (fqdn!=(char *)0) {
- while ((*fqdn==' ')||(*fqdn=='\t'))
- fqdn++;
- }
- if ((fqdn==(char *)0)||(strlen(fqdn)==0)) {
- (void) transmit(contact,"%d 5.5.4 %s",BADPAR,DETAIL);
+ case 0 : //Do we have a parameter
+ if ((parameter==(char *)0)||(strlen(parameter)==0)) {
+ (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(fqdn);
+ contact->fqdn=strdup(parameter);
(void) transmit(contact,"%d-%s ready, your IP=[%s]",
CMDOK,contact->locname,contact->peerip);
(void) transmit(contact,"%d-SIZE %ld",CMDOK,MXMSIZE);
proceed=true;
while (proceed==true) {
char *line;
+ char *parameter;
TIMESPEC attend;
attend.tv_sec=60;
attend.tv_nsec=0;
status=tcp_getline(contact,&attend,&line);
+ parameter=strchr(line,' ');
+ if (parameter==(char *)0)
+ parameter=strchr(line,'\t');
+ if (parameter!=(char *)0) {
+ *parameter='\000';
+ parameter++;
+ while ((*parameter==' ')||(*parameter=='\t'))
+ parameter++;
+ }
if (status<=0) //timeout or trouble?
break; //no need to go further
switch (eml_getcode(line)) {
+ case c_helo : //HELO SMTP protocol
+ proceed=dohelo(contact,line,parameter);
+ break;
case c_ehlo : //EHLO SMTP protocol
- proceed=doehlo(contact,line);
+ proceed=doehlo(contact,line,parameter);
break;
case c_quit : //QUIT SMTP protocol
(void) transmit(contact,"%d 2.0.0 Bye, closing connection",QUITOK);