*
* %sccs.include.redist.c%
*
- * @(#)conf.h 8.56 (Berkeley) %G%
+ * @(#)conf.h 8.57 (Berkeley) %G%
*/
/*
# define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */
# define MAXUSERENVIRON 100 /* max envars saved, must be >= 3 */
# define MAXALIASDB 12 /* max # of alias databases */
-# define PSBUFSIZE (MAXLINE + MAXATOM) /* size of prescan buffer */
# ifndef QUEUESIZE
# define QUEUESIZE 1000 /* max # of jobs per queue run */
# define TOBUFSIZE (1024 - 256)
#endif
+/*
+** Size of prescan buffer.
+** Despite comments in the _sendmail_ book, this probably should
+** not be changed; there are some hard-to-define dependencies.
+*/
+
+# define PSBUFSIZE (MAXNAME + MAXATOM) /* size of prescan buffer */
/* fork routine -- set above using #ifdef _osname_ or in Makefile */
# ifndef FORK
# define FORK vfork /* function to call to fork mailer */
*/
#ifndef lint
-static char sccsid[] = "@(#)deliver.c 8.47 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c 8.48 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
if (ctladdr != NULL)
{
strcpy(bp, ", ctladdr=");
- l = strlen(ctladdr->q_paddr);
- if (l > 83)
- sprintf(bp, "%.40s...%s",
- ctladdr->q_paddr, ctladdr->q_paddr + l - 40);
- else
- strcat(bp, ctladdr->q_paddr);
+ strcpy(bp, shortenstring(ctladdr->q_paddr, 83));
bp += strlen(bp);
if (bitset(QGOODUID, ctladdr->q_flags))
{
*/
#ifndef lint
-static char sccsid[] = "@(#)envelope.c 8.19.1.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)envelope.c 8.20 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
}
syslog(LOG_NOTICE,
"setsender: %s: invalid or unparseable, received from %s",
- from, p);
+ shortenstring(from, 83), p);
}
# endif /* LOG */
if (from != NULL)
*/
#ifndef lint
-static char sccsid[] = "@(#)parseaddr.c 8.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c 8.20 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
if (delimptr == NULL)
delimptr = &delimptrbuf;
- if (strlen(addr) >= MAXNAME)
- {
- usrerr("Name too long, %d characters max", MAXNAME - 1);
- if (tTd(20, 1))
- printf("parseaddr-->NULL\n");
- return NULL;
- }
-
pvp = prescan(addr, delim, pvpbuf, delimptr);
if (pvp == NULL)
{
if (q >= &pvpbuf[PSBUFSIZE - 5])
{
usrerr("553 Address too long");
+ returnnull:
if (delimptr != NULL)
*delimptr = p;
CurEnv->e_to = saveto;
if (avp >= &av[MAXATOM])
{
syserr("553 prescan: too many tokens");
- if (delimptr != NULL)
- *delimptr = p;
- CurEnv->e_to = saveto;
- return (NULL);
+ goto returnnull;
+ }
+ if (q - tok > MAXNAME)
+ {
+ syserr("553 prescan: token too long");
+ goto returnnull;
}
*avp++ = tok;
}
*
* %sccs.include.redist.c%
*
- * @(#)sendmail.h 8.28 (Berkeley) %G%
+ * @(#)sendmail.h 8.29 (Berkeley) %G%
*/
/*
# ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailSccsId[] = "@(#)sendmail.h 8.28 %G%";
+static char SmailSccsId[] = "@(#)sendmail.h 8.29 %G%";
# endif
# else /* _DEFINE */
# define EXTERN extern
extern void openxscript __P((ENVELOPE *));
extern void closexscript __P((ENVELOPE *));
extern sigfunc_t setsignal __P((int, sigfunc_t));
+extern char *shortenstring __P((char *, int));
/* ellipsis is a different case though */
#ifdef __STDC__
*/
#ifndef lint
-static char sccsid[] = "@(#)util.c 8.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c 8.20 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
else
printf("%s\n", buf);
}
+\f/*
+** SHORTENSTRING -- return short version of a string
+**
+** If the string is already short, just return it. If it is too
+** long, return the head and tail of the string.
+**
+** Parameters:
+** s -- the string to shorten.
+** m -- the max length of the string.
+**
+** Returns:
+** Either s or a short version of s.
+*/
+
+#ifndef MAXSHORTSTR
+# define MAXSHORTSTR 83
+#endif
+
+char *
+shortenstring(s, m)
+ register char *s;
+ int m;
+{
+ int l;
+ static char buf[MAXSHORTSTR + 1];
+
+ l = strlen(s);
+ if (l < m)
+ return s;
+ if (m > MAXSHORTSTR)
+ m = MAXSHORTSTR;
+ else if (m < 10)
+ {
+ if (m < 5)
+ {
+ strncpy(buf, s, m);
+ buf[m] = '\0';
+ return buf;
+ }
+ strncpy(buf, s, m - 3);
+ strcpy(buf + m - 3, "...");
+ return buf;
+ }
+ m = (m - 3) / 2;
+ strncpy(buf, s, m);
+ strcpy(buf + m, "...");
+ strcpy(buf + m + 3, s + l - m);
+ return buf;
+}