libnm-core: empty key is not a pkcs12 file

nmcli> set 802-1x.ca-cert file:///tmp/certs/eaptest_ca_cert.pem
  (process:31015): libnm-CRITICAL **: crypto_is_pkcs12_data: assertion 'data != NULL' failed
  Error: failed to set 'ca-cert' property: PEM certificate had no start tag '-----BEGIN CERTIFICATE-----'.
This commit is contained in:
Lubomir Rintel
2016-04-20 07:54:19 +02:00
parent 76348adb8e
commit 1d66d415b8
2 changed files with 6 additions and 0 deletions

View File

@@ -641,6 +641,9 @@ crypto_is_pkcs12_data (const guint8 *data,
GError *local = NULL;
gboolean success;
if (!data_len)
return FALSE;
g_return_val_if_fail (data != NULL, FALSE);
if (!crypto_init (error))

View File

@@ -654,6 +654,9 @@ crypto_is_pkcs12_data (const GByteArray *data)
g_return_val_if_fail (data != NULL, FALSE);
if (!data->len)
return FALSE;
success = crypto_verify_pkcs12 (data, NULL, &error);
if (success == FALSE) {
/* If the error was just a decryption error, then it's pkcs#12 */