Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use temp files to avoid loss of files on error #26

Merged
merged 1 commit into from Aug 31, 2015

Conversation

luizluca
Copy link
Contributor

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.

@jirutka
Copy link

jirutka commented Aug 29, 2015

+1

ecrist added a commit that referenced this pull request Aug 31, 2015
luizluca: use temp files.  clean up is more stream lined and errors prevent loss of working files.
@ecrist ecrist merged commit 34b8784 into OpenVPN:master Aug 31, 2015
@luizluca luizluca deleted the temp_files_even_simplier branch September 24, 2018 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants