aboutsummaryrefslogtreecommitdiffstats
path: root/src/import.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* core: Allow setting import options when importing keysIngo Klöcker2024-06-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | * src/context.h (struct gpgme_context): New field import_options. * src/engine-backend.h (struct engine_ops): Add arg import_options to field 'import'. * src/engine-gpg.c (gpg_import): Add arg import_options and pass option --import-options with argument value to gpg. * src/engine-gpgsm.c (gpgsm_import): Add dummy arg import_options. * src/engine.c (_gpgme_engine_op_import): Add arg import_options and pass option to import function of engine. * src/engine.h (_gpgme_engine_op_import): Add arg import_options. * src/gpgme.c (gpgme_release): Free 'import_options'. (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "import-options". * src/import.c (_gpgme_op_import_start, _gpgme_op_import_keys_start, _gpgme_op_receive_keys_start): Pass import options stored in context to _gpgme_engine_op_import. * tests/run-import.c (show_usage, main): Add option --import-options. -- This makes the --import-options option available in the GPGME API for key imports. GnuPG-bug-id: 7152
* core: Check STATUS_FAILURE in import operations.Ingo Klöcker2024-03-111-0/+14
| | | | | | | | * src/import.c (op_data_t): Add failure_code. (_gpgme_import_status_handler): Set it. Return it on EOF. -- GnuPG-bug-id: 7036
* Fix parsing import status for invalid fingerprint.NIIBE Yutaka2022-09-071-5/+10
| | | | | | | | | * src/import.c (parse_import): Handle invalid fingerprint case. -- GnuPG-bug-id: 6187 Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Handle import status lines during keylist operationIngo Klöcker2022-05-041-23/+29
| | | | | | | | | | | | | | | | | | | | | | * src/import.c (import_status_handler): Rename to ... (_gpgme_import_status_handler): this. Make non-static. (_gpgme_op_import_init_result): New. (_gpgme_op_import_start, _gpgme_op_import_keys_start, _gpgme_op_receive_keys_start): Call _gpgme_op_import_init_result. * src/keylist.c (keylist_status_handler): Call _gpgme_import_status_handler to handle import status lines. (gpgme_op_keylist_start, gpgme_op_keylist_ext_start): Call _gpgme_op_import_init_result. * src/ops.h (_gpgme_op_import_init_result, _gpgme_import_status_handler): New prototypes. -- If a keylist operation with keylist mode GPGME_KEYLIST_MODE_LOCATE is run, then gpg emits import status lines. Handling those status lines allows users to retrieve the result of a --locate-(external)-keys command. GnuPG-bug-id: 5951
* core: New function gpgme_op_receive_keysIngo Klöcker2022-02-031-4/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_receive_keys_start, gpgme_op_receive_keys): New. * src/gpgme.def, src/libgpgme.vers: Add them. * src/engine-backend.h (struct engine_ops): Add arg keyids to field 'import'. * src/engine.h, src/engine.c (_gpgme_engine_op_import): Add arg keyids. * src/engine.c (_gpgme_engine_op_import): Forward new arg keyids. * src/import.c: (_gpgme_op_import_start, _gpgme_op_import_keys_start): Pass NULL to new arg of _gpgme_op_import_start. (_gpgme_op_receive_keys_start, gpgme_op_receive_keys_start, gpgme_op_receive_keys): New. * src/engine-gpg.c (gpg_import): Add arg keyids. Extend check for valid arguments. Build command line if keyids are given. * src/engine-gpgsm.c (gpgsm_import): Add arg keyids. Return error if keyids is not NULL. tests/run-receive-keys.c: New. tests/Makefile.am (noinst_PROGRAMS): Add new test runner. -- The new function allows importing keys given by their key ids or fingerprints from a keyserver (like gpg's --recv-keys command). GnuPG-bug-id: 5808
* core: Detect bad passphrase error on certificate importIngo Klöcker2021-12-221-1/+53
| | | | | | | | | | | | | | | | | | | | | * src/import.c (gpgme_op_import_result): Check fpr for NULL. (parse_error): New. (import_status_handler): Handle error status line. * doc/gpgme.texi (gpgme_import_status_t): Mention that fpr can be NULL. * tests/gpg/t-import.c (check_result): Check fpr for NULL. * tests/run-threaded.c (delete_impres): Check fpr for NULL. -- When importing an encrypted certificate a wrong passphrase may be entered. In this case gpgsm emits a status line with a bad passphrase error and an "invalid object" error. To make it possible for callers to handle a wrong passphrase error more gracefully, an import status with bad passphrase error is added to the import result for each status line with bad passphrase error. GnuPG-bug-id: 5713
* core: Allow setting import filters when importing keysIngo Klöcker2021-12-141-2/+4
| | | | | | | | | | | | | | | | | | | * src/context.h (struct gpgme_context): New field import_filter. * src/engine-backend.h (struct engine_ops): Add arg import_filter to field 'import'. * src/engine-gpg.c (gpg_import): Add arg import_filter and pass option --import-filter with argument value to gpg. Adjust all callers. * src/engine-gpgsm.c (gpgsm_import): Add dummy arg import_filter. * src/gpgme.c (gpgme_release): Free 'import_filter'. (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "import-filter". * tests/run-import.c (main): Add option --import-filter. -- This makes the --import-filter option available in the GPGME API for key imports. GnuPG-bug-id: 5739
* core: Allow specifiying a key origin when importing keysIngo Klöcker2021-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | * src/context.h (struct gpgme_context): New field key_origin. * src/engine-backend.h (struct engine_ops): Add arg key_origin to field 'import'. * src/engine-gpg.c (gpg_import): Add arg key_origin and pass option --key-origin with argument value to gpg. Adjust all callers. * src/engine-gpgsm.c (gpgsm_import): Add dummy arg key_origin. * src/gpgme.c (gpgme_release): Free 'key_origin'. (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "key-origin". * tests/run-import.c (main): Add option --key-origin. * tests/gpg/t-import.c (main): Set and verify key origin. -- This makes the --key-origin option available in the GPGME API for key imports. GnuPG-bug-id: 5733
* core: Fix format string errors in trace macrosWerner Koch2018-11-161-1/+2
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Simplify the trace maros by using variadics.Werner Koch2018-11-161-14/+14
| | | | | | | | | | | | | | | | * src/debug.h (TRACE_BEG, TRACE_LOG, TRACE_SUC): Use variadic macros and remove the TRACE_BEG1 et al. Change all users to always pass a format string. (TRACE): Ditto. * src/debug.c (_gpgme_debugf): New. * configure.ac <GCC>: Add -Wno-format-zero-length. -- This makes it easier for use to enable format checks. The zero-length format is required to allow for an empty format due to the comman problematic of __VA_ARGS__. Signed-off-by: Werner Koch <[email protected]>
* Add SPDX identifiers to most source filesWerner Koch2018-11-161-19/+19
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Parse skipped_v3_keysAndre Heinecke2018-03-151-2/+7
| | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_import_result_t): Extend with skipped_v3_keys. * src/import.c (gpgme_op_import_result): Extend debug with new field. (parse_import_res): Parse skipped_v3_keys. * tests/gpg/t-support.h, tests/run-support.h (print_import_result): Print skipped_v3_keys. -- This makes it possible to handle this in a GUI in a future version. GnuPG-Bug-Id: T3776
* doc: Clarify import keys operation.Marcus Brinkmann2017-08-101-7/+6
| | | | | | | | | * doc/gpgme.texi (gpgme_op_import_start): Fix grammar. (gpgme_op_import_keys): Clarify some wording and fix result. * src/import.c (gpgme_op_import_keys): Clarify comment. Signed-off-by: Marcus Brinkmann <[email protected]> GnuPG-bug-id: 3215
* core: Fix status error return for gpgsm.Werner Koch2017-03-091-2/+2
| | | | | | | | | | | * src/engine-gpgsm.c (gpgsm_assuan_simple_command): Make sure CB_ERR is returned. * src/import.c (parse_import_res): Do not return an error for the last field. (import_status_handler): Actually return the error from parse_import_res. Signed-off-by: Werner Koch <[email protected]>
* Use gpg_error_from_syserror instead of directly accessing errno.Werner Koch2013-02-061-2/+1
| | | | | | | | -- Also fixed a couple of minor thing; e.g. save the error before calling cleanup functions. Do not save the errno if only free is called in between.
* Trace the use of GPG_ERR_INV_ENGINE.Werner Koch2012-10-191-2/+2
| | | | | | | | | | | | | | * src/debug.h: Include "gpgme.h" (_gpgme_trace_gpgme_error): New. (trace_gpg_error): New macro. Use it in all files where we return GPG_ERR_INV_ENGINE; also "include debug.h" as needed. -- This is a pretty common error code but often it is hard to figure out the actual cause. With debug level 4 we now print the file name and line number where this error code is generated by gpgme. Along with the git revision printed in the first log lines, this should give us an easier way to track down the problems related to this error code.
* Remove all trailing whitespace from source filesWerner Koch2012-09-251-7/+7
| | | | | -- Command used: sed -i 's,[ \t]*$,,' FILE
* Check context pointers for null pointer on entry points.Marcus Brinkmann2011-05-261-0/+14
|
* Return GPG_ERR_MISSING_ISSUER_CERT.Werner Koch2010-09-161-1/+2
|
* 2010-05-06 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-05-061-3/+3
| | | | | | | | | | | | | | | | | | | * configure.ac: Require libgpg-error 1.8. src/ 2010-05-06 Marcus Brinkmann <[email protected]> * sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c, decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c, data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use gpg_error_from_syserror instead gpg_error_from_errno, and use gpg_err_set_errno to set error number. * setenv.c: Include <gpg-error.h> and define __set_errno to use gpg_err_set_errno. * gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is mapped in Windows CE) instead of E2BIG (which is not). (gt_import_keys): Initialize err.
* 2009-11-05 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-11-051-2/+8
| | | | | | | | | | | | | | | | | | | | | | * decrypt.c (gpgme_op_decrypt_start): Fix use of debug macro. * decrypt-verify.c (gpgme_op_decrypt_verify_start): Likewise. * delete.c (gpgme_op_delete_start): Likewise. * edit.c (gpgme_op_edit_start, gpgme_op_card_edit_start): Likewise. * encrypt.c (gpgme_op_encrypt_start): Likewise. * encrypt-sign.c (gpgme_op_encrypt_sign_start): Likewise. * export.c (gpgme_op_export_start, gpgme_op_export_ext_start) (gpgme_op_export_keys_start, gpgme_op_export_keys): Likewise. * genkey.c (gpgme_op_genkey_start): Likewise. * getauditlog.c (gpgme_op_getauditlog_start): Likewise. * import.c (gpgme_op_import_start, gpgme_op_import_keys_start): Likewise. * opassuan.c (gpgme_op_assuan_transact_start): Likewise. * sign.c (gpgme_op_sign_start): Likewise. * verify.c (gpgme_op_verify_start): Likewise. * vfs-create.c (gpgme_op_vfs_create): Likewise. * vfs-mount.c (gpgme_op_vfs_mount): Likewise.
* 2009-10-28 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-10-281-2/+2
| | | | | | * signers.c, encrypt-sign.c, encrypt.c, delete.c, keylist.c, edit.c, import.c, export.c: Fix last change in debug output.
* 2009-10-27 Marcus Brinkmann <[email protected]>Marcus Brinkmann2009-10-271-7/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * edit.c (gpgme_op_edit_start, gpgme_op_edit) (gpgme_op_card_edit_start, gpgme_op_card_edit): Add debug output. * encrypt-sign.c (gpgme_op_encrypt_sign_start) (gpgme_op_encrypt_sign): Likewise. * encrypt.c (gpgme_op_encrypt_start, gpgme_op_encrypt) (gpgme_op_encrypt_result): Likewise. * export.c (gpgme_op_export_start, gpgme_op_export) (gpgme_op_export_ext_start, gpgme_op_export_ext) (gpgme_op_export_keys_start, gpgme_op_export_keys): Likewise. * genkey.c (gpgme_op_genkey_start, gpgme_op_genkey) (gpgme_op_genkey_result): Likewise. * getauditlog.c (gpgme_op_getauditlog_start) (gpgme_op_getauditlog): Likewise. * import.c (gpgme_op_import_result, gpgme_op_import_start) (gpgme_op_import): Likewise. * keylist.c (gpgme_op_keylist_result, keylist_colon_handler) (gpgme_op_keylist_start, gpgme_op_keylist_ext_start) (gpgme_op_keylist_next, gpgme_op_keylist_end, gpgme_get_key): Likewise. * opassuan.c (gpgme_op_assuan_transact_start) (gpgme_op_assuan_transact_ext, gpgme_op_assuan_result) (gpgme_op_assuan_transact): Likewise. * signers.c (gpgme_signers_add, gpgme_signers_clear): Likewise. * trustlist.c (gpgme_op_trustlist_start) (gpgme_op_trustlist_next, gpgme_op_trustlist_end): Likewise. * verify.c (gpgme_op_verify_start, gpgme_op_verify) (gpgme_op_verify_result): Likewise.
* Add new functions to import and export keys specified by gpgme_key_t.Werner Koch2009-06-161-1/+79
| | | | | Allow exporting keys to a keyserver.
* 008-11-03 Marcus Brinkmann <[email protected]>Marcus Brinkmann2008-11-031-0/+273
* configure.ac: Replace gpgme paths with src. * gpgme: Move to ... * src: ... this new directory. assuan/ 2008-11-03 Marcus Brinkmann <[email protected]> * Makefile.am (INCLUDES): Replace gpgme path with src. tests/ 2008-11-03 Marcus Brinkmann <[email protected]> * gpgsm/Makefile.am (INCLUDES, LDADD): Replace gpgme path with src. * gpg/Makefile.am (INCLUDES, LDADD, t_thread1_LDADD): Likewise. * Makefile.am (LDADD): Likewise.