files: warn the root user when all the write bits are missing
Root has carte blanche to both read unreadable files and write unwritable files -- the file system does not prevent this. So, alert root when opening a file that is intended to be read-only. This fulfills https://savannah.gnu.org/bugs/?58685. Requested-by: Marius Bakke <mbakke@fastmail.com>master
parent
d18cfb26cd
commit
180a53cc0c
|
@ -401,6 +401,10 @@ bool open_buffer(const char *filename, bool new_one)
|
||||||
free(realname);
|
free(realname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (new_one && !(fileinfo.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)) &&
|
||||||
|
geteuid() == ROOT_UID)
|
||||||
|
statusline(ALERT, _("%s is meant to be read-only"), realname);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue