mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Fixed bug#907.
Fixed a segv in keybox and made it more robust.
This commit is contained in:
parent
67e0a7e732
commit
4254e90426
2
TODO
2
TODO
@ -131,4 +131,6 @@
|
|||||||
our design goal to allow changing the locale without changing
|
our design goal to allow changing the locale without changing
|
||||||
gpg-agent's default locale (e.g. by the command updatestartuptty).
|
gpg-agent's default locale (e.g. by the command updatestartuptty).
|
||||||
|
|
||||||
|
* RFC 4387: Operational Protocols: Certificate Store Access via HTTP
|
||||||
|
Do we support this?
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ if test "$1" = "--build-w32"; then
|
|||||||
--with-zlib=${w32root} \
|
--with-zlib=${w32root} \
|
||||||
--with-regex=${w32root} \
|
--with-regex=${w32root} \
|
||||||
--with-pth-prefix=${w32root} \
|
--with-pth-prefix=${w32root} \
|
||||||
|
--with-adns=${w32root}
|
||||||
--without-included-gettext "$@"
|
--without-included-gettext "$@"
|
||||||
rc=$?
|
rc=$?
|
||||||
exit $rc
|
exit $rc
|
||||||
|
@ -847,6 +847,8 @@ if test "$have_adns" = "yes"; then
|
|||||||
ADNSLIBS="-ladns"
|
ADNSLIBS="-ladns"
|
||||||
fi
|
fi
|
||||||
AC_SUBST(ADNSLIBS)
|
AC_SUBST(ADNSLIBS)
|
||||||
|
# Newer adns versions feature a free function to be used under W32.
|
||||||
|
AC_CHECK_FUNCS(adns_free)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2008-05-06 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* keybox-file.c (_keybox_read_blob2): Return GPG_ERR_TOO_SHORT if
|
||||||
|
we get an EOF for 2nd to 5th byte as a better error message.
|
||||||
|
|
||||||
|
Always use gpg_error_from_syserror and gpg_err_code_from_syserror.
|
||||||
|
This is to avoid cases where we expect an error but due to an
|
||||||
|
errno set to 0 we get back a success status.
|
||||||
|
|
||||||
2008-04-01 Werner Koch <wk@g10code.com>
|
2008-04-01 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* keybox-init.c (keybox_new, keybox_release): Track used handles.
|
* keybox-init.c (keybox_new, keybox_release): Track used handles.
|
||||||
|
@ -685,7 +685,7 @@ create_blob_finish (KEYBOXBLOB blob)
|
|||||||
|
|
||||||
pp = xtrymalloc (n);
|
pp = xtrymalloc (n);
|
||||||
if ( !pp )
|
if ( !pp )
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
memcpy (pp , p, n);
|
memcpy (pp , p, n);
|
||||||
blob->blob = pp;
|
blob->blob = pp;
|
||||||
blob->bloblen = n;
|
blob->bloblen = n;
|
||||||
@ -706,7 +706,7 @@ _keybox_create_pgp_blob (KEYBOXBLOB *r_blob, KBNODE keyblock, int as_ephemeral)
|
|||||||
*r_blob = NULL;
|
*r_blob = NULL;
|
||||||
blob = xtrycalloc (1, sizeof *blob);
|
blob = xtrycalloc (1, sizeof *blob);
|
||||||
if (!blob)
|
if (!blob)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
/* fixme: Do some sanity checks on the keyblock */
|
/* fixme: Do some sanity checks on the keyblock */
|
||||||
|
|
||||||
@ -838,7 +838,7 @@ _keybox_create_x509_blob (KEYBOXBLOB *r_blob, ksba_cert_t cert,
|
|||||||
*r_blob = NULL;
|
*r_blob = NULL;
|
||||||
blob = xtrycalloc (1, sizeof *blob);
|
blob = xtrycalloc (1, sizeof *blob);
|
||||||
if( !blob )
|
if( !blob )
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
sn = ksba_cert_get_serial (cert);
|
sn = ksba_cert_get_serial (cert);
|
||||||
if (sn)
|
if (sn)
|
||||||
@ -873,7 +873,7 @@ _keybox_create_x509_blob (KEYBOXBLOB *r_blob, ksba_cert_t cert,
|
|||||||
names = xtrymalloc (max_names * sizeof *names);
|
names = xtrymalloc (max_names * sizeof *names);
|
||||||
if (!names)
|
if (!names)
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,7 +894,7 @@ _keybox_create_x509_blob (KEYBOXBLOB *r_blob, ksba_cert_t cert,
|
|||||||
tmp = xtryrealloc (names, max_names * sizeof *names);
|
tmp = xtryrealloc (names, max_names * sizeof *names);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -985,7 +985,7 @@ _keybox_new_blob (KEYBOXBLOB *r_blob,
|
|||||||
*r_blob = NULL;
|
*r_blob = NULL;
|
||||||
blob = xtrycalloc (1, sizeof *blob);
|
blob = xtrycalloc (1, sizeof *blob);
|
||||||
if (!blob)
|
if (!blob)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
blob->blob = image;
|
blob->blob = image;
|
||||||
blob->bloblen = imagelen;
|
blob->bloblen = imagelen;
|
||||||
|
@ -58,7 +58,7 @@ _keybox_read_blob2 (KEYBOXBLOB *r_blob, FILE *fp, int *skipped_deleted)
|
|||||||
*r_blob = NULL;
|
*r_blob = NULL;
|
||||||
off = ftello (fp);
|
off = ftello (fp);
|
||||||
if (off == (off_t)-1)
|
if (off == (off_t)-1)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
if ((c1 = getc (fp)) == EOF
|
if ((c1 = getc (fp)) == EOF
|
||||||
|| (c2 = getc (fp)) == EOF
|
|| (c2 = getc (fp)) == EOF
|
||||||
@ -68,7 +68,9 @@ _keybox_read_blob2 (KEYBOXBLOB *r_blob, FILE *fp, int *skipped_deleted)
|
|||||||
{
|
{
|
||||||
if ( c1 == EOF && !ferror (fp) )
|
if ( c1 == EOF && !ferror (fp) )
|
||||||
return -1; /* eof */
|
return -1; /* eof */
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
if (!ferror (fp))
|
||||||
|
return gpg_error (GPG_ERR_TOO_SHORT);
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
}
|
}
|
||||||
|
|
||||||
imagelen = (c1 << 24) | (c2 << 16) | (c3 << 8 ) | c4;
|
imagelen = (c1 << 24) | (c2 << 16) | (c3 << 8 ) | c4;
|
||||||
@ -82,26 +84,26 @@ _keybox_read_blob2 (KEYBOXBLOB *r_blob, FILE *fp, int *skipped_deleted)
|
|||||||
{
|
{
|
||||||
/* Special treatment for empty blobs. */
|
/* Special treatment for empty blobs. */
|
||||||
if (fseek (fp, imagelen-5, SEEK_CUR))
|
if (fseek (fp, imagelen-5, SEEK_CUR))
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
*skipped_deleted = 1;
|
*skipped_deleted = 1;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
image = xtrymalloc (imagelen);
|
image = xtrymalloc (imagelen);
|
||||||
if (!image)
|
if (!image)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
image[0] = c1; image[1] = c2; image[2] = c3; image[3] = c4; image[4] = type;
|
image[0] = c1; image[1] = c2; image[2] = c3; image[3] = c4; image[4] = type;
|
||||||
if (fread (image+5, imagelen-5, 1, fp) != 1)
|
if (fread (image+5, imagelen-5, 1, fp) != 1)
|
||||||
{
|
{
|
||||||
gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno));
|
gpg_error_t tmperr = gpg_error_from_syserror ();
|
||||||
xfree (image);
|
xfree (image);
|
||||||
return tmperr;
|
return tmperr;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = r_blob? _keybox_new_blob (r_blob, image, imagelen, off) : 0;
|
rc = r_blob? _keybox_new_blob (r_blob, image, imagelen, off) : 0;
|
||||||
if (rc || !r_blob)
|
if (rc || !r_blob)
|
||||||
xfree (image);
|
xfree (image);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +124,7 @@ _keybox_write_blob (KEYBOXBLOB blob, FILE *fp)
|
|||||||
|
|
||||||
image = _keybox_get_blob_image (blob, &length);
|
image = _keybox_get_blob_image (blob, &length);
|
||||||
if (fwrite (image, length, 1, fp) != 1)
|
if (fwrite (image, length, 1, fp) != 1)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ _keybox_write_header_blob (FILE *fp)
|
|||||||
image[20+3] = (val );
|
image[20+3] = (val );
|
||||||
|
|
||||||
if (fwrite (image, 32, 1, fp) != 1)
|
if (fwrite (image, 32, 1, fp) != 1)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@ keybox_search (KEYBOX_HANDLE hd, KEYBOX_SEARCH_DESC *desc, size_t ndesc)
|
|||||||
{
|
{
|
||||||
sn_array = xtrycalloc (ndesc, sizeof *sn_array);
|
sn_array = xtrycalloc (ndesc, sizeof *sn_array);
|
||||||
if (!sn_array)
|
if (!sn_array)
|
||||||
return (hd->error = gpg_error (gpg_err_code_from_errno (errno)));
|
return (hd->error = gpg_error_from_syserror ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -744,7 +744,7 @@ keybox_search (KEYBOX_HANDLE hd, KEYBOX_SEARCH_DESC *desc, size_t ndesc)
|
|||||||
hd->fp = fopen (hd->kb->fname, "rb");
|
hd->fp = fopen (hd->kb->fname, "rb");
|
||||||
if (!hd->fp)
|
if (!hd->fp)
|
||||||
{
|
{
|
||||||
hd->error = gpg_error (gpg_err_code_from_errno (errno));
|
hd->error = gpg_error_from_syserror ();
|
||||||
xfree (sn_array);
|
xfree (sn_array);
|
||||||
return hd->error;
|
return hd->error;
|
||||||
}
|
}
|
||||||
@ -776,7 +776,7 @@ keybox_search (KEYBOX_HANDLE hd, KEYBOX_SEARCH_DESC *desc, size_t ndesc)
|
|||||||
sn_array[n].sn = xtrymalloc (snlen);
|
sn_array[n].sn = xtrymalloc (snlen);
|
||||||
if (!sn_array[n].sn)
|
if (!sn_array[n].sn)
|
||||||
{
|
{
|
||||||
hd->error = gpg_error (gpg_err_code_from_errno (errno));
|
hd->error = gpg_error_from_syserror ();
|
||||||
release_sn_array (sn_array, n);
|
release_sn_array (sn_array, n);
|
||||||
return hd->error;
|
return hd->error;
|
||||||
}
|
}
|
||||||
@ -800,7 +800,7 @@ keybox_search (KEYBOX_HANDLE hd, KEYBOX_SEARCH_DESC *desc, size_t ndesc)
|
|||||||
sn_array[n].sn = xtrymalloc (snlen);
|
sn_array[n].sn = xtrymalloc (snlen);
|
||||||
if (!sn_array[n].sn)
|
if (!sn_array[n].sn)
|
||||||
{
|
{
|
||||||
hd->error = gpg_error (gpg_err_code_from_errno (errno));
|
hd->error = gpg_error_from_syserror ();
|
||||||
release_sn_array (sn_array, n);
|
release_sn_array (sn_array, n);
|
||||||
return hd->error;
|
return hd->error;
|
||||||
}
|
}
|
||||||
|
@ -82,14 +82,14 @@ create_tmp_file (const char *template,
|
|||||||
{
|
{
|
||||||
bakfname = xtrymalloc (strlen (template) + 1);
|
bakfname = xtrymalloc (strlen (template) + 1);
|
||||||
if (!bakfname)
|
if (!bakfname)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
strcpy (bakfname, template);
|
strcpy (bakfname, template);
|
||||||
strcpy (bakfname+strlen(template)-4, EXTSEP_S "bak");
|
strcpy (bakfname+strlen(template)-4, EXTSEP_S "bak");
|
||||||
|
|
||||||
tmpfname = xtrymalloc (strlen (template) + 1);
|
tmpfname = xtrymalloc (strlen (template) + 1);
|
||||||
if (!tmpfname)
|
if (!tmpfname)
|
||||||
{
|
{
|
||||||
gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno));
|
gpg_error_t tmperr = gpg_error_from_syserror ();
|
||||||
xfree (bakfname);
|
xfree (bakfname);
|
||||||
return tmperr;
|
return tmperr;
|
||||||
}
|
}
|
||||||
@ -100,13 +100,13 @@ create_tmp_file (const char *template,
|
|||||||
{ /* File does not end with kbx; hmmm. */
|
{ /* File does not end with kbx; hmmm. */
|
||||||
bakfname = xtrymalloc ( strlen (template) + 5);
|
bakfname = xtrymalloc ( strlen (template) + 5);
|
||||||
if (!bakfname)
|
if (!bakfname)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
strcpy (stpcpy (bakfname, template), EXTSEP_S "bak");
|
strcpy (stpcpy (bakfname, template), EXTSEP_S "bak");
|
||||||
|
|
||||||
tmpfname = xtrymalloc ( strlen (template) + 5);
|
tmpfname = xtrymalloc ( strlen (template) + 5);
|
||||||
if (!tmpfname)
|
if (!tmpfname)
|
||||||
{
|
{
|
||||||
gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno));
|
gpg_error_t tmperr = gpg_error_from_syserror ();
|
||||||
xfree (bakfname);
|
xfree (bakfname);
|
||||||
return tmperr;
|
return tmperr;
|
||||||
}
|
}
|
||||||
@ -115,13 +115,13 @@ create_tmp_file (const char *template,
|
|||||||
# else /* Posix file names */
|
# else /* Posix file names */
|
||||||
bakfname = xtrymalloc (strlen (template) + 2);
|
bakfname = xtrymalloc (strlen (template) + 2);
|
||||||
if (!bakfname)
|
if (!bakfname)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
strcpy (stpcpy (bakfname,template),"~");
|
strcpy (stpcpy (bakfname,template),"~");
|
||||||
|
|
||||||
tmpfname = xtrymalloc ( strlen (template) + 5);
|
tmpfname = xtrymalloc ( strlen (template) + 5);
|
||||||
if (!tmpfname)
|
if (!tmpfname)
|
||||||
{
|
{
|
||||||
gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno));
|
gpg_error_t tmperr = gpg_error_from_syserror ();
|
||||||
xfree (bakfname);
|
xfree (bakfname);
|
||||||
return tmperr;
|
return tmperr;
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ create_tmp_file (const char *template,
|
|||||||
*r_fp = fopen (tmpfname, "wb");
|
*r_fp = fopen (tmpfname, "wb");
|
||||||
if (!*r_fp)
|
if (!*r_fp)
|
||||||
{
|
{
|
||||||
gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno));
|
gpg_error_t tmperr = gpg_error_from_syserror ();
|
||||||
xfree (tmpfname);
|
xfree (tmpfname);
|
||||||
xfree (bakfname);
|
xfree (bakfname);
|
||||||
return tmperr;
|
return tmperr;
|
||||||
@ -175,7 +175,7 @@ rename_tmp_file (const char *bakfname, const char *tmpfname,
|
|||||||
#endif
|
#endif
|
||||||
if (rename (fname, bakfname) )
|
if (rename (fname, bakfname) )
|
||||||
{
|
{
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ rename_tmp_file (const char *bakfname, const char *tmpfname,
|
|||||||
#endif
|
#endif
|
||||||
if (rename (tmpfname, fname) )
|
if (rename (tmpfname, fname) )
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
if (secret)
|
if (secret)
|
||||||
{
|
{
|
||||||
/* log_info ("WARNING: 2 files with confidential" */
|
/* log_info ("WARNING: 2 files with confidential" */
|
||||||
@ -221,7 +221,7 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
|
|||||||
/* Open the source file. Because we do a rename, we have to check the
|
/* Open the source file. Because we do a rename, we have to check the
|
||||||
permissions of the file */
|
permissions of the file */
|
||||||
if (access (fname, W_OK))
|
if (access (fname, W_OK))
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
fp = fopen (fname, "rb");
|
fp = fopen (fname, "rb");
|
||||||
if (mode == 1 && !fp && errno == ENOENT)
|
if (mode == 1 && !fp && errno == ENOENT)
|
||||||
@ -230,7 +230,7 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
|
|||||||
Create a new keybox file. */
|
Create a new keybox file. */
|
||||||
newfp = fopen (fname, "wb");
|
newfp = fopen (fname, "wb");
|
||||||
if (!newfp )
|
if (!newfp )
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
rc = _keybox_write_header_blob (newfp);
|
rc = _keybox_write_header_blob (newfp);
|
||||||
if (rc)
|
if (rc)
|
||||||
@ -241,7 +241,7 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
|
|||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if ( fclose (newfp) )
|
if ( fclose (newfp) )
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
/* if (chmod( fname, S_IRUSR | S_IWUSR )) */
|
/* if (chmod( fname, S_IRUSR | S_IWUSR )) */
|
||||||
/* { */
|
/* { */
|
||||||
@ -253,7 +253,7 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
|
|||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,13 +273,13 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
|
|||||||
{
|
{
|
||||||
if (fwrite (buffer, nread, 1, newfp) != 1)
|
if (fwrite (buffer, nread, 1, newfp) != 1)
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ferror (fp))
|
if (ferror (fp))
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,13 +302,13 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
|
|||||||
|
|
||||||
if (fwrite (buffer, nread, 1, newfp) != 1)
|
if (fwrite (buffer, nread, 1, newfp) != 1)
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ferror (fp))
|
if (ferror (fp))
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,13 +333,13 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
|
|||||||
{
|
{
|
||||||
if (fwrite (buffer, nread, 1, newfp) != 1)
|
if (fwrite (buffer, nread, 1, newfp) != 1)
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ferror (fp))
|
if (ferror (fp))
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,13 +347,13 @@ blob_filecopy (int mode, const char *fname, KEYBOXBLOB blob,
|
|||||||
/* Close both files. */
|
/* Close both files. */
|
||||||
if (fclose(fp))
|
if (fclose(fp))
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
fclose (newfp);
|
fclose (newfp);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if (fclose(newfp))
|
if (fclose(newfp))
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,11 +452,11 @@ keybox_set_flags (KEYBOX_HANDLE hd, int what, int idx, unsigned int value)
|
|||||||
_keybox_close_file (hd);
|
_keybox_close_file (hd);
|
||||||
fp = fopen (hd->kb->fname, "r+b");
|
fp = fopen (hd->kb->fname, "r+b");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
ec = 0;
|
ec = 0;
|
||||||
if (fseeko (fp, off, SEEK_SET))
|
if (fseeko (fp, off, SEEK_SET))
|
||||||
ec = gpg_error (gpg_err_code_from_errno (errno));
|
ec = gpg_error_from_syserror ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned char tmp[4];
|
unsigned char tmp[4];
|
||||||
@ -472,7 +472,7 @@ keybox_set_flags (KEYBOX_HANDLE hd, int what, int idx, unsigned int value)
|
|||||||
case 2:
|
case 2:
|
||||||
case 4:
|
case 4:
|
||||||
if (fwrite (tmp+4-flag_size, flag_size, 1, fp) != 1)
|
if (fwrite (tmp+4-flag_size, flag_size, 1, fp) != 1)
|
||||||
ec = gpg_err_code_from_errno (errno);
|
ec = gpg_err_code_from_syserror ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ec = GPG_ERR_BUG;
|
ec = GPG_ERR_BUG;
|
||||||
@ -483,7 +483,7 @@ keybox_set_flags (KEYBOX_HANDLE hd, int what, int idx, unsigned int value)
|
|||||||
if (fclose (fp))
|
if (fclose (fp))
|
||||||
{
|
{
|
||||||
if (!ec)
|
if (!ec)
|
||||||
ec = gpg_err_code_from_errno (errno);
|
ec = gpg_err_code_from_syserror ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return gpg_error (ec);
|
return gpg_error (ec);
|
||||||
@ -517,19 +517,19 @@ keybox_delete (KEYBOX_HANDLE hd)
|
|||||||
_keybox_close_file (hd);
|
_keybox_close_file (hd);
|
||||||
fp = fopen (hd->kb->fname, "r+b");
|
fp = fopen (hd->kb->fname, "r+b");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
if (fseeko (fp, off, SEEK_SET))
|
if (fseeko (fp, off, SEEK_SET))
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
else if (putc (0, fp) == EOF)
|
else if (putc (0, fp) == EOF)
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
else
|
else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
if (fclose (fp))
|
if (fclose (fp))
|
||||||
{
|
{
|
||||||
if (!rc)
|
if (!rc)
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -567,14 +567,14 @@ keybox_compress (KEYBOX_HANDLE hd)
|
|||||||
/* Open the source file. Because we do a rename, we have to check the
|
/* Open the source file. Because we do a rename, we have to check the
|
||||||
permissions of the file */
|
permissions of the file */
|
||||||
if (access (fname, W_OK))
|
if (access (fname, W_OK))
|
||||||
return gpg_error (gpg_err_code_from_errno (errno));
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
fp = fopen (fname, "rb");
|
fp = fopen (fname, "rb");
|
||||||
if (!fp && errno == ENOENT)
|
if (!fp && errno == ENOENT)
|
||||||
return 0; /* Ready. File has been deleted right after the access above. */
|
return 0; /* Ready. File has been deleted right after the access above. */
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,9 +695,9 @@ keybox_compress (KEYBOX_HANDLE hd)
|
|||||||
|
|
||||||
/* Close both files. */
|
/* Close both files. */
|
||||||
if (fclose(fp) && !rc)
|
if (fclose(fp) && !rc)
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
if (fclose(newfp) && !rc)
|
if (fclose(newfp) && !rc)
|
||||||
rc = gpg_error (gpg_err_code_from_errno (errno));
|
rc = gpg_error_from_syserror ();
|
||||||
|
|
||||||
/* Rename or remove the temporary file. */
|
/* Rename or remove the temporary file. */
|
||||||
if (rc || !any_changes)
|
if (rc || !any_changes)
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#ifdef HAVE_ADNS_H
|
#ifdef HAVE_ADNS_H
|
||||||
# include <adns.h>
|
# include <adns.h>
|
||||||
|
# ifndef HAVE_ADNS_FREE
|
||||||
|
# define adns_free free
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INCLUDED_BY_MAIN_MODULE 1
|
#define INCLUDED_BY_MAIN_MODULE 1
|
||||||
@ -175,7 +178,7 @@ get_key (adns_state adns_ctx, char *address)
|
|||||||
fprintf (output, "\nNAME %s FAILED %d\n", address, ret);
|
fprintf (output, "\nNAME %s FAILED %d\n", address, ret);
|
||||||
else
|
else
|
||||||
fprintf (output, "\nNAME %s END\n", address);
|
fprintf (output, "\nNAME %s END\n", address);
|
||||||
free (answer); /* (Right, this is free and not xfree.) */
|
adns_free (answer);
|
||||||
xfree (name);
|
xfree (name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2008-05-01 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* de.po: Typo fix.
|
||||||
|
|
||||||
2008-03-26 Jedi Lin <Jedi@Jedi.org> (wk)
|
2008-03-26 Jedi Lin <Jedi@Jedi.org> (wk)
|
||||||
|
|
||||||
* zh_TW.po: Update.
|
* zh_TW.po: Update.
|
||||||
|
768
po/pt_BR.po
768
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
748
po/zh_CN.po
748
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
748
po/zh_TW.po
748
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,8 @@
|
|||||||
|
2008-05-06 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* keylist.c (list_external_keys): Ignore NOT FOUND error code.
|
||||||
|
This is bug#907.
|
||||||
|
|
||||||
2008-04-23 Werner Koch <wk@g10code.com>
|
2008-04-23 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* certchain.c (find_up): Make correct C89 code. Declare variable
|
* certchain.c (find_up): Make correct C89 code. Declare variable
|
||||||
|
@ -1383,6 +1383,9 @@ list_external_keys (ctrl_t ctrl, strlist_t names, estream_t fp, int raw_mode)
|
|||||||
parm.raw_mode = raw_mode;
|
parm.raw_mode = raw_mode;
|
||||||
|
|
||||||
rc = gpgsm_dirmngr_lookup (ctrl, names, 0, list_external_cb, &parm);
|
rc = gpgsm_dirmngr_lookup (ctrl, names, 0, list_external_cb, &parm);
|
||||||
|
if (gpg_err_code (rc) == GPG_ERR_EOF || rc == -1
|
||||||
|
|| gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
|
||||||
|
rc = 0; /* "Not found" is not an error here. */
|
||||||
if (rc)
|
if (rc)
|
||||||
log_error ("listing external keys failed: %s\n", gpg_strerror (rc));
|
log_error ("listing external keys failed: %s\n", gpg_strerror (rc));
|
||||||
return rc;
|
return rc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user