mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
g10: Allow relative path for specifying the file for bkuptocard.
* g10/keyedit.c (keyedit_menu): Assume the file is under GNUPGHOME. Also support tilda expansion.
This commit is contained in:
parent
40959add1b
commit
ee433d2b00
@ -1927,17 +1927,23 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
|
|||||||
backup key as generated by the card generation, parse
|
backup key as generated by the card generation, parse
|
||||||
that key and store it on card. */
|
that key and store it on card. */
|
||||||
KBNODE node;
|
KBNODE node;
|
||||||
const char *fname;
|
char *fname;
|
||||||
PACKET *pkt;
|
PACKET *pkt;
|
||||||
IOBUF a;
|
IOBUF a;
|
||||||
|
|
||||||
fname = arg_string;
|
if (!*arg_string)
|
||||||
if (!*fname)
|
|
||||||
{
|
{
|
||||||
tty_printf (_("Command expects a filename argument\n"));
|
tty_printf (_("Command expects a filename argument\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*arg_string == DIRSEP_C)
|
||||||
|
fname = xstrdup (arg_string);
|
||||||
|
else if (*arg_string == '~')
|
||||||
|
fname = make_filename (arg_string, NULL);
|
||||||
|
else
|
||||||
|
fname = make_filename (opt.homedir, arg_string, NULL);
|
||||||
|
|
||||||
/* Open that file. */
|
/* Open that file. */
|
||||||
a = iobuf_open (fname);
|
a = iobuf_open (fname);
|
||||||
if (a && is_secured_file (iobuf_get_fd (a)))
|
if (a && is_secured_file (iobuf_get_fd (a)))
|
||||||
@ -1950,6 +1956,7 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
|
|||||||
{
|
{
|
||||||
tty_printf (_("Can't open '%s': %s\n"),
|
tty_printf (_("Can't open '%s': %s\n"),
|
||||||
fname, strerror (errno));
|
fname, strerror (errno));
|
||||||
|
xfree (fname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1966,10 +1973,13 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
|
|||||||
{
|
{
|
||||||
tty_printf (_("Error reading backup key from '%s': %s\n"),
|
tty_printf (_("Error reading backup key from '%s': %s\n"),
|
||||||
fname, gpg_strerror (err));
|
fname, gpg_strerror (err));
|
||||||
|
xfree (fname);
|
||||||
free_packet (pkt);
|
free_packet (pkt);
|
||||||
xfree (pkt);
|
xfree (pkt);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xfree (fname);
|
||||||
node = new_kbnode (pkt);
|
node = new_kbnode (pkt);
|
||||||
|
|
||||||
if (cmd == cmdCHECKBKUPKEY)
|
if (cmd == cmdCHECKBKUPKEY)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user