Comment 15 for bug 1394582

Revision history for this message
Dmitry Nurislamov (nimms) wrote :

I'm experiencing the issue in Linux Mint 18 too.

I installed the package `nemo-seahorse_3.0.0+sarah` which adds
Seahorse integration to Nemo File Manager. It is based on seahorse-nautilus
and uses libcryptui internally.

Signing the files works, but I can't encrypt them. After choosing recipients
and pressing "OK" the window just closes without any messages,
leaving me with nothing. The package contains the tool called `seahorse-tool`,
which the Nemo plug-in internally uses. If I try to start it manually
from the terminal, I get the same result.

Now I'll try to explain why I think the Vlad's fix is correct.

The tool uses the `cryptui_prompt_recipients()` function. As Vlad already said,
the function calls `cryptui_prompt_recipients_with_symmetric()`
with the `NULL` value for its `symmetric` parameter. The problem is that
the imperative code block doesn't work with `symmetric` set to `NULL`.

So look at the definition of the `keys` pointer, which the function returns:
    gchar **keys = NULL;

Now look at the faulty code block:
    if (symmetric != NULL && !*symmetric) {
        /* ... */
        keys = g_new0(gchar*, g_list_length (recipients) + 1);
        for (l = recipients, i = 0; l; l = g_list_next (l), i++)
            keys[i] = g_strdup (l->data);
        /* ... */
    }

When the `symmetric` is set to `NULL`, this block never runs, so the function
returns `NULL`, which the calling program gets and can't do anything.

Let's rewrite the condition to be clearer:
    if (symmetric != NULL && *symmetric == FALSE)

`symmetric == NULL` and `*symmetric == FALSE` should mean the same,
as the comment states:
    @symmetric: Variable in which to store if symmetric encryption is requested.
    Set to NULL to disable symmetric encryption.

The correct condition, which the patch uses, is:
    if (symmetric == NULL || *symmetric == FALSE)

So it *is* a logic flaw. The Vlad's patch fixes it.