Bug 16849 - If root's umask is 077 then only root can read the created /etc/minirc.dfl
If root's umask is 077 then only root can read the created /etc/minirc.dfl
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: minicom (Show other bugs)
6.2
All Linux
low Severity low
: ---
: ---
Assigned To: Crutcher Dunnavant
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-08-24 05:21 EDT by Jarno Huuskonen
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-08-24 19:32:45 EDT
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 Jarno Huuskonen 2000-08-24 05:21:42 EDT
Summary says it all.

Here's an ugly (very briefly tested!!) patch:

-Jarno

--- src/config.c-old    Thu Aug 24 12:18:55 2000
+++ src/config.c        Thu Aug 24 12:19:51 2000
@@ -1221,13 +1221,17 @@
 
   /* Root saves new configuration */
   if (real_uid == 0) {
-       if ((fp = fopen(parfile, "w")) == (FILE *)NULL) {
+               /* Jarno if umask is 077 then only root can read the
config*/
+               if ((fp = fopen(parfile, "w")) == (FILE *)NULL) {
                werror(_("Cannot write to %s"), parfile);
                return(-1);
        }

        writepars(fp, 1);
-       fclose(fp);
-       werror(_("Configuration saved"));
+               fclose(fp);
+               /* Try to chmod the file */
+               chmod( parfile, (mode_t) 0644 );
+
+               werror(_("Configuration saved"));
   } else {
        /* Mortals save their own configuration */
        if ((fp = sfopen(pparfile, "w")) == (FILE *)NULL) {

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