Re: Problem with nntplib.pl and innd under Solaris

Tim Nelson (tnelson@c3i.saic.com)
Thu, 29 Sep 94 08:23:47 EDT


> Okay, it seems like your nntp server provides a restricted set of commands
> for connection to it from the local machine. I presume that it expects
> the connector to read the local disk, and not have things transferred through
> the socket.
> 
> The solution for nntplib.pl is to change it to handle the case of being
> on the local machine and having the restricted set of commands. The accesses
> need to change to looking in the appropriate group under /usr/spool/news,
> e.g. comp.lang.perl -> /usr/spool/news/comp/lang/perl. It shouldn't
> be difficult to map the nntplib commands to this schema.
> 
> Note that the server still supports list, and to get from the message id
> to the file which it represents, you use xpath, e.g.
> 
> xpath <369ihe$2a7@eagle.c3i.saic.com>
> ->
> 223 org/all/nnnnn
> 
> where nnnnn is the number which is the filename.
> 
> If you make the changes, I'd be interested in seeing them. My news server does
> not do what yours seems to do. Connections from its local machine act in the
> same way as connections from remote machines.
> 

Your solution is probably a good general purpose fix however, I have found,
yet another option.  Once the connection to the innd has been made, I 
request the server to go to reader mode.  If the restrictions are properly
set for innd, this will be successful and restore the full set of commands.
I accomplished this by adding a function to the nntplib.pl as follows:

#Ensures the innd is in the correct mode
#will disconnect if it fails.
sub set_mode_reader {
    &check_connected('set_mode_reader');
    print NNTP_SERVER "mode reader\r\n";
    local($line);
    $line = <NNTP_SERVER>;
}   

I then make sure the innd server is in the correct mode prior to performing
the group or article command as follow:

#On success returns an array consisting of
#1. The estimated number of articles in group;
#2. First article number in the group;
#3. Last article number in the group.
#On failure, returns an empty array.
sub set_current_group {
    local($group) = @_;
#
#   this is my new function
#
    &set_mode_reader;       
    &check_connected('set_current_group');
    print NNTP_SERVER "GROUP $group\r\n";
    local($line);
    $line = <NNTP_SERVER>;
    print "Get Group Response: $line<br>\n" if Debug;
    $Last_Server_Status = $line;
    ($line =~ /^211 (\d+) (\d+) (\d+)/) || return ();
    $Current_group = $group;
    ($1,$2,$3);
}

If the mode command fails, or the client does not have the privilege to to
change mode, the server will close the socket so it is probably a good idea
to 'check_connected' following the mode command.

Tim 


----- End Included Message -----