Skip to content

fix(net_ssh): use filename parameter instead of hardcoded RSA path in bind_key#57

Merged
InterLinked1 merged 1 commit into
InterLinked1:masterfrom
unle4rn:fix/net-ssh-bind-key-filename
Jun 6, 2026
Merged

fix(net_ssh): use filename parameter instead of hardcoded RSA path in bind_key#57
InterLinked1 merged 1 commit into
InterLinked1:masterfrom
unle4rn:fix/net-ssh-bind-key-filename

Conversation

@unle4rn

@unle4rn unle4rn commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Bug

bind_key() in nets/net_ssh.c (line 112) passes a hardcoded KEYS_FOLDER "ssh_host_rsa_key" to ssh_bind_options_set() regardless of the filename argument, causing all non-RSA key types to fail to load.

Current code

static int bind_key(enum ssh_bind_options_e opt, const char *filename)
{
    if (eaccess(filename, R_OK)) {
        bbs_warning("Can't access key %s - missing or not readable?\n", filename);
        return 0;
    }
    return ssh_bind_options_set(sshbind, opt, KEYS_FOLDER "ssh_host_rsa_key") ? 0 : 1;
}

Expected

    return ssh_bind_options_set(sshbind, opt, filename) ? 0 : 1;

Impact

If the system only has an ed25519 key (no RSA key), net_ssh fails to start with:

ERROR: net_ssh.c:145 start_ssh: Failed to configure listener, unable to bind any SSH keys

The eaccess() check passes for the ed25519 key, but then ssh_bind_options_set is called with the RSA path which doesn't exist, so it silently fails and returns 0 keys bound.

Environment

  • LBBS master branch (cloned 2026-06-06)
  • Debian 13 (Trixie), libssh 0.11.2
  • Config: [keys] with only ed25519 = yes, rsa/dsa/ecdsa = no

Fix

One-line change — replace the hardcoded string with the filename parameter on line 112.

… bind_key

bind_key() was always passing KEYS_FOLDER "ssh_host_rsa_key" to
ssh_bind_options_set() regardless of which key type was being bound.
This caused net_ssh to fail to start on systems with only ed25519
(or ecdsa/dsa) keys and no RSA key present.
@InterLinked1

Copy link
Copy Markdown
Owner

This smells like an AI pull request. Did you actually investigate/test any of this?

@unle4rn

unle4rn commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

This smells like an AI pull request. Did you actually investigate/test any of this?

The PR body is AI written yes (no shame), but, of course I tested it, as that is how I was able to get this to work regardless :P you can review the change yourself as it's a pretty common sense change.

@InterLinked1 InterLinked1 merged commit f5d4658 into InterLinked1:master Jun 6, 2026
40 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants