Diff

Differences From Artifact [a60ac58fb4]:

To Artifact [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