mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 745863 - Debug logging is not compiled out in NSSBridge. r=wesj
This commit is contained in:
parent
725f0b699e
commit
5a7a52d29a
@ -18,7 +18,7 @@
|
||||
#ifdef DEBUG
|
||||
#define LOG(x...) __android_log_print(ANDROID_LOG_INFO, "GeckoJNI", x)
|
||||
#else
|
||||
#define LOG(x...) printf(x);
|
||||
#define LOG(x...)
|
||||
#endif
|
||||
|
||||
static bool initialized = false;
|
||||
@ -44,9 +44,8 @@ setup_nss_functions(void *nss_handle,
|
||||
void *nspr_handle,
|
||||
void *plc_handle)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "setup nss 1");
|
||||
if (nss_handle == NULL || nspr_handle == NULL || plc_handle == NULL) {
|
||||
LOG("missing handle\n");
|
||||
LOG("Missing handle\n");
|
||||
return FAILURE;
|
||||
}
|
||||
#define GETFUNC(name) f_ ## name = (name ## _t) __wrap_dlsym(nss_handle, #name); \
|
||||
@ -151,7 +150,7 @@ doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool
|
||||
SECStatus rv;
|
||||
PK11SlotInfo *slot;
|
||||
if (!initialized) {
|
||||
LOG("initialize crypto %s\n", path);
|
||||
LOG("Initialize crypto in %s\n", path);
|
||||
rv = f_NSS_Initialize(path, "", "", "secmod.db", NSS_INIT_NOROOTINIT);
|
||||
if (rv != SECSuccess) {
|
||||
throwError(jenv, "NSS_Initialize");
|
||||
@ -167,7 +166,7 @@ doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool
|
||||
}
|
||||
|
||||
if (f_PK11_NeedUserInit(slot)) {
|
||||
LOG("Initializing key3.db with default blank password.");
|
||||
LOG("Initializing key3.db with default blank password.\n");
|
||||
rv = f_PK11_InitPin(slot, NULL, NULL);
|
||||
if (rv != SECSuccess) {
|
||||
throwError(jenv, "PK11_InitPin");
|
||||
@ -182,7 +181,8 @@ doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool
|
||||
reply.len = 0;
|
||||
|
||||
if (encrypt) {
|
||||
LOG("encrypting %s\n", value);
|
||||
// This can print sensitive data. Uncomment if you need it.
|
||||
// LOG("Encrypting: %s\n", value);
|
||||
request.data = (unsigned char*)value;
|
||||
request.len = strlen(value);
|
||||
|
||||
@ -201,9 +201,9 @@ doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool
|
||||
throwError(jenv, "encode");
|
||||
goto done;
|
||||
}
|
||||
LOG("encrypted %s\n", *result);
|
||||
LOG("Encrypted: %s\n", *result);
|
||||
} else {
|
||||
LOG("decoding %s\n", value);
|
||||
LOG("Decoding: %s\n", value);
|
||||
rv = decode(value, &request.data, (PRInt32*)&request.len);
|
||||
if (rv != SECSuccess) {
|
||||
throwError(jenv, "decode");
|
||||
@ -220,7 +220,8 @@ doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool
|
||||
strncpy(*result, (char *)reply.data, reply.len);
|
||||
(*result)[reply.len] = '\0';
|
||||
|
||||
LOG("decoded %i letters %s\n", reply.len, *result);
|
||||
// This can print sensitive data. Uncomment if you need it.
|
||||
// LOG("Decoded %i letters: %s\n", reply.len, *result);
|
||||
free(request.data);
|
||||
}
|
||||
|
||||
@ -275,14 +276,13 @@ decode(const char *data, unsigned char **result, PRInt32 *length)
|
||||
if (!decoded) {
|
||||
return SECFailure;
|
||||
}
|
||||
|
||||
LOG("xxx Decoded: %s\n", decoded);
|
||||
|
||||
if (!*decoded) {
|
||||
return SECFailure;
|
||||
}
|
||||
|
||||
*length = (len*3)/4 - adjust;
|
||||
LOG("Decoded %i chars into %i chars\n", len, *length);
|
||||
|
||||
*result = (unsigned char*)malloc((size_t)len);
|
||||
|
||||
if (!*result) {
|
||||
|
Loading…
Reference in New Issue
Block a user