summaryrefslogtreecommitdiffstats
path: root/cmds/keystore
diff options
context:
space:
mode:
authorChung-yih Wang <cywang@google.com>2009-07-04 22:19:51 +0800
committerChung-yih Wang <cywang@google.com>2009-07-05 11:06:01 +0800
commit6ac03019e68e6cd8732c5c1670eb71f4840010e2 (patch)
treeb35e00833f4fa339ad7160860f09f23cfc8cc9f9 /cmds/keystore
parent928f5052b5f7dfffa2921af769045d85eb483c79 (diff)
downloadframeworks_native-6ac03019e68e6cd8732c5c1670eb71f4840010e2.zip
frameworks_native-6ac03019e68e6cd8732c5c1670eb71f4840010e2.tar.gz
frameworks_native-6ac03019e68e6cd8732c5c1670eb71f4840010e2.tar.bz2
Add password field for WiFi configuration.
1. the certtool.h is modified for avoiding the side effect, for saving the configuration with wpa_supplicant. 2. put the loadLibrary back in CertTool.java 3. Fix incorrect JNI declarations.
Diffstat (limited to 'cmds/keystore')
-rw-r--r--cmds/keystore/certtool.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/cmds/keystore/certtool.h b/cmds/keystore/certtool.h
index 7cd316b..aefad66 100644
--- a/cmds/keystore/certtool.h
+++ b/cmds/keystore/certtool.h
@@ -26,21 +26,29 @@
#include "common.h"
#include "netkeystore.h"
+#define CERT_NAME_LEN (2 * MAX_KEY_NAME_LENGTH + 2)
+
/*
* The specific function 'get_cert' is used in daemons to get the key value
* from keystore. Caller should allocate the buffer and the length of the buffer
* should be MAX_KEY_VALUE_LENGTH.
*/
-static inline int get_cert(char *certname, unsigned char *value, int *size)
+static inline int get_cert(const char *certname, unsigned char *value, int *size)
{
int count, fd, ret = -1;
LPC_MARSHAL cmd;
char delimiter[] = "_";
char *namespace, *keyname;
char *context = NULL;
+ char cname[CERT_NAME_LEN];
+
+ if ((certname == NULL) || (value == NULL)) {
+ LOGE("get_cert: certname or value is null\n");
+ return -1;
+ }
- if (value == NULL) {
- LOGE("get_cert: value is null\n");
+ if (strlcpy(cname, certname, CERT_NAME_LEN) >= CERT_NAME_LEN) {
+ LOGE("get_cert: keyname is too long\n");
return -1;
}
@@ -53,7 +61,7 @@ static inline int get_cert(char *certname, unsigned char *value, int *size)
}
cmd.opcode = GET;
- if (((namespace = strtok_r(certname, delimiter, &context)) == NULL) ||
+ if (((namespace = strtok_r(cname, delimiter, &context)) == NULL) ||
((keyname = strtok_r(NULL, delimiter, &context)) == NULL)) {
goto err;
}