gawindx / WinNUT-Client

This is a NUT windows client for monitoring your ups hooked up to your favorite linux server.
GNU General Public License v3.0
403 stars 70 forks source link

UPS_Network.AuthLogin does not send LOGIN #100

Closed dylan-kerr closed 3 years ago

dylan-kerr commented 3 years ago

AuthLogin sends the USERNAME and PASSWORD messages, which is sufficient for authentication of subsequent commands, but does not send the LOGIN message. This means that the UPS server does not associate this client with a particular UPS.

In practice, I observed this issue when the UPS goes into the FSD state - the primary/master upsmon on the UPS server sees that there are no secondary/slave clients and immediately shuts down the UPS without waiting for WinNUT-Client to notice the FSD flag and shut itself down.

I think I can see how to add the LOGIN step to AuthLogin, but wanted to raise this issue for discussion about how this should be done. From inspection of the upsd code this should be a safe change when the UPS server is https://github.com/networkupstools/nut, but other servers might have different LOGIN semantics (the protocol document doesn't explicitly specify when LOGIN should or should not be called). Should calling LOGIN be configurable, perhaps with a checkbox in the server settings? Or can we consider it a core part of the protocol that users shouldn't need to opt in or out of?

Thanks and regards, Dylan

gbakeman commented 3 years ago

Thank you for your contribution @dylan-kerr ! I'm sorry you went through the trouble, but we're in the middle of implementing a library that's going to abstract away most of the protocol functionality. Proper LOGIN/LOGOUT support will be one thing that's added. Hopefully we can address your issue soon.

dylan-kerr commented 3 years ago

Ok, good to know. I'll continue running my fork for now and look forward to seeing the new version!