From unknown Sat Jun 14 19:03:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#76168: 30.0.91; auth-source backend password-store has no way to pass :force to nntp-send-authinfo Resent-From: Mekeor Melire Original-Sender: "Debbugs-submit" Resent-CC: larsi@gnus.org, damien@cassou.me, nicolas@petton.fr, camalot@picnicpark.org, bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Sun, 09 Feb 2025 23:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 76168 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: To: 76168@debbugs.gnu.org Cc: Lars Magne Ingebrigtsen , Damien Cassou , Nicolas Petton , Keith Amidon X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Lars Magne Ingebrigtsen , Damien Cassou , Nicolas Petton , Keith Amidon Received: via spool by submit@debbugs.gnu.org id=B.173914551830052 (code B ref -1); Sun, 09 Feb 2025 23:59:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 Feb 2025 23:58:38 +0000 Received: from localhost ([127.0.0.1]:46905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1thHC9-0007od-Gn for submit@debbugs.gnu.org; Sun, 09 Feb 2025 18:58:38 -0500 Received: from lists.gnu.org ([2001:470:142::17]:56390) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1thHC3-0007oG-5i for submit@debbugs.gnu.org; Sun, 09 Feb 2025 18:58:34 -0500 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 1thHBw-0001aR-QW for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2025 18:58:25 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1thHBu-0004rd-1j for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2025 18:58:24 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 801FF240101 for ; Mon, 10 Feb 2025 00:58:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1739145498; bh=FYo55CMVtlsm3w3ChM9eeyHMinOFFTUbarElsIN08+8=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=lkNiGOlj1iFWTODaGGhxle+/l5FcbqzRmdOfUgyMhlQIayNnm3iftb/pIBsnTzzHl 6IS4RB9nB40odBgYRj9a1dYh5B5NmsT3cNfvmkR4RLQ85oJeYht7Ruve5Nhjyuy8N/ 9p71fUY2JpotvAypI4T7hjOVKanqTeKu/OpmU3ico7dKQ4OkPDCRCVkoWTTwcx02+r 0hVc2TBx0xxPG57PAeWgKfc7XsAbSQO17dGdW+idktxRAbsVs8Q+01tmAlFdXE/8/w eCUJiDa6ffY3rpCpwRORkxQuk6jlZD/WLxuHlvvY7rELR+v4J9WBioZHrqExpqFCRr btkxKUBFKP7+A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Yrl5j5ZnBz9rxD; Mon, 10 Feb 2025 00:58:17 +0100 (CET) From: Mekeor Melire Date: Sun, 09 Feb 2025 23:57:50 +0000 Message-ID: <87o6zawu0x.fsf@posteo.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=mekeor@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain BACKGROUND The Gnus backend nntp features entries in ~/.authinfo with a field names `force'. In fact, the nntp server I use, has the following setup instructions for Gnus: --=-=-= Content-Type: text/plain Content-Disposition: inline add the following line to .authinfo: machine ... login ... force yes password ... --=-=-= Content-Type: text/plain BUG DESCRIPTION Unfortunately, it is currently not possible to set this kind of `force' flag with `password-store' as auth-source backend, as implemented in lisp/auth-source-pass.el. WORKAROUND As a workaround, users can just set `nntp-authinfo-force' to non-nil. But this will then of course affect all nntp servers, not just a specific one. BUG EXPLANATION The bug emerges as follows: - `nntp-send-authinfo' (lisp/gnus/nntp.el) calls `auth-source-search' and accesses the `:force' property of its car. - `auth-source-pass--build-result' (lisp/auth-source-pass.el) handles "host", "port", "user", and "secret" line-labels in password-store entries explicitly but no "force". POSSIBLE FIX One approach to fix this bug would be to teach `auth-source-pass--build-result' about `force': --=-=-= Content-Type: text/x-patch Content-Disposition: inline (defun auth-source-pass--build-result (hosts port user) "Build auth-source-pass entry matching HOSTS, PORT and USER. HOSTS can be a string or a list of strings." (let ((entry-data (auth-source-pass--find-match hosts user port))) (when entry-data (let ((retval (list + :force (auth-source-pass--get-attr "force" entry-data) :host (auth-source-pass--get-attr "host" entry-data) :port (or (auth-source-pass--get-attr "port" entry-data) port) :user (or (auth-source-pass--get-attr "user" entry-data) user) :secret (lambda () (auth-source-pass--get-attr 'secret entry-data))))) (auth-source-pass--do-debug "return %s as final result (plus hidden password)" (seq-subseq retval 0 -2)) ;; remove password retval)))) --=-=-= Content-Type: text/plain Then users could have password-store entries like: --=-=-= Content-Type: text/plain Content-Disposition: inline my-secret-password force: yes user: my-user-name --=-=-=--