mirror of
https://github.com/owntracks/recorder.git
synced 2026-05-05 02:36:45 +00:00
lowercase user/device for decryption key
also spaces in device name are converted to dashes, so "Will-iPhone 6s" should now be key "will-iphone-6s" addresses #108
This commit is contained in:
@@ -977,7 +977,7 @@ This named lmdb database is keyed on topic name (`owntracks/jane/phone`). If the
|
||||
|
||||
#### `keys`
|
||||
|
||||
If the _recorder_ was built with encryption support (see below), this named database contains the secret decryption keys for users/device pairs. The LMDB key is the username followed by a dash followed by the device name, all lower case. For example, if user Jjolie with device iPhone needs a secret entered, the database key will be `jjolie-iphone`. This can be entered into the database as follows:
|
||||
If the _recorder_ was built with encryption support (see below), this named database contains the secret decryption keys for users/device pairs. The LMDB key is the username followed by a dash followed by the device name, all lower case, with spaces translated to a single dash. For example, if user Jjolie with device iPhone needs a secret entered, the database key will be `jjolie-iphone`. This can be entered into the database as follows:
|
||||
|
||||
```bash
|
||||
echo "jjolie-iphone s3cr1t" | ocat --load=keys
|
||||
|
||||
@@ -481,6 +481,12 @@ unsigned char *decrypt(struct udata *ud, char *topic, char *p64, char *username,
|
||||
utstring_renew(userdev);
|
||||
utstring_printf(userdev, "%s-%s", username, device);
|
||||
|
||||
lowercase(UB(userdev));
|
||||
for (n = 0; n < strlen(UB(userdev)); n++) {
|
||||
if (UB(userdev)[n] == ' ')
|
||||
UB(userdev)[n] = '-';
|
||||
}
|
||||
|
||||
memset(key, 0, sizeof(key));
|
||||
klen = gcache_get(ud->keydb, (char *)UB(userdev), (char *)key, sizeof(key));
|
||||
if (klen < 1) {
|
||||
|
||||
Reference in New Issue
Block a user