Package: sinntp
Version: 1.4-1
Severity: wishlist
Tags: patch
Hi,
By default, if a user does not provide credentials for a server, python
nntplib will try to get them from ~/.netrc. With the attached patch, the
user can specify if this behaviour is desired.
Use case:
a) server which allows credential and IP-address based access.
The latter doesn't need credentials but if they are provided, they
have to match. nntplib tries netrc and if nothing else matches, it
takes the default entry - if this entry happens to not match, the
connection will be refused even if it would be accepted without any
credentials.
b) server which delivers only some informative groups to users without
credentials but refuses connection with wrong credentials.
Regards,
Dirk
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 3.2.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages sinntp depends on:
ii python 2.7.2-10
ii python-support 1.0.14
ii python-xdg 0.19-4
sinntp recommends no packages.
sinntp suggests no packages.
-- no debconf information
--- orig/sinntp 2011-07-27 00:00:00.000000000 +0200
+++ new/sinntp 2012-04-15 19:20:19.229893397 +0200
@@ -111,6 +111,7 @@
o.add_argument('-S', '--server', metavar='HOST[:PORT]', dest='server', action='store', help='specify server address')
o.add_argument('-U', '--username', dest='username', action='store', help='specify username')
o.add_argument('-P', '--password', dest='password', action='store', help='specify password')
+ o.add_argument('-n', '--nonetrc', dest='netrc', action='store_false', help='ignore credentials in ~/.netrc')
o.add_argument('-t', '--timeout', dest='timeout', action='store', type=int, help='specify connection timeout')
return o
@@ -338,7 +339,7 @@
socket.setdefaulttimeout(command.options.timeout)
try:
logging.info('Connecting to %s:%d...', host, port)
- connection = NNTP(host, port=port, user=command.options.username, password=command.options.password, readermode=True)
+ connection = NNTP(host, port=port, user=command.options.username, password=command.options.password, readermode=True, usenetrc=command.options.netrc)
except socket.error, e:
logging.error('Could not connect to %s:%d: %s', host, port, e[1])
sys.exit(3)