Citeren Michal Hlavinka <[email protected]>:

How to reproduce this crash:
1)add ups to ups.conf, omit port configuration
2)run upsdrvctl stop


There is nothing checking ups configuration is ok for upsdrvctl. For daemon
there is check in server/conf.c upsconf_add. I've moved that checking code to
separate function upsconf.c : validate_upsconf and used this function from
upsconf_add and from upsdrvctl.c , this was more intrusive than it seemed. See
attached patch (tested). Simpler way would be just adding validate_upsconf to
upsdrvctl.c but it'd lead to code duplication. Any comments?

Thanks for your patch.

This part of the code if used for stopping legacy drivers (up to and including nut-2.0.4), which are by now more than four years old. Newer drivers (nut-2.0.5 and later) use a different naming scheme for the driver sockets (and PID file) and the value of 'port' is no longer used anymore for those.

Instead of validating the value of 'port', it is sufficient to check for NULL if the PID file is not in the nut-2.0.5 location. This also allows us to skip the 'port' variable where this is not needed (for instance the usbhid-ups driver). A revised version is now available in the SVN trunk.

Best regards, Arjen
--
Please keep list traffic on the list


_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev

Reply via email to