unterwulf / egctl

EnerGenie EG-PMS-LAN control utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't connect without password

vmatrixx opened this issue · comments

To connect via pms21 without password I've modified consume_key():

  1. Moved memset(key.octets, 0x20, KEY_LEN) to the function start
  2. Added return instead of fatal() in case of !tok.

Can you please modify the program to fix this?

Hey, I have none of the supported devices in my possession anymore. Could you please verify if the provided patch resolves your problem?

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;
}

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.

I'm sorry, didn't notice link to the patch. :) Yes, it works fine, checked it just now