Bug 4225 - acpid.c executes "wrong" script/binary
Summary: acpid.c executes "wrong" script/binary
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.19.x
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-21 12:28 UTC by pzy
Modified: 2011-09-21 12:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pzy 2011-09-21 12:28:25 UTC
while playing around with busybox acpid i found that if i add a line like
PWRF   /scripts/poweroff.sh
to acpid.conf where /scripts/poweroff.sh is an absolute path to a poweroff script then the code would check via stat if the file exists but would execute the file .//scripts/poweroff.sh in the current working directory (which is /etc/acpi).
I don't know if its correct that the scripts should only be executed if they are in /etc/acpi, in my case i wanted to execute a script with an absolute path so i changed the process_event-code in acpid.c line 120 to
        char *handler = xasprintf("%s", event);
patch1 attached

if its correct that the scripts should only be executed when they are in /etc/acpi i guess the stat in line 132 should be changed to
        if (0 == stat(handler, &st))

I guess one of these should be correct. Or the handler variable could be removed to use the event variable direct