Thread View: news.software.nntp
16 messages
16 total messages
Started by Adam Bailey
Sun, 27 Dec 1998 00:00
inews-like program for non-local server?
Author: Adam Bailey
Date: Sun, 27 Dec 1998 00:00
Date: Sun, 27 Dec 1998 00:00
9 lines
709 bytes
709 bytes
Greets, I'm trying to find something that works along the lines of inews, but will connect to any server given on the command line. Does something like this exist? TIA!
Re: inews-like program for non-local server?
Author: Fluffy
Date: Mon, 28 Dec 1998 00:00
Date: Mon, 28 Dec 1998 00:00
67 lines
2878 bytes
2878 bytes
Fluffy <meowing@banet.net> wrote:
> Here's toy-inews which can do it. Needs Perl5 and the libnet bundle.
> Careful with the -D option. Unlike the INN inews, it does actually
> attempt to post.
Hmm. The authinfo stuff as-is won't be very nice if you're on a public
machine where people can see your command lines in ps. Here's some
stuff to make it use a file for that.
*** toy-inews.orig Sun Dec 27 21:11:54 1998
--- toy-inews Sun Dec 27 21:24:29 1998
***************
*** 8,12 ****
# toy-inews -snews.example.com .article # posts to news.foo.com
- # toy-inews -snews.example.com:username:password .article # with authinfo
# toy-inews -D .article # display the transaction for debugging
# toy-inews -S .article # append $HOME/.signature to article
--- 8,19 ----
# toy-inews -snews.example.com .article # posts to news.foo.com
# toy-inews -D .article # display the transaction for debugging
# toy-inews -S .article # append $HOME/.signature to article
+ #
+ # If you need authinfo, create a file $HOME/.toy-passwd and
+ # put this kind of information in it:
+ #
+ # foo.example.com:user:passwd
+ # news.example.net:username:password
+ #
+ # (just omit the ones that don't need authinfo.)
***************
*** 25,27 ****
my ($nntp, $infile, @article, $msgid, $idhdr, $result, $mod,
! $username, $password,
);
--- 32,34 ----
my ($nntp, $infile, @article, $msgid, $idhdr, $result, $mod,
! $username, $password, $foo,
);
***************
*** 37,40 ****
s/^-s//;
! ($nntpserver, $username, $password) = split /:/, $_;
}
}
--- 44,58 ----
s/^-s//;
! $nntpserver = $_;
}
+ }
+
+ if (open(TOYPASSWD, "$ENV{HOME}/.toy-passwd")) {
+ while (<TOYPASSWD>) {
+ if (/^$nntpserver:/) {
+ chomp;
+ ($foo, $username, $password) = split /:/;
+ last;
+ }
+ }
+ close(TOYPASSWD);
}
--
"FEAST!"
--Alice
Re: inews-like program for non-local server?
Author: Adam Bailey
Date: Mon, 28 Dec 1998 00:00
Date: Mon, 28 Dec 1998 00:00
21 lines
1414 bytes
1414 bytes
In article <766qcp$kvu@meow.invalid>, meowing@banet.net (Fluffy) wrote: > Fluffy <meowing@banet.net> wrote: >> Here's toy-inews which can do it. Needs Perl5 and the libnet bundle. >> Careful with the -D option. Unlike the INN inews, it does actually >> attempt to post. > > Hmm. The authinfo stuff as-is won't be very nice if you're on a public > machine where people can see your command lines in ps. Here's some > stuff to make it use a file for that. Am I correct in assuming that this doesn't matter if the news server doesn't require authorization? -- Adam Bailey | Chicago, Illinois adamb@tezcat.com | "Logic is the art of going wrong with adamkb@aol.com | confidence." - George Bernard Shaw Finger for PGP | http://www.tezcat.com/~adamb/
Re: inews-like program for non-local server?
Author: Fluffy
Date: Mon, 28 Dec 1998 00:00
Date: Mon, 28 Dec 1998 00:00
125 lines
3978 bytes
3978 bytes
Adam Bailey <adamb@tezcat.com> wrote:
> I'm trying to find something that works along the lines of inews,
> but will connect to any server given on the command line. Does
> something like this exist?
Here's toy-inews which can do it. Needs Perl5 and the libnet bundle.
Careful with the -D option. Unlike the INN inews, it does actually
attempt to post.
I'm assuming you're looking for a shell thingy, not a Mac thingy;
this will probably break on the latter.
#! /usr/local/bin/perl -w
#
# Usage:
#
# Unlike "real" inews programs, -h is always assumed, and you have
# to supply your own From: header.
#
# toy-inews -snews.example.com .article # posts to news.foo.com
# toy-inews -snews.example.com:username:password .article # with authinfo
# toy-inews -D .article # display the transaction for debugging
# toy-inews -S .article # append $HOME/.signature to article
require 5.004;
use Net::NNTP;
use strict;
### Plug in your domain (for message here. ###
my $domain = "meow.invalid";
### This is the default, override with -s ###
my $nntpserver = "news";
my $debug = 0;
my $signature = 0;
my ($nntp, $infile, @article, $msgid, $idhdr, $result, $mod,
$username, $password,
);
for (@ARGV) {
if (not /^-/) {
$infile = $_;
} elsif (/^-D/) {
$debug = 1;
} elsif (/^-S/) {
$signature = 1;
} elsif (/^-s/) {
s/^-s//;
($nntpserver, $username, $password) = split /:/, $_;
}
}
if ($infile) { open(STDIN, $infile) or die "can't open $infile, stopped" }
# Get message ID if present
HDRLINE: while (<STDIN>) {
last HDRLINE if (/^$/);
push @article, $_;
chomp;
$msgid = $1 if /^Message-ID:\s+(.+)/i;
}
# Generate a message ID if needed.
if (!$msgid) {
$msgid = innid($domain);
$idhdr = "Message-ID: " . $msgid . "\n";
}
# Write the article.
push @article, ($idhdr) if $idhdr;
push @article, "\n";
# the chomp then add back \n is to fix up files missing stuff.
while (<STDIN>) {
chomp;
push @article, $_ . "\n";
}
if ($signature) {
if (-s "$ENV{HOME}/.signature") {
push @article, "-- \n";
open(SIG, "$ENV{HOME}/.signature");
while (<SIG>) {
chomp;
push @article, $_ . "\n";
}
}
}
$nntp = Net::NNTP->new($nntpserver, "Debug", $debug);
if ($username && $password) {
die ("Authinfo failed") unless $nntp->authinfo($username, $password);
}
$result = $nntp->post(@article);
die "Posting failed :-( " unless $result;
exit 0;
# fin
# intcode: Convert an integer to an arbitrary character set
# $tm: integer to encode $alfa: character set string
sub intcode {
my $tm = shift;
my $alfa = shift;
my $id = "";
my $radix = length($alfa);
while (1 < $tm) {
$mod = $tm % $radix;
$id = substr($alfa, $mod, 1) . $id;
$tm = $tm / $radix;
}
return $id;
}
sub innid ($host) {
my $host = shift;
my $alphabet = "0123456789abcdefghijklmnopqrstuv";
return("<" . intcode(time - 673416000, $alphabet) . "\$" .
intcode($$, $alphabet) . "\@" . $host .">");
}
--
"FEAST!"
--Alice
Re: inews-like program for non-local server?
Author: Frank Slootweg
Date: Mon, 28 Dec 1998 00:00
Date: Mon, 28 Dec 1998 00:00
12 lines
938 bytes
938 bytes
It probably depends on the (INN) version or/and on how inews was compiled, but our local INN 1.4 version of inews seems to look at the NNTPSERVER variable:, i.e. export NNTPSERVER=whatever.you.want inews -h article Another possibility would be to (sed(1)) edit the /usr/local/news/inn.conf file (assuming INN does not run on the system on which you are using inews).
Re: inews-like program for non-local server?
Author: Adam Bailey
Date: Mon, 28 Dec 1998 00:00
Date: Mon, 28 Dec 1998 00:00
27 lines
1599 bytes
1599 bytes
In article <766mnm$kml@meow.invalid>, meowing@banet.net (Fluffy) wrote: > Adam Bailey <adamb@tezcat.com> wrote: >> I'm trying to find something that works along the lines of inews, >> but will connect to any server given on the command line. Does >> something like this exist? > > Here's toy-inews which can do it. Needs Perl5 and the libnet bundle. Running it gave me the following error: Can't locate Net/NNTP.pm in @INC (@INC contains: /usr/local/lib/perl5/sun4-sunos /5.00401 /usr/local/lib/perl5 /usr/local/lib/perl5/site_perl/sun4-sunos /usr/loc al/lib/perl5/site_perl .) at ../bin/toy-inews line 14. BEGIN failed--compilation aborted at ../bin/toy-inews line 14. Am I missing something I need? If so, where can it be found? Appreciate your assistance. -- Adam Bailey | Chicago, Illinois adamb@tezcat.com | "Logic is the art of going wrong with adamkb@aol.com | confidence." - George Bernard Shaw Finger for PGP | http://www.tezcat.com/~adamb/
Re: inews-like program for non-local server?
Author: Fluffy
Date: Mon, 28 Dec 1998 00:00
Date: Mon, 28 Dec 1998 00:00
27 lines
1908 bytes
1908 bytes
{posted and mailed so it doesn't get lost in the flood.}
Adam Bailey <adamb@tezcat.com> wrote:
> > Here's toy-inews which can do it. Needs Perl5 and the libnet bundle.
>
> Running it gave me the following error:
>
> Can't locate Net/NNTP.pm in @INC (@INC contains: /usr/local/lib/perl5/sun4-sunos
>
> Am I missing something I need? If so, where can it be found?
That's the libnet stuff I mentioned. I *wish* it came bundled with
Perl, though I suppose it's big enough already without it.
http://www.perl.com/CPAN-local//modules/by-module/Net/libnet-1.0606.tar.gz
(Not a bad download, only 55K.)
If you don't have root access to install the modules "properly" you can
put them in your own directory. See the perlfaq8 manpage -- the section
'How do I keep my own module/library directory?' -- if you haven't had
to do this before.
About the authinfo stuff and the patch: Sure, feel free to ignore it
all if you don't need to log into your posting servers.
Re: inews-like program for non-local server?
Author: Adam Bailey
Date: Tue, 29 Dec 1998 00:00
Date: Tue, 29 Dec 1998 00:00
44 lines
2196 bytes
2196 bytes
In message <76985t$309@meow.invalid>, Fluffy <meowing@banet.net> wrote... >Adam Bailey <adamb@tezcat.com> wrote: >> The first part went fine, but I don't know what to do with the use line. I >> tried attending it to toy-inews, but I get the error: > >Okay. To build libnet in your $HOME, you should have dome something >like: > > perl Makefile.PL prefix=/home/fluffy/perl > make Everything works up through here. > make install Writing /home4/adamb/bin/perl/lib/site_perl/sun4-sunos/auto/Net/.packlist sh: /home4/adamb/bin/perl/lib/sun4-sunos/5.00401/perllocal.pod: No such file or directory *** Error code 1 make: Fatal error: Command failed for target oc_site_install' >Then edit the script so the top lines look something like: > > require 5.004; > > # The 5.00blahblah stuff will depend on your perl version, > # so see what you've got under perl/lib/site_perl > use lib "/home/fluffy/perl/lib/site_perl/5.00554"; The only two items in my site_perl are directories named Net and a directory with the name of the local OS. But I presume it's because the make stopped early. Sorry to keep bothering you, I really am clueless when it comes to this stuff. I appreciate your patience. -- Adam Bailey | Chicago, Illinois adamb@tezcat.com | "Logic is the art of going wrong with adamkb@aol.com | confidence." - George Bernard Shaw Finger for PGP | http://www.tezcat.com/~adamb/
Re: inews-like program for non-local server?
Author: Fluffy
Date: Tue, 29 Dec 1998 00:00
Date: Tue, 29 Dec 1998 00:00
26 lines
1611 bytes
1611 bytes
Adam Bailey <adamb@tezcat.com> wrote: > The first part went fine, but I don't know what to do with the use line. I > tried attending it to toy-inews, but I get the error: Okay. To build libnet in your $HOME, you should have dome something like: perl Makefile.PL prefix=/home/fluffy/perl make make install Then edit the script so the top lines look something like: require 5.004; # The 5.00blahblah stuff will depend on your perl version, # so see what you've got under perl/lib/site_perl use lib "/home/fluffy/perl/lib/site_perl/5.00554"; use Net::NNTP; use strict; Isn't this *fun*?
Re: inews-like program for non-local server?
Author: Adam Bailey
Date: Tue, 29 Dec 1998 00:00
Date: Tue, 29 Dec 1998 00:00
34 lines
2153 bytes
2153 bytes
In article <yl1zljabhu.fsf@windlord.stanford.edu>, Russ Allbery <rra@stanford.edu> wrote: > Adam Bailey <adamb@tezcat.com> writes: > >> Writing /home4/adamb/bin/perl/lib/site_perl/sun4-sunos/auto/Net/.packlist >> sh: /home4/adamb/bin/perl/lib/sun4-sunos/5.00401/perllocal.pod: No such file >> or directory >> *** Error code 1 >> make: Fatal error: Command failed for target oc_site_install' > > You can probably safely ignore this error message, but if you want it to > go away, do: > > mkdir -p ~adamb/bin/perl/lib/sun4-sunos/5.00401 > touch ~adamb/bin/perl/lib/sun4-sunos/5.00401/perllocal.pod That appears to have worked, make install went off without a hitch. Thanks. Running toy-inews, however, still gives me an error: Can't locate Net/NNTP.pm in @INC (@INC contains: /home4/adamb/bin/perl/lib/sun4- sunos/5.00401 /usr/local/lib/perl5/sun4-sunos/5.00401 /usr/local/lib/perl5 /usr/ local/lib/perl5/site_perl/sun4-sunos /usr/local/lib/perl5/site_perl .) at /home4 /adamb/bin/toy-inews line 17. BEGIN failed--compilation aborted at /home4/adamb/bin/toy-inews line 17. -- Adam Bailey | Chicago, Illinois adamb@tezcat.com | "Logic is the art of going wrong with adamkb@aol.com | confidence." - George Bernard Shaw Finger for PGP | http://www.tezcat.com/~adamb/
Re: inews-like program for non-local server?
Author: Adam Bailey
Date: Tue, 29 Dec 1998 00:00
Date: Tue, 29 Dec 1998 00:00
51 lines
2752 bytes
2752 bytes
In message <769544$2jo@meow.invalid>, Fluffy <meowing@banet.net> wrote...
> Adam Bailey <adamb@tezcat.com> wrote:
>>> Here's toy-inews which can do it. Needs Perl5 and the libnet bundle.
>>
>> Running it gave me the following error:
>>
>> Can't locate Net/NNTP.pm in @INC (@INC contains: /usr/local/lib/perl5/sun4-sunos
>>
>> Am I missing something I need? If so, where can it be found?
>
> That's the libnet stuff I mentioned. I *wish* it came bundled with
> Perl, though I suppose it's big enough already without it.
>
> http://www.perl.com/CPAN-local//modules/by-module/Net/libnet-1.0606.tar.gz
>
> (Not a bad download, only 55K.)
>
> If you don't have root access to install the modules "properly" you can
> put them in your own directory. See the perlfaq8 manpage -- the section
> 'How do I keep my own module/library directory?' -- if you haven't had
> to do this before.
Okay, I went through all that. The one part of the man page I'm not
completely understanding is:
How do I keep my own module/library directory?
When you build modules, use the PREFIX option when generating Makefiles:
perl Makefile.PL PREFIX=/u/mydir/perl
then either set the PERL5LIB environment variable before you run scripts
that use the modules/libraries (see the perlrun manpage) or say
use lib /u/mydir/perl';
The first part went fine, but I don't know what to do with the use line. I
tried attending it to toy-inews, but I get the error:
Bareword found where operator expected at toy-inews line 14, near "/u/mydir"
(Missing operator before ydir?)
Unquoted string "ydir" may clash with future reserved word at toy-inews line 14.
syntax error at toy-inews line 14, near "/u/mydir"
Execution of toy-inews aborted due to compilation errors.
Was I supposed to substitute something there?
--
Adam Bailey | Chicago, Illinois
adamb@tezcat.com | "Logic is the art of going wrong with
adamkb@aol.com | confidence." - George Bernard Shaw
Finger for PGP | http://www.tezcat.com/~adamb/
Re: inews-like program for non-local server?
Author: Fluffy
Date: Mon, 04 Jan 1999 00:00
Date: Mon, 04 Jan 1999 00:00
14 lines
1368 bytes
1368 bytes
Russ Allbery <rra@stanford.edu> wrote: > env NNTPSERVER=server.to.connect.to inews -h INN's inews is painfully slow with a remote server if the link isn't fast or active is large, because it wants to send a 'list active' on every post to check for valid groups. And NNTPSERVER isn't going to work at all if your inews is the one that comes with C News. -- "REMEMBER TO WATER YOUR CAMEL AT LEAST EVERY THREE WEEKS OR IT WILL DIE!!!1!" -B. Eable
Re: inews-like program for non-local server?
Author: Volker Borchert
Date: Mon, 04 Jan 1999 00:00
Date: Mon, 04 Jan 1999 00:00
14 lines
1063 bytes
1063 bytes
In article <766g26$f6h$1@tepe.tezcat.com>, Adam Bailey <adamb@tezcat.com> writes: |> I'm trying to find something that works along the lines of inews, |> but will connect to any server given on the command line. Does |> something like this exist? Try ``rpost'' from the ``suck'' package. -- "I'm a doctor, not a mechanic." Dr Leonard McCoy <mccoy@ncc1701.starfleet.fed> "I'm a mechanic, not a doctor." Volker Borchert <bt@teknon.de>
Re: inews-like program for non-local server?
Author: Russ Allbery
Date: Mon, 04 Jan 1999 00:00
Date: Mon, 04 Jan 1999 00:00
12 lines
920 bytes
920 bytes
Adam Bailey <adamb@tezcat.com> writes: > I'm trying to find something that works along the lines of inews, but > will connect to any server given on the command line. Does something > like this exist? env NNTPSERVER=server.to.connect.to inews -h -- Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: inews-like program for non-local server?
Author: Russ Allbery
Date: Mon, 04 Jan 1999 00:00
Date: Mon, 04 Jan 1999 00:00
17 lines
1187 bytes
1187 bytes
Fluffy <gerglery@usa.net> writes:
> Russ Allbery <rra@stanford.edu> wrote:
>> env NNTPSERVER=server.to.connect.to inews -h
> INN's inews is painfully slow with a remote server if the link isn't
> fast or active is large, because it wants to send a 'list active' on
> every post to check for valid groups.
perl -MNet::NNTP -e '$n = Net::NNTP->new("server"); $n->post(<STDIN>)'
Error checking? Who needs error checking?
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: inews-like program for non-local server?
Author: Fluffy
Date: Mon, 04 Jan 1999 00:00
Date: Mon, 04 Jan 1999 00:00
17 lines
1626 bytes
1626 bytes
Russ Allbery <rra@stanford.edu> wrote:
> perl -MNet::NNTP -e '$n = Net::NNTP->new("server"); $n->post(<STDIN>)'
>
> Error checking? Who needs error checking?
Just append an 'or die' and all will be peachy keen.
The *really* silly thing about INN's inews is that it uses post, not
ihave, so all those checks are being done twice! I suppose this would
make some sense except that nnrpd already knows how to spool, and
you're not going to get far enough to spool if you can't list active in
the first place, so..........
--
"REMEMBER TO WATER YOUR CAMEL AT LEAST EVERY THREE
WEEKS OR IT WILL DIE!!!1!" -B. Eable
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