node-dbus-next icon indicating copy to clipboard operation
node-dbus-next copied to clipboard

Exception thrown when getUserHome() returns undefined.

Open martenjacobs opened this issue 6 years ago • 4 comments

As mentioned in #23 There's a issue with this line: https://github.com/acrisci/node-dbus-next/blob/4283e0e535cf6ca519e8d839bc9216ec30b45830/lib/handshake.js#L21 On my set-up, getUserHome() returns undefined (this may be due to mine running in the Electron renderer process). This causes path.join to fail (this happens in the upstream repo as well).

martenjacobs avatar May 02 '19 19:05 martenjacobs

I think we can lookup the home directory from /etc/passwd from the user indicated by process.getuid() when the HOME variable is not present.

https://github.com/sindresorhus/passwd-user

acrisci avatar May 02 '19 22:05 acrisci

Ah ok I'm testing the handshake.js code and it's all very broken, but I do have a partial fix using that library.

acrisci avatar May 02 '19 23:05 acrisci

I don’t think using /etc/passwd would work on macOS, so I don’t know who that fix would benefit. I’d say expected behaviour in this case would be to fall back to the next authentication method

martenjacobs avatar May 03 '19 04:05 martenjacobs

Yeah it's the fallback that isn't implemented in the legacy code. Getting the home directory is only required for the sha1 authentication which I think is a Windows only feature and I'm not going to support Windows unless someone else wants to do it.

acrisci avatar May 03 '19 15:05 acrisci