Bugtraq mailing list archives
Re: Symlinks and Cryogenic Sleep
From: pavel () SUSE CZ (Pavel Machek)
Date: Tue, 4 Jan 2000 22:47:09 +0100
Hi!
when you're dealing with files in /tmp that are supposed to be re-opened (rather than opened once and then discarded) there's an established way to do it which goes like this: if (lstat(fname, &stb1) >= 0 && S_ISREG(stb1.st_mode)) { fd = open(fname, O_RDWR); if (fd < 0 || fstat(fd, &stb2) < 0 || ino_or_dev_mismatch(&stb1, &stb2)) raise_big_stink()
If you add (at this place) if (lstat(fname, &stb2) < 0 || !S_ISREG(stb2.st_mode)) ino_or_dev_mismatch(&stb1, &stb2) it is safe. Idea is: once opened, dev/ino is stable, therefore if I followed link to interesting file, there's no way to create other regular file with same dev/ino.
Comments? Suggestions?
See above. Does it work? Pavel PS: Do you need to _symlink_ it? What about hardlinks? -- I'm pavel () ucw cz. "In my country we have almost anarchy and I don't care." Panos Katsaloulis describing me w.r.t. patents me at discuss () linmodems org
Current thread:
- Re: Symlinks and Cryogenic Sleep, (continued)
- Re: Symlinks and Cryogenic Sleep Casper Dik (Jan 04)
- Re: Symlinks and Cryogenic Sleep Olaf Kirch (Jan 04)
- Re: Symlinks and Cryogenic Sleep Henrik Nordstrom (Jan 04)
- First Telecom E-conso service totally insecure Thomas Quinot (Jan 03)
- Re: Symlinks and Cryogenic Sleep Goetz Babin-Ebell (Jan 04)
- Re: Symlinks and Cryogenic Sleep pedward () WEBCOM COM (Jan 04)
- Re: Symlinks and Cryogenic Sleep Christos Zoulas (Jan 04)
- Re: Symlinks and Cryogenic Sleep Mikael Olsson (Jan 05)
- Re: Symlinks and Cryogenic Sleep Marc Heuse (Jan 05)
- Re: Symlinks and Cryogenic Sleep Wietse Venema (Jan 04)
- Re: Symlinks and Cryogenic Sleep Pavel Machek (Jan 04)
- Security problem with Solstice Backup/Legato Networker recover command Chris Siebenmann (Jan 04)
- Local / Remote D.o.S Attack in IMail IMONITOR Server for WinNT Version 5.08 Ussr Labs (Jan 05)
- Re: Symlinks and Cryogenic Sleep Pavel Kankovsky (Jan 05)
- [RHSA-2000:002] New lpr packages available Bill Nottingham (Jan 07)
- Re: Symlinks and Cryogenic Sleep der Mouse (Jan 03)
- Re: Symlinks and Cryogenic Sleep Marc Heuse (Jan 04)
- Re: Symlinks and Cryogenic Sleep John Cochran (Jan 04)
- Re: Symlinks and Cryogenic Sleep Antonomasia (Jan 04)
- Re: Symlinks and Cryogenic Sleep Antonomasia (Jan 05)