summaryrefslogtreecommitdiffstats
path: root/g10/openfile.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpg: New commands --add-recipients and --change-recipients.Werner Koch2024-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/gpg.c (aAddRecipients, aChangeRecipients): New consts. (opts): Add --add-recipients and --change-recipients. (main): Handle them. * g10/gpg.h (struct server_control_s): Add fields modify_recipients, clear_recipients, and last_read_ctb. * g10/armor.c (was_armored): New. * g10/decrypt.c (decrypt_message): Add optional arg 'remusr'. Handle re-encryption if desired. * g10/encrypt.c (write_pubkey_enc): Factor info printing out to ... (show_encrypted_for_user_info): new. (reencrypt_to_new_recipients): New. * g10/packet.h (struct parse_packet_ctx_s): Add fields only_fookey_enc and last_ctb. (init_parse_packet): Clear them. * g10/parse-packet.c (parse): Store CTB in the context. Early return on pubkey_enc and symkey_enc packets if requested. * g10/mainproc.c (proc_encrypted): Allow for PKT being NULL. Return early in modify-recipients mode. (proc_encryption_packets): Add two optional args 'r_dek' and 'r_list'. Adjust callers. Call do_proc_packets in modify-recipients mode depending on the optional args. (do_proc_packets): Add arg 'keep_dek_and_list'. Adjust callers. Save the last read CTB in CTRL and return after the last fooenc_enc packets. -- This basically works but does not yet handle symmetric encrypted packets (symkey_enc). GnuPG-bug-id: 1825 (Yes, this is an at least 9 year old feature request)
* common: Introduce FD_DBG to display gnupg_fd_t value.NIIBE Yutaka2023-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/sysutils.h (FD_DBG): New. * agent/gpg-agent.c (check_nonce): Use FD_DBG. (do_start_connection_thread, start_connection_thread_ssh): Likewise. * common/iobuf.c (fd_cache_close, file_filter, do_open): Likewise. (do_iobuf_fdopen): Likewise. * dirmngr/dirmngr.c (check_nonce, start_connection_thread) (handle_connections): Likewise. * dirmngr/http.c (_my_socket_new, _my_socket_ref): Likewise. (_my_socket_unref): Likewise. * g10/decrypt.c (decrypt_message_fd): Likewise. * g10/encrypt.c (encrypt_crypt): Likewise. * g10/openfile.c (open_outfile): Likewise. * g10/plaintext.c (get_output_file, hash_datafile_by_fd): Likewise. * g10/verify.c (gpg_verify): Likewise. * kbx/keyboxd.c (check_nonce, do_start_connection_thread): Likewise. * scd/scdaemon.c (start_connection_thread): Likewise. (handle_connections): Likewise. * sm/gpgsm.c (open_es_fread, open_es_fwrite): Likewise. * tpm2d/tpm2daemon.c (start_connection_thread): Likewise. (handle_connections): Likewise. -- GnuPG-bug-id: 6597 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Format the value of type gnupg_fd_t by casting to int.NIIBE Yutaka2023-07-051-2/+2
| | | | | | | | | | | * g10/openfile.c (open_outfile): Cast to int. * g10/encrypt.c (encrypt_crypt): Ditto. * g10/decrypt.c (decrypt_message_fd): Ditto. -- GnuPG-bug-id: 6580 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Use gnupg_fd_t for open_outfile.NIIBE Yutaka2023-07-051-3/+3
| | | | | | | | | | | | | | | | * g10/main.h (open_outfile): Use gnupg_fd_t instead of int. * g10/openfile.c (open_outfile): Likewise. Use GNUPG_INVALID_FD. * g10/dearmor.c (dearmor_file, enarmor_file): Follow the change. * g10/encrypt.c (encrypt_simple): Likewise. * g10/export.c (do_export): Likewise. * g10/revoke.c (gen_desig_revoke, create_revocation): Likewise. * g10/sign.c (sign_file, clearsign_file, sign_symencrypt_file): Likewise. -- GnuPG-bug-id: 6580 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Partial fix for Unicode problem in output files.Werner Koch2021-05-251-1/+1
| | | | | | | | | | * g10/openfile.c (overwrite_filep): Use gnupg_access. -- As said, this is just an obvious but partial fix. We need to review things for the output module. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Fix duplicate implementation of try_make_homedir.Werner Koch2020-11-041-24/+6
| | | | | | | | | | | * g10/openfile.c (try_make_homedir): Move core of the code to ... * common/homedir.c (gnupg_maybe_make_homedir): new. * sm/keydb.c (try_make_homedir): Implement using new function. * common/homedir.c: Include i18n.h. * po/POTFILES.in: Add common/homedir.c. Signed-off-by: Werner Koch <wk@gnupg.org>
* Replace all calls to stat by gnupg_stat.Werner Koch2020-10-201-1/+1
| | | | | | | | | | | * common/sysutils.c (gnupg_stat): New. * common/sysutils.h: Include sys/stat.h. -- Yet another wrapper for Unicode support on Windows. GnuPG-bug-id: 5098 Signed-off-by: Werner Koch <wk@gnupg.org>
* Replace all calls to access by gnupg_accessWerner Koch2020-10-201-1/+1
| | | | | | | | | | | | | | | | * common/sysutils.c (gnupg_access): New. Replace all calls to access by this wrapper. * common/homedir.c (w32_shgetfolderpath): Change to return UTF-8 directory name. (standard_homedir): Adjust for change. (w32_commondir, gnupg_cachedir): Ditto. -- Also use SHGetFolderPathW instead of SHGetFolderPathA on Windows. This is required to correctly handle non-ascii filenames on Windows. GnuPG-bug-id: 5098
* gpg: Rename a misnomed arg in open_outfile.Werner Koch2018-01-281-10/+12
| | | | | | * g10/openfile.c (open_outfile): Rename inp_fd to out_fd. Signed-off-by: Werner Koch <wk@gnupg.org>
* Revert "g10: Always save standard revocation certificate in file."Marcus Brinkmann2017-08-011-7/+5
| | | | This reverts commit ebc65ff459e6c228fb7406e375819a9fe5637abe.
* g10: Always save standard revocation certificate in file.Marcus Brinkmann2017-08-011-5/+7
| | | | | | | | | | | | | * g10/main.h (open_outfile): New parameter NO_OUTFILE. * g10/openfile.c (open_outfile): New parameter NO_OUTFILE. If given, never use opt.outfile. * g10/revoke.c (create_revocation): If FILENAME is true, also set NO_OUTFILE to true (for standard revocation certificates). * g10/dearmor.c, g10/encrypt.c, g10/export.c, g10/revoke.c, g10/sign.c: Adjust all other callers. Signed-off-by: Marcus Brinkmann <mb@g10code.com> GnuPG-bug-id: 3015
* g10: Remove skeleton options files.Daniel Kahn Gillmor2017-05-021-102/+0
| | | | | | | | | | | | | | | | | | | | | * build-aux/speed/w32/inst.nsi: stop installing skeleton files. * doc/gpg.texi: stop documenting skeleton files. * g10/Makefile.am: stop installing skeleton files. * g10/openfile.c (copy_options_file): Remove. (try_make_homedir): do not call copy_options_file. -- The defaults for gpg and dirmngr are good. Both programs should work fine for the simple case without any config file. The skeleton config files were being copied at first use (when the defaults are fine). But when the user needs to fiddle with them (after they've become sophisticated users), they're likely out of date because gpg has been upgraded since then. So they're used for documentation, but they're stale documentation, which is probably worse than a clean empty file. GnuPG-bug-id: 3086 Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* Spelling fixes in docs and comments.NIIBE Yutaka2017-04-281-1/+1
| | | | | | | | | | -- In addition, fix trailing spaces in tests/inittests. GnuPG-bug-id: 3121 Reported-by: ka7 (klemens) Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Remove -I option to common.NIIBE Yutaka2017-03-071-4/+4
| | | | | | | | | | | | | * dirmngr/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/common. * g10/Makefile.am (AM_CPPFLAGS): Ditto. * g13/Makefile.am (AM_CPPFLAGS): Ditto. * kbx/Makefile.am (AM_CPPFLAGS): Ditto. * scd/Makefile.am (AM_CPPFLAGS): Ditto. * sm/Makefile.am (AM_CPPFLAGS): Ditto. * tools/Makefile.am (AM_CPPFLAGS): Ditto. * Throughout: Follow the change. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* Fix use cases of snprintf.NIIBE Yutaka2016-10-211-2/+2
| | | | | | | | | | | * agent/call-pinentry.c, agent/call-scd.c, agent/command.c, build-aux/speedo/w32/g4wihelp.c, common/get-passphrase.c, dirmngr/dirmngr.c, g10/call-agent.c, g10/cpr.c, g10/keygen.c, g10/openfile.c, g10/passphrase.c, scd/app-openpgp.c, scd/scdaemon.c, sm/call-agent.c, sm/call-dirmngr.c, sm/certreqgen.c: Fix assuming C99. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Remove all assert.h and s/assert/log_assert/.Werner Koch2016-04-291-1/+0
| | | | Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Install a dirmngr.conf file.Werner Koch2015-10-051-14/+20
| | | | | | | | | | | | | | | | | * g10/dirmngr-conf.skel: New. * g10/Makefile.am (EXTRA_DIST): Add file. (install-data-local, uninstall-local): Install that file. * g10/openfile.c (copy_options_file): Add arg "name", return a value, simplify with xstrconcat, and factor warning message out to: (try_make_homedir): here. Also install dirmngr.conf. * g10/options.skel: Remove --keyserver entry. -- The option --keyserver in gpg has been deprecated in favor of --keyserver in dirmngr.conf. Thus we need to install a skeleton file for dirmngr to set a default keyserver. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Make the use of "--verify FILE" for detached sigs harder.Werner Koch2014-11-131-26/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/openfile.c (open_sigfile): Factor some code out to ... (get_matching_datafile): new function. * g10/plaintext.c (hash_datafiles): Do not try to find matching file in batch mode. * g10/mainproc.c (check_sig_and_print): Print a warning if a possibly matching data file is not used by a standard signatures. -- Allowing to use the abbreviated form for detached signatures is a long standing bug which has only been noticed by the public with the release of 2.1.0. :-( What we do is to remove the ability to check detached signature in --batch using the one file abbreviated mode. This should exhibit problems in scripts which use this insecure practice. We also print a warning if a matching data file exists but was not considered because the detached signature was actually a standard signature: gpgv: Good signature from "Werner Koch (dist sig)" gpgv: WARNING: not a detached signature; \ file 'gnupg-2.1.0.tar.bz2' was NOT verified! We can only print a warning because it is possible that a standard signature is indeed to be verified but by coincidence a file with a matching name is stored alongside the standard signature. Reported-by: Simon Nicolussi (to gnupg-users on Nov 7) Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Re-indent two files.Werner Koch2014-11-131-112/+129
| | | | --
* gpg: Auto-create revocation certificates.Werner Koch2014-06-301-2/+26
| | | | | | | | | | | | | * configure.ac (GNUPG_OPENPGP_REVOC_DIR): New config define. * g10/revoke.c (create_revocation): Add arg "leadin". (gen_standard_revoke): New. * g10/openfile.c (get_openpgp_revocdir): New. (open_outfile): Add MODE value 3. * g10/keyid.c (hexfingerprint): New. * g10/keygen.c (do_generate_keypair): Call gen_standard_revoke. -- GnuPG-bug-id: 1042
* gpg: Create exported secret files and revocs with mode 700.Werner Koch2014-06-301-4/+6
| | | | | | | | | | | | | | | * common/iobuf.c (direct_open): Add arg MODE700. (iobuf_create): Ditto. * g10/openfile.c (open_outfile): Add arg RESTRICTEDPERM. Change call callers to pass 0 for it. * g10/revoke.c (gen_desig_revoke, gen_revoke): Here pass true for new arg. * g10/export.c (do_export): Pass true for new arg if SECRET is true. -- GnuPG-bug-id: 1653. Note that this works only if --output has been used.
* Make use of the *_NAME etc macros.Werner Koch2013-11-181-3/+4
| | | | | | | | | Replace hardwired strings at many places with new macros from config.h and use the new strusage macro replacement feature. * common/asshelp.c (lock_spawning) [W32]: Change the names of the spawn sentinels. * agent/command.c (cmd_import_key): Use asprintf to create the prompt.
* Change all quotes in strings and comments to the new GNU standard.Werner Koch2012-06-051-13/+13
| | | | | | | | | | | | | | | | | | | The asymmetric quotes used by GNU in the past (`...') don't render nicely on modern systems. We now use two \x27 characters ('...'). The proper solution would be to use the correct Unicode symmetric quotes here. However this has the disadvantage that the system requires Unicode support. We don't want that today. If Unicode is available a generated po file can be used to output proper quotes. A simple sed script like the one used for en@quote is sufficient to change them. The changes have been done by applying sed -i "s/\`\([^'\`]*\)'/'\1'/g" to most files and fixing obvious problems by hand. The msgid strings in the po files were fixed with a similar command.
* Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch2011-02-041-15/+15
| | | | | | | | We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
* Whole lot of changes to support CE.Werner Koch2010-04-141-6/+1
|
* Use gpg_err_set_errno to assign values to ERRNO.Werner Koch2010-04-011-4/+4
|
* Removed almost al dup calls.Werner Koch2010-03-081-8/+3
|
* Use macros for iobuf ioctls. Werner Koch2010-03-081-1/+1
|
* Implement the server comamnd DECRYPT.Werner Koch2009-10-021-9/+9
| | | | | | | Use int instead of gnupg_fd_t in the server. Comment fixes. Rename encr-data.c -> decrypt-data.c
* Some changes to suport g13.Werner Koch2009-09-301-116/+140
|
* Changed to GPLv3.Werner Koch2007-07-041-4/+2
| | | | | Removed intl/.
* More W32 related changesWerner Koch2007-06-261-29/+27
|
* A whole bunch of changes to allow building for Windows.Werner Koch2007-06-141-1/+4
| | | | | See the ChangeLogs for details.
* Preparing 2.0.4gnupg-2.0.4Werner Koch2007-05-091-2/+2
|
* Upgraded gettext.Werner Koch2007-05-071-2/+12
| | | | | Fixed accidental dependency on libgcrypt 1.3.0.
* Doc fix.Werner Koch2006-12-081-2/+2
| | | | | Don't let gpg2 fail if the option skeleton file is missing
* * openfile.c (ask_outfile_name): Fixed buffer overflow occurringWerner Koch2006-11-271-34/+36
| | | | | | if make_printable_string returns a longer string. Fixes bug 728.
* Take advantage of newer gpg-error features.Werner Koch2006-09-141-2/+2
|
* Merged with gpg 1.4.3 code. Werner Koch2006-04-191-40/+73
| | | | | The gpg part does not yet build.
* 2004-09-11 Moritz Schulte <moritz@g10code.com>Moritz Schulte2004-09-111-1/+1
| | | | | * openfile.c (copy_options_file): Fixed last commit (added a `+').
* Better take the length of SKELEXT into accountWerner Koch2004-08-311-1/+2
|
* * openfile.c (copy_options_file): Use gpg-conf.skelWerner Koch2004-08-311-1/+1
| | | | | * Makefile.am: Install options.skel as gpg-conf.skel.
* * gpgv.c: Removed g10defs.h.Werner Koch2004-02-121-1/+1
| | | | | * Makefile.am: Include cmacros.am for common flags.
* Finished the bulk of changes for gnupg 1.9. This included switchingWerner Koch2003-06-181-25/+27
| | | | | | | | | | | to libgcrypt functions, using shared error codes from libgpg-error, replacing the old functions we used to have in ../util by those in ../jnlib and ../common, renaming the malloc functions and a couple of types. Note, that not all changes are listed below becuause they are too similar and done at far too many places. As of today the code builds using the current libgcrypt from CVS but it is very unlikely that it actually works.
* This commit was manufactured by cvs2svn to create branchRepo Admin2003-06-051-0/+389
| | | | 'GNUPG-1-9-BRANCH'.
* This commit was manufactured by cvs2svn to create branchRepo Admin2002-10-191-362/+0
| | | | 'GNUPG-1-9-BRANCH'.
* Cleanups and minor fixes.Werner Koch2002-09-101-3/+3
|
* * options.skel: Some language tweaks, and remove the load-extensionDavid Shaw2002-08-091-0/+3
| | | | | | | | | | | | | | | section for random gatherers. * keyring.c (create_tmp_file, rename_tmp_file): Create tmp files with user-only permissions, but restore the original permissions if the user has something special set. * openfile.c (copy_options_file): Create new options file (gpg.conf) with user-only permissions. * keydb.c (keydb_add_resource): Create new keyrings with user-only permissions.
* use of EXTSEP_SStefan Bellon2002-08-061-1/+1
|