collect.c (43148) | collect.c (43730) |
---|---|
1/* 2 * Copyright (c) 1998 Sendmail, Inc. All rights reserved. 3 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 4 * Copyright (c) 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * By using this file, you agree to the terms and conditions set 8 * forth in the LICENSE file which can be found at the top level of 9 * the sendmail distribution. 10 * 11 */ 12 13#ifndef lint | 1/* 2 * Copyright (c) 1998 Sendmail, Inc. All rights reserved. 3 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 4 * Copyright (c) 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * By using this file, you agree to the terms and conditions set 8 * forth in the LICENSE file which can be found at the top level of 9 * the sendmail distribution. 10 * 11 */ 12 13#ifndef lint |
14static char sccsid[] = "@(#)collect.c 8.91 (Berkeley) 8/19/1998"; | 14static char sccsid[] = "@(#)collect.c 8.93 (Berkeley) 1/26/1999"; |
15#endif /* not lint */ 16 17# include <errno.h> 18# include "sendmail.h" 19 20/* 21** COLLECT -- read & parse message header & make temp file. 22** --- 50 unchanged lines hidden (view full) --- 73 volatile int c = EOF; 74 volatile bool inputerr = FALSE; 75 bool headeronly; 76 char *volatile buf; 77 volatile int buflen; 78 volatile int istate; 79 volatile int mstate; 80 u_char *volatile pbp; | 15#endif /* not lint */ 16 17# include <errno.h> 18# include "sendmail.h" 19 20/* 21** COLLECT -- read & parse message header & make temp file. 22** --- 50 unchanged lines hidden (view full) --- 73 volatile int c = EOF; 74 volatile bool inputerr = FALSE; 75 bool headeronly; 76 char *volatile buf; 77 volatile int buflen; 78 volatile int istate; 79 volatile int mstate; 80 u_char *volatile pbp; |
81 int nhdrlines = 0; 82 int hdrlinelen = 0; | 81 int hdrslen = 0; |
83 u_char peekbuf[8]; 84 char dfname[MAXQFNAME]; 85 char bufbuf[MAXLINE]; 86 extern bool isheader __P((char *)); 87 extern void tferror __P((FILE *volatile, ENVELOPE *)); 88 89 headeronly = hdrp != NULL; 90 --- 105 unchanged lines hidden (view full) --- 196 HasEightBits |= bitset(0x80, c); 197 } 198 if (tTd(30, 94)) 199 printf("istate=%d, c=%c (0x%x)\n", 200 istate, c, c); 201 switch (istate) 202 { 203 case IS_BOL: | 82 u_char peekbuf[8]; 83 char dfname[MAXQFNAME]; 84 char bufbuf[MAXLINE]; 85 extern bool isheader __P((char *)); 86 extern void tferror __P((FILE *volatile, ENVELOPE *)); 87 88 headeronly = hdrp != NULL; 89 --- 105 unchanged lines hidden (view full) --- 195 HasEightBits |= bitset(0x80, c); 196 } 197 if (tTd(30, 94)) 198 printf("istate=%d, c=%c (0x%x)\n", 199 istate, c, c); 200 switch (istate) 201 { 202 case IS_BOL: |
204 hdrlinelen = 0; | |
205 if (c == '.') 206 { 207 istate = IS_DOT; 208 continue; 209 } 210 break; 211 212 case IS_DOT: --- 91 unchanged lines hidden (view full) --- 304 { 305#if 0 /* causes complaints -- figure out something for 8.9 */ 306 usrerr("Illegal character 0x%x in header", c); 307#endif 308 } 309 else if (c != '\0') 310 { 311 *bp++ = c; | 203 if (c == '.') 204 { 205 istate = IS_DOT; 206 continue; 207 } 208 break; 209 210 case IS_DOT: --- 91 unchanged lines hidden (view full) --- 302 { 303#if 0 /* causes complaints -- figure out something for 8.9 */ 304 usrerr("Illegal character 0x%x in header", c); 305#endif 306 } 307 else if (c != '\0') 308 { 309 *bp++ = c; |
312 if (MaxHeaderLineLength > 0 && 313 ++hdrlinelen > MaxHeaderLineLength) | 310 if (MaxHeadersLength > 0 && 311 ++hdrslen > MaxHeadersLength) |
314 { 315 sm_syslog(LOG_NOTICE, e->e_id, | 312 { 313 sm_syslog(LOG_NOTICE, e->e_id, |
316 "header line too long (%d max) from %s during message collect", 317 MaxHeaderLineLength, | 314 "headers too large (%d max) from %s during message collect", 315 MaxHeadersLength, |
318 CurHostName != NULL ? CurHostName : "localhost"); 319 errno = 0; 320 e->e_flags |= EF_CLRQUEUE; 321 e->e_status = "5.6.0"; | 316 CurHostName != NULL ? CurHostName : "localhost"); 317 errno = 0; 318 e->e_flags |= EF_CLRQUEUE; 319 e->e_status = "5.6.0"; |
322 usrerr("552 Header line too long (%d max)", 323 MaxHeaderLineLength); | 320 usrerr("552 Headers too large (%d max)", 321 MaxHeadersLength); |
324 mstate = MS_DISCARD; 325 } 326 } 327 if (istate == IS_BOL) 328 break; 329 } 330 *bp = '\0'; 331 --- 19 unchanged lines hidden (view full) --- 351 352 case MS_HEADER: 353 if (!isheader(buf)) 354 { 355 mstate = MS_BODY; 356 goto nextstate; 357 } 358 | 322 mstate = MS_DISCARD; 323 } 324 } 325 if (istate == IS_BOL) 326 break; 327 } 328 *bp = '\0'; 329 --- 19 unchanged lines hidden (view full) --- 349 350 case MS_HEADER: 351 if (!isheader(buf)) 352 { 353 mstate = MS_BODY; 354 goto nextstate; 355 } 356 |
359 if (MaxHeaderLines > 0 && 360 ++nhdrlines > MaxHeaderLines) 361 { 362 sm_syslog(LOG_NOTICE, e->e_id, 363 "too many header lines (%d max) from %s during message collect", 364 MaxHeaderLines, 365 CurHostName != NULL ? CurHostName : "localhost"); 366 errno = 0; 367 e->e_flags |= EF_CLRQUEUE; 368 e->e_status = "5.6.0"; 369 usrerr("552 Too many header lines (%d max)", 370 MaxHeaderLines); 371 mstate = MS_DISCARD; 372 break; 373 } 374 | |
375 /* check for possible continuation line */ 376 do 377 { 378 clearerr(fp); 379 errno = 0; 380 c = getc(fp); 381 } while (errno == EINTR); 382 if (c != EOF) --- 408 unchanged lines hidden --- | 357 /* check for possible continuation line */ 358 do 359 { 360 clearerr(fp); 361 errno = 0; 362 c = getc(fp); 363 } while (errno == EINTR); 364 if (c != EOF) --- 408 unchanged lines hidden --- |