diff options
author | Werner Koch <wk@gnupg.org> | 2004-10-13 20:10:06 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2004-10-13 20:10:06 +0200 |
commit | 151ca81f1a5a03ae83d9c14ab7748a2d3c09919e (patch) | |
tree | 38cc8933051a1e45cd3e95cd8cc66746290f7e31 /g10/dearmor.c | |
parent | Add dearmor.c (diff) | |
download | gnupg2-151ca81f1a5a03ae83d9c14ab7748a2d3c09919e.tar.xz gnupg2-151ca81f1a5a03ae83d9c14ab7748a2d3c09919e.zip |
Added SELInux hacks and did some cleanups.
Diffstat (limited to 'g10/dearmor.c')
-rw-r--r-- | g10/dearmor.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/g10/dearmor.c b/g10/dearmor.c index 4ec8fa012..355820d9f 100644 --- a/g10/dearmor.c +++ b/g10/dearmor.c @@ -33,7 +33,7 @@ #include "packet.h" #include "options.h" #include "main.h" - +#include "i18n.h" /**************** * Take an armor file and write it out without armor @@ -49,8 +49,15 @@ dearmor_file( const char *fname ) memset( &afx, 0, sizeof afx); /* prepare iobufs */ - if( !(inp = iobuf_open(fname)) ) { - log_error("can't open %s: %s\n", fname? fname: "[stdin]", + inp = iobuf_open(fname); + if (inp && is_secured_file (iobuf_get_fd (inp))) + { + iobuf_close (inp); + inp = NULL; + errno = EPERM; + } + if (!inp) { + log_error(_("can't open `%s': %s\n"), fname? fname: "[stdin]", strerror(errno) ); rc = G10ERR_OPEN_FILE; goto leave; @@ -91,9 +98,16 @@ enarmor_file( const char *fname ) memset( &afx, 0, sizeof afx); /* prepare iobufs */ - if( !(inp = iobuf_open(fname)) ) { - log_error("can't open %s: %s\n", fname? fname: "[stdin]", - strerror(errno) ); + inp = iobuf_open(fname); + if (inp && is_secured_file (iobuf_get_fd (inp))) + { + iobuf_close (inp); + inp = NULL; + errno = EPERM; + } + if (!inp) { + log_error(_("can't open `%s': %s\n"), fname? fname: "[stdin]", + strerror(errno) ); rc = G10ERR_OPEN_FILE; goto leave; } |