The signature of keystore_get was changed with Android 2.x.

This commit is contained in:
Tobias Brunner
2010-06-22 16:19:55 +02:00
parent f283520faf
commit a427e98da1
+12 -2
View File
@@ -199,20 +199,30 @@ METHOD(android_creds_t, add_certificate, bool,
certificate_t *cert = NULL; certificate_t *cert = NULL;
bool status = FALSE; bool status = FALSE;
chunk_t chunk; 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); chunk.ptr = keystore_get(name, &chunk.len);
if (chunk.ptr) if (chunk.ptr)
#endif /* KEYSTORE_MESSAGE_SIZE */
{ {
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509, cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509,
BUILD_BLOB_PEM, chunk, BUILD_END); BUILD_BLOB_PEM, chunk, BUILD_END);
if (cert) if (cert)
{ {
this->lock->write_lock(this->lock);
this->certs->insert_last(this->certs, cert); this->certs->insert_last(this->certs, cert);
this->lock->unlock(this->lock);
status = TRUE; status = TRUE;
} }
#ifndef KEYSTORE_MESSAGE_SIZE
free(chunk.ptr); free(chunk.ptr);
#endif /* KEYSTORE_MESSAGE_SIZE */
} }
this->lock->unlock(this->lock);
return status; return status;
} }