From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Mar 10 17:20:03 2014 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C31F15B1 for ; Mon, 10 Mar 2014 17:20:03 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AE9AE3A6 for ; Mon, 10 Mar 2014 17:20:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s2AHK38b062248 for ; Mon, 10 Mar 2014 17:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s2AHK3HE062247; Mon, 10 Mar 2014 17:20:03 GMT (envelope-from gnats) Date: Mon, 10 Mar 2014 17:20:03 GMT Message-Id: <201403101720.s2AHK3HE062247@freefall.freebsd.org> To: freebsd-ports-bugs@FreeBSD.org Cc: From: Shane Ambler Subject: Re: ports/187408: [PATCH] security/denyhosts: set USE_PYTHON=2 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Shane Ambler List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Mar 2014 17:20:03 -0000 The following reply was made to PR ports/187408; it has been noted by GNATS. From: Shane Ambler To: bug-followup@FreeBSD.org, corsmith@gmail.com, jmohacsi@bsd.hu Cc: Subject: Re: ports/187408: [PATCH] security/denyhosts: set USE_PYTHON=2 Date: Tue, 11 Mar 2014 03:42:32 +1030 This is a multi-part message in MIME format. --------------050709070807040202090809 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Another possibility is to update so that python 2.x and 3.x compatible syntax is used. The attached patch allows denyhosts to compile and run with py2.7 or py3.3 Someone with a bit more knowledge should also look through the changes. I have also included minor updates - - add LICENSE - support staging - change NOPORTDOCS to PORT_OPTIONS:MDOCS --------------050709070807040202090809 Content-Type: text/plain; charset=UTF-8; name="denyhosts.patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="denyhosts.patch.txt" diff -Nru denyhosts.orig/Makefile denyhosts/Makefile --- denyhosts.orig/Makefile 2014-03-11 03:17:39.277186532 +1030 +++ denyhosts/Makefile 2014-03-11 03:15:34.074186620 +1030 @@ -11,7 +11,10 @@ MAINTAINER= jmohacsi@bsd.hu COMMENT= Script to thwart ssh attacks +LICENSE= GPLv2 + USE_PYTHON= yes +PYTHON_PY3K_PLIST_HACK= yes USE_PYDISTUTILS= yes PYDISTUTILS_PKGNAME= DenyHosts @@ -21,7 +24,8 @@ PORTDOCS= CHANGELOG.txt LICENSE.txt README.txt -NO_STAGE= yes +.include + post-patch: @${REINPLACE_CMD} -e 's,%%PREFIX%%,${PREFIX},' \ ${WRKSRC}/daemon-control-dist \ @@ -30,13 +34,13 @@ @${RM} ${WRKSRC}/scripts/restricted_from_passwd.py.orig post-install: - ${INSTALL_DATA} ${WRKSRC}/denyhosts.cfg-dist ${PREFIX}/etc/denyhosts.conf-dist - [ -f ${PREFIX}/etc/denyhosts.conf ] || \ - ${INSTALL_DATA} ${WRKSRC}/denyhosts.cfg-dist ${PREFIX}/etc/denyhosts.conf -.if !defined(NOPORTDOCS) - @${MKDIR} ${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/denyhosts.cfg-dist ${STAGEDIR}${PREFIX}/etc/denyhosts.conf-dist + [ -f ${STAGEDIR}${PREFIX}/etc/denyhosts.conf ] || \ + ${INSTALL_DATA} ${WRKSRC}/denyhosts.cfg-dist ${STAGEDIR}${PREFIX}/etc/denyhosts.conf +.if ${PORT_OPTIONS:MDOCS} + @${MKDIR} ${STAGEDIR}${DOCSDIR} . for f in ${PORTDOCS} - ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR} . endfor .endif @${CAT} ${PKGMESSAGE} diff -Nru denyhosts.orig/files/patch-DenyHosts__allowedhosts.py denyhosts/files/patch-DenyHosts__allowedhosts.py --- denyhosts.orig/files/patch-DenyHosts__allowedhosts.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__allowedhosts.py 2014-03-11 01:05:15.301186828 +1030 @@ -0,0 +1,47 @@ +--- ./DenyHosts/allowedhosts.py.orig 2006-04-27 06:56:41.000000000 +0930 ++++ ./DenyHosts/allowedhosts.py 2014-03-11 00:58:07.865186054 +1030 +@@ -1,11 +1,12 @@ ++from __future__ import print_function; + import os + from socket import getfqdn, gethostbyname + import logging + + +-from constants import ALLOWED_HOSTS, ALLOWED_WARNED_HOSTS +-from regex import ALLOWED_REGEX +-from util import is_true ++from DenyHosts.constants import ALLOWED_HOSTS, ALLOWED_WARNED_HOSTS ++from DenyHosts.regex import ALLOWED_REGEX ++from DenyHosts.util import is_true + + debug = logging.getLogger("AllowedHosts").debug + +@@ -28,14 +29,14 @@ + else: return 0 + + def dump(self): +- print "Dumping AllowedHosts" +- print self.allowed_hosts.keys() ++ print("Dumping AllowedHosts") ++ print(self.allowed_hosts.keys()) + + + def load_hosts(self): + try: + fp = open(self.allowed_path, "r") +- except Exception, e: ++ except Exception as e: + debug("Could not open %s - %s", self.allowed_path, str(e)) + return + +@@ -117,8 +118,8 @@ + for host in self.new_warned_hosts: + fp.write("%s\n" % host) + fp.close() +- except Exception, e: +- print e ++ except Exception as e: ++ print(e) + + + def clear_warned_hosts(self): diff -Nru denyhosts.orig/files/patch-DenyHosts__counter.py denyhosts/files/patch-DenyHosts__counter.py --- denyhosts.orig/files/patch-DenyHosts__counter.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__counter.py 2014-03-11 01:05:15.280187088 +1030 @@ -0,0 +1,21 @@ +--- ./DenyHosts/counter.py.orig 2006-02-09 11:47:24.000000000 +1030 ++++ ./DenyHosts/counter.py 2014-03-11 00:58:08.068187190 +1030 +@@ -14,6 +14,9 @@ + + def __str__(self): + return "%d:%s" % (self.__count, self.__date) ++ ++ def __int__(self): ++ return self.__count + + def __repr__(self): + return "CountRecord <%d - %s>" % (self.__count, self.__date) +@@ -33,7 +36,7 @@ + self.__count = 0 + + def age_count(self, age): +- cutoff = long(time.time()) - age ++ cutoff = time.time() - age + epoch = time.mktime(time.strptime(self.__date)) + #debug("cutoff : %d", cutoff) + #debug("epoch : %d", epoch) diff -Nru denyhosts.orig/files/patch-DenyHosts__daemon.py denyhosts/files/patch-DenyHosts__daemon.py --- denyhosts.orig/files/patch-DenyHosts__daemon.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__daemon.py 2014-03-11 01:05:15.265186735 +1030 @@ -0,0 +1,20 @@ +--- ./DenyHosts/daemon.py.orig 2005-12-17 09:15:00.000000000 +1030 ++++ ./DenyHosts/daemon.py 2014-03-11 00:58:08.110185890 +1030 +@@ -37,7 +37,7 @@ + # the child gets a new PID, making it impossible for its PID to equal its + # PGID. + pid = os.fork() +- except OSError, e: ++ except OSError as e: + return((e.errno, e.strerror)) # ERROR (return a tuple) + + if (pid == 0): # The first child. +@@ -62,7 +62,7 @@ + # fork guarantees that the child is no longer a session leader, thus + # preventing the daemon from ever acquiring a controlling terminal. + pid = os.fork() # Fork a second child. +- except OSError, e: ++ except OSError as e: + return((e.errno, e.strerror)) # ERROR (return a tuple) + + if (pid == 0): # The second child. diff -Nru denyhosts.orig/files/patch-DenyHosts__deny_hosts.py denyhosts/files/patch-DenyHosts__deny_hosts.py --- denyhosts.orig/files/patch-DenyHosts__deny_hosts.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__deny_hosts.py 2014-03-11 01:05:15.304187123 +1030 @@ -0,0 +1,118 @@ +--- ./DenyHosts/deny_hosts.py.orig 2006-11-10 14:55:38.000000000 +1030 ++++ ./DenyHosts/deny_hosts.py 2014-03-11 00:58:08.131186005 +1030 +@@ -1,3 +1,4 @@ ++from __future__ import print_function + import os, sys + import string + import time +@@ -16,23 +17,23 @@ + from stat import ST_SIZE, ST_INO + import re + +-from util import die, is_true, is_false, send_email +-from allowedhosts import AllowedHosts +-from loginattempt import LoginAttempt +-from lockfile import LockFile +-from filetracker import FileTracker +-from prefs import Prefs +-from report import Report +-from version import VERSION +-from constants import * +-from regex import * +-from daemon import createDaemon +-from denyfileutil import Purge +-from util import parse_host +-from version import VERSION +-from sync import Sync +-from restricted import Restricted +-import plugin ++from DenyHosts.util import die, is_true, is_false, send_email ++from DenyHosts.allowedhosts import AllowedHosts ++from DenyHosts.loginattempt import LoginAttempt ++from DenyHosts.lockfile import LockFile ++from DenyHosts.filetracker import FileTracker ++from DenyHosts.prefs import Prefs ++from DenyHosts.report import Report ++from DenyHosts.version import VERSION ++from DenyHosts.constants import * ++from DenyHosts.regex import * ++from DenyHosts.daemon import createDaemon ++from DenyHosts.denyfileutil import Purge ++from DenyHosts.util import parse_host ++from DenyHosts.version import VERSION ++from DenyHosts.sync import Sync ++from DenyHosts.restricted import Restricted ++import DenyHosts.plugin + + debug = logging.getLogger("denyhosts").debug + info = logging.getLogger("denyhosts").info +@@ -62,7 +63,7 @@ + try: + self.file_tracker = FileTracker(self.__prefs.get('WORK_DIR'), + logfile) +- except Exception, e: ++ except Exception as e: + self.__lock_file.remove() + die("Can't read: %s" % logfile, e) + +@@ -239,7 +240,7 @@ + try: + purge = Purge(self.__prefs, + purge_time) +- except Exception, e: ++ except Exception as e: + logging.getLogger().exception(e) + raise + self.purge_counter = 0 +@@ -261,7 +262,7 @@ + self.get_denied_hosts() + self.update_hosts_deny(new_hosts) + sync.xmlrpc_disconnect() +- except Exception, e: ++ except Exception as e: + logging.getLogger().exception(e) + raise + self.sync_counter = 0 +@@ -308,10 +309,10 @@ + try: + fp = open(self.__prefs.get('HOSTS_DENY'), "a") + status = 1 +- except Exception, e: +- print e +- print "These hosts should be manually added to", +- print self.__prefs.get('HOSTS_DENY') ++ except Exception as e: ++ print(e) ++ print("These hosts should be manually added to") ++ print(self.__prefs.get('HOSTS_DENY')) + fp = sys.stdout + status = 0 + +@@ -351,12 +352,12 @@ + fp = gzip.open(logfile) + elif logfile.endswith(".bz2"): + if HAS_BZ2: fp = bz2.BZ2File(logfile, "r") +- else: raise Exception, "Can not open bzip2 file (missing bz2 module)" ++ else: raise Exception("Can not open bzip2 file (missing bz2 module)") + else: + fp = open(logfile, "r") +- except Exception, e: +- print "Could not open log file: %s" % logfile +- print e ++ except Exception as e: ++ print("Could not open log file: %s" % logfile) ++ print(e) + return -1 + + try: +@@ -474,8 +475,8 @@ + for host in hosts: + fp.write("%s\n" % host) + fp.close() +- os.chmod(filename, 0644) +- except Exception, e: ++ os.chmod(filename, 0o644) ++ except Exception as e: + error(str(e)) + + def get_regex(self, name, default): diff -Nru denyhosts.orig/files/patch-DenyHosts__denyfileutil.py denyhosts/files/patch-DenyHosts__denyfileutil.py --- denyhosts.orig/files/patch-DenyHosts__denyfileutil.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__denyfileutil.py 2014-03-11 01:05:15.295186551 +1030 @@ -0,0 +1,104 @@ +--- ./DenyHosts/denyfileutil.py.orig 2006-04-20 13:14:58.000000000 +0930 ++++ ./DenyHosts/denyfileutil.py 2014-03-11 00:58:08.133186425 +1030 +@@ -1,13 +1,14 @@ ++from __future__ import print_function; + import os + import shutil + import time + import logging + +-from constants import DENY_DELIMITER, ENTRY_DELIMITER +-from loginattempt import AbusiveHosts +-from util import parse_host +-import plugin +-from purgecounter import PurgeCounter ++from DenyHosts.constants import DENY_DELIMITER, ENTRY_DELIMITER ++from DenyHosts.loginattempt import AbusiveHosts ++from DenyHosts.util import parse_host ++import DenyHosts.plugin ++from DenyHosts.purgecounter import PurgeCounter + + debug = logging.getLogger("denyfileutil").debug + info = logging.getLogger("denyfileutil").info +@@ -22,15 +23,15 @@ + def backup(self): + try: + shutil.copy(self.deny_file, self.backup_file) +- except Exception, e: ++ except Exception as e: + warn(str(e)) + + def replace(self): + # overwrites deny_file with contents of temp_file + try: + os.rename(self.temp_file, self.deny_file) +- except Exception, e: +- print e ++ except Exception as e: ++ print(e) + + def remove_temp(self): + try: +@@ -39,7 +40,7 @@ + pass + + def create_temp(self, data_list): +- raise Exception, "Not Imlemented" ++ raise Exception("Not Imlemented") + + + def get_data(self): +@@ -64,7 +65,7 @@ + def create_temp(self, data): + try: + fp = open(self.temp_file, "w") +- os.chmod(self.temp_file, 0644) ++ os.chmod(self.temp_file, 0o644) + for line in data: + if line.find("#") != -1: + fp.write(line) +@@ -82,7 +83,7 @@ + fp.write("%s\n" % line) + + fp.close() +- except Exception, e: ++ except Exception as e: + raise e + + +@@ -121,7 +122,7 @@ + entry)) + fp.write("%s\n" % entry) + fp.close() +- except Exception, e: ++ except Exception as e: + raise e + + ################################################################################# +@@ -165,7 +166,7 @@ + + try: + fp = open(self.temp_file, "w") +- os.chmod(self.temp_file, 0644) ++ os.chmod(self.temp_file, 0o644) + offset = 0 + num_lines = len(data) + while offset < num_lines: +@@ -180,7 +181,7 @@ + rest = line.lstrip(DENY_DELIMITER) + timestamp, host_verify = rest.split(ENTRY_DELIMITER) + tm = time.strptime(timestamp) +- except Exception, e: ++ except Exception as e: + warn("Parse error -- Ignorning timestamp: %s for: %s", timestamp, line) + warn("exception: %s", str(e)) + # ignoring bad time string +@@ -214,7 +215,7 @@ + continue + + fp.close() +- except Exception, e: ++ except Exception as e: + raise e + return purged_hosts + diff -Nru denyhosts.orig/files/patch-DenyHosts__filetracker.py denyhosts/files/patch-DenyHosts__filetracker.py --- denyhosts.orig/files/patch-DenyHosts__filetracker.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__filetracker.py 2014-03-11 01:05:15.298186688 +1030 @@ -0,0 +1,62 @@ +--- ./DenyHosts/filetracker.py.orig 2005-12-17 09:15:01.000000000 +1030 ++++ ./DenyHosts/filetracker.py 2014-03-11 00:58:08.135186272 +1030 +@@ -1,6 +1,7 @@ ++from __future__ import print_function; + import os + import logging +-from constants import SECURE_LOG_OFFSET ++from DenyHosts.constants import SECURE_LOG_OFFSET + + debug = logging.getLogger("filetracker").debug + +@@ -15,7 +16,7 @@ + path = os.path.join(self.work_dir, + SECURE_LOG_OFFSET) + first_line = "" +- offset = 0L ++ offset = 0 + try: + fp = open(path, "r") + first_line = fp.readline()[:-1] +@@ -32,13 +33,13 @@ + + def __get_current_offset(self): + first_line = "" +- offset = 0L ++ offset = 0 + try: + fp = open(self.logfile, "r") + first_line = fp.readline()[:-1] + fp.seek(0, 2) + offset = fp.tell() +- except Exception, e: ++ except Exception as e: + raise e + + debug("__get_current_offset():") +@@ -52,7 +53,7 @@ + try: + fp = open(self.logfile, "r") + first_line = fp.readline()[:-1] +- except Exception, e: ++ except Exception as e: + raise e + + self.__first_line = first_line +@@ -64,7 +65,7 @@ + + if last_line != self.__first_line: + # log file was rotated, start from beginning +- offset = 0L ++ offset = 0 + elif self.__offset > last_offset: + # new lines exist in log file + offset = last_offset +@@ -87,6 +88,6 @@ + fp.write("%ld\n" % offset) + fp.close() + except: +- print "Could not save logfile offset to: %s" % path ++ print("Could not save logfile offset to: %s" % path) + + diff -Nru denyhosts.orig/files/patch-DenyHosts__lockfile.py denyhosts/files/patch-DenyHosts__lockfile.py --- denyhosts.orig/files/patch-DenyHosts__lockfile.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__lockfile.py 2014-03-11 01:05:15.292186638 +1030 @@ -0,0 +1,37 @@ +--- ./DenyHosts/lockfile.py.orig 2005-12-17 09:15:00.000000000 +1030 ++++ ./DenyHosts/lockfile.py 2014-03-11 01:05:01.788188046 +1030 +@@ -1,5 +1,5 @@ + import os +-from util import die ++from DenyHosts.util import die + + class LockFile: + def __init__(self, lockpath): +@@ -28,13 +28,16 @@ + os.O_TRUNC | # truncate it, if it exists + os.O_WRONLY | # write-only + os.O_EXCL, # exclusive access +- 0644) # file mode ++ 0o644) # file mode + +- except Exception, e: ++ except Exception as e: + pid = self.get_pid() + die("DenyHosts could not obtain lock (pid: %s)" % pid, e) + +- os.write(self.fd, "%s\n" % os.getpid()) ++ # py2.7 doesn't interpret the following right ++ # use u"" to work on py2.7 and py3.3 ++ #os.write(self.fd, bytes("%s\n" % os.getpid(),'UTF-8')) ++ os.write(self.fd, u"%s\n" % os.getpid()) + os.fsync(self.fd) + + +@@ -47,6 +50,6 @@ + self.fd = None + try: + os.unlink(self.lockpath) +- except Exception, e: ++ except Exception as e: + if die_: + die("Error deleting DenyHosts lock file: %s" % self.lockpath, e) diff -Nru denyhosts.orig/files/patch-DenyHosts__loginattempt.py denyhosts/files/patch-DenyHosts__loginattempt.py --- denyhosts.orig/files/patch-DenyHosts__loginattempt.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__loginattempt.py 2014-03-11 01:05:15.289187501 +1030 @@ -0,0 +1,71 @@ +--- ./DenyHosts/loginattempt.py.orig 2006-05-21 10:28:56.000000000 +0930 ++++ ./DenyHosts/loginattempt.py 2014-03-11 00:58:08.166186045 +1030 +@@ -1,6 +1,7 @@ ++from __future__ import print_function; + import os + import logging +-from util import is_true ++from DenyHosts.util import is_true + + try: + set = set +@@ -8,8 +9,8 @@ + from sets import Set + set = Set + +-from counter import Counter, CounterRecord +-from constants import * ++from DenyHosts.counter import Counter, CounterRecord ++from DenyHosts.constants import * + + debug = logging.getLogger("loginattempt").debug + info = logging.getLogger("loginattempt").info +@@ -75,7 +76,7 @@ + self.__abusive_hosts_invalid[host].reset_count() + + +- if success and self.__abusive_hosts_invalid.get(host, 0) > self.__deny_threshold_invalid: ++ if success and int(self.__abusive_hosts_invalid.get(host, 0)) > self.__deny_threshold_invalid: + num_failures = self.__valid_users_and_hosts.get(user_host_key, 0) + self.__suspicious_logins[user_host_key] += 1 + if self.__suspicious_always or host not in self.__allowed_hosts: +@@ -169,14 +170,14 @@ + + stats[name] = CounterRecord(int(count), date) + #debug("stats[%s] = %s", name, stats[name]) +- except Exception, e: ++ except Exception as e: + ##debug(e) + pass +- except IOError, e: ++ except IOError as e: + if e.errno == 2: debug("%s does not exist", fname) +- else: print e +- except Exception, e: +- if not self.__first_time: print e ++ else: print(e) ++ except Exception as e: ++ if not self.__first_time: print(e) + + return stats + +@@ -248,8 +249,8 @@ + + try: + fp = open(path, "w") +- except Exception, e: +- print e ++ except Exception as e: ++ print(e) + return + + if not stats: +@@ -257,7 +258,7 @@ + fp.close() + return + +- keys = stats.keys() ++ keys = list(stats.keys()) + keys.sort() + + for key in keys: diff -Nru denyhosts.orig/files/patch-DenyHosts__old-daemon.py denyhosts/files/patch-DenyHosts__old-daemon.py --- denyhosts.orig/files/patch-DenyHosts__old-daemon.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__old-daemon.py 2014-03-11 01:05:15.271186505 +1030 @@ -0,0 +1,20 @@ +--- ./DenyHosts/old-daemon.py.orig 2005-12-17 09:15:00.000000000 +1030 ++++ ./DenyHosts/old-daemon.py 2014-03-11 00:58:08.169187417 +1030 +@@ -37,7 +37,7 @@ + # the child gets a new PID, making it impossible for its PID to equal its + # PGID. + pid = os.fork() +- except OSError, e: ++ except OSError as e: + return((e.errno, e.strerror)) # ERROR (return a tuple) + + if (pid == 0): # The first child. +@@ -62,7 +62,7 @@ + # fork guarantees that the child is no longer a session leader, thus + # preventing the daemon from ever acquiring a controlling terminal. + pid = os.fork() # Fork a second child. +- except OSError, e: ++ except OSError as e: + return((e.errno, e.strerror)) # ERROR (return a tuple) + + if (pid == 0): # The second child. diff -Nru denyhosts.orig/files/patch-DenyHosts__plugin.py denyhosts/files/patch-DenyHosts__plugin.py --- denyhosts.orig/files/patch-DenyHosts__plugin.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__plugin.py 2014-03-11 01:05:15.262189283 +1030 @@ -0,0 +1,10 @@ +--- ./DenyHosts/plugin.py.orig 2005-12-17 09:15:00.000000000 +1030 ++++ ./DenyHosts/plugin.py 2014-03-11 00:58:08.185186209 +1030 +@@ -13,6 +13,6 @@ + try: + res = os.system("%s %s" % (executable, host)) + if res: info("plugin returned %d", res) +- except Except, e: ++ except Except as e: + error("plugin error: %s", e) + diff -Nru denyhosts.orig/files/patch-DenyHosts__prefs.py denyhosts/files/patch-DenyHosts__prefs.py --- denyhosts.orig/files/patch-DenyHosts__prefs.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__prefs.py 2014-03-11 01:05:15.310187884 +1030 @@ -0,0 +1,89 @@ +--- ./DenyHosts/prefs.py.orig 2006-11-10 14:54:40.000000000 +1030 ++++ ./DenyHosts/prefs.py 2014-03-11 00:58:08.203186309 +1030 +@@ -1,6 +1,7 @@ ++from __future__ import print_function; + import os, sys, re +-from util import die, calculate_seconds, is_true +-from regex import PREFS_REGEX ++from DenyHosts.util import die, calculate_seconds, is_true ++from DenyHosts.regex import PREFS_REGEX + import logging + + debug = logging.getLogger("prefs").debug +@@ -121,7 +122,7 @@ + def load_settings(self, path): + try: + fp = open(path, "r") +- except Exception, e : ++ except Exception as e : + die("Error reading file: %s" % path, e) + + +@@ -145,7 +146,7 @@ + self.__data['USERDEF_FAILED_ENTRY_REGEX'].append(re.compile(value)) + else: + self.__data[name] = value +- except Exception, e: ++ except Exception as e: + fp.close() + die("Error processing configuration parameter %s: %s" % (name, e)) + fp.close() +@@ -163,26 +164,26 @@ + def check_required(self, path): + ok = 1 + for name_reqd, val_reqd in self.reqd: +- if not self.__data.has_key(name_reqd): +- print "Missing configuration parameter: %s" % name_reqd ++ if name_reqd not in self.__data.keys(): ++ print("Missing configuration parameter: %s" % name_reqd) + if name_reqd == 'DENY_THRESHOLD_INVALID': +- print "\nNote: The configuration parameter DENY_THRESHOLD has been renamed" +- print " DENY_THRESHOLD_INVALID. Please update your DenyHosts configuration" +- print " file to reflect this change." ++ print("\nNote: The configuration parameter DENY_THRESHOLD has been renamed") ++ print(" DENY_THRESHOLD_INVALID. Please update your DenyHosts configuration") ++ print(" file to reflect this change.") + + if self.__data.has_key('DENY_THRESHOLD'): +- print "\n*** Using deprecated DENY_THRESHOLD value for DENY_THRESHOLD_INVALID ***" ++ print("\n*** Using deprecated DENY_THRESHOLD value for DENY_THRESHOLD_INVALID ***") + self.__data['DENY_THRESHOLD_INVALID'] = self.__data['DENY_THRESHOLD'] + else: + ok = 0 + elif name_reqd == 'DENY_THRESHOLD_RESTRICTED': +- print "\nNote: DENY_THRESHOLD_RESTRICTED has not been defined. Setting this" +- print "value to DENY_THRESHOLD_ROOT" ++ print("\nNote: DENY_THRESHOLD_RESTRICTED has not been defined. Setting this") ++ print("value to DENY_THRESHOLD_ROOT") + self.__data['DENY_THRESHOLD_RESTRICTED'] = self.__data['DENY_THRESHOLD_ROOT'] + else: + ok = 0 + elif val_reqd and not self.__data[name_reqd]: +- print "Missing configuration value for: %s" % name_reqd ++ print("Missing configuration value for: %s" % name_reqd) + ok = 0 + + if not ok: +@@ -206,18 +207,18 @@ + + + def dump(self): +- print "Preferences:" ++ print("Preferences:") + keys = self.__data.keys() + for key in keys: + if key == 'USERDEF_FAILED_ENTRY_REGEX': + for rx in self.__data[key]: +- print " %s: [%s]" % (key, rx.pattern) ++ print(" %s: [%s]" % (key, rx.pattern)) + else: +- print " %s: [%s]" % (key, self.__data[key]) ++ print(" %s: [%s]" % (key, self.__data[key])) + + + def dump_to_logger(self): +- keys = self.__data.keys() ++ keys = list(self.__data.keys()) + keys.sort() + info("DenyHosts configuration settings:") + for key in keys: diff -Nru denyhosts.orig/files/patch-DenyHosts__purgecounter.py denyhosts/files/patch-DenyHosts__purgecounter.py --- denyhosts.orig/files/patch-DenyHosts__purgecounter.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__purgecounter.py 2014-03-11 01:05:15.286186681 +1030 @@ -0,0 +1,21 @@ +--- ./DenyHosts/purgecounter.py.orig 2006-04-09 10:11:58.000000000 +0930 ++++ ./DenyHosts/purgecounter.py 2014-03-11 00:58:08.204187408 +1030 +@@ -1,7 +1,7 @@ + +-from counter import Counter, CounterRecord ++from DenyHosts.counter import Counter, CounterRecord + +-import constants ++import DenyHosts.constants + import os + + try: +@@ -66,7 +66,7 @@ + def write_data(self, data): + try: + fp = open(self.filename, "w") +- except Exception, e: ++ except Exception as e: + error("error saving %s: %s", self.filename, str(e)) + + keys = data.keys() diff -Nru denyhosts.orig/files/patch-DenyHosts__python_version.py denyhosts/files/patch-DenyHosts__python_version.py --- denyhosts.orig/files/patch-DenyHosts__python_version.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__python_version.py 2014-03-11 01:05:15.307186578 +1030 @@ -0,0 +1,28 @@ +--- ./DenyHosts/python_version.py.orig 2005-12-17 09:15:01.000000000 +1030 ++++ ./DenyHosts/python_version.py 2014-03-11 00:58:08.206186127 +1030 +@@ -1,3 +1,4 @@ ++from __future__ import print_function + import sys + + +@@ -5,9 +6,9 @@ + version_tuple = sys.version_info + version = version_tuple[0] * 100 + version_tuple[1] + if version < 203: +- print "Python >= 2.3 required. You are using:", sys.version ++ print("Python >= 2.3 required. You are using:", sys.version) + +- print """ ++ print(""" + ###################################################################### + + Visit http://www.python.org and download a more recent version of +@@ -23,7 +24,7 @@ + + ###################################################################### + +-""" % ' '.join(sys.argv) ++""" % ' '.join(sys.argv)) + + sys.exit(1) + diff -Nru denyhosts.orig/files/patch-DenyHosts__regex.py denyhosts/files/patch-DenyHosts__regex.py --- denyhosts.orig/files/patch-DenyHosts__regex.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__regex.py 2014-03-11 01:05:15.283186705 +1030 @@ -0,0 +1,11 @@ +--- ./DenyHosts/regex.py.orig 2006-12-08 06:17:04.000000000 +1030 ++++ ./DenyHosts/regex.py 2014-03-11 00:58:08.207186709 +1030 +@@ -17,7 +17,7 @@ + + FAILED_ENTRY_REGEX4 = re.compile(r"""Authentication failure for (?P.*) .*from (?P.*)""") + +-FAILED_ENTRY_REGEX5 = re.compile(r"""User (?P.*) .*from (?P.*) not allowed because none of user's groups are listed in AllowGroups""") ++FAILED_ENTRY_REGEX5 = re.compile(r"""User (?P.*) .*from (?P.*) not allowed because none of user's groups are listed in AllowGroups$""") + + FAILED_ENTRY_REGEX6 = re.compile(r"""Did not receive identification string .*from (::ffff:)?(?P\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") + diff -Nru denyhosts.orig/files/patch-DenyHosts__report.py denyhosts/files/patch-DenyHosts__report.py --- denyhosts.orig/files/patch-DenyHosts__report.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__report.py 2014-03-11 01:05:15.268186526 +1030 @@ -0,0 +1,22 @@ +--- ./DenyHosts/report.py.orig 2006-04-09 13:04:04.000000000 +0930 ++++ ./DenyHosts/report.py 2014-03-11 00:58:08.208186600 +1030 +@@ -1,9 +1,8 @@ + import os + import re + import socket +-from types import ListType, TupleType + import logging +-from util import is_true ++from DenyHosts.util import is_true + try: + import syslog + HAS_SYSLOG = True +@@ -38,7 +37,7 @@ + def add_section(self, message, iterable): + self.report += "%s:\n\n" % message + for i in iterable: +- if type(i) in (TupleType, ListType): ++ if isinstance(type(i), (tuple,list)): + extra = ": %d\n" % i[1] + i = i[0] + else: diff -Nru denyhosts.orig/files/patch-DenyHosts__restricted.py denyhosts/files/patch-DenyHosts__restricted.py --- denyhosts.orig/files/patch-DenyHosts__restricted.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__restricted.py 2014-03-11 01:05:15.312186576 +1030 @@ -0,0 +1,10 @@ +--- ./DenyHosts/restricted.py.orig 2006-02-09 16:36:19.000000000 +1030 ++++ ./DenyHosts/restricted.py 2014-03-11 00:58:08.220186228 +1030 +@@ -1,6 +1,6 @@ + import os + +-from constants import RESTRICTED_USERNAMES ++from DenyHosts.constants import RESTRICTED_USERNAMES + try: + set = set + except: diff -Nru denyhosts.orig/files/patch-DenyHosts__sync.py denyhosts/files/patch-DenyHosts__sync.py --- denyhosts.orig/files/patch-DenyHosts__sync.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__sync.py 2014-03-11 01:05:15.274187520 +1030 @@ -0,0 +1,56 @@ +--- ./DenyHosts/sync.py.orig 2006-02-09 15:50:46.000000000 +1030 ++++ ./DenyHosts/sync.py 2014-03-11 00:58:08.221187327 +1030 +@@ -1,8 +1,12 @@ +-from xmlrpclib import ServerProxy ++try: ++ from xmlrpclib import ServerProxy ++except: ++ from xmlrpc.client import ServerProxy ++ + import logging + import os + import time +-from constants import SYNC_TIMESTAMP, SYNC_HOSTS, SYNC_HOSTS_TMP, SYNC_RECEIVED_HOSTS ++from DenyHosts.constants import SYNC_TIMESTAMP, SYNC_HOSTS, SYNC_HOSTS_TMP, SYNC_RECEIVED_HOSTS + debug = logging.getLogger("sync").debug + info = logging.getLogger("sync").info + error = logging.getLogger("sync").error +@@ -23,7 +27,7 @@ + try: + self.__server = ServerProxy(self.__prefs.get('SYNC_SERVER')) + self.__connected = True +- except Exception, e: ++ except Exception as e: + error(str(e)) + self.__connected = False + return self.__connected +@@ -46,9 +50,9 @@ + timestamp = fp.readline() + timestamp = long(timestamp.strip()) + return timestamp +- except Exception, e: ++ except Exception as e: + error(str(e)) +- return 0l ++ return 0 + + def set_sync_timestamp(self, timestamp): + try: +@@ -98,7 +102,7 @@ + + try: + self.__server.add_hosts(hosts) +- except Exception, e: ++ except Exception as e: + exception(e) + + +@@ -121,7 +125,7 @@ + info("received %d new host%s", len(hosts), get_plural(hosts)) + self.__save_received_hosts(hosts, timestamp) + return hosts +- except Exception, e: ++ except Exception as e: + exception(e) + return None + diff -Nru denyhosts.orig/files/patch-DenyHosts__util.py denyhosts/files/patch-DenyHosts__util.py --- denyhosts.orig/files/patch-DenyHosts__util.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-DenyHosts__util.py 2014-03-11 01:05:15.277186783 +1030 @@ -0,0 +1,66 @@ +--- ./DenyHosts/util.py.orig 2006-06-22 12:15:28.000000000 +0930 ++++ ./DenyHosts/util.py 2014-03-11 00:58:08.223186967 +1030 +@@ -1,11 +1,11 @@ ++from __future__ import print_function; + import sys + import os + import time + from smtplib import SMTP + import logging +-from constants import BSD_STYLE, TIME_SPEC_LOOKUP +-from regex import TIME_SPEC_REGEX +-from types import IntType ++from DenyHosts.constants import BSD_STYLE, TIME_SPEC_LOOKUP ++from DenyHosts.regex import TIME_SPEC_REGEX + + debug = logging.getLogger("util").debug + +@@ -55,8 +55,8 @@ + + + def die(msg, ex=None): +- print msg +- if ex: print ex ++ print(msg) ++ if ex: print(ex) + sys.exit(1) + + +@@ -74,17 +74,17 @@ + def calculate_seconds(timestr, zero_ok=False): + # return the number of seconds in a given timestr such as 1d (1 day), + # 13w (13 weeks), 5s (5seconds), etc... +- if type(timestr) is IntType: return timestr ++ if type(timestr) is int: return timestr + + m = TIME_SPEC_REGEX.search(timestr) + if not m: +- raise Exception, "Invalid time specification: string format error: %s", timestr ++ raise Exception("Invalid time specification: string format error: %s", timestr) + + units = int(m.group('units')) + period = m.group('period') or 's' # seconds is the default + + if units == 0 and not zero_ok: +- raise Exception, "Invalid time specification: units = 0" ++ raise Exception("Invalid time specification: units = 0") + + seconds = units * TIME_SPEC_LOOKUP[period] + #info("converted %s to %ld seconds: ", timestr, seconds) +@@ -145,11 +145,11 @@ + recipients, + msg) + debug("sent email to: %s" % prefs.get("ADMIN_EMAIL")) +- except Exception, e: +- print "Error sending email" +- print e +- print "Email message follows:" +- print msg ++ except Exception as e: ++ print("Error sending email") ++ print(e) ++ print("Email message follows:") ++ print(msg) + + try: + smtp.quit() diff -Nru denyhosts.orig/files/patch-DenyHosts_regex.py denyhosts/files/patch-DenyHosts_regex.py --- denyhosts.orig/files/patch-DenyHosts_regex.py 2014-03-11 03:17:39.274187104 +1030 +++ denyhosts/files/patch-DenyHosts_regex.py 1970-01-01 09:30:00.000000000 +0930 @@ -1,11 +0,0 @@ ---- DenyHosts/regex.py.orig Sat Jun 23 14:32:34 2007 -+++ DenyHosts/regex.py Sat Jun 23 14:32:58 2007 -@@ -17,7 +17,7 @@ - - FAILED_ENTRY_REGEX4 = re.compile(r"""Authentication failure for (?P.*) .*from (?P.*)""") - --FAILED_ENTRY_REGEX5 = re.compile(r"""User (?P.*) .*from (?P.*) not allowed because none of user's groups are listed in AllowGroups""") -+FAILED_ENTRY_REGEX5 = re.compile(r"""User (?P.*) .*from (?P.*) not allowed because none of user's groups are listed in AllowGroups$""") - - FAILED_ENTRY_REGEX6 = re.compile(r"""Did not receive identification string .*from (::ffff:)?(?P\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") - diff -Nru denyhosts.orig/files/patch-daemon-control-dist denyhosts/files/patch-daemon-control-dist --- denyhosts.orig/files/patch-daemon-control-dist 2014-03-11 03:17:39.276333215 +1030 +++ denyhosts/files/patch-daemon-control-dist 2014-03-11 02:13:12.416187192 +1030 @@ -1,9 +1,12 @@ - -$FreeBSD$ - ---- daemon-control-dist.orig -+++ daemon-control-dist -@@ -11,9 +11,9 @@ +--- ./daemon-control-dist.orig 2006-04-22 08:34:43.000000000 +0930 ++++ ./daemon-control-dist 2014-03-11 00:58:08.307186202 +1030 +@@ -6,14 +6,14 @@ + # DenyHosts daemon to block ssh attempts + # + ############################################### +- ++from __future__ import print_function + ############################################### #### Edit these to suit your configuration #### ############################################### @@ -14,5 +17,65 @@ +DENYHOSTS_LOCK = "/var/run/denyhosts" +DENYHOSTS_CFG = "%%PREFIX%%/share/denyhosts/denyhosts.cfg" + PYTHON_BIN = "/usr/bin/env python" - ############################################### +@@ -35,11 +35,11 @@ + STATE_LOCK_EXISTS = -2 + + def usage(): +- print "Usage: %s {start [args...] | stop | restart [args...] | status | debug | condrestart [args...] }" % sys.argv[0] +- print +- print "For a list of valid 'args' refer to:" +- print "$ denyhosts.py --help" +- print ++ print("Usage: %s {start [args...] | stop | restart [args...] | status | debug | condrestart [args...] }" % sys.argv[0]) ++ print() ++ print("For a list of valid 'args' refer to:") ++ print("$ denyhosts.py --help") ++ print() + sys.exit(0) + + +@@ -74,7 +74,7 @@ + cmd = "%s --daemon " % DENYHOSTS_BIN + if args: cmd += ' '.join(args) + +- print "starting DenyHosts: ", cmd ++ print("starting DenyHosts: ", cmd) + + os.system(cmd) + +@@ -83,26 +83,26 @@ + pid = getpid() + if pid >= 0: + os.kill(pid, signal.SIGTERM) +- print "sent DenyHosts SIGTERM" ++ print("sent DenyHosts SIGTERM") + else: +- print "DenyHosts is not running" ++ print("DenyHosts is not running") + + def debug(): + pid = getpid() + if pid >= 0: + os.kill(pid, signal.SIGUSR1) +- print "sent DenyHosts SIGUSR1" ++ print("sent DenyHosts SIGUSR1") + else: +- print "DenyHosts is not running" ++ print("DenyHosts is not running") + + def status(): + pid = getpid() + if pid == STATE_LOCK_EXISTS: +- print "%s exists but DenyHosts is not running" % DENYHOSTS_LOCK ++ print("%s exists but DenyHosts is not running" % DENYHOSTS_LOCK) + elif pid == STATE_NOT_RUNNING: +- print "Denyhosts is not running" ++ print("Denyhosts is not running") + else: +- print "DenyHosts is running with pid = %d" % pid ++ print("DenyHosts is running with pid = %d" % pid) + + + def condrestart(*args): diff -Nru denyhosts.orig/files/patch-denyhosts.cfg-dist denyhosts/files/patch-denyhosts.cfg-dist --- denyhosts.orig/files/patch-denyhosts.cfg-dist 2014-03-11 03:17:39.253623223 +1030 +++ denyhosts/files/patch-denyhosts.cfg-dist 2014-03-11 02:14:34.179186253 +1030 @@ -1,8 +1,5 @@ - -$FreeBSD$ - ---- denyhosts.cfg-dist.orig -+++ denyhosts.cfg-dist +--- ./denyhosts.cfg-dist.orig 2006-08-20 23:39:57.000000000 +0930 ++++ ./denyhosts.cfg-dist 2014-03-11 00:58:08.307186202 +1030 @@ -9,10 +9,10 @@ # argument # diff -Nru denyhosts.orig/files/patch-denyhosts.py denyhosts/files/patch-denyhosts.py --- denyhosts.orig/files/patch-denyhosts.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-denyhosts.py 2014-03-11 01:05:15.259186721 +1030 @@ -0,0 +1,118 @@ +--- ./denyhosts.py.orig 2006-07-09 00:02:45.000000000 +0930 ++++ ./denyhosts.py 2014-03-11 00:58:08.263185793 +1030 +@@ -1,4 +1,5 @@ + #!/usr/bin/env python ++from __future__ import print_function + import os + import sys + +@@ -22,26 +23,26 @@ + + + def usage(): +- print "Usage:" +- print "%s [-f logfile | --file=logfile] [ -c configfile | --config=configfile] [-i | --ignore] [-n | --noemail] [--purge] [--migrate] [--daemon] [--sync] [--version]" % sys.argv[0] +- print +- print +- print " --file: The name of log file to parse" +- print " --ignore: Ignore last processed offset (start processing from beginning)" +- print " --noemail: Do not send an email report" +- print " --unlock: if lockfile exists, remove it and run as normal" +- print " --migrate: migrate your HOSTS_DENY file so that it is suitable for --purge" +- print " --purge: expire entries older than your PURGE_DENY setting" +- print " --daemon: run DenyHosts in daemon mode" +- print " --sync: run DenyHosts synchronization mode" +- print " --version: Prints the version of DenyHosts and exits" ++ print("Usage:") ++ print("%s [-f logfile | --file=logfile] [ -c configfile | --config=configfile] [-i | --ignore] [-n | --noemail] [--purge] [--migrate] [--daemon] [--sync] [--version]" % sys.argv[0]) ++ print() ++ print() ++ print(" --file: The name of log file to parse") ++ print(" --ignore: Ignore last processed offset (start processing from beginning)") ++ print(" --noemail: Do not send an email report") ++ print(" --unlock: if lockfile exists, remove it and run as normal") ++ print(" --migrate: migrate your HOSTS_DENY file so that it is suitable for --purge") ++ print(" --purge: expire entries older than your PURGE_DENY setting") ++ print(" --daemon: run DenyHosts in daemon mode") ++ print(" --sync: run DenyHosts synchronization mode") ++ print(" --version: Prints the version of DenyHosts and exits") + +- print +- print "Note: multiple --file args can be processed. ", +- print "If multiple files are provided, --ignore is implied" +- print +- print "When run in --daemon mode the following flags are ignored:" +- print " --file, --purge, --migrate, --sync, --verbose" ++ print() ++ print("Note: multiple --file args can be processed. ") ++ print("If multiple files are provided, --ignore is implied") ++ print() ++ print("When run in --daemon mode the following flags are ignored:") ++ print(" --file, --purge, --migrate, --sync, --verbose") + + + ################################################################################# +@@ -72,7 +73,7 @@ + "migrate", "purge", "daemon", "sync", + "upgrade099"]) + except: +- print "\nInvalid command line option detected." ++ print("\nInvalid command line option detected.") + usage() + sys.exit(1) + +@@ -103,7 +104,7 @@ + if opt == '--upgrade099': + upgrade099 = 1 + if opt == '--version': +- print "DenyHosts version:", VERSION ++ print("DenyHosts version:", VERSION) + sys.exit(0) + + prefs = Prefs(config_file) +@@ -112,9 +113,9 @@ + try: + os.makedirs(prefs.get('WORK_DIR')) + first_time = 1 +- except Exception, e: +- if e[0] != 17: +- print e ++ except Exception as e: ++ if e.args[0] != 17: ++ print(e) + sys.exit(1) + + setup_logging(prefs, enable_debug, verbose, daemon) +@@ -154,7 +155,7 @@ + p = Purge(prefs, + purge_time) + +- except Exception, e: ++ except Exception as e: + lock_file.remove() + die(str(e)) + +@@ -162,11 +163,11 @@ + for f in logfiles: + dh = DenyHosts(f, prefs, lock_file, ignore_offset, + first_time, noemail, daemon) +- except SystemExit, e: ++ except SystemExit as e: + pass +- except Exception, e: ++ except Exception as e: + traceback.print_exc(file=sys.stdout) +- print "\nDenyHosts exited abnormally" ++ print("\nDenyHosts exited abnormally") + + + if sync_mode and not daemon: +@@ -189,7 +190,7 @@ + sync.get_denied_hosts() + sync.update_hosts_deny(new_hosts) + sync.xmlrpc_disconnect() +- except Exception, e: ++ except Exception as e: + lock_file.remove() + die("Error synchronizing data", e) + diff -Nru denyhosts.orig/files/patch-plugins__test_deny.py denyhosts/files/patch-plugins__test_deny.py --- denyhosts.orig/files/patch-plugins__test_deny.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-plugins__test_deny.py 2014-03-11 01:05:15.315186866 +1030 @@ -0,0 +1,10 @@ +--- ./plugins/test_deny.py.orig 2005-12-17 09:15:01.000000000 +1030 ++++ ./plugins/test_deny.py 2014-03-11 00:58:08.283185736 +1030 +@@ -1,5 +1,6 @@ + #!/usr/bin/python ++from __future__ import print_function + import sys + +-print "%s invoked with the following args: %s" % (sys.argv[0], sys.argv[1:]) ++print("%s invoked with the following args: %s" % (sys.argv[0], sys.argv[1:])) + sys.exit(0) diff -Nru denyhosts.orig/files/patch-scripts__restricted_from_invalid.py denyhosts/files/patch-scripts__restricted_from_invalid.py --- denyhosts.orig/files/patch-scripts__restricted_from_invalid.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-scripts__restricted_from_invalid.py 2014-03-11 01:05:15.318186913 +1030 @@ -0,0 +1,37 @@ +--- ./scripts/restricted_from_invalid.py.orig 2006-02-10 04:16:06.000000000 +1030 ++++ ./scripts/restricted_from_invalid.py 2014-03-11 00:58:08.284186028 +1030 +@@ -1,14 +1,15 @@ + #!/bin/env python ++from __future__ import print_function + import os, sys + + def usage(): +- print "%s WORK_DIR [num_results]" % sys.argv[0] ++ print("%s WORK_DIR [num_results]" % sys.argv[0]) + sys.exit(1) + + try: + work_dir = sys.argv[1] + except: +- print "you must specify your DenyHosts WORK_DIR" ++ print("you must specify your DenyHosts WORK_DIR") + usage() + + try: +@@ -21,7 +22,7 @@ + try: + fp = open(fname, "r") + except: +- print fname, "does not exist" ++ print(fname, "does not exist") + sys.exit(1) + + d = {} +@@ -50,6 +51,6 @@ + l = d.get(key) + for username in l: + i += 1 +- print username ++ print(username) + if i >= num: break + if i >= num: break diff -Nru denyhosts.orig/files/patch-scripts__restricted_from_passwd.py denyhosts/files/patch-scripts__restricted_from_passwd.py --- denyhosts.orig/files/patch-scripts__restricted_from_passwd.py 1970-01-01 09:30:00.000000000 +0930 +++ denyhosts/files/patch-scripts__restricted_from_passwd.py 2014-03-11 00:23:38.965186386 +1030 @@ -0,0 +1,21 @@ +--- ./scripts/restricted_from_passwd.py.orig 2014-03-11 00:23:11.398186276 +1030 ++++ ./scripts/restricted_from_passwd.py 2014-03-11 00:23:24.875186213 +1030 +@@ -10,8 +10,8 @@ + # where $WORK_DIR is your DenyHosts WORK_DIR parameter + # + ############################################################################ +- +-RESTRICTED_SHELLS = ("/sbin/nologin", ++from __future__ import print_function ++RESTRICTED_SHELLS = ("/usr/sbin/nologin", + "/sbin/shutdown", + "/sbin/halt") + +@@ -26,6 +26,6 @@ + + usernames.sort() + for username in usernames: +- print username ++ print(username) + + diff -Nru denyhosts.orig/files/patch-scripts_restrited-from-passwd.py denyhosts/files/patch-scripts_restrited-from-passwd.py --- denyhosts.orig/files/patch-scripts_restrited-from-passwd.py 2014-03-11 03:17:39.276333215 +1030 +++ denyhosts/files/patch-scripts_restrited-from-passwd.py 1970-01-01 09:30:00.000000000 +0930 @@ -1,11 +0,0 @@ ---- scripts/restricted_from_passwd.py.orig 2008-11-26 12:06:31.231726279 -0500 -+++ scripts/restricted_from_passwd.py 2008-11-26 12:06:36.696728675 -0500 -@@ -11,7 +11,7 @@ - # - ############################################################################ - --RESTRICTED_SHELLS = ("/sbin/nologin", -+RESTRICTED_SHELLS = ("/usr/sbin/nologin", - "/sbin/shutdown", - "/sbin/halt") - diff -Nru denyhosts.orig/pkg-descr denyhosts/pkg-descr --- denyhosts.orig/pkg-descr 2014-03-11 03:17:39.283419963 +1030 +++ denyhosts/pkg-descr 2014-03-11 03:04:32.715302966 +1030 @@ -18,4 +18,4 @@ - Optionally sends an email of newly banned hosts and suspicious logins. - Resolves IP addresses to hostnames, if you want -WWW: http://denyhosts.sourceforge.net/ +WWW: http://denyhosts.sourceforge.net/ --------------050709070807040202090809--