Can't connect without password
vmatrixx opened this issue · comments
Vladimir Terekhov commented
To connect via pms21 without password I've modified consume_key():
- Moved memset(key.octets, 0x20, KEY_LEN) to the function start
- Added return instead of fatal() in case of !tok.
Can you please modify the program to fix this?
Vitaly Sinilin commented
Hey, I have none of the supported devices in my possession anymore. Could you please verify if the provided patch resolves your problem?
Vladimir Terekhov commented
Yes, working code is:
Key consume_key(char **str)
{
Key key;
size_t keylen;
char *tok = consume_until_whitespace(str);
memset(key.octets, 0x20, KEY_LEN);
// Password isn't specified
if (!tok)
return key;
keylen = strlen(tok);
if (keylen > KEY_LEN) {
warn("Password too long, only first %u chars "
"will be considered", KEY_LEN);
keylen = KEY_LEN;
}
/* Key should be padded with trailing spaces */
memcpy(key.octets, tok, keylen);
return key;
}
Vitaly Sinilin commented
I didn't request a patch ;-) I asked to verify if my fix is working for you. Can you build from branch https://github.com/unterwulf/egctl/tree/optional_password and try it? Although fixes are just slightly different, still I want to make sure they do the same thing.
Vladimir Terekhov commented
I'm sorry, didn't notice link to the patch. :) Yes, it works fine, checked it just now