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

David Bremner david at tethera.net
Tue May 1 18:42:25 PDT 2018


Daniel Kahn Gillmor <dkg at 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.


More information about the notmuch mailing list