From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: more on starttls, gnutls-cli and using tls for mail Date: Tue, 27 Sep 2011 11:28:12 -0400 Message-ID: <87oby6attf.fsf@kwarm.red-bean.com> References: <20039.8838.116211.694328@gargle.gargle.HOWL> <8762m0n5qi.fsf@red-bean.com> <87ty9kpl2q.fsf@niu.edu> <87bovsj72q.fsf@red-bean.com> <87y5xc6a7o.fsf@lifelogs.com> <87ty80h6tr.fsf@red-bean.com> <871uv343rr.fsf@lifelogs.com> Reply-To: Karl Fogel NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1317137310 4188 80.91.229.12 (27 Sep 2011 15:28:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Sep 2011 15:28:30 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 27 17:28:27 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R8Za5-0001tS-L6 for ged-emacs-devel@m.gmane.org; Tue, 27 Sep 2011 17:28:25 +0200 Original-Received: from localhost ([::1]:51645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8Za4-0001wH-Sv for ged-emacs-devel@m.gmane.org; Tue, 27 Sep 2011 11:28:24 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:38956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8Za2-0001vk-98 for emacs-devel@gnu.org; Tue, 27 Sep 2011 11:28:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8ZZy-0006hM-1t for emacs-devel@gnu.org; Tue, 27 Sep 2011 11:28:22 -0400 Original-Received: from mail-vx0-f169.google.com ([209.85.220.169]:36844) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8ZZx-0006hI-Q1 for emacs-devel@gnu.org; Tue, 27 Sep 2011 11:28:17 -0400 Original-Received: by vcbfo14 with SMTP id fo14so4869923vcb.0 for ; Tue, 27 Sep 2011 08:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:references:reply-to:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=b3PYm5ueUW4gpNrOt3l8JeH1OXnTIW4Bp3TnmN7WySY=; b=w2LGL33Tj8xGNUKO5lzVJf0JR5bWhwTnpXUW+pa8Ms4CeT/v/qyVQpkD2qiv18s3nh 3qTLbxdJ0CcDEtGmkie8FZ3y3K87PbI2xRt+gTIkEwOhQN3kdijJhBTMkn0VXM9bukZM jUHjxdQTF8L7aKJlfVWGvbjzFWlsYb0UuNZlU= Original-Received: by 10.220.92.17 with SMTP id p17mr2264153vcm.75.1317137297081; Tue, 27 Sep 2011 08:28:17 -0700 (PDT) Original-Received: from kwarm.red-bean.com (topp148-office-nyc.openplans.org. [67.221.177.15]) by mx.google.com with ESMTPS id cu18sm16979179vdb.12.2011.09.27.08.28.13 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Sep 2011 08:28:13 -0700 (PDT) In-Reply-To: <871uv343rr.fsf@lifelogs.com> (Ted Zlatanov's message of "Mon, 26 Sep 2011 12:22:48 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:144412 Archived-At: Ted Zlatanov writes: >Heheh. OK. You really, really want a dynamic backend then. No >problem. > >First, look at the definition of `auth-sources'. You need to augment >the list of backends: > >[...] Ted, thanks for this amazingly detailed mail! It'll be my starting point. I wish I could start right away, but unfortunately can't, due to time constraints. Once I do, I'll try to make something re-usable, and leave the Info pages in better shape than I found them, to at least "pay forward" for your valuable guidance. -K > (choice > (string :tag "Just a file") > (const :tag "Default Secrets API Collection" 'default) > (const :tag "Login Secrets API Collection" "secrets:Login") > (const :tag "Temp Secrets API Collection" "secrets:session") >+ (const :tag "Karl's Dynamic Backend" 'dynamic-data) > >Then look at `auth-source-backend-parse'. Add your new backend to the >cond statement so it's parsed properly. Here you can parse a string >prefix like "dynamic-data:karl-dynamic-variable" (as the Sessions API does) so >your users can point to a variable easily without customizing >`auth-sources' too much. They would just have to add a string. The >prefix doesn't have to match the backend name. > >The last step is to create your backend instance when needed and return >it: > > (auth-source-backend > (plist-get entry :source) > :source (plist-get entry :source) > :type 'dynamic-data > :search-function 'auth-source-dynamic-data-search > :create-function 'auth-source-dynamic-data-create))) > >Your create function can be a stub, that's not a problem. > >Finally your search function... Copy the `auth-source-netrc-search' >template: > >(defun* auth-source-netrc-search (&rest > spec > &key backend require create delete > type max host user port > &allow-other-keys) > >1) the backend is the backend you created earlier, you'll need the >"source" slot which in your case is e.g. karl-dynamic-variable. You'd >map that to a symbol name and manipulate the value, obviously. > >2) require is a list of required keys > >3) max is the maximum number of results you should return > >4) create can be ignored if your create-function is a stub > >5) delete can be ignored if your backend doesn't delete entries, >otherwise delete everything you found up to max > >6) host, user, port are the only search criteria accepted by the >netrc/authinfo backend; yours could take more > >7) type is the backend type, you should return nothing if it's not >dynamic-data (the `auth-source-search' caller may ask for this). > >If you want to allow creation, look at `auth-source-netrc-create'. >There's a lot of code to deal with prompting that should IMO be factored >out but I haven't had the time. It sounds like you'd be OK with letting >the user modify the data externally though. > >Daiki Ueno went through this with his plstore backend so you're the >second one to possibly write a custom backend. If it goes well for you >I'll put these instructions in the auth-source texinfo pages. > >If you think this is too complicated or you're busy, I'll do it. Please >let me know. > >Thanks >Ted