Check-in [fe9b9c5e48]
Overview
SHA1:fe9b9c5e48b35bc2397a3bb34ef976949ba87b8a
Date: 2016-03-15 19:51:31
User: rkeene
Comment:Updated password saving to be less atomic but more consistently able to preserve ACLs, permissions, etc
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2016-03-15
19:53
[fb8686074b] Better error handling without a PKCS#11 module (user: rkeene, tags: trunk)
19:51
[fe9b9c5e48] Updated password saving to be less atomic but more consistently able to preserve ACLs, permissions, etc (user: rkeene, tags: trunk)
19:41
[bf46eec3a7] Updated README to be more accurate and deal with the new storage mechanism (user: rkeene, tags: trunk)
Changes

Modified hunter2 from [a60ac58fb4] to [ec608c91c1].

   266    266   
   267    267   			$dbCmd eval "INSERT INTO $table ([join $keys {, }]) VALUES ([join $values {, }]);"
   268    268   		}
   269    269   	}
   270    270   }
   271    271   
   272    272   proc _saveDB {dbCmd fileName} {
   273         -	set tmpFileName "${fileName}.[expr rand()]"
   274         -
   275         -	file delete -force -- $tmpFileName
   276         -
   277         -	set fd [open $tmpFileName w]
   278         -
   279    273   	if {[info exists ::globalHeader($dbCmd)]} {
   280         -		puts $fd $::globalHeader($dbCmd)
          274  +		lappend output $::globalHeader($dbCmd)
   281    275   
   282    276   		unset ::globalHeader($dbCmd)
   283    277   	}
   284    278   
   285         -	puts $fd "# <AzureDiamond> oh, ok."
          279  +	lappend output "# <AzureDiamond> oh, ok."
   286    280   
   287    281   	foreach table [list users passwords] {
   288    282   		unset -nocomplain row
   289    283   		$dbCmd eval "SELECT * FROM $table ORDER BY name;" row {
   290    284   			set outputLine [list $table]
   291    285   
   292    286   			unset -nocomplain row(*)
................................................................................
   296    290   					set key ":$key"
   297    291   					set value [binary encode base64 $value]
   298    292   				}
   299    293   
   300    294   				lappend outputLine $key $value
   301    295   			}
   302    296   
   303         -			puts $fd $outputLine
          297  +			lappend output $outputLine
   304    298   		}
   305    299   	}
   306    300   
          301  +	set fd [open $fileName w 0600]
          302  +	puts $fd [join $output "\n"]
   307    303   	close $fd
   308         -
   309         -	catch {
   310         -		file attributes $tmpFileName {*}[file attributes $fileName]
   311         -	}
   312         -
   313         -	file rename -force -- $tmpFileName $fileName
   314    304   }
   315    305   
   316    306   proc _listCertificates {} {
   317    307   	if {![info exists ::env(PKCS11MODULE)]} {
   318    308   		return [list]
   319    309   	}
   320    310