From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/74098 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: auth-source tokens Date: Mon, 15 Nov 2010 09:14:33 -0600 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87k4ked3fq.fsf@lifelogs.com> References: <87d3qylr29.fsf@marauder.physik.uni-ulm.de> <87fwvu5ele.fsf_-_@lifelogs.com> <87wrp4yjtk.fsf@lifelogs.com> <87eiarj0eu.fsf@lifelogs.com> <87pqu795st.fsf@gmx.de> <87tyjjpfkw.fsf@lifelogs.com> <87ipzz8a79.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1289834197 26971 80.91.229.12 (15 Nov 2010 15:16:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 15 Nov 2010 15:16:37 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M22466@lists.math.uh.edu Mon Nov 15 16:16:30 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PI0nF-0001AB-OX for ding-account@gmane.org; Mon, 15 Nov 2010 16:16:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PI0li-00042c-OY; Mon, 15 Nov 2010 09:14:54 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PI0lg-00042P-07 for ding@lists.math.uh.edu; Mon, 15 Nov 2010 09:14:52 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PI0lb-00076f-5v for ding@lists.math.uh.edu; Mon, 15 Nov 2010 09:14:51 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1PI0lZ-0006Ot-00 for ; Mon, 15 Nov 2010 16:14:45 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PI0lY-0008QJ-N5 for ding@gnus.org; Mon, 15 Nov 2010 16:14:44 +0100 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Nov 2010 16:14:44 +0100 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Nov 2010 16:14:44 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 73 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:JuphSNW08yJYgxytwUnvqsZP6Wo= X-Spam-Score: -0.7 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:74098 Archived-At: On Mon, 15 Nov 2010 05:47:22 +0100 Michael Albinus wrote: MA> In general, one shall know the exact purpose a secret is needed for. OK, final revision I hope... Note all backends will just throw an error rather than changing the return value when creation fails. I think that's the least surprising behavior. Ted (defun auth-source-search (&rest spec) "Search or modify authentication backends according to SPEC. This function parses `auth-sources' for matches of the SPEC plist. It can optionally create or update an authentication token if requested. A token is just a standard Emacs property list with a :secret property that can be a function; all the other properties will always hold scalar values. Typically the :secret property, if present, contains a password. Common search keys are :max, :host, :port, and :user. In addition, :create specifies how tokens will be updated or created. Finally, :backend-type can specify which backend types you want to check. A string value is always matched literally. A symbol is matched as its string value, literally. All the SPEC values can be single values (symbol or string) or lists thereof (in which case any of the search terms matches). :create t means to create a token if possible. When it is 'rewrite-existing, any matching existing token will be copied into the new token and deleted. This defaults to nil and will generate an error if used with :max greater than 1. Any specified parameters except :max will be used in the new token, so if you searched for :host X you would create a token with that parameter. When multiple parameters are specified in the search, the last one is used for creation. So :host (X Y Z) would create a token for host Z, for instance. This creation can fail if the search was not specific enough to create a new token (it's up to the backend to decide that). You should `catch' the backend-specific error as usual. :backend-type (X Y Z) will check only those backends. 'netrc and 'secrets are the only ones supported right now. :max N means to return at most N items (defaults to 1). When 0 the function will return just t or nil to indicate if any matches were found. :host (X Y Z) means to match only hosts X, Y, or Z according to the match rules above. Defaults to t. :user (X Y Z) means to match only users X, Y, or Z according to the match rules above. Defaults to t. :port (P Q R) means to match only protocols P, Q, or R. Defaults to t. :K (V1 V2 V3) for any other key K will match values V1, V2, or V3 (note the match rules above). The return value is a list with at most :max tokens. Each token is a plist with keys :backend :host :port :user, plus any other keys provided by the backend (notably :secret). But note the exception for :max 0, which see above. The token's :secret key can hold a function. In that case you must call it to obtain the actual value." )