Skip to content

Commit

Permalink
Fix hexadecimal conversion of e.g. passwords
Browse files Browse the repository at this point in the history
The od / sed / sed pipeline caused longer passwords to be wrapped causing the
mount tools to trip over password entry, resulting in authentication failures.
This approach uses a simpler setup with `xxd` which correctly converts all
input bytes into the format `expect` requires to enter the password.
  • Loading branch information
Jelle Raaijmakers committed Jul 2, 2020
1 parent 7f50251 commit c36605b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions automount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ function getKeychainProtocol {
}

function convertToHexCode {
tr -d '\n' |\
od -A n -t x1 |\
sed -E 's/^ */ /;s/ *$//;s/ /\\x/g'
tr -d '\n' \
| xxd -pu \
| sed -E 's/(.{2})/\\x\1/g'
}

function getPasswordFromKeychain {
Expand Down

0 comments on commit c36605b

Please sign in to comment.