Apr 2002 libsecret
This commit is contained in:
parent
4c1b226bff
commit
cb248a18a3
@ -3,6 +3,47 @@ MANIFEST.in
|
|||||||
README.md
|
README.md
|
||||||
setup.cfg
|
setup.cfg
|
||||||
setup.py
|
setup.py
|
||||||
|
/var/local/src/gajim-1.3.3/build/data/org.gajim.Gajim.appdata.xml
|
||||||
|
/var/local/src/gajim-1.3.3/build/data/org.gajim.Gajim.desktop
|
||||||
|
/var/local/src/gajim-1.3.3/build/man/gajim-history-manager.1.gz
|
||||||
|
/var/local/src/gajim-1.3.3/build/man/gajim-remote.1.gz
|
||||||
|
/var/local/src/gajim-1.3.3/build/man/gajim.1.gz
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/be/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/be@latin/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/bg/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/br/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/ca/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/cs/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/da/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/de/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/el/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/en_GB/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/eo/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/es/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/eu/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/fr/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/gl/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/he/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/hr/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/hu/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/it/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/ja/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/kk/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/lt/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/nb_NO/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/nl/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/pl/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/pt/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/pt_BR/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/ru/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/sk/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/sr/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/sr@Latn/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/sv/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/tr/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/uk/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/zh_CN/LC_MESSAGES/gajim.mo
|
||||||
|
/var/local/src/gajim-1.3.3/build/mo/zh_TW/LC_MESSAGES/gajim.mo
|
||||||
data/gajim-history-manager.1
|
data/gajim-history-manager.1
|
||||||
data/gajim-remote.1
|
data/gajim-remote.1
|
||||||
data/gajim.1
|
data/gajim.1
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import keyring
|
import keyring
|
||||||
|
import os
|
||||||
|
|
||||||
from gajim.common import app
|
from gajim.common import app
|
||||||
|
|
||||||
@ -29,17 +30,30 @@ __all__ = ['get_password', 'save_password']
|
|||||||
|
|
||||||
log = logging.getLogger('gajim.password')
|
log = logging.getLogger('gajim.password')
|
||||||
|
|
||||||
|
from keyring.backends.SecretService import Keyring
|
||||||
|
|
||||||
|
KEYRING_AVAILABLE = None
|
||||||
backends = keyring.backend.get_all_keyring()
|
backends = keyring.backend.get_all_keyring()
|
||||||
for backend in backends:
|
if 'PYTHON_KEYRING_BACKEND' in os.environ and os.environ['PYTHON_KEYRING_BACKEND']:
|
||||||
log.info('Found keyring backend: %s', backend)
|
k_name=os.environ['PYTHON_KEYRING_BACKEND']
|
||||||
|
# 'keyring.backends.SecretService.Keyring'
|
||||||
|
k_list = list(filter(lambda elt: repr(elt.__class__) == "<class '" +k_name +"'>",
|
||||||
|
backends))
|
||||||
|
if k_list:
|
||||||
|
keyring_backend = k_list[0]
|
||||||
|
KEYRING_AVAILABLE = True
|
||||||
|
log.info('Select PYTHON_KEYRING_BACKEND %s backend', keyring_backend)
|
||||||
|
else:
|
||||||
|
log.warn('Select PYTHON_KEYRING_BACKEND %s not found', k_name)
|
||||||
|
|
||||||
keyring_backend = keyring.get_keyring()
|
if not KEYRING_AVAILABLE:
|
||||||
log.info('Select %s backend', keyring_backend)
|
for backend in backends:
|
||||||
|
log.info('Found keyring backend: %s', backend)
|
||||||
KEYRING_AVAILABLE = any(keyring.core.recommended(backend)
|
|
||||||
for backend in backends)
|
|
||||||
|
|
||||||
|
keyring_backend = keyring.get_keyring()
|
||||||
|
KEYRING_AVAILABLE = any(keyring.core.recommended(backend)
|
||||||
|
for backend in backends)
|
||||||
|
log.info('Select %s backend', keyring_backend)
|
||||||
|
|
||||||
class SecretPasswordStorage:
|
class SecretPasswordStorage:
|
||||||
"""
|
"""
|
||||||
@ -47,14 +61,21 @@ class SecretPasswordStorage:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def save_password(account_name, password):
|
def save_password(account_name, password, **kwargs):
|
||||||
if not KEYRING_AVAILABLE:
|
if not KEYRING_AVAILABLE:
|
||||||
log.warning('No recommended keyring backend available.'
|
log.warning('No recommended keyring backend available.'
|
||||||
'Passwords cannot be stored.')
|
'Passwords cannot be stored.')
|
||||||
return True
|
return True
|
||||||
|
if kwargs is None: kwargs = dict()
|
||||||
|
kwargs["server"] = "xmpp"
|
||||||
|
kwargs["type"] = "plaintext"
|
||||||
|
kwargs["xdg:schema"] = "org.qt.keychain"
|
||||||
try:
|
try:
|
||||||
log.info('Save password to keyring')
|
log.info('Save password to keyring')
|
||||||
keyring_backend.set_password('gajim', account_name, password)
|
keyring_backend.set_password('gajim', account_name, password,
|
||||||
|
# these are added for qt compatability
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
return True
|
return True
|
||||||
except Exception:
|
except Exception:
|
||||||
log.exception('Save password failed')
|
log.exception('Save password failed')
|
||||||
@ -96,7 +117,7 @@ class ConfigPasswordStorage:
|
|||||||
return app.settings.get_account_setting(account_name, 'password')
|
return app.settings.get_account_setting(account_name, 'password')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def save_password(account_name, password):
|
def save_password(account_name, password, **kwargs):
|
||||||
app.settings.set_account_setting(account_name, 'password', password)
|
app.settings.set_account_setting(account_name, 'password', password)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -120,7 +141,8 @@ def save_password(account_name, password):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
if app.settings.get('use_keyring'):
|
if app.settings.get('use_keyring'):
|
||||||
return SecretPasswordStorage.save_password(account_name, password)
|
user = app.get_account_label(account) # guessing
|
||||||
|
return SecretPasswordStorage.save_password(account_name, password, user=user)
|
||||||
return ConfigPasswordStorage.save_password(account_name, password)
|
return ConfigPasswordStorage.save_password(account_name, password)
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
os.environ['PYTHON_KEYRING_BACKEND']='keyring.backends.SecretService.Keyring'
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import signal
|
import signal
|
||||||
import platform
|
import platform
|
||||||
|
@ -1021,7 +1021,8 @@ class LoginDialog(SettingsDialog):
|
|||||||
self.connect('destroy', self.on_destroy)
|
self.connect('destroy', self.on_destroy)
|
||||||
|
|
||||||
def on_password_change(self, new_password, _data):
|
def on_password_change(self, new_password, _data):
|
||||||
passwords.save_password(self.account, new_password)
|
user = app.get_account_label(account) # guessing
|
||||||
|
passwords.save_password(self.account, new_password, user=user)
|
||||||
|
|
||||||
def on_destroy(self, *args):
|
def on_destroy(self, *args):
|
||||||
savepass = app.settings.get_account_setting(self.account, 'savepass')
|
savepass = app.settings.get_account_setting(self.account, 'savepass')
|
||||||
|
@ -98,7 +98,7 @@ class ChangePassword(Assistant):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
password = self.get_page('password').get_password()
|
password = self.get_page('password').get_password()
|
||||||
passwords.save_password(self.account, password)
|
passwords.save_password(self.account, password, user=self.jid)
|
||||||
self.show_page('success')
|
self.show_page('success')
|
||||||
|
|
||||||
def _on_destroy(self, *args):
|
def _on_destroy(self, *args):
|
||||||
|
@ -291,7 +291,10 @@ class GenericSetting(Gtk.ListBoxRow):
|
|||||||
|
|
||||||
elif self.type_ == SettingType.ACCOUNT_CONFIG:
|
elif self.type_ == SettingType.ACCOUNT_CONFIG:
|
||||||
if self.value == 'password':
|
if self.value == 'password':
|
||||||
passwords.save_password(self.account, state)
|
passwords.save_password(self.account, state,
|
||||||
|
# guessing - for xdg:schema="org.qt.keychain"
|
||||||
|
user=self.jid,
|
||||||
|
)
|
||||||
if self.value == 'no_log_for':
|
if self.value == 'no_log_for':
|
||||||
self.set_no_log_for(self.account, state)
|
self.set_no_log_for(self.account, state)
|
||||||
else:
|
else:
|
||||||
|
@ -460,7 +460,7 @@ class Interface:
|
|||||||
|
|
||||||
def on_ok(passphrase, save):
|
def on_ok(passphrase, save):
|
||||||
app.settings.set_account_setting(account, 'savepass', save)
|
app.settings.set_account_setting(account, 'savepass', save)
|
||||||
passwords.save_password(account, passphrase)
|
passwords.save_password(account, passphrase, user=obj.jid)
|
||||||
obj.on_password(passphrase)
|
obj.on_password(passphrase)
|
||||||
del self.pass_dialog[account]
|
del self.pass_dialog[account]
|
||||||
|
|
||||||
@ -1550,7 +1550,7 @@ class Interface:
|
|||||||
app.settings.set_account_setting(account, opt, config[opt])
|
app.settings.set_account_setting(account, opt, config[opt])
|
||||||
|
|
||||||
# Password module depends on existing config
|
# Password module depends on existing config
|
||||||
passwords.save_password(account, password)
|
passwords.save_password(account, password, user=account_label)
|
||||||
|
|
||||||
app.css_config.refresh()
|
app.css_config.refresh()
|
||||||
|
|
||||||
|
@ -2052,7 +2052,7 @@ class RosterWindow:
|
|||||||
|
|
||||||
# The contact has several resources
|
# The contact has several resources
|
||||||
if len(contact_instances) > 1:
|
if len(contact_instances) > 1:
|
||||||
if contact.resource != '':
|
if contact.resource:
|
||||||
name += '/' + contact.resource
|
name += '/' + contact.resource
|
||||||
|
|
||||||
# Remove resource when going offline
|
# Remove resource when going offline
|
||||||
|
Loading…
Reference in New Issue
Block a user