From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Graves via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: [PATCH] Add custom variable auth-source-pass-file-extension. Date: Thu, 9 Mar 2023 17:30:18 +0100 Message-ID: <20230309163018.20565-1-ngraves@ngraves.fr> Reply-To: Nicolas Graves Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11464"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ngraves@ngraves.fr To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 09 17:43:37 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paJMf-0002pY-Af for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Mar 2023 17:43:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1paJML-0007V2-Jt; Thu, 09 Mar 2023 11:43:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1paJAA-00065U-6z for emacs-devel@gnu.org; Thu, 09 Mar 2023 11:30:42 -0500 Original-Received: from 10.mo575.mail-out.ovh.net ([46.105.79.203]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1paJA8-0002kf-Co for emacs-devel@gnu.org; Thu, 09 Mar 2023 11:30:41 -0500 Original-Received: from director4.ghost.mail-out.ovh.net (unknown [10.108.16.31]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 7669222A5F for ; Thu, 9 Mar 2023 16:30:26 +0000 (UTC) Original-Received: from ghost-submission-6684bf9d7b-fltmn (unknown [10.109.156.224]) by director4.ghost.mail-out.ovh.net (Postfix) with ESMTPS id B63F31FD80; Thu, 9 Mar 2023 16:30:24 +0000 (UTC) Original-Received: from ngraves.fr ([37.59.142.103]) by ghost-submission-6684bf9d7b-fltmn with ESMTPSA id Xk7zMKAJCmQcKR0ABrYVEg (envelope-from ); Thu, 09 Mar 2023 16:30:24 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-103G00502373128-a7ae-4a39-9774-cd069d525f5e, 0DC7F22B772D21B985E010E49B20A2FE772414A6) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 81.67.140.142 X-Mailer: git-send-email 2.39.2 X-Ovh-Tracer-Id: 694117293259481826 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdduiedgkeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepkeffgeetfffgffejgeejvdffgfdtvdeuueetgfefuedvjeegvdegjeejveeuueevnecukfhppeduvdejrddtrddtrddupdefjedrheelrddugedvrddutdefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopegvmhgrtghsqdguvghvvghlsehgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeehpdhmohguvgepshhmthhpohhuth Received-SPF: pass client-ip=46.105.79.203; envelope-from=ngraves@ngraves.fr; helo=10.mo575.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 09 Mar 2023 11:43:16 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304214 Archived-At: --- lisp/auth-source-pass.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el index dbcc9d05753..5e232b44438 100644 --- a/lisp/auth-source-pass.el +++ b/lisp/auth-source-pass.el @@ -69,6 +69,11 @@ Unix password store'." :type 'boolean :version "29.1") +(defcustom auth-source-pass-file-extension "gpg" + "File extension to expect for auth-source-pass." + :type 'string + :version "30.1") + (cl-defun auth-source-pass-search (&rest spec &key backend type host user port require max @@ -195,9 +200,10 @@ See `auth-source-pass-get'." (defun auth-source-pass--read-entry (entry) "Return a string with the file content of ENTRY." (with-temp-buffer - (insert-file-contents (expand-file-name - (format "%s.gpg" entry) - auth-source-pass-filename)) + (insert-file-contents + (expand-file-name + (format (concat "%s." auth-source-pass-file-extension) entry) + auth-source-pass-filename)) (buffer-substring-no-properties (point-min) (point-max)))) (defun auth-source-pass-parse-entry (entry) @@ -238,7 +244,8 @@ CONTENTS is the contents of a password-store formatted file." (let ((store-dir (expand-file-name auth-source-pass-filename))) (mapcar (lambda (file) (file-name-sans-extension (file-relative-name file store-dir))) - (directory-files-recursively store-dir "\\.gpg\\'")))) + (directory-files-recursively + store-dir (concat "\\." auth-source-pass-file-extension "\\'"))))) (defun auth-source-pass--find-match (hosts user port) "Return password-store entry data matching HOSTS, USER and PORT. -- 2.39.2