Dar: elastic buffer error with password starting with colon
When trying to access a dar archive, dar gives me the error message:
FATAL error, aborting operation too large elastic buffer or elastic buffer incoherent structure
It appears that typing a password starting with a colon (:) causes the error.
Steps to reproduce the problem
1. Create a dar archive
cd /tmp # Create colon.1.dar with colon-password ':abc' # NOTE: Password will become 'abc'. dar -K:abc --include foobar -c colon # Create nocolon.1.dar with no-colon-password 'abc' dar -Kabc --include foobar -c nocolon # Try listing the archives, ask for password dar -K: -l colon # SURPRISE: The password now is 'abc', not ':abc' dar -K: -l nocolon # The password is 'abc'
It appears that dar 'eats' the colon (:) as cipher-algorithm-delimiter. From the dar manpage:
-K, --key [[<algo>]:]<string> encrypt/decrypt the archive using the <algo> cipher with the <string> as pass phrase. An encrypted archive can only be read if the same pass phrase is given. Available ciphers are "blowfish" (alias "bf"), "aes", "twofish", "serpent" and "camellia" for strong encryption and "scrambling" (alias "scram") for a very weak encryption. By default if no <algo> or no ':' is given, the blowfish cipher is assumed. If your password contains a column ':' you need to specify the cipher to use (or at least use the initial ':' which is equivalent to 'bf:'). If the <string> is empty the pass phrase will be asked at execution time. Thus, the smallest argument that -K can receive is ':' which means blowfish cipher with the pass phrase asked at execution time.
If you want to use a password starting with a colon, you have to specify an additional colon:
# Create archive dar -K::abc --include foobar -c colon # List archive dar -K: -l colon # Password is ':abc'
Or even better, specify "aes" cipher for stronger encryption:
# Create archive dar -Kaes::abc --include foobar -c colon # List archive dar -Kaes: -l colon # Password is ':abc'
Please note that you have to specify the cipher. Otherwise, dar doesn't detect the used cipher and will give the error again:
$ # ERROR: Dar uses blowfish instead of aes-cipher $ dar -K: -l colon # You should use: dar -Kaes: -l colon Archive colon requires a password: Warning, the archive colon has been encrypted. A wrong key is not possible to detect, it would cause DAR to report the archive as corrupted FATAL error, aborting operation elastic buffer incoherent structure
Or even better, don't use colons at all in your dar-password...