🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
5 messages
5 total messages Started by Dave Magda Tue, 06 Nov 2001 14:26
441 return status?
#54994
Author: Dave Magda
Date: Tue, 06 Nov 2001 14:26
132 lines
4782 bytes
Hello,

I'm trying to setup a mail to news gateway using the Net::NNTP and
News::Gateway perl modules. I'm writing my own because none of the ones
I found use NNTP (vs. inews) with AUTHINFO.

I almost works except for the posting part. :> My script is at the
bottom of this message. Here is the output of the script:

    Selected group: ryeee.admin.test
    Reading in...done.
    Applying checks...done.
    Posting...done.
    An error occured during posting:
    441 No valid newsgroups in "ryeee.admin.test" at ./connews line 56,
    <STDIN> chunk 29

The corresponding entry in my news.notice log is:

    Nov  6 09:07:39 hydrogen nnrpd[4962]: ruby.ee.ryerson.ca times user
    0.245 system 0.122 elapsed 11.761
    Nov  6 09:07:45 hydrogen nnrpd[4964]: SERVER perl filtering enabled
    Nov  6 09:07:45 hydrogen nnrpd[4964]: ruby.ee.ryerson.ca connect
    Nov  6 09:07:45 hydrogen nnrpd[4964]: ruby.ee.ryerson.ca user dmagda
    Nov  6 09:07:57 hydrogen nnrpd[4964]: ruby.ee.ryerson.ca group
    ryeee.admin.test 0
    Nov  6 09:07:57 hydrogen nnrpd[4964]: ruby.ee.ryerson.ca times user
    0.188 system 0.148 elapsed 11.677

This is my perl code (yes I know it's not very pretty):

----------
#!/usr/local/bin/perl -w

use Net::NNTP;
use News::Gateway;

my $NEWSSERVER = "news.ee.ryerson.ca";
my $USERNAME = "dmagda";
my $PASSWD = "password";

my $GroupName = "ryeee.admin.test";

# set up actual connection
my $nntpptr = Net::NNTP->new('news.ee.ryerson.ca') 
    or die("Could not connect.");

# do authentication
$nntpptr->authinfo( $USERNAME, $PASSWD) or die("Auth failed.");

# select newsgroup
my ($NumArt, $NumFirst, $NumLast, $XGroupName) =
$nntpptr->group($GroupName);
print("Selected group: $GroupName\n");


##### mail/news gateway
# setup non-interactive (0) mail/news gateway object
my $gateway = News::Gateway->new( 0);

# do sanity checking/header munging
#   assume input is a mail message and going to news msg.
$gateway->modules( mailtonews => [$GroupName] );

# read in message
print("Reading in...");
$gateway->read(\*STDIN);
print("done.\n");

# apply checking
print("Applying checks...");
my $error = $gateway->apply();
print("done.\n");

if( $error) { die("An error occured during header checking:\n$error"); }

# post message:
print("Posting...");
$error = $gateway->post( $nntpptr);
print("done.\n");

if( $error) { die("An error occured during posting:\n$error"); }

$nntpptr->quit;
exit;

# EOF
----------

The test message is:

From fsmith@ee.ryerson.ca  Sat Nov  3 12:15:16 2001
Return-Path: <fsmith@ee.ryerson.ca>
Received: from fred.ee.ryerson.ca (fred.ee.ryerson.ca [192.168.2.34])
        by yoohoo.ee.ryerson.ca (8.11.6/8.11.6) with ESMTP id
fA3HFGB17319
        for <dmagda@ee.ryerson.ca>; Sat, 3 Nov 2001 12:15:16 -0500
Received: (from fsmith@localhost)
        by barney.ee.ryerson.ca (8.11.6/8.11.6) id MAA25925;
        Sat, 3 Nov 2001 12:21:30 -0500 (EST)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <15332.10138.508963.551277@gargle.gargle.HOWL>
Date: Sat, 3 Nov 2001 12:21:30 -0500
From: Fred Smith <fsmith@ee.ryerson.ca>
To: dmagda@ee.ryerson.ca
Subject: lynx cookies
In-Reply-To: <20011103120313.A336@number6.magda.ca>
References: <20011103120313.A336@number6.magda.ca>
X-Mailer: VM 6.97 under Emacs 21.0.106.1
Status: RO
X-Status: 
X-Keywords:                 

OK, thanks.

Can you compile the latest lynx for Solaris? It's rather old and
sometime ago, when I tried to compile it, I never got past the
configure-- but then I wasn't trying too hard, either.
 





-- 
David Magda <dmagda at ee.ryerson.ca>

Support Buy Nothing Day: http://adbusters.org/campaigns/bnd/
        November 23, 2001
Re: 441 return status?
#54995
Author: Andrew Gierth
Date: Tue, 06 Nov 2001 14:52
9 lines
1245 bytes
>>>>> "Dave" == Dave Magda <dmagda@number6.magda.ca> writes:

 Dave>     441 No valid newsgroups in "ryeee.admin.test"

is this group listed as 'n' in your active file, perhaps?

-- 
Andrew.
Re: 441 return status?
#55010
Author: Dave Magda
Date: Wed, 07 Nov 2001 01:21
50 lines
2559 bytes
On 06 Nov 2001, Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote:
[...]
> Dave>     441 No valid newsgroups in "ryeee.admin.test"
> is this group listed as 'n' in your active file, perhaps?
> 

No but it does need authenticaion (which works as shown in the log).
I've also tried posting to a group called ryeee.test which anyone can
post and it gives the same error.

Posting to the newsgroup through tin works just fine, so it must be my
script.

I did some digging in the INN source code:

* The error is output form nnrpd/post.c, line 742:
    [...]
    if (!FoundOne && !IsNewgroup)
        (void)sprintf(Error, "No valid newsgroups in \"%s\"", \
            MaxLength(hdr,hdr)
    [...]

* "IsNewgroup" is used when a control message comes in; FoundOne is
  set to TRUE on 697 of nnrpd/post.c:
    [...]
    if (!OVgroupstats(p, NULL, NULL, NULL, &flag))
        continue;
    FoundOne = TRUE;
    [...]
* OVgroupstats() can be found in storage/ov.c on line 169:
    [...]
    BOOL OVgroupstats(char *group, int *lo, int *hi, int *count, int \
            *flag) {
        if (!ov.open) {
            /* must be opened */
            syslog(L_ERROR, "ovopen must be called first");
            (void)fprintf(stderr, "ovopen must be called first");
            return FALSE;
        }
        return ((*ov.groupstats)(group, lo, hi, count, flag));
    }
    [...]


-- 
David Magda <dmagda at ee.ryerson.ca>

Support Buy Nothing Day: http://adbusters.org/campaigns/bnd/
        November 23, 2001
Re: 441 return status?
#55012
Author: Curt Welch
Date: Wed, 07 Nov 2001 03:02
42 lines
2901 bytes
dmagda+usenet@ee.ryerson.ca wrote:
> On 06 Nov 2001, Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote:
> [...]
> > Dave>     441 No valid newsgroups in "ryeee.admin.test"
> > is this group listed as 'n' in your active file, perhaps?
> >
>
> No but it does need authenticaion (which works as shown in the log).
> I've also tried posting to a group called ryeee.test which anyone can
> post and it gives the same error.

Any chance that the getway object is posting to some other server which
is returning that error code?

I don't know what should be in that nnrpd log but I notice there is no
entry for the post or for the error. (or at least what I see doesn't
look like that).

BTW, do you know that there is no need to issue the NNTP GROUP command
before the POST?  The POST command does not care what group is selected.

As far as I can see, it looks like the server thinks that newsgroup
is not valid.  So either it's not posting to the same server, or it's
posting to the server, but it's not valid for that user, or what you
see is not what you are getting (i.e. is there any where there could
be a non-printable control character in the group name which we are not
seeing?).

You might try posting to a known bogus group name and see if it does
the same thing.

I'd try to get the gateway object to show me exactly (byte for byte) what
it was sending to the server to see if I could spot any issues that
way.

Try posting a simple test message with the NNTP object (and not the gatway
object) to see if you can make that work.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: 441 return status?
#55023
Author: Dave Magda
Date: Wed, 07 Nov 2001 20:15
26 lines
1913 bytes
On 07 Nov 2001 03:02:33 GMT, Curt Welch <curt@kcwc.com> wrote:
[...]
> Any chance that the getway object is posting to some other server which
> is returning that error code?
> 
Could be. I've never used this module before so I could be using it
incorrectly.

[...]
> BTW, do you know that there is no need to issue the NNTP GROUP command
> before the POST?  The POST command does not care what group is selected.
> 
Good to know, thanks.

[...]
> Try posting a simple test message with the NNTP object (and not the gatway
> object) to see if you can make that work.
> 
Right. I'll have to think about this some more.

-- 
David Magda <dmagda at ee.ryerson.ca>

Support Buy Nothing Day: http://adbusters.org/campaigns/bnd/
        November 23, 2001
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads