Bug 49172 - do_netreport() hangs if ifup is run by non-root user
do_netreport() hangs if ifup is run by non-root user
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-07-16 10:51 EDT by Need Real Name
Modified: 2014-03-16 22:21 EDT (History)
1 user (show)

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

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2001-07-16 10:51:07 EDT
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 14:37:10 EDT
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.