SCCS-vsn: usr.sbin/sendmail/src/recipient.c 8.44.1.5
SCCS-vsn: usr.sbin/sendmail/src/main.c 8.55.1.4
SCCS-vsn: usr.sbin/sendmail/src/daemon.c 8.48.1.3
SCCS-vsn: usr.sbin/sendmail/src/util.c 8.39.1.3
SCCS-vsn: usr.sbin/sendmail/src/queue.c 8.41.1.2
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.89.1.1
-static char sccsid[] = "@(#)conf.c 8.134 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c 8.89.1.1 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
register char *p;
extern char *getusershell();
register char *p;
extern char *getusershell();
+ if (shell == NULL || shell[0] == '\0')
+ return TRUE;
+
setusershell();
while ((p = getusershell()) != NULL)
if (strcmp(p, shell) == 0 || strcmp(p, WILDCARD_SHELL) == 0)
setusershell();
while ((p = getusershell()) != NULL)
if (strcmp(p, shell) == 0 || strcmp(p, WILDCARD_SHELL) == 0)
register FILE *shellf;
char buf[MAXLINE];
register FILE *shellf;
char buf[MAXLINE];
+ if (shell == NULL || shell[0] == '\0')
+ return TRUE;
+
shellf = fopen(_PATH_SHELLS, "r");
if (shellf == NULL)
{
shellf = fopen(_PATH_SHELLS, "r");
if (shellf == NULL)
{
#ifndef lint
#ifdef DAEMON
#ifndef lint
#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 8.70 (Berkeley) %G% (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.48.1.3 (Berkeley) %G% (with daemon mode)";
-static char sccsid[] = "@(#)daemon.c 8.70 (Berkeley) %G% (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.48.1.3 (Berkeley) %G% (without daemon mode)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
int i;
EVENT *ev;
int nleft;
int i;
EVENT *ev;
int nleft;
static char hbuf[MAXNAME * 2 + 2];
extern char *hostnamebyanyaddr();
extern char RealUserName[]; /* main.c */
static char hbuf[MAXNAME * 2 + 2];
extern char *hostnamebyanyaddr();
extern char RealUserName[]; /* main.c */
}
/* create ident query */
}
/* create ident query */
- (void) sprintf(hbuf, "%d,%d\r\n",
+ (void) sprintf(ibuf, "%d,%d\r\n",
ntohs(RealHostAddr.sin.sin_port), ntohs(la.sin.sin_port));
/* create local address */
ntohs(RealHostAddr.sin.sin_port), ntohs(la.sin.sin_port));
/* create local address */
- printf("getauthinfo: sent %s", hbuf);
+ printf("getauthinfo: sent %s", ibuf);
- if (write(s, hbuf, strlen(hbuf)) < 0)
+ if (write(s, ibuf, strlen(ibuf)) < 0)
goto closeident;
/* get result */
goto closeident;
/* get result */
- p = &hbuf[0];
- nleft = sizeof(hbuf);
+ p = &ibuf[0];
+ nleft = sizeof(ibuf - 1);
while ((i = read(s, p, nleft)) > 0)
{
p += i;
while ((i = read(s, p, nleft)) > 0)
{
p += i;
}
(void) close(s);
clrevent(ev);
}
(void) close(s);
clrevent(ev);
- if (i < 0 || p == &hbuf[0])
+ if (i < 0 || p == &ibuf[0])
goto noident;
if (*--p == '\n' && *--p == '\r')
goto noident;
if (*--p == '\n' && *--p == '\r')
*++p = '\0';
if (tTd(9, 3))
*++p = '\0';
if (tTd(9, 3))
- printf("getauthinfo: got %s\n", hbuf);
+ printf("getauthinfo: got %s\n", ibuf);
if (p == NULL)
{
/* malformed response */
if (p == NULL)
{
/* malformed response */
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 8.84 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 8.55.1.4 (Berkeley) %G%";
#endif /* not lint */
#define _DEFINE
#endif /* not lint */
#define _DEFINE
#if NAMED_BIND
if (tTd(8, 8))
#if NAMED_BIND
if (tTd(8, 8))
{
res_init();
_res.options |= RES_DEBUG;
}
{
res_init();
_res.options |= RES_DEBUG;
}
ExitStat = EX_USAGE;
break;
}
ExitStat = EX_USAGE;
break;
}
- from = newstr(denlstring(optarg));
+ from = newstr(denlstring(optarg, TRUE));
if (strcmp(RealUserName, from) != 0)
warn_f_flag = j;
break;
if (strcmp(RealUserName, from) != 0)
warn_f_flag = j;
break;
** Initialize name server if it is going to be used.
*/
** Initialize name server if it is going to be used.
*/
+#if NAMED_BIND
+ if (!bitset(RES_INIT, _res.options))
+ res_init();
+#endif
+
+ /*
+ ** Initialize name server if it is going to be used.
+ */
+
#if NAMED_BIND
if (UseNameServer && !bitset(RES_INIT, _res.options))
res_init();
#if NAMED_BIND
if (UseNameServer && !bitset(RES_INIT, _res.options))
res_init();
/* full names can't have newlines */
if (FullName != NULL && strchr(FullName, '\n') != NULL)
/* full names can't have newlines */
if (FullName != NULL && strchr(FullName, '\n') != NULL)
- FullName = newstr(denlstring(FullName));
+ FullName = newstr(denlstring(FullName, TRUE));
/* do heuristic mode adjustment */
if (Verbose)
/* do heuristic mode adjustment */
if (Verbose)
#ifndef lint
#ifdef QUEUE
#ifndef lint
#ifdef QUEUE
-static char sccsid[] = "@(#)queue.c 8.63 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c 8.41.1.2 (Berkeley) %G% (with queueing)";
-static char sccsid[] = "@(#)queue.c 8.63 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c 8.41.1.2 (Berkeley) %G% (without queueing)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
/* message from envelope, if it exists */
if (e->e_message != NULL)
/* message from envelope, if it exists */
if (e->e_message != NULL)
- fprintf(tfp, "M%s\n", denlstring(e->e_message));
+ fprintf(tfp, "M%s\n", denlstring(e->e_message, FALSE));
/* send various flag bits through */
p = buf;
/* send various flag bits through */
p = buf;
/* $r and $s and $_ macro values */
if ((p = macvalue('r', e)) != NULL)
/* $r and $s and $_ macro values */
if ((p = macvalue('r', e)) != NULL)
- fprintf(tfp, "$r%s\n", denlstring(p));
+ fprintf(tfp, "$r%s\n", denlstring(p, FALSE));
if ((p = macvalue('s', e)) != NULL)
if ((p = macvalue('s', e)) != NULL)
- fprintf(tfp, "$s%s\n", denlstring(p));
+ fprintf(tfp, "$s%s\n", denlstring(p, FALSE));
if ((p = macvalue('_', e)) != NULL)
if ((p = macvalue('_', e)) != NULL)
- fprintf(tfp, "$_%s\n", denlstring(p));
+ fprintf(tfp, "$_%s\n", denlstring(p, FALSE));
/* output name of sender */
/* output name of sender */
- fprintf(tfp, "S%s\n", denlstring(e->e_from.q_paddr));
+ fprintf(tfp, "S%s\n", denlstring(e->e_from.q_paddr, FALSE));
/* output ESMTP-supplied "original" information */
if (e->e_envid != NULL)
/* output ESMTP-supplied "original" information */
if (e->e_envid != NULL)
if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
{
printctladdr(q, tfp);
if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
{
printctladdr(q, tfp);
- fprintf(tfp, "E%s\n", denlstring(q->q_paddr));
+ fprintf(tfp, "E%s\n", denlstring(q->q_paddr, FALSE));
{
printctladdr(q, tfp);
if (q->q_orcpt != NULL)
{
printctladdr(q, tfp);
if (q->q_orcpt != NULL)
- fprintf(tfp, "R%s\n", denlstring(q->q_paddr));
+ fprintf(tfp, "R%s\n", denlstring(q->q_paddr, FALSE));
if (announce)
{
e->e_to = q->q_paddr;
if (announce)
{
e->e_to = q->q_paddr;
else
uname = pw->pw_name;
else
uname = pw->pw_name;
- fprintf(tfp, "C%s:%s\n", uname, denlstring(a->q_paddr));
+ fprintf(tfp, "C%s:%s\n", uname, denlstring(a->q_paddr, FALSE));
}
\f/*
** RUNQUEUE -- run the jobs in the queue.
}
\f/*
** RUNQUEUE -- run the jobs in the queue.
-static char sccsid[] = "@(#)recipient.c 8.67 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c 8.44.1.5 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
bufp = buf;
else
bufp = xalloc(i);
bufp = buf;
else
bufp = xalloc(i);
- strcpy(bufp, denlstring(list));
+ strcpy(bufp, denlstring(list, FALSE));
for (p = bufp; *p != '\0'; )
{
for (p = bufp; *p != '\0'; )
{
-static char sccsid[] = "@(#)util.c 8.51 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c 8.39.1.3 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
{
#ifdef LOG
/* check for newlines and log if necessary */
{
#ifdef LOG
/* check for newlines and log if necessary */
+ (void) denlstring(f, TRUE);
**
** Parameters:
** s -- the input string
**
** Parameters:
** s -- the input string
+** logattacks -- if set, log attempted attacks.
**
** Returns:
** A pointer to a version of the string with newlines
**
** Returns:
** A pointer to a version of the string with newlines
+denlstring(s, logattacks)
{
register char *p;
int l;
{
register char *p;
int l;
- p = macvalue('_', CurEnv);
- syslog(LOG_ALERT, "POSSIBLE ATTACK from %s: newline in string \"%s\"",
- p == NULL ? "[UNKNOWN]" : p, bp);
+ if (logattacks)
+ {
+ syslog(LOG_NOTICE, "POSSIBLE ATTACK from %s: newline in string \"%s\"",
+ RealHostName == NULL ? "[UNKNOWN]" : RealHostName,
+ shortenstring(bp, 80));
+ }