1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-17 00:39:50 +02:00

* g10.c (main), passphrase.c (set_passphrase_from_string): New

--passphrase command line option.  Only useful in very special
circumstances.
This commit is contained in:
David Shaw 2005-08-05 19:54:06 +00:00
parent 6ce02d4eb5
commit 82bee9c68a
3 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-08-05 David Shaw <dshaw@jabberwocky.com>
* g10.c (main), passphrase.c (set_passphrase_from_string): New
--passphrase command line option. Only useful in very special
circumstances.
2005-08-05 Werner Koch <wk@g10code.com>
* gpgv.c (keyserver_import_fprint): New stub.

View File

@ -211,6 +211,7 @@ enum cmd_and_opt_values
oCompressLevel,
oBZ2CompressLevel,
oBZ2DecompressLowmem,
oPasswd,
oPasswdFD,
oPasswdFile,
oCommandFD,
@ -558,6 +559,7 @@ static ARGPARSE_OPTS opts[] = {
/* { aListTrustPath, "list-trust-path",0, "@"}, */
{ aPipeMode, "pipemode", 0, "@" },
{ oKOption, NULL, 0, "@"},
{ oPasswd, "passphrase",2, "@" },
{ oPasswdFD, "passphrase-fd",1, "@" },
{ oPasswdFile, "passphrase-file",2, "@" },
{ oCommandFD, "command-fd",1, "@" },
@ -2270,6 +2272,9 @@ main (int argc, char **argv )
case oCompressLevel: opt.compress_level = pargs.r.ret_int; break;
case oBZ2CompressLevel: opt.bz2_compress_level = pargs.r.ret_int; break;
case oBZ2DecompressLowmem: opt.bz2_decompress_lowmem=1; break;
case oPasswd:
set_passphrase_from_string(pargs.r.ret_str);
break;
case oPasswdFD:
pwfd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
opt.use_agent = 0;

View File

@ -115,6 +115,19 @@ get_last_passphrase()
return p;
}
/* Here's an interesting question: since this passphrase was passed in
on the command line, is there really any point in using secure
memory for it? I'm going with 'yes', since it doesn't hurt, and
might help in some small way (swapping). */
void
set_passphrase_from_string(const char *pass)
{
xfree( fd_passwd );
fd_passwd = xmalloc_secure(strlen(pass)+1);
strcpy(fd_passwd,pass);
}
void
read_passphrase_from_fd( int fd )