From 35774ec5682ae54f4cd71275b8055eef2aa64cb1 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 14 Oct 2004 07:11:57 +0000 Subject: * misc.c (is_secured_filename): New. * keydb.c (maybe_create_keyring) * tdbio.c (tdbio_set_dbname) * plaintext.c (handle_plaintext) * openfile.c (copy_options_file, open_outfile) * exec.c (exec_write) * keygen.c (do_generate_keypair, gen_card_key_with_backup) * sign.c (sign_file, clearsign_file) * keyring.c (create_tmp_file, do_copy): Check for secured files before creating them. * keygen.c (print_status_key_created): s/unsigned char/byte/ due to a strange typedef for RISC OS. Noted by Stefan. --- g10/plaintext.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'g10/plaintext.c') diff --git a/g10/plaintext.c b/g10/plaintext.c index 8b782add7..2e3c49907 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -128,6 +128,13 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx, #ifndef __riscos__ if( fp || nooutput ) ; + else if (is_secured_filename (fname)) + { + errno = EPERM; + log_error(_("error creating `%s': %s\n"), fname, strerror(errno) ); + rc = G10ERR_CREATE_FILE; + goto leave; + } else if( !(fp = fopen(fname,"wb")) ) { log_error(_("error creating `%s': %s\n"), fname, strerror(errno) ); rc = G10ERR_CREATE_FILE; -- cgit