Skip to content

Commit f249aa4

Browse files
strangelittlemonkeycorecode
authored andcommitted
dma - Fix security hole (#46)
Affecting DragonFly 4.6 and earlier, Matt Dillon fixed this in base after finding out from BSDNow Episode 152. Comments following were from his commit which explains better than I. Just taking his change and putting it here as well. * dma makes an age-old mistake of not properly checking whether a file owned by a user is a symlink or not, a bug which the original mail.local also had. * Add O_NOFOLLOW to disallow symlinks. Thanks-to: BSDNow Episode 152, made me dive dma to check when they talked about the mail.local bug.
1 parent 17a0f39 commit f249aa4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dma-mbox-create.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ main(int argc, char **argv)
142142
logfail(EX_CANTCREAT, "cannot build mbox path for `%s/%s'", _PATH_MAILDIR, user);
143143
}
144144

145-
f = open(fn, O_RDONLY|O_CREAT, 0600);
145+
f = open(fn, O_RDONLY|O_CREAT|O_NOFOLLOW, 0600);
146146
if (f < 0)
147147
logfail(EX_NOINPUT, "cannt open mbox `%s'", fn);
148148

0 commit comments

Comments
 (0)