FreeBSD Bugzilla – Attachment 140723 Details for
Bug 187408
[PATCH] security/denyhosts: set USE_PYTHON=2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
denyhosts-svn-351057.patch
denyhosts-svn-351057.patch (text/x-patch; charset=US-ASCII), 53.40 KB, created by
corsmith
on 2014-04-12 03:00:55 UTC
(
hide
)
Description:
denyhosts-svn-351057.patch
Filename:
MIME Type:
Creator:
corsmith
Created:
2014-04-12 03:00:55 UTC
Size:
53.40 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 351057) >+++ Makefile (working copy) >@@ -13,7 +13,10 @@ > > LICENSE= GPLv2 > >+LICENSE= GPLv2 >+ > USE_PYTHON= yes >+PYTHON_PY3K_PLIST_HACK= yes > USE_PYDISTUTILS= yes > PYDISTUTILS_AUTOPLIST= yes > >Index: files/patch-DenyHosts__allowedhosts.py >=================================================================== >--- files/patch-DenyHosts__allowedhosts.py (revision 0) >+++ files/patch-DenyHosts__allowedhosts.py (working copy) >@@ -0,0 +1,52 @@ >+--- DenyHosts/allowedhosts.py.orig 2014-04-11 21:44:43.780446339 -0400 >++++ DenyHosts/allowedhosts.py 2014-04-11 21:45:12.388447104 -0400 >+@@ -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 >+ >+@@ -24,18 +25,18 @@ >+ debug("done initializing AllowedHosts") >+ >+ def __contains__(self, ip_addr): >+- if self.allowed_hosts.has_key(ip_addr): return 1 >++ if ip_addr in self.allowed_hosts: return 1 >+ 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): > >Property changes on: files/patch-DenyHosts__allowedhosts.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__counter.py >=================================================================== >--- files/patch-DenyHosts__counter.py (revision 0) >+++ files/patch-DenyHosts__counter.py (working copy) >@@ -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) > >Property changes on: files/patch-DenyHosts__counter.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-DenyHosts__daemon.py >=================================================================== >--- files/patch-DenyHosts__daemon.py (revision 0) >+++ files/patch-DenyHosts__daemon.py (working copy) >@@ -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. > >Property changes on: files/patch-DenyHosts__daemon.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__deny_hosts.py >=================================================================== >--- files/patch-DenyHosts__deny_hosts.py (revision 0) >+++ files/patch-DenyHosts__deny_hosts.py (working copy) >@@ -0,0 +1,127 @@ >+--- DenyHosts/deny_hosts.py.orig 2014-04-11 21:45:07.827448049 -0400 >++++ DenyHosts/deny_hosts.py 2014-04-11 21:45:22.213444135 -0400 >+@@ -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 >+@@ -300,7 +301,7 @@ >+ >+ #info("keys: %s", str( self.__denied_hosts.keys())) >+ new_hosts = [host for host in deny_hosts >+- if not self.__denied_hosts.has_key(host) >++ if host not in self.__denied_hosts >+ and host not in self.__allowed_hosts] >+ >+ debug("new hosts: %s", str(new_hosts)) >+@@ -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): > >Property changes on: files/patch-DenyHosts__deny_hosts.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__denyfileutil.py >=================================================================== >--- files/patch-DenyHosts__denyfileutil.py (revision 0) >+++ files/patch-DenyHosts__denyfileutil.py (working copy) >@@ -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 >+ > >Property changes on: files/patch-DenyHosts__denyfileutil.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-DenyHosts__filetracker.py >=================================================================== >--- files/patch-DenyHosts__filetracker.py (revision 0) >+++ files/patch-DenyHosts__filetracker.py (working copy) >@@ -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) >+ >+ > >Property changes on: files/patch-DenyHosts__filetracker.py >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Index: files/patch-DenyHosts__lockfile.py >=================================================================== >--- files/patch-DenyHosts__lockfile.py (revision 0) >+++ files/patch-DenyHosts__lockfile.py (working copy) >@@ -0,0 +1,34 @@ >+--- DenyHosts/lockfile.py.orig 2014-04-11 21:44:57.699452994 -0400 >++++ DenyHosts/lockfile.py 2014-04-11 21:45:16.883446533 -0400 >+@@ -1,5 +1,5 @@ >+ import os >+-from util import die >++from DenyHosts.util import die >+ >+ class LockFile: >+ def __init__(self, lockpath): >+@@ -28,13 +28,13 @@ >+ 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()) >++ os.write(self.fd, bytes("%s\n" % os.getpid(),'ascii')) >+ os.fsync(self.fd) >+ >+ >+@@ -47,6 +47,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) > >Property changes on: files/patch-DenyHosts__lockfile.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__loginattempt.py >=================================================================== >--- files/patch-DenyHosts__loginattempt.py (revision 0) >+++ files/patch-DenyHosts__loginattempt.py (working copy) >@@ -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: > >Property changes on: files/patch-DenyHosts__loginattempt.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-DenyHosts__old-daemon.py >=================================================================== >--- files/patch-DenyHosts__old-daemon.py (revision 0) >+++ files/patch-DenyHosts__old-daemon.py (working copy) >@@ -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. > >Property changes on: files/patch-DenyHosts__old-daemon.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-DenyHosts__plugin.py >=================================================================== >--- files/patch-DenyHosts__plugin.py (revision 0) >+++ files/patch-DenyHosts__plugin.py (working copy) >@@ -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) >+ > >Property changes on: files/patch-DenyHosts__plugin.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__prefs.py >=================================================================== >--- files/patch-DenyHosts__prefs.py (revision 0) >+++ files/patch-DenyHosts__prefs.py (working copy) >@@ -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: > >Property changes on: files/patch-DenyHosts__prefs.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__purgecounter.py >=================================================================== >--- files/patch-DenyHosts__purgecounter.py (revision 0) >+++ files/patch-DenyHosts__purgecounter.py (working copy) >@@ -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() > >Property changes on: files/patch-DenyHosts__purgecounter.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-DenyHosts__python_version.py >=================================================================== >--- files/patch-DenyHosts__python_version.py (revision 0) >+++ files/patch-DenyHosts__python_version.py (working copy) >@@ -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) >+ > >Property changes on: files/patch-DenyHosts__python_version.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__regex.py >=================================================================== >--- files/patch-DenyHosts__regex.py (revision 351057) >+++ files/patch-DenyHosts__regex.py (working copy) >@@ -1,44 +1,11 @@ >-# Patch shaped from http://seclists.org/oss-sec/2013/q4/535 >-=================================================================== >---- ./DenyHosts/regex.py.orig 2006-12-07 20:47:04.000000000 +0100 >-+++ ./DenyHosts/regex.py 2013-12-23 17:17:42.000000000 +0100 >-@@ -6,22 +6,22 @@ >+--- ./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 @@ > >- #DATE_FORMAT_REGEX = re.compile(r"""(?P<month>[A-z]{3,3})\s*(?P<day>\d+)""") >+ FAILED_ENTRY_REGEX4 = re.compile(r"""Authentication failure for (?P<user>.*) .*from (?P<host>.*)""") > >--SSHD_FORMAT_REGEX = re.compile(r""".* (sshd.*:|\[sshd\]) (?P<message>.*)""") >-+SSHD_FORMAT_REGEX = re.compile(r""".*? (sshd.*?:|\[sshd\]) (?P<message>.*)""") >- #SSHD_FORMAT_REGEX = re.compile(r""".* sshd.*: (?P<message>.*)""") >- >--FAILED_ENTRY_REGEX = re.compile(r"""Failed (?P<method>.*) for (?P<invalid>invalid user |illegal user )?(?P<user>.*?) .*from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") >-+FAILED_ENTRY_REGEX = re.compile(r"""Failed (?P<method>\S*) for (?P<invalid>invalid user |illegal user )?(?P<user>.*) from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$""") >- >--FAILED_ENTRY_REGEX2 = re.compile(r"""(?P<invalid>(Illegal|Invalid)) user (?P<user>.*?) .*from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") >-+FAILED_ENTRY_REGEX2 = re.compile(r"""(?P<invalid>(Illegal|Invalid)) user (?P<user>.*) from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$""") >- >--FAILED_ENTRY_REGEX3 = re.compile(r"""Authentication failure for (?P<user>.*) .*from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") >-+FAILED_ENTRY_REGEX3 = None >- >--FAILED_ENTRY_REGEX4 = re.compile(r"""Authentication failure for (?P<user>.*) .*from (?P<host>.*)""") >-+FAILED_ENTRY_REGEX4 = re.compile(r"""Authentication failure for (?P<user>.*) from (::ffff:)?(?P<host>\S+)$""") >- > -FAILED_ENTRY_REGEX5 = re.compile(r"""User (?P<user>.*) .*from (?P<host>.*) not allowed because none of user's groups are listed in AllowGroups""") >-+FAILED_ENTRY_REGEX5 = re.compile(r"""User (?P<user>.*) from (::ffff:)?(?P<host>\S+) not allowed because none of user's groups are listed in AllowGroups$""") >++FAILED_ENTRY_REGEX5 = re.compile(r"""User (?P<user>.*) .*from (?P<host>.*) 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<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") >-+FAILED_ENTRY_REGEX6 = re.compile(r"""Did not receive identification string .*from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$""") >+ FAILED_ENTRY_REGEX6 = re.compile(r"""Did not receive identification string .*from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") > >--FAILED_ENTRY_REGEX7 = re.compile(r"""User (?P<user>.*) not allowed because not listed in AllowUsers""") >-+FAILED_ENTRY_REGEX7 = re.compile(r"""User (?P<user>.*) from (::ffff:)?(?P<host>\S+) not allowed because not listed in AllowUsers$""") >- >- >- # these are reserved for future versions >-@@ -42,7 +42,7 @@ >- FAILED_ENTRY_REGEX_MAP[i] = rx >- >- >--SUCCESSFUL_ENTRY_REGEX = re.compile(r"""Accepted (?P<method>.*) for (?P<user>.*?) from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""") >-+SUCCESSFUL_ENTRY_REGEX = re.compile(r"""Accepted (?P<method>\S+) for (?P<user>.*?) from (::ffff:)?(?P<host>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$""") >- >- TIME_SPEC_REGEX = re.compile(r"""(?P<units>\d*)\s*(?P<period>[smhdwy])?""") >- >Index: files/patch-DenyHosts__report.py >=================================================================== >--- files/patch-DenyHosts__report.py (revision 0) >+++ files/patch-DenyHosts__report.py (working copy) >@@ -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: > >Property changes on: files/patch-DenyHosts__report.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-DenyHosts__restricted.py >=================================================================== >--- files/patch-DenyHosts__restricted.py (revision 0) >+++ files/patch-DenyHosts__restricted.py (working copy) >@@ -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: > >Property changes on: files/patch-DenyHosts__restricted.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__sync.py >=================================================================== >--- files/patch-DenyHosts__sync.py (revision 0) >+++ files/patch-DenyHosts__sync.py (working copy) >@@ -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 >+ > >Property changes on: files/patch-DenyHosts__sync.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-DenyHosts__util.py >=================================================================== >--- files/patch-DenyHosts__util.py (revision 0) >+++ files/patch-DenyHosts__util.py (working copy) >@@ -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() > >Property changes on: files/patch-DenyHosts__util.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-daemon-control-dist >=================================================================== >--- files/patch-daemon-control-dist (revision 351057) >+++ files/patch-daemon-control-dist (working copy) >@@ -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): >Index: files/patch-denyhosts.cfg-dist >=================================================================== >--- files/patch-denyhosts.cfg-dist (revision 351057) >+++ files/patch-denyhosts.cfg-dist (working copy) >@@ -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 > # >Index: files/patch-denyhosts.py >=================================================================== >--- files/patch-denyhosts.py (revision 0) >+++ files/patch-denyhosts.py (working copy) >@@ -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) >+ > >Property changes on: files/patch-denyhosts.py >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Index: files/patch-plugins__test_deny.py >=================================================================== >--- files/patch-plugins__test_deny.py (revision 0) >+++ files/patch-plugins__test_deny.py (working copy) >@@ -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) > >Property changes on: files/patch-plugins__test_deny.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-scripts__restricted_from_invalid.py >=================================================================== >--- files/patch-scripts__restricted_from_invalid.py (revision 0) >+++ files/patch-scripts__restricted_from_invalid.py (working copy) >@@ -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 > >Property changes on: files/patch-scripts__restricted_from_invalid.py >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/patch-scripts__restricted_from_passwd.py >=================================================================== >--- files/patch-scripts__restricted_from_passwd.py (revision 351057) >+++ files/patch-scripts__restricted_from_passwd.py (working copy) >@@ -1,10 +1,21 @@ >---- ./scripts/restricted_from_passwd.py.orig 2013-12-28 18:51:41.000000000 +0100 >-+++ ./scripts/restricted_from_passwd.py 2013-12-28 18:51:41.000000000 +0100 >-@@ -12,6 +12,7 @@ >+--- ./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", >-+ "/usr/sbin/nologin", >+- >+-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) >+ >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 187408
:
140721
|
140722
| 140723