X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/f1e894f37fb99398f7447220925a915bd031491a..10385c155b0e1266c02535b76ab73b32fa83d73f:/src/src/buildconfig.c diff --git a/src/src/buildconfig.c b/src/src/buildconfig.c index e7be3eab1..36561a968 100644 --- a/src/src/buildconfig.c +++ b/src/src/buildconfig.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/buildconfig.c,v 1.10 2005/06/27 14:29:43 ph10 Exp $ */ +/* $Cambridge: exim/src/src/buildconfig.c,v 1.16 2010/06/06 02:46:13 pdp Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2005 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -285,10 +285,11 @@ fprintf(new, "#define HAVE_ICONV %s\n", if (errno_quota[0] != 0) fprintf(new, "\n#define ERRNO_QUOTA %s\n", errno_quota); -if (strcmp(cc, "gcc") == 0 && strstr(ostype, "IRIX") != NULL) +if (strcmp(cc, "gcc") == 0 && + (strstr(ostype, "IRIX") != NULL || strstr(ostype, "AIX") != NULL)) { fprintf(new, "\n/* This switch includes the code to fix the inet_ntoa() */"); - fprintf(new, "\n/* bug when using gcc on an IRIX system. */"); + fprintf(new, "\n/* bug when using gcc on an IRIX or AIX system. */"); fprintf(new, "\n#define USE_INET_NTOA_FIX"); } @@ -355,6 +356,7 @@ while (fgets(buffer, sizeof(buffer), base) != NULL) uid_t uid = 0; gid_t gid = 0; int gid_set = 0; + int uid_not_set = 0; char *username = NULL; char *groupname = NULL; char *s; @@ -409,6 +411,7 @@ while (fgets(buffer, sizeof(buffer), base) != NULL) while (isspace(*user)) user++; username = user; gid_set = 1; + uid_not_set = 1; } else @@ -502,6 +505,18 @@ while (fgets(buffer, sizeof(buffer), base) != NULL) return 1; } + /* security sanity checks + if ref: is being used, we can never be sure, but we can take reasonable + steps to filter out the most obvious ones. */ + + if ((!uid_not_set && uid == 0) || + (strcmp(username, "root") == 0) || + (strcmp(username, "toor") == 0) ) + { + printf("\n*** Exim's internal user must not be root.\n\n"); + return 1; + } + /* Output user and group names or uid/gid. When names are set, uid/gid are set to zero but will be replaced at runtime. */ @@ -679,7 +694,8 @@ while (fgets(buffer, sizeof(buffer), base) != NULL) { char *wcs = getenv("WITH_CONTENT_SCAN"); char *wod = getenv("WITH_OLD_DEMIME"); - if (wcs != NULL || wod != NULL) + char *dcc = getenv("EXPERIMENTAL_DCC"); + if (wcs != NULL || wod != NULL || dcc != NULL) fprintf(new, "#define WITH_CONTENT_SCAN yes\n"); else fprintf(new, "/* WITH_CONTENT_SCAN not set */\n"); continue;