From eb2cdc07f275d565b76940396381784e29125981 Mon Sep 17 00:00:00 2001
From: Gurmeen Bindra <gurmeen.bindra@isode.com>
Date: Wed, 11 Nov 2015 15:42:00 +0000
Subject: Fix sluift API for clearing certificate

Before this patch it was calling the constructor and creating certificate
object with empty string. This was causing tests to fail when client was
set with null certificate.
This object fixes it by setting the certificate object to Null if the
certificate file is empty.

Test-information:
Test cases using sluift with this API that set null certificate now pass

Change-Id: Id75e22b58afebb2db463a7a23a4ca0686ef6eb12

diff --git a/Sluift/client.cpp b/Sluift/client.cpp
index 813c180..997fd00 100644
--- a/Sluift/client.cpp
+++ b/Sluift/client.cpp
@@ -751,7 +751,11 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
 			++index;
 		}
 	}
-	getClient(L)->getClient()->setCertificate(boost::make_shared<PKCS12Certificate>(file, createSafeByteArray(pwd)));
+	if (file.empty()) {
+		getClient(L)->getClient()->setCertificate(CertificateWithKey::ref());
+	} else {
+		getClient(L)->getClient()->setCertificate(boost::make_shared<PKCS12Certificate>(file, createSafeByteArray(pwd)));
+	}
 	return 0;
 }
 
-- 
cgit v0.10.2-6-g49f6