Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Added libsecret #826

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ManiacTwister
Copy link
Contributor

As mentioned in the other pull request ( #825 ) libsecret is the replacement for gnome-keyring, so here is the new implementation.

cheers

@Arnavion
Copy link
Contributor

Apart from the commit message typo ("secure" instead of "secret" - this can be fixed when we merge it) and the whitespace issues, I think this is fine.

[use_libsecret=yes],
[use_libsecret=no])

if test "x$use_libsecret" = "xyes"; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Use COMMON_CFLAGS not CPPFLAGS. (same for LIBS)
  • Default to yes not auto, and set to no on failure.
  • Use libsecret instead of use_libsecret to match other vars.

@ManiacTwister
Copy link
Contributor Author

Just found a bug:
If heschats exits immediately after servlist_save were called ( = if no sessions are open) any changed password will not be updated because the libsecret thread will not finish fast enough. I have two ideas how to fix this:

  • Add an argument "shutdown" to servlist_save. When shutdown is true use secret_password_store_sync (= blocking) instead of secret_password_store. In servlistgui.c check if hexchat will close after saveing and if yes call servlist_save with shutdown=true.
  • Add the same argument as above but use secret_password_store and close hexchat in the libsecure "finished-callback" and not in servlistgui_save.
  • Use always secret_password_store_sync instead of secret_password_store. With the default serverlist ( ~ 90 servers) the servlistgui blocks for approximately 1,5seconds on my pc everytimei close it.

Any suggestions?

@TingPing
Copy link
Member

@ManiacTwister Probably the first option except check hexchat_is_quitting variable instead of adding an arg.

On an unrelated note it doesn't seem you check at all if the storing succeeds (or is supported at least)? Not every DE will have a keyring and it needs to fallback to the config file.

@ManiacTwister
Copy link
Contributor Author

@TingPing hexchat_is_quitting is set to true AFTER servlist_save is called. Should i set it to true manually in servlist_savegui?

Error handling isn't really possible when using secret_password_store because the result will be available in the callback only which will be called after the servist is written..

@TingPing
Copy link
Member

Error handling isn't really possible when using secret_password_store because the result will be available in the callback only which will be called after the servlist is written..

Well you have to find a way or disable this feature by default making it nearly useless.
I guess in the callback just detect the error, set that its not supported, and rewrite it then all saves after will just skip it.

Should i set it to true manually in servlist_savegui?

How would servlist know we are quitting? You can just call servlist_save once in hexchat_exit.

@ManiacTwister
Copy link
Contributor Author

Well you have to find a way or disable this feature by default making it nearly useless.

I'll look a bit depper into libsecret, maybe there is a elegant way to do this.

How would servlist know we are quitting? You can just call servlist_save once in hexchat_quit.

servlist_close_cb (GtkWidget *button, gpointer userdata)
{
    servlist_savegui ();
    gtk_widget_destroy (serverlist_win);
 [....]
    if (sess_list == NULL)
        hexchat_exit ();
}

As far as i understand the close-button callback, it is responsible for exiting hexchat if no sessions are open, so this should work.

@TingPing
Copy link
Member

As far as i understand the close-button callback, it is responsible for exiting hexchat if no sessions are open, so this should work.

I see, setting it there should be fine then.

@ManiacTwister
Copy link
Contributor Author

I have added an fallback now but i don't know if it it's really clean to do it like this. If you agree with the changes in the new branch [1] i'll merge it whit the pull request

[1] ManiacTwister@01f5b87

@TingPing
Copy link
Member

TingPing commented Nov 1, 2013

@ManiacTwister Seems to work fine but I would say if it fails once it should just set a preference to disable the feature entirely (also giving users the option to disable it manually) not retry it multiple times every time.

@ManiacTwister
Copy link
Contributor Author

@TingPing Added config option: ManiacTwister/hexchat@01f5b87...e787198

@TingPing
Copy link
Member

@ManiacTwister I like it other than the setup page, it is just empty and makes no more sense under Network than in the advanced page.

@ManiacTwister
Copy link
Contributor Author

@TingPing Done and merged the changes, but i'm not sure if the libsecret setting should be moved up to the other checkbox-settings. (maybe between hex_irc_cap_server_time and hex_net_auto_reconnect ?)

@tomek
Copy link
Member

tomek commented Apr 10, 2014

@ManiacTwister before anything - rebase it against our master as github itself shows there are some conflicts - and you could reduce numer of commits.

@ManiacTwister ManiacTwister changed the title Added libsecret (--enable-libsecret). Added libsecret Apr 10, 2014
@ManiacTwister
Copy link
Contributor Author

@tomek @TingPing So.. any news about this one? I'm using this patch locally since 7 months without problems.

@@ -0,0 +1,32 @@
/* HexChat
* Copyright (C) 2013 Robin Rieger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

odd I didn't think this pull was that old... perhaps the copyright should be updated

@ManiacTwister
Copy link
Contributor Author

Happy 3. Birthday to my pullrequest

@TingPing
Copy link
Member

@ManiacTwister So what I really want to happen is some abstract interface for storing passwords with backends for OSX, Windows, libsecret, plaintext, etc. This PR, while perhaps functional, is sort of an ugly mess of ifdefs throughout the code base that is not easily extended. Also I don't think you ever handled migration?

@DerekTurtleRoe
Copy link

@ManiacTwister @TingPing This seems like a cool idea, has anybody looked at it recently?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

6 participants