unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] ldap.el: use auth-source if passwd is not defined in ldap-host-parameters-list
@ 2011-03-04 20:47 Leonidas Tsampros
  2011-03-05  3:07 ` Ted Zlatanov
  0 siblings, 1 reply; 8+ messages in thread
From: Leonidas Tsampros @ 2011-03-04 20:47 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

Hi,

Attached you can find a small patch to make ldap.el use auth-source if
passwd is not defined in the ldap-host-parameters-list.

I find it useful not to carry passwords in my configurations files, so I
was motivated enough to do that for ldap.el since I use it through
eudc-ldap.

Thanks to nnimap.el from which I copied this piece of code.

I do not think that I break any existing configuration with this
patch but I'm not entirely sure about that.

Best Regards,
Leonidas Tsampros


[-- Attachment #2: ldap patch auth-source --]
[-- Type: text/plain, Size: 2859 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: ltsampros@upnet.gr-20110302174918-h06k6ohsksc8ymju
# target_branch: file:///home/ltsampros/repos2/emacs/trunk/
# testament_sha1: 2d5eb512df6c9c23c2c736a832130bd0e48e6a4c
# timestamp: 2011-03-02 19:54:44 +0200
# base_revision_id: schwab@linux-m68k.org-20110302104247-\
#   z4p2vqooiv34g8bd
# 
# Begin patch
=== modified file 'lisp/net/ldap.el'
--- lisp/net/ldap.el	2011-01-25 04:08:28 +0000
+++ lisp/net/ldap.el	2011-03-02 17:49:18 +0000
@@ -36,6 +36,8 @@
 (require 'custom)
 (eval-when-compile (require 'cl))
 
+(autoload 'auth-source-search "auth-source")
+
 (defgroup ldap nil
   "Lightweight Directory Access Protocol."
   :version "21.1"
@@ -512,7 +514,15 @@
 	(scope (plist-get search-plist 'scope))
 	(binddn (plist-get search-plist 'binddn))
         (auth (plist-get search-plist 'auth))
-	(passwd (plist-get search-plist 'passwd))
+	(passwd (or (plist-get search-plist 'passwd)
+		    (let ((found (nth 0 (auth-source-search :host (if (boundp 'host) host)
+							    :create t))))
+		      (if found
+			  (let ((secret (plist-get found :secret)))
+			    (if (functionp secret)
+				(funcall secret)
+			      secret))))
+		    ))
 	(deref (plist-get search-plist 'deref))
 	(timelimit (plist-get search-plist 'timelimit))
 	(sizelimit (plist-get search-plist 'sizelimit))

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWU8YDq8AAcXfgFgwUOP/93Ik
RAC////wUAQed7Ne2q9a2HQeg0iZI/VHqZpD1GgNDTRp6jQAACNIpiZkaI9Gp6gAAAAAAyRqZqPU
mibU9Gk9Rpo0NGgBoyAGmiKBpoBo00aBoAAAACSQECYIZNExTTDQk9pRpo9CeUpISEyUkMyYBnh0
aJm5uBF/3z/I2eWRTNqED83b6CD6LhBcsGXrh+PyuHUdXTIf77qetLDMf79ycKu1YQibUEFRn4FP
YYfH7lxDCYmMezK++njXcgfPKpQ3p+ZsE/ZHNDBuRpVQEJjOrQoOlVKZCHSCIEyRNYcqUCFVibA9
w3CnnukPE7g/n8JvJPcZEubw3rfVEJpXfRZO1VVwS6N4N5iTjzQMg8WT0yvFLC9XvU5KDcGoqFUI
Hkl2IQJFUGgcva4IsMytC5KYa6V92NmSRXdVDHPrWJj2vFy2q01QPTZE20riwjFX7FAqcKSz/h8g
axx0oaEvagijCZ5nCmcEUUZg1nR9CpLBRPmNRUOZ7QkJ0NiibkYsFKocVhm0QWGUM5zfxmJUjjxu
bLVHUT0HWVfK9lrfG9+/lwKb3vwPlZU4QvYy1lDpgc4N4GlSxAyrmdzHAZz02mlkBulz4xJhqg7V
2vsMDYMrBdmrCFKdasBRKrDdQ8hbOqFpAdk91UidlnnB6EecMKEgIQKNWBKMhUA1SeIlsvqTivQc
27XpuO0lzYgkDyn3o9QqiakA3wBecQALdKV0a3dC205DivgNfTpitsgBCsnrrqAQiKHARR+bf63p
s6HvGp1U6IHaEDcvVfVGMtB3eeGYtIHTRY+zgi3Gaxdca0SINzYnB+RoybSGMilYUrtJhZXcLc5f
SHbVYddd8ujGV78mhZxO3GETzqoDEsYBNHKBhoSQbYMpF2VE+RFU1wOqLMzGiH3cRwNEy/erS/Yx
x2v48DgVcBg1gQcilOkFyxW47DQ071M/Xd5FrHe3RnOLw6LwR9iWMf3yS0yYGRMTtAfYU/aXkKav
CZpYYT+E50cVXzNygPHeIVznyWeEcQqq+oTDLWuc4QFs9E3IW3aExb6M0q+UQhWBUMLdyNOAVFfG
QSh2llUyyWRrfbELQqBiDxv6kJYIRgJDzuYo2XyYJIaJdilC2ExuqyI5OTmWDhfTnSsruwVafHjQ
GrpY/8KotoC7xBrlhBSA6h43yXr2hwj0belx7Ft04uZa/J8i2UTklraiQFa6KizkLemeD8aQcD+x
yGRV3XF0ghV4vB2j70DyCGq4u3wSnu+HJeYq1OxasmIfpsWi19oNxFWuEgrwU70wLLRQVgGBLy8h
iSISojKoj28BzKsDnzhM1VB9FOyszjKsKAlSk5avkO1Pdg3atQeiVTgsuFQql1TResA/pPyVJyTR
tWKcsV1F10V1pL/xdyRThQkE8YDq8A==

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-13 22:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-04 20:47 [PATCH] ldap.el: use auth-source if passwd is not defined in ldap-host-parameters-list Leonidas Tsampros
2011-03-05  3:07 ` Ted Zlatanov
2011-03-05  9:16   ` Leonidas Tsampros
2011-03-07 10:55     ` Ted Zlatanov
2011-03-10 21:05       ` Leonidas Tsampros
2011-03-10 22:05         ` Ted Zlatanov
2011-03-11 13:50           ` Leonidas Tsampros
2011-03-13 22:06             ` Ted Zlatanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).