Skip to contentSkip to conversation

patch to sepcut tool

PATCH Frank Mayer 1 participant 1 message Jan 22, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

Attached is a patched to setools v0.6.1 which was included in last week's selinux distribution. This patch fixes a file handling bug in sepcut (a basic policy browser/editor). This patch will also be posted on www.tresys.com/selinux for those of you who downloads setools from there.

To apply, copy the patch to selinux/tools, cd there, and do 'patch -p1 < sepcut.patch'

Frank

setools/sepct/browser.tcl +1 -0
diff -ruN rel-0-6-1/setools/sepct/browser.tcl rel-0-6-1-patched/setools/sepct/browser.tcl
@@ -274,6 +274,7 @@
 	    	}
 	} else {
 		# no file current opened or was moved/removed
+		set curr_file ""
 		$text_c delete 0.0 end
 		Sepct::clear_fileStatus
 		Sepct_Browse::reset_dirtyState
setools/sepct/db.tcl +14 -6
diff -ruN rel-0-6-1/setools/sepct/db.tcl rel-0-6-1-patched/setools/sepct/db.tcl
@@ -290,25 +290,33 @@
 		puts stderr "Problem getting file info data for $oldfn"
 		return -1
 	}
+	# First, check if oldfn is in modlist 
+	set rt [Sepct_db::getModFile_Data $oldfn old_data]
+	
+	if {$rt != -1} {
+		# oldfn IS in mod list
+		Sepct_db::remove_from_mod_List $oldfn
+	}
+	
+	# Remove the file from its' parent node in the tree 
 	if { [Sepct_db::remove_file $oldfn] == -1 } {
 		puts stderr "Problem removing $oldfn"
 		return -1
 	}
+	
+	# Add the new file to parent node in the tree 
 	if {[Sepct_db::add_file $newfn 0] == -1 }  {
 		puts stderr "Problem adding $newfn"
 		return -1
 	}
 	
-	# now check if oldfn is in modlist and if so rename it to newfn
-	set rt [Sepct_db::getModFile_Data $oldfn old_data]
-	if {$rt != -1 } {
-		# oldfn IS in mod list
-		Sepct_db::remove_from_mod_List $oldfn
+	# Add newfn to the modlist.
+	if {$rt != -1} {
 		set cnt [Sepct_db::add_to_mod_List $newfn $old_data]
 	} else {
 		set cnt 0
 	}
-
+		
 	return $cnt
 }