[Guessnet-devel] [svn] r132 - in trunk: . debian src

Enrico Zini enrico at costa.debian.org
Sun Oct 23 11:52:10 UTC 2005


Author: enrico
Date: Sun Oct 23 11:52:09 2005
New Revision: 132

Modified:
   trunk/README
   trunk/debian/changelog
   trunk/src/ChildProcess.h
   trunk/src/NetWatcher.cc
   trunk/src/NetWatcher.h
   trunk/src/ProcessRunner.cc
   trunk/src/ProcessRunner.h
   trunk/src/ScanConsumer.h
   trunk/src/Scanner.h
Log:
Script scans now look for the script in /usr/share/guessnet/test if they are
specified with relative paths.  It is easier to write in the config file, and
it avoids scripts specified without an absolute path to be run relative to the
current directory, which is bad.

Script scans now also get a sane and clean PATH, which includes the script
directory itself.


Modified: trunk/README
==============================================================================
--- trunk/README	(original)
+++ trunk/README	Sun Oct 23 11:52:09 2005
@@ -323,6 +323,11 @@
 the reply, for example, would be a very useful feature.
 
 
+'script' scan
+-------------
+
+Maintained by Enrico.
+
 
 TODO
 ====
@@ -405,6 +410,12 @@
 
  + Implemented peer test without destination IP, to test for the existance of
    physical interfaces with changing IP addresses.
+ + Script scans now look for the script in /usr/share/guessnet/test if they are
+   specified with relative paths.  It is easier to write in the config file,
+   and it avoids scripts specified without an absolute path to be run relative
+   to the current directory, which is bad.
+ + Script scans now get a sane and clean PATH, which includes the script
+   directory itself.
  
  
  * Done in version 0.35

Modified: trunk/debian/changelog
==============================================================================
--- trunk/debian/changelog	(original)
+++ trunk/debian/changelog	Sun Oct 23 11:52:09 2005
@@ -1,8 +1,19 @@
 guessnet (0.37-1) unstable; urgency=low
 
+  [ Thomas Hood ]
   * Bump Standards-Version to 3.6.2.1; no changes required
 
- -- Thomas Hood <jdthood at aglu.demon.nl>  Fri, 17 Jun 2005 10:09:09 +0200
+  [ Enrico Zini ]
+  * New upstream version
+    + Implemented peer test without destination IP, to test for the existance
+      of physical interfaces with changing IP addresses.
+    + Script scans now look for the script in /usr/share/guessnet/test instead
+      of current directory if they are specified with relative paths.
+      Hopefully noone used relative paths, as they didn't work.
+      Script scans now also get a sane and clean PATH, which includes the
+      script directory itself.  Closes: #257328.
+
+ -- Enrico Zini <enrico at debian.org>  Sun, 23 Oct 2005 13:48:03 +0200
 
 guessnet (0.36-1) unstable; urgency=low
 

Modified: trunk/src/ChildProcess.h
==============================================================================
--- trunk/src/ChildProcess.h	(original)
+++ trunk/src/ChildProcess.h	Sun Oct 23 11:52:09 2005
@@ -30,6 +30,8 @@
 	void detachFromTTY() throw (SystemException);
 
 public:
+	virtual ~Process() {}
+
 	// TODO: since the destructor is called twice (one in the parent and one in
 	// the child), it could be useful to add a bool isChild() method to let the
 	// destructor and other functions know where they are operating.  The value

Modified: trunk/src/NetWatcher.cc
==============================================================================
--- trunk/src/NetWatcher.cc	(original)
+++ trunk/src/NetWatcher.cc	Sun Oct 23 11:52:09 2005
@@ -216,6 +216,7 @@
 	} catch (Exception& e) {
 		error("%s: %.*s.  Quitting NetWatcher thread.\n", e.type(), PFSTR(e.desc()));
 	}
+	return 0;
 }
 
 

Modified: trunk/src/NetWatcher.h
==============================================================================
--- trunk/src/NetWatcher.h	(original)
+++ trunk/src/NetWatcher.h	Sun Oct 23 11:52:09 2005
@@ -55,6 +55,7 @@
 class PacketListener
 {
 public:
+	virtual ~PacketListener() {}
 	virtual void handleARP(const NetBuffer& pkt) throw () {}
 	virtual void handleDHCP(const NetBuffer& pkt) throw () {}
 	virtual void handleICMP(const NetBuffer& pkt) throw () {}

Modified: trunk/src/ProcessRunner.cc
==============================================================================
--- trunk/src/ProcessRunner.cc	(original)
+++ trunk/src/ProcessRunner.cc	Sun Oct 23 11:52:09 2005
@@ -39,6 +39,10 @@
 //#define DEBUG(args...) fprintf(stderr, ##args)
 #define DEBUG(args...) do {} while(0)
 
+static bool canRun(const string& file)
+{
+	return access(file.c_str(), X_OK) != -1;
+}
 
 class Script : public Process
 {
@@ -63,10 +67,20 @@
 		runner.addEnv("NAME=" + tag);
 		runner.addEnv("IFACE=" + iface);
 		runner.addEnv("GUESSNET=true");
+		runner.addEnv(string("PATH=") + SCRIPTDIR + ":/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
 
 		runner.addArg("/bin/sh");
 		runner.addArg("-c");
-		runner.addArg(cmdline);
+
+		// Try to find the command in known locations
+		string cmd = cmdline;
+		if (cmdline[0] != '/')
+		{
+			cmd = string(SCRIPTDIR) + "/" + cmdline;
+		}
+		if (!canRun(cmd))
+			throw SystemException(errno, "checking if " + cmd + " is executable");
+		runner.addArg(cmd);
 
 		DEBUG("SCRIPT MAIN Running %.*s\n", PFSTR(cmdline));
 

Modified: trunk/src/ProcessRunner.h
==============================================================================
--- trunk/src/ProcessRunner.h	(original)
+++ trunk/src/ProcessRunner.h	Sun Oct 23 11:52:09 2005
@@ -27,6 +27,7 @@
 class ProcessListener
 {
 public:
+	virtual ~ProcessListener() {}
 	virtual void handleTermination(const std::string& tag, int status) throw () {}
 };
 

Modified: trunk/src/ScanConsumer.h
==============================================================================
--- trunk/src/ScanConsumer.h	(original)
+++ trunk/src/ScanConsumer.h	Sun Oct 23 11:52:09 2005
@@ -6,6 +6,7 @@
 class ScanConsumer
 {
 public:
+	virtual ~ScanConsumer() {}
 	virtual void handleScan(const Scan* scan) throw () = 0;
 };
 

Modified: trunk/src/Scanner.h
==============================================================================
--- trunk/src/Scanner.h	(original)
+++ trunk/src/Scanner.h	Sun Oct 23 11:52:09 2005
@@ -27,6 +27,7 @@
 class ScannerListener
 {
 public:
+	virtual ~ScannerListener() {}
 	virtual void notifyScan(const Scan* scan) throw () = 0;
 };
 



More information about the Guessnet-devel mailing list