Bug 235096 - [patch] usr.bin/write broken capabilities checking
Summary: [patch] usr.bin/write broken capabilities checking
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-21 02:58 UTC by fullermd
Modified: 2019-03-09 21:15 UTC (History)
2 users (show)

See Also:


Attachments
patch (549 bytes, patch)
2019-01-21 02:58 UTC, fullermd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description fullermd 2019-01-21 02:58:07 UTC
Created attachment 201301 [details]
patch

In r306761 when write(1) was capsicumized, a call to setutxent() was added to load up the utx db before entering capabilities mode.  However, the other setutxent() calls in later functions were left in place, so the actual getutx*() calls would still fail, making write unable to find any users.

-CURRENT presumably needs a similar patch.  Attach patch applies cleanly to -CURRENT, but I've only tested on stable/12.
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2019-01-22 02:30:02 UTC
This looks good to me, and seems to fix write(1).
Comment 2 commit-hook freebsd_committer freebsd_triage 2019-01-23 20:02:26 UTC
A commit references this bug:

Author: markj
Date: Wed Jan 23 20:02:18 UTC 2019
New revision: 343354
URL: https://svnweb.freebsd.org/changeset/base/343354

Log:
  Remove extraneous setutxent() calls in write(1).

  We already call setutxent() once during initialization.  Furthermore,
  the subsequent calls occur after the process has entered capability
  mode, so they fail, and attempts to fetch database entries fail as
  a result.

  PR:		235096
  Submitted by:	fullermd@over-yonder.net
  MFC after:	3 days

Changes:
  head/usr.bin/write/write.c
Comment 3 fullermd 2019-03-09 21:02:21 UTC
Ping: doesn't seem to have made it down the MFC chute.
Comment 4 commit-hook freebsd_committer freebsd_triage 2019-03-09 21:10:16 UTC
A commit references this bug:

Author: markj
Date: Sat Mar  9 21:09:44 UTC 2019
New revision: 344973
URL: https://svnweb.freebsd.org/changeset/base/344973

Log:
  MFC r343354:
  Remove extraneous setutxent() calls in write(1).

  PR:	235096

Changes:
_U  stable/12/
  stable/12/usr.bin/write/write.c
Comment 5 Mark Johnston freebsd_committer freebsd_triage 2019-03-09 21:15:54 UTC
Thanks for poking me, not sure how I missed it.