Check-in [92d30d85bb]
Overview
SHA1:92d30d85bbfd4c899d1a7f19386b3ae6725e7f73
Date: 2016-03-15 18:32:32
User: rkeene
Comment:Added a "whoami" command to determine the current users
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2016-03-15
18:35
[21bc3c9fe8] Updated to make verification failure more fatal (user: rkeene, tags: trunk)
18:32
[92d30d85bb] Added a "whoami" command to determine the current users (user: rkeene, tags: trunk)
18:28
[d12f13c977] Added verification system so that passwords are only updated if they currently contain a valid password (user: rkeene, tags: trunk)
Changes

Modified hunter2 from [e039ea66c1] to [f70b629bc8].

    25     25   # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
    26     26   # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
    27     27   # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    28     28   
    29     29   set passwordFile [lindex $argv 0]
    30     30   set action [lindex $argv 1]
    31     31   
    32         -set validCommands [list "listLocalKeys" "listPasswords" "listAvailablePasswords" "listUsers" "addUser" "addPassword" "authorizeUser" "authorizeUsers" "deauthorizeUser" "deauthorizeUsers" "getPassword" "updatePassword" "deletePassword" "help"]
           32  +set validCommands [list "listLocalKeys" "listPasswords" "listAvailablePasswords" "listUsers" "addUser" "addPassword" "authorizeUser" "authorizeUsers" "deauthorizeUser" "deauthorizeUsers" "getPassword" "updatePassword" "deletePassword" "help" "whoami"]
    33     33   
    34     34   proc _argDescription {command argName} {
    35     35   	switch -- $argName {
    36     36   		"passwordName" {
    37     37   			return "$argName - Name of the password entry"
    38     38   		}
    39     39   		"key" {
................................................................................
   551    551   		set changeRequired 1
   552    552   	}
   553    553   }
   554    554   
   555    555   proc deauthorizeUser {passwordName userName} {
   556    556   	return [deauthorizeUsers $passwordName $userName]
   557    557   }
          558  +
          559  +proc whoami {} {
          560  +	foreach slotInfoDict [_listCertificates] {
          561  +		unset -nocomplain slotInfo
          562  +		array set slotInfo $slotInfoDict
          563  +
          564  +		set pubkey $slotInfo(pubkey)
          565  +
          566  +		unset -nocomplain row
          567  +		db eval {SELECT name FROM users WHERE publicKey = $pubkey;} row {
          568  +			set users($row(name)) 1
          569  +		}
          570  +	}
          571  +
          572  +	puts [join [array names users] {, }]
          573  +}
   558    574   
   559    575   proc help {{action ""}} {
   560    576   	_printHelp stdout $action
   561    577   }
   562    578   # End user CLI functions
   563    579   
   564    580   ### MAIN