Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1B2E2431FBC for ; Sat, 7 Mar 2015 09:19:58 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 1.738 X-Spam-Level: * X-Spam-Status: No, score=1.738 tagged_above=-999 required=5 tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SK9A1qSywhW1 for ; Sat, 7 Mar 2015 09:19:54 -0800 (PST) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A8246431FAE for ; Sat, 7 Mar 2015 09:19:54 -0800 (PST) Received: by widex7 with SMTP id ex7so9766955wid.3 for ; Sat, 07 Mar 2015 09:19:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=0ATfHU3xBnnOJyL9PU+vptwUULLxihntaTQsEMFAVDc=; b=WPxzAjQmYEdYYwtFlUBmrfmQSfPccoposyQr0OpeZhMPOkb5G8glSYZye7hD1XB6j6 F5Os0+aVlTyt6EPWTH0kbpqRMpNm9pYpZdNkamLXmdQv8gExOXTHR6RVqkyZ3X+d5AsY o/FFp6+JU0iDeyzxDJbjDx1u+cTBdwhqwEBZTZmLKXAFe32/YHvB8QYCaiD3RHYP+ipE c2Qtoe0fXAhWNZc0fFn82dIT/+exBKzkreOBycTrfXFzYP3FqpJ2WIrbmAn9K7ehFjqn Chxfo6WJW9YRZFhe7vyWpcqpP7csWGNBJHrz55RXG58nOR6Ib6WPWsz5mvN7zkNf7YjG sUOQ== X-Gm-Message-State: ALoCoQnrRTZ1qMhbgO/cnbrK3Xn9kn9JZntYLGSQX7PG9FlNiY/aOcSU7L/2NAyR4z9o0eDWYyF1 X-Received: by 10.180.103.40 with SMTP id ft8mr89542469wib.68.1425748793761; Sat, 07 Mar 2015 09:19:53 -0800 (PST) Received: from localhost (mobile-internet-bcee3b-76.dhcp.inet.fi. [188.238.59.76]) by mx.google.com with ESMTPSA id bd3sm7427211wib.17.2015.03.07.09.19.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Mar 2015 09:19:53 -0800 (PST) From: Jani Nikula To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] CLI: make gpg binary used by libgmime configurable. In-Reply-To: <1418155271-23704-2-git-send-email-david@tethera.net> References: <1418155271-23704-1-git-send-email-david@tethera.net> <1418155271-23704-2-git-send-email-david@tethera.net> User-Agent: Notmuch/0.19+74~g6aeef2e (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Sat, 07 Mar 2015 19:20:12 +0200 Message-ID: <87d24kiv1v.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Mar 2015 17:19:58 -0000 On Tue, 09 Dec 2014, David Bremner wrote: > Previously we set up a way for the top level notmuch command to choose > which gpg binary was invoked by libgmime. In this commit we add the > (mostly boilplate) code to allow the notmuch-config command to read > and write this path, and use it in the appropriate struct. This should probably add the section comment in notmuch_config_open(). For a lot of things we add the default to the config if it isn't there already. I'm undecided whether this is a good approach in general, and whether we should push the "gpg" hardcoding to the config code. For the time being I'm fine with this as it is, and we should probably have a look at the config code at a later time anyway. Is "gpg" as a section name too specific? Does this lead to having to add other sections for crypto/security/privacy stuff if it isn't related to gpg? *shrug*. BR, Jani. > --- > notmuch-client.h | 7 +++++++ > notmuch-config.c | 15 +++++++++++++++ > notmuch-reply.c | 2 ++ > notmuch-show.c | 2 ++ > 4 files changed, 26 insertions(+) > > diff --git a/notmuch-client.h b/notmuch-client.h > index c25c4ea..fad81d5 100644 > --- a/notmuch-client.h > +++ b/notmuch-client.h > @@ -279,6 +279,13 @@ notmuch_config_set_database_path (notmuch_config_t *config, > const char *database_path); > > const char * > +notmuch_config_get_gpg_path (notmuch_config_t *config); > + > +void > +notmuch_config_set_gpg_path (notmuch_config_t *config, > + const char *gpg_path); > + > +const char * > notmuch_config_get_user_name (notmuch_config_t *config); > > void > diff --git a/notmuch-config.c b/notmuch-config.c > index a564bca..7aef1b6 100644 > --- a/notmuch-config.c > +++ b/notmuch-config.c > @@ -107,6 +107,7 @@ struct _notmuch_config { > notmuch_bool_t is_new; > > char *database_path; > + char *gpg_path; > char *user_name; > char *user_primary_email; > const char **user_other_email; > @@ -690,6 +691,20 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t *config, > &(config->search_exclude_tags)); > } > > +const char * > +notmuch_config_get_gpg_path (notmuch_config_t *config) > +{ > + return _config_get (config, &config->gpg_path, "gpg", "path"); > +} > + > +void > +notmuch_config_set_gpg_path (notmuch_config_t *config, > + const char *gpg_path) > +{ > + _config_set (config, &config->gpg_path, "gpg", "path", gpg_path); > +} > + > + > /* Given a configuration item of the form . return the > * component group and key. If any error occurs, print a message on > * stderr and return 1. Otherwise, return 0. > diff --git a/notmuch-reply.c b/notmuch-reply.c > index e18370f..d6d3315 100644 > --- a/notmuch-reply.c > +++ b/notmuch-reply.c > @@ -822,6 +822,8 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[]) > return EXIT_FAILURE; > } > > + params.crypto.gpgpath = notmuch_config_get_gpg_path (config); > + > if (notmuch_database_open (notmuch_config_get_database_path (config), > NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) > return EXIT_FAILURE; > diff --git a/notmuch-show.c b/notmuch-show.c > index d292f29..b0d4609 100644 > --- a/notmuch-show.c > +++ b/notmuch-show.c > @@ -1204,6 +1204,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) > return EXIT_FAILURE; > } > > + params.crypto.gpgpath = notmuch_config_get_gpg_path (config); > + > if (notmuch_database_open (notmuch_config_get_database_path (config), > NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much)) > return EXIT_FAILURE; > -- > 2.1.3 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch