Merge CSRG branch changes into main branch
This commit is contained in:
parent
2a3b769d01
commit
d986f3c961
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)conf.c 8.89 (Berkeley) 4/18/94";
|
||||
static char sccsid[] = "@(#)conf.c 8.89.1.3 (Berkeley) 3/7/95";
|
||||
#endif /* not lint */
|
||||
|
||||
# include "sendmail.h"
|
||||
@ -915,7 +915,7 @@ getla()
|
||||
|
||||
/* Non Apollo stuff removed by Don Lewis 11/15/93 */
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#)$Id: conf.c,v 1.4 1994/08/05 09:14:29 davidg Exp $";
|
||||
static char rcsid[] = "@(#)$Id: conf.c,v 1.5 1995/02/23 00:46:30 pst Exp $";
|
||||
#endif /* !lint */
|
||||
|
||||
#ifdef apollo
|
||||
@ -1404,8 +1404,8 @@ extern int optind, opterr;
|
||||
int opterr = 1; /* if error message should be printed */
|
||||
int optind = 1; /* index into parent argv vector */
|
||||
#endif
|
||||
int optopt; /* character checked for validity */
|
||||
char *optarg; /* argument associated with option */
|
||||
int optopt = 0; /* character checked for validity */
|
||||
char *optarg = NULL; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define EMSG ""
|
||||
@ -1545,6 +1545,9 @@ usershellok(shell)
|
||||
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)
|
||||
@ -1555,6 +1558,9 @@ usershellok(shell)
|
||||
register FILE *shellf;
|
||||
char buf[MAXLINE];
|
||||
|
||||
if (shell == NULL || shell[0] == '\0')
|
||||
return TRUE;
|
||||
|
||||
shellf = fopen(_PATH_SHELLS, "r");
|
||||
if (shellf == NULL)
|
||||
{
|
||||
@ -2193,6 +2199,8 @@ strtol(nptr, endptr, base)
|
||||
|
||||
#ifdef SOLARIS
|
||||
|
||||
extern int h_errno;
|
||||
|
||||
struct hostent *
|
||||
solaris_gethostbyname(name)
|
||||
const char *name;
|
||||
|
@ -37,9 +37,9 @@
|
||||
|
||||
#ifndef lint
|
||||
#ifdef DAEMON
|
||||
static char sccsid[] = "@(#)daemon.c 8.48.1.2 (Berkeley) 2/9/95 (with daemon mode)";
|
||||
static char sccsid[] = "@(#)daemon.c 8.48.1.4 (Berkeley) 2/28/95 (with daemon mode)";
|
||||
#else
|
||||
static char sccsid[] = "@(#)daemon.c 8.48.1.2 (Berkeley) 2/9/95 (without daemon mode)";
|
||||
static char sccsid[] = "@(#)daemon.c 8.48.1.4 (Berkeley) 2/28/95 (without daemon mode)";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -995,6 +995,8 @@ getauthinfo(fd)
|
||||
int s;
|
||||
int i;
|
||||
EVENT *ev;
|
||||
int nleft;
|
||||
char ibuf[MAXNAME + 1];
|
||||
#endif
|
||||
static char hbuf[MAXNAME * 2 + 2];
|
||||
extern char *hostnamebyanyaddr();
|
||||
@ -1030,7 +1032,7 @@ getauthinfo(fd)
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
@ -1068,27 +1070,34 @@ getauthinfo(fd)
|
||||
}
|
||||
|
||||
if (tTd(9, 10))
|
||||
printf("getauthinfo: sent %s", hbuf);
|
||||
printf("getauthinfo: sent %s", ibuf);
|
||||
|
||||
/* send query */
|
||||
if (write(s, hbuf, strlen(hbuf)) < 0)
|
||||
if (write(s, ibuf, strlen(ibuf)) < 0)
|
||||
goto closeident;
|
||||
|
||||
/* get result */
|
||||
i = read(s, hbuf, sizeof hbuf);
|
||||
p = &ibuf[0];
|
||||
nleft = sizeof(ibuf - 1);
|
||||
while ((i = read(s, p, nleft)) > 0)
|
||||
{
|
||||
p += i;
|
||||
nleft -= i;
|
||||
}
|
||||
(void) close(s);
|
||||
clrevent(ev);
|
||||
if (i <= 0)
|
||||
if (i < 0 || p == &ibuf[0])
|
||||
goto noident;
|
||||
if (hbuf[--i] == '\n' && hbuf[--i] == '\r')
|
||||
i--;
|
||||
hbuf[++i] = '\0';
|
||||
|
||||
if (*--p == '\n' && *--p == '\r')
|
||||
p--;
|
||||
*++p = '\0';
|
||||
|
||||
if (tTd(9, 3))
|
||||
printf("getauthinfo: got %s\n", hbuf);
|
||||
printf("getauthinfo: got %s\n", ibuf);
|
||||
|
||||
/* parse result */
|
||||
p = strchr(hbuf, ':');
|
||||
p = strchr(ibuf, ':');
|
||||
if (p == NULL)
|
||||
{
|
||||
/* malformed response */
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)deliver.c 8.84.1.1 (Berkeley) 2/10/95";
|
||||
static char sccsid[] = "@(#)deliver.c 8.84.1.3 (Berkeley) 3/5/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "sendmail.h"
|
||||
@ -1181,6 +1181,12 @@ deliver(e, firstto)
|
||||
extern char **environ;
|
||||
extern int DtableSize;
|
||||
|
||||
if (e->e_lockfp != NULL)
|
||||
{
|
||||
fclose(e->e_lockfp);
|
||||
e->e_lockfp = NULL;
|
||||
}
|
||||
|
||||
/* child -- set up input & exec mailer */
|
||||
(void) setsignal(SIGINT, SIG_IGN);
|
||||
(void) setsignal(SIGHUP, SIG_IGN);
|
||||
@ -2176,7 +2182,15 @@ mailfile(filename, ctladdr, e)
|
||||
{
|
||||
/* child -- actually write to file */
|
||||
struct stat stb;
|
||||
struct stat fsb;
|
||||
MCI mcibuf;
|
||||
int oflags = O_WRONLY|O_APPEND;
|
||||
|
||||
if (e->e_lockfp != NULL)
|
||||
{
|
||||
fclose(e->e_lockfp);
|
||||
e->e_lockfp = NULL;
|
||||
}
|
||||
|
||||
(void) setsignal(SIGINT, SIG_DFL);
|
||||
(void) setsignal(SIGHUP, SIG_DFL);
|
||||
@ -2184,15 +2198,18 @@ mailfile(filename, ctladdr, e)
|
||||
(void) umask(OldUmask);
|
||||
|
||||
if (stat(filename, &stb) < 0)
|
||||
{
|
||||
stb.st_mode = FileMode;
|
||||
oflags |= O_CREAT|O_EXCL;
|
||||
}
|
||||
else if (bitset(0111, stb.st_mode))
|
||||
exit(EX_CANTCREAT);
|
||||
mode = stb.st_mode;
|
||||
|
||||
/* limit the errors to those actually caused in the child */
|
||||
errno = 0;
|
||||
ExitStat = EX_OK;
|
||||
|
||||
if (bitset(0111, stb.st_mode))
|
||||
exit(EX_CANTCREAT);
|
||||
if (ctladdr != NULL)
|
||||
{
|
||||
/* ignore setuid and setgid bits */
|
||||
@ -2232,12 +2249,22 @@ mailfile(filename, ctladdr, e)
|
||||
}
|
||||
FileName = filename;
|
||||
LineNumber = 0;
|
||||
f = dfopen(filename, O_WRONLY|O_CREAT|O_APPEND, FileMode);
|
||||
f = dfopen(filename, oflags, FileMode);
|
||||
if (f == NULL)
|
||||
{
|
||||
message("554 cannot open: %s", errstring(errno));
|
||||
exit(EX_CANTCREAT);
|
||||
}
|
||||
if (fstat(fileno(f), &fsb) < 0 ||
|
||||
!bitset(O_CREAT, oflags) &&
|
||||
(stb.st_nlink != fsb.st_nlink ||
|
||||
stb.st_dev != fsb.st_dev ||
|
||||
stb.st_ino != fsb.st_ino ||
|
||||
stb.st_uid != fsb.st_uid))
|
||||
{
|
||||
message("554 cannot write: file changed after open");
|
||||
exit(EX_CANTCREAT);
|
||||
}
|
||||
|
||||
bzero(&mcibuf, sizeof mcibuf);
|
||||
mcibuf.mci_mailer = FileMailer;
|
||||
|
@ -36,9 +36,9 @@
|
||||
|
||||
#ifndef lint
|
||||
#if NAMED_BIND
|
||||
static char sccsid[] = "@(#)domain.c 8.19 (Berkeley) 3/11/94 (with name server)";
|
||||
static char sccsid[] = "@(#)domain.c 8.19.1.1 (Berkeley) 3/6/95 (with name server)";
|
||||
#else
|
||||
static char sccsid[] = "@(#)domain.c 8.19 (Berkeley) 3/11/94 (without name server)";
|
||||
static char sccsid[] = "@(#)domain.c 8.19.1.1 (Berkeley) 3/6/95 (without name server)";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -709,6 +709,7 @@ gethostalias(host)
|
||||
fname = getenv("HOSTALIASES");
|
||||
if (fname == NULL || (fp = fopen(fname, "r")) == NULL)
|
||||
return NULL;
|
||||
setbuf(fp, NULL);
|
||||
while (fgets(buf, sizeof buf, fp) != NULL)
|
||||
{
|
||||
for (p = buf; p != '\0' && !(isascii(*p) && isspace(*p)); p++)
|
||||
|
Loading…
Reference in New Issue
Block a user