mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-11 22:52:47 +01:00
dirmngr: Suppress error message on trial reading as PEM format.
* dirmngr/dirmngr-client.c (read_pem_certificate): Add NO_ERRMSG argument to suppress the error message. (read_certificate, squid_loop_body): Follow the change. -- GnuPG-bug-id: 5531 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
4d19759ce5
commit
25d37a0a6a
@ -459,7 +459,8 @@ data_cb (void *opaque, const void *buffer, size_t length)
|
|||||||
returned in an alloced buffer whose address will be returned in
|
returned in an alloced buffer whose address will be returned in
|
||||||
RBUF and its length in RBUFLEN. */
|
RBUF and its length in RBUFLEN. */
|
||||||
static gpg_error_t
|
static gpg_error_t
|
||||||
read_pem_certificate (const char *fname, unsigned char **rbuf, size_t *rbuflen)
|
read_pem_certificate (const char *fname, unsigned char **rbuf, size_t *rbuflen,
|
||||||
|
int no_errmsg)
|
||||||
{
|
{
|
||||||
estream_t fp;
|
estream_t fp;
|
||||||
int c;
|
int c;
|
||||||
@ -602,7 +603,8 @@ read_pem_certificate (const char *fname, unsigned char **rbuf, size_t *rbuflen)
|
|||||||
}
|
}
|
||||||
else if (state != s_waitend)
|
else if (state != s_waitend)
|
||||||
{
|
{
|
||||||
log_error ("no certificate or invalid encoded\n");
|
if (!no_errmsg)
|
||||||
|
log_error ("no certificate or invalid encoded\n");
|
||||||
xfree (buf);
|
xfree (buf);
|
||||||
return gpg_error (GPG_ERR_INV_ARMOR);
|
return gpg_error (GPG_ERR_INV_ARMOR);
|
||||||
}
|
}
|
||||||
@ -625,13 +627,13 @@ read_certificate (const char *fname, unsigned char **rbuf, size_t *rbuflen)
|
|||||||
size_t nread, bufsize, buflen;
|
size_t nread, bufsize, buflen;
|
||||||
|
|
||||||
if (opt.pem)
|
if (opt.pem)
|
||||||
return read_pem_certificate (fname, rbuf, rbuflen);
|
return read_pem_certificate (fname, rbuf, rbuflen, 0);
|
||||||
else if (fname)
|
else if (fname)
|
||||||
{
|
{
|
||||||
/* A filename has been given. Let's just assume it is in PEM
|
/* A filename has been given. Let's just assume it is in PEM
|
||||||
format and decode it, and fall back to interpreting it as
|
format and decode it, and fall back to interpreting it as
|
||||||
binary certificate if that fails. */
|
binary certificate if that fails. */
|
||||||
err = read_pem_certificate (fname, rbuf, rbuflen);
|
err = read_pem_certificate (fname, rbuf, rbuflen, 1);
|
||||||
if (! err)
|
if (! err)
|
||||||
return 0;
|
return 0;
|
||||||
/* Clear the error count to try as binary certificate. */
|
/* Clear the error count to try as binary certificate. */
|
||||||
@ -905,7 +907,7 @@ squid_loop_body (assuan_context_t ctx)
|
|||||||
unsigned char *certbuf;
|
unsigned char *certbuf;
|
||||||
size_t certbuflen = 0;
|
size_t certbuflen = 0;
|
||||||
|
|
||||||
err = read_pem_certificate (NULL, &certbuf, &certbuflen);
|
err = read_pem_certificate (NULL, &certbuf, &certbuflen, 0);
|
||||||
if (gpg_err_code (err) == GPG_ERR_EOF)
|
if (gpg_err_code (err) == GPG_ERR_EOF)
|
||||||
return err;
|
return err;
|
||||||
if (err)
|
if (err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user