Commits

Martin Tournoij  committed 7829091

Fix a few minor bugs

  • Participants
  • Parent commits 8345e6d
  • Tags version-1.0

Comments (0)

Files changed (3)

 Use `./pwbunny filename` to start the program.
 
 You will need Vim 7.3 or later.
-This program was tested on FreeBSD 9, and Ubuntu 12; it will *probably* also
-work on other POSIX systems (Other Linux systems, OpenBSD, MacOSX, etc.).  
+This program was tested on FreeBSD, Ubuntu 12.04, and ArchLinux; it will
+*probably* also work on other POSIX systems (Other Linux systems, OpenBSD,
+MacOSX, etc.).  
 It will *not* work on Windows.
 
 
 - An entry *must* have at least 3 lines.
 - An entry *must* be followed by 1 or more empty lines; except for the last
   entry, where an empty line is *optional*.
-- The 1st line *must* be the title, which also doubles as the URL.
+- The 1st line *must* be the title, which also doubles as the domain.
 - The 2nd line *must* be the username.
 - The 3rd line *must* be the password.
-- An entry *may* have as many lines as desired. This is useful for storing notes
-  and extra data (eg. SSH fingerprints).
+- An entry *may* have as many lines as desired. This is useful for storing
+  notes, answers to 'security questions' (which should also be random), and
+  other extra data (eg. SSH fingerprints).
 
 
 Security
 TODO
 ----
 - Undo after `PwbunnySort()` removes all folds
-- Make `\c` & `\u` work over ssh sessions
+- Document how to make `\c` & `\u` work over ssh sessions
 - Prepare for unexpected inquisitions
 
 
 
 	clear
 	echo "That seems to be the wrong password; press enter to try again, or ^C to abort"
+
+	# Make sure we don't echo anything to the screen, in the case the user
+	# enters the password here (as I did a few times...)
+	# TODO: We really want to solve this better by allowing password input here
+	stty -echo
 	read x
+	stty echo
 done
 
 
 # The MIT License (MIT)
 #
-# Copyright © 2013 Martin Tournoij
+# Copyright © 2014 Martin Tournoij
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to
 
 " Try and see if we can access the clipboard
 " You could set this manually for a better startup time if you're using a
-" commandline utility
-let s:copymethod = has('clipboard')
+" commandline utility`
+" TODO: Are clipboard *and* xterm_clipboard really required? Figure out the
+" difference...
+let s:copymethod = has('clipboard') && has('xterm_clipboard')
 
 if s:copymethod == '0'
 	if system('which xclip  > /dev/null && echo -n 0 || echo -n 1') == '0'
 
 	if s:emptyclipboard > 0
 		let l:i = 0
+		let l:wait = s:emptyclipboard * 10
 
-		while  l:i < s:emptyclipboard
-			echon "\rPassword copied; clipboard will be emptied in " . (s:emptyclipboard - l:i) . " seconds (^C to cancel)"
-			execute "sleep 1"
+		" If we sleep in steps of 1s, pasting has a delay of 1s
+		while  l:i < l:wait
+			echon "\rPassword copied; clipboard will be emptied in " . ((l:wait - l:i) / 10) . " seconds (^C to cancel)"
+			execute "sleep 100m"
 			let l:i += 1
 		endwhile
 
 
 " Clear the clipboard
 fun! PwbunnyEmptyClipboard()
-	if !PwbunnyCopyToClipboard('')
+	" Using an empty clipboard doesn't seem to work with:
+	" let @* = a:str
+	if !PwbunnyCopyToClipboard(' ')
 		return
 	endif
 	
 endfun
 
 
-" If there are less than 2 + (bytes / 100) newlines, we assume the password
+" If there are less than 3 + (bytes / 100) newlines, we assume the password
 " is incorrect, and we're displaying a bunch of gibberish. Quit, and try
 " again
 fun! PwbunnyOpen()
-	if line("$") < 2 + (line2byte(line("$")) / 100)
+	if getline(1) != '' && line("$") < 3 + (line2byte(line("$")) / 100)
 		" User pressed ^C
 		if strpart(getline("."), 0, 12) == "VimCrypt~02!"
 			quit!