🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #79142

Re: Cleanfeed - Any rules for invalid group names?

#79142
From: Julien ÉLIE
Date: Wed, 25 Jun 2008 19:13
83 lines
4726 bytes
Hi D. Stussy,

> I'm seeing some messages with bogus group names with "&" and "@" in them.
> I've also seen ";" being used as a separator instead of ",".  Has anyone
> else written a group name filter (a regex expression) patch?
>
> Based on the valid names at isc.org -- with one modification (allowing a
> digit as the first character), I think the appropriate expression should be
> something close to:
>
>  [a-z0-9]([-a-z0-9._+]*[-a-z0-9_+])*

Do you really want a regexp in order to achieve that?
Otherwise, you can see what newgroup.pl does in INN:


# Check the group name.  This is partially derived from C News.
# Some checks are commented out if I think they're too strict or
# language-dependent.  Your mileage may vary.
sub checkgroupname {
    local $_ = shift;

    # whole-name checking
    return 'Empty group name' if /^$/;
    return 'Whitespace in group name' if /\s/;
    return 'Unsafe group name' if /[\`\/:;]/;
    return 'Bad dots in group name' if /^\./ or /\.$/ or /\.\./;
#    return 'Group name does not begin/end with alphanumeric'
#        if (/^[a-zA-Z0-9].+[a-zA-Z0-9]$/;
    return 'Group name begins in control., junk. or to.' if /^(?:control|junk|to)\./;
#    return 'Group name too long' if length $_ > 128;

    my @components = split(/\./);
    # prevent alt.a.b.c.d.e.f.g.w.x.y.z...
    return 'Too many components' if $#components > 9;

    # per-component checking
    for (my $i = 0; $i <= $#components; $i++) {
        local $_ = $components[$i];
        return 'all-numeric name component' if /^[0-9]+$/;
#        return 'name component starts with non-alphanumeric' if /^[a-zA-Z0-9]/;
#        return 'name component does not contain letter' if not /[a-zA-Z]/;
        return "`all' or `ctl' used as name component" if /^(?:all|ctl)$/;
#        return 'name component longer than 30 characters' if length $_ > 30;
#        return 'uppercase letter(s) in name' if /[A-Z]/;
        return 'illegal character(s) in name' if /[^a-z0-9+_\-.]/;
        # sigh, c++ etc must be allowed
        return 'repeated punctuation in name' if /--|__|\+\+./;
#        return 'repeated component(s) in name' if ($i + 2 <= $#components
#            and $_ eq $components[$i + 1] and $_ eq $components[$i + 2]);
    }
    return '';
}



> I note that there are things that it won't check for:
> - A fully numeric name component.
> - The length requirement of any component.
> - The number of components.
> - Invalid components such as "all" or "ctl".
> ...But it's not meant to check for everything.

Done in the function above :)


> As far as any patch goes, there's also one option I'd like as a
> consideration:  Whether an article with an invalid group name should be
> accepted (altered to post only to its valid groups, if any) or outright
> rejected (i.e. not posted to any groups).

I think it should be accepted.  It is the default behaviour of news server,
I assume.  If you post to "news.software.nntp,unknown.group" and if your
news server has the first one, I believe it should be posted to it.
(as for the "junk" newsgroup when you do not have news.software.nntp,
I do not think it useful for readers)

-- 
Julien ÉLIE

« Quel prodige ! Rien qu'en vous voyant, les pirates
  refusent le combat et coulent leur propre navire ! » (Astérix)
Technical Details
Message-ID: <g3u5cn$5qt$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!club-internet.fr!feedme-small.clubint.net!news.ecp.fr!news.trigofacile.com!not-for-mail
References: <g3sqvk$8eh$1@snarked.org>

Show Full Headers
Complete Article Headers
Message-ID: <g3u5cn$5qt$1@news.trigofacile.com>
Subject: Re: Cleanfeed - Any rules for invalid group names?
Date: Wed, 25 Jun 2008 21:13:22 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <g3sqvk$8eh$1@snarked.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!club-internet.fr!feedme-small.clubint.net!news.ecp.fr!news.trigofacile.com!not-for-mail
Newsgroups: news.software.nntp
Organization: TrigoFACILE -- http://www.trigofacile.com/
Lines: 83
NNTP-Posting-Host: aaubervilliers-151-1-57-198.w83-112.abo.wanadoo.fr
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset="Windows-1252";
 reply-type=original
Content-Transfer-Encoding: 8bit
X-Trace: news.trigofacile.com 1214421208 5981 83.112.30.198 (25 Jun 2008
X-Complaints-To: abuse@trigofacile.com
NNTP-Posting-Date: Wed, 25 Jun 2008 19:13:28 +0000 (UTC)
In-Reply-To: <g3sqvk$8eh$1@snarked.org>
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18000