*** xx/smap.c Thu Jun 11 19:40:48 1998 --- smap.c Thu Jun 11 19:41:25 1998 *************** *** 364,369 **** --- 364,375 ---- ** some little errors. Made return codes RFC821-compliant, ** ripping out all the made-up return codes. ** + ** Modified: 10 June 1998, Pat Verner pat@patsat.isis.co.za + ** Added a primitive EHLO response, to return the SIZE parameter if + ** maxbytes has been set. This can prevent large messages from even starting + ** to be sent, rather than receiving the whole darm message and discarding + ** it. + ** ** Last modified 06/09/98 14:21:36. Last retrieved 06/09/98 14:21:39. ** ** Compile conditionals: *************** *** 1902,1907 **** --- 1908,1941 ---- continue; } + + /* + ** "EHLO" just introduces the conversation. The name + ** passed in, if any, is stored in rhost - and never + ** used. + */ + if(!strcasecmp(p,"EHLO")) { + char *q; + if((q = strtok((char *)0,"\r\n")) == (char *)0) { + printf("250-Charmed, I'm sure.\r\n"); + if (rhost != (char *) NULL) + free(rhost); + rhost = (char *) NULL; + } else { + printf("250-(%s) pleased to meet you.\r\n",q); + if (rhost != (char *) NULL) + free(rhost); + rhost = malloc(strlen(q) + 1); + if (rhost != (char *) NULL) + strcpy(rhost, q); + } + if (maxbytes > 0 ) { + printf("250-SIZE %d\r\n", maxbytes); + } + printf("250 HELP\r\n"); + fflush(stdout); + continue; + } /* VERB is treated as a NO-OP internally. */ if(!strcasecmp(p,"VERB")) {