From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71969: [PATCH] Support interactive D-Bus authentication Date: Sat, 06 Jul 2024 13:54:49 +0200 Message-ID: <87o77a20s6.fsf@gmx.de> References: <877cdzklbd.fsf@stebalien.com> Reply-To: Michael Albinus Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15624"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: steven@stebalien.com To: 71969@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 06 13:56:30 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1sQ41l-0003ol-VP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Jul 2024 13:56:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQ41J-0005r7-Ch; Sat, 06 Jul 2024 07:56:01 -0400 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 1sQ41H-0005nL-99 for bug-gnu-emacs@gnu.org; Sat, 06 Jul 2024 07:55:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQ41G-0006Xb-W8 for bug-gnu-emacs@gnu.org; Sat, 06 Jul 2024 07:55:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sQ41K-0006fk-I6 for bug-gnu-emacs@gnu.org; Sat, 06 Jul 2024 07:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Jul 2024 11:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71969 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Steven Allen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: 71969@debbugs.gnu.org, Steven Allen Original-Received: via spool by 71969-submit@debbugs.gnu.org id=B71969.172026690925556 (code B ref 71969); Sat, 06 Jul 2024 11:56:02 +0000 Original-Received: (at 71969) by debbugs.gnu.org; 6 Jul 2024 11:55:09 +0000 Original-Received: from localhost ([127.0.0.1]:45694 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQ40S-0006e7-J6 for submit@debbugs.gnu.org; Sat, 06 Jul 2024 07:55:08 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:39823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQ40O-0006dW-SZ for 71969@debbugs.gnu.org; Sat, 06 Jul 2024 07:55:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1720266892; x=1720871692; i=michael.albinus@gmx.de; bh=IEgc5gFpGRXTXnDj3rlnBW44OBFtvjPk5h1l1fAQGpY=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=j1+hqYbDZ77qpQOH2XnpBCPqnIkfJVEgwl2Q8MDtDol7cft+2vVkLgsv8Se3jmT6 c7BGnQfbRoxO3dT1YftU0PS1HwJXgqNSzn8FjE5E1RG7DUXI103JhkLevOpLGvZzR 1uUhOdhDSj8MDf+mM38uTJOo8ap4Ot7KB/IyM+ze4HgB7DzxLD5Q+yrrbxjwZWXia e2XRuEjtyBEVRSlMGaPC0cDGNwVwp14wjDMj9Sj60N4lfFmOjP8Tt720dlsnQ1hwX 3wWoVcCtoRlNQWhFn3lkdbo3+haWmc2zDQIBP25vmm5ur3kLRiJqbqrsttQht+6Fp je79AT+WU4x9A/9/OA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MeCtj-1rsNwZ08xT-00cYqs; Sat, 06 Jul 2024 13:54:52 +0200 In-Reply-To: <877cdzklbd.fsf@stebalien.com> (Steven Allen via's message of "Sat, 06 Jul 2024 09:53:58 +0200") X-Provags-ID: V03:K1:eU3YT0G4wnixyfcrVmERJldADaW+M6qU3MOcMbRGpVirVGMvHAM /U0GphpC1iEKjy5OB+yKGNrDc9k+MaXmLMLEqKQg1jjbCPKRbJDnw+xKdPNrmv5gROVVw/C gv8tczR6yY1Uw3wp700g8s53LNm4Vcw0PItW+GNRUXiz8nJThbfYwtuU/EsEXa1z/SnK3HO gJj7/TY4gWiLPBPYO68dg== UI-OutboundReport: notjunk:1;M01:P0:PjR5cygnNyE=;Vma6Tk1Zo97mz8zYN8f17hVTcTL t2vvEQl3q0drlsIJteABE7KwtBhpHM67juXctwPAMcOCAh2QyOTUWdQ21XnUsyih2uMcVxbwK IjWz1Cynp13NkoV1jP5m5VVnjmToqplNbkiMoLi9WpYlSmBWw1y7WSPrJnszX0PFyAumdjUq/ gFMMQp42ioJri/FoL6uJRgzCDITKxBXwg/GGiKCcIB81DOE4eJIZP4kiJjtBIuZLeSjTl0Wqw zW3Vdiaxh29DbGpiYQTMdv0Pp33Gv3jGd11oXoCgIZV1jAcntnoxoHJ/5a8Ybl9MgBFLkwXZi c4HByFk1f3EaK6ILR/JYOMrCv6n7Fxn+skKl+XH02t7d95brBUjH+ubBnnsWI6s9NBoochz8G jD26Hl7LLBoWKUZTCkOGruNy0+nI+7LO8C99hskILs6jnuEtIhwugn5xm3mUmK5JO3djTRZSG s7pxp+N8MrgSG9zh0VW5Ao258GAfSqAsSy0MYA5Mw/VClzq/JNnNHoCB8JK6xu1lBGbqubfzf CD60K1nP0kyfzOIoiI1FWFUYQP45TW9PhXZ3f6MFgk0vFLYrMemAbXT52rwxWsgYlNiGNe7zk FcD7vlIZeiyJ3/FJRgQjfmfCTANSszEe5zinrFDvBNyu1puLcdncLHl3cfq5bMbfjHSjw/wQv ECM+9bT5cWU5ogdKcM8upaF15Ps52voc+WwlefG1PvzTpzDo+OkN3VmmCwwCd9kXMN2xzeEKM Acjt8cuDeAJQOnFC2x1Bkaahwo9/lkeExbJ3CAsFI24mtkqUZd7G7imQKT1i9Cv/T0eQF1F6 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288493 Archived-At: Steven Allen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: Hi Steven, > When invoking D-Bus methods, let the user enable interactive > authorization by passing an :authenticate t parameter. This makes it > possible to D-Bus methods that require polkit authorization. Thanks for the patch, it looks interesting. Since I've never used D-Bus interactive authentication, could you pls provide an example that I could see it in action? I'm running Fedora 40, if that matters. Bonus point, if you could add a test to dbus-tests.el. > Alternatively, we could allow interactive authorization unconditionally, > but I'd prefer to leave it up to the caller. Agreed. > From fa996a3363e9bcefb547c2a587d55b279d44c5dd Mon Sep 17 00:00:00 2001 > From: Steven Allen > Date: Thu, 4 Jul 2024 20:45:07 +0200 > Subject: [PATCH] Support interactive D-Bus authentication > > When invoking D-Bus methods, let the user enable interactive > authorization by passing an :authenticate t parameter. This makes it > possible to D-Bus methods that require polkit authorization. Do you mean authorization or authentication? I guess authorization. Pls change all places consistently. > +++ b/src/dbusbind.c > @@ -1512,12 +1512,23 @@ DEFUN ("dbus-message-internal", Fdbus_message_internal, Sdbus_message_internal, > XD_SIGNAL1 (build_string ("Unable to create an error message")); > } > > - /* Check for timeout parameter. */ > - if ((count + 2 <= nargs) && EQ (args[count], QCtimeout)) > + while ((count + 2 <= nargs)) > { > - CHECK_FIXNAT (args[count+1]); > - timeout = min (XFIXNAT (args[count+1]), INT_MAX); > - count = count+2; > + /* Check for timeout parameter. */ > + if (EQ (args[count], QCtimeout)) > + { > + CHECK_FIXNAT (args[count+1]); > + timeout = min (XFIXNAT (args[count+1]), INT_MAX); > + count = count+2; > + } > + /* Check for authenticate parameter. */ > + else if (EQ (args[count], QCauthenticate)) > + { > + dbus_message_set_allow_interactive_authorization > + (dmessage, NILP (args[count+1]) ? FALSE : TRUE); > + count = count+2; > + } > + else break; I guess, we shall check only in case the message type is DBUS_MESSAGE_TYPE_METHOD_CALL. Otherwise, if there is a :timeout or :authorize keyword, we shall raise an error. Furthermore, does exist dbus_message_set_allow_interactive_authorization "since ever"? Or shall we check for the existence in configure.ac, like we do it with other dbus_* functions? Best regards, Michael.