[Fedora-directory-commits] adminserver/admserv/newinst/src ux-update.cc, 1.13, 1.14

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Thu Nov 10 01:13:07 UTC 2005


Author: rmeggins

Update of /cvs/dirsec/adminserver/admserv/newinst/src
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13048/adminserver/admserv/newinst/src

Modified Files:
	ux-update.cc 
Log Message:
Bug(s) fixed: 172816
Bug Description: use system perl for AS PERL5; make files owned by AS uid
Reviewed by: Noriko (Thanks!)
Fix Description: 1) I made a similar fix to adminutil to use the system 
perl for the PERL5 macro on all Linux systems.  2) The files admpw, 
adm.conf, and console.conf are read and/or written by the httpd process, 
which is owned by the SSuser (default nobody), so they must be owned by 
that user.
Platforms tested: FC4
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none



Index: ux-update.cc
===================================================================
RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/ux-update.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ux-update.cc	28 Oct 2005 22:44:18 -0000	1.13
+++ ux-update.cc	10 Nov 2005 01:12:59 -0000	1.14
@@ -441,6 +441,24 @@
 }
 
 void
+chown_file(const char *user, const char *group, const char *file)
+{
+    /* only do this if we are root */
+    uid_t my_uid = geteuid();
+
+    if (my_uid == 0) {
+        char tmp[BIG_BUF];
+
+        snprintf(tmp, sizeof(tmp), CHOWN_CMD, user, file);
+        tmp[sizeof(tmp)-1] = 0;
+        system(tmp);
+        snprintf(tmp, sizeof(tmp), CHGRP_CMD, group, file);
+        tmp[sizeof(tmp)-1] = 0;
+        system(tmp);
+    }
+}    
+
+void
 create_admserv(char *hn, const char *sroot)
 {
    char httpuser[SML_BUF], httppw[SML_BUF];
@@ -599,7 +617,7 @@
    fprintf(f, "%s:{SHA}%s", httpuser, pw);
    fclose(f);
    chmod(tstr, S_IRUSR | S_IWUSR);
-
+   chown_file(SSuser, SSgroup, tstr);
    logUninstallInfo(sroot, "admin", "admin", tstr);
 
    /* create admin-serv/modules directory */
@@ -1032,7 +1050,7 @@
    admConf.setFormat(2);
    admConf.write(tstr);
    chmod(tstr, S_IRUSR | S_IWUSR);
-
+   chown_file(SSuser, SSgroup, tstr);
    logUninstallInfo(sroot, "admin", "admin", tstr);
 
    // Mark to remove the following guys which are
@@ -1127,6 +1145,7 @@
    snprintf(src, sizeof(tstr), "%s/shared/config/template/console.conf.tmpl", sroot);
    replaceTokensInFile(src, tstr, consolearray);
    chmod(tstr, S_IRUSR | S_IWUSR);
+   chown_file(SSuser, SSgroup, tstr);
    logUninstallInfo(sroot, "admin", "admin", tstr);
 
    snprintf(tstr, sizeof(tstr), "%s/start-admin", sroot);




More information about the Fedora-directory-commits mailing list