]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: trim doveadm dump dcrypt-key input
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Tue, 18 Oct 2016 11:57:31 +0000 (14:57 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 19 Oct 2016 12:43:24 +0000 (15:43 +0300)
dcrypt does not like extra newlines at the end of a key.

src/doveadm/doveadm-dump-dcrypt-key.c

index 781b5c56d13ae074a6cffc24050cca69bfee900c..532cbec4e3d704f5fe4d41d4cc5e13e9f63b9fff 100644 (file)
@@ -178,13 +178,14 @@ static bool dcrypt_key_dump_metadata(const char *filename, bool print)
        if (key_hash != NULL)
                printf("key_hash: %s\n", key_hash);
 
+       const char *data = t_str_rtrim(buf, "\r\n\t ");
        switch (kind) {
        case DCRYPT_KEY_KIND_PUBLIC:
-               dcrypt_dump_public_key_metadata(buf);
+               dcrypt_dump_public_key_metadata(data);
                break;
        case DCRYPT_KEY_KIND_PRIVATE:
                if (encryption_type == DCRYPT_KEY_ENCRYPTION_TYPE_NONE)
-                       dcrypt_dump_private_key_metadata(buf);
+                       dcrypt_dump_private_key_metadata(data);
                break;
        }
        return TRUE;