You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Alexander Thomas <al...@collab.net> on 2008/12/12 05:33:18 UTC
[PATCH] unlock gnome-keyring
Here is a patch which try to address a Subversion issues with gnome
keyring support. Present implementation of gnome-keyring fails to access
a locked keyring and if there is no X present.
This patch, try to unlock the keyring by prompting the user for keyring
password only if the default keyring is locked.
Patch might not be well written, I got some concerns over it. I
appreciate if someone can guide me to make it better.
Here are couple of questions.
1. Patch uses svn_cmdline_auth_simple_prompt() to prompt the user to
key-in default keyring password. This might be okay for SVN cmdline.
But at the API level, third party applications won;t be able plugin
their custom password prompt. So how I do it?
I got a suggestion for this, but don't know how difficult to implement
it. Can this be implemented with auth providers, where we add a new
vtable entry in addition to existing first_credentials, next_credentials
and save_credentials. We can call new vtable entry as
'unlock_credentials'.
2. The patch written with lot of helper functions, which made the patch
look ugly. The reason why I wrote it this way is to make patch work with
the primitive versions of gnome-keyring (RHEL4 uses gnome-keyring
version < 0.5). With the gnome-keyring version >= 0.8, we can avoid
using this help functions and can rewrite the patch in much lesser
lines. So should I need to rewrite this patch and make subversion
dependent of gnome-keyring version >= 0.8.
[[[
Prompts for default keyring password if the keyring is locked
and unlocks the keyring.
* subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
(gnome_keyring_baton): New struct.
(callback_destroy_data_keyring): New helper function
to do cleanup.
(callback_done): New helper function.
(callback_get_info_keyring): New helper function to
handle keyring details.
(callback_default_keyring): New helper function for
getting the default keyring name.
(gnome_keyring_unlock_keyring): New function, which
will prompt for the keyring password and unlocks
the keyring if it is already locked.
(gnome_keyring_password_get): Use gnome_keyring_unlock_keyring()
to unlock a keyring and later does the cleanup.
(gnome_keyring_password_set): Use gnome_keyring_unlock_keyring()
to unlock a keyring and later does the cleanup.
]]]
Thanks
-Alexander Thomas (AT)
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=983212
Re: [PATCH] unlock gnome-keyring
Posted by Senthil Kumaran S <se...@collab.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Alexander Thomas wrote:
> Here is a patch which try to address a Subversion issues with gnome
> keyring support. Present implementation of gnome-keyring fails to access
> a locked keyring and if there is no X present.
Committed in r34977 with some formatting, doc tweaks and corrected compilation
warnings.
Thank You.
- --
Senthil Kumaran S
http://www.stylesen.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFJWffp9o1G+2zNQDgRAjnuAJ4rNk0sZYSuYwaVBlI2OoJzLPvAWACfSMO2
8ilq9jaOffWCJ8EoQf2b6DU=
=vdx/
-----END PGP SIGNATURE-----
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=995793
Re: [PATCH] unlock gnome-keyring
Posted by Alexander Thomas <al...@collab.net>.
On Mon, 2008-12-15 at 01:32 +0100, Arfrever Frehtes Taifersar Arahesis
wrote:
> 2008-12-12 06:33 Alexander Thomas <al...@collab.net> napisał(a):
> > Here is a patch which try to address a Subversion issues with gnome
> > keyring support. Present implementation of gnome-keyring fails to access
> > a locked keyring and if there is no X present.
> >
> > This patch, try to unlock the keyring by prompting the user for keyring
> > password only if the default keyring is locked.
>
> Could you write steps to reproduce "a locked keyring"?
There are different ways one can lock a keyring. Simply way do a logout
from the session and keyring will get locked. Another way is set idle
time for lock out, which I hope can be done through
gnome-keyring-manger.
I developed a command line tool, with which you can do some basic
operations on keyring. Here I',m attaching it.
Thanks
-AT
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=984270
Re: [PATCH] unlock gnome-keyring
Posted by Senthil Kumaran S <se...@collab.net>.
Daniel Shahaf wrote:
> Senthil Kumaran S wrote on Tue, 6 Jan 2009 at 18:30 +0530:
>> Bert Huijben wrote:
>>
>>> Thanks for looking into this.
>> I am attaching the patch, which "removes cmdline prompt from library function". I shall commit this patch tomorrow if there is no changes required.
>>
>> [[[
>> Follow up r34977.
>>
>> Remove cmdline prompt added to a library function.
>>
> ...
>> * subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
>> (unlock_prompt_provider_baton_t): New baton.
>
> Here, you can remove the include of "svn_cmdline.h" from <gnome_keyring.c>.
Done in r36040.
--
Senthil Kumaran S
http://www.stylesen.org/
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1218393
RE: [PATCH] unlock gnome-keyring
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Senthil Kumaran S wrote on Tue, 6 Jan 2009 at 18:30 +0530:
> Bert Huijben wrote:
>
> > Thanks for looking into this.
>
> I am attaching the patch, which "removes cmdline prompt from library function". I shall commit this patch tomorrow if there is no changes required.
>
> [[[
> Follow up r34977.
>
> Remove cmdline prompt added to a library function.
>
...
> * subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
> (unlock_prompt_provider_baton_t): New baton.
Here, you can remove the include of "svn_cmdline.h" from <gnome_keyring.c>.
Daniel
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1200496
RE: [PATCH] unlock gnome-keyring
Posted by Senthil Kumaran S <se...@collab.net>.
Bert Huijben wrote:
> Thanks for looking into this.
I am attaching the patch, which "removes cmdline prompt from library function". I shall commit this patch tomorrow if there is no changes required.
[[[
Follow up r34977.
Remove cmdline prompt added to a library function.
* subversion/libsvn_subr/auth.c
(): Include svn_cmdline.h
(svn_auth_get_platform_specific_provider): Change parameters passed to GNOME
Keyring provider function.
* subversion/libsvn_subr/prompt.c
(svn_cmdline_auth_unlock_prompt): New function to prompt for unlocking GNOME
Keyring.
* subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
(unlock_prompt_provider_baton_t): New baton.
(get_default_keyring_name): New function to return default keyring's name.
(check_keyring_is_locked): New function to check whether a keyring is locked.
(gnome_keyring_unlock_keyring): Modified to unlock the provided keyring with
a password supplied.
(gnome_keyring_password_get, gnome_keyring_password_set): Get default
keyring name with the new function.
(gnome_keyring_simple_first_creds, gnome_keyring_simple_save_creds): Check
if the keyring is locked and throw a prompt in order to get the password
and unlock it.
(svn_auth_get_gnome_keyring_simple_provider): Change signature in order to
accept a prompt function. Since this API was added for 1.6, the name
remains the same.
* subversion/include/svn_cmdline.h
(svn_cmdline_auth_unlock_prompt): New function signature added.
* subversion/include/svn_auth.h
(svn_auth_unlock_prompt_func_t): New callback.
(svn_auth_unlock_provider_func_t): New function type returning GNOME Keyring
authentication provider.
(svn_auth_get_gnome_keyring_simple_provider): Change signature.
]]]
Thank You.
--
Senthil Kumaran S
http://www.stylesen.org/
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1007590
RE: [PATCH] unlock gnome-keyring
Posted by Bert Huijben <rh...@sharpsvn.net>.
> -----Original Message-----
> From: Senthil Kumaran S [mailto:senthil@collab.net]
> Sent: Wednesday, December 31, 2008 11:25 AM
> To: Bert Huijben
> Cc: 'Mark Phippard'; 'Arfrever Frehtes Taifersar Arahesis';
> alexander@collab.net; dev@subversion.tigris.org
> Subject: Re: [PATCH] unlock gnome-keyring
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> Bert Huijben wrote:
> > The patch adds a console prompt to a library, which we should never
> do. We designed our entire authentication library to use prompt
> handlers and we should/must use such handlers here as well.
> >
> > Our library should /never/ directly communicate to the user without
> allowing a library user to at least override this behavior. But in
> almost every case the library user (=subversion client
> application/integration) should just provide a prompt implementation.
>
> Bert, Yes I see this problem, which could be solved by creating a
> prompt
> provider for unlocking gnome-keyring. I shall work on this and come up
> with a
> patch asap.
Thanks for looking into this.
If you need any help, please let me know.
Bert
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=996987
Re: [PATCH] unlock gnome-keyring
Posted by Senthil Kumaran S <se...@collab.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Bert Huijben wrote:
> The patch adds a console prompt to a library, which we should never do. We designed our entire authentication library to use prompt handlers and we should/must use such handlers here as well.
>
> Our library should /never/ directly communicate to the user without allowing a library user to at least override this behavior. But in almost every case the library user (=subversion client application/integration) should just provide a prompt implementation.
Bert, Yes I see this problem, which could be solved by creating a prompt
provider for unlocking gnome-keyring. I shall work on this and come up with a
patch asap.
Thank You.
- --
Senthil Kumaran S
http://www.stylesen.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFJW0h29o1G+2zNQDgRAuNQAJ0etEwXwa3Q9LjwkaCRw/tw3ddqrQCfdttw
gxAOaErLmpaWmwksUi34lbE=
=m8Ed
-----END PGP SIGNATURE-----
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=996804
RE: [PATCH] unlock gnome-keyring
Posted by Bert Huijben <rh...@sharpsvn.net>.
> -----Original Message-----
> From: Mark Phippard [mailto:mphippard@collab.net]
> Sent: Wednesday, December 17, 2008 2:30 PM
> To: Arfrever Frehtes Taifersar Arahesis
> Cc: alexander@collab.net; dev@subversion.tigris.org
> Subject: Re: [PATCH] unlock gnome-keyring
>
> 2008/12/15 Mark Phippard <ma...@gmail.com>:
> > On Sun, Dec 14, 2008 at 7:32 PM, Arfrever Frehtes Taifersar Arahesis
> > <Ar...@gmail.com> wrote:
> >> 2008-12-12 06:33 Alexander Thomas <al...@collab.net> napisał(a):
> >>> Here is a patch which try to address a Subversion issues with gnome
> >>> keyring support. Present implementation of gnome-keyring fails to
> access
> >>> a locked keyring and if there is no X present.
> >>>
> >>> This patch, try to unlock the keyring by prompting the user for
> keyring
> >>> password only if the default keyring is locked.
> >>
> >> Could you write steps to reproduce "a locked keyring"?
> >
> > 1) Turn on computer
> >
> > No more steps. A keyring is locked until you unlock it. Since
> > gnome-keyring only provides a GUI for this operation if you are
> > working via an SSH terminal to a Linux system (without X) then there
> > is no way to use an unlock your keyring without this patch.
> >
> > Without this patch the feature was useless except for users that are
> > running Linux on their local graphical workstation. Even those users
> > were not able to use the feature if they also use SSH to work on
> > remote systems.
> >
> > With this patch, you just need to do this when you login to your SSH
> session:
> >
> > $ export `gnome-keyring-daemon`
> >
> > This starts the keyring and exports the environment variables used by
> > the feature. SVN then has the code to detect your keyring is locked
> > and prompts you to unlock it so that it can retrieve your passwords
> > etc.
>
> Does anyone have any feedback for Alex on this? Should I just ask
> Senthil to commit it as is?
>
> We need this functionality in SVN 1.6. The gnome-keyring feature is
> only useful in one very specific situation without it. With this
> patch, the gnome-keyring feature works very well and can be used to
> store passwords securely even when there is no X environment
> available.
>
> I'd rather not have to maintain a special 1.6 branch to hold this code.
I replied on the final commit as I didn't review this mail before it was committed.
The patch adds a console prompt to a library, which we should never do. We designed our entire authentication library to use prompt handlers and we should/must use such handlers here as well.
Our library should /never/ directly communicate to the user without allowing a library user to at least override this behavior. But in almost every case the library user (=subversion client application/integration) should just provide a prompt implementation.
I see this as a 1.6 blocking issue, for the reasons mentioned above.
Thanks,
Bert
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=996474
Re: [PATCH] unlock gnome-keyring
Posted by Mark Phippard <mp...@collab.net>.
2008/12/15 Mark Phippard <ma...@gmail.com>:
> On Sun, Dec 14, 2008 at 7:32 PM, Arfrever Frehtes Taifersar Arahesis
> <Ar...@gmail.com> wrote:
>> 2008-12-12 06:33 Alexander Thomas <al...@collab.net> napisał(a):
>>> Here is a patch which try to address a Subversion issues with gnome
>>> keyring support. Present implementation of gnome-keyring fails to access
>>> a locked keyring and if there is no X present.
>>>
>>> This patch, try to unlock the keyring by prompting the user for keyring
>>> password only if the default keyring is locked.
>>
>> Could you write steps to reproduce "a locked keyring"?
>
> 1) Turn on computer
>
> No more steps. A keyring is locked until you unlock it. Since
> gnome-keyring only provides a GUI for this operation if you are
> working via an SSH terminal to a Linux system (without X) then there
> is no way to use an unlock your keyring without this patch.
>
> Without this patch the feature was useless except for users that are
> running Linux on their local graphical workstation. Even those users
> were not able to use the feature if they also use SSH to work on
> remote systems.
>
> With this patch, you just need to do this when you login to your SSH session:
>
> $ export `gnome-keyring-daemon`
>
> This starts the keyring and exports the environment variables used by
> the feature. SVN then has the code to detect your keyring is locked
> and prompts you to unlock it so that it can retrieve your passwords
> etc.
Does anyone have any feedback for Alex on this? Should I just ask
Senthil to commit it as is?
We need this functionality in SVN 1.6. The gnome-keyring feature is
only useful in one very specific situation without it. With this
patch, the gnome-keyring feature works very well and can be used to
store passwords securely even when there is no X environment
available.
I'd rather not have to maintain a special 1.6 branch to hold this code.
--
Thanks
Mark Phippard
http://markphip.blogspot.com/
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=985690
Re: [PATCH] unlock gnome-keyring
Posted by Mark Phippard <ma...@gmail.com>.
On Sun, Dec 14, 2008 at 7:32 PM, Arfrever Frehtes Taifersar Arahesis
<Ar...@gmail.com> wrote:
> 2008-12-12 06:33 Alexander Thomas <al...@collab.net> napisał(a):
>> Here is a patch which try to address a Subversion issues with gnome
>> keyring support. Present implementation of gnome-keyring fails to access
>> a locked keyring and if there is no X present.
>>
>> This patch, try to unlock the keyring by prompting the user for keyring
>> password only if the default keyring is locked.
>
> Could you write steps to reproduce "a locked keyring"?
1) Turn on computer
No more steps. A keyring is locked until you unlock it. Since
gnome-keyring only provides a GUI for this operation if you are
working via an SSH terminal to a Linux system (without X) then there
is no way to use an unlock your keyring without this patch.
Without this patch the feature was useless except for users that are
running Linux on their local graphical workstation. Even those users
were not able to use the feature if they also use SSH to work on
remote systems.
With this patch, you just need to do this when you login to your SSH session:
$ export `gnome-keyring-daemon`
This starts the keyring and exports the environment variables used by
the feature. SVN then has the code to detect your keyring is locked
and prompts you to unlock it so that it can retrieve your passwords
etc.
--
Thanks
Mark Phippard
http://markphip.blogspot.com/
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=984457
Re: [PATCH] unlock gnome-keyring
Posted by Arfrever Frehtes Taifersar Arahesis <Ar...@GMail.Com>.
2008-12-12 06:33 Alexander Thomas <al...@collab.net> napisał(a):
> Here is a patch which try to address a Subversion issues with gnome
> keyring support. Present implementation of gnome-keyring fails to access
> a locked keyring and if there is no X present.
>
> This patch, try to unlock the keyring by prompting the user for keyring
> password only if the default keyring is locked.
Could you write steps to reproduce "a locked keyring"?
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=984199