Bug 170587 - pam_selinux.so will misreport errors on relabelling terminal devices
pam_selinux.so will misreport errors on relabelling terminal devices
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: pam (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tomas Mraz
Jay Turner
https://www.redhat.com/archives/fedor...
:
Depends On: 153711
Blocks: 168429
  Show dependency treegraph
 
Reported: 2005-10-13 02:49 EDT by Tomas Mraz
Modified: 2015-01-07 19:10 EST (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2006-0093
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-07 13:49:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tomas Mraz 2005-10-13 02:49:56 EDT
+++ This bug was initially created as a clone of Bug #153711 +++

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.0 (like Gecko)

Description of problem:
The below code from pam-0.78-selinux.patch has a bug.  It should use ptr  
instead of ttybuf when reporting the error so that if the strncmp() returns  
zero the correct data will be used.  This has been noted when su experiences  
sighup.  
  
+  if(strncmp("/dev/", tty, 5)) {  
+    snprintf(ttybuf,sizeof(ttybuf),"/dev/%s",tty);  
+    ptr = ttybuf;  
+  }  
+  else  
+    ptr = tty;  
+  
+  if (setfilecon(ptr, context))  
+  {  
+      syslog(LOG_NOTICE,  
+             _("Warning!  Could not relabel %s with %s, not relabeling.\n"),  
+             ttybuf,context);  
+  }  
  
Also note that in the case of a kill -1 on the sshd for a ssh login it's  
normal that the /dev/pts device will be gone before su notices anything has  
happened.  So maybe ENOENT should not even be logged in this case. 
 
The URL I've given is for the fedora-selinux-list discussion of this issue. 

Version-Release number of selected component (if applicable):
pam-0.78-5

How reproducible:
Always

Steps to Reproduce:
Login via ssh and su to another account.  Then kill -1 the sshd controlling 
the session.  Note that su logs a message such as the following: 
Apr  3 11:58:51 localhost su[3659]: Warning!  Could not relabel ,
\uffff\uff7f\u0661\uffff with user_u:object_r:devpts_t, not relabeling.
Comment 6 Red Hat Bugzilla 2006-03-07 13:49:59 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0093.html

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