Browse Source

Implement "send_group" and "ssl_type" per server instead of global.

pull/191/merge
shypike 11 years ago
parent
commit
9079c05b97
  1. 34
      interfaces/Config/templates/config_server.tmpl
  2. 15
      interfaces/Config/templates/config_switches.tmpl
  3. 45
      interfaces/Plush/templates/config_server.tmpl
  4. 21
      interfaces/Plush/templates/config_switches.tmpl
  5. 40
      interfaces/smpl/templates/config_server.tmpl
  6. 14
      interfaces/smpl/templates/config_switches.tmpl
  7. 10
      sabnzbd/__init__.py
  8. 5
      sabnzbd/cfg.py
  9. 8
      sabnzbd/config.py
  10. 11
      sabnzbd/downloader.py
  11. 8
      sabnzbd/interface.py
  12. 30
      sabnzbd/newswrapper.py
  13. 10
      sabnzbd/skintext.py
  14. 9
      sabnzbd/utils/servertests.py

34
interfaces/Config/templates/config_server.tmpl

@ -54,12 +54,29 @@
<input type="checkbox" name="ssl" id="ssl" value="1" <!--#if int($have_ssl) == 0 then "disabled=\"disabled\"" else ""#--> />
<span class="desc">$T('srv-ssl')</span>
</div>
<div class="field-pair <!--#if int($have_ssl) == 0 then "disabled" else ""#-->">
<label class="config" for="ssl_type">$T('srv-ssl_type')</label>
<!--#if int($have_ssl) == 1#-->
<select name="ssl_type" id="ssl_type">
<option value="t1" selected="selected" class="selected">TLS1</option>
<option value="v23">V23</option>
<option value="v2" >V2</option>
<option value="v3" >V3</option>
</select>
<!--#end if#-->
<span class="desc">$T('srv-explain-ssl_type')</span>
</div>
<div class="field-pair">
<label class="config" for="fillserver">$T('srv-fillserver')</label>
<input type="checkbox" name="fillserver" id="fillserver" value="1" />
<span class="desc">$T('srv-fillserver')</span>
</div>
<div class="field-pair alt">
<label class="config" for="send_group">$T('srv-send_group')</label>
<input type="checkbox" name="send_group" id="send_group" value="1" />
<span class="desc">$T('srv-explain-send_group')</span>
</div>
<div class="field-pair">
<label class="config" for="optional">$T('srv-optional')</label>
<input type="checkbox" name="optional" id="optional" value="1" />
<span class="desc">$T('srv-optional')</span>
@ -135,6 +152,18 @@
<input type="checkbox" name="ssl" id="ssl$cur" value="1" <!--#if int($servers[$server]['ssl']) != 0 and int($have_ssl) == 1 then 'checked="checked"' else ""#--> <!--#if int($have_ssl) == 0 then "disabled=\"disabled\"" else ""#--> />
<span class="desc">$T('srv-ssl')</span>
</div>
<div class="field-pair <!--#if int($have_ssl) == 0 then "disabled" else ""#-->">
<label class="config" for="ssl_type$cur">$T('srv-ssl_type')</label>
<!--#if int($have_ssl) == 1#-->
<select name="ssl_type" id="ssl_type$cur">
<option value="t1" <!--#if $servers[$server]['ssl_type'] == "t1" then 'selected="selected" class="selected"' else ""#--> >TLS1</option>
<option value="v23" <!--#if $servers[$server]['ssl_type'] == "v23" then 'selected="selected" class="selected"' else ""#--> >V23</option>
<option value="v2" <!--#if $servers[$server]['ssl_type'] == "v2" then 'selected="selected" class="selected"' else ""#--> >V2</option>
<option value="v3" <!--#if $servers[$server]['ssl_type'] == "v3" then 'selected="selected" class="selected"' else ""#--> >V3</option>
</select>
<!--#end if#-->
<span class="desc">$T('srv-explain-ssl_type')</span>
</div>
<div class="field-pair">
<label class="config" for="fillserver$cur">$T('srv-fillserver')</label>
<input type="checkbox" name="fillserver" id="fillserver$cur" value="1" <!--#if int($servers[$server]['fillserver']) != 0 then 'checked="checked"' else ""#--> />
@ -146,6 +175,11 @@
<span class="desc">$T('srv-optional')</span>
</div>
<div class="field-pair">
<label class="config" for="send_group$cur">$T('srv-send_group')</label>
<input type="checkbox" name="send_group" id="send_group$cur" value="1" <!--#if int($servers[$server]['send_group']) != 0 then 'checked="checked"' else ""#--> />
<span class="desc">$T('srv-explain-send_group')</span>
</div>
<div class="field-pair">
<input type="submit" value="$T('button-saveChanges')" class="saveButton" />
<input type="button" value="$T('button-testServer')" class="testServer" />
<input type="button" value="$T('button-delServer')" class="delServer" />

15
interfaces/Config/templates/config_switches.tmpl

@ -58,21 +58,6 @@
<span class="desc">$T('explain-auto_disconnect')</span>
</div>
<div class="field-pair">
<label class="config" for="send_group">$T('opt-send_group')</label>
<input type="checkbox" name="send_group" id="send_group" value="1" <!--#if int($send_group) > 0 then 'checked="checked"' else ""#--> />
<span class="desc">$T('explain-send_group')</span>
</div>
<div class="field-pair alt">
<label class="config" for="sec_type">$T('opt-sec_type')</label>
<select name="sec_type" id="sec_type">
<option value="t1" <!--#if $sec_type == "t1" then 'selected="selected" class="selected"' else ""#--> >TLS1</option>
<option value="v23" <!--#if $sec_type == "v23" then 'selected="selected" class="selected"' else ""#--> >V23</option>
<option value="v2" <!--#if $sec_type == "v2" then 'selected="selected" class="selected"' else ""#--> >V2</option>
<option value="v3" <!--#if $sec_type == "v3" then 'selected="selected" class="selected"' else ""#--> >V3</option>
</select>
<span class="desc">$T('explain-sec_type')</span>
</div>
<div class="field-pair">
<input type="submit" value="$T('button-saveChanges')" class="saveButton" />
</div>
</fieldset>

45
interfaces/Plush/templates/config_server.tmpl

@ -74,7 +74,7 @@
<span class="component-desc">&nbsp;</span>
</label>
</div>
<div class="field-pair alt">
<div class="field-pair">
<input type="checkbox" name="ssl" id="ssl" value="1" <!--#if int($have_ssl) == 0 then "disabled" else ""#-->/>
<label class="clearfix" for="ssl">
<span class="component-title">$T('srv-ssl')</span>
@ -82,6 +82,26 @@
</label>
</div>
<div class="field-pair alt">
<label class="clearfix" for="ssl_type">
<span class="component-title">$T('srv-ssl_type')</span>
<!--#if int($have_ssl) == 1#-->
<select name="ssl_type" id="ssl_type" class="select">
<option value="t1" selected> TLS1</option>
<option value="v23"> V23</option>
<option value="v2"> V2</option>
<option value="v3"> V3</option>
</select>
<!--#end if#-->
</label>
</div>
<div class="field-pair">
<input type="checkbox" name="send_group" id="send_group" value="1"/>
<label class="clearfix" for="send_group">
<span class="component-title">$T('srv-send_group')</span>
<span class="component-desc">&nbsp;</span>
</label>
</div>
<div class="field-pair alt">
<input type="checkbox" name="fillserver" id="fillserver" value="1"/>
<label class="clearfix" for="fillserver">
<span class="component-title">$T('srv-fillserver')</span>
@ -185,7 +205,7 @@
<span class="component-desc">&nbsp;</span>
</label>
</div>
<div class="field-pair alt">
<div class="field-pair">
<input type="checkbox" name="ssl" id="ssl" value="1" <!--#if int($servers[$server]['ssl']) != 0 and int($have_ssl) == 1 then "checked=1" else ""#--> <!--#if int($have_ssl) == 0 then "disabled" else ""#--> />
<label class="clearfix" for="ssl">
<span class="component-title">$T('srv-ssl')</span>
@ -193,6 +213,27 @@
</label>
</div>
<div class="field-pair alt">
<label class="clearfix" for="ssl_type">
<span class="component-title">$T('srv-ssl_type')</span>
<span class="component-desc">&nbsp;</span>
<!--#if int($have_ssl) == 1#-->
<select name="ssl_type" id="ssl_type">
<option value="t1" <!--#if $servers[$server]['ssl_type'] == "t1" then 'selected="selected" class="selected"' else ""#--> >TLS1</option>
<option value="v23" <!--#if $servers[$server]['ssl_type'] == "v23" then 'selected="selected" class="selected"' else ""#--> >V23</option>
<option value="v2" <!--#if $servers[$server]['ssl_type'] == "v2" then 'selected="selected" class="selected"' else ""#--> >V2</option>
<option value="v3" <!--#if $servers[$server]['ssl_type'] == "v3" then 'selected="selected" class="selected"' else ""#--> >V3</option>
</select>
<!--#end if#-->
</label>
</div>
<div class="field-pair">
<input type="checkbox" name="send_group" id="send_group" value="1" <!--#if int($servers[$server]['send_group']) != 0 then "checked=1" else ""#-->/>
<label class="clearfix" for="send_group">
<span class="component-title">$T('srv-send_group')</span>
<span class="component-desc">&nbsp;</span>
</label>
</div>
<div class="field-pair alt">
<input type="checkbox" name="fillserver" id="fillserver" value="1" <!--#if int($servers[$server]['fillserver']) != 0 then "checked=1" else ""#--> />
<label class="clearfix" for="fillserver">
<span class="component-title">$T('srv-fillserver')</span>

21
interfaces/Plush/templates/config_switches.tmpl

@ -68,27 +68,6 @@
<span class="component-desc">$T('explain-auto_disconnect')</span>
</label>
</div>
<div class="field-pair alt">
<input type="checkbox" name="send_group" id="send_group" value="1" <!--#if $send_group > 0 then "checked=1" else ""#--> />
<label class="clearfix" for="send_group">
<span class="component-title">$T('opt-send_group')</span>
<span class="component-desc">$T('explain-send_group')</span>
</label>
</div>
<div class="field-pair">
<label class="nocheck clearfix" for="sec_type">
<span class="component-title">$T('opt-sec_type')</span>
<select name="sec_type" id="sec_type">
<option value="v23" <!--#if $sec_type == "v23" then 'selected' else ''#--> >V23</option>
<option value="v2" <!--#if $sec_type == "v2" then 'selected' else ''#--> >V2</option>
<option value="v3" <!--#if $sec_type == "v3" then 'selected' else ''#--> >V3</option>
</select>
</label>
<label class="nocheck clearfix">
<span class="component-title">&nbsp;</span>
<span class="component-desc">$T('explain-sec_type')</span>
</label>
</div>
</fieldset>
</div><!-- /component-group2 -->

40
interfaces/smpl/templates/config_server.tmpl

@ -25,8 +25,29 @@
<label class="label">$T('srv-retention') ($T('days')):</label><input type="text" size="25" name="retention" value="$servers[$server]['retention']">
<br class="clear" />
<label><span class="label">$T('srv-ssl')<!--#if int($have_ssl) == 0 then $T('opt-notInstalled') else ""#-->:</span>
<input class="radio" type="checkbox" name="ssl" value="1" <!--#if int($servers[$server]['ssl']) != 0 and int($have_ssl) == 1 then "checked=1" else ""#--> <!--#if int($have_ssl) == 0 then "disabled" else ""#-->/>
<label><span class="label">$T('srv-ssl'):</span>
<!--#if int($have_ssl) == 1#-->
<input class="radio" type="checkbox" name="ssl" value="1" <!--#if int($servers[$server]['ssl']) != 0 and int($have_ssl) == 1 then "checked=1" else ""#--> <!--#if int($have_ssl) == 0 then "disabled" else ""#-->/>
<!--#else#-->
<i>$T('opt-notInstalled')</i>
<!--#end if#-->
</label><br class="clear" />
<label><span class="label">$T('srv-ssl_type'):</span>
<!--#if int($have_ssl) == 1#-->
<select name="ssl_type" id="ssl_type">
<option value="t1" <!--#if $servers[$server]['ssl_type'] == "t1" then 'selected="selected" class="selected"' else ""#--> >TLS1</option>
<option value="v23" <!--#if $servers[$server]['ssl_type'] == "v23" then 'selected="selected" class="selected"' else ""#--> >V23</option>
<option value="v2" <!--#if $servers[$server]['ssl_type'] == "v2" then 'selected="selected" class="selected"' else ""#--> >V2</option>
<option value="v3" <!--#if $servers[$server]['ssl_type'] == "v3" then 'selected="selected" class="selected"' else ""#--> >V3</option>
</select>
<!--#else#-->
<i>$T('opt-notInstalled')</i>
<!--#end if#-->
</label><br class="clear" />
<label><span class="label">$T('srv-send_group'):</span>
<input class="radio" type="checkbox" name="send_group" value="1" />
</label><br class="clear" />
<label><span class="label">$T('srv-fillserver'):</span>
@ -94,6 +115,21 @@
<input class="radio" type="checkbox" name="ssl" value="1" <!--#if int($have_ssl) == 0 then "disabled" else ""#-->></label>
<br class="clear" />
<label><span class="label">$T('srv-ssl_type')<!--#if int($have_ssl) == 0 then $T('opt-notInstalled') else ""#-->:</span>
<!--#if int($have_ssl) == 1#-->
<select name="sec_type" id="sec_type" class="select">
<option value="t1" selected> TLS1</option>
<option value="v23"> V23</option>
<option value="v2"> V2</option>
<option value="v3"> V3</option>
</select>
<!--#end if#-->
<br class="clear" />
<label><span class="label">$T('srv-send_group'):</span>
<input class="radio" type="checkbox" name="send_group" value="1"></label>
<br class="clear" />
<label><span class="label">$T('srv-fillserver'):</span>
<input class="radio" type="checkbox" name="fillserver" value="1"></label>
<br class="clear" />

14
interfaces/smpl/templates/config_switches.tmpl

@ -155,11 +155,6 @@
<span class="tips">$T('explain-auto_disconnect')</span></label>
<br class="clear" />
<label><span class="label">$T('opt-send_group'):</span>
<input class="radio" type="checkbox" name="send_group" value="1" <!--#if $send_group > 0 then 'checked="1"' else ""#--> />
<span class="tips">$T('explain-send_group')</span></label>
<br class="clear" />
<label><span class="label">$T('opt-auto_sort'):</span>
<input class="radio" type="checkbox" name="auto_sort" value="1" <!--#if $auto_sort > 0 then 'checked="1"' else ""#--> />
<span class="tips">$T('explain-auto_sort')</span></label>
@ -223,15 +218,6 @@
<span class="tips">$T('explain-ignore_samples')</span>
<br class="clear" />
<span class="label">$T('opt-sec_type'):</span>
<select name="sec_type" id="sec_type" class="select">
<option value="v23" <!--#if $sec_type == "v23" then 'selected' else ''#--> >V23</option>
<option value="v2" <!--#if $sec_type == "v2" then 'selected' else ''#--> >V2</option>
<option value="v3" <!--#if $sec_type == "v3" then 'selected' else ''#--> >V3</option>
</select>
<span class="tips">$T('explain-sec_type')</span>
<br class="clear" />
</fieldset>
<fieldset class="EntryFieldSet">

10
sabnzbd/__init__.py

@ -1,5 +1,5 @@
#!/usr/bin/python -OO
# Copyright 2008-2012 The SABnzbd-Team <team@sabnzbd.org>
# Copyright 2008-2014 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -237,14 +237,6 @@ def initialize(pause_downloader = False, clean_up = False, evalSched=False, repa
if not os.path.exists(path):
sabnzbd.misc.create_real_path(cfg.dirscan_dir.ident(), '', path, False)
### Convert ssl_type to sec_type (if still needed)
if cfg.ssl_type():
if cfg.ssl_type() == 'v2':
cfg.sec_type.set('v2')
else:
cfg.sec_type.set('t1')
cfg.ssl_type.set('')
### Set call backs for Config items
cfg.cache_limit.callback(new_limit)
cfg.cherryhost.callback(guard_restart)

5
sabnzbd/cfg.py

@ -1,5 +1,5 @@
#!/usr/bin/python -OO
# Copyright 2008-2012 The SABnzbd-Team <team@sabnzbd.org>
# Copyright 2008-2014 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -66,7 +66,6 @@ else:
#
quick_check = OptionBool('misc', 'quick_check', True)
fail_on_crc = OptionBool('misc', 'fail_on_crc', True)
send_group = OptionBool('misc', 'send_group', False)
sfv_check = OptionBool('misc', 'sfv_check', True)
email_server = OptionStr('misc', 'email_server', validation=validate_server)
@ -215,8 +214,6 @@ https_chain = OptionDir('misc','https_chain', create=False)
enable_https = OptionBool('misc', 'enable_https', False)
language = OptionStr('misc', 'language', 'en')
ssl_type = OptionStr('misc', 'ssl_type') # Obsolete variable, only used to seed 'sec_type'
sec_type = OptionStr('misc', 'sec_type', 't1')
unpack_check = OptionBool('misc', 'unpack_check', True)
no_penalties = OptionBool('misc', 'no_penalties', False)
randomize_server_ip = OptionBool('misc', 'randomize_server_ip', False)

8
sabnzbd/config.py

@ -1,5 +1,5 @@
#!/usr/bin/python -OO
# Copyright 2008-2012 The SABnzbd-Team <team@sabnzbd.org>
# Copyright 2008-2014 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -365,6 +365,8 @@ class ConfigServer(object):
self.enable = OptionBool(name, 'enable', True, add=False)
self.optional = OptionBool(name, 'optional', False, add=False)
self.retention = OptionNumber(name, 'retention', add=False)
self.ssl_type = OptionStr(name, 'ssl_type', 't1', add=False)
self.send_group = OptionBool(name, 'send_group', False, add=False)
self.set_dict(values)
add_to_database('servers', self.__name, self)
@ -372,7 +374,7 @@ class ConfigServer(object):
def set_dict(self, values):
""" Set one or more fields, passed as dictionary """
for kw in ('host', 'port', 'timeout', 'username', 'password', 'connections',
'fillserver', 'ssl', 'enable', 'optional', 'retention'):
'fillserver', 'ssl', 'ssl_type', 'send_group', 'enable', 'optional', 'retention'):
try:
value = values[kw]
except KeyError:
@ -398,6 +400,8 @@ class ConfigServer(object):
dict['enable'] = self.enable()
dict['optional'] = self.optional()
dict['retention'] = self.retention()
dict['ssl_type'] = self.ssl_type()
dict['send_group'] = self.send_group()
return dict
def delete(self):

11
sabnzbd/downloader.py

@ -1,5 +1,5 @@
#!/usr/bin/python -OO
# Copyright 2008-2012 The SABnzbd-Team <team@sabnzbd.org>
# Copyright 2008-2014 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -54,7 +54,7 @@ TIMER_LOCK = RLock()
#------------------------------------------------------------------------------
class Server(object):
def __init__(self, id, host, port, timeout, threads, fillserver, ssl, username = None,
def __init__(self, id, host, port, timeout, threads, fillserver, ssl, ssl_type, send_group, username = None,
password = None, optional=False, retention=0):
self.id = id
self.newid = None
@ -65,8 +65,10 @@ class Server(object):
self.threads = threads
self.fillserver = fillserver
self.ssl = ssl
self.ssl_type = ssl_type
self.optional = optional
self.retention = retention
self.send_group = send_group
self.username = username
self.password = password
@ -180,10 +182,12 @@ class Downloader(Thread):
fillserver = srv.fillserver()
primary = enabled and (not fillserver) and (threads > 0)
ssl = srv.ssl() and sabnzbd.newswrapper.HAVE_SSL
ssl_type = srv.ssl_type()
username = srv.username()
password = srv.password()
optional = srv.optional()
retention = float(srv.retention() * 24 * 3600) # days ==> seconds
send_group = srv.send_group()
create = True
if oldserver:
@ -198,6 +202,7 @@ class Downloader(Thread):
if create and enabled and host and port and threads:
self.servers.append(Server(newserver, host, port, timeout, threads, fillserver, ssl,
ssl_type, send_group,
username, password, optional, retention))
return primary
@ -705,7 +710,7 @@ class Downloader(Thread):
def __request_article(self, nw):
try:
nzo = nw.article.nzf.nzo
if cfg.send_group() and nzo.group != nw.group:
if nw.server.send_group and nzo.group != nw.group:
group = nzo.group
if sabnzbd.LOG_ALL:
logging.debug('Thread %s@%s: GROUP <%s>', nw.thrdnum, nw.server.id, group)

8
sabnzbd/interface.py

@ -1,5 +1,5 @@
#!/usr/bin/python -OO
# Copyright 2008-2012 The SABnzbd-Team <team@sabnzbd.org>
# Copyright 2008-2014 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -1173,11 +1173,11 @@ class ConfigFolders(object):
SWITCH_LIST = \
('par2_multicore', 'par_option', 'enable_unrar', 'enable_unzip', 'enable_filejoin',
'enable_tsjoin', 'send_group', 'fail_on_crc', 'top_only',
'enable_tsjoin', 'fail_on_crc', 'top_only',
'auto_sort', 'check_new_rel', 'auto_disconnect', 'flat_unpack',
'safe_postproc', 'no_dupes', 'replace_spaces', 'replace_dots', 'replace_illegal', 'auto_browser',
'ignore_samples', 'pause_on_post_processing', 'quick_check', 'nice', 'ionice',
'sec_type', 'pre_script', 'pause_on_pwrar', 'ampm', 'sfv_check', 'folder_rename',
'pre_script', 'pause_on_pwrar', 'ampm', 'sfv_check', 'folder_rename',
'unpack_check', 'quota_size', 'quota_day', 'quota_resume', 'quota_period',
'pre_check', 'max_art_tries', 'max_art_opt', 'fail_hopeless', 'enable_7zip', 'enable_all_par',
'enable_recursive', 'no_series_dupes',
@ -1653,7 +1653,7 @@ def handle_server(kwargs, root=None, new_svr=False):
if new_svr:
server = unique_svr_name(server)
for kw in ('fillserver', 'ssl', 'enable', 'optional'):
for kw in ('fillserver', 'ssl', 'send_group', 'enable', 'optional'):
if kw not in kwargs.keys():
kwargs[kw] = None
if svr and not new_svr:

30
sabnzbd/newswrapper.py

@ -1,5 +1,5 @@
#!/usr/bin/python -OO
# Copyright 2008-2012 The SABnzbd-Team <team@sabnzbd.org>
# Copyright 2008-2014 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -150,8 +150,15 @@ def con(sock, host, port, sslenabled, write_fds, nntp):
except _ssl.Error, e:
nntp.error(e)
_SSL_TYPES = {
't1' : _ssl.TLSv1_METHOD,
'v2' : _ssl.SSLv2_METHOD,
'v3' : _ssl.SSLv3_METHOD,
'v23': _ssl.SSLv23_METHOD
}
class NNTP(object):
def __init__(self, host, port, info, sslenabled, nw, user=None, password=None, block=False, write_fds=None):
def __init__(self, host, port, info, sslenabled, ssl_type, send_group, nw, user=None, password=None, block=False, write_fds=None):
assert isinstance(nw, NewsWrapper)
self.host = host
self.port = port
@ -167,17 +174,7 @@ class NNTP(object):
af, socktype, proto, canonname, sa = info[0]
if sslenabled and _ssl:
# Some users benefit from SSLv2 not being capped.
ssl_type = sabnzbd.cfg.sec_type.get()
if ssl_type == 't1' and hasattr(_ssl, 'TLSv1_METHOD'):
ctx = _ssl.Context(_ssl.TLSv1_METHOD)
elif ssl_type == 'v2':
ctx = _ssl.Context(_ssl.SSLv2_METHOD)
elif ssl_type == 'v3':
ctx = _ssl.Context(_ssl.SSLv3_METHOD)
else:
ctx = _ssl.Context(_ssl.SSLv23_METHOD)
ctx = _ssl.Context(_SSL_TYPES.get(ssl_type, _ssl.TLSv1_METHOD))
self.sock = SSLConnection(ctx, socket.socket(af, socktype, proto))
elif sslenabled and not _ssl:
logging.error(T('Error importing OpenSSL module. Connecting with NON-SSL'))
@ -224,8 +221,8 @@ class NNTP(object):
self.error(e)
def error(self, error):
if 'SSL23_GET_SERVER_HELLO' in str(error):
error = 'This server does not allow SSL on this port'
if 'SSL23_GET_SERVER_HELLO' in str(error) or 'SSL3_GET_RECORD' in str(error):
error = T('This server does not allow SSL on this port')
msg = "Failed to connect: %s" % (str(error))
msg = "%s %s@%s:%s" % (msg, self.nw.thrdnum, self.host, self.port)
self.error_msg = msg
@ -261,7 +258,8 @@ class NewsWrapper(object):
self.force_login = False
def init_connect(self, write_fds):
self.nntp = NNTP(self.server.hostip, self.server.port, self.server.info, self.server.ssl, self,
self.nntp = NNTP(self.server.hostip, self.server.port, self.server.info, self.server.ssl,
self.server.ssl_type, self.server.send_group, self,
self.server.username, self.server.password, self.blocking, write_fds)
self.recv = self.nntp.sock.recv

10
sabnzbd/skintext.py

@ -1,6 +1,6 @@
#!/usr/bin/python -OO
# -*- coding: UTF-8 -*-
# Copyright 2012 The SABnzbd-Team <team@sabnzbd.org>
# Copyright 2012-2014 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -455,8 +455,6 @@ SKIN_TEXT = {
'otherSwitches' : TT('Other Switches'),
'opt-auto_disconnect' : TT('Disconnect on Empty Queue'),
'explain-auto_disconnect' : TT('Disconnect from Usenet server(s) when queue is empty or paused.'),
'opt-send_group' : TT('Send Group'),
'explain-send_group' : TT('Send group command before requesting articles.'),
'opt-auto_sort' : TT('Sort by Age'),
'explain-auto_sort' : TT('Automatically sort items by (average) age.'),
'opt-check_new_rel' : TT('Check for New Release'),
@ -479,8 +477,6 @@ SKIN_TEXT = {
'igsam-off' : TT('Off'),
'igsam-del' : TT('Delete after download'),
'igsam-not' : TT('Do not download'),
'opt-sec_type' : TT('SSL type'),
'explain-sec_type' : TT('Use T1 unless your provider requires otherwise!'),
'opt-ampm' : TT('Use 12 hour clock (AM/PM)'),
'explain-ampm' : TT('Show times in AM/PM notation (does not affect scheduler).'),
'swtag-general' : TT('General'),
@ -522,6 +518,8 @@ SKIN_TEXT = {
'srv-fillserver' : TT('Backup server'), #: Backup server tickbox
'srv-optional' : TT('Optional'), #: Server optional tickbox
'srv-enable' : TT('Enable'), #: Enable server tickbox
'srv-ssl_type' : TT('SSL type'),
'srv-explain-ssl_type' : TT('Use TLS1 unless your provider requires otherwise!'),
'button-addServer' : TT('Add Server'), #: Button: Add server
'button-delServer' : TT('Remove Server'), #: Button: Remove server
'button-testServer' : TT('Test Server'), #: Button: Test server
@ -529,6 +527,8 @@ SKIN_TEXT = {
'srv-testing' : TT('Testing server details...'),
'srv-testHint' : TT('Click below to test.'),
'srv-bandwidth' : TT('Bandwidth'),
'srv-send_group' : TT('Send Group'),
'srv-explain-send_group' : TT('Send group command before requesting articles.'),
# Config->Scheduling
'configSchedule' : TT('Scheduling configuration'), #:Config->Scheduling

9
sabnzbd/utils/servertests.py

@ -1,5 +1,5 @@
#!/usr/bin/python -OO
# Copyright 2008-2012 The SABnzbd-Team <team@sabnzbd.org>
# Copyright 2008-2014 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -40,6 +40,7 @@ def test_nntp_server_dict(kwargs):
if not connections:
return False, T('There are no connections set. Please set at least one connection.')
ssl = int_conv(kwargs.get('ssl', 0))
ssl_type = kwargs.get('ssl_type', 't1')
port = int_conv(kwargs.get('port', 0))
if not port:
if ssl:
@ -49,10 +50,10 @@ def test_nntp_server_dict(kwargs):
return test_nntp_server(host, port, server, username=username, \
password=password, ssl=ssl)
password=password, ssl=ssl, ssl_type=ssl_type)
def test_nntp_server(host, port, server=None, username=None, password=None, ssl=None):
def test_nntp_server(host, port, server=None, username=None, password=None, ssl=None, ssl_type='t1'):
''' Will connect (blocking) to the nttp server and report back any errors '''
timeout = 4.0
if '*' in password and not password.strip('*'):
@ -73,7 +74,7 @@ def test_nntp_server(host, port, server=None, username=None, password=None, ssl=
if not got_pass:
return False, T('Password masked in ******, please re-enter')
try:
s = Server(-1, host, port, timeout, 0, 0, ssl, username, password)
s = Server(-1, host, port, timeout, 0, 0, ssl, ssl_type, False, username, password)
except:
return False, T('Invalid server details')

Loading…
Cancel
Save