|
37 | 37 | #include "../kbx/keybox.h" |
38 | 38 | #include "keydb.h" |
39 | 39 | #include "../common/i18n.h" |
| 40 | +#include "../common/comopt.h" |
40 | 41 |
|
41 | 42 | #include "keydb-private.h" /* For struct keydb_handle_s */ |
42 | 43 |
|
@@ -265,8 +266,24 @@ maybe_create_keyring_or_box (char *filename, int is_box, int force_create) |
265 | 266 | *last_slash_in_filename = save_slash; |
266 | 267 | goto leave; |
267 | 268 | } |
| 269 | + |
| 270 | + *last_slash_in_filename = save_slash; |
| 271 | + |
| 272 | + if (!opt.use_keyboxd |
| 273 | + && !parse_comopt (GNUPG_MODULE_NAME_GPG, 0) |
| 274 | + && comopt.use_keyboxd) |
| 275 | + { |
| 276 | + /* The above try_make_homedir created a new default hoemdir |
| 277 | + * and also wrote a new common.conf. Thus we now see that |
| 278 | + * use-keyboxd has been set. Let's set this option and |
| 279 | + * return a dedicated error code. */ |
| 280 | + opt.use_keyboxd = comopt.use_keyboxd; |
| 281 | + rc = gpg_error (GPG_ERR_TRUE); |
| 282 | + goto leave; |
| 283 | + } |
268 | 284 | } |
269 | | - *last_slash_in_filename = save_slash; |
| 285 | + else |
| 286 | + *last_slash_in_filename = save_slash; |
270 | 287 |
|
271 | 288 | /* To avoid races with other instances of gpg trying to create or |
272 | 289 | update the keyring (it is removed during an update for a short |
@@ -555,7 +572,8 @@ keydb_search_desc_dump (struct keydb_search_desc *desc) |
555 | 572 | * If KEYDB_RESOURCE_FLAG_READONLY is set and the resource is a |
556 | 573 | * keyring (not a keybox), then the keyring is marked as read only and |
557 | 574 | * operations just as keyring_insert_keyblock will return |
558 | | - * GPG_ERR_ACCESS. */ |
| 575 | + * GPG_ERR_ACCESS. |
| 576 | + */ |
559 | 577 | gpg_error_t |
560 | 578 | keydb_add_resource (const char *url, unsigned int flags) |
561 | 579 | { |
@@ -774,9 +792,12 @@ keydb_add_resource (const char *url, unsigned int flags) |
774 | 792 | leave: |
775 | 793 | if (err) |
776 | 794 | { |
777 | | - log_error (_("keyblock resource '%s': %s\n"), |
778 | | - filename, gpg_strerror (err)); |
779 | | - write_status_error ("add_keyblock_resource", err); |
| 795 | + if (gpg_err_code (err) != GPG_ERR_TRUE) |
| 796 | + { |
| 797 | + log_error (_("keyblock resource '%s': %s\n"), |
| 798 | + filename, gpg_strerror (err)); |
| 799 | + write_status_error ("add_keyblock_resource", err); |
| 800 | + } |
780 | 801 | } |
781 | 802 | else |
782 | 803 | any_registered = 1; |
|
0 commit comments