git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6707bfa
)
Logging: convert an internal element from static to allocated buffer
author
Jeremy Harris
<jgh146exb@wizmail.org>
Mon, 7 Aug 2023 14:51:38 +0000
(15:51 +0100)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Mon, 7 Aug 2023 16:00:35 +0000
(17:00 +0100)
src/src/host.c
patch
|
blob
|
history
diff --git
a/src/src/host.c
b/src/src/host.c
index 9c66e9aacb71c562bfe003b3007c68fe437fc26f..e274673a0fe100d6354594db288ebac2161c56f6 100644
(file)
--- a/
src/src/host.c
+++ b/
src/src/host.c
@@
-600,35
+600,36
@@
return depends on whether sender_fullhost and sender_ident are set or not:
ident set, no host => U=ident
ident set, host set => H=sender_fullhost U=ident
ident set, no host => U=ident
ident set, host set => H=sender_fullhost U=ident
-Use taint-unchecked routines on the assumption we'll never expand the results.
-
Arguments:
useflag TRUE if first item to be flagged (H= or U=); if there are two
items, the second is always flagged
Arguments:
useflag TRUE if first item to be flagged (H= or U=); if there are two
items, the second is always flagged
-Returns: pointer to a
string in big_buffer
+Returns: pointer to a
n allocated string
*/
uschar *
host_and_ident(BOOL useflag)
{
*/
uschar *
host_and_ident(BOOL useflag)
{
+gstring * g = NULL;
+
if (!sender_fullhost)
if (!sender_fullhost)
- string_format_nt(big_buffer, big_buffer_size, "%s%s", useflag ? "U=" : "",
- sender_ident ? sender_ident : US"unknown");
+ {
+ if (useflag)
+ g = string_catn(g, US"U=", 2);
+ g = string_cat(g, sender_ident ? sender_ident : US"unknown");
+ }
else
{
else
{
- uschar * flag = useflag ? US"H=" : US"";
- uschar * iface = US"";
+ if (useflag)
+ g = string_catn(g, US"H=", 2);
+ g = string_cat(g, sender_fullhost);
if (LOGGING(incoming_interface) && interface_address)
if (LOGGING(incoming_interface) && interface_address)
-
iface = string_sprintf(
" I=[%s]:%d", interface_address, interface_port);
+
g = string_fmt_append(g,
" I=[%s]:%d", interface_address, interface_port);
if (sender_ident)
if (sender_ident)
- string_format_nt(big_buffer, big_buffer_size, "%s%s%s U=%s",
- flag, sender_fullhost, iface, sender_ident);
- else
- string_format_nt(big_buffer, big_buffer_size, "%s%s%s",
- flag, sender_fullhost, iface);
+ g = string_fmt_append(g, " U=%s", sender_ident);
}
}
-return big_buffer;
+gstring_release_unused(g);
+return string_from_gstring(g);
}
#endif /* STAND_ALONE */
}
#endif /* STAND_ALONE */