[gnome-keyring] daemon: Add new --unlock option to prompt for login password
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring] daemon: Add new --unlock option to prompt for login password
- Date: Wed, 5 Mar 2014 12:05:46 +0000 (UTC)
commit ed727e39f52069176ca0325d8f51f3f4e7e2cc3e
Author: Stef Walter <stefw gnome org>
Date: Tue Oct 15 15:35:03 2013 +0200
daemon: Add new --unlock option to prompt for login password
https://bugzilla.gnome.org/show_bug.cgi?id=710187
daemon/gkd-main.c | 18 ++++++++++++++++--
docs/gnome-keyring-daemon.xml | 11 ++++++++++-
2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index 2fe38e2..57d3288 100644
--- a/daemon/gkd-main.c
+++ b/daemon/gkd-main.c
@@ -118,6 +118,7 @@ static gboolean run_foreground = FALSE;
static gboolean run_daemonized = FALSE;
static gboolean run_version = FALSE;
static gboolean run_for_login = FALSE;
+static gboolean perform_unlock = FALSE;
static gboolean run_for_start = FALSE;
static gboolean run_for_replace = FALSE;
static gchar* login_password = NULL;
@@ -138,6 +139,8 @@ static GOptionEntry option_entries[] = {
"Run as a daemon", NULL },
{ "login", 'l', 0, G_OPTION_ARG_NONE, &run_for_login,
"Run by PAM for a user login. Read login password from stdin", NULL },
+ { "unlock", 0, 0, G_OPTION_ARG_NONE, &perform_unlock,
+ "Prompt for login keyring password, or read from stdin", NULL },
{ "components", 'c', 0, G_OPTION_ARG_STRING, &run_components,
"The optional components to run", DEFAULT_COMPONENTS },
{ "control-directory", 'C', 0, G_OPTION_ARG_FILENAME, &control_directory,
@@ -184,6 +187,14 @@ parse_arguments (int *argc, char** argv[])
run_for_start = FALSE;
}
+ if (run_for_start && perform_unlock) {
+ g_printerr ("gnome-keyring-daemon: The --start option is incompatible with --unlock");
+ perform_unlock = FALSE;
+ }
+
+ if (run_for_login)
+ perform_unlock = TRUE;
+
g_option_context_free (context);
}
@@ -978,10 +989,13 @@ main (int argc, char *argv[])
if (!gkd_control_listen ())
return FALSE;
- /* The --login option. Delayed initialization */
- if (run_for_login) {
+ if (perform_unlock) {
login_password = read_login_password (STDIN);
atexit (clear_login_password);
+ }
+
+ /* The --login option. Delayed initialization */
+ if (run_for_login) {
timeout_id = g_timeout_add_seconds (LOGIN_TIMEOUT, (GSourceFunc) on_login_timeout, NULL);
/* Not a login daemon. Startup stuff now.*/
diff --git a/docs/gnome-keyring-daemon.xml b/docs/gnome-keyring-daemon.xml
index a4019c2..9353391 100644
--- a/docs/gnome-keyring-daemon.xml
+++ b/docs/gnome-keyring-daemon.xml
@@ -96,7 +96,8 @@
<para>The daemon should later be initialized with a
<command>gnome-keyring-daemon</command> <option>--start</option>
invocation.</para>
- <para>This option may not be used together with either the
+ <para>This option implies <option>--unlock</option>. It
+ may not be used together with either the
<option>--replace</option> or <option>--start</option>
arguments.</para>
</listitem>
@@ -126,6 +127,14 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--unlock</option></term>
+ <listitem>
+ <para>Read a password from stdin, and use it to unlock the
+ login keyring or create it if the login keyring does not
+ exist.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>-V</option>, <option>--version</option></term>
<listitem>
<para>Print out the gnome-keyring version and then exit.</para>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]