Add --reload command to gpgconf.

Fix a problem in exechelp.c
Get ready for a release.
This commit is contained in:
Werner Koch 2009-03-03 09:02:58 +00:00
parent b61b2f542a
commit c20b3db108
42 changed files with 6590 additions and 6466 deletions

View File

@ -1,3 +1,7 @@
2009-03-03 Werner Koch <wk@g10code.com>
Release 2.0.11.
2009-01-12 Werner Koch <wk@g10code.com>
Release 2.0.10.

4
NEWS
View File

@ -1,4 +1,4 @@
Noteworthy changes in version 2.0.11 (unreleased)
Noteworthy changes in version 2.0.11 (2009-03-03)
-------------------------------------------------
* Fixed a problem in SCDAEMON which caused unexpected card resets.
@ -7,6 +7,8 @@ Noteworthy changes in version 2.0.11 (unreleased)
* The SCDAEMON option --allow-admin is now used by default.
* GPGCONF now restarts SCdaemon if necessary.
* The default cipher algorithm in GPGSM is now again 3DES. This is
due to interoperability problems with Outlook 2003 which still
can't cope with AES.

View File

@ -1,5 +1,9 @@
2009-03-02 Werner Koch <wk@g10code.com>
* command.c (cmd_getinfo): Add subcommand "scd_running".
* call-scd.c (agent_scd_check_running): New.
* gpg-agent.c: Add missing option strings for "--batch" and
"--homedir". Reported by Petr Uzel.

View File

@ -320,6 +320,7 @@ int divert_generic_cmd (ctrl_t ctrl,
/*-- call-scd.c --*/
void initialize_module_call_scd (void);
void agent_scd_dump_state (void);
int agent_scd_check_running (void);
void agent_scd_check_aliveness (void);
int agent_reset_scd (ctrl_t ctrl);
int agent_card_learn (ctrl_t ctrl,

View File

@ -409,6 +409,16 @@ start_scd (ctrl_t ctrl)
}
/* Check whether the SCdaemon is active. This is a fast check without
any locking and might give a wrong result if another thread is about
to start the daemon or the daemon is about to be stopped.. */
int
agent_scd_check_running (void)
{
return !!primary_scd_ctx;
}
/* Check whether the Scdaemon is still alive and clean it up if not. */
void
agent_scd_check_aliveness (void)

View File

@ -1396,7 +1396,7 @@ cmd_reloadagent (assuan_context_t ctx, char *line)
pid - Return the process id of the server.
socket_name - Return the name of the socket.
ssh_socket_name - Return the name of the ssh socket.
scd_running - Return OK if the SCdaemon is already running.
*/
static int
cmd_getinfo (assuan_context_t ctx, char *line)
@ -1433,6 +1433,10 @@ cmd_getinfo (assuan_context_t ctx, char *line)
else
rc = gpg_error (GPG_ERR_NO_DATA);
}
else if (!strcmp (line, "scd_running"))
{
rc = agent_scd_check_running ()? 0 : gpg_error (GPG_ERR_GENERAL);
}
else
rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");
return rc;

View File

@ -2022,7 +2022,7 @@ check_own_socket_thread (void *arg)
log_error ("socket is now serviced by another server\n");
rc = 1;
}
else if (opt.verbose)
else if (opt.verbose > 1)
log_error ("socket is still served by this server\n");
xfree (buffer);

View File

@ -1,3 +1,8 @@
2009-03-03 Werner Koch <wk@g10code.com>
* exechelp.c (do_exec): Make sure that /dev/null connected FDs are
not closed.
2009-01-19 Werner Koch <wk@g10code.com>
* audit.c (writeout_li): Translate a few more result strings.

View File

@ -238,7 +238,7 @@ do_exec (const char *pgmname, const char *argv[],
for (i=0,j=1; argv[i]; i++, j++)
arg_list[j] = (char*)argv[i];
/* Connect the standard files. */
/* Assign /dev/null to unused FDs. */
for (i=0; i <= 2; i++)
{
if (fds[i] == -1 )
@ -248,7 +248,12 @@ do_exec (const char *pgmname, const char *argv[],
log_fatal ("failed to open `%s': %s\n",
"/dev/null", strerror (errno));
}
else if (fds[i] != i && dup2 (fds[i], i) == -1)
}
/* Connect the standard files. */
for (i=0; i <= 2; i++)
{
if (fds[i] != i && dup2 (fds[i], i) == -1)
log_fatal ("dup2 std%s failed: %s\n",
i==0?"in":i==1?"out":"err", strerror (errno));
}

View File

@ -25,7 +25,7 @@ min_automake_version="1.10"
# Set my_issvn to "yes" for non-released code. Remember to run an
# "svn up" and "autogen.sh" right before creating a distribution.
m4_define([my_version], [2.0.11])
m4_define([my_issvn], [yes])
m4_define([my_issvn], [no])
m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \
| sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)]))

View File

@ -1023,7 +1023,7 @@ show_version ()
fputs (strusage (11), stdout);
if ((s=strusage (12)))
printf (" (%s)", s );
printf (" %s\n", strusage (13) );
printf (" %s %s\n", strusage (13), "(Gpg4win @PACKAGE_VERSION@)");
/* Additional version lines. */
for (i=20; i < 30; i++)
if ((s=strusage (i)))

478
po/be.po

File diff suppressed because it is too large Load Diff

478
po/ca.po

File diff suppressed because it is too large Load Diff

478
po/cs.po

File diff suppressed because it is too large Load Diff

478
po/da.po

File diff suppressed because it is too large Load Diff

478
po/de.po

File diff suppressed because it is too large Load Diff

478
po/el.po

File diff suppressed because it is too large Load Diff

478
po/eo.po

File diff suppressed because it is too large Load Diff

478
po/es.po

File diff suppressed because it is too large Load Diff

478
po/et.po

File diff suppressed because it is too large Load Diff

478
po/fi.po

File diff suppressed because it is too large Load Diff

478
po/fr.po

File diff suppressed because it is too large Load Diff

478
po/gl.po

File diff suppressed because it is too large Load Diff

478
po/hu.po

File diff suppressed because it is too large Load Diff

478
po/id.po

File diff suppressed because it is too large Load Diff

478
po/it.po

File diff suppressed because it is too large Load Diff

478
po/ja.po

File diff suppressed because it is too large Load Diff

478
po/nb.po

File diff suppressed because it is too large Load Diff

478
po/pl.po

File diff suppressed because it is too large Load Diff

478
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

478
po/ro.po

File diff suppressed because it is too large Load Diff

478
po/ru.po

File diff suppressed because it is too large Load Diff

478
po/sk.po

File diff suppressed because it is too large Load Diff

478
po/sv.po

File diff suppressed because it is too large Load Diff

478
po/tr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,14 @@
2009-03-03 Werner Koch <wk@g10code.com>
* gpgconf.c: New command --reload.
* gpgconf-comp.c (gc_component_reload): New.
2009-03-02 Werner Koch <wk@g10code.com>
* gpgconf-comp.c (scdaemon_runtime_change): Killsc d only if it is
not running.
2009-02-27 Werner Koch <wk@g10code.com>
* gpgconf-comp.c (gpg_agent_runtime_change): Declare static.

View File

@ -1,5 +1,5 @@
/* gpgconf-comp.c - Configuration utility for GnuPG.
* Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
* Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -1051,12 +1051,21 @@ scdaemon_runtime_change (void)
{
gpg_error_t err;
const char *pgmname;
const char *argv[2];
const char *argv[6];
pid_t pid;
/* We use "GETINFO app_running" to see whether the agent is already
running and kill it only in this case. This avoids an explicit
starting of the agent in case it is not yet running. There is
obviously a race condition but that should not harm too much. */
pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);
argv[0] = "scd killscd";
argv[1] = NULL;
argv[0] = "-s";
argv[1] = "GETINFO scd_running";
argv[2] = "/if ${! $?}";
argv[3] = "scd killscd";
argv[4] = "/end";
argv[5] = NULL;
err = gnupg_spawn_process_fd (pgmname, argv, -1, -1, -1, &pid);
if (!err)
@ -1067,6 +1076,44 @@ scdaemon_runtime_change (void)
}
/* Unconditionally reload COMPONENT or all components if COMPONENT is -1. */
void
gc_component_reload (int component)
{
int runtime[GC_BACKEND_NR];
gc_option_t *option;
gc_backend_t backend;
/* Set a flag for the backends to be reloaded. */
for (backend = 0; backend < GC_BACKEND_NR; backend++)
runtime[backend] = 0;
if (component == -1)
{
for (component = 0; component < GC_COMPONENT_NR; component++)
{
option = gc_component[component].options;
for (; option && option->name; option++)
runtime[option->backend] = 1;
}
}
else
{
assert (component < GC_COMPONENT_NR);
option = gc_component[component].options;
for (; option && option->name; option++)
runtime[option->backend] = 1;
}
/* Do the reload for all selected backends. */
for (backend = 0; backend < GC_BACKEND_NR; backend++)
{
if (runtime[backend] && gc_backend[backend].runtime_change)
(*gc_backend[backend].runtime_change) ();
}
}
/* More or less Robust version of dgettext. It has the side effect of
switching the codeset to utf-8 because this is what we want to

View File

@ -1,5 +1,5 @@
/* gpgconf.c - Configuration utility for GnuPG
* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
* Copyright (C) 2003, 2007, 2009 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -47,7 +47,8 @@ enum cmd_and_opt_values
aApplyDefaults,
aListConfig,
aCheckConfig,
aListDirs
aListDirs,
aReload
};
@ -70,6 +71,7 @@ static ARGPARSE_OPTS opts[] =
N_("list global configuration file") },
{ aCheckConfig, "check-config", 256,
N_("check global configuration file") },
{ aReload, "reload", 256, "@" },
{ 301, NULL, 0, N_("@\nOptions:\n ") },
@ -176,6 +178,7 @@ main (int argc, char **argv)
case aApplyDefaults:
case aListConfig:
case aCheckConfig:
case aReload:
cmd = pargs.r_opt;
break;
@ -233,6 +236,31 @@ main (int argc, char **argv)
}
break;
case aReload:
if (!fname)
{
/* Reload all. */
gc_component_reload (-1);
}
else
{
/* Reload given component. */
int idx;
idx = gc_component_find (fname);
if (idx < 0)
{
fputs (_("Component not found"), stderr);
putc ('\n', stderr);
exit (1);
}
else
{
gc_component_reload (idx);
}
}
break;
case aListConfig:
if (gc_process_gpgconf_conf (fname, 0, 0, get_outfp (&outfp)))
exit (1);

View File

@ -44,6 +44,9 @@ char *gc_percent_escape (const char *src);
void gc_error (int status, int errnum, const char *fmt, ...);
/* Reload given component. */
void gc_component_reload (int component);
/* List all components that are available. */
void gc_component_list_components (FILE *out);