librelist archives

« back to archive

procer should create log file before dropping privs

procer should create log file before dropping privs

From:
Justin Karneges
Date:
2012-03-12 @ 18:53
In Action_exec(), I've reordered the code in my local copy to this:

    if(pid == 0) {
        if( (procer_run_log = getenv("PROCER_RUN_LOG")) == NULL)
            procer_run_log = "run.log";
        redirect_output(procer_run_log);

        rc = Unixy_drop_priv(action->profile_dir);

This way, both run.log and error.log get created as root.  Without this, 
run.log normally gets opened with whatever permission the current profile has, 
and this can cause problems depending on profile load order (for example root 
owned profile starts first, creates log file, then user owned profile starts next 
and can't append to the log).

Justin