[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] [ANNOUNCE] leafnode-2.0b5
Joerg Dietrich <joerg@xxxxxxxxxxxx> writes:
> - Leafnode should check if a locally posted article is already
> present in the spool.
I tried the following hack:
--- leafnode-2.0b3.orig/nntpd.c Fri Oct 27 18:00:53 2000
+++ leafnode-2.0b3/nntpd.c Mon Oct 30 01:42:47 2000
@@ -1058,6 +1058,9 @@
int havesubject = 0;
int err = 0;
int hdrtoolong = FALSE;
+ int duplicate = 0;
+ FILE *art;
+ struct stat st;
int i, len;
int out;
char outname[80];
@@ -1204,7 +1207,13 @@
} while ( line[0] != '.' || line[1] != '\0' );
close( out );
- if ( havefrom && havesubject && havenewsgroups && !err ) {
+ /* check if Message-ID already in use */
+ art = fopen( outname, "r" );
+ if ( !stat( lookup( fgetheader( art, "Message-ID:" ) ), &st ) )
+ duplicate = 1;
+ fclose( art );
+
+ if ( havefrom && havesubject && havenewsgroups && !err && !duplicate ) {
FILE * f;
char * mid;
char * groups;
@@ -1269,6 +1278,8 @@
nntpprintf( "441 Newsgroups: header missing, article not posted" );
else if ( hdrtoolong )
nntpprintf( "441 Header too long, article not posted" );
+ else if ( duplicate )
+ nntpprintf( "441 435 Duplicate" );
else
nntpprintf( "441 Formatting error, article not posted" );
}
The error message is just stolen from one of my upstream servers.
I'm not sure if better error handling might be necessary.
BTW, I have some ideas how to improve the supersedes processing.
Anyone interested in?
Stefan
--
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list