[Oval-commits] r63 - in trunk/Interpreters/src: linux probes/linux

Pavel Vinogradov blaze-guest at alioth.debian.org
Tue Jul 10 10:11:38 UTC 2007


Author: blaze-guest
Date: 2007-07-10 10:11:38 +0000 (Tue, 10 Jul 2007)
New Revision: 63

Added:
   trunk/Interpreters/src/probes/linux/DPKGInfoProbe.h
Modified:
   trunk/Interpreters/src/linux/ProbeFactory.cpp
   trunk/Interpreters/src/linux/ProbeFactory.h
Log:
Integrate DPKGInfoProbe class into interpretator

Modified: trunk/Interpreters/src/linux/ProbeFactory.cpp
===================================================================
--- trunk/Interpreters/src/linux/ProbeFactory.cpp	2007-07-10 09:05:57 UTC (rev 62)
+++ trunk/Interpreters/src/linux/ProbeFactory.cpp	2007-07-10 10:11:38 UTC (rev 63)
@@ -82,7 +82,7 @@
 
 // here are the objects defined in the linux schema
 	} else if(objectName.compare("dpkginfo_object") == 0) {
-		// Not currently implemented
+		probe = DPKGInfoProbe::Instance();
 	} else if(objectName.compare("inetlisteningservers_object") == 0) {
 		probe = InetListeningServersProbe::Instance();
 	} else if(objectName.compare("rpminfo_object") == 0) {
@@ -109,7 +109,10 @@
 
 	probe = RPMInfoProbe::Instance();
 	delete probe;
-
+	
+	probe = DPKGInfoProbe::Instance();
+	delete probe;
+	
 	probe = ProcessProbe::Instance();
 	delete probe;
 

Modified: trunk/Interpreters/src/linux/ProbeFactory.h
===================================================================
--- trunk/Interpreters/src/linux/ProbeFactory.h	2007-07-10 09:05:57 UTC (rev 62)
+++ trunk/Interpreters/src/linux/ProbeFactory.h	2007-07-10 10:11:38 UTC (rev 63)
@@ -47,6 +47,7 @@
 #include "FamilyProbe.h"
 #include "UnameProbe.h"
 #include "RPMInfoProbe.h"
+#include "DPKGInfoProbe.h"
 #include "InetListeningServersProbe.h"
 #include "ProcessProbe.h"
 //#include "ShadowProbe.h"

Added: trunk/Interpreters/src/probes/linux/DPKGInfoProbe.h
===================================================================
--- trunk/Interpreters/src/probes/linux/DPKGInfoProbe.h	                        (rev 0)
+++ trunk/Interpreters/src/probes/linux/DPKGInfoProbe.h	2007-07-10 10:11:38 UTC (rev 63)
@@ -0,0 +1,104 @@
+//
+// $Id: DPKGInfoProbe.h 4194 2007-07-03 15:33:35Z blaze $
+//
+//****************************************************************************************//
+// Copyright (c) 2002-2007, The MITRE Corporation
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+//     * Redistributions of source code must retain the above copyright notice, this list
+//       of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above copyright notice, this 
+//       list of conditions and the following disclaimer in the documentation and/or other
+//       materials provided with the distribution.
+//     * Neither the name of The MITRE Corporation nor the names of its contributors may be
+//       used to endorse or promote products derived from this software without specific 
+//       prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
+// SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+// TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+//****************************************************************************************//
+
+#ifndef DPKGInfoProbe_H
+#define DPKGInfoProbe_H
+
+#include "AbsProbe.h"
+
+#include <apt-pkg/progress.h> 	//OpTextProgress
+#include <apt-pkg/cachefile.h> 	//pkgCacheFile
+#include <apt-pkg/configuration.h> //_config
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/termios.h>
+#include <sys/wait.h>
+
+#include <fcntl.h>
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+using namespace std;
+/**
+	Data collector for dpkg info test.
+*/
+class DPKGInfoProbe : public AbsProbe {
+public:
+	~DPKGInfoProbe();       
+
+	ItemVector* CollectItems(Object* object);
+	Item* CreateItem();
+
+	/** Ensure that the DPKGInfoProbe is a singleton. */
+	static AbsProbe* Instance();
+
+private:
+	DPKGInfoProbe();
+
+	/**
+		Return the name of all debs on the system that match the specirfied Object entity's criteria.
+		All names that are return have been checked and exist on the system.
+		@param name an ObjectEntity* that represents the objects to collect on the system
+		@return The matching names
+	*/
+	StringVector* GetDPKGNames(ObjectEntity* name);
+
+	/**
+		Get all deb names on the system that match the specified pattern.
+		@param pattern a string used that deb names are compared against.
+		@param isRegex a bool that is indicates how system deb names should be compared against the specifed pattern
+		@return The set of matching names.
+	*/
+	StringVector* GetMatchingDPKGNames(string pattern, bool isRegex);
+
+	/**
+		Return true if the specifeid deb exists on the system.
+		@param name a string that hold the name of the deb to check for.
+		@result The result of checking for the specifed deb on the system.
+	*/
+	bool DPKGExists(string name);
+
+	/**
+		Get all the information for the named deb.
+		@param name a string representing the name of an deb on the system.
+		@param items a vector of items that matched the deb name.
+	*/
+	void GetDPKGInfo(string name, ItemVector* items);
+
+	char *readHeaderString(Header header, int_32 tag_id);
+
+	static DPKGInfoProbe *instance;
+};
+
+#endif




More information about the Oval-commits mailing list