From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Petton Newsgroups: gmane.emacs.bugs Subject: bug#15520: 24.3; secrets.el secrets-create-item has wrong dbus arguments (fix included) Date: Wed, 02 Oct 2013 19:20:06 +0200 Message-ID: <1380734406.9521.13.camel@lingonberry> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1380832232 21928 80.91.229.3 (3 Oct 2013 20:30:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Oct 2013 20:30:32 +0000 (UTC) To: 15520@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 03 22:30:36 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VRpXe-0003jU-Tx for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Oct 2013 22:30:35 +0200 Original-Received: from localhost ([::1]:45079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRpXe-0005eR-IV for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Oct 2013 16:30:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRpXO-0005Uf-RA for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2013 16:30:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRpXG-00063B-3q for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2013 16:30:18 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRpXG-000635-19 for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2013 16:30:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VRpXF-0006cy-11 for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2013 16:30:09 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Petton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Oct 2013 20:30:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15520 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138083216625329 (code B ref -1); Thu, 03 Oct 2013 20:30:08 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Oct 2013 20:29:26 +0000 Original-Received: from localhost ([127.0.0.1]:52378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VRpWW-0006aS-Uf for submit@debbugs.gnu.org; Thu, 03 Oct 2013 16:29:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57353) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VRQ6I-0001I1-N6 for submit@debbugs.gnu.org; Wed, 02 Oct 2013 13:20:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRQ69-0006EM-Oa for submit@debbugs.gnu.org; Wed, 02 Oct 2013 13:20:38 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRQ69-0006ED-Lu for submit@debbugs.gnu.org; Wed, 02 Oct 2013 13:20:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRQ60-0007Zj-Rz for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2013 13:20:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRQ5s-000646-Fg for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2013 13:20:20 -0400 Original-Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:49781) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRQ5s-00063h-5b for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2013 13:20:12 -0400 Original-Received: by mail-wi0-f180.google.com with SMTP id hj3so1327481wib.1 for ; Wed, 02 Oct 2013 10:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:mime-version :content-transfer-encoding; bh=tMN4Ri6S5+vc4aRcSIcIPdeq3bNykxsfwTZ0nHtDh48=; b=RIRjvkKxQID4lvc+9wxXb9i9Jik9xa5y9ul405AIYs28uRB6ylbNmwnIf8fGnhrk5j w0WBdlIqwDKBWpWt7t3eVp+bc39hbUo73jig/Y+0X1/MQuHaLnhl3WUIFtmzjY/5bZnH o08LH9uQlQghMXnl+gLUK/OH4cAEOUE20qddL4dWVO+i/noWqTRtqD6PNR8pC/xoaK22 dF+CgiLGFFsbGRz2WEAkzkaehNm7y2HnKsniDCx1TBdwenloJCYeZCcl4ubH7P96D7q/ hp2iyAKose6/NIL1WB3yjNNLi4zqse0VKHH8p98rf9bJ6eTKQG9cQRki22oye2Y/1bZr g2Cw== X-Received: by 10.180.72.148 with SMTP id d20mr3061115wiv.21.1380734410871; Wed, 02 Oct 2013 10:20:10 -0700 (PDT) Original-Received: from [192.168.0.45] ([88.160.125.31]) by mx.google.com with ESMTPSA id q5sm5519178wiz.3.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 02 Oct 2013 10:20:10 -0700 (PDT) X-Mailer: Evolution 3.10.0-0ubuntu1~saucy1 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Thu, 03 Oct 2013 16:29:24 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78904 Archived-At: In secrets.el, secrets-create-item has the wrong label property for the created item, and the secret struct is not built correctly. Here's a new version that fixes the issue. (defun secrets-create-item (collection item password &rest attributes) "Create a new item in COLLECTION with label ITEM and password PASSWORD. ATTRIBUTES are key-value pairs set for the created item. The keys are keyword symbols, starting with a colon. Example: \(secrets-create-item \"Tramp collection\" \"item\" \"geheim\" :method \"sudo\" :user \"joe\" :host \"remote-host\"\) The object path of the created item is returned." (unless (member item (secrets-list-items collection)) (let ((collection-path (secrets-unlock-collection collection)) result props) (unless (secrets-empty-path collection-path) ;; Create attributes list. (while (consp (cdr attributes)) (unless (keywordp (car attributes)) (error 'wrong-type-argument (car attributes))) (setq props (add-to-list 'props (list :dict-entry (substring (symbol-name (car attributes)) 1) (cadr attributes)) 'append) attributes (cddr attributes))) ;; Create the item. (setq result (dbus-call-method :session secrets-service collection-path secrets-interface-collection "CreateItem" ;; Properties. (append `(:array (:dict-entry "org.freedesktop.Secret.Item.Label" (:variant ,item))) (when props `((:dict-entry "org.freedesktop.Secret.Item.Attributes" (:variant ,(append '(:array) props)))))) ;; Secret. `(:struct :object-path ,secrets-session-path ,(dbus-string-to-byte-array "") ,(dbus-string-to-byte-array password) "text/plain") ;; Do not replace. Replace does not seem to work. nil)) (secrets-prompt (cadr result)) ;; Return the object path. (car result)))))