mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-23 15:07:03 +01:00
Re-indentation
This commit is contained in:
parent
27c1b4bef8
commit
fafe852c33
@ -1,6 +1,6 @@
|
||||
/* decrypt.c - verify signed data
|
||||
/* decrypt.c - decrypt and verify data
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||
* 2007 Free Software Foundation, Inc.
|
||||
* 2007, 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -36,18 +36,14 @@
|
||||
#include "status.h"
|
||||
#include "i18n.h"
|
||||
|
||||
|
||||
|
||||
/****************
|
||||
* Assume that the input is an encrypted message and decrypt
|
||||
/* Assume that the input is an encrypted message and decrypt
|
||||
* (and if signed, verify the signature on) it.
|
||||
* This command differs from the default operation, as it never
|
||||
* writes to the filename which is included in the file and it
|
||||
* rejects files which don't begin with an encrypted message.
|
||||
*/
|
||||
|
||||
int
|
||||
decrypt_message( const char *filename )
|
||||
decrypt_message (const char *filename)
|
||||
{
|
||||
IOBUF fp;
|
||||
armor_filter_context_t *afx = NULL;
|
||||
@ -58,14 +54,15 @@ decrypt_message( const char *filename )
|
||||
pfx = new_progress_context ();
|
||||
|
||||
/* Open the message file. */
|
||||
fp = iobuf_open(filename);
|
||||
fp = iobuf_open (filename);
|
||||
if (fp && is_secured_file (iobuf_get_fd (fp)))
|
||||
{
|
||||
iobuf_close (fp);
|
||||
fp = NULL;
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !fp ) {
|
||||
if ( !fp )
|
||||
{
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error (_("can't open `%s': %s\n"), print_fname_stdin(filename),
|
||||
gpg_strerror (rc));
|
||||
@ -75,28 +72,33 @@ decrypt_message( const char *filename )
|
||||
|
||||
handle_progress (pfx, fp, filename);
|
||||
|
||||
if( !opt.no_armor ) {
|
||||
if( use_armor_filter( fp ) ) {
|
||||
if ( !opt.no_armor )
|
||||
{
|
||||
if ( use_armor_filter( fp ) )
|
||||
{
|
||||
afx = new_armor_context ();
|
||||
push_armor_filter ( afx, fp );
|
||||
}
|
||||
}
|
||||
|
||||
if( !opt.outfile ) {
|
||||
if (!opt.outfile)
|
||||
{
|
||||
no_out = 1;
|
||||
opt.outfile = "-";
|
||||
}
|
||||
rc = proc_encryption_packets( NULL, fp );
|
||||
if( no_out )
|
||||
rc = proc_encryption_packets ( NULL, fp );
|
||||
if (no_out)
|
||||
opt.outfile = NULL;
|
||||
iobuf_close(fp);
|
||||
|
||||
iobuf_close (fp);
|
||||
release_armor_context (afx);
|
||||
release_progress_context (pfx);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
decrypt_messages(int nfiles, char *files[])
|
||||
decrypt_messages (int nfiles, char *files[])
|
||||
{
|
||||
IOBUF fp;
|
||||
armor_filter_context_t *afx = NULL;
|
||||
|
31
g10/server.c
31
g10/server.c
@ -345,14 +345,33 @@ cmd_encrypt (assuan_context_t ctx, char *line)
|
||||
|
||||
/* DECRYPT
|
||||
|
||||
This performs the decrypt operation after doing some checks on the
|
||||
internal state (e.g. that only needed data has been set). */
|
||||
This performs the decrypt operation. */
|
||||
static gpg_error_t
|
||||
cmd_decrypt (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
(void)line;
|
||||
return gpg_error (GPG_ERR_NOT_SUPPORTED);
|
||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||
gpg_error_t err;
|
||||
int inp_fd, out_fd;
|
||||
|
||||
(void)line; /* LINE is not used. */
|
||||
|
||||
inp_fd = translate_sys2libc_fd (assuan_get_input_fd (ctx), 0);
|
||||
if (inp_fd == -1)
|
||||
return set_error (GPG_ERR_ASS_NO_INPUT, NULL);
|
||||
out_fd = translate_sys2libc_fd (assuan_get_output_fd (ctx), 1);
|
||||
if (out_fd == -1)
|
||||
return set_error (GPG_ERR_ASS_NO_OUTPUT, NULL);
|
||||
|
||||
err = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
|
||||
/* Close and reset the fds. */
|
||||
close_message_fd (ctrl);
|
||||
assuan_close_input_fd (ctx);
|
||||
assuan_close_output_fd (ctx);
|
||||
|
||||
if (err)
|
||||
log_error ("command '%s' failed: %s\n", "DECRYPT", gpg_strerror (err));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@ -406,6 +425,8 @@ cmd_verify (assuan_context_t ctx, char *line)
|
||||
assuan_close_input_fd (ctx);
|
||||
assuan_close_output_fd (ctx);
|
||||
|
||||
if (rc)
|
||||
log_error ("command '%s' failed: %s\n", "VERIFY", gpg_strerror (rc));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user