Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 603606 - sys-process/acct: init script should use checkpath instead of touch/chmod
Summary: sys-process/acct: init script should use checkpath instead of touch/chmod
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-23 18:39 UTC by Michael Orlitzky
Modified: 2017-01-07 21:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Orlitzky gentoo-dev 2016-12-23 18:39:10 UTC
The init script for acct creates its own log file:

  if [ ! -e "${ACCT_LOG}" ] ; then
    touch "${ACCT_LOG}"
    chmod 600 "${ACCT_LOG}"
  fi

That whole "if" statement can be replaced with a single call to "checkpath", from OpenRC. Doing so has two benefits: checkpath is more portable, being part of OpenRC, and it is also more secure, because it will not follow symlinks (as opposed to chmod, which will).

This minor improvement will also eliminate a bad example that could be copy/pasted into a more critical position by an unwary developer.
Comment 2 Michael Orlitzky gentoo-dev 2016-12-27 13:30:10 UTC
The fix is obviously correct, but a change to acct.initd will affect the stable acct-6.5.5-r3.ebuild. We try not to modify stable packages in-place, opting instead for a new revision. In this case you could do an acct.initd-r1 and then modify acct-6.6.*.ebuild in-place to use the new init script.

On the other hand, this change is at the level of "what could possibly go wrong," so the maintainers will have to decide =)
Comment 3 Wim Muskee 2017-01-03 07:51:07 UTC
added the revisions in the PR
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2017-01-07 21:32:58 UTC
$ git cherry-pick -x 34607e7a775cc87873fd4710513f923b36ba75dc -s
[master e5926f877e] sys-process/acct: initd implement checkpath, #603606
 Author: Wim Muskee <wimmuskee@gmail.com>
 Date: Tue Dec 27 11:31:17 2016 +0100
 3 files changed, 124 insertions(+)
 create mode 100644 sys-process/acct/acct-6.5.5-r4.ebuild
 create mode 100644 sys-process/acct/acct-6.6.2-r1.ebuild
 create mode 100644 sys-process/acct/files/acct.initd-r1