Bug 49172 - do_netreport() hangs if ifup is run by non-root user
Summary: do_netreport() hangs if ifup is run by non-root user
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts   
(Show other bugs)
Version: 7.1
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-07-16 14:51 UTC by Need Real Name
Modified: 2014-03-17 02:21 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-07-16 18:31:32 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Need Real Name 2001-07-16 14:51:07 UTC
Description of Problem:
The function do_netreport in /etc/sysconfig/network-scripts/network-
functions uses 'su' to try to become the correct user to send the SIGIO 
signal to processes awaiting notification that the network has come up.  
That works find as long as ifup was run by root.  If a non-root user 
brings the network up then this su command hangs (awaiting a password, but 
input and output are redirected to /dev/null so that's not evident).

How Reproducible:

Steps to Reproduce:
1. Run something that places a file in /var/run/netreport requesting a 
signal when the network comes up.
2. Run ifup as a non-root user.

Actual Results:
do_netreport() will hang.

Expected Results:
Attempt to send signal fails (or no attempt is made to send signals) if 
the caller of do_netreport() is not root.

Additional Information:
This modification to the function should solve the problem:

do_netreport ()
  # No notifications if not root
  uid=`id | sed -e 's/^uid=//' -e 's/(.*//'`
  if [ "${uid}" = "0" ] ; then
    # Notify programs that have requested notification
    ( cd /var/run/netreport || exit
      for i in * ; do
	if [ -f $i ]; then
	  OWNER=`ls -l $i | awk '{ print $3 }'`
	  su $OWNER -c "kill -SIGIO $i >/dev/null 2>&1" > /dev/null 2>&1 
|| \
	     rm -f $i >/dev/null 2>&1

Comment 1 Bill Nottingham 2001-07-16 18:37:10 UTC
actually, you still need to run the 'kill' if you're non-root, so for that
case you just want to take the 'su' out (it will silently fail if it's
the wrong process.)

Will be fixed in 6.03-1.

Note You need to log in before you can comment on or make changes to this bug.