if the version released is past that point. */
#include <sys/param.h>
#if OpenBSD >= 201405
-#define NOT_HAVE_ARC4RANDOM_STIR
+# define NOT_HAVE_ARC4RANDOM_STIR
#endif
typedef struct flock flock_t;
# define EPROTO 71
#endif
+/* We need to force this; the automatic in buildconfig.c gets %ld */
+#ifdef OFF_T_FMT
+# undef OFF_T_FMT
+# undef LONGLONG_T
+#endif
+#define OFF_T_FMT "%lld"
+#define LONGLONG_T long long int
+
+#ifdef PID_T_FMT
+# undef PID_T_FMT
+#endif
+#define PID_T_FMT "%d"
+
+#ifdef INO_T_FMT
+# undef INO_T_FMT
+#endif
+#define INO_T_FMT "%llu"
+
+#ifdef TIME_T_FMT
+# undef TIME_T_FMT
+#endif
+#define TIME_T_FMT "%lld"
+
/* End */
}
else ss = s;
-while (isspace(*ss))ss++;
+while (isspace(*ss)) ss++;
/* If we can't find a named ACL, the default is to parse it as an inline one.
(Unless it begins with a slash; non-existent files give rise to an error.) */
{
off_t test_off_t = 0;
time_t test_time_t = 0;
+ino_t test_ino_t;
#if ! (__STDC_VERSION__ >= 199901L)
size_t test_size_t = 0;
ssize_t test_ssize_t = 0;
fprintf(new, "#ifndef OFF_T_FMT\n");
if (sizeof(test_off_t) > sizeof(test_long_t))
{
- fprintf(new, "#define OFF_T_FMT \"%%lld\"\n");
- fprintf(new, "#define LONGLONG_T long long int\n");
+ fprintf(new, "# define OFF_T_FMT \"%%lld\"\n");
+ fprintf(new, "# define LONGLONG_T long long int\n");
}
else
{
- fprintf(new, "#define OFF_T_FMT \"%%ld\"\n");
- fprintf(new, "#define LONGLONG_T long int\n");
+ fprintf(new, "# define OFF_T_FMT \"%%ld\"\n");
+ fprintf(new, "# define LONGLONG_T long int\n");
}
fprintf(new, "#endif\n\n");
fprintf(new, "#ifndef TIME_T_FMT\n");
if (sizeof(test_time_t) > sizeof(test_long_t))
{
- fprintf(new, "#define TIME_T_FMT \"%%lld\"\n");
- fprintf(new, "#undef LONGLONG_T\n");
- fprintf(new, "#define LONGLONG_T long long int\n");
+ fprintf(new, "# define TIME_T_FMT \"%%lld\"\n");
+ fprintf(new, "# undef LONGLONG_T\n");
+ fprintf(new, "# define LONGLONG_T long long int\n");
}
else
- {
- fprintf(new, "#define TIME_T_FMT \"%%ld\"\n");
- }
+ fprintf(new, "# define TIME_T_FMT \"%%ld\"\n");
+fprintf(new, "#endif\n\n");
+
+fprintf(new, "#ifndef INO_T_FMT\n");
+if (sizeof(test_ino_t) > sizeof(test_long_t))
+ fprintf(new, "# define INO_T_FMT \"%%llu\"\n");
+else
+ fprintf(new, "# define INO_T_FMT \"%%lu\"\n");
+fprintf(new, "#endif\n\n");
+
+fprintf(new, "#ifndef PID_T_FMT\n");
+fprintf(new, "# define PID_T_FMT \"%%lu\"\n");
fprintf(new, "#endif\n\n");
/* And for sizeof() results, size_t, which should with C99 be just %zu, deal
got = readn(fd, pipeheader, required);
if (got != required)
{
- msg = string_sprintf("got %d of %d bytes (pipeheader) "
- "from transport process %d for transport %s",
- got, PIPE_HEADER_SIZE, pid, addr->transport->driver_name);
- done = TRUE;
- break;
+ msg = string_sprintf("got " SSIZE_T_FMT " of %d bytes (pipeheader) "
+ "from transport process %d for transport %s",
+ got, PIPE_HEADER_SIZE, pid, addr->transport->driver_name);
+ done = TRUE;
+ break;
}
pipeheader[PIPE_HEADER_SIZE] = '\0';
got = readn(fd, big_buffer, required);
if (got != required)
{
- msg = string_sprintf("got only %d of %d bytes (pipedata) "
- "from transport process %d for transport %s",
- got, required, pid, addr->transport->driver_name);
- done = TRUE;
- break;
+ msg = string_sprintf("got only " SSIZE_T_FMT " of " SIZE_T_FMT
+ " bytes (pipedata) from transport process %d for transport %s",
+ got, required, pid, addr->transport->driver_name);
+ done = TRUE;
+ break;
}
/* Handle each possible type of item, assuming the complete item is
dkim_exim_verify_finish(void)
{
pdkim_signature * sig = NULL;
-int dkim_signers_size = 0, dkim_signers_ptr = 0, rc;
+int rc;
gstring * g = NULL;
const uschar * errstr;
" c=", sig->canon_headers == PDKIM_CANON_SIMPLE ? "simple" : "relaxed",
"/", sig->canon_body == PDKIM_CANON_SIMPLE ? "simple" : "relaxed",
" a=", dkim_sig_to_a_tag(sig),
- string_sprintf(" b=%d",
+ string_sprintf(" b=" SIZE_T_FMT,
(int)sig->sighash.len > -1 ? sig->sighash.len * 8 : 0));
if ((s= sig->identity)) logmsg = string_append(logmsg, 2, " i=", s);
if (sig->created > 0) logmsg = string_cat(logmsg,
case DKIM_BODYLENGTH:
return dkim_cur_sig->bodylength >= 0
- ? string_sprintf(OFF_T_FMT, (LONGLONG_T) dkim_cur_sig->bodylength)
+ ? string_sprintf("%ld", dkim_cur_sig->bodylength)
: dkim_exim_expand_defaults(what);
case DKIM_CANON_BODY:
case DKIM_CREATED:
return dkim_cur_sig->created > 0
- ? string_sprintf("%llu", dkim_cur_sig->created)
+ ? string_sprintf("%lu", dkim_cur_sig->created)
: dkim_exim_expand_defaults(what);
case DKIM_EXPIRES:
return dkim_cur_sig->expires > 0
- ? string_sprintf("%llu", dkim_cur_sig->expires)
+ ? string_sprintf("%lu", dkim_cur_sig->expires)
: dkim_exim_expand_defaults(what);
case DKIM_HEADERNAMES:
/* Send the file at in_fd down the output fd */
static BOOL
-dkt_send_file(int out_fd, int in_fd, off_t off, size_t size)
+dkt_send_file(int out_fd, int in_fd, off_t off
+#ifdef OS_SENDFILE
+ , size_t size
+#endif
+ )
{
DEBUG(D_transport) debug_printf("send file fd=%d size=%u\n", out_fd, (unsigned)(size - off));
if(dlen > 0 && !transport_write_block(tctx, dkim_signature->s, dlen, TRUE))
goto err;
-if (!dkt_send_file(tctx->u.fd, dkim_fd, 0, k_file_size))
+if (!dkt_send_file(tctx->u.fd, dkim_fd, 0
+#ifdef OS_SENDFILE
+ , k_file_size
+#endif
+ ))
{
save_errno = errno;
rc = FALSE;
/* If user name has not been set by -F, set it from the passwd entry
unless -f has been used to set the sender address by a trusted user. */
- if (originator_name == NULL)
+ if (!originator_name)
{
- if (sender_address == NULL ||
- (!trusted_caller && filter_test == FTEST_NONE))
+ if (!sender_address || (!trusted_caller && filter_test == FTEST_NONE))
{
uschar *name = US pw->pw_gecos;
uschar *amp = Ustrchr(name, '&');
replaced by a copy of the login name, and some even specify that
the first character should be upper cased, so that's what we do. */
- if (amp != NULL)
+ if (amp)
{
int loffset;
string_format(buffer, sizeof(buffer), "%.*s%n%s%s",
- amp - name, name, &loffset, originator_login, amp + 1);
+ (int)(amp - name), name, &loffset, originator_login, amp + 1);
buffer[loffset] = toupper(buffer[loffset]);
name = buffer;
}
/* If a pattern for matching the gecos field was supplied, apply
it and then expand the name string. */
- if (gecos_pattern != NULL && gecos_name != NULL)
+ if (gecos_pattern && gecos_name)
{
const pcre *re;
re = regex_must_compile(gecos_pattern, FALSE, TRUE); /* Use malloc */
{
uschar *new_name = expand_string(gecos_name);
expand_nmax = -1;
- if (new_name != NULL)
+ if (new_name)
{
DEBUG(D_receive) debug_printf("user name \"%s\" extracted from "
"gecos field \"%s\"\n", new_name, name);
/* If value2 is unset, just compute one number */
if (value2 < 0)
- s = string_sprintf("%d", total % value1);
+ s = string_sprintf("%lu", total % value1);
/* Otherwise do a div/mod hash */
else
{
total = total % (value1 * value2);
- s = string_sprintf("%d/%d", total/value2, total % value2);
+ s = string_sprintf("%lu/%lu", total/value2, total % value2);
}
*len = Ustrlen(s);
{
int len;
int newsize = 0;
- gstring * g;
+ gstring * g = NULL;
s = read_name(name, sizeof(name), s, US"_");
/* If this is the first thing to be expanded, release the pre-allocated
buffer. */
- if (yield && yield->ptr == 0)
+ if (!yield)
+ g = store_get(sizeof(gstring));
+ else if (yield->ptr == 0)
{
if (resetok) store_reset(yield);
yield = NULL;
- g = store_get(sizeof(gstring));
+ g = store_get(sizeof(gstring)); /* alloc _before_ calling find_variable() */
}
/* Header */
yield->ptr = len;
yield->s = value;
}
- else yield = string_catn(yield, value, len);
+ else
+ yield = string_catn(yield, value, len);
continue;
}
if (error != NULL)
{
expand_string_message = string_sprintf("error in expression "
- "evaluation: %s (after processing \"%.*s\")", error, sub-save_sub,
- save_sub);
+ "evaluation: %s (after processing \"%.*s\")", error,
+ (int)(sub-save_sub), save_sub);
goto EXPAND_FAILED;
}
sprintf(CS var_buffer, PR_EXIM_ARITH, n);
{
int len;
int newsize = 0;
- gstring * g;
+ gstring * g = NULL;
- if (yield && yield->ptr == 0)
+ if (!yield)
+ g = store_get(sizeof(gstring));
+ else if (yield->ptr == 0)
{
if (resetok) store_reset(yield);
yield = NULL;
- g = store_get(sizeof(gstring));
+ g = store_get(sizeof(gstring)); /* alloc _before_ calling find_variable() */
}
if (!(value = find_variable(name, FALSE, skipping, &newsize)))
{
{
*error_pointer = string_sprintf("Bad time value for \"once_repeat\" "
"in mail or vacation command: %s",
- commands->args[mailarg_index_once_repeat]);
+ commands->args[mailarg_index_once_repeat].u);
return FF_ERROR;
}
}
return DEFER;
}
- qserverlist = string_sprintf("%.*s", ss - s, s);
+ qserverlist = string_sprintf("%.*s", (int)(ss - s), s);
qsep = 0;
while ((qserver = string_nextinlist(&qserverlist, &qsep, qbuffer,
/* Debugging control */
-#define DEBUG(x) if ((debug_selector & (x)) != 0)
-#define HDEBUG(x) if (host_checking || (debug_selector & (x)) != 0)
+#define DEBUG(x) if (debug_selector & (x))
+#define HDEBUG(x) if (host_checking || (debug_selector & (x)))
#define PTR_CHK(ptr) \
do { \
*errorptr = s[-1] == 0
? US"'>' missing at end of address"
: string_sprintf("malformed address: %.32s may not follow %.*s",
- s-1, s - US mailbox - 1, mailbox);
+ s-1, (int)(s - US mailbox - 1), mailbox);
goto PARSE_FAILED;
}
else
{
*errorptr = string_sprintf("malformed address: %.32s may not follow %.*s",
- s, s - US mailbox, mailbox);
+ s, (int)(s - US mailbox), mailbox);
goto PARSE_FAILED;
}
}
start = Ustrlen(pf1) + start + new - p1;
end = start + Ustrlen(newparsed);
- new = string_sprintf("%s%.*s%s", pf1, p2 - p1, p1, pf2);
+ new = string_sprintf("%s%.*s%s", pf1, (int)(p2 - p1), p1, pf2);
}
/* Now accept the whole thing */
{
address_item *parent = store_get(sizeof(address_item));
uschar *at = Ustrrchr(addr->address, '@');
-uschar *address = string_sprintf("%.*s@%s", at - addr->address, addr->address,
- domain);
+uschar *address = string_sprintf("%.*s@%s",
+ (int)(at - addr->address), addr->address, domain);
DEBUG(D_route) debug_printf("domain changed to %s\n", domain);
{
uschar *mime_body,*reason_end;
static const uschar nlnl[]="\r\n\r\n";
- gstring * g;
for
(
tree_node *node;
endptr = Ustrchr(big_buffer + 6, ' ');
if (endptr == NULL) goto SPOOL_FORMAT_ERROR;
- name = string_sprintf("%c%.*s", big_buffer[4], endptr - big_buffer - 6,
- big_buffer + 6);
+ name = string_sprintf("%c%.*s", big_buffer[4],
+ (int)(endptr - big_buffer - 6), big_buffer + 6);
if (sscanf(CS endptr, " %d", &count) != 1) goto SPOOL_FORMAT_ERROR;
node = acl_var_create(name);
node->data.ptr = store_get(count + 1);
time_t t = mktime(&tm); /* make the tm self-consistent */
if (mod && Ustrcmp(mod, "int") == 0) /* seconds since epoch */
- s = string_sprintf("%u", t);
+ s = string_sprintf(TIME_T_FMT, t);
else
{
uschar *
tls_cert_version(void * cert, uschar * mod)
{
-return string_sprintf("%d", X509_get_version((X509 *)cert));
+return string_sprintf("%ld", X509_get_version((X509 *)cert));
}
uschar *
plen = (addr->prefix == NULL)? 0 : Ustrlen(addr->prefix);
slen = Ustrlen(addr->suffix);
-return string_sprintf("%.*s@%s", (at - addr->address - plen - slen),
+return string_sprintf("%.*s@%s", (int)(at - addr->address - plen - slen),
addr->address + plen, at + 1);
}
{
addr->basic_errno = ERRNO_INODECHANGED;
addr->message = string_sprintf("opened mailbox %s inode number changed "
- "from %d to %ld", filename, inode, statbuf.st_ino);
+ "from " INO_T_FMT " to " INO_T_FMT, filename, inode, statbuf.st_ino);
addr->special_action = SPECIAL_FREEZE;
goto RETURN;
}
uschar *basename;
(void)gettimeofday(&msg_tv, NULL);
- basename = string_sprintf(TIME_T_FMT ".H%luP%lu.%s",
+ basename = string_sprintf(TIME_T_FMT ".H%luP" PID_T_FMT ".%s",
msg_tv.tv_sec, msg_tv.tv_usec, getpid(), primary_hostname);
filename = dataname = string_sprintf("tmp/%s", basename);
static void
socks_option(socks_opts * sob, const uschar * opt)
{
-const uschar * s;
-
if (Ustrncmp(opt, "auth=", 5) == 0)
{
opt += 5;
/* deconst cast ok as we're passing a non-const to string_printing() */
*msgptr = US string_printing(
string_sprintf("%s: failing address in \"%.*s:\" header %s: %.*s",
- errmess, tt - h->text, h->text, verb, len, s));
+ errmess, (int)(tt - h->text), h->text, verb, len, s));
yield = FAIL;
break; /* Out of address loop */
while (ss > s && isspace(ss[-1])) ss--;
*log_msgptr = string_sprintf("syntax error in '%.*s' header when "
"scanning for sender: %s in \"%.*s\"",
- endname - h->text, h->text, *log_msgptr, ss - s, s);
+ (int)(endname - h->text), h->text, *log_msgptr, (int)(ss - s), s);
yield = FAIL;
done = TRUE;
break;
{
*verrno = vaddr->basic_errno;
if (smtp_return_error_details)
- {
*user_msgptr = string_sprintf("Rejected after DATA: "
"could not verify \"%.*s\" header address\n%s: %s",
- endname - h->text, h->text, vaddr->address, vaddr->message);
- }
+ (int)(endname - h->text), h->text, vaddr->address, vaddr->message);
}
/* Success or defer */
Attempting to start TLS
pppp:error:dddddddd:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:[...]:SSL alert number 40
Failed to start TLS
++++ 1
+>>> help
+??? 554
+<<< 554 Security failure
End of script
Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
Certificate file = TESTSUITE/aux-fixed/exim-ca/example.com/server1.example.com/server1.example.com.pem