All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthijs Kooijman <matthijs@stdin.nl>
To: git@vger.kernel.org
Cc: Eric Wong <normalperson@yhbt.net>,
	Gustav Munkby <grddev@gmail.com>,
	Edward Rudd <urkle@outoforder.cc>, Carsten Bormann <cabo@tzi.org>,
	Matthijs Kooijman <matthijs@stdin.nl>
Subject: [PATCH] git-svn: Configure a prompt callback for gnome_keyring.
Date: Tue, 18 Jun 2013 18:38:10 +0200	[thread overview]
Message-ID: <1371573490-21973-1-git-send-email-matthijs@stdin.nl> (raw)
In-Reply-To: <20130618163609.GD10217@login.drsnuggles.stderr.nl>

This allows git-svn to prompt for a keyring unlock password, when a
the needed gnome keyring is locked.

This requires changes in the subversion perl bindings which have been
committed to svn trunk (r1241554 and some followup commits) and are
first available in the 1.8.0 release.
---
 perl/Git/SVN/Prompt.pm |  5 +++++
 perl/Git/SVN/Ra.pm     | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/perl/Git/SVN/Prompt.pm b/perl/Git/SVN/Prompt.pm
index e940b08..faeda01 100644
--- a/perl/Git/SVN/Prompt.pm
+++ b/perl/Git/SVN/Prompt.pm
@@ -23,6 +23,11 @@ sub simple {
 	$SVN::_Core::SVN_NO_ERROR;
 }
 
+sub gnome_keyring_unlock {
+	my ($keyring, $pool) = @_;
+	_read_password("Password for '$keyring' GNOME keyring: ", undef);
+}
+
 sub ssl_server_trust {
 	my ($cred, $realm, $failures, $cert_info, $may_save, $pool) = @_;
 	$may_save = undef if $_no_auth_cache;
diff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm
index 75ecc42..38ed0cb 100644
--- a/perl/Git/SVN/Ra.pm
+++ b/perl/Git/SVN/Ra.pm
@@ -104,6 +104,19 @@ sub new {
 		}
 	} # no warnings 'once'
 
+	# Allow git-svn to show a prompt for opening up a gnome-keyring, if needed.
+	if (defined(&SVN::Core::auth_set_gnome_keyring_unlock_prompt_func)) {
+		my $keyring_callback = SVN::Core::auth_set_gnome_keyring_unlock_prompt_func(
+			$baton,
+			\&Git::SVN::Prompt::gnome_keyring_unlock
+		);
+		# Keep a reference to this callback, to prevent the function
+		# (reference) from being garbage collected.  We just add it to
+		# the callbacks value, which are also used only to prevent the
+		# garbage collector from eating stuff.
+		$callbacks = [$callbacks, $keyring_callback]
+	}
+
 	my $self = SVN::Ra->new(url => $url, auth => $baton,
 	                      config => $config,
 			      pool => SVN::Pool->new,
-- 
1.8.3.rc1

  reply	other threads:[~2013-06-18 16:38 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-18  0:36 git-svn won't remember pem password Igor
2012-02-18 11:30 ` Jakub Narebski
2012-02-19  4:03   ` Nikolaus Demmel
2012-02-20  0:57   ` Jeff King
2012-02-20  3:08     ` Nikolaus Demmel
2012-02-19  1:30 ` Eric Wong
2012-04-26 18:00   ` Matthijs Kooijman
     [not found]     ` <41A093CB-CA4A-4FEF-9F5C-A9B626D10AFB@gmail.com>
     [not found]       ` <20120426181327.GZ4023@login.drsnuggles.stderr.nl>
2012-04-26 18:31         ` Igor
2012-04-26 18:36           ` Matthijs Kooijman
2012-04-26 19:34             ` [PATCH 1/2] git-svn: use platform specific auth providers Matthijs Kooijman
2012-04-26 19:34               ` [PATCH 2/2] git-svn: Configure a prompt callback for gnome_keyring Matthijs Kooijman
2012-04-27  8:28                 ` Eric Wong
2012-04-27  9:36                   ` Matthijs Kooijman
2013-06-18 16:36                   ` Matthijs Kooijman
2013-06-18 16:38                     ` Matthijs Kooijman [this message]
2013-08-29  9:42                       ` [PATCH] " Matthijs Kooijman
2013-08-29 17:38                         ` Eric Wong
     [not found]                           ` <35AE7D09-F859-4277-AC74-729BA1188D10@outoforder.cc>
2013-08-29 17:56                             ` Eric Wong
2012-04-27  8:29                 ` [PATCH 2/2] " Matthijs Kooijman
2012-04-27  8:21               ` [PATCH 1/2] git-svn: use platform specific auth providers Eric Wong
2012-04-27  8:25                 ` Matthijs Kooijman
2012-04-29  8:23                   ` Eric Wong
2012-04-30  0:03                     ` Junio C Hamano
2012-04-30  1:21                       ` Junio C Hamano
2012-04-30  8:19                         ` Eric Wong
2012-04-30 16:04                           ` Junio C Hamano
2012-04-30 16:53                             ` Matthijs Kooijman
2012-04-30 19:02                               ` Eric Wong
2012-04-30 19:20                                 ` Matthijs Kooijman
2012-05-01  1:08                                   ` Junio C Hamano
2012-06-03 10:49                                     ` Charles Bailey
2012-06-03 21:44                                       ` Junio C Hamano
2012-06-04  9:00                                         ` Matthijs Kooijman
2012-06-04 19:26                                           ` Junio C Hamano
2012-06-04 19:36                                             ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371573490-21973-1-git-send-email-matthijs@stdin.nl \
    --to=matthijs@stdin.nl \
    --cc=cabo@tzi.org \
    --cc=git@vger.kernel.org \
    --cc=grddev@gmail.com \
    --cc=normalperson@yhbt.net \
    --cc=urkle@outoforder.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.