Deleted Added
full compact
parseaddr.c (111823) parseaddr.c (112810)
1/*
2 * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1988, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
12 */
13
14#include <sendmail.h>
15
1/*
2 * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1988, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
12 */
13
14#include <sendmail.h>
15
16SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.4 2003/01/18 00:41:48 gshapiro Exp $")
16SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.6 2003/03/27 02:39:53 ca Exp $")
17
18static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));
19static int callsubr __P((char**, int, ENVELOPE *));
20static char *map_lookup __P((STAB *, char *, char **, int *, ENVELOPE *));
21static ADDRESS *buildaddr __P((char **, ADDRESS *, int, ENVELOPE *));
22static bool hasctrlchar __P((register char *, bool, bool));
23
24/* replacement for illegal characters in addresses */

--- 578 unchanged lines hidden (view full) ---

603 ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
604 /* ` a b c d e f g h i j k l m n o */
605 ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
606 /* p q r s t u v w x y z { | } ~ del */
607 ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
608};
609
610
17
18static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));
19static int callsubr __P((char**, int, ENVELOPE *));
20static char *map_lookup __P((STAB *, char *, char **, int *, ENVELOPE *));
21static ADDRESS *buildaddr __P((char **, ADDRESS *, int, ENVELOPE *));
22static bool hasctrlchar __P((register char *, bool, bool));
23
24/* replacement for illegal characters in addresses */

--- 578 unchanged lines hidden (view full) ---

603 ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
604 /* ` a b c d e f g h i j k l m n o */
605 ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
606 /* p q r s t u v w x y z { | } ~ del */
607 ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
608};
609
610
611#define NOCHAR -1 /* signal nothing in lookahead token */
611#define NOCHAR (-1) /* signal nothing in lookahead token */
612
613char **
614prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
615 char *addr;
616 int delim;
617 char pvpbuf[];
618 int pvpbsize;
619 char **delimptr;

--- 69 unchanged lines hidden (view full) ---

689 for (;;)
690 {
691 /* store away any old lookahead character */
692 if (c != NOCHAR && !bslashmode)
693 {
694 /* see if there is room */
695 if (q >= &pvpbuf[pvpbsize - 5])
696 {
612
613char **
614prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
615 char *addr;
616 int delim;
617 char pvpbuf[];
618 int pvpbsize;
619 char **delimptr;

--- 69 unchanged lines hidden (view full) ---

689 for (;;)
690 {
691 /* store away any old lookahead character */
692 if (c != NOCHAR && !bslashmode)
693 {
694 /* see if there is room */
695 if (q >= &pvpbuf[pvpbsize - 5])
696 {
697 addrtoolong:
697 usrerr("553 5.1.1 Address too long");
698 if (strlen(addr) > MAXNAME)
699 addr[MAXNAME] = '\0';
700 returnnull:
701 if (delimptr != NULL)
702 *delimptr = p;
703 CurEnv->e_to = saveto;
704 return NULL;
705 }
706
707 /* squirrel it away */
698 usrerr("553 5.1.1 Address too long");
699 if (strlen(addr) > MAXNAME)
700 addr[MAXNAME] = '\0';
701 returnnull:
702 if (delimptr != NULL)
703 *delimptr = p;
704 CurEnv->e_to = saveto;
705 return NULL;
706 }
707
708 /* squirrel it away */
709#if !ALLOW_255
710 if ((char) c == (char) -1 && !tTd(82, 101))
711 c &= 0x7f;
712#endif /* !ALLOW_255 */
708 *q++ = c;
709 }
710
711 /* read a new input character */
713 *q++ = c;
714 }
715
716 /* read a new input character */
712 c = *p++;
717 c = (*p++) & 0x00ff;
713 if (c == '\0')
714 {
715 /* diagnose and patch up bad syntax */
716 if (state == QST)
717 {
718 usrerr("553 Unbalanced '\"'");
719 c = '"';
720 }

--- 38 unchanged lines hidden (view full) ---

759 /* kludge \! for naive users */
760 if (cmntcnt > 0)
761 {
762 c = NOCHAR;
763 continue;
764 }
765 else if (c != '!' || state == QST)
766 {
718 if (c == '\0')
719 {
720 /* diagnose and patch up bad syntax */
721 if (state == QST)
722 {
723 usrerr("553 Unbalanced '\"'");
724 c = '"';
725 }

--- 38 unchanged lines hidden (view full) ---

764 /* kludge \! for naive users */
765 if (cmntcnt > 0)
766 {
767 c = NOCHAR;
768 continue;
769 }
770 else if (c != '!' || state == QST)
771 {
772 /* see if there is room */
773 if (q >= &pvpbuf[pvpbsize - 5])
774 goto addrtoolong;
767 *q++ = '\\';
768 continue;
769 }
770 }
771
772 if (c == '\\')
773 {
774 bslashmode = true;

--- 69 unchanged lines hidden (view full) ---

844 c = NOCHAR;
845 if (bitset(B, newstate))
846 break;
847 }
848
849 /* new token */
850 if (tok != q)
851 {
775 *q++ = '\\';
776 continue;
777 }
778 }
779
780 if (c == '\\')
781 {
782 bslashmode = true;

--- 69 unchanged lines hidden (view full) ---

852 c = NOCHAR;
853 if (bitset(B, newstate))
854 break;
855 }
856
857 /* new token */
858 if (tok != q)
859 {
860 /* see if there is room */
861 if (q >= &pvpbuf[pvpbsize - 5])
862 goto addrtoolong;
852 *q++ = '\0';
853 if (tTd(22, 36))
854 {
855 sm_dprintf("tok=");
856 xputs(tok);
857 sm_dprintf("\n");
858 }
859 if (avp >= &av[MAXATOM])

--- 2325 unchanged lines hidden ---
863 *q++ = '\0';
864 if (tTd(22, 36))
865 {
866 sm_dprintf("tok=");
867 xputs(tok);
868 sm_dprintf("\n");
869 }
870 if (avp >= &av[MAXATOM])

--- 2325 unchanged lines hidden ---