🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #9457

Re: nn with authenticated login?

#9457
From: Tim Skirvin
Date: Sun, 20 Feb 2000 00:00
75 lines
3579 bytes
Cord Beermann <cord@Wunder-Nett.org> writes:

>It enables nn to use 'Original' Authinfo, for READING. If you want to post,
>you'll have to add the authentication to inews or mini-inews. which isn't done
>yet.

	On my work system, I got sick of being unable to get nn6.5.5 to
compile but needed an updated inews.  And so I figured out that there was
really little reason I couldn't do it all in perl...  Anyway, News::Article 
is a wonderful thing, and does support authentication.  

	The following script oughta work (I haven't tested it or anything,
at least not the authorization part) and be fairly compatible with nn's
interaction with the mini-inews.  It does, of course, require News::Article, 
available at a CPAN mirror near you (perl -MCPAN -e shell), is a little short 
on error messages, and isn't quite as user configurable as I'd like (but
anything more would take some configuration line parsing).

	Usage: inews [-h] [-u user] [-p pass] [-s server] [file]
All options are optional; if no file is offered, then it reads from STDIN.

			    - Tim Skirvin (tskirvin@killfile.org)
-- 
<URL:http://www.killfile.org/~tskirvin/> Skirv's Homepage <FISH><
<URL:http://www.killfile.org/dungeon/>	 The Killfile Dungeon <*>


#!/usr/bin/perl

use News::Article;
use Getopt::Std;
use strict;
use vars qw ($user $server $nntpuser $nntppass $opt_h $whoami 
	     $opt_u $opt_p $opt_s);

getopts('hu:p:s:');	

### Variables to set before using ########################################
$whoami = "/usr/ucb/whoami";	# The location of your 'whoami' binary.
$server = $ENV{'NNTPSERVER'} || "insert.default.here";
# $nntpuser = "DEFAULT"   # Uncomment these and set them to something real
# $nntppass = "DEFAULT"	  # if you want to use authentication by default
##########################################################################

$user = (`$whoami`);	
chomp($user);

$nntpuser = $opt_u if $opt_u;
$nntppass = $opt_p if $opt_p;
$server   = $opt_s if $opt_s;

my $article = new News::Article;
if (@ARGV) {
  my $file = shift;
  unless (-r $file) {
    print "No such file $file\n";
    exit;
  }
  $article->read($file);
} else {
  $article->read(\*STDIN);
}

$article->drop_headers("date");
$article->add_date;
$article->add_message_id ( "$user-" )  ;
$article->set_headers("X-Inews", "Skirv's Little nn inews replacement");

my $NNTP = Net::NNTP->new($server);
exit "Couldn't connect to server $server" unless $NNTP;
$NNTP->authinfo($nntpuser, $nntppass) 
	if ( defined($nntpuser) && defined($nntppass) );
$article->post($NNTP);

Technical Details
Message-ID: <tskirvin.951074776@yen-lo-wang.crhc.uiuc.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nn.mbox.zip!not-for-mail
References: <38a48359@news.iglou.com> <zZ1p4.3008$8p3.401782@ptah.visi.com> <88jinq$2ba$1@jadzia.cord.de>

Show Full Headers
Complete Article Headers
Message-ID: <tskirvin.951074776@yen-lo-wang.crhc.uiuc.edu>
Subject: Re: nn with authenticated login?
Date: Sun, 20 Feb 2000 00:00:00 +0000
From: tskirvin@killfile.org (Tim Skirvin)
References: <38a48359@news.iglou.com> <zZ1p4.3008$8p3.401782@ptah.visi.com> <88jinq$2ba$1@jadzia.cord.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nn.mbox.zip!not-for-mail
X-Deja-AN: 587632197
X-Inews: Skirv's Temporary NN inews replacement
X-Complaints-To: usenet@crhc.uiuc.edu
X-Trace: sephiroth.crhc.uiuc.edu 951075888 3670 130.126.141.117 (20 Feb 2000 19:44:48 GMT)
Organization: Center for Reliable and High-Performance Computing
X-Note: If you got this through mail, it was probably posted and mailed.
Reply-To: tskirvin@killfile.org
NNTP-Posting-Date: 20 Feb 2000 19:44:48 GMT
Newsgroups: news.software.nn