[Python-bugs-list] [Bug #123625] "authinfo" belongs before "mode reader" in nntplib.py

noreply@sourceforge.net noreply@sourceforge.net
Mon, 15 Jan 2001 23:58:34 -0800


Bug #123625, was updated on 2000-Nov-27 12:20
Here is a current snapshot of the bug.

Project: Python
Category: Python Library
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 5
Submitted by: mogul
Assigned to : twouters
Summary: "authinfo" belongs before "mode reader" in nntplib.py

Details: On some secure news servers (Netcape Collabra in this case), a
client cannot even set "mode reader" before providing authentication
information.  If you have Mailman attempt to gate news from such a server,
it will error with an entry such as this in the logs: 

Nov 27 11:01:44 2000 gate_news(9768): Traceback (innermost last):
Nov 27 11:01:44 2000 gate_news(9768):   File
"/usr/share/mailman/cron/gate_news", line 222, in ?
Nov 27 11:01:44 2000 gate_news(9768):      main()
Nov 27 11:01:44 2000 gate_news(9768):   File
"/usr/share/mailman/cron/gate_news", line 203, in main
Nov 27 11:01:44 2000 gate_news(9768):      process_lists(lock)
Nov 27 11:01:44 2000 gate_news(9768):   File
"/usr/share/mailman/cron/gate_news", line 148, in process_lists
Nov 27 11:01:44 2000 gate_news(9768):      conn, first, last =
open_newsgroup(mlist)
Nov 27 11:01:44 2000 gate_news(9768):   File
"/usr/share/mailman/cron/gate_news", line 75, in open_newsgroup
Nov 27 11:01:44 2000 gate_news(9768):      password=mm_cfg.NNTP_PASSWORD)
Nov 27 11:01:44 2000 gate_news(9768):   File
"/usr/share/mailman/Mailman/pythonlib/nntplib.py", line 117, in __init__
Nov 27 11:01:44 2000 gate_news(9768):      self.welcome =
self.shortcmd('mode reader')
Nov 27 11:01:44 2000 gate_news(9768):   File
"/usr/share/mailman/Mailman/pythonlib/nntplib.py", line 210, in shortcmd
Nov 27 11:01:44 2000 gate_news(9768):      return self.getresp()
Nov 27 11:01:44 2000 gate_news(9768):   File
"/usr/share/mailman/Mailman/pythonlib/nntplib.py", line 184, in getresp
Nov 27 11:01:44 2000 gate_news(9768):      raise NNTPTemporaryError(resp)
Nov 27 11:01:44 2000 gate_news(9768): Mailman.pythonlib.nntplib .
NNTPTemporaryError :  480 Authentication required for command 


My solution: Move these lines...

	if readermode:
		try:
                         	self.welcome = self.shortcmd('mode reader')
	except NNTPPermanentError:
	# error 500, probably 'not implemented'
            		pass

to the end of NNTP's constructor, in other words, after the authinfo
exchange is done.

Bret

Follow-Ups:

Date: 2001-Jan-15 23:58
By: mogul

Comment:
Works like crazy!  Thanks a ton, guys.
-------------------------------------------------------

Date: 2001-Jan-15 22:40
By: twouters

Comment:
I've checked in a fix in revision 1.23 of Lib/nntplib.py. It should work,
but I haven't been able to test it for the case it fixes. Mogul, maybe you
can test this ? You should be able to grab the nntplib.py file from the CVS
tree (using a CVS client, or the SourceForge CVSWeb page. Just replace the
old nntplib.py in Mailman/pythonlib with the new one.

Barry, if you are going to release a Mailman 2.0.2, you probably want to
grab this revision and dump it in pythonlib/ -- it should work with Python
1.5.2. 

-------------------------------------------------------

Date: 2001-Jan-15 15:28
By: twouters

Comment:
Yes, after consulting with two INN/NNTP experts (or at least practitioners
:) I'm now sure of my case. Some versions/installations/configurations of
INN need 'mode reader' *before* authinfo, because 'mode reader' simply
spawns 'nnrpd', losing the previously passed authinfo.

I'll check in the workaround I suggested (try mode reader, catch autherror
and send authinfo (if any)) sometime tomorrow or tonight.

-------------------------------------------------------

Date: 2001-Jan-03 15:52
By: twouters

Comment:
It's not so simple :-( I already forgot all this stuff again, but here's
what I remember: The reader-mode isn't covered by the RFC on NNTP (which is
pretty old) but is basically yet another addition by INN (IIRC, that is).
We had one particular setup where readmode really was necessary before
anything else, including, IIRC, authinfo. That was because the nnrpd that
could handle all that wasn't spawned until you gave the 'mode reader'
command, and it couldn't pass that info. However, I need to doublecheck to
be sure. I think we dropped most of that intricate setup when we built our
new set of top-of-the-line newsservers using Diablo rather than INN.

I'll consult with a couple of local news guru's tomorrow, see if I'm not
remembering wrong. If I'm not, we may have to do some dancing around by
sending readermode, catching autherror, and re-sending after authinfo in
that case.

-------------------------------------------------------

Date: 2001-Jan-03 14:08
By: gvanrossum

Comment:
Thomas, you seem to be the author of the readermode code.

I was going to just check in the suggested change, but when I read the CVS
logs, it mentioned that "mode reader" was sent before authentication, so
perhaps there's a reason.

If you agree with the suggestion here, please go ahead and check it in --
no need to go through the patch manager.
-------------------------------------------------------

Date: 2001-Jan-02 22:30
By: bwarsaw

Comment:
This is more accurately a bug in Python's nntplib.py
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=123625&group_id=5470