From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10952f,b69d377feb5a8a2 X-Google-Attributes: gid10952f,public X-Google-Thread: 10872d,d4c1f7c0fe672a4 X-Google-Attributes: gid10872d,public X-Google-Thread: fcda7,d4c1f7c0fe672a4 X-Google-Attributes: gidfcda7,public X-Google-Thread: 1020c6,d4c1f7c0fe672a4 X-Google-Attributes: gid1020c6,public X-Google-Thread: 1164f8,d4c1f7c0fe672a4 X-Google-Attributes: gid1164f8,public X-Google-Thread: 1070f0,d4c1f7c0fe672a4 X-Google-Attributes: gid1070f0,public From: Chris Calabrese Subject: Re: Yet Another Ultimate TMP-cleaner algorithm! Date: 1998/09/23 Message-ID: <36091904.EA44578F@fpk.hp.com>#1/1 X-Deja-AN: 394029553 Content-Transfer-Encoding: 7bit References: <35F71814.1E0B911C@iakom.com> <36079B1B.2781@s054.aone.net.au> <6u88qm$t5u@web.nmti.com> <3607C878.85DA16C1@fpk.hp.com> <6u8n1s$667@web.nmti.com> Content-Type: text/plain; charset=us-ascii Organization: Hewlett Packard Engineering Services Group (Consultant) Mime-Version: 1.0 Newsgroups: comp.unix.admin,comp.sys.hp.hpux,comp.sys.sgi.admin,comp.sys.sun.admin,comp.sys.dec,comp.security.unix Peter da Silva wrote: > > >However, we don't actually have to check the whole path, just > >the last component if we check device/inode of .. vs . instead of > >names > > That won't help if the file they're trying to trick you into unlinking > is also in /tmp. And yes, there can be security issues in removing temp > files and replacing them with whatever you want. As Peter pointed out in a private e-mail exchange, my method will get the right path of parents, but I forgot about verifying the name of '.'. The solution is to add something like this to my previously posted pseudo-code ... dotbynamestatus=stat("../" + name); if dotstatus.inode != dotbynamestatus.inode || dotstatus.device != dotbynamestatus.inode error! -- Christopher J. Calabrese ES Architect and DR/Audit/Security/y2k Coordinator (Consultant) Hewlett Packard Engineering Services Group cjc@fpk.hp.com