aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2011-10-13 15:18:05 +0000
committerMarcus Brinkmann <[email protected]>2011-10-13 15:18:05 +0000
commit36e85416a37fdf8bda8ac5d74ef5f4ee9d1a82cd (patch)
treeea6136a772863030dc209fc21e7e42257cb09e4b
parentInitial port to Npth. (diff)
parentPut more options into the options index (diff)
downloadgnupg-36e85416a37fdf8bda8ac5d74ef5f4ee9d1a82cd.tar.gz
gnupg-36e85416a37fdf8bda8ac5d74ef5f4ee9d1a82cd.zip
Merge branch 'master' into npth
Conflicts: ChangeLog common/ChangeLog
-rw-r--r--ChangeLog6
-rw-r--r--common/ChangeLog45
-rw-r--r--common/argparse.c25
-rw-r--r--common/argparse.h25
-rw-r--r--common/asshelp.c6
-rw-r--r--common/dotlock.c1325
-rw-r--r--common/dotlock.h71
-rw-r--r--common/dynload.h25
-rw-r--r--common/libjnlib-config.h25
-rw-r--r--common/logging.c25
-rw-r--r--common/logging.h25
-rw-r--r--common/mischelp.c25
-rw-r--r--common/mischelp.h25
-rw-r--r--common/stringhelp.c25
-rw-r--r--common/stringhelp.h25
-rw-r--r--common/strlist.c25
-rw-r--r--common/strlist.h25
-rw-r--r--common/t-dotlock.c145
-rw-r--r--common/t-stringhelp.c25
-rw-r--r--common/t-support.c25
-rw-r--r--common/t-support.h25
-rw-r--r--common/t-timestuff.c25
-rw-r--r--common/t-w32-reg.c25
-rw-r--r--common/types.h25
-rw-r--r--common/utf8conv.c25
-rw-r--r--common/utf8conv.h25
-rw-r--r--common/util.h33
-rw-r--r--common/w32-afunix.c25
-rw-r--r--common/w32-afunix.h25
-rw-r--r--common/w32-reg.c25
-rw-r--r--common/w32help.h25
-rw-r--r--common/xmalloc.c25
-rw-r--r--common/xmalloc.h25
-rw-r--r--configure.ac33
-rw-r--r--doc/ChangeLog6
-rw-r--r--doc/gpg-agent.texi4
-rw-r--r--doc/gpg.texi1500
-rw-r--r--doc/gpgsm.texi2
-rw-r--r--doc/tools.texi1
-rw-r--r--doc/yat2m.c103
-rw-r--r--g10/ChangeLog9
-rw-r--r--g10/gpg.c4
-rw-r--r--g10/gpgv.c15
-rw-r--r--g10/keydb.c8
-rw-r--r--g10/keyring.c6
-rw-r--r--g10/tdbio.c24
-rw-r--r--g13/create.c6
-rw-r--r--g13/g13.c2
-rw-r--r--g13/mount.c6
-rw-r--r--po/de.po56
-rw-r--r--sm/gpgsm.c2
-rw-r--r--sm/keydb.c12
52 files changed, 2688 insertions, 1392 deletions
diff --git a/ChangeLog b/ChangeLog
index 00e01abea..f36d54e97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-2011-09-26 Marcus Brinkmann <[email protected]>
+2011-10-13 Marcus Brinkmann <[email protected]>
* configure.ac: Don't check for PTH but for NPTH.
(AH_BOTTOM): Remove PTH_SYSCALL_SOFT.
@@ -8,6 +8,10 @@
(USE_GNU_PTH): ... this.
* m4/gnupg-npth.m4: New file.
+2011-09-23 Werner Koch <[email protected]>
+
+ * configure.ac: Remove check for gcry_kdf_derive.
+
2011-08-10 Werner Koch <[email protected]>
* configure.ac: Fix new autoconf warnings.
diff --git a/common/ChangeLog b/common/ChangeLog
index 0e0e626f1..d1090e059 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -3,6 +3,49 @@
* estream.c, exechelp-posix.c, exechelp-w32.c, exechelp-w32ce.c,
http.c, init.c, sysutils.c: Port to NPth.
+2011-09-30 Werner Koch <[email protected]>
+
+ Change the license of all JNLIB parts from LPGLv3+ to to LGPLv3+
+ or GPLv2+.
+
+ * dotlock.h (DOTLOCK_EXT_SYM_PREFIX): New macro.
+
+2011-09-29 Werner Koch <[email protected]>
+
+ * dotlock.c (DOTLOCK_USE_PTHREAD): New macro.
+ [DOTLOCK_USE_PTHREAD] (all_lockfiles_mutex): New.
+ (LOCK_all_lockfiles, UNLOCK_all_lockfiles): New. Use them to
+ protect access to all_lockfiles.
+ (dotlock_set_fd, dotlock_get_fd): New.
+
+2011-09-28 Werner Koch <[email protected]>
+
+ * dotlock.c (dotlock_take, dotlock_take_unix, dotlock_take_w32):
+ Implement arbitrary timeout values.
+ (dotlock_create): Add arg FLAGS for future extensions.
+
+2011-09-27 Werner Koch <[email protected]>
+
+ * dotlock.c (dotlock_take_unix): Check only the link count and not
+ the error return from link.
+ (use_hardlinks_p): New.
+ (dotlock_create_unix): Test for hardlinks.
+ (dotlock_take_unix): Implement O_EXCL locking.
+
+2011-09-23 Werner Koch <[email protected]>
+
+ * dotlock.c: Factor Unix and W32 specific code out into specific
+ functions. Define HAVE_POSIX_SYSTEM. Rearrange some functions.
+ (disable_dotlock): Rename to dotlock_disable.
+ (create_dotlock): Rename to dotlock_create.
+ (destroy_dotlock): Rename to dotlock_destroy.
+ (make_dotlock): Rename to dotlock_take.
+ (release_dotlock): Rename to dotlock_release.
+
+2011-09-22 Werner Koch <[email protected]>
+
+ * dotlock.c: Remove support for RISCOS.
+
2011-08-10 Werner Koch <[email protected]>
* t-exechelp.c (test_close_all_fds): Don't use the DUMMY_FD var.
@@ -2399,7 +2442,7 @@
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
- 2009, 2010 Free Software Foundation, Inc.
+ 2009, 2010, 2011 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
diff --git a/common/argparse.c b/common/argparse.c
index 06aa7821d..f55456d41 100644
--- a/common/argparse.c
+++ b/common/argparse.c
@@ -2,20 +2,31 @@
* Copyright (C) 1998, 1999, 2000, 2001, 2006
* 2007, 2008 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
diff --git a/common/argparse.h b/common/argparse.h
index b2ed9eed8..dc9b07b42 100644
--- a/common/argparse.h
+++ b/common/argparse.h
@@ -1,20 +1,31 @@
/* argparse.h - Argument parser for option handling.
* Copyright (C) 1998,1999,2000,2001,2006 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_ARGPARSE_H
diff --git a/common/asshelp.c b/common/asshelp.c
index c5d5a3359..c5d8bdf84 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -287,14 +287,14 @@ lock_spawning (lock_spawn_t *lock, const char *homedir, const char *name,
if (!fname)
return gpg_error_from_syserror ();
- *lock = create_dotlock (fname);
+ *lock = dotlock_create (fname, 0);
xfree (fname);
if (!*lock)
return gpg_error_from_syserror ();
/* FIXME: We should use a timeout of 5000 here - however
make_dotlock does not yet support values other than -1 and 0. */
- if (make_dotlock (*lock, -1))
+ if (dotlock_take (*lock, -1))
return gpg_error_from_syserror ();
return 0;
@@ -315,7 +315,7 @@ unlock_spawning (lock_spawn_t *lock, const char *name)
CloseHandle (*lock);
#else /*!HAVE_W32_SYSTEM*/
(void)name;
- destroy_dotlock (*lock);
+ dotlock_destroy (*lock);
#endif /*!HAVE_W32_SYSTEM*/
*lock = NULL;
}
diff --git a/common/dotlock.c b/common/dotlock.c
index 507546562..353f2cf1c 100644
--- a/common/dotlock.c
+++ b/common/dotlock.c
@@ -1,34 +1,261 @@
/* dotlock.c - dotfile locking
* Copyright (C) 1998, 2000, 2001, 2003, 2004,
- * 2005, 2006, 2008, 2010 Free Software Foundation, Inc.
+ * 2005, 2006, 2008, 2010, 2011 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
-#include <config.h>
+/*
+ Overview:
+ =========
+
+ This module implements advisory file locking in a portable way.
+ Due to the problems with POSIX fcntl locking a separate lock file
+ is used. It would be possible to use fcntl locking on this lock
+ file and thus avoid the weird auto unlock bug of POSIX while still
+ having an unproved better performance of fcntl locking. However
+ there are still problems left, thus we resort to use a hardlink
+ which has the well defined property that a link call will fail if
+ the target file already exists.
+
+ Given that hardlinks are also available on NTFS file systems since
+ Windows XP; it will be possible to enhance this module to use
+ hardlinks even on Windows and thus allow Windows and Posix clients
+ to use locking on the same directory. This is not yet implemented;
+ instead we use a lockfile on Windows along with W32 style file
+ locking.
+
+ On FAT file systems hardlinks are not supported. Thus this method
+ does not work. Our solution is to use a O_EXCL locking instead.
+ Querying the type of the file system is not easy to do in a
+ portable way (e.g. Linux has a statfs, BSDs have a the same call
+ but using different structures and constants). What we do instead
+ is to check at runtime whether link(2) works for a specific lock
+ file.
+
+
+ How to use:
+ ===========
+
+ At program initialization time, the module should be explicitly
+ initialized:
+
+ dotlock_create (NULL, 0);
+
+ This installs an atexit handler and may also initialize mutex etc.
+ It is optional for non-threaded applications. Only the first call
+ has an effect. This needs to be done before any extra threads are
+ started.
+
+ To create a lock file (which prepares it but does not take the
+ lock) you do:
+
+ dotlock_t h
+
+ h = dotlock_create (fname, 0);
+ if (!h)
+ error ("error creating lock file: %s\n", strerror (errno));
+
+ It is important to handle the error. For example on a read-only
+ file system a lock can't be created (but is usually not needed).
+ FNAME is the file you want to lock; the actual lockfile is that
+ name with the suffix ".lock" appended. On success a handle to be
+ used with the other functions is returned or NULL on error. Note
+ that the handle shall only be used by one thread at a time. This
+ function creates a unique file temporary file (".#lk*") in the same
+ directory as FNAME and returns a handle for further operations.
+ The module keeps track of theses unique files so that they will be
+ unlinked using the atexit handler. If you don't need the lock file
+ anymore, you may also explicitly remove it with a call to:
+
+ dotlock_destroy (h);
+
+ To actually lock the file, you use:
+
+ if (dotlock_take (h, -1))
+ error ("error taking lock: %s\n", strerror (errno));
+
+ This function will wait until the lock is acquired. If an
+ unexpected error occurs if will return non-zero and set ERRNO. If
+ you pass (0) instead of (-1) the function does not wait in case the
+ file is already locked but returns -1 and sets ERRNO to EACCES.
+ Any other positive value for the second parameter is considered a
+ timeout valuie in milliseconds.
+
+ To release the lock you call:
+
+ if (dotlock_release (h))
+ error ("error releasing lock: %s\n", strerror (errno));
+
+ or, if the lock file is not anymore needed, you may just call
+ dotlock_destroy. However dotlock_release does some extra checks
+ before releasing the lock and prints diagnostics to help detecting
+ bugs.
+
+ If you want to explicitly destroy all lock files you may call
+
+ dotlock_remove_lockfiles ();
+
+ which is the core of the installed atexit handler. In case your
+ application wants to disable locking completely it may call
+
+ disable_locking ()
+
+ before any locks are created.
+
+ There are two convenience functions to store an integer (e.g. a
+ file descriptor) value with the handle:
+
+ void dotlock_set_fd (dotlock_t h, int fd);
+ int dotlock_get_fd (dotlock_t h);
+
+ If nothing has been stored dotlock_get_fd returns -1.
+
+
+
+ How to build:
+ =============
+
+ This module was originally developed for GnuPG but later changed to
+ allow its use without any GnuPG dependency. If you want to use it
+ with you application you may simply use it and it should figure out
+ most things automagically.
+
+ You may use the common config.h file to pass macros, but take care
+ to pass -DHAVE_CONFIG_H to the compiler. Macros used by this
+ module are:
+
+ DOTLOCK_USE_PTHREAD - Define if POSIX threads are in use.
+
+ DOTLOCK_GLIB_LOGGING - Define this to use Glib logging functions.
+
+ DOTLOCK_EXT_SYM_PREFIX - Prefix all external symbols with the
+ string to which this macro evaluates.
+
+ GNUPG_MAJOR_VERSION - Defined when used by GnuPG.
+
+ HAVE_DOSISH_SYSTEM - Defined for Windows etc. Will be
+ automatically defined if a the target is
+ Windows.
+
+ HAVE_POSIX_SYSTEM - Internally defined to !HAVE_DOSISH_SYSTEM.
+
+ HAVE_SIGNAL_H - Should be defined on Posix systems. If config.h
+ is not used defaults to defined.
+
+ DIRSEP_C - Separation character for file name parts.
+ Usually not redefined.
+
+ EXTSEP_S - Separation string for file name suffixes.
+ Usually not redefined.
+
+ HAVE_W32CE_SYSTEM - Currently only used by GnuPG.
+
+ Note that there is a test program t-dotlock which has compile
+ instructions at its end. At least for SMBFS and CIFS it is
+ important that 64 bit versions of stat are used; most programming
+ environments do this these days, just in case you want to compile
+ it on the command line, remember to pass -D_FILE_OFFSET_BITS=64
+
+
+ Bugs:
+ =====
+
+ On Windows this module is not yet thread-safe.
+
+
+ Miscellaneous notes:
+ ====================
+
+ On hardlinks:
+ - Hardlinks are supported under Windows with NTFS since XP/Server2003.
+ - In Linux 2.6.33 both SMBFS and CIFS seem to support hardlinks.
+ - NFS supports hard links. But there are solvable problems.
+ - FAT does not support links
+
+ On the file locking API:
+ - CIFS on Linux 2.6.33 supports several locking methods.
+ SMBFS seems not to support locking. No closer checks done.
+ - NFS supports Posix locks. flock is emulated in the server.
+ However there are a couple of problems; see below.
+ - FAT does not support locks.
+ - An advantage of fcntl locking is that R/W locks can be
+ implemented which is not easy with a straight lock file.
+
+ On O_EXCL:
+ - Does not work reliable on NFS
+ - Should work on CIFS and SMBFS but how can we delete lockfiles?
+
+ On NFS problems:
+ - Locks vanish if the server crashes and reboots.
+ - Client crashes keep the lock in the server until the client
+ re-connects.
+ - Communication problems may return unreliable error codes. The
+ MUA Postfix's workaround is to compare the link count after
+ seeing an error for link. However that gives a race. If using a
+ unique file to link to a lockfile and using stat to check the
+ link count instead of looking at the error return of link(2) is
+ the best solution.
+ - O_EXCL seems to have a race and may re-create a file anyway.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Some quick replacements for stuff we usually expect to be defined
+ in config.h. Define HAVE_POSIX_SYSTEM for better readability. */
+#if !defined (HAVE_DOSISH_SYSTEM) && defined(_WIN32)
+# define HAVE_DOSISH_SYSTEM 1
+#endif
+#if !defined (HAVE_DOSISH_SYSTEM) && !defined (HAVE_POSIX_SYSTEM)
+# define HAVE_POSIX_SYSTEM 1
+#endif
+
+/* With no config.h assume that we have sitgnal.h. */
+#if !defined (HAVE_CONFIG_H) && defined (HAVE_POSIX_SYSTEM)
+# define HAVE_SIGNAL_H 1
+#endif
+
+/* Standard headers. */
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#ifdef HAVE_DOSISH_SYSTEM
-# define WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN /* We only need the OS core stuff. */
# include <windows.h>
#else
+# include <sys/types.h>
+# include <sys/stat.h>
# include <sys/utsname.h>
#endif
#include <sys/types.h>
@@ -38,58 +265,138 @@
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#endif
+#ifdef DOTLOCK_USE_PTHREAD
+# include <pthread.h>
+#endif
+
+#ifdef DOTLOCK_GLIB_LOGGING
+# include <glib.h>
+#endif
+
+#ifdef GNUPG_MAJOR_VERSION
+# include "libjnlib-config.h"
+#endif
+#ifdef HAVE_W32CE_SYSTEM
+# include "utf8conv.h" /* WindowsCE requires filename conversion. */
+#endif
-#include "libjnlib-config.h"
-#include "stringhelp.h"
#include "dotlock.h"
-#include "utf8conv.h"
-#if !defined(DIRSEP_C) && !defined(EXTSEP_C) \
- && !defined(DIRSEP_S) && !defined(EXTSEP_S)
-#ifdef HAVE_DOSISH_SYSTEM
-#define DIRSEP_C '\\'
-#define EXTSEP_C '.'
-#define DIRSEP_S "\\"
-#define EXTSEP_S "."
+
+/* Define constants for file name construction. */
+#if !defined(DIRSEP_C) && !defined(EXTSEP_S)
+# ifdef HAVE_DOSISH_SYSTEM
+# define DIRSEP_C '\\'
+# define EXTSEP_S "."
#else
-#define DIRSEP_C '/'
-#define EXTSEP_C '.'
-#define DIRSEP_S "/"
-#define EXTSEP_S "."
+# define DIRSEP_C '/'
+# define EXTSEP_S "."
+# endif
#endif
+
+/* In GnuPG we use wrappers around the malloc fucntions. If they are
+ not defined we assume that this code is used outside of GnuPG and
+ fall back to the regular malloc functions. */
+#ifndef jnlib_malloc
+# define jnlib_malloc(a) malloc ((a))
+# define jnlib_calloc(a,b) calloc ((a), (b))
+# define jnlib_free(a) free ((a))
#endif
+/* Wrapper to set ERRNO. */
+#ifndef jnlib_set_errno
+# ifdef HAVE_W32CE_SYSTEM
+# define jnlib_set_errno(e) gpg_err_set_errno ((e))
+# else
+# define jnlib_set_errno(e) do { errno = (e); } while (0)
+# endif
+#endif
+
+/* Gettext macro replacement. */
+#ifndef _
+# define _(a) (a)
+#endif
+
+#ifdef GNUPG_MAJOR_VERSION
+# define my_info_0(a) log_info ((a))
+# define my_info_1(a,b) log_info ((a), (b))
+# define my_info_2(a,b,c) log_info ((a), (b), (c))
+# define my_info_3(a,b,c,d) log_info ((a), (b), (c), (d))
+# define my_error_0(a) log_error ((a))
+# define my_error_1(a,b) log_error ((a), (b))
+# define my_error_2(a,b,c) log_error ((a), (b), (c))
+# define my_debug_1(a,b) log_debug ((a), (b))
+# define my_fatal_0(a) log_fatal ((a))
+#elif defined (DOTLOCK_GLIB_LOGGING)
+# define my_info_0(a) g_message ((a))
+# define my_info_1(a,b) g_message ((a), (b))
+# define my_info_2(a,b,c) g_message ((a), (b), (c))
+# define my_info_3(a,b,c,d) g_message ((a), (b), (c), (d))
+# define my_error_0(a) g_warning ((a))
+# define my_error_1(a,b) g_warning ((a), (b))
+# define my_error_2(a,b,c) g_warning ((a), (b), (c))
+# define my_debug_1(a,b) g_debug ((a), (b))
+# define my_fatal_0(a) g_error ((a))
+#else
+# define my_info_0(a) fprintf (stderr, (a))
+# define my_info_1(a,b) fprintf (stderr, (a), (b))
+# define my_info_2(a,b,c) fprintf (stderr, (a), (b), (c))
+# define my_info_3(a,b,c,d) fprintf (stderr, (a), (b), (c), (d))
+# define my_error_0(a) fprintf (stderr, (a))
+# define my_error_1(a,b) fprintf (stderr, (a), (b))
+# define my_error_2(a,b,c) fprintf (stderr, (a), (b), (c))
+# define my_debug_1(a,b) fprintf (stderr, (a), (b))
+# define my_fatal_0(a) do { fprintf (stderr,(a)); fflush (stderr); \
+ abort (); } while (0)
+#endif
+
+
+
+
/* The object describing a lock. */
struct dotlock_handle
{
struct dotlock_handle *next;
- char *lockname; /* Name of the actual lockfile. */
- int locked; /* Lock status. */
- int disable; /* If true, locking is disabled. */
+ char *lockname; /* Name of the actual lockfile. */
+ unsigned int locked:1; /* Lock status. */
+ unsigned int disable:1; /* If true, locking is disabled. */
+ unsigned int use_o_excl:1; /* Use open (O_EXCL) for locking. */
+
+ int extra_fd; /* A place for the caller to store an FD. */
#ifdef HAVE_DOSISH_SYSTEM
HANDLE lockhd; /* The W32 handle of the lock file. */
-#else
+#else /*!HAVE_DOSISH_SYSTEM */
char *tname; /* Name of the lockfile template. */
size_t nodename_off; /* Offset in TNAME of the nodename part. */
size_t nodename_len; /* Length of the nodename part. */
-#endif /* HAVE_DOSISH_SYSTEM */
+#endif /*!HAVE_DOSISH_SYSTEM */
};
-/* A list of of all lock handles. */
+/* A list of of all lock handles. The volatile attribute might help
+ if used in an atexit handler. */
static volatile dotlock_t all_lockfiles;
+#ifdef DOTLOCK_USE_PTHREAD
+static pthread_mutex_t all_lockfiles_mutex = PTHREAD_MUTEX_INITIALIZER;
+# define LOCK_all_lockfiles() do { \
+ if (pthread_mutex_lock (&all_lockfiles_mutex)) \
+ my_fatal_0 ("locking all_lockfiles_mutex failed\n"); \
+ } while (0)
+# define UNLOCK_all_lockfiles() do { \
+ if (pthread_mutex_unlock (&all_lockfiles_mutex)) \
+ my_fatal_0 ("unlocking all_lockfiles_mutex failed\n"); \
+ } while (0)
+#else /*!DOTLOCK_USE_PTHREAD*/
+# define LOCK_all_lockfiles() do { } while (0)
+# define UNLOCK_all_lockfiles() do { } while (0)
+#endif /*!DOTLOCK_USE_PTHREAD*/
/* If this has the value true all locking is disabled. */
static int never_lock;
-/* Local protototypes. */
-#ifndef HAVE_DOSISH_SYSTEM
-static int read_lockfile (dotlock_t h, int *same_node);
-#endif /*!HAVE_DOSISH_SYSTEM*/
-
@@ -97,75 +404,179 @@ static int read_lockfile (dotlock_t h, int *same_node);
before any locking is done. It may be called right at startup of
the process as it only sets a global value. */
void
-disable_dotlock(void)
+dotlock_disable (void)
{
never_lock = 1;
}
+#ifdef HAVE_POSIX_SYSTEM
+static int
+maybe_deadlock (dotlock_t h)
+{
+ dotlock_t r;
+ int res = 0;
-/* Create a lockfile for a file name FILE_TO_LOCK and returns an
- object of type dotlock_t which may be used later to actually acquire
- the lock. A cleanup routine gets installed to cleanup left over
- locks or other files used internally by the lock mechanism.
-
- Calling this function with NULL does only install the atexit
- handler and may thus be used to assure that the cleanup is called
- after all other atexit handlers.
+ LOCK_all_lockfiles ();
+ for (r=all_lockfiles; r; r = r->next)
+ {
+ if ( r != h && r->locked )
+ {
+ res = 1;
+ break;
+ }
+ }
+ UNLOCK_all_lockfiles ();
+ return res;
+}
+#endif /*HAVE_POSIX_SYSTEM*/
- This function creates a lock file in the same directory as
- FILE_TO_LOCK using that name and a suffix of ".lock". Note that on
- POSIX systems a temporary file ".#lk.<hostname>.pid[.threadid] is
- used.
- The function returns an new handle which needs to be released using
- destroy_dotlock but gets also released at the termination of the
- process. On error NULL is returned.
- */
-dotlock_t
-create_dotlock (const char *file_to_lock)
+/* Read the lock file and return the pid, returns -1 on error. True
+ will be stored in the integer at address SAME_NODE if the lock file
+ has been created on the same node. */
+#ifdef HAVE_POSIX_SYSTEM
+static int
+read_lockfile (dotlock_t h, int *same_node )
{
- static int initialized;
- dotlock_t h;
-#ifndef HAVE_DOSISH_SYSTEM
- int fd = -1;
- char pidstr[16];
- const char *nodename;
- const char *dirpart;
- int dirpartlen;
- struct utsname utsbuf;
- size_t tnamelen;
-#endif
+ char buffer_space[10+1+70+1]; /* 70 is just an estimated value; node
+ names are usually shorter. */
+ int fd;
+ int pid = -1;
+ char *buffer, *p;
+ size_t expected_len;
+ int res, nread;
- if ( !initialized )
+ *same_node = 0;
+ expected_len = 10 + 1 + h->nodename_len + 1;
+ if ( expected_len >= sizeof buffer_space)
{
- atexit (dotlock_remove_lockfiles);
- initialized = 1;
+ buffer = jnlib_malloc (expected_len);
+ if (!buffer)
+ return -1;
}
+ else
+ buffer = buffer_space;
- if ( !file_to_lock )
- return NULL; /* Only initialization was requested. */
+ if ( (fd = open (h->lockname, O_RDONLY)) == -1 )
+ {
+ int e = errno;
+ my_info_2 ("error opening lockfile `%s': %s\n",
+ h->lockname, strerror(errno) );
+ if (buffer != buffer_space)
+ jnlib_free (buffer);
+ jnlib_set_errno (e); /* Need to return ERRNO here. */
+ return -1;
+ }
- h = jnlib_calloc (1, sizeof *h);
- if (!h)
- return NULL;
+ p = buffer;
+ nread = 0;
+ do
+ {
+ res = read (fd, p, expected_len - nread);
+ if (res == -1 && errno == EINTR)
+ continue;
+ if (res < 0)
+ {
+ my_info_1 ("error reading lockfile `%s'\n", h->lockname );
+ close (fd);
+ if (buffer != buffer_space)
+ jnlib_free (buffer);
+ jnlib_set_errno (0); /* Do not return an inappropriate ERRNO. */
+ return -1;
+ }
+ p += res;
+ nread += res;
+ }
+ while (res && nread != expected_len);
+ close(fd);
- if (never_lock)
+ if (nread < 11)
{
- h->disable = 1;
-#ifdef _REENTRANT
- /* fixme: aquire mutex on all_lockfiles */
-#endif
- h->next = all_lockfiles;
- all_lockfiles = h;
- return h;
+ my_info_1 ("invalid size of lockfile `%s'\n", h->lockname);
+ if (buffer != buffer_space)
+ jnlib_free (buffer);
+ jnlib_set_errno (0); /* Better don't return an inappropriate ERRNO. */
+ return -1;
}
-#ifndef HAVE_DOSISH_SYSTEM
- /*
- This is the POSIX version which uses a temporary file and the
- link system call to make locking an atomic operation.
- */
+ if (buffer[10] != '\n'
+ || (buffer[10] = 0, pid = atoi (buffer)) == -1
+ || !pid )
+ {
+ my_error_2 ("invalid pid %d in lockfile `%s'\n", pid, h->lockname);
+ if (buffer != buffer_space)
+ jnlib_free (buffer);
+ jnlib_set_errno (0);
+ return -1;
+ }
+
+ if (nread == expected_len
+ && !memcmp (h->tname+h->nodename_off, buffer+11, h->nodename_len)
+ && buffer[11+h->nodename_len] == '\n')
+ *same_node = 1;
+
+ if (buffer != buffer_space)
+ jnlib_free (buffer);
+ return pid;
+}
+#endif /*HAVE_POSIX_SYSTEM */
+
+
+/* Check whether the file system which stores TNAME supports
+ hardlinks. Instead of using the non-portable statsfs call which
+ differs between various Unix versions, we do a runtime test.
+ Returns: 0 supports hardlinks; 1 no hardlink support, -1 unknown
+ (test error). */
+#ifdef HAVE_POSIX_SYSTEM
+static int
+use_hardlinks_p (const char *tname)
+{
+ char *lname;
+ struct stat sb;
+ unsigned int nlink;
+ int res;
+
+ if (stat (tname, &sb))
+ return -1;
+ nlink = (unsigned int)sb.st_nlink;
+
+ lname = jnlib_malloc (strlen (tname) + 1 + 1);
+ if (!lname)
+ return -1;
+ strcpy (lname, tname);
+ strcat (lname, "x");
+
+ link (tname, lname);
+
+ if (stat (tname, &sb))
+ res = -1; /* Ooops. */
+ else if (sb.st_nlink == nlink + 1)
+ res = 0; /* Yeah, hardlinks are supported. */
+ else
+ res = 1; /* No hardlink support. */
+
+ unlink (lname);
+ jnlib_free (lname);
+ return res;
+}
+#endif /*HAVE_POSIX_SYSTEM */
+
+
+
+#ifdef HAVE_POSIX_SYSTEM
+/* Locking core for Unix. It used a temporary file and the link
+ system call to make locking an atomic operation. */
+static dotlock_t
+dotlock_create_unix (dotlock_t h, const char *file_to_lock)
+{
+ int fd = -1;
+ char pidstr[16];
+ const char *nodename;
+ const char *dirpart;
+ int dirpartlen;
+ struct utsname utsbuf;
+ size_t tnamelen;
snprintf (pidstr, sizeof pidstr, "%10d\n", (int)getpid() );
@@ -175,15 +586,6 @@ create_dotlock (const char *file_to_lock)
else
nodename = utsbuf.nodename;
-#ifdef __riscos__
- {
- char *iter = (char *) nodename;
- for (; iter[0]; iter++)
- if (iter[0] == '.')
- iter[0] = '/';
- }
-#endif /* __riscos__ */
-
if ( !(dirpart = strrchr (file_to_lock, DIRSEP_C)) )
{
dirpart = EXTSEP_S;
@@ -195,33 +597,25 @@ create_dotlock (const char *file_to_lock)
dirpart = file_to_lock;
}
-#ifdef _REENTRANT
- /* fixme: aquire mutex on all_lockfiles */
-#endif
+ LOCK_all_lockfiles ();
h->next = all_lockfiles;
all_lockfiles = h;
- tnamelen = dirpartlen + 6 + 30 + strlen(nodename) + 10;
+ tnamelen = dirpartlen + 6 + 30 + strlen(nodename) + 10 + 1;
h->tname = jnlib_malloc (tnamelen + 1);
if (!h->tname)
{
all_lockfiles = h->next;
+ UNLOCK_all_lockfiles ();
jnlib_free (h);
return NULL;
}
h->nodename_len = strlen (nodename);
-#ifndef __riscos__
snprintf (h->tname, tnamelen, "%.*s/.#lk%p.", dirpartlen, dirpart, h );
h->nodename_off = strlen (h->tname);
snprintf (h->tname+h->nodename_off, tnamelen - h->nodename_off,
"%s.%d", nodename, (int)getpid ());
-#else /* __riscos__ */
- snprintf (h->tname, tnamelen, "%.*s.lk%p/", dirpartlen, dirpart, h );
- h->nodename_off = strlen (h->tname);
- snprintf (h->tname+h->nodename_off, tnamelen - h->modename_off,
- "%s/%d", nodename, (int)getpid () );
-#endif /* __riscos__ */
do
{
@@ -234,7 +628,8 @@ create_dotlock (const char *file_to_lock)
if ( fd == -1 )
{
all_lockfiles = h->next;
- log_error (_("failed to create temporary file `%s': %s\n"),
+ UNLOCK_all_lockfiles ();
+ my_error_2 (_("failed to create temporary file `%s': %s\n"),
h->tname, strerror(errno));
jnlib_free (h->tname);
jnlib_free (h);
@@ -249,40 +644,61 @@ create_dotlock (const char *file_to_lock)
if ( close (fd) )
goto write_failed;
-# ifdef _REENTRANT
- /* release mutex */
-# endif
- h->lockname = jnlib_malloc ( strlen (file_to_lock) + 6 );
+ /* Check whether we support hard links. */
+ switch (use_hardlinks_p (h->tname))
+ {
+ case 0: /* Yes. */
+ break;
+ case 1: /* No. */
+ unlink (h->tname);
+ h->use_o_excl = 1;
+ break;
+ default:
+ my_error_2 ("can't check whether hardlinks are supported for `%s': %s\n",
+ h->tname, strerror(errno));
+ goto write_failed;
+ }
+
+ h->lockname = jnlib_malloc (strlen (file_to_lock) + 6 );
if (!h->lockname)
{
all_lockfiles = h->next;
+ UNLOCK_all_lockfiles ();
unlink (h->tname);
jnlib_free (h->tname);
jnlib_free (h);
return NULL;
}
strcpy (stpcpy (h->lockname, file_to_lock), EXTSEP_S "lock");
+ UNLOCK_all_lockfiles ();
+ if (h->use_o_excl)
+ my_debug_1 ("locking for `%s' done via O_EXCL\n", h->lockname);
+
return h;
write_failed:
all_lockfiles = h->next;
-# ifdef _REENTRANT
- /* fixme: release mutex */
-# endif
- log_error ( _("error writing to `%s': %s\n"), h->tname, strerror(errno) );
+ UNLOCK_all_lockfiles ();
+ my_error_2 (_("error writing to `%s': %s\n"), h->tname, strerror (errno));
close (fd);
unlink (h->tname);
jnlib_free (h->tname);
jnlib_free (h);
return NULL;
+}
+#endif /*HAVE_POSIX_SYSTEM*/
-#else /* HAVE_DOSISH_SYSTEM */
- /* The Windows version does not need a temporary file but uses the
- plain lock file along with record locking. We create this file
- here so that we later do only need to do the file locking. For
- error reporting it is useful to keep the name of the file in the
- handle. */
+#ifdef HAVE_DOSISH_SYSTEM
+/* Locking core for Windows. This version does not need a temporary
+ file but uses the plain lock file along with record locking. We
+ create this file here so that we later only need to do the file
+ locking. For error reporting it is useful to keep the name of the
+ file in the handle. */
+static dotlock_t
+dotlock_create_w32 (dotlock_t h, const char *file_to_lock)
+{
+ LOCK_all_lockfiles ();
h->next = all_lockfiles;
all_lockfiles = h;
@@ -290,6 +706,7 @@ create_dotlock (const char *file_to_lock)
if (!h->lockname)
{
all_lockfiles = h->next;
+ UNLOCK_all_lockfiles ();
jnlib_free (h);
return NULL;
}
@@ -301,43 +718,159 @@ create_dotlock (const char *file_to_lock)
error and we can't reliable create/open the lock file unless we
would wait here until it works - however there are other valid
reasons why a lock file can't be created and thus the process
- would not stop as expected but spin til until Windows crashes.
- Our solution is to keep the lock file open; that does not
- harm. */
+ would not stop as expected but spin until Windows crashes. Our
+ solution is to keep the lock file open; that does not harm. */
{
#ifdef HAVE_W32CE_SYSTEM
wchar_t *wname = utf8_to_wchar (h->lockname);
- h->lockhd = INVALID_HANDLE_VALUE;
if (wname)
h->lockhd = CreateFile (wname,
+ GENERIC_READ|GENERIC_WRITE,
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ NULL, OPEN_ALWAYS, 0, NULL);
+ else
+ h->lockhd = INVALID_HANDLE_VALUE;
+ jnlib_free (wname);
#else
h->lockhd = CreateFile (h->lockname,
-#endif
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_ALWAYS, 0, NULL);
-#ifdef HAVE_W32CE_SYSTEM
- jnlib_free (wname);
#endif
}
if (h->lockhd == INVALID_HANDLE_VALUE)
{
- log_error (_("can't create `%s': %s\n"), h->lockname, w32_strerror (-1));
all_lockfiles = h->next;
+ UNLOCK_all_lockfiles ();
+ my_error_2 (_("can't create `%s': %s\n"), h->lockname, w32_strerror (-1));
jnlib_free (h->lockname);
jnlib_free (h);
return NULL;
}
return h;
+}
+#endif /*HAVE_DOSISH_SYSTEM*/
-#endif /* HAVE_DOSISH_SYSTEM */
+
+/* Create a lockfile for a file name FILE_TO_LOCK and returns an
+ object of type dotlock_t which may be used later to actually acquire
+ the lock. A cleanup routine gets installed to cleanup left over
+ locks or other files used internally by the lock mechanism.
+
+ Calling this function with NULL does only install the atexit
+ handler and may thus be used to assure that the cleanup is called
+ after all other atexit handlers.
+
+ This function creates a lock file in the same directory as
+ FILE_TO_LOCK using that name and a suffix of ".lock". Note that on
+ POSIX systems a temporary file ".#lk.<hostname>.pid[.threadid] is
+ used.
+
+ FLAGS must be 0.
+
+ The function returns an new handle which needs to be released using
+ destroy_dotlock but gets also released at the termination of the
+ process. On error NULL is returned.
+ */
+
+dotlock_t
+dotlock_create (const char *file_to_lock, unsigned int flags)
+{
+ static int initialized;
+ dotlock_t h;
+
+ if ( !initialized )
+ {
+ atexit (dotlock_remove_lockfiles);
+ initialized = 1;
+ }
+
+ if ( !file_to_lock )
+ return NULL; /* Only initialization was requested. */
+
+ if (flags)
+ {
+ jnlib_set_errno (EINVAL);
+ return NULL;
+ }
+
+ h = jnlib_calloc (1, sizeof *h);
+ if (!h)
+ return NULL;
+ h->extra_fd = -1;
+
+ if (never_lock)
+ {
+ h->disable = 1;
+ LOCK_all_lockfiles ();
+ h->next = all_lockfiles;
+ all_lockfiles = h;
+ UNLOCK_all_lockfiles ();
+ return h;
+ }
+
+#ifdef HAVE_DOSISH_SYSTEM
+ return dotlock_create_w32 (h, file_to_lock);
+#else /*!HAVE_DOSISH_SYSTEM */
+ return dotlock_create_unix (h, file_to_lock);
+#endif /*!HAVE_DOSISH_SYSTEM*/
}
-/* Destroy the local handle H and release the lock. */
+
+/* Convenience function to store a file descriptor (or any any other
+ integer value) in the context of handle H. */
+void
+dotlock_set_fd (dotlock_t h, int fd)
+{
+ h->extra_fd = fd;
+}
+
+/* Convenience function to retrieve a file descriptor (or any any other
+ integer value) stored in the context of handle H. */
+int
+dotlock_get_fd (dotlock_t h)
+{
+ return h->extra_fd;
+}
+
+
+
+#ifdef HAVE_POSIX_SYSTEM
+/* Unix specific code of destroy_dotlock. */
+static void
+dotlock_destroy_unix (dotlock_t h)
+{
+ if (h->locked && h->lockname)
+ unlink (h->lockname);
+ if (h->tname && !h->use_o_excl)
+ unlink (h->tname);
+ jnlib_free (h->tname);
+}
+#endif /*HAVE_POSIX_SYSTEM*/
+
+
+#ifdef HAVE_DOSISH_SYSTEM
+/* Windows specific code of destroy_dotlock. */
+static void
+dotlock_destroy_w32 (dotlock_t h)
+{
+ if (h->locked)
+ {
+ OVERLAPPED ovl;
+
+ memset (&ovl, 0, sizeof ovl);
+ UnlockFileEx (h->lockhd, 0, 1, 0, &ovl);
+ }
+ CloseHandle (h->lockhd);
+}
+#endif /*HAVE_DOSISH_SYSTEM*/
+
+
+/* Destroy the locck handle H and release the lock. */
void
-destroy_dotlock (dotlock_t h)
+dotlock_destroy (dotlock_t h)
{
dotlock_t hprev, htmp;
@@ -345,6 +878,7 @@ destroy_dotlock (dotlock_t h)
return;
/* First remove the handle from our global list of all locks. */
+ LOCK_all_lockfiles ();
for (hprev=NULL, htmp=all_lockfiles; htmp; hprev=htmp, htmp=htmp->next)
if (htmp == h)
{
@@ -355,25 +889,15 @@ destroy_dotlock (dotlock_t h)
h->next = NULL;
break;
}
+ UNLOCK_all_lockfiles ();
/* Then destroy the lock. */
if (!h->disable)
{
#ifdef HAVE_DOSISH_SYSTEM
- if (h->locked)
- {
- OVERLAPPED ovl;
-
- memset (&ovl, 0, sizeof ovl);
- UnlockFileEx (h->lockhd, 0, 1, 0, &ovl);
- }
- CloseHandle (h->lockhd);
+ dotlock_destroy_w32 (h);
#else /* !HAVE_DOSISH_SYSTEM */
- if (h->locked && h->lockname)
- unlink (h->lockname);
- if (h->tname)
- unlink (h->tname);
- jnlib_free (h->tname);
+ dotlock_destroy_unix (h);
#endif /* HAVE_DOSISH_SYSTEM */
jnlib_free (h->lockname);
}
@@ -381,330 +905,342 @@ destroy_dotlock (dotlock_t h)
}
-#ifndef HAVE_DOSISH_SYSTEM
+
+#ifdef HAVE_POSIX_SYSTEM
+/* Unix specific code of make_dotlock. Returns 0 on success and -1 on
+ error. */
static int
-maybe_deadlock (dotlock_t h)
+dotlock_take_unix (dotlock_t h, long timeout)
{
- dotlock_t r;
-
- for ( r=all_lockfiles; r; r = r->next )
- {
- if ( r != h && r->locked )
- return 1;
- }
- return 0;
-}
-#endif /*!HAVE_DOSISH_SYSTEM*/
-
-
-
-/* Do a lock on H. A TIMEOUT of 0 returns immediately, -1 waits
- forever (hopefully not), other values are reserved (should then be
- timeouts in milliseconds). Returns: 0 on success */
-int
-make_dotlock (dotlock_t h, long timeout)
-{
- int backoff = 0;
-#ifndef HAVE_DOSISH_SYSTEM
- int pid;
+ int wtime = 0;
+ int sumtime = 0;
+ int pid;
+ int lastpid = -1;
+ int ownerchanged;
const char *maybe_dead="";
int same_node;
-#endif /*!HAVE_DOSISH_SYSTEM*/
- if ( h->disable )
- return 0; /* Locks are completely disabled. Return success. */
-
- if ( h->locked )
+ again:
+ if (h->use_o_excl)
{
-#ifndef __riscos__
- log_debug ("Oops, `%s' is already locked\n", h->lockname);
-#endif /* !__riscos__ */
- return 0;
- }
+ /* No hardlink support - use open(O_EXCL). */
+ int fd;
- for (;;)
- {
-#ifndef HAVE_DOSISH_SYSTEM
-# ifndef __riscos__
- if ( !link(h->tname, h->lockname) )
+ do
{
- /* fixme: better use stat to check the link count */
- h->locked = 1;
- return 0; /* okay */
- }
- if ( errno != EEXIST )
+ jnlib_set_errno (0);
+ fd = open (h->lockname, O_WRONLY|O_CREAT|O_EXCL,
+ S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR );
+ }
+ while (fd == -1 && errno == EINTR);
+
+ if (fd == -1 && errno == EEXIST)
+ ; /* Lock held by another process. */
+ else if (fd == -1)
{
- log_error ( "lock not made: link() failed: %s\n", strerror(errno) );
+ my_error_2 ("lock not made: open(O_EXCL) of `%s' failed: %s\n",
+ h->lockname, strerror (errno));
return -1;
- }
-# else /* __riscos__ */
- if ( !renamefile(h->tname, h->lockname) )
- {
- h->locked = 1;
- return 0; /* okay */
}
- if ( errno != EEXIST )
+ else
{
- log_error( "lock not made: rename() failed: %s\n", strerror(errno) );
+ char pidstr[16];
+
+ snprintf (pidstr, sizeof pidstr, "%10d\n", (int)getpid());
+ if (write (fd, pidstr, 11 ) == 11
+ && write (fd, h->tname + h->nodename_off,h->nodename_len)
+ == h->nodename_len
+ && write (fd, "\n", 1) == 1
+ && !close (fd))
+ {
+ h->locked = 1;
+ return 0;
+ }
+ /* Write error. */
+ my_error_2 ("lock not made: writing to `%s' failed: %s\n",
+ h->lockname, strerror (errno));
+ close (fd);
+ unlink (h->lockname);
return -1;
}
-# endif /* __riscos__ */
+ }
+ else /* Standard method: Use hardlinks. */
+ {
+ struct stat sb;
+
+ link (h->tname, h->lockname);
- if ( (pid = read_lockfile (h, &same_node)) == -1 )
+ if (stat (h->tname, &sb))
{
- if ( errno != ENOENT )
- {
- log_info ("cannot read lockfile\n");
- return -1;
- }
- log_info( "lockfile disappeared\n");
- continue;
- }
- else if ( pid == getpid() && same_node )
+ my_error_1 ("lock not made: Oops: stat of tmp file failed: %s\n",
+ strerror (errno));
+ /* In theory this might be a severe error: It is possible
+ that link succeeded but stat failed due to changed
+ permissions. We can't do anything about it, though. */
+ return -1;
+ }
+
+ if (sb.st_nlink == 2)
{
- log_info( "Oops: lock already held by us\n");
h->locked = 1;
- return 0; /* okay */
- }
- else if ( same_node && kill (pid, 0) && errno == ESRCH )
- {
-# ifndef __riscos__
- log_info (_("removing stale lockfile (created by %d)\n"), pid );
- unlink (h->lockname);
- continue;
-# else /* __riscos__ */
- /* Under RISCOS we are *pretty* sure that the other task
- is dead and therefore we remove the stale lock file. */
- maybe_dead = _(" - probably dead - removing lock");
- unlink(h->lockname);
-# endif /* __riscos__ */
- }
-
- if ( timeout == -1 )
- {
- /* Wait until lock has been released. */
- struct timeval tv;
-
- log_info (_("waiting for lock (held by %d%s) %s...\n"),
- pid, maybe_dead, maybe_deadlock(h)? _("(deadlock?) "):"");
+ return 0; /* Okay. */
+ }
+ }
+ /* Check for stale lock files. */
+ if ( (pid = read_lockfile (h, &same_node)) == -1 )
+ {
+ if ( errno != ENOENT )
+ {
+ my_info_0 ("cannot read lockfile\n");
+ return -1;
+ }
+ my_info_0 ("lockfile disappeared\n");
+ goto again;
+ }
+ else if ( pid == getpid() && same_node )
+ {
+ my_info_0 ("Oops: lock already held by us\n");
+ h->locked = 1;
+ return 0; /* okay */
+ }
+ else if ( same_node && kill (pid, 0) && errno == ESRCH )
+ {
+ /* Note: It is unlikley that we get a race here unless a pid is
+ reused too fast or a new process with the same pid as the one
+ of the stale file tries to lock right at the same time as we. */
+ my_info_1 (_("removing stale lockfile (created by %d)\n"), pid);
+ unlink (h->lockname);
+ goto again;
+ }
- /* We can't use sleep, cause signals may be blocked. */
- tv.tv_sec = 1 + backoff;
- tv.tv_usec = 0;
- select(0, NULL, NULL, NULL, &tv);
- if ( backoff < 10 )
- backoff++ ;
- }
- else
- return -1;
-#else /*HAVE_DOSISH_SYSTEM*/
- int w32err;
- OVERLAPPED ovl;
+ if (lastpid == -1)
+ lastpid = pid;
+ ownerchanged = (pid != lastpid);
- /* Lock one byte at offset 0. The offset is given by OVL. */
- memset (&ovl, 0, sizeof ovl);
- if (LockFileEx (h->lockhd, (LOCKFILE_EXCLUSIVE_LOCK
- | LOCKFILE_FAIL_IMMEDIATELY), 0, 1, 0, &ovl))
+ if (timeout)
+ {
+ struct timeval tv;
+
+ /* Wait until lock has been released. We use increasing retry
+ intervals of 50ms, 100ms, 200ms, 400ms, 800ms, 2s, 4s and 8s
+ but reset it if the lock owner meanwhile changed. */
+ if (!wtime || ownerchanged)
+ wtime = 50;
+ else if (wtime < 800)
+ wtime *= 2;
+ else if (wtime == 800)
+ wtime = 2000;
+ else if (wtime < 8000)
+ wtime *= 2;
+
+ if (timeout > 0)
{
- h->locked = 1;
- return 0; /* okay */
+ if (wtime > timeout)
+ wtime = timeout;
+ timeout -= wtime;
}
- w32err = GetLastError ();
- if (w32err != ERROR_LOCK_VIOLATION)
+
+ sumtime += wtime;
+ if (sumtime >= 1500)
{
- log_error (_("lock `%s' not made: %s\n"),
- h->lockname, w32_strerror (w32err));
- return -1;
+ sumtime = 0;
+ my_info_3 (_("waiting for lock (held by %d%s) %s...\n"),
+ pid, maybe_dead, maybe_deadlock(h)? _("(deadlock?) "):"");
}
- if ( timeout == -1 )
+
+ tv.tv_sec = wtime / 1000;
+ tv.tv_usec = (wtime % 1000) * 1000;
+ select (0, NULL, NULL, NULL, &tv);
+ goto again;
+ }
+
+ jnlib_set_errno (EACCES);
+ return -1;
+}
+#endif /*HAVE_POSIX_SYSTEM*/
+
+
+#ifdef HAVE_DOSISH_SYSTEM
+/* Windows specific code of make_dotlock. Returns 0 on success and -1 on
+ error. */
+static int
+dotlock_take_w32 (dotlock_t h, long timeout)
+{
+ int wtime = 0;
+ int w32err;
+ OVERLAPPED ovl;
+
+ again:
+ /* Lock one byte at offset 0. The offset is given by OVL. */
+ memset (&ovl, 0, sizeof ovl);
+ if (LockFileEx (h->lockhd, (LOCKFILE_EXCLUSIVE_LOCK
+ | LOCKFILE_FAIL_IMMEDIATELY), 0, 1, 0, &ovl))
+ {
+ h->locked = 1;
+ return 0; /* okay */
+ }
+
+ w32err = GetLastError ();
+ if (w32err != ERROR_LOCK_VIOLATION)
+ {
+ my_error_2 (_("lock `%s' not made: %s\n"),
+ h->lockname, w32_strerror (w32err));
+ return -1;
+ }
+
+ if (timeout)
+ {
+ /* Wait until lock has been released. We use retry intervals of
+ 50ms, 100ms, 200ms, 400ms, 800ms, 2s, 4s and 8s. */
+ if (!wtime)
+ wtime = 50;
+ else if (wtime < 800)
+ wtime *= 2;
+ else if (wtime == 800)
+ wtime = 2000;
+ else if (wtime < 8000)
+ wtime *= 2;
+
+ if (timeout > 0)
{
- /* Wait until lock has been released. */
- log_info (_("waiting for lock %s...\n"), h->lockname);
- Sleep ((1 + backoff)*1000);
- if ( backoff < 10 )
- backoff++ ;
- }
- else
- return -1;
-#endif /*HAVE_DOSISH_SYSTEM*/
+ if (wtime > timeout)
+ wtime = timeout;
+ timeout -= wtime;
+ }
+
+ if (wtime >= 800)
+ my_info_1 (_("waiting for lock %s...\n"), h->lockname);
+
+ Sleep (wtime);
+ goto again;
}
- /*NOTREACHED*/
+
+ return -1;
}
+#endif /*HAVE_DOSISH_SYSTEM*/
-/* Release a lock. Returns 0 on success. */
+/* Take a lock on H. A value of 0 for TIMEOUT returns immediately if
+ the lock can't be taked, -1 waits forever (hopefully not), other
+ values wait for TIMEOUT milliseconds. Returns: 0 on success */
int
-release_dotlock (dotlock_t h)
+dotlock_take (dotlock_t h, long timeout)
{
-#ifndef HAVE_DOSISH_SYSTEM
- int pid, same_node;
-#endif
-
- /* To avoid atexit race conditions we first check whether there are
- any locks left. It might happen that another atexit handler
- tries to release the lock while the atexit handler of this module
- already ran and thus H is undefined. */
- if (!all_lockfiles)
- return 0;
+ int ret;
if ( h->disable )
- return 0;
+ return 0; /* Locks are completely disabled. Return success. */
- if ( !h->locked )
+ if ( h->locked )
{
- log_debug("Oops, `%s' is not locked\n", h->lockname);
+ my_debug_1 ("Oops, `%s' is already locked\n", h->lockname);
return 0;
}
#ifdef HAVE_DOSISH_SYSTEM
- {
- OVERLAPPED ovl;
+ ret = dotlock_take_w32 (h, timeout);
+#else /*!HAVE_DOSISH_SYSTEM*/
+ ret = dotlock_take_unix (h, timeout);
+#endif /*!HAVE_DOSISH_SYSTEM*/
- memset (&ovl, 0, sizeof ovl);
- if (!UnlockFileEx (h->lockhd, 0, 1, 0, &ovl))
- {
- log_error ("release_dotlock: error removing lockfile `%s': %s\n",
- h->lockname, w32_strerror (-1));
- return -1;
- }
- }
-#else
+ return ret;
+}
+
+
+
+#ifdef HAVE_POSIX_SYSTEM
+/* Unix specific code of release_dotlock. */
+static int
+dotlock_release_unix (dotlock_t h)
+{
+ int pid, same_node;
pid = read_lockfile (h, &same_node);
if ( pid == -1 )
{
- log_error( "release_dotlock: lockfile error\n");
+ my_error_0 ("release_dotlock: lockfile error\n");
return -1;
}
if ( pid != getpid() || !same_node )
{
- log_error( "release_dotlock: not our lock (pid=%d)\n", pid);
+ my_error_1 ("release_dotlock: not our lock (pid=%d)\n", pid);
return -1;
}
-#ifndef __riscos__
if ( unlink( h->lockname ) )
{
- log_error ("release_dotlock: error removing lockfile `%s'\n",
- h->lockname);
+ my_error_1 ("release_dotlock: error removing lockfile `%s'\n",
+ h->lockname);
return -1;
}
/* Fixme: As an extra check we could check whether the link count is
now really at 1. */
-#else /* __riscos__ */
- if ( renamefile (h->lockname, h->tname) )
- {
- log_error ("release_dotlock: error renaming lockfile `%s' to `%s'\n",
- h->lockname, h->tname);
- return -1;
- }
-#endif /* __riscos__ */
-
-#endif /* !HAVE_DOSISH_SYSTEM */
- h->locked = 0;
return 0;
}
+#endif /*HAVE_POSIX_SYSTEM */
-/* Read the lock file and return the pid, returns -1 on error. True
- will be stored in the integer at address SAME_NODE if the lock file
- has been created on the same node. */
-#ifndef HAVE_DOSISH_SYSTEM
+#ifdef HAVE_DOSISH_SYSTEM
+/* Windows specific code of release_dotlock. */
static int
-read_lockfile (dotlock_t h, int *same_node )
+dotlock_release_w32 (dotlock_t h)
{
- char buffer_space[10+1+70+1]; /* 70 is just an estimated value; node
- name are usually shorter. */
- int fd;
- int pid = -1;
- char *buffer, *p;
- size_t expected_len;
- int res, nread;
-
- *same_node = 0;
- expected_len = 10 + 1 + h->nodename_len + 1;
- if ( expected_len >= sizeof buffer_space)
- {
- buffer = jnlib_malloc (expected_len);
- if (!buffer)
- return -1;
- }
- else
- buffer = buffer_space;
+ OVERLAPPED ovl;
- if ( (fd = open (h->lockname, O_RDONLY)) == -1 )
+ memset (&ovl, 0, sizeof ovl);
+ if (!UnlockFileEx (h->lockhd, 0, 1, 0, &ovl))
{
- int e = errno;
- log_info ("error opening lockfile `%s': %s\n",
- h->lockname, strerror(errno) );
- if (buffer != buffer_space)
- jnlib_free (buffer);
- jnlib_set_errno (e); /* Need to return ERRNO here. */
+ my_error_2 ("release_dotlock: error removing lockfile `%s': %s\n",
+ h->lockname, w32_strerror (-1));
return -1;
}
- p = buffer;
- nread = 0;
- do
- {
- res = read (fd, p, expected_len - nread);
- if (res == -1 && errno == EINTR)
- continue;
- if (res < 0)
- {
- log_info ("error reading lockfile `%s'", h->lockname );
- close (fd);
- if (buffer != buffer_space)
- jnlib_free (buffer);
- jnlib_set_errno (0); /* Do not return an inappropriate ERRNO. */
- return -1;
- }
- p += res;
- nread += res;
- }
- while (res && nread != expected_len);
- close(fd);
+ return 0;
+}
+#endif /*HAVE_DOSISH_SYSTEM */
- if (nread < 11)
- {
- log_info ("invalid size of lockfile `%s'", h->lockname );
- if (buffer != buffer_space)
- jnlib_free (buffer);
- jnlib_set_errno (0); /* Better don't return an inappropriate ERRNO. */
- return -1;
- }
- if (buffer[10] != '\n'
- || (buffer[10] = 0, pid = atoi (buffer)) == -1
-#ifndef __riscos__
- || !pid
-#else /* __riscos__ */
- || (!pid && riscos_getpid())
-#endif /* __riscos__ */
- )
- {
- log_error ("invalid pid %d in lockfile `%s'", pid, h->lockname );
- if (buffer != buffer_space)
- jnlib_free (buffer);
- jnlib_set_errno (0);
- return -1;
+/* Release a lock. Returns 0 on success. */
+int
+dotlock_release (dotlock_t h)
+{
+ int ret;
+
+ /* To avoid atexit race conditions we first check whether there are
+ any locks left. It might happen that another atexit handler
+ tries to release the lock while the atexit handler of this module
+ already ran and thus H is undefined. */
+ LOCK_all_lockfiles ();
+ ret = !all_lockfiles;
+ UNLOCK_all_lockfiles ();
+ if (ret)
+ return 0;
+
+ if ( h->disable )
+ return 0;
+
+ if ( !h->locked )
+ {
+ my_debug_1 ("Oops, `%s' is not locked\n", h->lockname);
+ return 0;
}
- if (nread == expected_len
- && !memcmp (h->tname+h->nodename_off, buffer+11, h->nodename_len)
- && buffer[11+h->nodename_len] == '\n')
- *same_node = 1;
+#ifdef HAVE_DOSISH_SYSTEM
+ ret = dotlock_release_w32 (h);
+#else
+ ret = dotlock_release_unix (h);
+#endif
- if (buffer != buffer_space)
- jnlib_free (buffer);
- return pid;
+ if (!ret)
+ h->locked = 0;
+ return ret;
}
-#endif /* !HAVE_DOSISH_SYSTEM */
-/* Remove all lockfiles. This is usually called by the atexit handler
+
+/* Remove all lockfiles. This is called by the atexit handler
installed by this module but may also be called by other
termination handlers. */
void
@@ -712,13 +1248,18 @@ dotlock_remove_lockfiles (void)
{
dotlock_t h, h2;
+ /* First set the lockfiles list to NULL so that for example
+ dotlock_release is ware that this fucntion is currently
+ running. */
+ LOCK_all_lockfiles ();
h = all_lockfiles;
all_lockfiles = NULL;
+ UNLOCK_all_lockfiles ();
while ( h )
{
h2 = h->next;
- destroy_dotlock (h);
+ dotlock_destroy (h);
h = h2;
}
}
diff --git a/common/dotlock.h b/common/dotlock.h
index 407a80b37..5267ceb09 100644
--- a/common/dotlock.h
+++ b/common/dotlock.h
@@ -1,33 +1,76 @@
-/* dotlock.h
- * Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+/* dotlock.h - dotfile locking declarations
+ * Copyright (C) 2000, 2001, 2006, 2011 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_DOTLOCK_H
#define LIBJNLIB_DOTLOCK_H
+/* See dotlock.c for a description. */
+
+#ifdef DOTLOCK_EXT_SYM_PREFIX
+# ifndef _DOTLOCK_PREFIX
+# define _DOTLOCK_PREFIX1(x,y) x ## y
+# define _DOTLOCK_PREFIX2(x,y) _DOTLOCK_PREFIX1(x,y)
+# define _DOTLOCK_PREFIX(x) _DOTLOCK_PREFIX2(DOTLOCK_EXT_SYM_PREFIX,x)
+# endif /*_DOTLOCK_PREFIX*/
+# define dotlock_disable _DOTLOCK_PREFIX(dotlock_disable)
+# define dotlock_create _DOTLOCK_PREFIX(dotlock_create)
+# define dotlock_set_fd _DOTLOCK_PREFIX(dotlock_set_fd)
+# define dotlock_get_fd _DOTLOCK_PREFIX(dotlock_get_fd)
+# define dotlock_destroy _DOTLOCK_PREFIX(dotlock_destroy)
+# define dotlock_take _DOTLOCK_PREFIX(dotlock_take)
+# define dotlock_release _DOTLOCK_PREFIX(dotlock_release)
+# define dotlock_remove_lockfiles _DOTLOCK_PREFIX(dotlock_remove_lockfiles)
+#endif /*DOTLOCK_EXT_SYM_PREFIX*/
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0
+}
+#endif
+#endif
+
+
struct dotlock_handle;
typedef struct dotlock_handle *dotlock_t;
-void disable_dotlock (void);
-dotlock_t create_dotlock (const char *file_to_lock);
-void destroy_dotlock ( dotlock_t h );
-int make_dotlock (dotlock_t h, long timeout);
-int release_dotlock (dotlock_t h);
+void dotlock_disable (void);
+dotlock_t dotlock_create (const char *file_to_lock, unsigned int flags);
+void dotlock_set_fd (dotlock_t h, int fd);
+int dotlock_get_fd (dotlock_t h);
+void dotlock_destroy (dotlock_t h);
+int dotlock_take (dotlock_t h, long timeout);
+int dotlock_release (dotlock_t h);
void dotlock_remove_lockfiles (void);
+#ifdef __cplusplus
+}
+#endif
#endif /*LIBJNLIB_DOTLOCK_H*/
diff --git a/common/dynload.h b/common/dynload.h
index 84407c2d5..e029b2b36 100644
--- a/common/dynload.h
+++ b/common/dynload.h
@@ -1,20 +1,31 @@
/* dynload.h - Wrapper functions for run-time dynamic loading
* Copyright (C) 2003, 2010 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_DYNLOAD_H
diff --git a/common/libjnlib-config.h b/common/libjnlib-config.h
index 621e89feb..85be87f3e 100644
--- a/common/libjnlib-config.h
+++ b/common/libjnlib-config.h
@@ -1,20 +1,31 @@
/* libjnlib-config.h - local configuration of the jnlib functions
* Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
/****************
diff --git a/common/logging.c b/common/logging.c
index 94e7fbae1..2d9b17d45 100644
--- a/common/logging.c
+++ b/common/logging.c
@@ -2,20 +2,31 @@
* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
* 2009, 2010 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
diff --git a/common/logging.h b/common/logging.h
index fa5d4cfd7..b0d662b71 100644
--- a/common/logging.h
+++ b/common/logging.h
@@ -2,20 +2,31 @@
* Copyright (C) 1999, 2000, 2001, 2004, 2006,
* 2010 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_LOGGING_H
diff --git a/common/mischelp.c b/common/mischelp.c
index 57688d767..d106cde4f 100644
--- a/common/mischelp.c
+++ b/common/mischelp.c
@@ -1,20 +1,31 @@
/* mischelp.c - Miscellaneous helper functions
* Copyright (C) 1998, 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/mischelp.h b/common/mischelp.h
index 5a0132aa6..a8b16356a 100644
--- a/common/mischelp.h
+++ b/common/mischelp.h
@@ -2,20 +2,31 @@
* Copyright (C) 1999, 2000, 2001, 2002, 2003,
* 2006, 2007, 2009 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_MISCHELP_H
diff --git a/common/stringhelp.c b/common/stringhelp.c
index 15ca9d7fa..235cbd3d2 100644
--- a/common/stringhelp.c
+++ b/common/stringhelp.c
@@ -2,20 +2,31 @@
* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007,
* 2008, 2009, 2010 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/stringhelp.h b/common/stringhelp.h
index 28cbdab72..60ba12b8c 100644
--- a/common/stringhelp.h
+++ b/common/stringhelp.h
@@ -2,20 +2,31 @@
* Copyright (C) 1998, 1999, 2000, 2001, 2003,
* 2006, 2007, 2009 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_STRINGHELP_H
diff --git a/common/strlist.c b/common/strlist.c
index 93a58d5a0..d9aed16f2 100644
--- a/common/strlist.c
+++ b/common/strlist.c
@@ -1,20 +1,31 @@
/* strlist.c - string helpers
* Copyright (C) 1998, 2000, 2001, 2006 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/strlist.h b/common/strlist.h
index 3640da63d..c72549fe8 100644
--- a/common/strlist.h
+++ b/common/strlist.h
@@ -1,20 +1,31 @@
/* strlist.h
* Copyright (C) 1998, 2000, 2001, 2006 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_STRLIST_H
diff --git a/common/t-dotlock.c b/common/t-dotlock.c
new file mode 100644
index 000000000..f81b95276
--- /dev/null
+++ b/common/t-dotlock.c
@@ -0,0 +1,145 @@
+/* t-dotlock.c - Module test for dotlock.c
+ * Copyright (C) 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Note: This is a standalone test program which does not rely on any
+ GnuPG helper files. However, it may also be build as part of the
+ GnuPG build system. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Some quick replacements for stuff we usually expect to be defined
+ in config.h. Define HAVE_POSIX_SYSTEM for better readability. */
+#if !defined (HAVE_DOSISH_SYSTEM) && defined(_WIN32)
+# define HAVE_DOSISH_SYSTEM 1
+#endif
+#if !defined (HAVE_DOSISH_SYSTEM) && !defined (HAVE_POSIX_SYSTEM)
+# define HAVE_POSIX_SYSTEM 1
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include <unistd.h>
+
+#include "dotlock.h"
+
+#define PGM "t-dotlock"
+
+
+static volatile int ctrl_c_pending;
+
+static void
+control_c_handler (int signo)
+{
+ (void)signo;
+ ctrl_c_pending = 1;
+}
+
+
+
+static void
+die (const char *format, ...)
+{
+ va_list arg_ptr;
+
+ va_start (arg_ptr, format);
+ fprintf (stderr, PGM "[%lu]: ", (unsigned long)getpid ());
+ vfprintf (stderr, format, arg_ptr);
+ putc ('\n', stderr);
+ va_end (arg_ptr);
+ exit (1);
+}
+
+
+static void
+inf (const char *format, ...)
+{
+ va_list arg_ptr;
+
+ va_start (arg_ptr, format);
+ fprintf (stderr, PGM "[%lu]: ", (unsigned long)getpid ());
+ vfprintf (stderr, format, arg_ptr);
+ putc ('\n', stderr);
+ va_end (arg_ptr);
+}
+
+
+static void
+lock_and_unlock (const char *fname)
+{
+ dotlock_t h;
+
+ h = dotlock_create (fname, 0);
+ if (!h)
+ die ("error creating lock file for `%s': %s", fname, strerror (errno));
+ inf ("lock created");
+
+ while (!ctrl_c_pending)
+ {
+ if (dotlock_take (h, -1))
+ die ("error taking lock");
+ inf ("lock taken");
+ sleep (1);
+ if (dotlock_release (h))
+ die ("error releasing lock");
+ inf ("lock released");
+ sleep (1);
+ }
+ dotlock_destroy (h);
+ inf ("lock destroyed");
+}
+
+
+int
+main (int argc, char **argv)
+{
+ const char *fname;
+
+ if (argc > 1)
+ fname = argv[1];
+ else
+ fname = "t-dotlock.tmp";
+
+ {
+ struct sigaction nact;
+
+ nact.sa_handler = control_c_handler;
+ nact.sa_flags = 0;
+ sigaction (SIGINT, &nact, NULL);
+ }
+
+ dotlock_create (NULL, 0); /* Initialize (optional). */
+
+ lock_and_unlock (fname);
+
+
+ return 0;
+}
+
+
+/*
+Local Variables:
+compile-command: "cc -Wall -O2 -D_FILE_OFFSET_BITS=64 -o t-dotlock t-dotlock.c dotlock.c"
+End:
+*/
diff --git a/common/t-stringhelp.c b/common/t-stringhelp.c
index d7b25e9b0..990a8004a 100644
--- a/common/t-stringhelp.c
+++ b/common/t-stringhelp.c
@@ -1,20 +1,31 @@
/* t-stringhelp.c - Regression tests for stringhelp.c
* Copyright (C) 2007 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/t-support.c b/common/t-support.c
index 755e15611..f8b087de1 100644
--- a/common/t-support.c
+++ b/common/t-support.c
@@ -1,20 +1,31 @@
/* t-support.c - helper functions for the regression tests.
* Copyright (C) 2007 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/t-support.h b/common/t-support.h
index 2dfbc0990..8316909b5 100644
--- a/common/t-support.h
+++ b/common/t-support.h
@@ -1,20 +1,31 @@
/* t-support.h - Helper for the regression tests
* Copyright (C) 2007 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_T_SUPPORT_H
diff --git a/common/t-timestuff.c b/common/t-timestuff.c
index 8e5fa65ee..d1a2c0287 100644
--- a/common/t-timestuff.c
+++ b/common/t-timestuff.c
@@ -1,20 +1,31 @@
/* t-timestuff.c - Regression tests for time functions
* Copyright (C) 2007 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/t-w32-reg.c b/common/t-w32-reg.c
index 9a6a61d39..cac6db031 100644
--- a/common/t-w32-reg.c
+++ b/common/t-w32-reg.c
@@ -1,20 +1,31 @@
/* t-w32-reg.c - Regression tests for W32 registry functions
* Copyright (C) 2010 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/types.h b/common/types.h
index fcba737c2..631cd8295 100644
--- a/common/types.h
+++ b/common/types.h
@@ -1,20 +1,31 @@
/* types.h - define some extra types
* Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_TYPES_H
diff --git a/common/utf8conv.c b/common/utf8conv.c
index a5765f6a6..861662745 100644
--- a/common/utf8conv.c
+++ b/common/utf8conv.c
@@ -2,20 +2,31 @@
* Copyright (C) 1994, 1998, 1999, 2000, 2001, 2003, 2006,
* 2008, 2010 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/utf8conv.h b/common/utf8conv.h
index 28dd450dd..a08d3f35d 100644
--- a/common/utf8conv.h
+++ b/common/utf8conv.h
@@ -1,20 +1,31 @@
/* utf8conf.h
* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_UTF8CONF_H
diff --git a/common/util.h b/common/util.h
index 31c2caacb..9381f29e4 100644
--- a/common/util.h
+++ b/common/util.h
@@ -1,20 +1,31 @@
/* util.h - Utility functions for GnuPG
* Copyright (C) 2001, 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
*
- * This file is part of GnuPG.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * JNLIB is free software; you can redistribute it and/or modify it
+ * under the terms of either
*
- * GnuPG is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
+ *
+ * JNLIB is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GNUPG_COMMON_UTIL_H
diff --git a/common/w32-afunix.c b/common/w32-afunix.c
index 690e95176..5f56c29b0 100644
--- a/common/w32-afunix.c
+++ b/common/w32-afunix.c
@@ -1,20 +1,31 @@
/* w32-afunix.c - AF_UNIX emulation for Windows (Client only).
* Copyright (C) 2004, 2006 g10 Code GmbH
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
/* Use of this code is deprecated - you better use the socket wrappers
diff --git a/common/w32-afunix.h b/common/w32-afunix.h
index 23681ddeb..c9abd7b2b 100644
--- a/common/w32-afunix.h
+++ b/common/w32-afunix.h
@@ -1,20 +1,31 @@
/* w32-afunix.h - AF_UNIX emulation for Windows
* Copyright (C) 2004, 2006 g10 Code GmbH
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef _WIN32
diff --git a/common/w32-reg.c b/common/w32-reg.c
index 5dc2be584..d3cb815ff 100644
--- a/common/w32-reg.c
+++ b/common/w32-reg.c
@@ -1,20 +1,31 @@
/* w32-reg.c - MS-Windows Registry access
* Copyright (C) 1999, 2002, 2007 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/w32help.h b/common/w32help.h
index beabdedef..50eda67a0 100644
--- a/common/w32help.h
+++ b/common/w32help.h
@@ -1,20 +1,31 @@
/* w32help.h - W32 speicif functions
* Copyright (C) 2007 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_W32HELP_H
diff --git a/common/xmalloc.c b/common/xmalloc.c
index c0d5d1d6d..999ec00f8 100644
--- a/common/xmalloc.c
+++ b/common/xmalloc.c
@@ -1,20 +1,31 @@
/* xmalloc.c - standard malloc wrappers
* Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
diff --git a/common/xmalloc.h b/common/xmalloc.h
index 8c9c5292b..73d6f45bc 100644
--- a/common/xmalloc.h
+++ b/common/xmalloc.h
@@ -1,20 +1,31 @@
/* xmalloc.h
* Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
*
- * This file is part of JNLIB.
+ * This file is part of JNLIB, which is a subsystem of GnuPG.
*
* JNLIB is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
+ * under the terms of either
+ *
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
*
* JNLIB is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copies of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBJNLIB_XMALLOC_H
diff --git a/configure.ac b/configure.ac
index e2c77537f..26995ce74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -741,21 +741,6 @@ AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
have_libgcrypt=yes,have_libgcrypt=no)
-# FIxme: Remove this test after libgcrypt 1.5.0 has been released.
-AC_CACHE_CHECK([whether Libgcrypt has gcry_kdf_derive],
- gnupg_cv_gcry_kdf_derive,
- [ _gnupg_gcry_save_cflags=$CFLAGS
- _gnupg_gcry_save_libs=$LIBS
- CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
- LIBS="$LIBS $LIBGCRYPT_LIBS"
- AC_TRY_LINK(
- [#include <gcrypt.h>],
- [ return gcry_kdf_derive (NULL,0,0,0,NULL,0,0,0,NULL); ],
- gnupg_cv_gcry_kdf_derive=yes,
- gnupg_cv_gcry_kdf_derive=no)
- LIBS=$_gnupg_gcry_save_libs
- CFLAGS=$_gnupg_gcry_save_cflags])
-
#
# libassuan is used for IPC
@@ -1616,15 +1601,15 @@ if test "$have_libgcrypt" = "no"; then
*** ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/
*** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API is required.)
***]])
-elif test "$gnupg_cv_gcry_kdf_derive" = no; then
- die=yes
- AC_MSG_NOTICE([[
-***
-*** Libgcrypt 1.5.0 has not yet been released and thus the API
-*** is a bit in a flux. Your version misses the function
-*** gcry_kdf_derive
-*** You need to install a newer Libgcrypt version.
-***]])
+dnl elif test "$gnupg_cv_gcry_kdf_derive" = no; then
+dnl die=yes
+dnl AC_MSG_NOTICE([[
+dnl ***
+dnl *** Libgcrypt 1.5.0 has not yet been released and thus the API
+dnl *** is a bit in a flux. Your version misses the function
+dnl *** gcry_kdf_derive
+dnl *** You need to install a newer Libgcrypt version.
+dnl #***]])
fi
if test "$have_libassuan" = "no"; then
die=yes
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 39c8dec57..17c58ecd4 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-12 Werner Koch <[email protected]>
+
+ * gpg.texi: Add a bunch of opindex items.
+
+ * yat2m.c (parse_file): Add hack to allow table indentation.
+
2011-08-12 Werner Koch <[email protected]>
* texi.css: Override some elements.
diff --git a/doc/gpg-agent.texi b/doc/gpg-agent.texi
index b212153e3..4c7f13f33 100644
--- a/doc/gpg-agent.texi
+++ b/doc/gpg-agent.texi
@@ -204,7 +204,6 @@ below the home directory of the user.
@item -v
@item --verbose
-@opindex v
@opindex verbose
Outputs additional information while running.
You can increase the verbosity by giving several
@@ -212,7 +211,6 @@ verbose commands to @command{gpgsm}, such as @samp{-vv}.
@item -q
@item --quiet
-@opindex q
@opindex quiet
Try to be as quiet as possible.
@@ -300,9 +298,7 @@ debugging.
@itemx --sh
@itemx -c
@itemx --csh
-@opindex s
@opindex sh
-@opindex c
@opindex csh
Format the info output in daemon mode for use with the standard Bourne
shell or the C-shell respectively. The default is to guess it based on
diff --git a/doc/gpg.texi b/doc/gpg.texi
index 1112fa21a..715b599ec 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -551,7 +551,7 @@ Use the source, Luke :-). The output format is still subject to change.
@item --enarmor
@item --dearmor
@opindex enarmor
-@opindex --enarmor
+@opindex dearmor
Pack or unpack an arbitrary input into/from an OpenPGP ASCII armor.
This is a GnuPG extension to OpenPGP and in general not very useful.
@@ -598,42 +598,42 @@ line.
@c ******** Begin Edit-key Options **********
@table @asis
-@item uid @code{n}
-@opindex keyedit:uid
-Toggle selection of user ID or photographic user ID with index @code{n}.
-Use @code{*} to select all and @code{0} to deselect all.
-
-@item key @code{n}
-@opindex keyedit:key
-Toggle selection of subkey with index @code{n}.
-Use @code{*} to select all and @code{0} to deselect all.
-
-@item sign
-@opindex keyedit:sign
-Make a signature on key of user @code{name} If the key is not yet
-signed by the default user (or the users given with -u), the program
-displays the information of the key again, together with its
-fingerprint and asks whether it should be signed. This question is
-repeated for all users specified with
--u.
-
-@item lsign
-@opindex keyedit:lsign
-Same as "sign" but the signature is marked as non-exportable and will
-therefore never be used by others. This may be used to make keys
-valid only in the local environment.
-
-@item nrsign
-@opindex keyedit:nrsign
-Same as "sign" but the signature is marked as non-revocable and can
-therefore never be revoked.
-
-@item tsign
-@opindex keyedit:tsign
-Make a trust signature. This is a signature that combines the notions
-of certification (like a regular signature), and trust (like the
-"trust" command). It is generally only useful in distinct communities
-or groups.
+ @item uid @code{n}
+ @opindex keyedit:uid
+ Toggle selection of user ID or photographic user ID with index @code{n}.
+ Use @code{*} to select all and @code{0} to deselect all.
+
+ @item key @code{n}
+ @opindex keyedit:key
+ Toggle selection of subkey with index @code{n}.
+ Use @code{*} to select all and @code{0} to deselect all.
+
+ @item sign
+ @opindex keyedit:sign
+ Make a signature on key of user @code{name} If the key is not yet
+ signed by the default user (or the users given with -u), the program
+ displays the information of the key again, together with its
+ fingerprint and asks whether it should be signed. This question is
+ repeated for all users specified with
+ -u.
+
+ @item lsign
+ @opindex keyedit:lsign
+ Same as "sign" but the signature is marked as non-exportable and will
+ therefore never be used by others. This may be used to make keys
+ valid only in the local environment.
+
+ @item nrsign
+ @opindex keyedit:nrsign
+ Same as "sign" but the signature is marked as non-revocable and can
+ therefore never be revoked.
+
+ @item tsign
+ @opindex keyedit:tsign
+ Make a trust signature. This is a signature that combines the notions
+ of certification (like a regular signature), and trust (like the
+ "trust" command). It is generally only useful in distinct communities
+ or groups.
@end table
@c man:.RS
@@ -644,212 +644,211 @@ create a signature of any type desired.
@table @asis
-@item delsig
-@opindex keyedit:delsig
-Delete a signature. Note that it is not possible to retract a signature,
-once it has been send to the public (i.e. to a keyserver). In that case
-you better use @code{revsig}.
-
-@item revsig
-@opindex keyedit:revsig
-Revoke a signature. For every signature which has been generated by
-one of the secret keys, GnuPG asks whether a revocation certificate
-should be generated.
-
-@item check
-@opindex keyedit:check
-Check the signatures on all selected user IDs.
-
-@item adduid
-@opindex keyedit:adduid
-Create an additional user ID.
-
-@item addphoto
-@opindex keyedit:addphoto
-Create a photographic user ID. This will prompt for a JPEG file that
-will be embedded into the user ID. Note that a very large JPEG will make
-for a very large key. Also note that some programs will display your
-JPEG unchanged (GnuPG), and some programs will scale it to fit in a
-dialog box (PGP).
-
-@item showphoto
-@opindex keyedit:showphoto
-Display the selected photographic user ID.
-
-@item deluid
-@opindex keyedit:deluid
-Delete a user ID or photographic user ID. Note that it is not
-possible to retract a user id, once it has been send to the public
-(i.e. to a keyserver). In that case you better use @code{revuid}.
-
-@item revuid
-@opindex keyedit:revuid
-Revoke a user ID or photographic user ID.
-
-@item primary
-@opindex keyedit:primary
-Flag the current user id as the primary one, removes the primary user
-id flag from all other user ids and sets the timestamp of all affected
-self-signatures one second ahead. Note that setting a photo user ID
-as primary makes it primary over other photo user IDs, and setting a
-regular user ID as primary makes it primary over other regular user
-IDs.
-
-@item keyserver
-@opindex keyedit:keyserver
-Set a preferred keyserver for the specified user ID(s). This allows
-other users to know where you prefer they get your key from. See
-@option{--keyserver-options honor-keyserver-url} for more on how this
-works. Setting a value of "none" removes an existing preferred
-keyserver.
-
-@item notation
-@opindex keyedit:notation
-Set a name=value notation for the specified user ID(s). See
-@option{--cert-notation} for more on how this works. Setting a value of
-"none" removes all notations, setting a notation prefixed with a minus
-sign (-) removes that notation, and setting a notation name (without the
-=value) prefixed with a minus sign removes all notations with that name.
-
-@item pref
-@opindex keyedit:pref
-List preferences from the selected user ID. This shows the actual
-preferences, without including any implied preferences.
-
-@item showpref
-@opindex keyedit:showpref
-More verbose preferences listing for the selected user ID. This shows
-the preferences in effect by including the implied preferences of 3DES
-(cipher), SHA-1 (digest), and Uncompressed (compression) if they are
-not already included in the preference list. In addition, the
-preferred keyserver and signature notations (if any) are shown.
-
-@item setpref @code{string}
-@opindex keyedit:setpref
-Set the list of user ID preferences to @code{string} for all (or just
-the selected) user IDs. Calling setpref with no arguments sets the
-preference list to the default (either built-in or set via
-@option{--default-preference-list}), and calling setpref with "none"
-as the argument sets an empty preference list. Use @command{@gpgname
---version} to get a list of available algorithms. Note that while you
-can change the preferences on an attribute user ID (aka "photo ID"),
-GnuPG does not select keys via attribute user IDs so these preferences
-will not be used by GnuPG.
-
-When setting preferences, you should list the algorithms in the order
-which you'd like to see them used by someone else when encrypting a
-message to your key. If you don't include 3DES, it will be
-automatically added at the end. Note that there are many factors that
-go into choosing an algorithm (for example, your key may not be the
-only recipient), and so the remote OpenPGP application being used to
-send to you may or may not follow your exact chosen order for a given
-message. It will, however, only choose an algorithm that is present
-on the preference list of every recipient key. See also the
-INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
-
-@item addkey
-@opindex keyedit:addkey
-Add a subkey to this key.
-
-@item addcardkey
-@opindex keyedit:addcardkey
-Generate a subkey on a card and add it to this key.
-
-@item keytocard
-@opindex keyedit:keytocard
-Transfer the selected secret subkey (or the primary key if no subkey
-has been selected) to a smartcard. The secret key in the keyring will
-be replaced by a stub if the key could be stored successfully on the
-card and you use the save command later. Only certain key types may be
-transferred to the card. A sub menu allows you to select on what card
-to store the key. Note that it is not possible to get that key back
-from the card - if the card gets broken your secret key will be lost
-unless you have a backup somewhere.
-
-@item bkuptocard @code{file}
-@opindex keyedit:bkuptocard
-Restore the given file to a card. This command may be used to restore a
-backup key (as generated during card initialization) to a new card. In
-almost all cases this will be the encryption key. You should use this
-command only with the corresponding public key and make sure that the
-file given as argument is indeed the backup to restore. You should then
-select 2 to restore as encryption key. You will first be asked to enter
-the passphrase of the backup key and then for the Admin PIN of the card.
-
-@item delkey
-@opindex keyedit:delkey
-Remove a subkey (secondart key). Note that it is not possible to retract
-a subkey, once it has been send to the public (i.e. to a keyserver). In
-that case you better use @code{revkey}.
-
-@item revkey
-@opindex keyedit:revkey
-Revoke a subkey.
-
-@item expire
-@opindex keyedit:expire
-Change the key or subkey expiration time. If a subkey is selected, the
-expiration time of this subkey will be changed. With no selection, the
-key expiration of the primary key is changed.
-
-@item trust
-@opindex keyedit:trust
-Change the owner trust value for the key. This updates the trust-db
-immediately and no save is required.
-
-@item disable
-@itemx enable
-@opindex keyedit:disable
-@opindex keyedit:enable
-Disable or enable an entire key. A disabled key can not normally be
-used for encryption.
-
-@item addrevoker
-@opindex keyedit:addrevoker
-Add a designated revoker to the key. This takes one optional argument:
-"sensitive". If a designated revoker is marked as sensitive, it will
-not be exported by default (see export-options).
-
-@item passwd
-@opindex keyedit:passwd
-Change the passphrase of the secret key.
-
-@item toggle
-@opindex keyedit:toggle
-Toggle between public and secret key listing.
-
-@item clean
-@opindex keyedit:clean
-Compact (by removing all signatures except the selfsig) any user ID
-that is no longer usable (e.g. revoked, or expired). Then, remove any
-signatures that are not usable by the trust calculations.
-Specifically, this removes any signature that does not validate, any
-signature that is superseded by a later signature, revoked signatures,
-and signatures issued by keys that are not present on the keyring.
-
-@item minimize
-@opindex keyedit:minimize
-Make the key as small as possible. This removes all signatures from
-each user ID except for the most recent self-signature.
-
-@item cross-certify
-@opindex keyedit:cross-certify
-Add cross-certification signatures to signing subkeys that may not
-currently have them. Cross-certification signatures protect against a
-subtle attack against signing subkeys. See
-@option{--require-cross-certification}. All new keys generated have
-this signature by default, so this option is only useful to bring
-older keys up to date.
-
-@item save
-@opindex keyedit:save
-Save all changes to the key rings and quit.
-
-@item quit
-@opindex keyedit:quit
-Quit the program without updating the
-key rings.
-
+ @item delsig
+ @opindex keyedit:delsig
+ Delete a signature. Note that it is not possible to retract a signature,
+ once it has been send to the public (i.e. to a keyserver). In that case
+ you better use @code{revsig}.
+
+ @item revsig
+ @opindex keyedit:revsig
+ Revoke a signature. For every signature which has been generated by
+ one of the secret keys, GnuPG asks whether a revocation certificate
+ should be generated.
+
+ @item check
+ @opindex keyedit:check
+ Check the signatures on all selected user IDs.
+
+ @item adduid
+ @opindex keyedit:adduid
+ Create an additional user ID.
+
+ @item addphoto
+ @opindex keyedit:addphoto
+ Create a photographic user ID. This will prompt for a JPEG file that
+ will be embedded into the user ID. Note that a very large JPEG will make
+ for a very large key. Also note that some programs will display your
+ JPEG unchanged (GnuPG), and some programs will scale it to fit in a
+ dialog box (PGP).
+
+ @item showphoto
+ @opindex keyedit:showphoto
+ Display the selected photographic user ID.
+
+ @item deluid
+ @opindex keyedit:deluid
+ Delete a user ID or photographic user ID. Note that it is not
+ possible to retract a user id, once it has been send to the public
+ (i.e. to a keyserver). In that case you better use @code{revuid}.
+
+ @item revuid
+ @opindex keyedit:revuid
+ Revoke a user ID or photographic user ID.
+
+ @item primary
+ @opindex keyedit:primary
+ Flag the current user id as the primary one, removes the primary user
+ id flag from all other user ids and sets the timestamp of all affected
+ self-signatures one second ahead. Note that setting a photo user ID
+ as primary makes it primary over other photo user IDs, and setting a
+ regular user ID as primary makes it primary over other regular user
+ IDs.
+
+ @item keyserver
+ @opindex keyedit:keyserver
+ Set a preferred keyserver for the specified user ID(s). This allows
+ other users to know where you prefer they get your key from. See
+ @option{--keyserver-options honor-keyserver-url} for more on how this
+ works. Setting a value of "none" removes an existing preferred
+ keyserver.
+
+ @item notation
+ @opindex keyedit:notation
+ Set a name=value notation for the specified user ID(s). See
+ @option{--cert-notation} for more on how this works. Setting a value of
+ "none" removes all notations, setting a notation prefixed with a minus
+ sign (-) removes that notation, and setting a notation name (without the
+ =value) prefixed with a minus sign removes all notations with that name.
+
+ @item pref
+ @opindex keyedit:pref
+ List preferences from the selected user ID. This shows the actual
+ preferences, without including any implied preferences.
+
+ @item showpref
+ @opindex keyedit:showpref
+ More verbose preferences listing for the selected user ID. This shows
+ the preferences in effect by including the implied preferences of 3DES
+ (cipher), SHA-1 (digest), and Uncompressed (compression) if they are
+ not already included in the preference list. In addition, the
+ preferred keyserver and signature notations (if any) are shown.
+
+ @item setpref @code{string}
+ @opindex keyedit:setpref
+ Set the list of user ID preferences to @code{string} for all (or just
+ the selected) user IDs. Calling setpref with no arguments sets the
+ preference list to the default (either built-in or set via
+ @option{--default-preference-list}), and calling setpref with "none"
+ as the argument sets an empty preference list. Use @command{@gpgname
+ --version} to get a list of available algorithms. Note that while you
+ can change the preferences on an attribute user ID (aka "photo ID"),
+ GnuPG does not select keys via attribute user IDs so these preferences
+ will not be used by GnuPG.
+
+ When setting preferences, you should list the algorithms in the order
+ which you'd like to see them used by someone else when encrypting a
+ message to your key. If you don't include 3DES, it will be
+ automatically added at the end. Note that there are many factors that
+ go into choosing an algorithm (for example, your key may not be the
+ only recipient), and so the remote OpenPGP application being used to
+ send to you may or may not follow your exact chosen order for a given
+ message. It will, however, only choose an algorithm that is present
+ on the preference list of every recipient key. See also the
+ INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.
+
+ @item addkey
+ @opindex keyedit:addkey
+ Add a subkey to this key.
+
+ @item addcardkey
+ @opindex keyedit:addcardkey
+ Generate a subkey on a card and add it to this key.
+
+ @item keytocard
+ @opindex keyedit:keytocard
+ Transfer the selected secret subkey (or the primary key if no subkey
+ has been selected) to a smartcard. The secret key in the keyring will
+ be replaced by a stub if the key could be stored successfully on the
+ card and you use the save command later. Only certain key types may be
+ transferred to the card. A sub menu allows you to select on what card
+ to store the key. Note that it is not possible to get that key back
+ from the card - if the card gets broken your secret key will be lost
+ unless you have a backup somewhere.
+
+ @item bkuptocard @code{file}
+ @opindex keyedit:bkuptocard
+ Restore the given file to a card. This command may be used to restore a
+ backup key (as generated during card initialization) to a new card. In
+ almost all cases this will be the encryption key. You should use this
+ command only with the corresponding public key and make sure that the
+ file given as argument is indeed the backup to restore. You should then
+ select 2 to restore as encryption key. You will first be asked to enter
+ the passphrase of the backup key and then for the Admin PIN of the card.
+
+ @item delkey
+ @opindex keyedit:delkey
+ Remove a subkey (secondart key). Note that it is not possible to retract
+ a subkey, once it has been send to the public (i.e. to a keyserver). In
+ that case you better use @code{revkey}.
+
+ @item revkey
+ @opindex keyedit:revkey
+ Revoke a subkey.
+
+ @item expire
+ @opindex keyedit:expire
+ Change the key or subkey expiration time. If a subkey is selected, the
+ expiration time of this subkey will be changed. With no selection, the
+ key expiration of the primary key is changed.
+
+ @item trust
+ @opindex keyedit:trust
+ Change the owner trust value for the key. This updates the trust-db
+ immediately and no save is required.
+
+ @item disable
+ @itemx enable
+ @opindex keyedit:disable
+ @opindex keyedit:enable
+ Disable or enable an entire key. A disabled key can not normally be
+ used for encryption.
+
+ @item addrevoker
+ @opindex keyedit:addrevoker
+ Add a designated revoker to the key. This takes one optional argument:
+ "sensitive". If a designated revoker is marked as sensitive, it will
+ not be exported by default (see export-options).
+
+ @item passwd
+ @opindex keyedit:passwd
+ Change the passphrase of the secret key.
+
+ @item toggle
+ @opindex keyedit:toggle
+ Toggle between public and secret key listing.
+
+ @item clean
+ @opindex keyedit:clean
+ Compact (by removing all signatures except the selfsig) any user ID
+ that is no longer usable (e.g. revoked, or expired). Then, remove any
+ signatures that are not usable by the trust calculations.
+ Specifically, this removes any signature that does not validate, any
+ signature that is superseded by a later signature, revoked signatures,
+ and signatures issued by keys that are not present on the keyring.
+
+ @item minimize
+ @opindex keyedit:minimize
+ Make the key as small as possible. This removes all signatures from
+ each user ID except for the most recent self-signature.
+
+ @item cross-certify
+ @opindex keyedit:cross-certify
+ Add cross-certification signatures to signing subkeys that may not
+ currently have them. Cross-certification signatures protect against a
+ subtle attack against signing subkeys. See
+ @option{--require-cross-certification}. All new keys generated have
+ this signature by default, so this option is only useful to bring
+ older keys up to date.
+
+ @item save
+ @opindex keyedit:save
+ Save all changes to the key rings and quit.
+
+ @item quit
+ @opindex keyedit:quit
+ Quit the program without updating the
+ key rings.
@end table
@c man:.RS
@@ -863,27 +862,28 @@ the values:
@table @asis
-@item -
-No ownertrust assigned / not yet calculated.
+ @item -
+ No ownertrust assigned / not yet calculated.
+
+ @item e
+ Trust
+ calculation has failed; probably due to an expired key.
-@item e
-Trust
-calculation has failed; probably due to an expired key.
+ @item q
+ Not enough information for calculation.
-@item q
-Not enough information for calculation.
+ @item n
+ Never trust this key.
-@item n
-Never trust this key.
+ @item m
+ Marginally trusted.
-@item m
-Marginally trusted.
+ @item f
+ Fully trusted.
-@item f
-Fully trusted.
+ @item u
+ Ultimately trusted.
-@item u
-Ultimately trusted.
@end table
@c ******** End Edit-key Options **********
@@ -1026,117 +1026,139 @@ give the opposite meaning. The options are:
@table @asis
-@item show-photos
-@opindex list-options:show-photos
-Causes @option{--list-keys}, @option{--list-sigs},
-@option{--list-public-keys}, and @option{--list-secret-keys} to
-display any photo IDs attached to the key. Defaults to no. See also
-@option{--photo-viewer}. Does not work with @option{--with-colons}:
-see @option{--attribute-fd} for the appropriate way to get photo data
-for scripts and other frontends.
-
-@item show-policy-urls
-@opindex list-options:show-policy-urls
-Show policy URLs in the @option{--list-sigs} or @option{--check-sigs}
-listings. Defaults to no.
-
-@item show-notations
-@itemx show-std-notations
-@itemx show-user-notations
-@opindex list-options:show-notations
-@opindex list-options:show-std-notations
-@opindex list-options:show-user-notations
-Show all, IETF standard, or user-defined signature notations in the
-@option{--list-sigs} or @option{--check-sigs} listings. Defaults to no.
-
-@item show-keyserver-urls
-
-Show any preferred keyserver URL in the @option{--list-sigs} or
-@option{--check-sigs} listings. Defaults to no.
-
-@item show-uid-validity
-Display the calculated validity of user IDs during key listings.
-Defaults to no.
-
-@item show-unusable-uids
-Show revoked and expired user IDs in key listings. Defaults to no.
-
-@item show-unusable-subkeys
-Show revoked and expired subkeys in key listings. Defaults to no.
+ @item show-photos
+ @opindex list-options:show-photos
+ Causes @option{--list-keys}, @option{--list-sigs},
+ @option{--list-public-keys}, and @option{--list-secret-keys} to
+ display any photo IDs attached to the key. Defaults to no. See also
+ @option{--photo-viewer}. Does not work with @option{--with-colons}:
+ see @option{--attribute-fd} for the appropriate way to get photo data
+ for scripts and other frontends.
+
+ @item show-policy-urls
+ @opindex list-options:show-policy-urls
+ Show policy URLs in the @option{--list-sigs} or @option{--check-sigs}
+ listings. Defaults to no.
+
+ @item show-notations
+ @itemx show-std-notations
+ @itemx show-user-notations
+ @opindex list-options:show-notations
+ @opindex list-options:show-std-notations
+ @opindex list-options:show-user-notations
+ Show all, IETF standard, or user-defined signature notations in the
+ @option{--list-sigs} or @option{--check-sigs} listings. Defaults to no.
+
+ @item show-keyserver-urls
+ @opindex list-options:show-keyserver-urls
+ Show any preferred keyserver URL in the @option{--list-sigs} or
+ @option{--check-sigs} listings. Defaults to no.
+
+ @item show-uid-validity
+ @opindex list-options:show-uid-validity
+ Display the calculated validity of user IDs during key listings.
+ Defaults to no.
+
+ @item show-unusable-uids
+ @opindex list-options:show-unusable-uids
+ Show revoked and expired user IDs in key listings. Defaults to no.
+
+ @item show-unusable-subkeys
+ @opindex list-options:show-unusable-subkeys
+ Show revoked and expired subkeys in key listings. Defaults to no.
+
+ @item show-keyring
+ @opindex list-options:show-keyring
+ Display the keyring name at the head of key listings to show which
+ keyring a given key resides on. Defaults to no.
+
+ @item show-sig-expire
+ @opindex list-options:show-sig-expire
+ Show signature expiration dates (if any) during @option{--list-sigs} or
+ @option{--check-sigs} listings. Defaults to no.
+
+ @item show-sig-subpackets
+ @opindex list-options:show-sig-subpackets
+ Include signature subpackets in the key listing. This option can take an
+ optional argument list of the subpackets to list. If no argument is
+ passed, list all subpackets. Defaults to no. This option is only
+ meaningful when using @option{--with-colons} along with
+ @option{--list-sigs} or @option{--check-sigs}.
-@item show-keyring
-Display the keyring name at the head of key listings to show which
-keyring a given key resides on. Defaults to no.
-
-@item show-sig-expire
-Show signature expiration dates (if any) during @option{--list-sigs} or
-@option{--check-sigs} listings. Defaults to no.
-
-@item show-sig-subpackets
-Include signature subpackets in the key listing. This option can take an
-optional argument list of the subpackets to list. If no argument is
-passed, list all subpackets. Defaults to no. This option is only
-meaningful when using @option{--with-colons} along with
-@option{--list-sigs} or @option{--check-sigs}.
@end table
@item --verify-options @code{parameters}
+@opindex verify-options
This is a space or comma delimited string that gives options used when
verifying signatures. Options can be prepended with a `no-' to give
the opposite meaning. The options are:
@table @asis
-@item show-photos
-Display any photo IDs present on the key that issued the signature.
-Defaults to no. See also @option{--photo-viewer}.
-
-@item show-policy-urls
-Show policy URLs in the signature being verified. Defaults to no.
-
-@item show-notations
-@itemx show-std-notations
-@itemx show-user-notations
-Show all, IETF standard, or user-defined signature notations in the
-signature being verified. Defaults to IETF standard.
-
-@item show-keyserver-urls
-Show any preferred keyserver URL in the signature being verified.
-Defaults to no.
-
-@item show-uid-validity
-Display the calculated validity of the user IDs on the key that issued
-the signature. Defaults to no.
-
-@item show-unusable-uids
-Show revoked and expired user IDs during signature verification.
-Defaults to no.
-
-@item show-primary-uid-only
-Show only the primary user ID during signature verification. That is
-all the AKA lines as well as photo Ids are not shown with the signature
-verification status.
-
-@item pka-lookups
-Enable PKA lookups to verify sender addresses. Note that PKA is based
-on DNS, and so enabling this option may disclose information on when
-and what signatures are verified or to whom data is encrypted. This
-is similar to the "web bug" described for the auto-key-retrieve
-feature.
-
-@item pka-trust-increase
-Raise the trust in a signature to full if the signature passes PKA
-validation. This option is only meaningful if pka-lookups is set.
+ @item show-photos
+ @opindex verify-options:show-photos
+ Display any photo IDs present on the key that issued the signature.
+ Defaults to no. See also @option{--photo-viewer}.
+
+ @item show-policy-urls
+ @opindex verify-options:show-policy-urls
+ Show policy URLs in the signature being verified. Defaults to no.
+
+ @item show-notations
+ @itemx show-std-notations
+ @itemx show-user-notations
+ @opindex verify-options:show-notations
+ @opindex verify-options:show-std-notations
+ @opindex verify-options:show-user-notations
+ Show all, IETF standard, or user-defined signature notations in the
+ signature being verified. Defaults to IETF standard.
+
+ @item show-keyserver-urls
+ @opindex verify-options:show-keyserver-urls
+ Show any preferred keyserver URL in the signature being verified.
+ Defaults to no.
+
+ @item show-uid-validity
+ @opindex verify-options:show-uid-validity
+ Display the calculated validity of the user IDs on the key that issued
+ the signature. Defaults to no.
+
+ @item show-unusable-uids
+ @opindex verify-options:show-unusable-uids
+ Show revoked and expired user IDs during signature verification.
+ Defaults to no.
+
+ @item show-primary-uid-only
+ @opindex verify-options:show-primary-uid-only
+ Show only the primary user ID during signature verification. That is
+ all the AKA lines as well as photo Ids are not shown with the signature
+ verification status.
+
+ @item pka-lookups
+ @opindex verify-options:pka-lookups
+ Enable PKA lookups to verify sender addresses. Note that PKA is based
+ on DNS, and so enabling this option may disclose information on when
+ and what signatures are verified or to whom data is encrypted. This
+ is similar to the "web bug" described for the auto-key-retrieve
+ feature.
+
+ @item pka-trust-increase
+ @opindex verify-options:pka-trust-increase
+ Raise the trust in a signature to full if the signature passes PKA
+ validation. This option is only meaningful if pka-lookups is set.
@end table
@item --enable-dsa2
@itemx --disable-dsa2
+@opindex enable-dsa2
+@opindex disable-dsa2
Enable hash truncation for all DSA keys even for old DSA Keys up to
1024 bit. This is also the default with @option{--openpgp}. Note
that older versions of GnuPG also required this flag to allow the
generation of DSA larger than 1024 bit.
@item --photo-viewer @code{string}
+@opindex photo-viewer
This is the command line that should be run to view a photo ID. "%i"
will be expanded to a filename containing the photo. "%I" does the
same, except the file will not be deleted once the viewer exits.
@@ -1154,6 +1176,7 @@ STDIN". Note that if your image viewer program is not secure, then
executing it from GnuPG does not make it secure.
@item --exec-path @code{string}
+@opindex exec-path
Sets a list of directories to search for photo viewers and keyserver
helpers. If not provided, keyserver helpers use the compiled-in
default directory, and photo viewers use the $PATH environment
@@ -1162,6 +1185,7 @@ Note, that on W32 system this value is ignored when searching for
keyserver helpers.
@item --keyring @code{file}
+@opindex keyring
Add @code{file} to the current list of keyrings. If @code{file} begins
with a tilde and a slash, these are replaced by the $HOME directory. If
the filename does not contain a slash, it is assumed to be in the GnuPG
@@ -1173,14 +1197,17 @@ use the specified keyring alone, use @option{--keyring} along with
@option{--no-default-keyring}.
@item --secret-keyring @code{file}
+@opindex secret-keyring
Same as @option{--keyring} but for the secret keyrings.
@item --primary-keyring @code{file}
+@opindex primary-keyring
Designate @code{file} as the primary public keyring. This means that
newly imported keys (via @option{--import} or keyserver
@option{--recv-from}) will go to this keyring.
@item --trustdb-name @code{file}
+@opindex trustdb-name
Use @code{file} instead of the default trustdb. If @code{file} begins
with a tilde and a slash, these are replaced by the $HOME directory. If
the filename does not contain a slash, it is assumed to be in the GnuPG
@@ -1195,6 +1222,7 @@ not used).
@ifset gpgone
@item --pcsc-driver @code{file}
+@opindex pcsc-driver
Use @code{file} to access the smartcard reader. The current default is
`libpcsclite.so.1' for GLIBC based systems,
`/System/Library/Frameworks/PCSC.framework/PCSC' for MAC OS X,
@@ -1203,6 +1231,7 @@ Use @code{file} to access the smartcard reader. The current default is
@ifset gpgone
@item --disable-ccid
+@opindex disable-ccid
Disable the integrated support for CCID compliant readers. This
allows to fall back to one of the other drivers even if the internal
CCID driver can handle the reader. Note, that CCID support is only
@@ -1211,6 +1240,7 @@ available if libusb was available at build time.
@ifset gpgone
@item --reader-port @code{number_or_string}
+@opindex reader-port
This option may be used to specify the port of the card terminal. A
value of 0 refers to the first serial device; add 32768 to access USB
devices. The default is 32768 (first USB device). PC/SC or CCID
@@ -1220,6 +1250,7 @@ found.
@end ifset
@item --display-charset @code{name}
+@opindex display-charset
Set the name of the native character set. This is used to convert
some informational strings like user IDs to the proper UTF-8 encoding.
Note that this has nothing to do with the character set of data to be
@@ -1230,26 +1261,32 @@ Valid values for @code{name} are:
@table @asis
-@item iso-8859-1
-This is the Latin 1 set.
+ @item iso-8859-1
+ @opindex display-charset:iso-8859-1
+ This is the Latin 1 set.
-@item iso-8859-2
-The Latin 2 set.
+ @item iso-8859-2
+ @opindex display-charset:iso-8859-2
+ The Latin 2 set.
-@item iso-8859-15
-This is currently an alias for
-the Latin 1 set.
+ @item iso-8859-15
+ @opindex display-charset:iso-8859-15
+ This is currently an alias for
+ the Latin 1 set.
-@item koi8-r
-The usual Russian set (rfc1489).
+ @item koi8-r
+ @opindex display-charset:koi8-r
+ The usual Russian set (rfc1489).
-@item utf-8
-Bypass all translations and assume
-that the OS uses native UTF-8 encoding.
+ @item utf-8
+ @opindex display-charset:utf-8
+ Bypass all translations and assume
+ that the OS uses native UTF-8 encoding.
@end table
@item --utf8-strings
@itemx --no-utf8-strings
+@opindex utf8-strings
Assume that command line arguments are given as UTF8 strings. The
default (@option{--no-utf8-strings}) is to assume that arguments are
encoded in the character set as specified by
@@ -1260,20 +1297,22 @@ arguments. Both options may be used multiple times.
@anchor{option --options}
@end ifset
@item --options @code{file}
+@opindex options
Read options from @code{file} and do not try to read them from the
default options file in the homedir (see @option{--homedir}). This
option is ignored if used in an options file.
@item --no-options
+@opindex no-options
Shortcut for @option{--options /dev/null}. This option is detected
before an attempt to open an option file. Using this option will also
prevent the creation of a @file{~/.gnupg} homedir.
-
-
@item -z @code{n}
@itemx --compress-level @code{n}
@itemx --bzip2-compress-level @code{n}
+@opindex compress-level
+@opindex bzip2-compress-level
Set compression level to @code{n} for the ZIP and ZLIB compression
algorithms. The default is to use the default compression level of zlib
(normally 6). @option{--bzip2-compress-level} sets the compression level
@@ -1283,6 +1322,7 @@ significant amount of memory for each additional compression level.
@option{-z} sets both. A value of 0 for @code{n} disables compression.
@item --bzip2-decompress-lowmem
+@opindex bzip2-decompress-lowmem
Use a different decompression method for BZIP2 compressed files. This
alternate method uses a bit more than half the memory, but also runs
at half the speed. This is useful under extreme low memory
@@ -1302,6 +1342,7 @@ platforms.
@item --ask-cert-level
@itemx --no-ask-cert-level
+@opindex ask-cert-level
When making a key signature, prompt for a certification level. If this
option is not specified, the certification level used is set via
@option{--default-cert-level}. See @option{--default-cert-level} for
@@ -1310,6 +1351,7 @@ used. @option{--no-ask-cert-level} disables this option. This option
defaults to no.
@item --default-cert-level @code{n}
+@opindex default-cert-level
The default to use for the check level when signing a key.
0 means you make no particular claim as to how carefully you verified
@@ -1339,12 +1381,14 @@ and "extensive" mean to you.
This option defaults to 0 (no particular claim).
@item --min-cert-level
+@opindex min-cert-level
When building the trust database, treat any signatures with a
certification level below this as invalid. Defaults to 2, which
disregards level 1 signatures. Note that level 0 "no particular
claim" signatures are always accepted.
@item --trusted-key @code{long key ID}
+@opindex trusted-key
Assume that the specified key (which must be given
as a full 8 byte key ID) is as trustworthy as one of
your own secret keys. This option is useful if you
@@ -1353,37 +1397,44 @@ online but still want to be able to check the validity of a given
recipient's or signator's key.
@item --trust-model @code{pgp|classic|direct|always|auto}
+@opindex trust-model
Set what trust model GnuPG should follow. The models are:
@table @asis
-@item pgp
-This is the Web of Trust combined with trust signatures as used in PGP
-5.x and later. This is the default trust model when creating a new
-trust database.
-
-@item classic
-This is the standard Web of Trust as used in PGP 2.x and earlier.
-
-@item direct
-Key validity is set directly by the user and not calculated via the
-Web of Trust.
-
-@item always
-Skip key validation and assume that used keys are always fully
-trusted. You generally won't use this unless you are using some
-external validation scheme. This option also suppresses the
-"[uncertain]" tag printed with signature checks when there is no
-evidence that the user ID is bound to the key.
-
-@item auto
-Select the trust model depending on whatever the internal trust
-database says. This is the default model if such a database already
-exists.
+ @item pgp
+ @opindex trust-mode:pgp
+ This is the Web of Trust combined with trust signatures as used in PGP
+ 5.x and later. This is the default trust model when creating a new
+ trust database.
+
+ @item classic
+ @opindex trust-mode:classic
+ This is the standard Web of Trust as used in PGP 2.x and earlier.
+
+ @item direct
+ @opindex trust-mode:direct
+ Key validity is set directly by the user and not calculated via the
+ Web of Trust.
+
+ @item always
+ @opindex trust-mode:always
+ Skip key validation and assume that used keys are always fully
+ trusted. You generally won't use this unless you are using some
+ external validation scheme. This option also suppresses the
+ "[uncertain]" tag printed with signature checks when there is no
+ evidence that the user ID is bound to the key.
+
+ @item auto
+ @opindex trust-mode:auto
+ Select the trust model depending on whatever the internal trust
+ database says. This is the default model if such a database already
+ exists.
@end table
@item --auto-key-locate @code{parameters}
@itemx --no-auto-key-locate
+@opindex auto-key-locate
GnuPG can automatically locate and retrieve keys as needed using this
option. This happens when encrypting to an email address (in the
"user@@example.com" form), and there are no user@@example.com keys on
@@ -1392,40 +1443,41 @@ mechanisms, in the order they are to be tried:
@table @asis
-@item cert
-Locate a key using DNS CERT, as specified in rfc4398.
+ @item cert
+ Locate a key using DNS CERT, as specified in rfc4398.
-@item pka
-Locate a key using DNS PKA.
+ @item pka
+ Locate a key using DNS PKA.
-@item ldap
-Using DNS Service Discovery, check the domain in question for any LDAP
-keyservers to use. If this fails, attempt to locate the key using the
-PGP Universal method of checking @samp{ldap://keys.(thedomain)}.
+ @item ldap
+ Using DNS Service Discovery, check the domain in question for any LDAP
+ keyservers to use. If this fails, attempt to locate the key using the
+ PGP Universal method of checking @samp{ldap://keys.(thedomain)}.
-@item keyserver
-Locate a key using whatever keyserver is defined using the
-@option{--keyserver} option.
+ @item keyserver
+ Locate a key using whatever keyserver is defined using the
+ @option{--keyserver} option.
-@item keyserver-URL
-In addition, a keyserver URL as used in the @option{--keyserver} option
-may be used here to query that particular keyserver.
+ @item keyserver-URL
+ In addition, a keyserver URL as used in the @option{--keyserver} option
+ may be used here to query that particular keyserver.
-@item local
-Locate the key using the local keyrings. This mechanism allows to
-select the order a local key lookup is done. Thus using
-@samp{--auto-key-locate local} is identical to
-@option{--no-auto-key-locate}.
+ @item local
+ Locate the key using the local keyrings. This mechanism allows to
+ select the order a local key lookup is done. Thus using
+ @samp{--auto-key-locate local} is identical to
+ @option{--no-auto-key-locate}.
-@item nodefault
-This flag disables the standard local key lookup, done before any of the
-mechanisms defined by the @option{--auto-key-locate} are tried. The
-position of this mechanism in the list does not matter. It is not
-required if @code{local} is also used.
+ @item nodefault
+ This flag disables the standard local key lookup, done before any of the
+ mechanisms defined by the @option{--auto-key-locate} are tried. The
+ position of this mechanism in the list does not matter. It is not
+ required if @code{local} is also used.
@end table
@item --keyid-format @code{short|0xshort|long|0xlong}
+@opindex keyid-format
Select how to display key IDs. "short" is the traditional 8-character
key ID. "long" is the more accurate (but less convenient)
16-character key ID. Add an "0x" to either to include an "0x" at the
@@ -1433,6 +1485,7 @@ beginning of the key ID, as in 0x99242560. Note that this option is
ignored if the option --with-colons is used.
@item --keyserver @code{name}
+@opindex keyserver
Use @code{name} as your keyserver. This is the server that
@option{--recv-keys}, @option{--send-keys}, and @option{--search-keys}
will communicate with to receive keys from, send keys to, and search for
@@ -1452,6 +1505,7 @@ need to send keys to more than one server. The keyserver
keyserver each time you use it.
@item --keyserver-options @code{name=value1 }
+@opindex keyserver-options
This is a space or comma delimited string that gives options for the
keyserver. Options can be prefixed with a `no-' to give the opposite
meaning. Valid import-options or export-options may be used here as
@@ -1461,111 +1515,115 @@ are available for all keyserver types, some common options are:
@table @asis
-@item include-revoked
-When searching for a key with @option{--search-keys}, include keys that
-are marked on the keyserver as revoked. Note that not all keyservers
-differentiate between revoked and unrevoked keys, and for such
-keyservers this option is meaningless. Note also that most keyservers do
-not have cryptographic verification of key revocations, and so turning
-this option off may result in skipping keys that are incorrectly marked
-as revoked.
-
-@item include-disabled
-When searching for a key with @option{--search-keys}, include keys that
-are marked on the keyserver as disabled. Note that this option is not
-used with HKP keyservers.
-
-@item auto-key-retrieve
-This option enables the automatic retrieving of keys from a keyserver
-when verifying signatures made by keys that are not on the local
-keyring.
-
-Note that this option makes a "web bug" like behavior possible.
-Keyserver operators can see which keys you request, so by sending you
-a message signed by a brand new key (which you naturally will not have
-on your local keyring), the operator can tell both your IP address and
-the time when you verified the signature.
-
-@item honor-keyserver-url
-When using @option{--refresh-keys}, if the key in question has a preferred
-keyserver URL, then use that preferred keyserver to refresh the key
-from. In addition, if auto-key-retrieve is set, and the signature
-being verified has a preferred keyserver URL, then use that preferred
-keyserver to fetch the key from. Defaults to yes.
-
-@item honor-pka-record
-If auto-key-retrieve is set, and the signature being verified has a
-PKA record, then use the PKA information to fetch the key. Defaults
-to yes.
-
-@item include-subkeys
-When receiving a key, include subkeys as potential targets. Note that
-this option is not used with HKP keyservers, as they do not support
-retrieving keys by subkey id.
-
-@item use-temp-files
-On most Unix-like platforms, GnuPG communicates with the keyserver
-helper program via pipes, which is the most efficient method. This
-option forces GnuPG to use temporary files to communicate. On some
-platforms (such as Win32 and RISC OS), this option is always enabled.
-
-@item keep-temp-files
-If using `use-temp-files', do not delete the temp files after using
-them. This option is useful to learn the keyserver communication
-protocol by reading the temporary files.
-
-@item verbose
-Tell the keyserver helper program to be more verbose. This option can
-be repeated multiple times to increase the verbosity level.
-
-@item timeout
-Tell the keyserver helper program how long (in seconds) to try and
-perform a keyserver action before giving up. Note that performing
-multiple actions at the same time uses this timeout value per action.
-For example, when retrieving multiple keys via @option{--recv-keys}, the
-timeout applies separately to each key retrieval, and not to the
-@option{--recv-keys} command as a whole. Defaults to 30 seconds.
-
-@item http-proxy=@code{value}
-Set the proxy to use for HTTP and HKP keyservers. This overrides the
-"http_proxy" environment variable, if any.
-
-@item max-cert-size
-When retrieving a key via DNS CERT, only accept keys up to this size.
-Defaults to 16384 bytes.
-
-@item debug
-Turn on debug output in the keyserver helper program. Note that the
-details of debug output depends on which keyserver helper program is
-being used, and in turn, on any libraries that the keyserver helper
-program uses internally (libcurl, openldap, etc).
-
-@item check-cert
-Enable certificate checking if the keyserver presents one (for hkps or
-ldaps). Defaults to on.
-
-@item ca-cert-file
-Provide a certificate store to override the system default. Only
-necessary if check-cert is enabled, and the keyserver is using a
-certificate that is not present in a system default certificate list.
-
-Note that depending on the SSL library that the keyserver helper is
-built with, this may actually be a directory or a file.
+ @item include-revoked
+ When searching for a key with @option{--search-keys}, include keys that
+ are marked on the keyserver as revoked. Note that not all keyservers
+ differentiate between revoked and unrevoked keys, and for such
+ keyservers this option is meaningless. Note also that most keyservers do
+ not have cryptographic verification of key revocations, and so turning
+ this option off may result in skipping keys that are incorrectly marked
+ as revoked.
+
+ @item include-disabled
+ When searching for a key with @option{--search-keys}, include keys that
+ are marked on the keyserver as disabled. Note that this option is not
+ used with HKP keyservers.
+
+ @item auto-key-retrieve
+ This option enables the automatic retrieving of keys from a keyserver
+ when verifying signatures made by keys that are not on the local
+ keyring.
+
+ Note that this option makes a "web bug" like behavior possible.
+ Keyserver operators can see which keys you request, so by sending you
+ a message signed by a brand new key (which you naturally will not have
+ on your local keyring), the operator can tell both your IP address and
+ the time when you verified the signature.
+
+ @item honor-keyserver-url
+ When using @option{--refresh-keys}, if the key in question has a preferred
+ keyserver URL, then use that preferred keyserver to refresh the key
+ from. In addition, if auto-key-retrieve is set, and the signature
+ being verified has a preferred keyserver URL, then use that preferred
+ keyserver to fetch the key from. Defaults to yes.
+
+ @item honor-pka-record
+ If auto-key-retrieve is set, and the signature being verified has a
+ PKA record, then use the PKA information to fetch the key. Defaults
+ to yes.
+
+ @item include-subkeys
+ When receiving a key, include subkeys as potential targets. Note that
+ this option is not used with HKP keyservers, as they do not support
+ retrieving keys by subkey id.
+
+ @item use-temp-files
+ On most Unix-like platforms, GnuPG communicates with the keyserver
+ helper program via pipes, which is the most efficient method. This
+ option forces GnuPG to use temporary files to communicate. On some
+ platforms (such as Win32 and RISC OS), this option is always enabled.
+
+ @item keep-temp-files
+ If using `use-temp-files', do not delete the temp files after using
+ them. This option is useful to learn the keyserver communication
+ protocol by reading the temporary files.
+
+ @item verbose
+ Tell the keyserver helper program to be more verbose. This option can
+ be repeated multiple times to increase the verbosity level.
+
+ @item timeout
+ Tell the keyserver helper program how long (in seconds) to try and
+ perform a keyserver action before giving up. Note that performing
+ multiple actions at the same time uses this timeout value per action.
+ For example, when retrieving multiple keys via @option{--recv-keys}, the
+ timeout applies separately to each key retrieval, and not to the
+ @option{--recv-keys} command as a whole. Defaults to 30 seconds.
+
+ @item http-proxy=@code{value}
+ Set the proxy to use for HTTP and HKP keyservers. This overrides the
+ "http_proxy" environment variable, if any.
+
+ @item max-cert-size
+ When retrieving a key via DNS CERT, only accept keys up to this size.
+ Defaults to 16384 bytes.
+
+ @item debug
+ Turn on debug output in the keyserver helper program. Note that the
+ details of debug output depends on which keyserver helper program is
+ being used, and in turn, on any libraries that the keyserver helper
+ program uses internally (libcurl, openldap, etc).
+
+ @item check-cert
+ Enable certificate checking if the keyserver presents one (for hkps or
+ ldaps). Defaults to on.
+
+ @item ca-cert-file
+ Provide a certificate store to override the system default. Only
+ necessary if check-cert is enabled, and the keyserver is using a
+ certificate that is not present in a system default certificate list.
+
+ Note that depending on the SSL library that the keyserver helper is
+ built with, this may actually be a directory or a file.
@end table
@item --completes-needed @code{n}
+@opindex compliant-needed
Number of completely trusted users to introduce a new
key signer (defaults to 1).
@item --marginals-needed @code{n}
+@opindex marginals-needed
Number of marginally trusted users to introduce a new
key signer (defaults to 3)
@item --max-cert-depth @code{n}
+@opindex max-cert-depth
Maximum depth of a certification chain (default is 5).
@ifclear gpgtwoone
@item --simple-sk-checksum
+@opindex simple-sk-checksum
Secret keys are integrity protected by using a SHA-1 checksum. This
method is part of the upcoming enhanced OpenPGP specification but
GnuPG already uses it as a countermeasure against certain attacks.
@@ -1578,6 +1636,7 @@ value is acceptable).
@end ifclear
@item --no-sig-cache
+@opindex no-sig-cache
Do not cache the verification status of key signatures.
Caching gives a much better performance in key listings. However, if
you suspect that your public keyring is not save against write
@@ -1586,6 +1645,7 @@ probably does not make sense to disable it because all kind of damage
can be done if someone else has write access to your public keyring.
@item --no-sig-create-check
+@opindex no-sig-create-check
GnuPG normally verifies each signature right after creation to protect
against bugs and hardware malfunctions which could leak out bits from
the secret key. This extra verification needs some time (about 115%
@@ -1595,6 +1655,7 @@ interaction, this performance penalty does not matter in most settings.
@item --auto-check-trustdb
@itemx --no-auto-check-trustdb
+@opindex auto-check-trustdb
If GnuPG feels that its information about the Web of Trust has to be
updated, it automatically runs the @option{--check-trustdb} command
internally. This may be a time consuming
@@ -1602,6 +1663,7 @@ process. @option{--no-auto-check-trustdb} disables this option.
@item --use-agent
@itemx --no-use-agent
+@opindex use-agent
@ifclear gpgone
This is dummy option. @command{@gpgname} always requires the agent.
@end ifclear
@@ -1612,6 +1674,7 @@ passphrase. @option{--no-use-agent} disables this option.
@end ifset
@item --gpg-agent-info
+@opindex gpg-agent-info
@ifclear gpgone
This is dummy option. It has no effect when used with @command{gpg2}.
@end ifclear
@@ -1623,16 +1686,19 @@ been given. Given that this option is not anymore used by
@end ifset
@item --lock-once
+@opindex lock-once
Lock the databases the first time a lock is requested
and do not release the lock until the process
terminates.
@item --lock-multiple
+@opindex lock-multiple
Release the locks every time a lock is no longer
needed. Use this to override a previous @option{--lock-once}
from a config file.
@item --lock-never
+@opindex lock-never
Disable locking entirely. This option should be used only in very
special environments, where it can be assured that only one process
is accessing those files. A bootable floppy with a stand-alone
@@ -1640,6 +1706,7 @@ encryption system will probably use this. Improper usage of this
option may lead to data and key corruption.
@item --exit-on-status-write-error
+@opindex exit-on-status-write-error
This option will cause write errors on the status FD to immediately
terminate the process. That should in fact be the default but it never
worked this way and thus we need an option to enable this, so that the
@@ -1649,6 +1716,7 @@ connected pipe too early. Using this option along with
running gpg operations.
@item --limit-card-insert-tries @code{n}
+@opindex limit-card-insert-tries
With @code{n} greater than 0 the number of prompts asking to insert a
smartcard gets limited to N-1. Thus with a value of 1 gpg won't at
all ask to insert a card if none has been inserted at startup. This
@@ -1657,18 +1725,22 @@ not know about the smartcard support and waits ad infinitum for an
inserted card.
@item --no-random-seed-file
+@opindex no-random-seed-file
GnuPG uses a file to store its internal random pool over invocations.
This makes random generation faster; however sometimes write operations
are not desired. This option can be used to achieve that with the cost of
slower random generation.
@item --no-greeting
+@opindex no-greeting
Suppress the initial copyright message.
@item --no-secmem-warning
+@opindex no-secmem-warning
Suppress the warning about "using insecure memory".
@item --no-permission-warning
+@opindex permission-warning
Suppress the warning about unsafe file and home directory (@option{--homedir})
permissions. Note that the permission checks that GnuPG performs are
not intended to be authoritative, but rather they simply warn about
@@ -1682,16 +1754,19 @@ warnings about itself. The @option{--homedir} permissions warning may only be
suppressed on the command line.
@item --no-mdc-warning
+@opindex no-mdc-warning
Suppress the warning about missing MDC integrity protection.
@item --require-secmem
@itemx --no-require-secmem
+@opindex require-secmem
Refuse to run if GnuPG cannot get secure memory. Defaults to no
(i.e. run, but give a warning).
@item --require-cross-certification
@itemx --no-require-cross-certification
+@opindex require-cross-certification
When verifying a signature made from a subkey, ensure that the cross
certification "back signature" on the subkey is present and valid. This
protects against a subtle attack against subkeys that can sign.
@@ -1700,6 +1775,7 @@ Defaults to @option{--require-cross-certification} for
@item --expert
@itemx --no-expert
+@opindex expert
Allow the user to do certain nonsensical or "silly" things like
signing an expired or revoked key, or certain potentially incompatible
things like generating unusual key types. This also disables certain
@@ -1708,9 +1784,6 @@ implies, this option is for experts only. If you don't fully
understand the implications of what it allows you to do, leave this
off. @option{--no-expert} disables this option.
-
-
-
@end table
@@ -1739,6 +1812,7 @@ limited countermeasure against traffic analysis. If this option or
@option{--default-recipient} is given.
@item --encrypt-to @code{name}
+@opindex encrypt-to
Same as @option{--recipient} but this one is intended for use in the
options file and may be used with your own user-id as an
"encrypt-to-self". These keys are only used when there are other
@@ -1747,6 +1821,7 @@ user id. No trust checking is performed for these user ids and even
disabled keys can be used.
@item --hidden-encrypt-to @code{name}
+@opindex hidden-encrypt-to
Same as @option{--hidden-recipient} but this one is intended for use in the
options file and may be used with your own user-id as a hidden
"encrypt-to-self". These keys are only used when there are other
@@ -1755,10 +1830,12 @@ No trust checking is performed for these user ids and even disabled
keys can be used.
@item --no-encrypt-to
+@opindex no-encrypt-to
Disable the use of all @option{--encrypt-to} and
@option{--hidden-encrypt-to} keys.
@item --group @code{name=value1 }
+@opindex group
Sets up a named group, which is similar to aliases in email programs.
Any time the group name is a recipient (@option{-r} or
@option{--recipient}), it will be expanded to the values
@@ -1774,9 +1851,11 @@ this option to prevent the shell from treating it as multiple
arguments.
@item --ungroup @code{name}
+@opindex ungroup
Remove a given entry from the @option{--group} list.
@item --no-groups
+@opindex no-groups
Remove all entries from the @option{--group} list.
@item --local-user @var{name}
@@ -1837,6 +1916,7 @@ Create ASCII armored output. The default is to create the binary
OpenPGP format.
@item --no-armor
+@opindex no-armor
Assume the input data is not in ASCII armored format.
@item --output @var{file}
@@ -1855,91 +1935,93 @@ maximum file size that will be generated before processing is forced to
stop by the OS limits. Defaults to 0, which means "no limit".
@item --import-options @code{parameters}
+@opindex import-options
This is a space or comma delimited string that gives options for
importing keys. Options can be prepended with a `no-' to give the
opposite meaning. The options are:
@table @asis
-@item import-local-sigs
-Allow importing key signatures marked as "local". This is not
-generally useful unless a shared keyring scheme is being used.
-Defaults to no.
-
-@item repair-pks-subkey-bug
-During import, attempt to repair the damage caused by the PKS keyserver
-bug (pre version 0.9.6) that mangles keys with multiple subkeys. Note
-that this cannot completely repair the damaged key as some crucial data
-is removed by the keyserver, but it does at least give you back one
-subkey. Defaults to no for regular @option{--import} and to yes for
-keyserver @option{--recv-keys}.
-
-@item merge-only
-During import, allow key updates to existing keys, but do not allow
-any new keys to be imported. Defaults to no.
-
-@item import-clean
-After import, compact (remove all signatures except the
-self-signature) any user IDs from the new key that are not usable.
-Then, remove any signatures from the new key that are not usable.
-This includes signatures that were issued by keys that are not present
-on the keyring. This option is the same as running the @option{--edit-key}
-command "clean" after import. Defaults to no.
-
-@item import-minimal
-Import the smallest key possible. This removes all signatures except
-the most recent self-signature on each user ID. This option is the
-same as running the @option{--edit-key} command "minimize" after import.
-Defaults to no.
+ @item import-local-sigs
+ Allow importing key signatures marked as "local". This is not
+ generally useful unless a shared keyring scheme is being used.
+ Defaults to no.
+
+ @item repair-pks-subkey-bug
+ During import, attempt to repair the damage caused by the PKS keyserver
+ bug (pre version 0.9.6) that mangles keys with multiple subkeys. Note
+ that this cannot completely repair the damaged key as some crucial data
+ is removed by the keyserver, but it does at least give you back one
+ subkey. Defaults to no for regular @option{--import} and to yes for
+ keyserver @option{--recv-keys}.
+
+ @item merge-only
+ During import, allow key updates to existing keys, but do not allow
+ any new keys to be imported. Defaults to no.
+
+ @item import-clean
+ After import, compact (remove all signatures except the
+ self-signature) any user IDs from the new key that are not usable.
+ Then, remove any signatures from the new key that are not usable.
+ This includes signatures that were issued by keys that are not present
+ on the keyring. This option is the same as running the @option{--edit-key}
+ command "clean" after import. Defaults to no.
+
+ @item import-minimal
+ Import the smallest key possible. This removes all signatures except
+ the most recent self-signature on each user ID. This option is the
+ same as running the @option{--edit-key} command "minimize" after import.
+ Defaults to no.
@end table
@item --export-options @code{parameters}
+@opindex export-options
This is a space or comma delimited string that gives options for
exporting keys. Options can be prepended with a `no-' to give the
opposite meaning. The options are:
@table @asis
-@item export-local-sigs
-Allow exporting key signatures marked as "local". This is not
-generally useful unless a shared keyring scheme is being used.
-Defaults to no.
+ @item export-local-sigs
+ Allow exporting key signatures marked as "local". This is not
+ generally useful unless a shared keyring scheme is being used.
+ Defaults to no.
-@item export-attributes
-Include attribute user IDs (photo IDs) while exporting. This is
-useful to export keys if they are going to be used by an OpenPGP
-program that does not accept attribute user IDs. Defaults to yes.
+ @item export-attributes
+ Include attribute user IDs (photo IDs) while exporting. This is
+ useful to export keys if they are going to be used by an OpenPGP
+ program that does not accept attribute user IDs. Defaults to yes.
-@item export-sensitive-revkeys
-Include designated revoker information that was marked as
-"sensitive". Defaults to no.
+ @item export-sensitive-revkeys
+ Include designated revoker information that was marked as
+ "sensitive". Defaults to no.
-@c Since GnuPG 2.1 gpg-agent manages the secret key and thus the
-@c export-reset-subkey-passwd hack is not anymore justified. Such use
-@c cases need to be implemented using a specialized secret key export
-@c tool.
+ @c Since GnuPG 2.1 gpg-agent manages the secret key and thus the
+ @c export-reset-subkey-passwd hack is not anymore justified. Such use
+ @c cases need to be implemented using a specialized secret key export
+ @c tool.
@ifclear gpgtwoone
-@item export-reset-subkey-passwd
-When using the @option{--export-secret-subkeys} command, this option resets
-the passphrases for all exported subkeys to empty. This is useful
-when the exported subkey is to be used on an unattended machine where
-a passphrase doesn't necessarily make sense. Defaults to no.
+ @item export-reset-subkey-passwd
+ When using the @option{--export-secret-subkeys} command, this option resets
+ the passphrases for all exported subkeys to empty. This is useful
+ when the exported subkey is to be used on an unattended machine where
+ a passphrase doesn't necessarily make sense. Defaults to no.
@end ifclear
-@item export-clean
-Compact (remove all signatures from) user IDs on the key being
-exported if the user IDs are not usable. Also, do not export any
-signatures that are not usable. This includes signatures that were
-issued by keys that are not present on the keyring. This option is
-the same as running the @option{--edit-key} command "clean" before export
-except that the local copy of the key is not modified. Defaults to
-no.
-
-@item export-minimal
-Export the smallest key possible. This removes all signatures except the
-most recent self-signature on each user ID. This option is the same as
-running the @option{--edit-key} command "minimize" before export except
-that the local copy of the key is not modified. Defaults to no.
+ @item export-clean
+ Compact (remove all signatures from) user IDs on the key being
+ exported if the user IDs are not usable. Also, do not export any
+ signatures that are not usable. This includes signatures that were
+ issued by keys that are not present on the keyring. This option is
+ the same as running the @option{--edit-key} command "clean" before export
+ except that the local copy of the key is not modified. Defaults to
+ no.
+
+ @item export-minimal
+ Export the smallest key possible. This removes all signatures except the
+ most recent self-signature on each user ID. This option is the same as
+ running the @option{--edit-key} command "minimize" before export except
+ that the local copy of the key is not modified. Defaults to no.
@end table
@item --with-colons
@@ -1983,6 +2065,7 @@ Include the keygrip in the key listings.
@item -t, --textmode
@itemx --no-textmode
+@opindex textmode
Treat input files as text and store them in the OpenPGP canonical text
form with standard "CRLF" line endings. This also sets the necessary
flags to inform the recipient that the encrypted or signed data is text
@@ -2002,6 +2085,7 @@ the type of the signature.
@item --force-v3-sigs
@itemx --no-force-v3-sigs
+@opindex force-v3-sigs
OpenPGP states that an implementation should generate v4 signatures
but PGP versions 5 through 7 only recognize v4 signatures on key
material. This option forces v3 signatures for signatures on data.
@@ -2013,22 +2097,26 @@ Defaults to no.
@item --force-v4-certs
@itemx --no-force-v4-certs
+@opindex force-v4-certs
Always use v4 key signatures even on v3 keys. This option also
changes the default hash algorithm for v3 RSA keys from MD5 to SHA-1.
@option{--no-force-v4-certs} disables this option.
@item --force-mdc
+@opindex force-mdc
Force the use of encryption with a modification detection code. This
is always used with the newer ciphers (those with a blocksize greater
than 64 bits), or if all of the recipient keys indicate MDC support in
their feature flags.
@item --disable-mdc
+@opindex disable-mdc
Disable the use of the modification detection code. Note that by
using this option, the encrypted message becomes vulnerable to a
message modification attack.
@item --personal-cipher-preferences @code{string}
+@opindex personal-cipher-preferences
Set the list of personal cipher preferences to @code{string}. Use
@command{@gpgname --version} to get a list of available algorithms,
and use @code{none} to set no preference at all. This allows the user
@@ -2038,6 +2126,7 @@ all recipients. The most highly ranked cipher in this list is also
used for the @option{--symmetric} encryption command.
@item --personal-digest-preferences @code{string}
+@opindex personal-digest-preferences
Set the list of personal digest preferences to @code{string}. Use
@command{@gpgname --version} to get a list of available algorithms,
and use @code{none} to set no preference at all. This allows the user
@@ -2048,6 +2137,7 @@ is also used when signing without encryption
(e.g. @option{--clearsign} or @option{--sign}).
@item --personal-compress-preferences @code{string}
+@opindex personal-compress-preferences
Set the list of personal compression preferences to @code{string}.
Use @command{@gpgname --version} to get a list of available
algorithms, and use @code{none} to set no preference at all. This
@@ -2058,16 +2148,19 @@ algorithm in this list is also used when there are no recipient keys
to consider (e.g. @option{--symmetric}).
@item --s2k-cipher-algo @code{name}
+@opindex s2k-cipher-algo
Use @code{name} as the cipher algorithm used to protect secret keys.
The default cipher is CAST5. This cipher is also used for
conventional encryption if @option{--personal-cipher-preferences} and
@option{--cipher-algo} is not given.
@item --s2k-digest-algo @code{name}
+@opindex s2k-digest-algo
Use @code{name} as the digest algorithm used to mangle the passphrases.
The default algorithm is SHA-1.
@item --s2k-mode @code{n}
+@opindex s2k-mode
Selects how passphrases are mangled. If @code{n} is 0 a plain
passphrase (which is not recommended) will be used, a 1 adds a salt to
the passphrase and a 3 (the default) iterates the whole process a
@@ -2075,12 +2168,13 @@ number of times (see --s2k-count). Unless @option{--rfc1991} is used,
this mode is also used for conventional encryption.
@item --s2k-count @code{n}
+@opindex s2k-count
Specify how many times the passphrase mangling is repeated. This
-value may range between 1024 and 65011712 inclusive, and the default
-is 65536. Note that not all values in the 1024-65011712 range are
-legal and if an illegal value is selected, GnuPG will round up to the
-nearest legal value. This option is only meaningful if
-@option{--s2k-mode} is 3.
+value may range between 1024 and 65011712 inclusive. The default is
+inquired from gpg-agent. Note that not all values in the
+1024-65011712 range are legal and if an illegal value is selected,
+GnuPG will round up to the nearest legal value. This option is only
+meaningful if @option{--s2k-mode} is 3.
@end table
@@ -2186,6 +2280,7 @@ SHA224, SHA384, and SHA512 digests.
Don't make any changes (this is not completely implemented).
@item --list-only
+@opindex list-only
Changes the behaviour of some commands. This is like @option{--dry-run} but
different in some cases. The semantic of this command may be extended in
the future. Currently it only skips the actual decryption pass and
@@ -2202,22 +2297,22 @@ Select the debug level for investigating problems. @var{level} may be
a numeric value or by a keyword:
@table @code
-@item none
-No debugging at all. A value of less than 1 may be used instead of
-the keyword.
-@item basic
-Some basic debug messages. A value between 1 and 2 may be used
-instead of the keyword.
-@item advanced
-More verbose debug messages. A value between 3 and 5 may be used
-instead of the keyword.
-@item expert
-Even more detailed messages. A value between 6 and 8 may be used
-instead of the keyword.
-@item guru
-All of the debug messages you can get. A value greater than 8 may be
-used instead of the keyword. The creation of hash tracing files is
-only enabled if the keyword is used.
+ @item none
+ No debugging at all. A value of less than 1 may be used instead of
+ the keyword.
+ @item basic
+ Some basic debug messages. A value between 1 and 2 may be used
+ instead of the keyword.
+ @item advanced
+ More verbose debug messages. A value between 3 and 5 may be used
+ instead of the keyword.
+ @item expert
+ Even more detailed messages. A value between 6 and 8 may be used
+ instead of the keyword.
+ @item guru
+ All of the debug messages you can get. A value greater than 8 may be
+ used instead of the keyword. The creation of hash tracing files is
+ only enabled if the keyword is used.
@end table
How these messages are mapped to the actual debugging flags is not
@@ -2230,10 +2325,12 @@ Set debugging flags. All flags are or-ed and @var{flags} may
be given in C syntax (e.g. 0x0042).
@item --debug-all
+@opindex debug-all
Set all useful debugging flags.
@ifset gpgone
@item --debug-ccid-driver
+@opindex debug-ccid-driver
Enable debug output from the included CCID driver for smartcards.
Note that this option is only available on some system.
@end ifset
@@ -2246,39 +2343,47 @@ forth to @var{epoch} which is the number of seconds elapsed since the year
(e.g. "20070924T154812").
@item --enable-progress-filter
+@opindex enable-progress-filter
Enable certain PROGRESS status outputs. This option allows frontends
to display a progress indicator while gpg is processing larger files.
There is a slight performance overhead using it.
@item --status-fd @code{n}
+@opindex status-fd
Write special status strings to the file descriptor @code{n}.
See the file DETAILS in the documentation for a listing of them.
@item --status-file @code{file}
+@opindex status-file
Same as @option{--status-fd}, except the status data is written to file
@code{file}.
@item --logger-fd @code{n}
+@opindex logger-fd
Write log output to file descriptor @code{n} and not to STDERR.
@item --log-file @code{file}
@itemx --logger-file @code{file}
+@opindex log-file
Same as @option{--logger-fd}, except the logger data is written to file
@code{file}. Note that @option{--log-file} is only implemented for
GnuPG-2.
@item --attribute-fd @code{n}
+@opindex attribute-fd
Write attribute subpackets to the file descriptor @code{n}. This is most
useful for use with @option{--status-fd}, since the status messages are
needed to separate out the various subpackets from the stream delivered
to the file descriptor.
@item --attribute-file @code{file}
+@opindex attribute-file
Same as @option{--attribute-fd}, except the attribute data is written to
file @code{file}.
@item --comment @code{string}
@itemx --no-comments
+@opindex comment
Use @code{string} as a comment string in clear text signatures and ASCII
armored messages or keys (see @option{--armor}). The default behavior is
not to use a comment string. @option{--comment} may be repeated multiple
@@ -2290,12 +2395,16 @@ protected by the signature.
@item --emit-version
@itemx --no-emit-version
+@opindex emit-version
Force inclusion of the version string in ASCII armored output.
@option{--no-emit-version} disables this option.
@item --sig-notation @code{name=value}
@itemx --cert-notation @code{name=value}
@itemx -N, --set-notation @code{name=value}
+@opindex sig-notation
+@opindex cert-notation
+@opindex set-notation
Put the name value pair into the signature as notation data.
@code{name} must consist only of printable characters or spaces, and
must contain a '@@' character in the form keyname@@domain.example.com
@@ -2325,6 +2434,9 @@ meaningful when using the OpenPGP smartcard.
@item --sig-policy-url @code{string}
@itemx --cert-policy-url @code{string}
@itemx --set-policy-url @code{string}
+@opindex sig-policy-url
+@opindex cert-policy-url
+@opindex set-policy-url
Use @code{string} as a Policy URL for signatures (rfc2440:5.2.3.19). If
you prefix it with an exclamation mark (!), the policy URL packet will
be flagged as critical. @option{--sig-policy-url} sets a policy url for
@@ -2334,6 +2446,7 @@ signatures (certifications). @option{--set-policy-url} sets both.
The same %-expandos used for notation data are available here as well.
@item --sig-keyserver-url @code{string}
+@opindex sig-keyserver-url
Use @code{string} as a preferred keyserver URL for data signatures. If
you prefix it with an exclamation mark (!), the keyserver URL packet
will be flagged as critical.
@@ -2341,12 +2454,14 @@ will be flagged as critical.
The same %-expandos used for notation data are available here as well.
@item --set-filename @code{string}
+@opindex set-filename
Use @code{string} as the filename which is stored inside messages.
This overrides the default, which is to use the actual filename of the
file being encrypted.
@item --for-your-eyes-only
@itemx --no-for-your-eyes-only
+@opindex for-your-eyes-only
Set the `for your eyes only' flag in the message. This causes GnuPG to
refuse to save the file unless the @option{--output} option is given,
and PGP to use a "secure viewer" with a claimed Tempest-resistant font
@@ -2355,10 +2470,12 @@ to display the message. This option overrides @option{--set-filename}.
@item --use-embedded-filename
@itemx --no-use-embedded-filename
+@opindex use-embedded-filename
Try to create a file with a name as embedded in the data. This can be
a dangerous option as it allows to overwrite files. Defaults to no.
@item --cipher-algo @code{name}
+@opindex cipher-algo
Use @code{name} as cipher algorithm. Running the program with the
command @option{--version} yields a list of supported algorithms. If
this is not used the cipher algorithm is selected from the preferences
@@ -2368,6 +2485,7 @@ it allows you to violate the OpenPGP standard.
same thing.
@item --digest-algo @code{name}
+@opindex digest-algo
Use @code{name} as the message digest algorithm. Running the program
with the command @option{--version} yields a list of supported algorithms. In
general, you do not want to use this option as it allows you to
@@ -2375,6 +2493,7 @@ violate the OpenPGP standard. @option{--personal-digest-preferences} is the
safe way to accomplish the same thing.
@item --compress-algo @code{name}
+@opindex compress-algo
Use compression algorithm @code{name}. "zlib" is RFC-1950 ZLIB
compression. "zip" is RFC-1951 ZIP compression which is used by PGP.
"bzip2" is a more modern compression scheme that can compress some
@@ -2397,6 +2516,7 @@ violate the OpenPGP standard. @option{--personal-compress-preferences} is the
safe way to accomplish the same thing.
@item --cert-digest-algo @code{name}
+@opindex cert-digest-algo
Use @code{name} as the message digest algorithm used when signing a
key. Running the program with the command @option{--version} yields a
list of supported algorithms. Be aware that if you choose an algorithm
@@ -2405,17 +2525,20 @@ users will not be able to use the key signatures you make, or quite
possibly your entire key.
@item --disable-cipher-algo @code{name}
+@opindex disable-cipher-algo
Never allow the use of @code{name} as cipher algorithm.
The given name will not be checked so that a later loaded algorithm
will still get disabled.
@item --disable-pubkey-algo @code{name}
+@opindex disable-pubkey-algo
Never allow the use of @code{name} as public key algorithm.
The given name will not be checked so that a later loaded algorithm
will still get disabled.
@item --throw-keyids
@itemx --no-throw-keyids
+@opindex throw-keyids
Do not put the recipient key IDs into encrypted messages. This helps to
hide the receivers of the message and is a limited countermeasure
against traffic analysis.@footnote{Using a little social engineering
@@ -2427,6 +2550,7 @@ is essentially the same as using @option{--hidden-recipient} for all
recipients.
@item --not-dash-escaped
+@opindex not-dash-escaped
This option changes the behavior of cleartext signatures
so that they can be used for patch files. You should not
send such an armored file via email because all spaces
@@ -2437,6 +2561,7 @@ line tells GnuPG about this cleartext signature option.
@item --escape-from-lines
@itemx --no-escape-from-lines
+@opindex escape-from-lines
Because some mailers change lines starting with "From " to ">From " it
is good to handle such lines in a special way when creating cleartext
signatures to prevent the mail system from breaking the signature. Note
@@ -2444,11 +2569,13 @@ that all other PGP versions do it this way too. Enabled by
default. @option{--no-escape-from-lines} disables this option.
@item --passphrase-repeat @code{n}
+@opindex passphrase-repeat
Specify how many times @command{@gpgname} will request a new
passphrase be repeated. This is useful for helping memorize a
passphrase. Defaults to 1 repetition.
@item --passphrase-fd @code{n}
+@opindex passphrase-fd
Read the passphrase from file descriptor @code{n}. Only the first line
will be read from file descriptor @code{n}. If you use 0 for @code{n},
the passphrase will be read from STDIN. This can only be used if only
@@ -2459,6 +2586,7 @@ has also been given. This is different from @command{gpg}.
@end ifclear
@item --passphrase-file @code{file}
+@opindex passphrase-file
Read the passphrase from file @code{file}. Only the first line will
be read from file @code{file}. This can only be used if only one
passphrase is supplied. Obviously, a passphrase stored in a file is
@@ -2470,6 +2598,7 @@ has also been given. This is different from @command{gpg}.
@end ifclear
@item --passphrase @code{string}
+@opindex passphrase
Use @code{string} as the passphrase. This can only be used if only one
passphrase is supplied. Obviously, this is of very questionable
security on a multi-user system. Don't use this option if you can
@@ -2480,6 +2609,7 @@ has also been given. This is different from @command{gpg}.
@end ifclear
@item --command-fd @code{n}
+@opindex command-fd
This is a replacement for the deprecated shared-memory IPC mode.
If this option is enabled, user input on questions is not expected
from the TTY but from the given file descriptor. It should be used
@@ -2487,21 +2617,25 @@ together with @option{--status-fd}. See the file doc/DETAILS in the source
distribution for details on how to use it.
@item --command-file @code{file}
+@opindex command-file
Same as @option{--command-fd}, except the commands are read out of file
@code{file}
@item --allow-non-selfsigned-uid
@itemx --no-allow-non-selfsigned-uid
+@opindex allow-non-selfsigned-uid
Allow the import and use of keys with user IDs which are not
self-signed. This is not recommended, as a non self-signed user ID is
trivial to forge. @option{--no-allow-non-selfsigned-uid} disables.
@item --allow-freeform-uid
+@opindex allow-freeform-uid
Disable all checks on the form of the user ID while generating a new
one. This option should only be used in very special environments as
it does not ensure the de-facto standard format of user IDs.
@item --ignore-time-conflict
+@opindex ignore-time-conflict
GnuPG normally checks that the timestamps associated with keys and
signatures have plausible values. However, sometimes a signature
seems to be older than the key due to clock problems. This option
@@ -2509,6 +2643,7 @@ makes these checks just a warning. See also @option{--ignore-valid-from} for
timestamp issues on subkeys.
@item --ignore-valid-from
+@opindex ignore-valid-from
GnuPG normally does not select and use subkeys created in the future.
This option allows the use of such keys and thus exhibits the
pre-1.0.7 behaviour. You should not use this option unless there
@@ -2516,6 +2651,7 @@ is some clock problem. See also @option{--ignore-time-conflict} for timestamp
issues with signatures.
@item --ignore-crc-error
+@opindex ignore-crc-error
The ASCII armor used by OpenPGP is protected by a CRC checksum against
transmission errors. Occasionally the CRC gets mangled somewhere on
the transmission channel but the actual content (which is protected by
@@ -2523,6 +2659,7 @@ the OpenPGP protocol anyway) is still okay. This option allows GnuPG
to ignore CRC errors.
@item --ignore-mdc-error
+@opindex ignore-mdc-error
This option changes a MDC integrity protection failure into a warning.
This can be useful if a message is partially corrupt, but it is
necessary to get as much data as possible out of the corrupt message.
@@ -2530,6 +2667,7 @@ However, be aware that a MDC protection failure may also mean that the
message was tampered with intentionally by an attacker.
@item --no-default-keyring
+@opindex no-default-keyring
Do not add the default keyrings to the list of keyrings. Note that
GnuPG will not operate without any keyrings, so if you use this option
and do not provide alternate keyrings via @option{--keyring} or
@@ -2537,15 +2675,18 @@ and do not provide alternate keyrings via @option{--keyring} or
secret keyrings.
@item --skip-verify
+@opindex skip-verify
Skip the signature verification step. This may be
used to make the decryption faster if the signature
verification is not needed.
@item --with-key-data
+@opindex with-key-data
Print key listings delimited by colons (like @option{--with-colons}) and
print the public key data.
@item --fast-list-mode
+@opindex fast-list-mode
Changes the output of the list commands to work faster; this is achieved
by leaving some parts empty. Some applications don't need the user ID
and the trust information given in the listings. By using this options
@@ -2554,12 +2695,15 @@ change in future versions. If you are missing some information, don't
use this option.
@item --no-literal
+@opindex no-literal
This is not for normal use. Use the source to see for what it might be useful.
@item --set-filesize
+@opindex set-filesize
This is not for normal use. Use the source to see for what it might be useful.
@item --show-session-key
+@opindex show-session-key
Display the session key used for one message. See
@option{--override-session-key} for the counterpart of this option.
@@ -2570,6 +2714,7 @@ encrypted for one secret key. DON'T USE IT UNLESS YOU ARE REALLY
FORCED TO DO SO.
@item --override-session-key @code{string}
+@opindex override-session-key
Don't use the public key but the session key @code{string}. The format
of this string is the same as the one printed by
@option{--show-session-key}. This option is normally not used but comes
@@ -2579,12 +2724,14 @@ secret key.
@item --ask-sig-expire
@itemx --no-ask-sig-expire
+@opindex ask-sig-expire
When making a data signature, prompt for an expiration time. If this
option is not specified, the expiration time set via
@option{--default-sig-expire} is used. @option{--no-ask-sig-expire}
disables this option.
@item --default-sig-expire
+@opindex default-sig-expire
The default expiration time to use for signature expiration. Valid
values are "0" for no expiration, a number followed by the letter d
(for days), w (for weeks), m (for months), or y (for years) (for
@@ -2593,12 +2740,14 @@ date in the form YYYY-MM-DD. Defaults to "0".
@item --ask-cert-expire
@itemx --no-ask-cert-expire
+@opindex ask-cert-expire
When making a key signature, prompt for an expiration time. If this
option is not specified, the expiration time set via
@option{--default-cert-expire} is used. @option{--no-ask-cert-expire}
disables this option.
@item --default-cert-expire
+@opindex default-cert-expire
The default expiration time to use for key signature expiration.
Valid values are "0" for no expiration, a number followed by the
letter d (for days), w (for weeks), m (for months), or y (for years)
@@ -2606,10 +2755,12 @@ letter d (for days), w (for weeks), m (for months), or y (for years)
absolute date in the form YYYY-MM-DD. Defaults to "0".
@item --allow-secret-key-import
+@opindex allow-secret-key-import
This is an obsolete option and is not used anywhere.
@item --allow-multiple-messages
@item --no-allow-multiple-messages
+@opindex allow-multiple-messages
Allow processing of multiple OpenPGP messages contained in a single file
or stream. Some programs that call GPG are not prepared to deal with
multiple messages being processed together, so this option defaults to
@@ -2621,14 +2772,17 @@ workaround!
@item --enable-special-filenames
+@opindex enable-special-filenames
This options enables a mode in which filenames of the form
@file{-&n}, where n is a non-negative decimal number,
refer to the file descriptor n and not to a file with that name.
@item --no-expensive-trust-checks
+@opindex no-expensive-trust-checks
Experimental use only.
@item --preserve-permissions
+@opindex preserve-permissions
Don't change the permissions of a secret keyring back to user
read/write only. Use this option only if you really know what you are doing.
@@ -2676,6 +2830,7 @@ on the configuration file.
@ifset gpgone
@item --load-extension @code{name}
+@opindex load-extension
Load an extension module. If @code{name} does not contain a slash it is
searched for in the directory configured when GnuPG was built
(generally "/usr/local/lib/gnupg"). Extensions are not generally
@@ -2684,6 +2839,7 @@ useful anymore, and the use of this option is deprecated.
@item --show-photos
@itemx --no-show-photos
+@opindex show-photos
Causes @option{--list-keys}, @option{--list-sigs},
@option{--list-public-keys}, @option{--list-secret-keys}, and verifying
a signature to also display the photo ID attached to the key, if
@@ -2692,22 +2848,26 @@ any. See also @option{--photo-viewer}. These options are deprecated. Use
[no-]show-photos} instead.
@item --show-keyring
+@opindex show-keyring
Display the keyring name at the head of key listings to show which
keyring a given key resides on. This option is deprecated: use
@option{--list-options [no-]show-keyring} instead.
@ifset gpgone
@item --ctapi-driver @code{file}
+@opindex ctapi-driver
Use @code{file} to access the smartcard reader. The current default
is `libtowitoko.so'. Note that the use of this interface is
deprecated; it may be removed in future releases.
@end ifset
@item --always-trust
+@opindex always-trust
Identical to @option{--trust-model always}. This option is deprecated.
@item --show-notation
@itemx --no-show-notation
+@opindex show-notation
Show signature notations in the @option{--list-sigs} or @option{--check-sigs} listings
as well as when verifying a signature with a notation in it. These
options are deprecated. Use @option{--list-options [no-]show-notation}
@@ -2715,6 +2875,7 @@ and/or @option{--verify-options [no-]show-notation} instead.
@item --show-policy-url
@itemx --no-show-policy-url
+@opindex show-policy-url
Show policy URLs in the @option{--list-sigs} or @option{--check-sigs}
listings as well as when verifying a signature with a policy URL in
it. These options are deprecated. Use @option{--list-options
@@ -2740,13 +2901,13 @@ current home directory (@pxref{option --homedir}).
@table @file
-@item gpg.conf
-@cindex gpg.conf
-This is the standard configuration file read by @command{@gpgname} on
-startup. It may contain any valid long option; the leading two dashes
-may not be entered and the option may not be abbreviated. This default
-name may be changed on the command line (@pxref{option --options}).
-You should backup this file.
+ @item gpg.conf
+ @cindex gpg.conf
+ This is the standard configuration file read by @command{@gpgname} on
+ startup. It may contain any valid long option; the leading two dashes
+ may not be entered and the option may not be abbreviated. This default
+ name may be changed on the command line (@pxref{option --options}).
+ You should backup this file.
@end table
@@ -2765,33 +2926,33 @@ files; They all live in in the current home directory (@pxref{option
@table @file
-@item ~/.gnupg/secring.gpg
-The secret keyring. You should backup this file.
+ @item ~/.gnupg/secring.gpg
+ The secret keyring. You should backup this file.
-@item ~/.gnupg/secring.gpg.lock
-The lock file for the secret keyring.
+ @item ~/.gnupg/secring.gpg.lock
+ The lock file for the secret keyring.
-@item ~/.gnupg/pubring.gpg
-The public keyring. You should backup this file.
+ @item ~/.gnupg/pubring.gpg
+ The public keyring. You should backup this file.
-@item ~/.gnupg/pubring.gpg.lock
-The lock file for the public keyring.
+ @item ~/.gnupg/pubring.gpg.lock
+ The lock file for the public keyring.
-@item ~/.gnupg/trustdb.gpg
-The trust database. There is no need to backup this file; it is better
-to backup the ownertrust values (@pxref{option --export-ownertrust}).
+ @item ~/.gnupg/trustdb.gpg
+ The trust database. There is no need to backup this file; it is better
+ to backup the ownertrust values (@pxref{option --export-ownertrust}).
-@item ~/.gnupg/trustdb.gpg.lock
-The lock file for the trust database.
+ @item ~/.gnupg/trustdb.gpg.lock
+ The lock file for the trust database.
-@item ~/.gnupg/random_seed
-A file used to preserve the state of the internal random pool.
+ @item ~/.gnupg/random_seed
+ A file used to preserve the state of the internal random pool.
-@item /usr[/local]/share/gnupg/options.skel
-The skeleton options file.
+ @item /usr[/local]/share/gnupg/options.skel
+ The skeleton options file.
-@item /usr[/local]/lib/gnupg/
-Default location for extensions.
+ @item /usr[/local]/lib/gnupg/
+ Default location for extensions.
@end table
@@ -2800,41 +2961,42 @@ Operation is further controlled by a few environment variables:
@table @asis
-@item HOME
-Used to locate the default home directory.
+ @item HOME
+ Used to locate the default home directory.
-@item GNUPGHOME
-If set directory used instead of "~/.gnupg".
+ @item GNUPGHOME
+ If set directory used instead of "~/.gnupg".
-@item GPG_AGENT_INFO
-Used to locate the gpg-agent.
-@ifset gpgone
-This is only honored when @option{--use-agent} is set.
-@end ifset
-The value consists of 3 colon delimited fields: The first is the path
-to the Unix Domain Socket, the second the PID of the gpg-agent and the
-protocol version which should be set to 1. When starting the gpg-agent
-as described in its documentation, this variable is set to the correct
-value. The option @option{--gpg-agent-info} can be used to override it.
-
-@item PINENTRY_USER_DATA
-This value is passed via gpg-agent to pinentry. It is useful to convey
-extra information to a custom pinentry.
-
-@item COLUMNS
-@itemx LINES
-Used to size some displays to the full size of the screen.
-
-
-@item LANGUAGE
-Apart from its use by GNU, it is used in the W32 version to override the
-language selection done through the Registry. If used and set to a
-valid and available language name (@var{langid}), the file with the
-translation is loaded from
-@code{@var{gpgdir}/gnupg.nls/@var{langid}.mo}. Here @var{gpgdir} is the
-directory out of which the gpg binary has been loaded. If it can't be
-loaded the Registry is tried and as last resort the native Windows
-locale system is used.
+ @item GPG_AGENT_INFO
+ Used to locate the gpg-agent.
+ @ifset gpgone
+ This is only honored when @option{--use-agent} is set.
+ @end ifset
+ The value consists of 3 colon delimited fields: The first is the path
+ to the Unix Domain Socket, the second the PID of the gpg-agent and the
+ protocol version which should be set to 1. When starting the gpg-agent
+ as described in its documentation, this variable is set to the correct
+ value. The option @option{--gpg-agent-info} can be used to override it.
+
+ @item PINENTRY_USER_DATA
+ This value is passed via gpg-agent to pinentry. It is useful to convey
+ extra information to a custom pinentry.
+
+ @item COLUMNS
+ @itemx LINES
+ Used to size some displays to the full size of the screen.
+
+
+ @item LANGUAGE
+ Apart from its use by GNU, it is used in the W32 version to override the
+ language selection done through the Registry. If used and set to a
+ valid and available language name (@var{langid}), the file with the
+ translation is loaded from
+
+ @code{@var{gpgdir}/gnupg.nls/@var{langid}.mo}. Here @var{gpgdir} is the
+ directory out of which the gpg binary has been loaded. If it can't be
+ loaded the Registry is tried and as last resort the native Windows
+ locale system is used.
@end table
@@ -2993,28 +3155,28 @@ either read from stdin or given as a file on the command line.
The format of the parameter file is as follows:
@itemize @bullet
-@item Text only, line length is limited to about 1000 characters.
-@item UTF-8 encoding must be used to specify non-ASCII characters.
-@item Empty lines are ignored.
-@item Leading and trailing while space is ignored.
-@item A hash sign as the first non white space character indicates
-a comment line.
-@item Control statements are indicated by a leading percent sign, the
-arguments are separated by white space from the keyword.
-@item Parameters are specified by a keyword, followed by a colon. Arguments
-are separated by white space.
-@item
-The first parameter must be @samp{Key-Type}; control statements may be
-placed anywhere.
-@item
-The order of the parameters does not matter except for @samp{Key-Type}
-which must be the first parameter. The parameters are only used for
-the generated keyblock (primary and subkeys); parameters from previous
-sets are not used. Some syntactically checks may be performed.
-@item
-Key generation takes place when either the end of the parameter file
-is reached, the next @samp{Key-Type} parameter is encountered or at the
-control statement @samp{%commit} is encountered.
+ @item Text only, line length is limited to about 1000 characters.
+ @item UTF-8 encoding must be used to specify non-ASCII characters.
+ @item Empty lines are ignored.
+ @item Leading and trailing while space is ignored.
+ @item A hash sign as the first non white space character indicates
+ a comment line.
+ @item Control statements are indicated by a leading percent sign, the
+ arguments are separated by white space from the keyword.
+ @item Parameters are specified by a keyword, followed by a colon. Arguments
+ are separated by white space.
+ @item
+ The first parameter must be @samp{Key-Type}; control statements may be
+ placed anywhere.
+ @item
+ The order of the parameters does not matter except for @samp{Key-Type}
+ which must be the first parameter. The parameters are only used for
+ the generated keyblock (primary and subkeys); parameters from previous
+ sets are not used. Some syntactically checks may be performed.
+ @item
+ Key generation takes place when either the end of the parameter file
+ is reached, the next @samp{Key-Type} parameter is encountered or at the
+ control statement @samp{%commit} is encountered.
@end itemize
@noindent
diff --git a/doc/gpgsm.texi b/doc/gpgsm.texi
index 0de3daf4d..7bfbc9dc6 100644
--- a/doc/gpgsm.texi
+++ b/doc/gpgsm.texi
@@ -479,7 +479,6 @@ for a reason.
@item --armor
@itemx -a
@opindex armor
-@opindex -a
Create PEM encoded output. Default is binary output.
@item --base64
@@ -523,7 +522,6 @@ set; however @option{--default-key} always overrides this.
@item --local-user @var{user_id}
@item -u @var{user_id}
@opindex local-user
-@opindex -u
Set the user(s) to be used for signing. The default is the first
secret key found in the database.
diff --git a/doc/tools.texi b/doc/tools.texi
index f530c1ed1..5e9a02487 100644
--- a/doc/tools.texi
+++ b/doc/tools.texi
@@ -1193,7 +1193,6 @@ Specify the agent program to be started if none is running.
@item -S
@itemx --raw-socket @var{name}
-@opindex S
@opindex raw-socket
Connect to socket @var{name} assuming this is an Assuan style server.
Do not run any special initializations or environment checks. This may
diff --git a/doc/yat2m.c b/doc/yat2m.c
index a936fefa9..aaa7ea618 100644
--- a/doc/yat2m.c
+++ b/doc/yat2m.c
@@ -1,6 +1,6 @@
/* yat2m.c - Yet Another Texi 2 Man converter
* Copyright (C) 2005 g10 Code GmbH
- * Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2006, 2008, 2011 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,11 +29,11 @@
@end macro
@macro mansect {a}
@end macro
- @macro manpause
+ @macro manpause
@end macro
@macro mancont
@end macro
-
+
They are used by yat2m to select parts of the Texinfo which should
go into the man page. These macros need to be used without leading
left space. Processing starts after a "manpage" macro has been
@@ -72,7 +72,21 @@
extracted from one file, either using the --store or the --select
option.
-
+ If you want to indent tables in the source use this style:
+
+ @table foo
+ @item
+ @item
+ @table
+ @item
+ @end
+ @end
+
+ Don't change the indentation within a table and keep the same
+ number of white space at the start of the line. yat2m simply
+ detects the number of white spaces in front of an @item and remove
+ this number of spaces from all following lines until a new @item
+ is found or there are less spaces than for the last @item.
*/
#include <stdio.h>
@@ -97,8 +111,8 @@
static int verbose;
static int quiet;
static int debug;
-static const char *opt_source;
-static const char *opt_release;
+static const char *opt_source;
+static const char *opt_release;
static const char *opt_select;
static const char *opt_include;
static int opt_store;
@@ -148,22 +162,22 @@ struct section_buffer_s
typedef struct section_buffer_s *section_buffer_t;
/* Variable to keep info about the current page together. */
-static struct
+static struct
{
/* Filename of the current page or NULL if no page is active. Malloced. */
char *name;
/* Number of allocated elements in SECTIONS below. */
- size_t n_sections;
+ size_t n_sections;
/* Array with the data of the sections. */
- section_buffer_t sections;
+ section_buffer_t sections;
} thepage;
/* The list of standard section names. COMMANDS and ASSUAN are GnuPG
specific. */
-static const char * const standard_sections[] =
+static const char * const standard_sections[] =
{ "NAME", "SYNOPSIS", "DESCRIPTION",
"RETURN VALUE", "EXIT STATUS", "ERROR HANDLING", "ERRORS",
"COMMANDS", "OPTIONS", "USAGE", "EXAMPLES", "FILES",
@@ -286,7 +300,7 @@ isodatestring (void)
static char buffer[11+5];
struct tm *tp;
time_t atime = time (NULL);
-
+
if (atime < 0)
strcpy (buffer, "????" "-??" "-??");
else
@@ -307,7 +321,7 @@ static section_buffer_t
get_section_buffer (const char *name)
{
int i;
- section_buffer_t sect;
+ section_buffer_t sect;
/* If there is no section we put everything into the required NAME
section. Given that this is the first one listed it is likely
@@ -452,8 +466,8 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{ "sc", 0, "\\fB", "\\fR" },
{ "var", 0, "\\fI", "\\fR" },
{ "samp", 0, "\\(aq", "\\(aq" },
- { "file", 0, "\\(oq\\fI","\\fR\\(cq" },
- { "env", 0, "\\(oq\\fI","\\fR\\(cq" },
+ { "file", 0, "\\(oq\\fI","\\fR\\(cq" },
+ { "env", 0, "\\(oq\\fI","\\fR\\(cq" },
{ "acronym", 0 },
{ "dfn", 0 },
{ "option", 0, "\\fB", "\\fR" },
@@ -467,7 +481,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{ "uref", 0, "(\\fB", "\\fR)" },
{ "footnote",0, " ([", "])" },
{ "emph", 0, "\\fI", "\\fR" },
- { "w", 1 },
+ { "w", 1 },
{ "c", 5 },
{ "opindex", 1 },
{ "cpindex", 1 },
@@ -479,8 +493,8 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{ "chapheading", 0},
{ "item", 2, ".TP\n.B " },
{ "itemx", 2, ".TP\n.B " },
- { "table", 3 },
- { "itemize", 3 },
+ { "table", 3 },
+ { "itemize", 3 },
{ "bullet", 0, "* " },
{ "end", 4 },
{ "quotation",1, ".RS\n\\fB" },
@@ -504,7 +518,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
{
case 1: /* Throw away the entire line. */
s = memchr (rest, '\n', len);
- return s? (s-rest)+1 : len;
+ return s? (s-rest)+1 : len;
case 2: /* Handle @item. */
break;
case 3: /* Handle table. */
@@ -512,7 +526,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
fputs (".RS\n", fp);
/* Now throw away the entire line. */
s = memchr (rest, '\n', len);
- return s? (s-rest)+1 : len;
+ return s? (s-rest)+1 : len;
break;
case 4: /* Handle end. */
for (s=rest, n=len; n && (*s == ' ' || *s == '\t'); s++, n--)
@@ -540,7 +554,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
}
/* Now throw away the entire line. */
s = memchr (rest, '\n', len);
- return s? (s-rest)+1 : len;
+ return s? (s-rest)+1 : len;
case 5: /* Handle special comments. */
for (s=rest, n=len; n && (*s == ' ' || *s == '\t'); s++, n--)
;
@@ -552,7 +566,7 @@ proc_texi_cmd (FILE *fp, const char *command, const char *rest, size_t len,
}
/* Now throw away the entire line. */
s = memchr (rest, '\n', len);
- return s? (s-rest)+1 : len;
+ return s? (s-rest)+1 : len;
case 6:
*eol_action = 1;
break;
@@ -627,17 +641,17 @@ proc_texi_buffer (FILE *fp, const char *line, size_t len,
{
switch (*s)
{
- case '@': case '{': case '}':
- putc (*s, fp); in_cmd = 0;
+ case '@': case '{': case '}':
+ putc (*s, fp); in_cmd = 0;
break;
case ':': /* Not ending a sentence flag. */
in_cmd = 0;
break;
case '.': case '!': case '?': /* Ending a sentence. */
- putc (*s, fp); in_cmd = 0;
+ putc (*s, fp); in_cmd = 0;
break;
case ' ': case '\t': case '\n': /* Non collapsing spaces. */
- putc (*s, fp); in_cmd = 0;
+ putc (*s, fp); in_cmd = 0;
break;
default:
cmdidx = 0;
@@ -655,7 +669,7 @@ proc_texi_buffer (FILE *fp, const char *line, size_t len,
s--; len++;
in_cmd = 0;
}
- else if (cmdidx < sizeof cmdbuf -1)
+ else if (cmdidx < sizeof cmdbuf -1)
cmdbuf[cmdidx++] = *s;
else
{
@@ -734,7 +748,7 @@ write_content (FILE *fp, line_buffer_t lines)
/* fputs ("---\n", fp); */
parse_texi_line (fp, line->line, &table_level);
}
- }
+ }
}
@@ -823,7 +837,7 @@ finish_page (void)
write_content (fp, sect->lines);
}
}
-
+
}
}
@@ -856,10 +870,11 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
int in_gpgone = 0; /* Keep track of "@ifset gpgone" parts. */
int not_in_gpgone = 0; /* Keep track of "@ifclear gpgone" parts. */
int not_in_man = 0; /* Keep track of "@ifclear isman" parts. */
+ int item_indent = 0; /* How far is the current @item indented. */
/* Helper to define a macro. */
- char *macroname = NULL;
- char *macrovalue = NULL;
+ char *macroname = NULL;
+ char *macrovalue = NULL;
size_t macrovaluesize = 0;
size_t macrovalueused = 0;
@@ -879,6 +894,24 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
}
line[--n] = 0;
+ /* Kludge to allow indentation of tables. */
+ for (p=line; *p == ' ' || *p == '\t'; p++)
+ ;
+ if (*p)
+ {
+ if (*p == '@' && !strncmp (p+1, "item", 4))
+ item_indent = p - line; /* Set a new indent level. */
+ else if (p - line < item_indent)
+ item_indent = 0; /* Switch off indention. */
+
+ if (item_indent)
+ {
+ memmove (line, line+item_indent, n - item_indent + 1);
+ n -= item_indent;
+ }
+ }
+
+
if (*line == '@')
{
for (p=line+1, n=1; *p && *p != ' ' && *p != '\t'; p++)
@@ -903,7 +936,7 @@ parse_file (const char *fname, FILE *fp, char **section_name, int in_pause)
macrovalue[--macrovalueused] = 0; /* Kill the last LF. */
macrovalue[macrovalueused] = 0; /* Terminate macro. */
macrovalue = xrealloc (macrovalue, macrovalueused+1);
-
+
for (m= macrolist; m; m = m->next)
if (!strcmp (m->name, macroname))
break;
@@ -1182,7 +1215,7 @@ top_parse_file (const char *fname, FILE *fp)
}
-int
+int
main (int argc, char **argv)
{
int last_argc = -1;
@@ -1275,7 +1308,7 @@ main (int argc, char **argv)
opt_select = strrchr (*argv, '/');
if (opt_select)
opt_select++;
- else
+ else
opt_select = *argv;
argc--; argv++;
}
@@ -1299,8 +1332,8 @@ main (int argc, char **argv)
argc--; argv++;
}
}
- }
-
+ }
+
if (argc > 1)
die ("usage: " PGM " [OPTION] [FILE] (try --help for more information)\n");
diff --git a/g10/ChangeLog b/g10/ChangeLog
index be131964d..4b5f2f141 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,12 @@
+2011-09-23 Werner Koch <[email protected]>
+
+ * gpgv.c (disable_dotlock): Rename to dotlock_disable.
+ (create_dotlock): Rename to dotlock_create.
+ (destroy_dotlock): Rename to dotlock_destroy.
+ (make_dotlock): Rename to dotlock_take.
+ (release_dotlock): Rename to dotlock_release.
+ (lockfiles_remove): Rename to dotlock_remove_lockfiles.
+
2011-09-20 Werner Koch <[email protected]>
* free-packet.c (free_public_key): Allow a NULL argument.
diff --git a/g10/gpg.c b/g10/gpg.c
index 8326ee7e3..c31a55863 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -1969,7 +1969,7 @@ main (int argc, char **argv)
gnupg_init_signals (0, emergency_cleanup);
- create_dotlock(NULL); /* Register locking cleanup. */
+ dotlock_create (NULL, 0); /* Register lock file cleanup. */
opt.session_env = session_env_new ();
if (!opt.session_env)
@@ -2651,7 +2651,7 @@ main (int argc, char **argv)
case oNoEscapeFrom: opt.escape_from = 0; break;
case oLockOnce: opt.lock_once = 1; break;
case oLockNever:
- disable_dotlock ();
+ dotlock_disable ();
break;
case oLockMultiple:
#ifndef __riscos__
diff --git a/g10/gpgv.c b/g10/gpgv.c
index 9f46ab39c..8ca675289 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -163,7 +163,7 @@ main( int argc, char **argv )
tty_no_terminal(1);
tty_batchmode(1);
- disable_dotlock();
+ dotlock_disable ();
pargs.argc = &argc;
pargs.argv = &argv;
@@ -502,25 +502,26 @@ agent_scd_getattr (const char *name, struct agent_card_info_s *info)
/* We do not do any locking, so use these stubs here */
void
-disable_dotlock (void)
+dotlock_disable (void)
{
}
dotlock_t
-create_dotlock (const char *file_to_lock)
+dotlock_create (const char *file_to_lock, unsigned int flags)
{
(void)file_to_lock;
+ (void)flags;
return NULL;
}
void
-destroy_dotlock (dotlock_t h)
+dotlock_destroy (dotlock_t h)
{
(void)h;
}
int
-make_dotlock (dotlock_t h, long timeout)
+dotlock_take (dotlock_t h, long timeout)
{
(void)h;
(void)timeout;
@@ -528,14 +529,14 @@ make_dotlock (dotlock_t h, long timeout)
}
int
-release_dotlock (dotlock_t h)
+dotlock_release (dotlock_t h)
{
(void)h;
return 0;
}
void
-remove_lockfiles (void)
+dotlock_remove_lockfiles (void)
{
}
diff --git a/g10/keydb.c b/g10/keydb.c
index f7642485a..9b9b2ed5f 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -136,7 +136,7 @@ maybe_create_keyring (char *filename, int force)
/* To avoid races with other instances of gpg trying to create or
update the keyring (it is removed during an update for a short
time), we do the next stuff in a locked state. */
- lockhd = create_dotlock (filename);
+ lockhd = dotlock_create (filename, 0);
if (!lockhd)
{
/* A reason for this to fail is that the directory is not
@@ -152,7 +152,7 @@ maybe_create_keyring (char *filename, int force)
return gpg_error (GPG_ERR_GENERAL);
}
- if ( make_dotlock (lockhd, -1) )
+ if ( dotlock_take (lockhd, -1) )
{
/* This is something bad. Probably a stale lockfile. */
log_info ("can't lock `%s'\n", filename );
@@ -196,8 +196,8 @@ maybe_create_keyring (char *filename, int force)
leave:
if (lockhd)
{
- release_dotlock (lockhd);
- destroy_dotlock (lockhd);
+ dotlock_release (lockhd);
+ dotlock_destroy (lockhd);
}
return rc;
}
diff --git a/g10/keyring.c b/g10/keyring.c
index 12356e23c..4eb26aab6 100644
--- a/g10/keyring.c
+++ b/g10/keyring.c
@@ -306,7 +306,7 @@ keyring_lock (KEYRING_HANDLE hd, int yes)
if (!keyring_is_writable(kr))
continue;
if (!kr->lockhd) {
- kr->lockhd = create_dotlock( kr->fname );
+ kr->lockhd = dotlock_create (kr->fname, 0);
if (!kr->lockhd) {
log_info ("can't allocate lock for `%s'\n", kr->fname );
rc = G10ERR_GENERAL;
@@ -322,7 +322,7 @@ keyring_lock (KEYRING_HANDLE hd, int yes)
continue;
if (kr->is_locked)
;
- else if (make_dotlock (kr->lockhd, -1) ) {
+ else if (dotlock_take (kr->lockhd, -1) ) {
log_info ("can't lock `%s'\n", kr->fname );
rc = G10ERR_GENERAL;
}
@@ -337,7 +337,7 @@ keyring_lock (KEYRING_HANDLE hd, int yes)
continue;
if (!kr->is_locked)
;
- else if (release_dotlock (kr->lockhd))
+ else if (dotlock_release (kr->lockhd))
log_info ("can't unlock `%s'\n", kr->fname );
else
kr->is_locked = 0;
diff --git a/g10/tdbio.c b/g10/tdbio.c
index 09f31aa5d..1ab11f2e7 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -257,7 +257,7 @@ put_record_into_cache( ulong recno, const char *data )
if( !n )
n = 1;
if( !is_locked ) {
- if( make_dotlock( lockhandle, -1 ) )
+ if( dotlock_take( lockhandle, -1 ) )
log_fatal("can't acquire lock - giving up\n");
else
is_locked = 1;
@@ -276,7 +276,7 @@ put_record_into_cache( ulong recno, const char *data )
}
}
if( !opt.lock_once ) {
- if( !release_dotlock( lockhandle ) )
+ if( !dotlock_release( lockhandle ) )
is_locked = 0;
}
assert( unused );
@@ -318,7 +318,7 @@ tdbio_sync()
return 0;
if( !is_locked ) {
- if( make_dotlock( lockhandle, -1 ) )
+ if( dotlock_take( lockhandle, -1 ) )
log_fatal("can't acquire lock - giving up\n");
else
is_locked = 1;
@@ -333,7 +333,7 @@ tdbio_sync()
}
cache_is_dirty = 0;
if( did_lock && !opt.lock_once ) {
- if( !release_dotlock( lockhandle ) )
+ if( !dotlock_release (lockhandle) )
is_locked = 0;
}
@@ -373,7 +373,7 @@ tdbio_end_transaction()
if( !in_transaction )
log_bug("tdbio: no active transaction\n");
if( !is_locked ) {
- if( make_dotlock( lockhandle, -1 ) )
+ if( dotlock_take( lockhandle, -1 ) )
log_fatal("can't acquire lock - giving up\n");
else
is_locked = 1;
@@ -383,7 +383,7 @@ tdbio_end_transaction()
rc = tdbio_sync();
unblock_all_signals();
if( !opt.lock_once ) {
- if( !release_dotlock( lockhandle ) )
+ if( !dotlock_release (lockhandle) )
is_locked = 0;
}
return rc;
@@ -423,7 +423,7 @@ static void
cleanup(void)
{
if( is_locked ) {
- if( !release_dotlock(lockhandle) )
+ if( !dotlock_release (lockhandle) )
is_locked = 0;
}
}
@@ -544,10 +544,10 @@ tdbio_set_dbname( const char *new_dbname, int create )
db_name = fname;
#ifdef __riscos__
if( !lockhandle )
- lockhandle = create_dotlock( db_name );
+ lockhandle = dotlock_create (db_name, 0);
if( !lockhandle )
log_fatal( _("can't create lock for `%s'\n"), db_name );
- if( make_dotlock( lockhandle, -1 ) )
+ if( dotlock_make (lockhandle, -1) )
log_fatal( _("can't lock `%s'\n"), db_name );
#endif /* __riscos__ */
oldmask=umask(077);
@@ -567,7 +567,7 @@ tdbio_set_dbname( const char *new_dbname, int create )
#ifndef __riscos__
if( !lockhandle )
- lockhandle = create_dotlock( db_name );
+ lockhandle = dotlock_create (db_name, 0);
if( !lockhandle )
log_fatal( _("can't create lock for `%s'\n"), db_name );
#endif /* !__riscos__ */
@@ -608,11 +608,11 @@ open_db()
assert( db_fd == -1 );
if (!lockhandle )
- lockhandle = create_dotlock( db_name );
+ lockhandle = dotlock_create (db_name, 0);
if (!lockhandle )
log_fatal( _("can't create lock for `%s'\n"), db_name );
#ifdef __riscos__
- if (make_dotlock( lockhandle, -1 ) )
+ if (dotlock_take (lockhandle, -1) )
log_fatal( _("can't lock `%s'\n"), db_name );
#endif /* __riscos__ */
#ifdef HAVE_W32CE_SYSTEM
diff --git a/g13/create.c b/g13/create.c
index 2b998e2b2..f907ddbf6 100644
--- a/g13/create.c
+++ b/g13/create.c
@@ -246,10 +246,10 @@ g13_create_container (ctrl_t ctrl, const char *filename, strlist_t keys)
/* Take a lock and proceed with the creation. If there is a lock we
immediately return an error because for creation it does not make
sense to wait. */
- lock = create_dotlock (filename);
+ lock = dotlock_create (filename, 0);
if (!lock)
return gpg_error_from_syserror ();
- if (make_dotlock (lock, 0))
+ if (dotlock_take (lock, 0))
{
err = gpg_error_from_syserror ();
goto leave;
@@ -319,7 +319,7 @@ g13_create_container (ctrl_t ctrl, const char *filename, strlist_t keys)
xfree (detachedname);
xfree (enckeyblob);
xfree (keyblob);
- destroy_dotlock (lock);
+ dotlock_destroy (lock);
return err;
}
diff --git a/g13/g13.c b/g13/g13.c
index 72280c9d5..b3603ccaf 100644
--- a/g13/g13.c
+++ b/g13/g13.c
@@ -365,7 +365,7 @@ main ( int argc, char **argv)
gnupg_init_signals (0, emergency_cleanup);
- create_dotlock (NULL); /* Register locking cleanup. */
+ dotlock_create (NULL, 0); /* Register locking cleanup. */
opt.session_env = session_env_new ();
if (!opt.session_env)
diff --git a/g13/mount.c b/g13/mount.c
index 387bb6f32..62eeca1f7 100644
--- a/g13/mount.c
+++ b/g13/mount.c
@@ -273,14 +273,14 @@ g13_mount_container (ctrl_t ctrl, const char *filename, const char *mountpoint)
}
/* Try to take a lock. */
- lock = create_dotlock (filename);
+ lock = dotlock_create (filename, 0);
if (!lock)
{
xfree (mountpoint_buffer);
return gpg_error_from_syserror ();
}
- if (make_dotlock (lock, 0))
+ if (dotlock_take (lock, 0))
{
err = gpg_error_from_syserror ();
goto leave;
@@ -359,7 +359,7 @@ g13_mount_container (ctrl_t ctrl, const char *filename, const char *mountpoint)
destroy_tupledesc (tuples);
xfree (keyblob);
xfree (enckeyblob);
- destroy_dotlock (lock);
+ dotlock_destroy (lock);
xfree (mountpoint_buffer);
return err;
}
diff --git a/po/de.po b/po/de.po
index dab6c5739..5f80e0998 100644
--- a/po/de.po
+++ b/po/de.po
@@ -128,16 +128,28 @@ msgid "error writing key: %s\n"
msgstr "Fehler beim Schreiben des Schlüssels: %s\n"
#, c-format
-msgid "Please enter the passphrase for the ssh key%0A %c"
+msgid ""
+"An ssh process requested the use of key%%0A %s%%0A (%s)%%0ADo you want to "
+"allow this?"
+msgstr ""
+
+msgid "Allow"
+msgstr ""
+
+msgid "Deny"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "Please enter the passphrase for the ssh key%%0A %F%%0A (%c)"
msgstr "Bitte geben Sie die Passphrase für den SSH-Schlüssel %0A %c ein."
msgid "Please re-enter this passphrase"
msgstr "Bitte geben Sie die Passphrase noch einmal ein:"
-#, c-format
+#, fuzzy, c-format
msgid ""
-"Please enter a passphrase to protect the received secret key%%0A %s%%"
-"0Awithin gpg-agent's key storage"
+"Please enter a passphrase to protect the received secret key%%0A %s%%0A %"
+"s%%0Awithin gpg-agent's key storage"
msgstr ""
"Bitte geben Sie eine Passphrase ein, um den empfangenen geheimen Schlüssel%%"
"0A %s%%0A im Schlüsselspeicher des gpg-agenten zu schützen."
@@ -1034,9 +1046,6 @@ msgstr "Fehler beim Schreiben von %s: %s\n"
msgid "removing stale lockfile (created by %d)\n"
msgstr "eine übriggebliebene Sperrdatei wird entfernt (erzeugt von %d)\n"
-msgid " - probably dead - removing lock"
-msgstr " - existiert wahrscheinlich nicht mehr - entferne Sperre"
-
#, c-format
msgid "waiting for lock (held by %d%s) %s...\n"
msgstr "warte auf die Freigabe der Sperre (gehalten von %d%s) %s...\n"
@@ -1428,6 +1437,10 @@ msgstr "Diesen Schlüssel aus dem Schlüsselbund löschen? (j/N) "
msgid "This is a secret key! - really delete? (y/N) "
msgstr "Dies ist ein privater Schlüssel! - Wirklich löschen? (j/N) "
+#, fuzzy
+msgid "deleting secret key not implemented\n"
+msgstr "Exportieren geheimer Schlüssel ist nicht erlaubt\n"
+
#, c-format
msgid "deleting keyblock failed: %s\n"
msgstr "löschen des Schlüsselblocks fehlgeschlagen: %s\n"
@@ -2522,10 +2535,6 @@ msgid "importing secret keys not allowed\n"
msgstr "Importieren geheimer Schlüssel ist nicht erlaubt\n"
#, c-format
-msgid "key %s: secret key part already available\n"
-msgstr "Schlüssel %s: Die geheimen Teile sind bereits vorhanden\n"
-
-#, c-format
msgid "key %s: no public key - can't apply revocation certificate\n"
msgstr ""
"Schlüssel %s: Kein öffentlicher Schlüssel - der Schlüsselwiderruf kann nicht "
@@ -7666,6 +7675,25 @@ msgstr "Liste der LDAP Server"
msgid "Configuration for OCSP"
msgstr "Konfiguration zu OCSP"
+msgid "GPG for OpenPGP"
+msgstr ""
+
+msgid "GPG Agent"
+msgstr ""
+
+msgid "Smartcard Daemon"
+msgstr ""
+
+msgid "GPG for S/MIME"
+msgstr ""
+
+msgid "Directory Manager"
+msgstr ""
+
+#, fuzzy
+msgid "PIN and Passphrase Entry"
+msgstr "Falsche Passphrase!"
+
#, c-format
msgid "External verification of component %s failed"
msgstr "Die externe Überprüfung der Komponente %s war nicht erfolgreich"
@@ -7878,6 +7906,12 @@ msgstr ""
"Syntax: gpg-check-pattern [optionen] Musterdatei\n"
"Die von stdin gelesene Passphrase gegen die Musterdatei prüfen\n"
+#~ msgid " - probably dead - removing lock"
+#~ msgstr " - existiert wahrscheinlich nicht mehr - entferne Sperre"
+
+#~ msgid "key %s: secret key part already available\n"
+#~ msgstr "Schlüssel %s: Die geheimen Teile sind bereits vorhanden\n"
+
#~ msgid "self-signed certificate"
#~ msgstr "eigenbeglaubigtes Zertifikat"
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index f08e0f80f..dc9f2e032 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -928,7 +928,7 @@ main ( int argc, char **argv)
gnupg_init_signals (0, emergency_cleanup);
- create_dotlock (NULL); /* register locking cleanup */
+ dotlock_create (NULL, 0); /* Register lockfile cleanup. */
opt.session_env = session_env_new ();
if (!opt.session_env)
diff --git a/sm/keydb.c b/sm/keydb.c
index fe5d0e741..86301b337 100644
--- a/sm/keydb.c
+++ b/sm/keydb.c
@@ -214,12 +214,12 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created)
all_resources[used_resources].secret = secret;
all_resources[used_resources].lockhandle
- = create_dotlock (filename);
+ = dotlock_create (filename, 0);
if (!all_resources[used_resources].lockhandle)
log_fatal ( _("can't create lock for `%s'\n"), filename);
/* Do a compress run if needed and the file is not locked. */
- if (!make_dotlock (all_resources[used_resources].lockhandle, 0))
+ if (!dotlock_take (all_resources[used_resources].lockhandle, 0))
{
KEYBOX_HANDLE kbxhd = keybox_new (token, secret);
@@ -228,7 +228,7 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created)
keybox_compress (kbxhd);
keybox_release (kbxhd);
}
- release_dotlock (all_resources[used_resources].lockhandle);
+ dotlock_release (all_resources[used_resources].lockhandle);
}
used_resources++;
@@ -421,7 +421,7 @@ lock_all (KEYDB_HANDLE hd)
break;
case KEYDB_RESOURCE_TYPE_KEYBOX:
if (hd->active[i].lockhandle)
- rc = make_dotlock (hd->active[i].lockhandle, -1);
+ rc = dotlock_take (hd->active[i].lockhandle, -1);
break;
}
if (rc)
@@ -439,7 +439,7 @@ lock_all (KEYDB_HANDLE hd)
break;
case KEYDB_RESOURCE_TYPE_KEYBOX:
if (hd->active[i].lockhandle)
- release_dotlock (hd->active[i].lockhandle);
+ dotlock_release (hd->active[i].lockhandle);
break;
}
}
@@ -469,7 +469,7 @@ unlock_all (KEYDB_HANDLE hd)
break;
case KEYDB_RESOURCE_TYPE_KEYBOX:
if (hd->active[i].lockhandle)
- release_dotlock (hd->active[i].lockhandle);
+ dotlock_release (hd->active[i].lockhandle);
break;
}
}