summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-19 06:43:58 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-19 06:43:58 +0000
commite60deb155585c410b85d417002d1f4f32062de19 (patch)
treea2c527cf4353e88720cdc094e3fa2cc55dd8fd5d /file.c
parent87bf8b1dc31de2eaeafe5e75eaa04571926302ea (diff)
* file.c (path_check_1): should check directory sticky bits.
* process.c (security): need not to warn twice. * marshal.c (r_object): complete restoration before calling r_regist(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/file.c b/file.c
index 1eea9360e4..3016589b91 100644
--- a/file.c
+++ b/file.c
@@ -2304,7 +2304,14 @@ path_check_1(path)
return path_check_1(newpath);
}
for (;;) {
- if (stat(p0, &st) == 0 && (st.st_mode & 002)) {
+#ifndef S_IWOTH
+# define S_IWOTH 002
+#endif
+ if (stat(p0, &st) == 0 && S_ISDIR(st->st_mode) && (st.st_mode & S_IWOTH)
+#ifdef S_ISVTX
+ && !(st.st_mode & S_ISVTX)
+#endif
+ ) {
if (p) *p = '/';
rb_warn("Unsecure world writeable dir %s , mode 0%o", p0, st.st_mode);
return 0;