[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hack for smtpserver




  The enclosed patch for smtpserver.c in 2.99.21 will relax checking of 
the HELO parameter.  This patch adds a new command line parm "-h", which 
restores smtpserver strong HELO checking.  With this addition, smtpserver 
will never respond with more than one line to a HELO response, and never 
refuse a connection due to a misformed domain (ie. containing spaces).

  This should make dumb PC clients like EMC (whose authors haven't fixed 
the continuation line bug in their product since informed about it, over 
4 months ago) and PMMail happier.

Tom
*** smtpserver.c.orig	Sun Dec 10 15:31:19 1995
--- smtpserver.c	Sun Dec 10 15:48:36 1995
***************
*** 167,172 ****
--- 167,173 ----
  char	ihostaddr[3*4+1*3+2+1 /* == 18 for '[255.255.255.255]' */ +10/*slack*/];
  int	rport;
  int	skeptical  = 1;
+ int	checkhelo  = 0;
  int	verbose    = 0;
  int	daemon_flg = 1;
  int	pid, routerpid;
***************
*** 323,329 ****
  	  exit(1);
  	}
  	/* optarg = NULL; */
! 	while ((c = getopt(argc, argv, "aBigl:np:L:M:P:R:s:Vv")) != EOF) {
  	  switch (c) {
  #ifdef	USE_AUTH
  	    case 'a':
--- 324,330 ----
  	  exit(1);
  	}
  	/* optarg = NULL; */
! 	while ((c = getopt(argc, argv, "aBighl:np:L:M:P:R:s:Vv")) != EOF) {
  	  switch (c) {
  #ifdef	USE_AUTH
  	    case 'a':
***************
*** 347,352 ****
--- 348,356 ----
  	    case 'g':	/* gullible */
  		skeptical = 0;
  		break;
+ 	    case 'h':	/* checkhelo */
+ 		checkhelo = 1;
+ 		break;
  	    case 'l':	/* log file */
  		logfile = strdup(optarg);
  		break;
***************
*** 785,791 ****
  	 * tokenizer -- RFC821SCN.C, lets use it :)
  	 * We need it for proper handling of ESMTP anyway
  	 */
! 	if (skeptical && partridge(helobuf, cfinfo)) {
  	  rfc821_error_ptr += (cp - helobuf);
  	  type821err(501, buf,
  		     "Invalid `%s' parameter!  Err: %s",
--- 789,795 ----
  	 * tokenizer -- RFC821SCN.C, lets use it :)
  	 * We need it for proper handling of ESMTP anyway
  	 */
! 	if (checkhelo && skeptical && partridge(helobuf, cfinfo)) {
  	  rfc821_error_ptr += (cp - helobuf);
  	  type821err(501, buf,
  		     "Invalid `%s' parameter!  Err: %s",
***************
*** 804,816 ****
  	if (skeptical && ihostaddr[0] != '\0'
  	    && rhostname[0] != '\0' && rhostname[0] != '['
  	    && cistrcmp(helobuf, rhostname) != 0) {
! 	  type(-250, " %s That hostname is inconsistent with",
! 	       myhostname);
! 	  type(-250, " %s your address to name mapping.",
! 	       myhostname);
  	  type(carp->cmd==Hello2 ? -250: 250,
  	       " %s expected \"%s %s\"", myhostname,
! 	       carp->verb, rhostname);
  	} else
  	  type(carp->cmd==Hello2 ? -250: 250,
  	       " %s Hello %s", myhostname, helobuf);
--- 808,822 ----
  	if (skeptical && ihostaddr[0] != '\0'
  	    && rhostname[0] != '\0' && rhostname[0] != '['
  	    && cistrcmp(helobuf, rhostname) != 0) {
! 	  if (checkhelo) {
! 	    type(-250, " %s That hostname is inconsistent with",
! 	         myhostname);
! 	    type(-250, " %s your address to name mapping.",
! 	         myhostname);
! 	  }
  	  type(carp->cmd==Hello2 ? -250: 250,
  	       " %s expected \"%s %s\"", myhostname,
! 	     carp->verb, rhostname);
  	} else
  	  type(carp->cmd==Hello2 ? -250: 250,
  	       " %s Hello %s", myhostname, helobuf);