diff --git a/SABnzbd.py b/SABnzbd.py index 9cb30a8..def4cd1 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -68,7 +68,7 @@ import sabnzbd.interface from sabnzbd.constants import * import sabnzbd.newsunpack from sabnzbd.misc import get_user_shellfolders, launch_a_browser, real_path, \ - check_latest_version, panic_tmpl, panic_port, panic_fwall, panic_sqlite, panic, exit_sab, \ + check_latest_version, panic_tmpl, panic_port, panic_host, panic_fwall, panic_sqlite, panic, exit_sab, \ panic_xport, notify, split_host, get_ext, create_https_certificates, \ windows_variant, ip_extract, set_serv_parms, get_serv_parms, globber import sabnzbd.scheduler as scheduler @@ -289,12 +289,14 @@ def daemonize(): os.dup2(dev_null.fileno(), sys.stdin.fileno()) #------------------------------------------------------------------------------ -def Bail_Out(browserhost, cherryport, access=False): +def Bail_Out(browserhost, cherryport, err=''): """Abort program because of CherryPy troubles """ logging.error(Ta('Failed to start web-interface')) - if access: + if '13' in err: panic_xport(browserhost, cherryport) + elif '49' in err: + panic_host(browserhost, cherryport) else: panic_port(browserhost, cherryport) sabnzbd.halt() @@ -1296,8 +1298,7 @@ def main(): exit_sab(2) else: logging.debug("Failed to start web-interface: ", exc_info = True) - # When error 13 occurs, we have no access rights - Bail_Out(browserhost, cherryport, '13' in str(error)) + Bail_Out(browserhost, cherryport, str(error)) except socket.error, error: logging.debug("Failed to start web-interface: ", exc_info = True) Bail_Out(browserhost, cherryport, access=True) diff --git a/sabnzbd/misc.py b/sabnzbd/misc.py index ae22244..caad7a8 100644 --- a/sabnzbd/misc.py +++ b/sabnzbd/misc.py @@ -58,6 +58,7 @@ PANIC_FWALL = 4 PANIC_OTHER = 5 PANIC_XPORT = 6 PANIC_SQLITE = 7 +PANIC_HOST = 8 # Check if strings are defined for AM and PM HAVE_AMPM = bool(time.strftime('%p', time.localtime())) @@ -511,6 +512,18 @@ MSG_ILL_PORT = r''' If you get this error message again, please try a different number.
''' +MSG_BAD_HOST = r''' + SABnzbd needs a valid host address for its internal web server.
+ You have specified an invalid address.
+ Safe values are localhost and 0.0.0.0
+
+ Please restart SABnzbd with a proper host address.
+
+ %s
+     %s --server %s:%s
+
+''' + MSG_BAD_QUEUE = r''' SABnzbd detected saved data from an other SABnzbd version
but cannot re-use the data of the other program.

@@ -583,6 +596,8 @@ def panic_message(panic, a=None, b=None): msg = MSG_BAD_FWALL % "
" elif panic == PANIC_SQLITE: msg = MSG_SQLITE + elif panic == PANIC_HOST: + msg = MSG_BAD_HOST % (os_str, prog_path, 'localhost', b) else: msg = MSG_OTHER % (a, b) @@ -607,6 +622,9 @@ def panic_fwall(vista): def panic_port(host, port): launch_a_browser(panic_message(PANIC_PORT, host, port)) +def panic_host(host, port): + launch_a_browser(panic_message(PANIC_HOST, host, port)) + def panic_xport(host, port): launch_a_browser(panic_message(PANIC_XPORT, host, port)) logging.error(Ta('You have no permisson to use port %s'), port)