Bug 317071

Summary: fails to write pid file if server user changes
Product: [Retired] 389 Reporter: jmccann
Component: AdminAssignee: Rich Megginson <rmeggins>
Status: CLOSED WONTFIX QA Contact: Chandrasekar Kannan <ckannan>
Severity: low Docs Contact:
Priority: low    
Version: 1.1.0CC: benl, cschalle
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-30 16:31:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jmccann 2007-10-03 16:42:42 UTC
Description of problem:
If for whatever reason the server user changes (in my case it was rerunning the
the initial setup tool) the init script will report that the server fails to
start because it doesn't have permission to write the pid file.

My /var/run/dirsrv directory was owned by nobody:nobody and I had changed DS to
run as dirsrv.  I notice that the initscript in CVS has a little bit more logic
but not quite enough to fix this problem.

Maybe just something like:

Index: initscript.in
===================================================================
RCS file: /cvs/dirsec/adminserver/wrappers/initscript.in,v
retrieving revision 1.1
diff -p -u -8 -r1.1 initscript.in
--- initscript.in       15 Jun 2007 17:13:02 -0000      1.1
+++ initscript.in       3 Oct 2007 16:41:26 -0000
@@ -58,19 +58,17 @@ fix_pid_dir_ownership()
         dirowner=`ls -ld $piddir | awk '{print $3}'`
         dirgrp=`ls -ld $piddir | awk '{print $4}'`
         if [ "$owner" != "$dirowner" ]; then
             groups $owner | grep $dirgrp > /dev/null 2>&1
             rc=$?
             if [ $rc -eq 0 ]; then
                 chmod 770 $piddir
             else
-                echo_n "$piddir is not writable for $owner"
-                failure; echo
-                exit 1
+                chown $owner $piddir
             fi
         fi
     else
         mkdir -p $piddir
         owner=`grep \^nsslapd-localuser $1/dse.ldif | awk '{print $2}'`
         if [ -n "$owner" ] ; then
             chown $owner $piddir
             chmod 700 $piddir

Comment 1 Rich Megginson 2007-10-05 17:07:55 UTC
What version of Fedora DS was this?  Note that this is the admin server init
script, not the directory server init script.  Did you actually build and
install the fedora-ds-admin (dirsrv-admin) package?

Comment 2 jmccann 2007-10-05 17:20:17 UTC
I'm using the FDS in Fedora 7.  So my problem is with that version of the init
script.  Then I just tried to find the appropriate file to fix in CVS... looks
like I got the wrong one.  Sorry.  May still make sense though.

I'll make a new patch.

Comment 3 Rich Megginson 2007-10-05 17:26:24 UTC
(In reply to comment #2)
> I'm using the FDS in Fedora 7.  So my problem is with that version of the init
> script.  Then I just tried to find the appropriate file to fix in CVS... looks
> like I got the wrong one.  Sorry.  May still make sense though.

Ok.  The one in Fedora 7 is the 1.1 candidate.  In CVS this is
/cvs/dirsec/ldapserver/wrappers/initscript.in

> 
> I'll make a new patch.



Comment 4 Martin Kosek 2012-01-04 13:45:41 UTC
Upstream ticket:
https://fedorahosted.org/389/ticket/125