The unified diff between revisions [8ffe6625..] and [cbb4788e..] is displayed below. It can also be downloaded as a raw diff.

#
#
# patch "plugins/postgresql.py"
#  from [d5a85a5e564d3dcc09cfb170575c0edf2b38bd36]
#    to [31cd15378c86802c279a8a976097103ef22c8387]
#
# patch "plugins/smb.py"
#  from [7a57a62b47f16c35eaffd39dcb92dc3a20e7594a]
#    to [7ff6cfe8569f5f11677b984431c25aa6a2c5a399]
#
# patch "plugins/x11.py"
#  from [b9a0175dc96e6e471d3f2eb08d488bb120047325]
#    to [7d40157ebd174729abd72daf522b6c2b7e05939a]
#
# patch "scan.py"
#  from [83d5f22c453318651dc8455ed85f28c111c0449c]
#    to [4eb1704670d1258628116573a32af771b9d58278]
#
============================================================
--- plugins/postgresql.py	d5a85a5e564d3dcc09cfb170575c0edf2b38bd36
+++ plugins/postgresql.py	31cd15378c86802c279a8a976097103ef22c8387
@@ -2,6 +2,7 @@ import sys
 import socket
 import threading
 import sys
+import sets
 from pyPgSQL import libpq

 export = {
@@ -13,7 +14,8 @@ cnx = None

 lock = threading.Lock()
 cnx = None
-seen_hosts = set()
+results_db = None
+seen_hosts = sets.Set()

 def q(s):
 	if s == None: return "NULL"
@@ -22,9 +24,9 @@ def initialise(library):
 def initialise(library):
 	global cnx
 	cnx = libpq.PQconnectdb(library.config.connect_str)
-	cnx.query("DELETE FROM urgency")
+	cnx.query("DELETE FROM proktos_urgency")
 	for urgency in library.urgency_to_string:
-		cnx.query("INSERT INTO urgency (urgency,description) VALUES (%d,%s)" % (urgency, q(library.urgency_to_string[urgency])))
+		cnx.query("INSERT INTO proktos_urgency (urgency,description) VALUES (%d,%s)" % (urgency, q(library.urgency_to_string[urgency])))

 def finalise(library):
 	return
@@ -37,8 +39,8 @@ def write_results(library, host, plugins
 		if (result.address[0]) not in seen_hosts:
 			seen_hosts.add(result.address[0])
 			for plugin in plugins:
-				cnx.query("DELETE FROM results WHERE address=" + q(result.address[0]) + " AND plugin_name=" + q(plugin))
-		query = "INSERT INTO results (updated,address,plugin_name,tcp_ports,udp_ports,urgency,short_mesg,long_mesg,advice) VALUES (now(),"
+				cnx.query("DELETE FROM proktos_results WHERE address=" + q(result.address[0]) + " AND plugin_name=" + q(plugin))
+		query = "INSERT INTO proktos_results (updated,address,plugin_name,tcp_ports,udp_ports,urgency,short_mesg,long_mesg,advice) VALUES (now(),"
 		udp_ports = result.udp_ports
 		if udp_ports != None: udp_ports = ','.join(map(str, udp_ports))
 		tcp_ports = result.tcp_ports
============================================================
--- plugins/smb.py	7a57a62b47f16c35eaffd39dcb92dc3a20e7594a
+++ plugins/smb.py	7ff6cfe8569f5f11677b984431c25aa6a2c5a399
@@ -44,7 +44,7 @@ def host_callback(library, host, tcp_por
 		critical = []
 		file_count = 0
 		smbclient = smbwrapper.build_basic_smbclient(address, workgroup, username=library.config.username) + " -c 'DIR' " + pipes.quote('//%s/%s' % (node, share))
-		result = run_command(smbclient, library.config.socket_timeout)
+		result = run_command(smbclient, library.config.socket_timeout, send_kill=True)
 		if result['timeout']: break # host probably down
 		lines = result['fromchild'].split('\n')
 		for line in lines:
============================================================
--- plugins/x11.py	b9a0175dc96e6e471d3f2eb08d488bb120047325
+++ plugins/x11.py	7d40157ebd174729abd72daf522b6c2b7e05939a
@@ -24,7 +24,7 @@ def host_callback(library, host, tcp_por
 		if port >= 6000: display_id = port - 6000
 		else: display_id = 0
 		display = "%s:%s" % (address, display_id)
-		result = run_command("%s/x11/x11 %s >/dev/null 2>&1" % (library.config.plugin_path, display), library.config.socket_timeout)
+		result = run_command("%s/x11/x11 %s >/dev/null 2>&1" % (library.config.plugin_path, display), library.config.socket_timeout, send_kill=True)
 		if result['timeout']: return rv
 		if result['exitcode'] == 0:
 			response = scan.ScannerResponse()
============================================================
--- scan.py	83d5f22c453318651dc8455ed85f28c111c0449c
+++ scan.py	4eb1704670d1258628116573a32af771b9d58278
@@ -40,14 +40,13 @@ def scan_host(mythread, host, library):
 	fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NDELAY)

 def scan_host(mythread, host, library):
-	library.notify("[%2d] %-15s: has been assigned (T:%s U:%s)" % (mythread.id, host.addresses[0][0], str(host.tcp_ports), str(host.udp_ports)))
+	# if the magic UDP port is open, then ignore any open UDP ports
+	if config.magic_udp_port in host.udp_ports:
+		host.udp_ports = []
 	plugins = library.plugins_for_ports(host.tcp_ports, host.udp_ports)
+	library.notify("[%2d] %-15s: has been assigned (T:%s U:%s)" % (mythread.id, host.addresses[0][0], str(host.tcp_ports), str(host.udp_ports)))
 	errors = []
 	results = []
-	# if the magic UDP port is open, then ignore any open UDP ports
-	if config.magic_udp_port in host.udp_ports:
-		library.notify("ignoring UDP ports; magic UDP port %d open" % (config.magic_udp_port))
-		host.udp_ports = []
 	for plugin in plugins:
 		tcp_ports = filter(lambda x: x in plugins[plugin][0], host.tcp_ports)
 		udp_ports = filter(lambda x: x in plugins[plugin][1], host.udp_ports)
@@ -68,7 +67,10 @@ def scan_host(mythread, host, library):
 		plugin.write_errors(library, host, errors)
 	mythread.status_string = None
 	library.notify("[%2d] %-15s: done with this host" % (mythread.id, host.addresses[0][0]))
+	# clean up memory explicitly, as otherwise Python might not garbage collect
+	# quickly enough for us.
 	del results
+	del errors

 # (I hate Unix) : setting a SIGCHLD handler will start me getting
 # lots of exceptions whenver I do blah.read(), select(), etc.. which