Re: [PATCH v2 3/5] cli: write session keys to database, if asked to do so

Subject: Re: [PATCH v2 3/5] cli: write session keys to database, if asked to do so

Date: Tue, 01 May 2018 22:42:25 -0300

To: Daniel Kahn Gillmor, Notmuch Mail

Cc:

From: David Bremner


Daniel Kahn Gillmor <dkg@fifthhorseman.net> 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.
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: