diff options
author | asq <asq@asq.art.pl> | 2014-04-03 17:15:37 +0200 |
---|---|---|
committer | Anna Janackova <anna.janackova@gmail.com> | 2014-06-24 08:11:44 +0200 |
commit | b70fcc845696f58b2a5d36039df5f2c8c1dd2e04 (patch) | |
tree | bbb7c1cb640552e3582872d460ccde16805c56fe /lib/trocla.rb | |
parent | 44027adce7333c406e3308686b53b31c43161efa (diff) |
add option to generate shell-safe passwords
basically excludes characters that might be dangerous if used in shell.
many passwords generated by trocla may end up in some sort of bash
scripts (initscripts, sourced shell variables, etc) which may yeld
problems with default trocla random generator.
this can be now changed either in troclarc (with "shellsafe: true")
or on (ie. "trocla create foo plain '{ length: 32, shellsafe: true}'").
Diffstat (limited to 'lib/trocla.rb')
-rw-r--r-- | lib/trocla.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/trocla.rb b/lib/trocla.rb index 4e7bedb..7755149 100644 --- a/lib/trocla.rb +++ b/lib/trocla.rb @@ -22,7 +22,7 @@ class Trocla plain_pwd = get_password(key,'plain') if options['random'] && plain_pwd.nil? - plain_pwd = Trocla::Util.random_str(options['length']) + plain_pwd = Trocla::Util.random_str(options['length'],options['shellsafe']) set_password(key,'plain',plain_pwd) unless format == 'plain' elsif !options['random'] && plain_pwd.nil? raise "Password must be present as plaintext if you don't want a random password" |