OpenVPN/easy-rsa — pull request #26 by luizluca (2014-03-21 17:43:02+00:00)
Title: use temp files to avoid loss of files on error

This patch change easyrsa to use tempfiles for openssl output files. This prevents file destruction when openssl fails (like trying to sign a req twice will destroy the first output crt).

I'm using a little dirty approach with multiple tempfiles vars. However, I wrote a list-based alternative before and it was much more complex (see branch https://github.com/luizluca/easy-rsa/tree/temp_files for list as string sep by new line and https://github.com/luizluca/easy-rsa/compare/temp_files_simpler for fake array).

I also changed the clean_temp to be called by trap EXIT. This is POSIX compatible and avoids multiple calls of it.

I think that even EASYRSA_TEMP_FILE should use mktemp.

If mktemp is not a desired dependency (not a POSIX required command), I could implement a dummy one.