From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 4A0526DE00B4 for ; Tue, 1 May 2018 18:42:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D4XgcwitpMd7 for ; Tue, 1 May 2018 18:42:27 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 485B26DE00AC for ; Tue, 1 May 2018 18:42:27 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1fDgmo-0006Fx-IF; Tue, 01 May 2018 21:42:26 -0400 Received: (nullmailer pid 3294 invoked by uid 1000); Wed, 02 May 2018 01:42:25 -0000 From: David Bremner To: Daniel Kahn Gillmor , Notmuch Mail Subject: Re: [PATCH v2 3/5] cli: write session keys to database, if asked to do so In-Reply-To: <20180110001228.2211-4-dkg@fifthhorseman.net> References: <20180110001228.2211-1-dkg@fifthhorseman.net> <20180110001228.2211-4-dkg@fifthhorseman.net> Date: Tue, 01 May 2018 22:42:25 -0300 Message-ID: <87fu3ag7em.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.26 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: Wed, 02 May 2018 01:42:28 -0000 Daniel Kahn Gillmor writes: > + > +#if HAVE_GMIME_SESSION_KEYS > + if (node->ctx->crypto->decrypt == NOTMUCH_DECRYPT_TRUE && message) { > + notmuch_database_t *db = notmuch_message_get_database (message); > + const char *sk = g_mime_decrypt_result_get_session_key (decrypt_result); > + if (db && sk) { > + notmuch_status_t status; > + status = notmuch_message_add_property (message, "session-key", sk); > + if (status) > + fprintf (stderr, "Failed to stash session key in the database (%d) %s\n", > + status, notmuch_status_to_string (status)); > + } > + } > +#endif As a nit, I don't really like sk as a variable name. It might be worth definining a "print_status_message", along the lines of print_status_query in status.c and using it here and in the next commit. That would also handle any use of _notmuch_database_log.