mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Make --export-options work with --export-secret-keys.
* g10/export.c (export_seckeys): Add arg OPTIONS and pass it to do_export. (export_secsubkeys): Ditto. * g10/gpg.c (main): Pass opt.export_options to export_seckeys and export_secsubkeys -- Back in the old days we did not used the export options for secret keys export because of a lot of duplicated code and that the old secring.gpg was anyway smaller that the pubring.gpg. With 2.1 it was pretty easy to enable it. Reported-by: Peter Lebbing GnuPG-bug-id: 2973
This commit is contained in:
parent
2bbdeb8ee8
commit
891ab23411
@ -1832,7 +1832,8 @@ are available for all keyserver types, some common options are:
|
|||||||
used with HKP keyservers.
|
used with HKP keyservers.
|
||||||
|
|
||||||
@item auto-key-retrieve
|
@item auto-key-retrieve
|
||||||
This is the same as the option @option{auto-key-retrieve}.
|
This is an obsolete alias for the option @option{auto-key-retrieve}.
|
||||||
|
Please do not use it; it will be removed in future versions..
|
||||||
|
|
||||||
@item honor-keyserver-url
|
@item honor-keyserver-url
|
||||||
When using @option{--refresh-keys}, if the key in question has a preferred
|
When using @option{--refresh-keys}, if the key in question has a preferred
|
||||||
@ -2379,8 +2380,8 @@ The available properties are:
|
|||||||
@item --export-options @code{parameters}
|
@item --export-options @code{parameters}
|
||||||
@opindex export-options
|
@opindex export-options
|
||||||
This is a space or comma delimited string that gives options for
|
This is a space or comma delimited string that gives options for
|
||||||
exporting keys. Options can be prepended with a `no-' to give the
|
exporting keys. Options can be prepended with a `no-' to give the
|
||||||
opposite meaning. The options are:
|
opposite meaning. The options are:
|
||||||
|
|
||||||
@table @asis
|
@table @asis
|
||||||
|
|
||||||
|
31
g10/export.c
31
g10/export.c
@ -247,16 +247,17 @@ export_pubkeys (ctrl_t ctrl, strlist_t users, unsigned int options,
|
|||||||
/*
|
/*
|
||||||
* Export secret keys (to stdout or to --output FILE).
|
* Export secret keys (to stdout or to --output FILE).
|
||||||
*
|
*
|
||||||
* Depending on opt.armor the output is armored. If USERS is NULL,
|
* Depending on opt.armor the output is armored. OPTIONS are defined
|
||||||
* all secret keys will be exported. STATS is either an export stats
|
* in main.h. If USERS is NULL, all secret keys will be exported.
|
||||||
* object for update or NULL.
|
* STATS is either an export stats object for update or NULL.
|
||||||
*
|
*
|
||||||
* This function is the core of "gpg --export-secret-keys".
|
* This function is the core of "gpg --export-secret-keys".
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
export_seckeys (ctrl_t ctrl, strlist_t users, export_stats_t stats)
|
export_seckeys (ctrl_t ctrl, strlist_t users, unsigned int options,
|
||||||
|
export_stats_t stats)
|
||||||
{
|
{
|
||||||
return do_export (ctrl, users, 1, 0, stats);
|
return do_export (ctrl, users, 1, options, stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -264,16 +265,18 @@ export_seckeys (ctrl_t ctrl, strlist_t users, export_stats_t stats)
|
|||||||
* Export secret sub keys (to stdout or to --output FILE).
|
* Export secret sub keys (to stdout or to --output FILE).
|
||||||
*
|
*
|
||||||
* This is the same as export_seckeys but replaces the primary key by
|
* This is the same as export_seckeys but replaces the primary key by
|
||||||
* a stub key. Depending on opt.armor the output is armored. If
|
* a stub key. Depending on opt.armor the output is armored. OPTIONS
|
||||||
* USERS is NULL, all secret subkeys will be exported. STATS is
|
* are defined in main.h. If USERS is NULL, all secret subkeys will
|
||||||
* either an export stats object for update or NULL.
|
* be exported. STATS is either an export stats object for update or
|
||||||
|
* NULL.
|
||||||
*
|
*
|
||||||
* This function is the core of "gpg --export-secret-subkeys".
|
* This function is the core of "gpg --export-secret-subkeys".
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
export_secsubkeys (ctrl_t ctrl, strlist_t users, export_stats_t stats)
|
export_secsubkeys (ctrl_t ctrl, strlist_t users, unsigned int options,
|
||||||
|
export_stats_t stats)
|
||||||
{
|
{
|
||||||
return do_export (ctrl, users, 2, 0, stats);
|
return do_export (ctrl, users, 2, options, stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1969,11 +1972,9 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Always do the cleaning on the public key part if requested.
|
/* Always do the cleaning on the public key part if requested.
|
||||||
Note that we don't yet set this option if we are exporting
|
* Note that both export-clean and export-minimal only apply to
|
||||||
secret keys. Note that both export-clean and export-minimal
|
* UID sigs (0x10, 0x11, 0x12, and 0x13). A designated
|
||||||
only apply to UID sigs (0x10, 0x11, 0x12, and 0x13). A
|
* revocation is never stripped, even with export-minimal set. */
|
||||||
designated revocation is never stripped, even with
|
|
||||||
export-minimal set. */
|
|
||||||
if ((options & EXPORT_CLEAN))
|
if ((options & EXPORT_CLEAN))
|
||||||
clean_key (keyblock, opt.verbose, (options&EXPORT_MINIMAL), NULL, NULL);
|
clean_key (keyblock, opt.verbose, (options&EXPORT_MINIMAL), NULL, NULL);
|
||||||
|
|
||||||
|
@ -4546,7 +4546,7 @@ main (int argc, char **argv)
|
|||||||
add_to_strlist2( &sl, *argv, utf8_strings );
|
add_to_strlist2( &sl, *argv, utf8_strings );
|
||||||
{
|
{
|
||||||
export_stats_t stats = export_new_stats ();
|
export_stats_t stats = export_new_stats ();
|
||||||
export_seckeys (ctrl, sl, stats);
|
export_seckeys (ctrl, sl, opt.export_options, stats);
|
||||||
export_print_stats (stats);
|
export_print_stats (stats);
|
||||||
export_release_stats (stats);
|
export_release_stats (stats);
|
||||||
}
|
}
|
||||||
@ -4559,7 +4559,7 @@ main (int argc, char **argv)
|
|||||||
add_to_strlist2( &sl, *argv, utf8_strings );
|
add_to_strlist2( &sl, *argv, utf8_strings );
|
||||||
{
|
{
|
||||||
export_stats_t stats = export_new_stats ();
|
export_stats_t stats = export_new_stats ();
|
||||||
export_secsubkeys (ctrl, sl, stats);
|
export_secsubkeys (ctrl, sl, opt.export_options, stats);
|
||||||
export_print_stats (stats);
|
export_print_stats (stats);
|
||||||
export_release_stats (stats);
|
export_release_stats (stats);
|
||||||
}
|
}
|
||||||
|
@ -397,8 +397,10 @@ gpg_error_t parse_and_set_export_filter (const char *string);
|
|||||||
|
|
||||||
int export_pubkeys (ctrl_t ctrl, strlist_t users, unsigned int options,
|
int export_pubkeys (ctrl_t ctrl, strlist_t users, unsigned int options,
|
||||||
export_stats_t stats);
|
export_stats_t stats);
|
||||||
int export_seckeys (ctrl_t ctrl, strlist_t users, export_stats_t stats);
|
int export_seckeys (ctrl_t ctrl, strlist_t users, unsigned int options,
|
||||||
int export_secsubkeys (ctrl_t ctrl, strlist_t users, export_stats_t stats);
|
export_stats_t stats);
|
||||||
|
int export_secsubkeys (ctrl_t ctrl, strlist_t users, unsigned int options,
|
||||||
|
export_stats_t stats);
|
||||||
|
|
||||||
gpg_error_t export_pubkey_buffer (ctrl_t ctrl, const char *keyspec,
|
gpg_error_t export_pubkey_buffer (ctrl_t ctrl, const char *keyspec,
|
||||||
unsigned int options,
|
unsigned int options,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user