From: Tobias Brunner Date: Tue, 22 Jun 2010 14:19:55 +0000 (+0200) Subject: The signature of keystore_get was changed with Android 2.x. X-Git-Tag: 4.4.1~143 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a427e98da17b33d6e98c0dd41f18e13e961e23f3;p=thirdparty%2Fstrongswan.git The signature of keystore_get was changed with Android 2.x. --- diff --git a/src/libcharon/plugins/android/android_creds.c b/src/libcharon/plugins/android/android_creds.c index d91686b778..0018496154 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; }