INN commit: trunk/nnrpd (post.c)
INN Commit
rra at isc.org
Sun Sep 26 15:49:33 UTC 2010
Date: Sunday, September 26, 2010 @ 08:49:33
Author: iulius
Revision: 9124
Better check for the syntax of the posting-host attribute
of the Injection-Info: header field.
"stdin:" without any IP was seen in the wild. Fix it to
only print "stdin".
Modified:
trunk/nnrpd/post.c
--------+
post.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
Modified: post.c
===================================================================
--- post.c 2010-09-26 15:46:57 UTC (rev 9123)
+++ post.c 2010-09-26 15:49:33 UTC (rev 9124)
@@ -524,13 +524,21 @@
}
snprintf(pathidentitybuff, sizeof(pathidentitybuff), "%s", p);
- /* Set the posting-host identity. */
- if (strcmp(Client.host, Client.ip) == 0) {
- snprintf(postinghostbuff, sizeof(postinghostbuff),
- "; posting-host=\"%s\"", Client.ip);
- } else {
- snprintf(postinghostbuff, sizeof(postinghostbuff),
- "; posting-host=\"%s:%s\"", Client.host, Client.ip);
+ /* Set the posting-host identity.
+ * Check a proper definition of Client.host and Client.ip
+ * (we already saw the case of "stdin:" without IP). */
+ if ((strlen(Client.host) > 0) || (strlen(Client.ip) > 0)) {
+ if ((strcmp(Client.host, Client.ip) == 0)
+ || (strlen(Client.host) == 0)) {
+ snprintf(postinghostbuff, sizeof(postinghostbuff),
+ "; posting-host=\"%s\"", Client.ip);
+ } else if (strlen(Client.ip) == 0) {
+ snprintf(postinghostbuff, sizeof(postinghostbuff),
+ "; posting-host=\"%s\"", Client.host);
+ } else {
+ snprintf(postinghostbuff, sizeof(postinghostbuff),
+ "; posting-host=\"%s:%s\"", Client.host, Client.ip);
+ }
}
/* Set the logging-data attribute. */
More information about the inn-committers
mailing list