# HG changeset patch # User bears # Date 1152732401 -3600 # Node ID 372f8b55506e1af6277634c89879473e730a2b08 # Parent 4d3a1597813aa5062457f26b9e057233a580dc25 [svn] Apply patch from Jan De Luyck. Add new option 'add-messageid-if-missing', which optionally postpones adding a message ID to the upstream server. If this is done, post-locally must be off. This is to deal with an upstream server troubling Jan. It usually (but not always) rejects posts with a Noffle message ID. I have changed Jan's original option of 'add-message-id-if-missing' for consistency with 'replace-messageid' and added the manual page entry. See SourceForge feature request 1513395. diff -r 4d3a1597813a -r 372f8b55506e docs/noffle.conf.5 --- a/docs/noffle.conf.5 Sun Apr 16 07:20:58 2006 +0100 +++ b/docs/noffle.conf.5 Wed Jul 12 20:26:41 2006 +0100 @@ -1,5 +1,5 @@ .TH noffle.conf 5 -.\" $Id: noffle.conf.5 619 2003-10-31 15:54:59Z godisch $ +.\" $Id: noffle.conf.5 645 2006-07-12 19:26:41Z bears $ .SH NAME noffle.conf \- Configuration file for NOFFLE news server @@ -235,18 +235,40 @@ .TP .B replace\-messageid yes|no Always replace the Message-ID of a posted article with a Message-ID -generated by NOFFLE. NOFFLE will always add a Message-ID if none is -present, or replace a Message-ID that does not meet the basic -formatting and content requirements for a Message-ID. However, some -news readers may generate Message-IDs that are not accepted by some -servers (for example the server may insist the Message-ID domain is -part of the server domain) or may not always be unique. In either of -these cases you may prefer to have NOFFLE always replace the -Message-ID. +generated by NOFFLE. NOFFLE by default adds a Message-ID if none is +present. However, some news readers may generate Message-IDs that are +not accepted by some servers (for example the server may insist the +Message-ID domain is part of the server domain) or may not always be +unique. In either of these cases you may prefer to have NOFFLE always +replace the Message-ID. .br Default: no .TP +.B add\-messageid\-if-missing yes|no +NOFFLE by default will always add a Message-ID a posted article if the +article does not have a Message-ID. This is required if +.B post\-locally +is set. However, some news servers in the wild have been observed +to prefer to assign their own Message-IDs, to the extent of often +rejecting posts with perfectly legitimate Message-IDs. If you are +unfortunate enough to be confronted by one of these beasts, you can +change +.B add\-messageid\-if-missing +to +.B no +to leave adding a Message-ID to the upstream server. If you do this, +you +.B must +also set +.B post\-locally +to +.B no +or posting an article without a Message-ID will generate an error. +.br +Default: yes + +.TP .B hostname Specify right-hand side of Message-IDs generated by NOFFLE. If omitted, the fully qualified domain name of your system will be used. diff -r 4d3a1597813a -r 372f8b55506e src/configfile.c --- a/src/configfile.c Sun Apr 16 07:20:58 2006 +0100 +++ b/src/configfile.c Wed Jul 12 20:26:41 2006 +0100 @@ -6,7 +6,7 @@ SPOOLDIR VERSION - $Id: configfile.c 620 2003-11-29 23:42:33Z bears $ + $Id: configfile.c 645 2006-07-12 19:26:41Z bears $ */ #if HAVE_CONFIG_H @@ -99,6 +99,7 @@ Str organization; Str noffleUser; Str noffleGroup; + Bool addMsgIdIfMissing; } config = { SPOOLDIR, /* spoolDir */ @@ -132,7 +133,8 @@ "", /* fromDomain */ "", /* organization */ "news", /* user Noffle runs as */ - "news" /* group Noffle runs as */ + "news", /* group Noffle runs as */ + TRUE /* addMsgIdIfMissing */ }; const char * Cfg_spoolDir( void ) { return config.spoolDir; } @@ -159,6 +161,7 @@ const char * Cfg_organization( void ) { return config.organization; } const char * Cfg_noffleUser( void ) { return config.noffleUser; } const char * Cfg_noffleGroup( void ) { return config.noffleGroup; } +Bool Cfg_addMsgIdIfMissing( void ) { return config.addMsgIdIfMissing; } void Cfg_setClientAuth( Bool needsAuth ) { @@ -965,6 +968,8 @@ getStr( config.hostnameMsgId, line ); else if ( strcmp( "post-locally", name ) == 0 ) getBool( &config.postLocal, p ); + else if ( strcmp( "add-messageid-if-missing", name ) == 0 ) + getBool( &config.addMsgIdIfMissing, p ); #if USE_AUTH /* * Don't recognise this unless we have some sort of auth @@ -1017,4 +1022,7 @@ fclose( f ); if ( ! config.numServ ) Log_fatal( "Config file contains no server" ); + + if ( config.postLocal && ! config.addMsgIdIfMissing ) + Log_fatal ( "Local posting without adding missing Message-ID's is impossible. "); } diff -r 4d3a1597813a -r 372f8b55506e src/configfile.h --- a/src/configfile.h Sun Apr 16 07:20:58 2006 +0100 +++ b/src/configfile.h Wed Jul 12 20:26:41 2006 +0100 @@ -3,7 +3,7 @@ Common declarations and handling of the configuration file. - $Id: configfile.h 533 2003-05-23 09:33:10Z bears $ + $Id: configfile.h 645 2006-07-12 19:26:41Z bears $ */ #ifndef CONFIGFILE_H @@ -34,6 +34,7 @@ const char * Cfg_hostnameMsgId( void ); Bool Cfg_postLocal( void ); const char * Cfg_mailTo( void ); +Bool Cfg_addMsgIdIfMissing( void ); /* Begin iteration through the server names */ void Cfg_beginServEnum( void ); diff -r 4d3a1597813a -r 372f8b55506e src/post.c --- a/src/post.c Sun Apr 16 07:20:58 2006 +0100 +++ b/src/post.c Wed Jul 12 20:26:41 2006 +0100 @@ -1,7 +1,7 @@ /* post.c - $Id: post.c 517 2003-04-03 17:21:24Z bears $ + $Id: post.c 645 2006-07-12 19:26:41Z bears $ */ #if HAVE_CONFIG_H @@ -182,6 +182,10 @@ Bool continuation; time_t t; int sigLines; + Bool addMsgIdIfMissing; + Bool processMsgId = TRUE; + + addMsgIdIfMissing = Cfg_addMsgIdIfMissing(); s = new_DynStr( 10000 ); article.text = s; @@ -356,6 +360,9 @@ { Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" ); Log_inf( "Adding missing Message-ID '%s'", article.over.msgId ); + + if ( ! addMsgIdIfMissing ) + processMsgId = FALSE; } else if ( ! Prt_isValidMsgId( article.over.msgId ) || Cfg_replaceMsgId() ) { @@ -364,8 +371,14 @@ "Replacing Message-ID with '%s'", article.over.msgId ); } - DynStr_app( s, "Message-ID: " ); - DynStr_appLn( s, article.over.msgId ); + + if ( processMsgId ) + { + DynStr_app( s, "Message-ID: " ); + DynStr_appLn( s, article.over.msgId ); + } + else + Log_inf( "Not storing Message-ID '%s' in message.", article.over.msgId ); /* Ensure Path header */ if ( ! pathFound )