With this patch, in clang 3.4.1 we get no compilation complaints if
Local/Makefile contains:
CC=clang
CFLAGS+=-Wno-dangling-else -Wno-logical-op-parentheses
* In hash.c, for the OpenSSL case, use assert() to guard the paths which
can't happen, instead of just assuming that the calling code never has
a mistake
* Fix some signed/unsigned issues
* Be explicit about some ignored return values
* Some parens around bit-twiddling
* Use our os_getcwd with its extra guards in one place where getcwd was
called
* FreeBSD: use system iconv, safely, always
(cherry picked from commit
845a3ced80964f562872aba841099adbc8933b40)
Signed-off-by: Phil Pennock <pdp@exim.org>
typedef struct flock flock_t;
typedef struct flock flock_t;
-/* default is non-const */
-#define ICONV_ARG2_TYPE const char **
+/* iconv arg2 type: libiconv in Ports uses "const char* * inbuf" and was
+ * traditionally the only approach available. The iconv functionality
+ * in libc is "char ** restrict src".
+ *
+ * <https://www.freebsd.org/doc/en/books/porters-handbook/using-iconv.html>
+ * says that libc has iconv since 2013, in 10-CURRENT. FreeBSD man-pages
+ * shows it included in 10.0-RELEASE. Writing this in 2017, 10.3 is the
+ * oldest supported release, so we should assume non-libiconv by default.
+ *
+ * Thus we no longer override iconv.
+ *
+ * However, if libiconv is installed, and anything adds /usr/local/include
+ * to include-path (likely) then we'll get that. So define a variable
+ * which makes the libiconv try to not interfere with OS iconv.
+ */
+#define LIBICONV_PLUG
#
# but of course there may need to be other things in CFLAGS and EXTRALIBS_EXIM
# as well.
#
# but of course there may need to be other things in CFLAGS and EXTRALIBS_EXIM
# as well.
+#
+# nb: FreeBSD as of 4.89 defines LIBICONV_PLUG to pick up the system iconv
+# more reliably. If you explicitly want the libiconv Port then as well
+# as adding -liconv you'll want to unset LIBICONV_PLUG. If you actually need
+# this, let us know, but for now the Exim Maintainers are assuming that this
+# is uncommon and so you'll need to edit OS/os.h-FreeBSD yourself to remove
+# the define.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
) )
&& ( !multi_domain
|| ( (
) )
&& ( !multi_domain
|| ( (
- !tp->expand_multi_domain || (deliver_set_expansions(next), 1),
+ (void)(!tp->expand_multi_domain || ((void)deliver_set_expansions(next), 1)),
exp_bool(addr,
US"transport", next->transport->name, D_transport,
US"multi_domain", next->transport->multi_domain,
exp_bool(addr,
US"transport", next->transport->name, D_transport,
US"multi_domain", next->transport->multi_domain,
#ifdef ALT_CONFIG_PREFIX
int sep = 0;
int len = Ustrlen(ALT_CONFIG_PREFIX);
#ifdef ALT_CONFIG_PREFIX
int sep = 0;
int len = Ustrlen(ALT_CONFIG_PREFIX);
- uschar *list = argrest;
+ const uschar *list = argrest;
uschar *filename;
while((filename = string_nextinlist(&list, &sep, big_buffer,
big_buffer_size)) != NULL)
uschar *filename;
while((filename = string_nextinlist(&list, &sep, big_buffer,
big_buffer_size)) != NULL)
sha1;
#endif /*STAND_ALONE*/
sha1;
#endif /*STAND_ALONE*/
/******************************************************************************/
#ifdef SHA_OPENSSL
/******************************************************************************/
#ifdef SHA_OPENSSL
{
case HASH_SHA1: SHA1_Update (&h->u.sha1, data, len); break;
case HASH_SHA256: SHA256_Update(&h->u.sha2, data, len); break;
{
case HASH_SHA1: SHA1_Update (&h->u.sha1, data, len); break;
case HASH_SHA256: SHA256_Update(&h->u.sha2, data, len); break;
+ /* should be blocked by init not handling these, but be explicit to
+ * guard against accidents later (and hush up clang -Wswitch) */
+ default: assert(0);
{
case HASH_SHA1: SHA1_Final (b->data, &h->u.sha1); break;
case HASH_SHA256: SHA256_Final(b->data, &h->u.sha2); break;
{
case HASH_SHA1: SHA1_Final (b->data, &h->u.sha1); break;
case HASH_SHA256: SHA256_Final(b->data, &h->u.sha2); break;
/* Entries in lists options are in this form. */
typedef struct {
/* Entries in lists options are in this form. */
typedef struct {
+ const char *name; /* should have been uschar but too late now */
int type;
void *value;
} optionlist;
int type;
void *value;
} optionlist;
if ((rc = pdkim_header_complete(ctx)) != PDKIM_OK)
return rc;
if ((rc = pdkim_header_complete(ctx)) != PDKIM_OK)
return rc;
- ctx->flags = ctx->flags & ~(PDKIM_SEEN_LF|PDKIM_SEEN_CR) | PDKIM_PAST_HDRS;
+ ctx->flags = (ctx->flags & ~(PDKIM_SEEN_LF|PDKIM_SEEN_CR)) | PDKIM_PAST_HDRS;
DEBUG(D_acl) debug_printf(
"PDKIM >> Body data for hash, canonicalized >>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
continue;
}
else
DEBUG(D_acl) debug_printf(
"PDKIM >> Body data for hash, canonicalized >>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
continue;
}
else
- ctx->flags = ctx->flags & ~PDKIM_SEEN_CR | PDKIM_SEEN_LF;
+ ctx->flags = (ctx->flags & ~PDKIM_SEEN_CR) | PDKIM_SEEN_LF;
}
else if (ctx->flags & PDKIM_SEEN_LF)
{
}
else if (ctx->flags & PDKIM_SEEN_LF)
{
macros that have substrings are always discovered first during
expansion. */
macros that have substrings are always discovered first during
expansion. */
-for (i = 0; i < nopt; i++) if (*(s = opts[i].name) && *s != '*')
+for (i = 0; i < nopt; i++) if (*(s = US opts[i].name) && *s != '*')
if (group)
macro_create(string_sprintf("_OPT_%T_%T_%T", section, group, s), US"y", FALSE, TRUE);
else
if (group)
macro_create(string_sprintf("_OPT_%T_%T_%T", section, group, s), US"y", FALSE, TRUE);
else
"configuration file %s", ss);
config_filename = string_copy(ss);
"configuration file %s", ss);
config_filename = string_copy(ss);
- config_directory = string_copyn(ss, (const uschar*) strrchr(ss, '/') - ss);
+ config_directory = string_copyn(ss, CUstrrchr(ss, '/') - ss);
config_lineno = 0;
continue;
}
config_lineno = 0;
continue;
}
{
/* relative configuration file name: working dir + / + basename(filename) */
{
/* relative configuration file name: working dir + / + basename(filename) */
int offset = 0;
int size = 0;
int offset = 0;
int size = 0;
- if (getcwd(buf, PATH_MAX) == NULL)
+ if (os_getcwd(buf, PATH_MAX) == NULL)
{
perror("exim: getcwd");
exit(EXIT_FAILURE);
{
perror("exim: getcwd");
exit(EXIT_FAILURE);
uschar * msg = NULL;
if (sx->verify)
{
uschar * msg = NULL;
if (sx->verify)
{
+ msg = US strerror(errno);
HDEBUG(D_verify) debug_printf("connect: %s\n", msg);
}
set_errno_nohost(sx->addrlist,
HDEBUG(D_verify) debug_printf("connect: %s\n", msg);
}
set_errno_nohost(sx->addrlist,