Bug 16849 - If root's umask is 077 then only root can read the created /etc/minirc.dfl
Summary: If root's umask is 077 then only root can read the created /etc/minirc.dfl
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: minicom
Version: 6.2
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Crutcher Dunnavant
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-08-24 09:21 UTC by Jarno Huuskonen
Modified: 2008-05-01 15:37 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2000-08-24 23:32:45 UTC


Attachments (Terms of Use)

Description Jarno Huuskonen 2000-08-24 09:21:42 UTC
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.