From 931979b5c6ac0d16ee46365a1d770274ba9e03f0 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 22 Sep 2014 22:56:54 +0200 Subject: [PATCH] Use a keyring to store some credentials --- emacs/.emacs.d/init.el | 6 +++--- offlineimap/.offlineimap.py | 11 ++--------- offlineimap/.offlineimaprc | 8 ++++---- x11/.xinitrc | 2 ++ 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index d68499a..bc0338f 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -13,8 +13,7 @@ (require 'esh-proc) (require 'fill-column-indicator) (require 'magit) - (require 'yasnippet) - (require 'noflet)) + (require 'yasnippet)) (load (concat user-emacs-directory "init2")) @@ -658,7 +657,8 @@ For `python-mode' I prefer `python-imenu-create-flat-index'." (if (daemonp) (add-hook 'after-make-frame-functions (lambda (frame) - (noflet ((display-graphic-p (&optional display) t)) + (cl-letf (((symbol-function 'display-graphic-p) + (lambda () t))) (oni:set-theme frame)))) (oni:eval-after-init (oni:set-theme nil))) diff --git a/offlineimap/.offlineimap.py b/offlineimap/.offlineimap.py index fb4f66e..9ae081e 100644 --- a/offlineimap/.offlineimap.py +++ b/offlineimap/.offlineimap.py @@ -1,4 +1,5 @@ from offlineimap import imaputil +import keyring def lld_flagsimap2maildir(flagstring): @@ -39,13 +40,5 @@ imaputil.flagsmaildir2imap = lld_flagsmaildir2imap imaputil.flagsimap2maildir = lld_flagsimap2maildir -def getuser(host): - import netrc - mynet = netrc.netrc() - return mynet.authenticators(host)[0] - - def getpassword(host): - import netrc - mynet = netrc.netrc() - return mynet.authenticators(host)[2] + return keyring.get_password('offlineimap', host) diff --git a/offlineimap/.offlineimaprc b/offlineimap/.offlineimaprc index af59f59..07a2893 100644 --- a/offlineimap/.offlineimaprc +++ b/offlineimap/.offlineimaprc @@ -18,8 +18,8 @@ nametrans = lambda folder: re.sub('^Inbox$', 'INBOX', folder.capitalize()) [Repository ryuslash.org-remote] type = IMAP remotehost = imap.alwaysdata.com -remoteusereval = getuser("imap.alwaysdata.com") -remotepasseval = getpassword("imap.alwaysdata.com") +remoteuser = 'tom@ryuslash.org' +remotepasseval = getpassword("ryuslash") nametrans = lambda folder: folder.lower() [Account picturefix] @@ -71,8 +71,8 @@ nametrans = lambda folder: re.sub('^inbox$', 'INBOX', re.sub('^drafts$', '[Gm [Repository gmail-remote] type = Gmail -remoteusereval = getuser("imap.google.com") -remotepasseval = getpassword("imap.google.com") +remoteuser = "ryuslash@gmail.com" +remotepasseval = getpassword("gmail") realdelete = no cert_fingerprint = 687687a7f2dc166baf58221ff7a42f1683d0d164 folderfilter = lambda folder: folder in ['INBOX', '[Gmail]/Drafts', '[Gmail]/Sent Mail', '[Gmail]/Trash'] diff --git a/x11/.xinitrc b/x11/.xinitrc index 9dd60ae..06f9be6 100755 --- a/x11/.xinitrc +++ b/x11/.xinitrc @@ -31,6 +31,8 @@ case $_hostname in # exec i3 ;; phoenix) + eval $(/usr/bin/gnome-keyring-daemon --start --components=secrets) + export GPG_AGENT_INFO SSH_AUTH_SOCK exec awesome ;; esac