INN commit: trunk (9 files)
INN Commit
rra at isc.org
Sun Nov 9 15:01:45 UTC 2014
Date: Sunday, November 9, 2014 @ 07:01:45
Author: iulius
Revision: 9740
Add support for the posting-account attribute in Injection-Info: header fields
Add new addinjectionpostingaccount parameter to inn.conf. When set
to true, the Injection-Info: header field contains an additional
posting-account attribute that mentions the username assigned to the
user at connection time or after authentication. The default value
for this parameter is false.
closes #51
Modified:
trunk/doc/pod/inn.conf.pod
trunk/doc/pod/news.pod
trunk/doc/pod/readers.conf.pod
trunk/include/inn/innconf.h
trunk/lib/innconf.c
trunk/nnrpd/nnrpd.h
trunk/nnrpd/perm.c
trunk/nnrpd/post.c
trunk/scripts/inncheck.in
--------------------------+
doc/pod/inn.conf.pod | 8 ++++++
doc/pod/news.pod | 8 ++++++
doc/pod/readers.conf.pod | 8 +++---
include/inn/innconf.h | 1
lib/innconf.c | 1
nnrpd/nnrpd.h | 1
nnrpd/perm.c | 59 +++++++++++++++++++++++++--------------------
nnrpd/post.c | 11 +++++++-
scripts/inncheck.in | 1
9 files changed, 68 insertions(+), 30 deletions(-)
Modified: doc/pod/inn.conf.pod
===================================================================
--- doc/pod/inn.conf.pod 2014-11-01 21:44:24 UTC (rev 9739)
+++ doc/pod/inn.conf.pod 2014-11-09 15:01:45 UTC (rev 9740)
@@ -835,6 +835,14 @@
Whether to add an Injection-Date: header to all local posts. This is a
boolean value and the default is true.
+=item I<addinjectionpostingaccount>
+
+Whether to add a posting-account attribute to the Injection-Info:
+header to all local posts giving the username assigned to the user at
+connection time or after authentication. This is a boolean value and
+the default is false. There is no intrinsic support for obfuscating the
+value. That has to be done with a user-written Perl filter, if desired.
+
=item I<addinjectionpostinghost>
Whether to add a posting-host attribute to the Injection-Info: header to
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2014-11-01 21:44:24 UTC (rev 9739)
+++ doc/pod/news.pod 2014-11-09 15:01:45 UTC (rev 9740)
@@ -102,6 +102,14 @@
=item *
+A new I<addinjectionpostingaccount> parameter has been added in
+F<inn.conf>. When set to true, the Injection-Info: header field
+contains an additional posting-account attribute that mentions the
+username assigned to the user at connection time or after authentication.
+The default value for this parameter is false.
+
+=item *
+
A few headers are now considered as obsolete by B<nnrpd> at injection
time: NNTP-Posting-Date:, NNTP-Posting-Host:, X-Complaints-To:, X-Trace:,
Also-Control:, Article-Names:, Article-Updates:, and See-Also: headers.
Modified: doc/pod/readers.conf.pod
===================================================================
--- doc/pod/readers.conf.pod 2014-11-01 21:44:24 UTC (rev 9739)
+++ doc/pod/readers.conf.pod 2014-11-09 15:01:45 UTC (rev 9740)
@@ -555,10 +555,10 @@
and override the global setting in F<inn.conf>. See inn.conf(5) for the
descriptions of these parameters:
- addinjectiondate, addinjectionpostinghost, backoff_auth, backoff_db,
- backoff_k, backoff_postfast, backoff_postslow, backoff_trigger,
- checkincludedtext, clienttimeout, complaints, domain, fromhost,
- localmaxartsize, moderatormailer, nnrpdauthsender, nnrpdcheckart,
+ addinjectiondate, addinjectionpostingaccount, addinjectionpostinghost,
+ backoff_auth, backoff_db, backoff_k, backoff_postfast, backoff_postslow,
+ backoff_trigger, checkincludedtext, clienttimeout, complaints, domain,
+ fromhost, localmaxartsize, moderatormailer, nnrpdauthsender, nnrpdcheckart,
nnrpdoverstats, nnrpdposthost, nnrpdpostport, organization, pathhost,
readertrack, spoolfirst, strippostcc.
Modified: include/inn/innconf.h
===================================================================
--- include/inn/innconf.h 2014-11-01 21:44:24 UTC (rev 9739)
+++ include/inn/innconf.h 2014-11-09 15:01:45 UTC (rev 9740)
@@ -100,6 +100,7 @@
/* Posting */
bool addinjectiondate; /* Add Injection-Date: to posts */
+ bool addinjectionpostingaccount; /* Add posting-account attribute to Injection-Info: to posts */
bool addinjectionpostinghost; /* Add posting-host attribute to Injection-Info: to posts */
bool checkincludedtext; /* Reject if too much included text */
char *complaints; /* Address for mail-complaints-to attribute to Injection-Info: */
Modified: lib/innconf.c
===================================================================
--- lib/innconf.c 2014-11-01 21:44:24 UTC (rev 9739)
+++ lib/innconf.c 2014-11-09 15:01:45 UTC (rev 9740)
@@ -194,6 +194,7 @@
/* The following settings are specific to nnrpd. */
{ K(addinjectiondate), BOOL (true) },
+ { K(addinjectionpostingaccount), BOOL (false) },
{ K(addinjectionpostinghost), BOOL (true) },
{ K(allownewnews), BOOL (true) },
{ K(backoffauth), BOOL (false) },
Modified: nnrpd/nnrpd.h
===================================================================
--- nnrpd/nnrpd.h 2014-11-01 21:44:24 UTC (rev 9739)
+++ nnrpd/nnrpd.h 2014-11-09 15:01:45 UTC (rev 9740)
@@ -71,6 +71,7 @@
int readertrack;
int strippostcc;
int addinjectiondate;
+ int addinjectionpostingaccount;
int addinjectionpostinghost;
char *nnrpdposthost;
unsigned long nnrpdpostport;
Modified: nnrpd/perm.c
===================================================================
--- nnrpd/perm.c 2014-11-01 21:44:24 UTC (rev 9739)
+++ nnrpd/perm.c 2014-11-09 15:01:45 UTC (rev 9740)
@@ -138,33 +138,34 @@
#define PERMreadertrack 36
#define PERMstrippostcc 37
#define PERMaddinjectiondate 38
-#define PERMaddinjectionpostinghost 39
-#define PERMnnrpdposthost 40
-#define PERMnnrpdpostport 41
-#define PERMnnrpdoverstats 42
-#define PERMbackoff_auth 43
-#define PERMbackoff_db 44
-#define PERMbackoff_k 45
-#define PERMbackoff_postfast 46
-#define PERMbackoff_postslow 47
-#define PERMbackoff_trigger 48
-#define PERMnnrpdcheckart 49
-#define PERMnnrpdauthsender 50
-#define PERMvirtualhost 51
-#define PERMnewsmaster 52
-#define PERMlocaladdress 53
-#define PERMrejectwith 54
-#define PERMmaxbytespersecond 55
-#define PERMperl_auth 56
-#define PERMpython_auth 57
-#define PERMperl_access 58
-#define PERMpython_access 59
-#define PERMpython_dynamic 60
+#define PERMaddinjectionpostingaccount 39
+#define PERMaddinjectionpostinghost 40
+#define PERMnnrpdposthost 41
+#define PERMnnrpdpostport 42
+#define PERMnnrpdoverstats 43
+#define PERMbackoff_auth 44
+#define PERMbackoff_db 45
+#define PERMbackoff_k 46
+#define PERMbackoff_postfast 47
+#define PERMbackoff_postslow 48
+#define PERMbackoff_trigger 49
+#define PERMnnrpdcheckart 50
+#define PERMnnrpdauthsender 51
+#define PERMvirtualhost 52
+#define PERMnewsmaster 53
+#define PERMlocaladdress 54
+#define PERMrejectwith 55
+#define PERMmaxbytespersecond 56
+#define PERMperl_auth 57
+#define PERMpython_auth 58
+#define PERMperl_access 59
+#define PERMpython_access 60
+#define PERMpython_dynamic 61
#ifdef HAVE_OPENSSL
-#define PERMrequire_ssl 61
-#define PERMMAX 62
+#define PERMrequire_ssl 62
+#define PERMMAX 63
#else
-#define PERMMAX 61
+#define PERMMAX 62
#endif
#define TEST_CONFIG(a, b) \
@@ -227,6 +228,7 @@
{ PERMreadertrack, (char *) "readertrack:" },
{ PERMstrippostcc, (char *) "strippostcc:" },
{ PERMaddinjectiondate, (char *) "addinjectiondate:" },
+ { PERMaddinjectionpostingaccount, (char *) "addinjectionpostingaccount:" },
{ PERMaddinjectionpostinghost, (char *) "addinjectionpostinghost:" },
{ PERMnnrpdposthost, (char *) "nnrpdposthost:" },
{ PERMnnrpdpostport, (char *) "nnrpdpostport:" },
@@ -492,6 +494,7 @@
curaccess->readertrack = innconf->readertrack;
curaccess->strippostcc = innconf->strippostcc;
curaccess->addinjectiondate = innconf->addinjectiondate;
+ curaccess->addinjectionpostingaccount = innconf->addinjectionpostingaccount;
curaccess->addinjectionpostinghost = innconf->addinjectionpostinghost;
curaccess->nnrpdposthost = innconf->nnrpdposthost;
curaccess->nnrpdpostport = innconf->nnrpdpostport;
@@ -987,6 +990,11 @@
curaccess->addinjectiondate = boolval;
SET_CONFIG(oldtype);
break;
+ case PERMaddinjectionpostingaccount:
+ if (boolval != -1)
+ curaccess->addinjectionpostingaccount = boolval;
+ SET_CONFIG(oldtype);
+ break;
case PERMaddinjectionpostinghost:
if (boolval != -1)
curaccess->addinjectionpostinghost = boolval;
@@ -1301,6 +1309,7 @@
case PERMreadertrack:
case PERMstrippostcc:
case PERMaddinjectiondate:
+ case PERMaddinjectionpostingaccount:
case PERMaddinjectionpostinghost:
case PERMnnrpdposthost:
case PERMnnrpdpostport:
Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c 2014-11-01 21:44:24 UTC (rev 9739)
+++ nnrpd/post.c 2014-11-09 15:01:45 UTC (rev 9740)
@@ -334,6 +334,7 @@
static char orgbuff[SMBUF];
static char pathidentitybuff[SMBUF];
static char complaintsbuff[SMBUF];
+ static char postingaccountbuff[SMBUF];
static char postinghostbuff[SMBUF];
static char sendbuff[SMBUF];
static char injectioninfobuff[SMBUF];
@@ -544,6 +545,12 @@
}
snprintf(pathidentitybuff, sizeof(pathidentitybuff), "%s", p);
+ /* Set the posting-account value. */
+ if (PERMaccessconf->addinjectionpostingaccount && PERMuser[0] != '\0') {
+ snprintf(postingaccountbuff, sizeof(postingaccountbuff),
+ "; posting-account=\"%s\"", PERMuser);
+ }
+
/* Set the posting-host identity.
* Check a proper definition of Client.host and Client.ip
* (we already saw the case of "localhost:" without IP),
@@ -582,8 +589,10 @@
/* ARTpost() will convert bare LF to CRLF. Do not use CRLF here.*/
snprintf(injectioninfobuff, sizeof(injectioninfobuff),
- "%s%s;\n\tlogging-data=\"%ld\"; mail-complaints-to=\"%s\"",
+ "%s%s%s;\n\tlogging-data=\"%ld\"; mail-complaints-to=\"%s\"",
pathidentitybuff,
+ PERMaccessconf->addinjectionpostingaccount && PERMuser[0] != '\0' ?
+ postingaccountbuff : "",
PERMaccessconf->addinjectionpostinghost ? postinghostbuff : "",
(long) pid, complaintsbuff);
Modified: scripts/inncheck.in
===================================================================
--- scripts/inncheck.in 2014-11-01 21:44:24 UTC (rev 9739)
+++ scripts/inncheck.in 2014-11-09 15:01:45 UTC (rev 9740)
@@ -951,6 +951,7 @@
'virtualhost' => 'boolean',
# inn.conf parameters:
'addinjectiondate' => 'boolean',
+ 'addinjectionpostingaccount' => 'boolean',
'addinjectionpostinghost' => 'boolean',
'backoff_auth' => 'boolean', # careful:
'backoff_db' => 'string', # the inn.conf options
More information about the inn-committers
mailing list