Re: Traceback

Varunram Ganesh <[email protected]>
Newsgroups gmane.comp.security.nmap.devel
Message-ID <[email protected]>
Hi Clive,

Thanks for your report! I've looked into the problem and it turns out we were executing the create table command irrespective of whether the drop command succeeded or not. The attached patch should clear this up.
Cheers,
Varunram

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/
patch.diff (application/octet-stream, 1.1 KB)
diff --git a/zenmap/zenmapCore/UmitDB.py b/zenmap/zenmapCore/UmitDB.py
index 75c4eda..f8fa9e3 100644
--- a/zenmap/zenmapCore/UmitDB.py
+++ b/zenmap/zenmapCore/UmitDB.py
@@ -266,13 +266,6 @@ class UmitDB(object):
     def create_db(self):
         drop_string = "DROP TABLE scans;"
 
-        try:
-            self.cursor.execute(drop_string)
-        except:
-            connection.rollback()
-        else:
-            connection.commit()
-
         creation_string = """CREATE TABLE scans (
             scans_id INTEGER PRIMARY KEY AUTOINCREMENT,
             scan_name TEXT,
@@ -280,8 +273,18 @@ class UmitDB(object):
             digest TEXT,
             date INTEGER)"""
 
-        self.cursor.execute(creation_string)
-        connection.commit()
+        try:
+            self.cursor.execute(drop_string)
+        except:
+            connection.rollback()
+        else:
+            connection.commit()
+            try:
+                self.cursor.execute(creation_string)
+            except:
+                connection.rollback()
+            else:
+                connection.commit()
 
     def add_scan(self, **kargs):
         return Scans(**kargs)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.