if (!auth_defer_msg)
auth_defer_msg = string_copy(US status_string.value);
- HDEBUG(D_auth) debug_printf("heimdal %s: %.*s\n",
- string_from_gstring(g), (int)status_string.length,
- CS status_string.value);
+ HDEBUG(D_auth) debug_printf("heimdal %Y: %.*s\n",
+ g, (int)status_string.length, CS status_string.value);
gss_release_buffer(&min_stat, &status_string);
} while (msgcontext != 0);
whofrom = string_fmt_append(whofrom, " I=[%s]:%d",
interface_address, interface_port);
-(void) string_from_gstring(whofrom); /* Terminate the newly-built string */
-
/* Check maximum number of connections. We do not check for reserved
connections or unacceptable hosts here. That is done in the subprocess because
it might take some time. */
smtp_printf("421 Too many concurrent SMTP connections; "
"please try again later.\r\n", FALSE);
log_write(L_connection_reject,
- LOG_MAIN, "Connection from %s refused: too many connections",
- whofrom->s);
+ LOG_MAIN, "Connection from %Y refused: too many connections",
+ whofrom);
goto ERROR_RETURN;
}
(double)load_average/1000.0);
smtp_printf("421 Too much load; please try again later.\r\n", FALSE);
log_write(L_connection_reject,
- LOG_MAIN, "Connection from %s refused: load average = %.2f",
- whofrom->s, (double)load_average/1000.0);
+ LOG_MAIN, "Connection from %Y refused: load average = %.2f",
+ whofrom, (double)load_average/1000.0);
goto ERROR_RETURN;
}
}
{
if (!f.expand_string_forcedfail)
log_write(0, LOG_MAIN|LOG_PANIC, "expansion of smtp_accept_max_per_host "
- "failed for %s: %s", whofrom->s, expand_string_message);
+ "failed for %Y: %s", whofrom, expand_string_message);
}
/* For speed, interpret a decimal number inline here */
else
max_for_this_host = max_for_this_host * 10 + *s++ - '0';
if (*s)
log_write(0, LOG_MAIN|LOG_PANIC, "expansion of smtp_accept_max_per_host "
- "for %s contains non-digit: %s", whofrom->s, expanded);
+ "for %Y contains non-digit: %s", whofrom, expanded);
}
}
smtp_printf("421 Too many concurrent SMTP connections "
"from this IP address; please try again later.\r\n", FALSE);
log_write(L_connection_reject,
- LOG_MAIN, "Connection from %s refused: too many connections "
- "from that IP address", whofrom->s);
+ LOG_MAIN, "Connection from %Y refused: too many connections "
+ "from that IP address", whofrom);
search_tidyup();
goto ERROR_RETURN;
}
if (list && verify_check_host(&list) == OK)
save_log_selector &= ~L_smtp_connection;
else
- log_write(L_smtp_connection, LOG_MAIN, "SMTP connection from %s "
- "(TCP/IP connection count = %d)", whofrom->s, smtp_accept_count + 1);
+ log_write(L_smtp_connection, LOG_MAIN, "SMTP connection from %Y "
+ "(TCP/IP connection count = %d)", whofrom, smtp_accept_count + 1);
}
/* Now we can fork the accepting process; do a lookup tidy, just in case any
}
/* send a blank line between options and message */
dcc_headers = string_catn(dcc_headers, US"\n", 1);
+
/* Now we send the input buffer */
-(void) string_from_gstring(dcc_headers);
DEBUG(D_acl)
- debug_printf("DCC: ***********************************\nDCC: Sending options:\n%s"
- "DCC: ***********************************\n", dcc_headers->s);
+ debug_printf("DCC: ***********************************\nDCC: Sending options:\n%Y"
+ "DCC: ***********************************\n", dcc_headers);
if (flushbuffer(sockfd, dcc_headers) != 0)
{
(void)fclose(data_file);
/* a blank line separates header from body */
sendbuf = string_catn(sendbuf, US"\r\n", 2);
-(void) string_from_gstring(sendbuf);
gstring_release_unused(sendbuf);
DEBUG(D_acl)
- debug_printf("%sDCC: ***********************************\n", sendbuf->s);
+ debug_printf("%YDCC: ***********************************\n", sendbuf);
if (flushbuffer(sockfd, sendbuf) != 0)
{
(void)fclose(data_file);
/* Now let's sum up what we've got. */
DEBUG(D_acl)
debug_printf("\nDCC: --------------------------\nDCC: Overall result = %d\n"
- "DCC: X-DCC header: %sReturn message: %s\nDCC: dcc_result: %s\n",
- retval, dcc_header_str->s, dcc_return_text, dcc_result);
+ "DCC: X-DCC header: %YReturn message: %s\nDCC: dcc_result: %s\n",
+ retval, dcc_header_str, dcc_return_text, dcc_result);
/* We only add the X-DCC header if it starts with X-DCC */
if(!(Ustrncmp(dcc_header_str->s, "X-DCC", 5)))
{
- dcc_header = dcc_header_str->s;
+ dcc_header = string_from_gstring(dcc_header_str);
if(dcc_direct_add_header)
{
- header_add(' ' , "%s", dcc_header_str->s);
+ header_add(' ' , "%s", dcc_header);
/* since the MIME ACL already writes the .eml file to disk without DCC Header we've to erase it */
unspool_mbox();
}
}
else
DEBUG(D_acl)
- debug_printf("DCC: Wrong format of the X-DCC header: %.*s\n", dcc_header_str->ptr, dcc_header_str->s);
+ debug_printf("DCC: Wrong format of the X-DCC header: %Y\n", dcc_header_str);
/* check if we should add additional headers passed in acl_m_dcc_add_header */
if (dcc_direct_add_header)
dcc_xtra_hdrs = string_catn(dcc_xtra_hdrs, US"\n", 1);
header_add(' ', "%s", string_from_gstring(dcc_xtra_hdrs));
DEBUG(D_acl)
- debug_printf("DCC: adding additional headers in $acl_m_dcc_add_header: %.*s", dcc_xtra_hdrs->ptr, dcc_xtra_hdrs->s);
+ debug_printf("DCC: adding additional headers in $acl_m_dcc_add_header: %Y", dcc_xtra_hdrs);
}
}
: string_fmt_append(g, " proto %d", val);
}
#endif
- debug_printf_indent(" socket: %s\n", string_from_gstring(g));
+ debug_printf_indent(" socket: %Y\n", g);
}
else
debug_printf_indent(" fd st_mode 0%o\n", s.st_mode);
{
while (addr->parent)
{
- address_item *aa;
+ address_item * aa;
addr = addr->parent;
if (--addr->child_count > 0) return; /* Incomplete parent */
/* string_cat() always leaves room for the terminator. Release the
store we used to build the line after writing it. */
-log_write(0, flags, "%s", string_from_gstring(g));
+log_write(0, flags, "%Y", g);
#ifndef DISABLE_EVENT
if (!msg) msg_event_raise(US"msg:delivery", addr);
if (addr->message)
g = string_append(g, 2, US": ", addr->message);
- {
- const uschar * s = string_from_gstring(g);
+/* Log the deferment in the message log, but don't clutter it
+up with retry-time defers after the first delivery attempt. */
- /* Log the deferment in the message log, but don't clutter it
- up with retry-time defers after the first delivery attempt. */
+if (f.deliver_firsttime || addr->basic_errno > ERRNO_RETRY_BASE)
+ deliver_msglog("%s %.*s\n", now, g->ptr, g->s);
- if (f.deliver_firsttime || addr->basic_errno > ERRNO_RETRY_BASE)
- deliver_msglog("%s %s\n", now, s);
+/* Write the main log and reset the store.
+For errors of the type "retry time not reached" (also remotes skipped
+on queue run), logging is controlled by L_retry_defer. Note that this kind
+of error number is negative, and all the retry ones are less than any
+others. */
- /* Write the main log and reset the store.
- For errors of the type "retry time not reached" (also remotes skipped
- on queue run), logging is controlled by L_retry_defer. Note that this kind
- of error number is negative, and all the retry ones are less than any
- others. */
-
- log_write(addr->basic_errno <= ERRNO_RETRY_BASE ? L_retry_defer : 0, logflags,
- "== %s", s);
- }
+log_write(addr->basic_errno <= ERRNO_RETRY_BASE ? L_retry_defer : 0, logflags,
+ "== %Y", g);
store_reset(reset_point);
return;
/* Do the logging. For the message log, "routing failed" for those cases,
just to make it clearer. */
- {
- const uschar * s = string_from_gstring(g);
-
- if (driver_kind)
- deliver_msglog("%s %s failed for %s\n", now, driver_kind, s);
- else
- deliver_msglog("%s %s\n", now, s);
+if (driver_kind)
+ deliver_msglog("%s %s failed for %.*s\n", now, driver_kind, g->ptr, g->s);
+else
+ deliver_msglog("%s %.*s\n", now, g->ptr, g->s);
- log_write(0, LOG_MAIN, "** %s", s);
- }
+log_write(0, LOG_MAIN, "** %Y", g);
store_reset(reset_point);
return;
if (rc != 0)
{
- uschar *s = US"";
+ uschar * s = US"";
if (now - received_time.tv_sec < retry_maximum_timeout && !addr_defer)
{
addr_defer = (address_item *)(+1);
break;
}
-log_write(0, LOG_MAIN, "%s", string_from_gstring(logmsg));
+log_write(0, LOG_MAIN, "%Y", logmsg);
return;
}
if (host_checking || f.running_in_test_harness)
{
DEBUG(D_receive)
- debug_printf("DMARC history data for debugging:\n%s", string_from_gstring(g));
+ debug_printf("DMARC history data for debugging:\n%Y", g);
}
else
{
hash_source = string_catn(NULL, key_num, 1);
hash_source = string_catn(hash_source, daystamp, 3);
hash_source = string_cat(hash_source, address);
-(void) string_from_gstring(hash_source);
DEBUG(D_expand)
- debug_printf_indent("prvs: hash source is '%s'\n", hash_source->s);
+ debug_printf_indent("prvs: hash source is '%Y'\n", hash_source);
memset(innerkey, 0x36, 64);
memset(outerkey, 0x5c, 64);
goto EXPAND_FAILED;
}
yield = string_cat(yield, s);
- DEBUG(D_expand) debug_printf_indent("yield: '%s'\n", string_from_gstring(yield));
+ DEBUG(D_expand) debug_printf_indent("yield: '%Y'\n", yield);
break;
}
if (!string_vformat(&gs, SVFMT_REBUFFER, format, ap))
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "string too long in header_add: "
- "%.100s ...", string_from_gstring(&gs));
+ "%.100Y ...", &gs);
if (gs.s != buf) store_release_above(buf);
gstring_release_unused(&gs);
}
va_end(ap);
- g = string_catn(g, US"\n", 1);
- debug_printf("%s", string_from_gstring(g));
+ debug_printf("%Y\n", g);
gs.size = LOG_BUFFER_SIZE-2; /* Having used the buffer for debug output, */
gs.ptr = 0; /* reset it for the real use. */
result = string_cat(result, US PQcmdTuples(pg_result));
*do_cache = 0;
DEBUG(D_lookup) debug_printf_indent("PGSQL: command does not return any data "
- "but was successful. Rows affected: %s\n", string_from_gstring(result));
+ "but was successful. Rows affected: %Y\n", result);
break;
case PGRES_TUPLES_OK:
val = string_catn(val, fname++, 1);
val = string_catn(val, US"?=", 2);
-*len = val->ptr;
+*len = gstring_length(val);
return string_from_gstring(val);
}
sender_address[0] == 0 ? US"<>" : sender_address);
g = add_host_info_for_log(g);
- log_write(0, LOG_MAIN|LOG_REJECT, "%s %srejected by local_scan(): %.256s",
- string_from_gstring(g), istemp, string_printing(errmsg));
+ log_write(0, LOG_MAIN|LOG_REJECT, "%Y %srejected by local_scan(): %.256s",
+ g, istemp, string_printing(errmsg));
if (smtp_input)
if (!smtp_batched_input)
gstring_reset(g);
g = string_cat(g, US"SMTP connection lost after final dot");
g = add_host_info_for_log(g);
- log_write(0, LOG_MAIN, "%s", string_from_gstring(g));
+ log_write(0, LOG_MAIN, "%Y", g);
/* Delete the files for this aborted message. */
log_write(0, LOG_MAIN |
(LOGGING(received_recipients) ? LOG_RECIPIENTS : 0) |
(LOGGING(received_sender) ? LOG_SENDER : 0),
- "%s", g->s);
+ "%Y", g);
/* Log any control actions taken by an ACL or local_scan(). */
/* Now output the banner */
/*XXX the ehlo-resp code does its own tls/nontls bit. Maybe subroutine that? */
-smtp_printf("%s",
+smtp_printf("%Y",
#ifndef DISABLE_PIPE_CONNECT
fl.pipe_connect_acceptable && pipeline_connect_sends(),
#else
FALSE,
#endif
- string_from_gstring(ss));
+ ss);
/* Attempt to see if we sent the banner before the last ACK of the 3-way
handshake arrived. If so we must have managed a TFO. */
{
yield = 1;
log_write(0, LOG_MAIN|LOG_REJECT, "SMTP call from %s dropped: too many "
- "syntax or protocol errors (last command was \"%s\", %s)",
+ "syntax or protocol errors (last command was \"%s\", %Y)",
host_and_ident(FALSE), string_printing(smtp_cmd_buffer),
- string_from_gstring(s_connhad_log(NULL))
+ s_connhad_log(NULL)
);
}
va_start(ap, defaultrespond);
g = string_vformat(NULL, SVFMT_EXTEND|SVFMT_REBUFFER, CS defaultrespond, ap);
va_end(ap);
- smtp_printf("%s %s\r\n", FALSE, code, string_from_gstring(g));
+ smtp_printf("%s %Y\r\n", FALSE, code, g);
}
mac_smtp_fflush();
}
if (++synprot_error_count > smtp_max_synprot_errors)
{
log_write(0, LOG_MAIN|LOG_REJECT, "SMTP call from %s dropped: too many "
- "syntax or protocol errors (last command was \"%s\", %s)",
+ "syntax or protocol errors (last command was \"%s\", %Y)",
host_and_ident(FALSE), string_printing(smtp_cmd_buffer),
- string_from_gstring(s_connhad_log(NULL))
+ s_connhad_log(NULL)
);
done = 1;
}
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "overlong write_command in outgoing "
"SMTP");
va_end(ap);
- string_from_gstring(&gs);
if (gs.ptr > outblock->buffersize)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "overlong write_command in outgoing "
will not be grown, and is usable in the original place after return.
The return value can be NULL to signify overflow.
+Field width: decimal digits, or *
+Precision: dot, followed by decimal digits or *
+Length modifiers: h L l ll z
+Conversion specifiers: n d o u x X p f e E g G % c s S T Y D M
+
Returns the possibly-new (if copy for growth or taint-handling was needed)
string, not nul-terminated.
*/
slen = string_datestamp_length;
goto INSERT_STRING;
+ case 'Y': /* gstring pointer */
+ {
+ gstring * zg = va_arg(ap, gstring *);
+ s = CS zg->s;
+ slen = zg->ptr;
+ goto INSERT_GSTRING;
+ }
+
case 's':
case 'S': /* Forces *lower* case */
case 'T': /* Forces *upper* case */
if (!s) s = null;
slen = Ustrlen(s);
+ INSERT_GSTRING: /* Coome to from %Y above */
+
if (!(flags & SVFMT_TAINT_NOCHK) && is_incompatible(g->s, s))
if (flags & SVFMT_REBUFFER)
{
DEBUG(D_tls) debug_printf("\n");
if (server_seen_alpn > 1)
{
- log_write(0, LOG_MAIN, "TLS ALPN (%s) rejected", string_from_gstring(g));
+ log_write(0, LOG_MAIN, "TLS ALPN (%Y) rejected", g);
DEBUG(D_tls) debug_printf("TLS: too many ALPNs presented in handshake\n");
return GNUTLS_E_NO_APPLICATION_PROTOCOL;
}
if (pos + 1 + siz > inlen) siz = inlen - pos - 1;
g = string_append_listele_n(g, ':', in + pos + 1, siz);
}
-log_write(0, LOG_MAIN, "TLS ALPN (%s) rejected", string_from_gstring(g));
+log_write(0, LOG_MAIN, "TLS ALPN (%Y) rejected", g);
gstring_release_unused(g);
return SSL_TLSEXT_ERR_ALERT_FATAL;
}
return FALSE;
}
va_end(ap);
-DEBUG(D_transport|D_v) debug_printf(" LMTP>> %s", string_from_gstring(&gs));
+DEBUG(D_transport|D_v) debug_printf(" LMTP>> %Y", &gs);
rc = write(fd, gs.s, gs.ptr);
gs.ptr -= 2; string_from_gstring(&gs); /* remove \r\n for debug and error message */
if (rc > 0) return TRUE;
else
message = string_fmt_append(message, " %s", exim_errstr(basic_errno));
-log_write(0, LOG_MAIN, "%s", string_from_gstring(message));
-deliver_msglog("%s %s\n", tod_stamp(tod_log), message->s);
+log_write(0, LOG_MAIN, "%Y", message);
+deliver_msglog("%s %.*s\n", tod_stamp(tod_log), message->ptr, message->s);
}
static void