aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2010-06-22 16:19:55 +0200
committerTobias Brunner <tobias@strongswan.org>2010-06-22 16:19:55 +0200
commita427e98da17b33d6e98c0dd41f18e13e961e23f3 (patch)
tree5b0794f07b413e7d9f48d8fca14b2aa3ee7b11b4
parentf283520fafa8df21ef8231c3c4f6347516d5729f (diff)
downloadstrongswan-a427e98da17b33d6e98c0dd41f18e13e961e23f3.tar.bz2
strongswan-a427e98da17b33d6e98c0dd41f18e13e961e23f3.tar.xz
The signature of keystore_get was changed with Android 2.x.
-rw-r--r--src/libcharon/plugins/android/android_creds.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libcharon/plugins/android/android_creds.c b/src/libcharon/plugins/android/android_creds.c
index d91686b77..001849615 100644
--- a/src/libcharon/plugins/android/android_creds.c
+++ b/src/libcharon/plugins/android/android_creds.c
@@ -199,20 +199,30 @@ METHOD(android_creds_t, add_certificate, bool,
certificate_t *cert = NULL;
bool status = FALSE;
chunk_t chunk;
- this->lock->write_lock(this->lock);
+#ifdef KEYSTORE_MESSAGE_SIZE
+ char value[KEYSTORE_MESSAGE_SIZE];
+ chunk.ptr = value;
+ chunk.len = keystore_get(name, chunk.ptr);
+ if (chunk.len > 0)
+#else
+ /* 1.6 interface, allocates memory */
chunk.ptr = keystore_get(name, &chunk.len);
if (chunk.ptr)
+#endif /* KEYSTORE_MESSAGE_SIZE */
{
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509,
BUILD_BLOB_PEM, chunk, BUILD_END);
if (cert)
{
+ this->lock->write_lock(this->lock);
this->certs->insert_last(this->certs, cert);
+ this->lock->unlock(this->lock);
status = TRUE;
}
+#ifndef KEYSTORE_MESSAGE_SIZE
free(chunk.ptr);
+#endif /* KEYSTORE_MESSAGE_SIZE */
}
- this->lock->unlock(this->lock);
return status;
}